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,296 bytes, lines 1902-6432
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.4.1 (https://getbootstrap.com/) 1911 * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 1912 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/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 $ = $ && $.hasOwnProperty('default') ? $['default'] : $; 1920 Popper = Popper && Popper.hasOwnProperty('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 _defineProperty(obj, key, value) { 1939 if (key in obj) { 1940 Object.defineProperty(obj, key, { 1941 value: value, 1942 enumerable: true, 1943 configurable: true, 1944 writable: true 1945 }); 1946 } else { 1947 obj[key] = value; 1948 } 1949 1950 return obj; 1951 } 1952 1953 function ownKeys(object, enumerableOnly) { 1954 var keys = Object.keys(object); 1955 1956 if (Object.getOwnPropertySymbols) { 1957 var symbols = Object.getOwnPropertySymbols(object); 1958 if (enumerableOnly) symbols = symbols.filter(function (sym) { 1959 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 1960 }); 1961 keys.push.apply(keys, symbols); 1962 } 1963 1964 return keys; 1965 } 1966 1967 function _objectSpread2(target) { 1968 for (var i = 1; i < arguments.length; i++) { 1969 var source = arguments[i] != null ? arguments[i] : {}; 1970 1971 if (i % 2) { 1972 ownKeys(Object(source), true).forEach(function (key) { 1973 _defineProperty(target, key, source[key]); 1974 }); 1975 } else if (Object.getOwnPropertyDescriptors) { 1976 Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); 1977 } else { 1978 ownKeys(Object(source)).forEach(function (key) { 1979 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 1980 }); 1981 } 1982 } 1983 1984 return target; 1985 } 1986 1987 function _inheritsLoose(subClass, superClass) { 1988 subClass.prototype = Object.create(superClass.prototype); 1989 subClass.prototype.constructor = subClass; 1990 subClass.__proto__ = superClass; 1991 } 1992 1993 /** 1994 * -------------------------------------------------------------------------- 1995 * Bootstrap (v4.4.1): util.js 1996 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 1997 * -------------------------------------------------------------------------- 1998 */ 1999 /** 2000 * ------------------------------------------------------------------------ 2001 * Private TransitionEnd Helpers 2002 * ------------------------------------------------------------------------ 2003 */ 2004 2005 var TRANSITION_END = 'transitionend'; 2006 var MAX_UID = 1000000; 2007 var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp) 2008 2009 function toType(obj) { 2010 return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase(); 2011 } 2012 2013 function getSpecialTransitionEndEvent() { 2014 return { 2015 bindType: TRANSITION_END, 2016 delegateType: TRANSITION_END, 2017 handle: function handle(event) { 2018 if ($(event.target).is(this)) { 2019 return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params 2020 } 2021 2022 return undefined; // eslint-disable-line no-undefined 2023 } 2024 }; 2025 } 2026 2027 function transitionEndEmulator(duration) { 2028 var _this = this; 2029 2030 var called = false; 2031 $(this).one(Util.TRANSITION_END, function () { 2032 called = true; 2033 }); 2034 setTimeout(function () { 2035 if (!called) { 2036 Util.triggerTransitionEnd(_this); 2037 } 2038 }, duration); 2039 return this; 2040 } 2041 2042 function setTransitionEndSupport() { 2043 $.fn.emulateTransitionEnd = transitionEndEmulator; 2044 $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); 2045 } 2046 /** 2047 * -------------------------------------------------------------------------- 2048 * Public Util Api 2049 * -------------------------------------------------------------------------- 2050 */ 2051 2052 2053 var Util = { 2054 TRANSITION_END: 'bsTransitionEnd', 2055 getUID: function getUID(prefix) { 2056 do { 2057 // eslint-disable-next-line no-bitwise 2058 prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here 2059 } while (document.getElementById(prefix)); 2060 2061 return prefix; 2062 }, 2063 getSelectorFromElement: function getSelectorFromElement(element) { 2064 var selector = element.getAttribute('data-target'); 2065 2066 if (!selector || selector === '#') { 2067 var hrefAttr = element.getAttribute('href'); 2068 selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : ''; 2069 } 2070 2071 try { 2072 return document.querySelector(selector) ? selector : null; 2073 } catch (err) { 2074 return null; 2075 } 2076 }, 2077 getTransitionDurationFromElement: function getTransitionDurationFromElement(element) { 2078 if (!element) { 2079 return 0; 2080 } // Get transition-duration of the element 2081 2082 2083 var transitionDuration = $(element).css('transition-duration'); 2084 var transitionDelay = $(element).css('transition-delay'); 2085 var floatTransitionDuration = parseFloat(transitionDuration); 2086 var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found 2087 2088 if (!floatTransitionDuration && !floatTransitionDelay) { 2089 return 0; 2090 } // If multiple durations are defined, take the first 2091 2092 2093 transitionDuration = transitionDuration.split(',')[0]; 2094 transitionDelay = transitionDelay.split(',')[0]; 2095 return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; 2096 }, 2097 reflow: function reflow(element) { 2098 return element.offsetHeight; 2099 }, 2100 triggerTransitionEnd: function triggerTransitionEnd(element) { 2101 $(element).trigger(TRANSITION_END); 2102 }, 2103 // TODO: Remove in v5 2104 supportsTransitionEnd: function supportsTransitionEnd() { 2105 return Boolean(TRANSITION_END); 2106 }, 2107 isElement: function isElement(obj) { 2108 return (obj[0] || obj).nodeType; 2109 }, 2110 typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { 2111 for (var property in configTypes) { 2112 if (Object.prototype.hasOwnProperty.call(configTypes, property)) { 2113 var expectedTypes = configTypes[property]; 2114 var value = config[property]; 2115 var valueType = value && Util.isElement(value) ? 'element' : toType(value); 2116 2117 if (!new RegExp(expectedTypes).test(valueType)) { 2118 throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\".")); 2119 } 2120 } 2121 } 2122 }, 2123 findShadowRoot: function findShadowRoot(element) { 2124 if (!document.documentElement.attachShadow) { 2125 return null; 2126 } // Can find the shadow root otherwise it'll return the document 2127 2128 2129 if (typeof element.getRootNode === 'function') { 2130 var root = element.getRootNode(); 2131 return root instanceof ShadowRoot ? root : null; 2132 } 2133 2134 if (element instanceof ShadowRoot) { 2135 return element; 2136 } // when we don't find a shadow root 2137 2138 2139 if (!element.parentNode) { 2140 return null; 2141 } 2142 2143 return Util.findShadowRoot(element.parentNode); 2144 }, 2145 jQueryDetection: function jQueryDetection() { 2146 if (typeof $ === 'undefined') { 2147 throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.'); 2148 } 2149 2150 var version = $.fn.jquery.split(' ')[0].split('.'); 2151 var minMajor = 1; 2152 var ltMajor = 2; 2153 var minMinor = 9; 2154 var minPatch = 1; 2155 var maxMajor = 4; 2156 2157 if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) { 2158 throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0'); 2159 } 2160 } 2161 }; 2162 Util.jQueryDetection(); 2163 setTransitionEndSupport(); 2164 2165 /** 2166 * ------------------------------------------------------------------------ 2167 * Constants 2168 * ------------------------------------------------------------------------ 2169 */ 2170 2171 var NAME = 'alert'; 2172 var VERSION = '4.4.1'; 2173 var DATA_KEY = 'bs.alert'; 2174 var EVENT_KEY = "." + DATA_KEY; 2175 var DATA_API_KEY = '.data-api'; 2176 var JQUERY_NO_CONFLICT = $.fn[NAME]; 2177 var Selector = { 2178 DISMISS: '[data-dismiss="alert"]' 2179 }; 2180 var Event = { 2181 CLOSE: "close" + EVENT_KEY, 2182 CLOSED: "closed" + EVENT_KEY, 2183 CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY 2184 }; 2185 var ClassName = { 2186 ALERT: 'alert', 2187 FADE: 'fade', 2188 SHOW: 'show' 2189 }; 2190 /** 2191 * ------------------------------------------------------------------------ 2192 * Class Definition 2193 * ------------------------------------------------------------------------ 2194 */ 2195 2196 var Alert = 2197 /*#__PURE__*/ 2198 function () { 2199 function Alert(element) { 2200 this._element = element; 2201 } // Getters 2202 2203 2204 var _proto = Alert.prototype; 2205 2206 // Public 2207 _proto.close = function close(element) { 2208 var rootElement = this._element; 2209 2210 if (element) { 2211 rootElement = this._getRootElement(element); 2212 } 2213 2214 var customEvent = this._triggerCloseEvent(rootElement); 2215 2216 if (customEvent.isDefaultPrevented()) { 2217 return; 2218 } 2219 2220 this._removeElement(rootElement); 2221 }; 2222 2223 _proto.dispose = function dispose() { 2224 $.removeData(this._element, DATA_KEY); 2225 this._element = null; 2226 } // Private 2227 ; 2228 2229 _proto._getRootElement = function _getRootElement(element) { 2230 var selector = Util.getSelectorFromElement(element); 2231 var parent = false; 2232 2233 if (selector) { 2234 parent = document.querySelector(selector); 2235 } 2236 2237 if (!parent) { 2238 parent = $(element).closest("." + ClassName.ALERT)[0]; 2239 } 2240 2241 return parent; 2242 }; 2243 2244 _proto._triggerCloseEvent = function _triggerCloseEvent(element) { 2245 var closeEvent = $.Event(Event.CLOSE); 2246 $(element).trigger(closeEvent); 2247 return closeEvent; 2248 }; 2249 2250 _proto._removeElement = function _removeElement(element) { 2251 var _this = this; 2252 2253 $(element).removeClass(ClassName.SHOW); 2254 2255 if (!$(element).hasClass(ClassName.FADE)) { 2256 this._destroyElement(element); 2257 2258 return; 2259 } 2260 2261 var transitionDuration = Util.getTransitionDurationFromElement(element); 2262 $(element).one(Util.TRANSITION_END, function (event) { 2263 return _this._destroyElement(element, event); 2264 }).emulateTransitionEnd(transitionDuration); 2265 }; 2266 2267 _proto._destroyElement = function _destroyElement(element) { 2268 $(element).detach().trigger(Event.CLOSED).remove(); 2269 } // Static 2270 ; 2271 2272 Alert._jQueryInterface = function _jQueryInterface(config) { 2273 return this.each(function () { 2274 var $element = $(this); 2275 var data = $element.data(DATA_KEY); 2276 2277 if (!data) { 2278 data = new Alert(this); 2279 $element.data(DATA_KEY, data); 2280 } 2281 2282 if (config === 'close') { 2283 data[config](this); 2284 } 2285 }); 2286 }; 2287 2288 Alert._handleDismiss = function _handleDismiss(alertInstance) { 2289 return function (event) { 2290 if (event) { 2291 event.preventDefault(); 2292 } 2293 2294 alertInstance.close(this); 2295 }; 2296 }; 2297 2298 _createClass(Alert, null, [{ 2299 key: "VERSION", 2300 get: function get() { 2301 return VERSION; 2302 } 2303 }]); 2304 2305 return Alert; 2306 }(); 2307 /** 2308 * ------------------------------------------------------------------------ 2309 * Data Api implementation 2310 * ------------------------------------------------------------------------ 2311 */ 2312 2313 2314 $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert())); 2315 /** 2316 * ------------------------------------------------------------------------ 2317 * jQuery 2318 * ------------------------------------------------------------------------ 2319 */ 2320 2321 $.fn[NAME] = Alert._jQueryInterface; 2322 $.fn[NAME].Constructor = Alert; 2323 2324 $.fn[NAME].noConflict = function () { 2325 $.fn[NAME] = JQUERY_NO_CONFLICT; 2326 return Alert._jQueryInterface; 2327 }; 2328 2329 /** 2330 * ------------------------------------------------------------------------ 2331 * Constants 2332 * ------------------------------------------------------------------------ 2333 */ 2334 2335 var NAME$1 = 'button'; 2336 var VERSION$1 = '4.4.1'; 2337 var DATA_KEY$1 = 'bs.button'; 2338 var EVENT_KEY$1 = "." + DATA_KEY$1; 2339 var DATA_API_KEY$1 = '.data-api'; 2340 var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1]; 2341 var ClassName$1 = { 2342 ACTIVE: 'active', 2343 BUTTON: 'btn', 2344 FOCUS: 'focus' 2345 }; 2346 var Selector$1 = { 2347 DATA_TOGGLE_CARROT: '[data-toggle^="button"]', 2348 DATA_TOGGLES: '[data-toggle="buttons"]', 2349 DATA_TOGGLE: '[data-toggle="button"]', 2350 DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn', 2351 INPUT: 'input:not([type="hidden"])', 2352 ACTIVE: '.active', 2353 BUTTON: '.btn' 2354 }; 2355 var Event$1 = { 2356 CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1, 2357 FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1), 2358 LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1 2359 }; 2360 /** 2361 * ------------------------------------------------------------------------ 2362 * Class Definition 2363 * ------------------------------------------------------------------------ 2364 */ 2365 2366 var Button = 2367 /*#__PURE__*/ 2368 function () { 2369 function Button(element) { 2370 this._element = element; 2371 } // Getters 2372 2373 2374 var _proto = Button.prototype; 2375 2376 // Public 2377 _proto.toggle = function toggle() { 2378 var triggerChangeEvent = true; 2379 var addAriaPressed = true; 2380 var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0]; 2381 2382 if (rootElement) { 2383 var input = this._element.querySelector(Selector$1.INPUT); 2384 2385 if (input) { 2386 if (input.type === 'radio') { 2387 if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) { 2388 triggerChangeEvent = false; 2389 } else { 2390 var activeElement = rootElement.querySelector(Selector$1.ACTIVE); 2391 2392 if (activeElement) { 2393 $(activeElement).removeClass(ClassName$1.ACTIVE); 2394 } 2395 } 2396 } else if (input.type === 'checkbox') { 2397 if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) { 2398 triggerChangeEvent = false; 2399 } 2400 } else { 2401 // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input 2402 triggerChangeEvent = false; 2403 } 2404 2405 if (triggerChangeEvent) { 2406 input.checked = !this._element.classList.contains(ClassName$1.ACTIVE); 2407 $(input).trigger('change'); 2408 } 2409 2410 input.focus(); 2411 addAriaPressed = false; 2412 } 2413 } 2414 2415 if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) { 2416 if (addAriaPressed) { 2417 this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE)); 2418 } 2419 2420 if (triggerChangeEvent) { 2421 $(this._element).toggleClass(ClassName$1.ACTIVE); 2422 } 2423 } 2424 }; 2425 2426 _proto.dispose = function dispose() { 2427 $.removeData(this._element, DATA_KEY$1); 2428 this._element = null; 2429 } // Static 2430 ; 2431 2432 Button._jQueryInterface = function _jQueryInterface(config) { 2433 return this.each(function () { 2434 var data = $(this).data(DATA_KEY$1); 2435 2436 if (!data) { 2437 data = new Button(this); 2438 $(this).data(DATA_KEY$1, data); 2439 } 2440 2441 if (config === 'toggle') { 2442 data[config](); 2443 } 2444 }); 2445 }; 2446 2447 _createClass(Button, null, [{ 2448 key: "VERSION", 2449 get: function get() { 2450 return VERSION$1; 2451 } 2452 }]); 2453 2454 return Button; 2455 }(); 2456 /** 2457 * ------------------------------------------------------------------------ 2458 * Data Api implementation 2459 * ------------------------------------------------------------------------ 2460 */ 2461 2462 2463 $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) { 2464 var button = event.target; 2465 2466 if (!$(button).hasClass(ClassName$1.BUTTON)) { 2467 button = $(button).closest(Selector$1.BUTTON)[0]; 2468 } 2469 2470 if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) { 2471 event.preventDefault(); // work around Firefox bug #1540995 2472 } else { 2473 var inputBtn = button.querySelector(Selector$1.INPUT); 2474 2475 if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) { 2476 event.preventDefault(); // work around Firefox bug #1540995 2477 2478 return; 2479 } 2480 2481 Button._jQueryInterface.call($(button), 'toggle'); 2482 } 2483 }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) { 2484 var button = $(event.target).closest(Selector$1.BUTTON)[0]; 2485 $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type)); 2486 }); 2487 $(window).on(Event$1.LOAD_DATA_API, function () { 2488 // ensure correct active class is set to match the controls' actual values/states 2489 // find all checkboxes/readio buttons inside data-toggle groups 2490 var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS)); 2491 2492 for (var i = 0, len = buttons.length; i < len; i++) { 2493 var button = buttons[i]; 2494 var input = button.querySelector(Selector$1.INPUT); 2495 2496 if (input.checked || input.hasAttribute('checked')) { 2497 button.classList.add(ClassName$1.ACTIVE); 2498 } else { 2499 button.classList.remove(ClassName$1.ACTIVE); 2500 } 2501 } // find all button toggles 2502 2503 2504 buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE)); 2505 2506 for (var _i = 0, _len = buttons.length; _i < _len; _i++) { 2507 var _button = buttons[_i]; 2508 2509 if (_button.getAttribute('aria-pressed') === 'true') { 2510 _button.classList.add(ClassName$1.ACTIVE); 2511 } else { 2512 _button.classList.remove(ClassName$1.ACTIVE); 2513 } 2514 } 2515 }); 2516 /** 2517 * ------------------------------------------------------------------------ 2518 * jQuery 2519 * ------------------------------------------------------------------------ 2520 */ 2521 2522 $.fn[NAME$1] = Button._jQueryInterface; 2523 $.fn[NAME$1].Constructor = Button; 2524 2525 $.fn[NAME$1].noConflict = function () { 2526 $.fn[NAME$1] = JQUERY_NO_CONFLICT$1; 2527 return Button._jQueryInterface; 2528 }; 2529 2530 /** 2531 * ------------------------------------------------------------------------ 2532 * Constants 2533 * ------------------------------------------------------------------------ 2534 */ 2535 2536 var NAME$2 = 'carousel'; 2537 var VERSION$2 = '4.4.1'; 2538 var DATA_KEY$2 = 'bs.carousel'; 2539 var EVENT_KEY$2 = "." + DATA_KEY$2; 2540 var DATA_API_KEY$2 = '.data-api'; 2541 var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2]; 2542 var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key 2543 2544 var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key 2545 2546 var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch 2547 2548 var SWIPE_THRESHOLD = 40; 2549 var Default = { 2550 interval: 5000, 2551 keyboard: true, 2552 slide: false, 2553 pause: 'hover', 2554 wrap: true, 2555 touch: true 2556 }; 2557 var DefaultType = { 2558 interval: '(number|boolean)', 2559 keyboard: 'boolean', 2560 slide: '(boolean|string)', 2561 pause: '(string|boolean)', 2562 wrap: 'boolean', 2563 touch: 'boolean' 2564 }; 2565 var Direction = { 2566 NEXT: 'next', 2567 PREV: 'prev', 2568 LEFT: 'left', 2569 RIGHT: 'right' 2570 }; 2571 var Event$2 = { 2572 SLIDE: "slide" + EVENT_KEY$2, 2573 SLID: "slid" + EVENT_KEY$2, 2574 KEYDOWN: "keydown" + EVENT_KEY$2, 2575 MOUSEENTER: "mouseenter" + EVENT_KEY$2, 2576 MOUSELEAVE: "mouseleave" + EVENT_KEY$2, 2577 TOUCHSTART: "touchstart" + EVENT_KEY$2, 2578 TOUCHMOVE: "touchmove" + EVENT_KEY$2, 2579 TOUCHEND: "touchend" + EVENT_KEY$2, 2580 POINTERDOWN: "pointerdown" + EVENT_KEY$2, 2581 POINTERUP: "pointerup" + EVENT_KEY$2, 2582 DRAG_START: "dragstart" + EVENT_KEY$2, 2583 LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2, 2584 CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2 2585 }; 2586 var ClassName$2 = { 2587 CAROUSEL: 'carousel', 2588 ACTIVE: 'active', 2589 SLIDE: 'slide', 2590 RIGHT: 'carousel-item-right', 2591 LEFT: 'carousel-item-left', 2592 NEXT: 'carousel-item-next', 2593 PREV: 'carousel-item-prev', 2594 ITEM: 'carousel-item', 2595 POINTER_EVENT: 'pointer-event' 2596 }; 2597 var Selector$2 = { 2598 ACTIVE: '.active', 2599 ACTIVE_ITEM: '.active.carousel-item', 2600 ITEM: '.carousel-item', 2601 ITEM_IMG: '.carousel-item img', 2602 NEXT_PREV: '.carousel-item-next, .carousel-item-prev', 2603 INDICATORS: '.carousel-indicators', 2604 DATA_SLIDE: '[data-slide], [data-slide-to]', 2605 DATA_RIDE: '[data-ride="carousel"]' 2606 }; 2607 var PointerType = { 2608 TOUCH: 'touch', 2609 PEN: 'pen' 2610 }; 2611 /** 2612 * ------------------------------------------------------------------------ 2613 * Class Definition 2614 * ------------------------------------------------------------------------ 2615 */ 2616 2617 var Carousel = 2618 /*#__PURE__*/ 2619 function () { 2620 function Carousel(element, config) { 2621 this._items = null; 2622 this._interval = null; 2623 this._activeElement = null; 2624 this._isPaused = false; 2625 this._isSliding = false; 2626 this.touchTimeout = null; 2627 this.touchStartX = 0; 2628 this.touchDeltaX = 0; 2629 this._config = this._getConfig(config); 2630 this._element = element; 2631 this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS); 2632 this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; 2633 this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent); 2634 2635 this._addEventListeners(); 2636 } // Getters 2637 2638 2639 var _proto = Carousel.prototype; 2640 2641 // Public 2642 _proto.next = function next() { 2643 if (!this._isSliding) { 2644 this._slide(Direction.NEXT); 2645 } 2646 }; 2647 2648 _proto.nextWhenVisible = function nextWhenVisible() { 2649 // Don't call next when the page isn't visible 2650 // or the carousel or its parent isn't visible 2651 if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') { 2652 this.next(); 2653 } 2654 }; 2655 2656 _proto.prev = function prev() { 2657 if (!this._isSliding) { 2658 this._slide(Direction.PREV); 2659 } 2660 }; 2661 2662 _proto.pause = function pause(event) { 2663 if (!event) { 2664 this._isPaused = true; 2665 } 2666 2667 if (this._element.querySelector(Selector$2.NEXT_PREV)) { 2668 Util.triggerTransitionEnd(this._element); 2669 this.cycle(true); 2670 } 2671 2672 clearInterval(this._interval); 2673 this._interval = null; 2674 }; 2675 2676 _proto.cycle = function cycle(event) { 2677 if (!event) { 2678 this._isPaused = false; 2679 } 2680 2681 if (this._interval) { 2682 clearInterval(this._interval); 2683 this._interval = null; 2684 } 2685 2686 if (this._config.interval && !this._isPaused) { 2687 this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval); 2688 } 2689 }; 2690 2691 _proto.to = function to(index) { 2692 var _this = this; 2693 2694 this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM); 2695 2696 var activeIndex = this._getItemIndex(this._activeElement); 2697 2698 if (index > this._items.length - 1 || index < 0) { 2699 return; 2700 } 2701 2702 if (this._isSliding) { 2703 $(this._element).one(Event$2.SLID, function () { 2704 return _this.to(index); 2705 }); 2706 return; 2707 } 2708 2709 if (activeIndex === index) { 2710 this.pause(); 2711 this.cycle(); 2712 return; 2713 } 2714 2715 var direction = index > activeIndex ? Direction.NEXT : Direction.PREV; 2716 2717 this._slide(direction, this._items[index]); 2718 }; 2719 2720 _proto.dispose = function dispose() { 2721 $(this._element).off(EVENT_KEY$2); 2722 $.removeData(this._element, DATA_KEY$2); 2723 this._items = null; 2724 this._config = null; 2725 this._element = null; 2726 this._interval = null; 2727 this._isPaused = null; 2728 this._isSliding = null; 2729 this._activeElement = null; 2730 this._indicatorsElement = null; 2731 } // Private 2732 ; 2733 2734 _proto._getConfig = function _getConfig(config) { 2735 config = _objectSpread2({}, Default, {}, config); 2736 Util.typeCheckConfig(NAME$2, config, DefaultType); 2737 return config; 2738 }; 2739 2740 _proto._handleSwipe = function _handleSwipe() { 2741 var absDeltax = Math.abs(this.touchDeltaX); 2742 2743 if (absDeltax <= SWIPE_THRESHOLD) { 2744 return; 2745 } 2746 2747 var direction = absDeltax / this.touchDeltaX; 2748 this.touchDeltaX = 0; // swipe left 2749 2750 if (direction > 0) { 2751 this.prev(); 2752 } // swipe right 2753 2754 2755 if (direction < 0) { 2756 this.next(); 2757 } 2758 }; 2759 2760 _proto._addEventListeners = function _addEventListeners() { 2761 var _this2 = this; 2762 2763 if (this._config.keyboard) { 2764 $(this._element).on(Event$2.KEYDOWN, function (event) { 2765 return _this2._keydown(event); 2766 }); 2767 } 2768 2769 if (this._config.pause === 'hover') { 2770 $(this._element).on(Event$2.MOUSEENTER, function (event) { 2771 return _this2.pause(event); 2772 }).on(Event$2.MOUSELEAVE, function (event) { 2773 return _this2.cycle(event); 2774 }); 2775 } 2776 2777 if (this._config.touch) { 2778 this._addTouchEventListeners(); 2779 } 2780 }; 2781 2782 _proto._addTouchEventListeners = function _addTouchEventListeners() { 2783 var _this3 = this; 2784 2785 if (!this._touchSupported) { 2786 return; 2787 } 2788 2789 var start = function start(event) { 2790 if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 2791 _this3.touchStartX = event.originalEvent.clientX; 2792 } else if (!_this3._pointerEvent) { 2793 _this3.touchStartX = event.originalEvent.touches[0].clientX; 2794 } 2795 }; 2796 2797 var move = function move(event) { 2798 // ensure swiping with one touch and not pinching 2799 if (event.originalEvent.touches && event.originalEvent.touches.length > 1) { 2800 _this3.touchDeltaX = 0; 2801 } else { 2802 _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX; 2803 } 2804 }; 2805 2806 var end = function end(event) { 2807 if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 2808 _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX; 2809 } 2810 2811 _this3._handleSwipe(); 2812 2813 if (_this3._config.pause === 'hover') { 2814 // If it's a touch-enabled device, mouseenter/leave are fired as 2815 // part of the mouse compatibility events on first tap - the carousel 2816 // would stop cycling until user tapped out of it; 2817 // here, we listen for touchend, explicitly pause the carousel 2818 // (as if it's the second time we tap on it, mouseenter compat event 2819 // is NOT fired) and after a timeout (to allow for mouse compatibility 2820 // events to fire) we explicitly restart cycling 2821 _this3.pause(); 2822 2823 if (_this3.touchTimeout) { 2824 clearTimeout(_this3.touchTimeout); 2825 } 2826 2827 _this3.touchTimeout = setTimeout(function (event) { 2828 return _this3.cycle(event); 2829 }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval); 2830 } 2831 }; 2832 2833 $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) { 2834 return e.preventDefault(); 2835 }); 2836 2837 if (this._pointerEvent) { 2838 $(this._element).on(Event$2.POINTERDOWN, function (event) { 2839 return start(event); 2840 }); 2841 $(this._element).on(Event$2.POINTERUP, function (event) { 2842 return end(event); 2843 }); 2844 2845 this._element.classList.add(ClassName$2.POINTER_EVENT); 2846 } else { 2847 $(this._element).on(Event$2.TOUCHSTART, function (event) { 2848 return start(event); 2849 }); 2850 $(this._element).on(Event$2.TOUCHMOVE, function (event) { 2851 return move(event); 2852 }); 2853 $(this._element).on(Event$2.TOUCHEND, function (event) { 2854 return end(event); 2855 }); 2856 } 2857 }; 2858 2859 _proto._keydown = function _keydown(event) { 2860 if (/input|textarea/i.test(event.target.tagName)) { 2861 return; 2862 } 2863 2864 switch (event.which) { 2865 case ARROW_LEFT_KEYCODE: 2866 event.preventDefault(); 2867 this.prev(); 2868 break; 2869 2870 case ARROW_RIGHT_KEYCODE: 2871 event.preventDefault(); 2872 this.next(); 2873 break; 2874 } 2875 }; 2876 2877 _proto._getItemIndex = function _getItemIndex(element) { 2878 this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : []; 2879 return this._items.indexOf(element); 2880 }; 2881 2882 _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) { 2883 var isNextDirection = direction === Direction.NEXT; 2884 var isPrevDirection = direction === Direction.PREV; 2885 2886 var activeIndex = this._getItemIndex(activeElement); 2887 2888 var lastItemIndex = this._items.length - 1; 2889 var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex; 2890 2891 if (isGoingToWrap && !this._config.wrap) { 2892 return activeElement; 2893 } 2894 2895 var delta = direction === Direction.PREV ? -1 : 1; 2896 var itemIndex = (activeIndex + delta) % this._items.length; 2897 return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex]; 2898 }; 2899 2900 _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { 2901 var targetIndex = this._getItemIndex(relatedTarget); 2902 2903 var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM)); 2904 2905 var slideEvent = $.Event(Event$2.SLIDE, { 2906 relatedTarget: relatedTarget, 2907 direction: eventDirectionName, 2908 from: fromIndex, 2909 to: targetIndex 2910 }); 2911 $(this._element).trigger(slideEvent); 2912 return slideEvent; 2913 }; 2914 2915 _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { 2916 if (this._indicatorsElement) { 2917 var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE)); 2918 $(indicators).removeClass(ClassName$2.ACTIVE); 2919 2920 var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; 2921 2922 if (nextIndicator) { 2923 $(nextIndicator).addClass(ClassName$2.ACTIVE); 2924 } 2925 } 2926 }; 2927 2928 _proto._slide = function _slide(direction, element) { 2929 var _this4 = this; 2930 2931 var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM); 2932 2933 var activeElementIndex = this._getItemIndex(activeElement); 2934 2935 var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement); 2936 2937 var nextElementIndex = this._getItemIndex(nextElement); 2938 2939 var isCycling = Boolean(this._interval); 2940 var directionalClassName; 2941 var orderClassName; 2942 var eventDirectionName; 2943 2944 if (direction === Direction.NEXT) { 2945 directionalClassName = ClassName$2.LEFT; 2946 orderClassName = ClassName$2.NEXT; 2947 eventDirectionName = Direction.LEFT; 2948 } else { 2949 directionalClassName = ClassName$2.RIGHT; 2950 orderClassName = ClassName$2.PREV; 2951 eventDirectionName = Direction.RIGHT; 2952 } 2953 2954 if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) { 2955 this._isSliding = false; 2956 return; 2957 } 2958 2959 var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); 2960 2961 if (slideEvent.isDefaultPrevented()) { 2962 return; 2963 } 2964 2965 if (!activeElement || !nextElement) { 2966 // Some weirdness is happening, so we bail 2967 return; 2968 } 2969 2970 this._isSliding = true; 2971 2972 if (isCycling) { 2973 this.pause(); 2974 } 2975 2976 this._setActiveIndicatorElement(nextElement); 2977 2978 var slidEvent = $.Event(Event$2.SLID, { 2979 relatedTarget: nextElement, 2980 direction: eventDirectionName, 2981 from: activeElementIndex, 2982 to: nextElementIndex 2983 }); 2984 2985 if ($(this._element).hasClass(ClassName$2.SLIDE)) { 2986 $(nextElement).addClass(orderClassName); 2987 Util.reflow(nextElement); 2988 $(activeElement).addClass(directionalClassName); 2989 $(nextElement).addClass(directionalClassName); 2990 var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10); 2991 2992 if (nextElementInterval) { 2993 this._config.defaultInterval = this._config.defaultInterval || this._config.interval; 2994 this._config.interval = nextElementInterval; 2995 } else { 2996 this._config.interval = this._config.defaultInterval || this._config.interval; 2997 } 2998 2999 var transitionDuration = Util.getTransitionDurationFromElement(activeElement); 3000 $(activeElement).one(Util.TRANSITION_END, function () { 3001 $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE); 3002 $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName); 3003 _this4._isSliding = false; 3004 setTimeout(function () { 3005 return $(_this4._element).trigger(slidEvent); 3006 }, 0); 3007 }).emulateTransitionEnd(transitionDuration); 3008 } else { 3009 $(activeElement).removeClass(ClassName$2.ACTIVE); 3010 $(nextElement).addClass(ClassName$2.ACTIVE); 3011 this._isSliding = false; 3012 $(this._element).trigger(slidEvent); 3013 } 3014 3015 if (isCycling) { 3016 this.cycle(); 3017 } 3018 } // Static 3019 ; 3020 3021 Carousel._jQueryInterface = function _jQueryInterface(config) { 3022 return this.each(function () { 3023 var data = $(this).data(DATA_KEY$2); 3024 3025 var _config = _objectSpread2({}, Default, {}, $(this).data()); 3026 3027 if (typeof config === 'object') { 3028 _config = _objectSpread2({}, _config, {}, config); 3029 } 3030 3031 var action = typeof config === 'string' ? config : _config.slide; 3032 3033 if (!data) { 3034 data = new Carousel(this, _config); 3035 $(this).data(DATA_KEY$2, data); 3036 } 3037 3038 if (typeof config === 'number') { 3039 data.to(config); 3040 } else if (typeof action === 'string') { 3041 if (typeof data[action] === 'undefined') { 3042 throw new TypeError("No method named \"" + action + "\""); 3043 } 3044 3045 data[action](); 3046 } else if (_config.interval && _config.ride) { 3047 data.pause(); 3048 data.cycle(); 3049 } 3050 }); 3051 }; 3052 3053 Carousel._dataApiClickHandler = function _dataApiClickHandler(event) { 3054 var selector = Util.getSelectorFromElement(this); 3055 3056 if (!selector) { 3057 return; 3058 } 3059 3060 var target = $(selector)[0]; 3061 3062 if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) { 3063 return; 3064 } 3065 3066 var config = _objectSpread2({}, $(target).data(), {}, $(this).data()); 3067 3068 var slideIndex = this.getAttribute('data-slide-to'); 3069 3070 if (slideIndex) { 3071 config.interval = false; 3072 } 3073 3074 Carousel._jQueryInterface.call($(target), config); 3075 3076 if (slideIndex) { 3077 $(target).data(DATA_KEY$2).to(slideIndex); 3078 } 3079 3080 event.preventDefault(); 3081 }; 3082 3083 _createClass(Carousel, null, [{ 3084 key: "VERSION", 3085 get: function get() { 3086 return VERSION$2; 3087 } 3088 }, { 3089 key: "Default", 3090 get: function get() { 3091 return Default; 3092 } 3093 }]); 3094 3095 return Carousel; 3096 }(); 3097 /** 3098 * ------------------------------------------------------------------------ 3099 * Data Api implementation 3100 * ------------------------------------------------------------------------ 3101 */ 3102 3103 3104 $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler); 3105 $(window).on(Event$2.LOAD_DATA_API, function () { 3106 var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE)); 3107 3108 for (var i = 0, len = carousels.length; i < len; i++) { 3109 var $carousel = $(carousels[i]); 3110 3111 Carousel._jQueryInterface.call($carousel, $carousel.data()); 3112 } 3113 }); 3114 /** 3115 * ------------------------------------------------------------------------ 3116 * jQuery 3117 * ------------------------------------------------------------------------ 3118 */ 3119 3120 $.fn[NAME$2] = Carousel._jQueryInterface; 3121 $.fn[NAME$2].Constructor = Carousel; 3122 3123 $.fn[NAME$2].noConflict = function () { 3124 $.fn[NAME$2] = JQUERY_NO_CONFLICT$2; 3125 return Carousel._jQueryInterface; 3126 }; 3127 3128 /** 3129 * ------------------------------------------------------------------------ 3130 * Constants 3131 * ------------------------------------------------------------------------ 3132 */ 3133 3134 var NAME$3 = 'collapse'; 3135 var VERSION$3 = '4.4.1'; 3136 var DATA_KEY$3 = 'bs.collapse'; 3137 var EVENT_KEY$3 = "." + DATA_KEY$3; 3138 var DATA_API_KEY$3 = '.data-api'; 3139 var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3]; 3140 var Default$1 = { 3141 toggle: true, 3142 parent: '' 3143 }; 3144 var DefaultType$1 = { 3145 toggle: 'boolean', 3146 parent: '(string|element)' 3147 }; 3148 var Event$3 = { 3149 SHOW: "show" + EVENT_KEY$3, 3150 SHOWN: "shown" + EVENT_KEY$3, 3151 HIDE: "hide" + EVENT_KEY$3, 3152 HIDDEN: "hidden" + EVENT_KEY$3, 3153 CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3 3154 }; 3155 var ClassName$3 = { 3156 SHOW: 'show', 3157 COLLAPSE: 'collapse', 3158 COLLAPSING: 'collapsing', 3159 COLLAPSED: 'collapsed' 3160 }; 3161 var Dimension = { 3162 WIDTH: 'width', 3163 HEIGHT: 'height' 3164 }; 3165 var Selector$3 = { 3166 ACTIVES: '.show, .collapsing', 3167 DATA_TOGGLE: '[data-toggle="collapse"]' 3168 }; 3169 /** 3170 * ------------------------------------------------------------------------ 3171 * Class Definition 3172 * ------------------------------------------------------------------------ 3173 */ 3174 3175 var Collapse = 3176 /*#__PURE__*/ 3177 function () { 3178 function Collapse(element, config) { 3179 this._isTransitioning = false; 3180 this._element = element; 3181 this._config = this._getConfig(config); 3182 this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]"))); 3183 var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE)); 3184 3185 for (var i = 0, len = toggleList.length; i < len; i++) { 3186 var elem = toggleList[i]; 3187 var selector = Util.getSelectorFromElement(elem); 3188 var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) { 3189 return foundElem === element; 3190 }); 3191 3192 if (selector !== null && filterElement.length > 0) { 3193 this._selector = selector; 3194 3195 this._triggerArray.push(elem); 3196 } 3197 } 3198 3199 this._parent = this._config.parent ? this._getParent() : null; 3200 3201 if (!this._config.parent) { 3202 this._addAriaAndCollapsedClass(this._element, this._triggerArray); 3203 } 3204 3205 if (this._config.toggle) { 3206 this.toggle(); 3207 } 3208 } // Getters 3209 3210 3211 var _proto = Collapse.prototype; 3212 3213 // Public 3214 _proto.toggle = function toggle() { 3215 if ($(this._element).hasClass(ClassName$3.SHOW)) { 3216 this.hide(); 3217 } else { 3218 this.show(); 3219 } 3220 }; 3221 3222 _proto.show = function show() { 3223 var _this = this; 3224 3225 if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) { 3226 return; 3227 } 3228 3229 var actives; 3230 var activesData; 3231 3232 if (this._parent) { 3233 actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) { 3234 if (typeof _this._config.parent === 'string') { 3235 return elem.getAttribute('data-parent') === _this._config.parent; 3236 } 3237 3238 return elem.classList.contains(ClassName$3.COLLAPSE); 3239 }); 3240 3241 if (actives.length === 0) { 3242 actives = null; 3243 } 3244 } 3245 3246 if (actives) { 3247 activesData = $(actives).not(this._selector).data(DATA_KEY$3); 3248 3249 if (activesData && activesData._isTransitioning) { 3250 return; 3251 } 3252 } 3253 3254 var startEvent = $.Event(Event$3.SHOW); 3255 $(this._element).trigger(startEvent); 3256 3257 if (startEvent.isDefaultPrevented()) { 3258 return; 3259 } 3260 3261 if (actives) { 3262 Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide'); 3263 3264 if (!activesData) { 3265 $(actives).data(DATA_KEY$3, null); 3266 } 3267 } 3268 3269 var dimension = this._getDimension(); 3270 3271 $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING); 3272 this._element.style[dimension] = 0; 3273 3274 if (this._triggerArray.length) { 3275 $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true); 3276 } 3277 3278 this.setTransitioning(true); 3279 3280 var complete = function complete() { 3281 $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW); 3282 _this._element.style[dimension] = ''; 3283 3284 _this.setTransitioning(false); 3285 3286 $(_this._element).trigger(Event$3.SHOWN); 3287 }; 3288 3289 var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); 3290 var scrollSize = "scroll" + capitalizedDimension; 3291 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 3292 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 3293 this._element.style[dimension] = this._element[scrollSize] + "px"; 3294 }; 3295 3296 _proto.hide = function hide() { 3297 var _this2 = this; 3298 3299 if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) { 3300 return; 3301 } 3302 3303 var startEvent = $.Event(Event$3.HIDE); 3304 $(this._element).trigger(startEvent); 3305 3306 if (startEvent.isDefaultPrevented()) { 3307 return; 3308 } 3309 3310 var dimension = this._getDimension(); 3311 3312 this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px"; 3313 Util.reflow(this._element); 3314 $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW); 3315 var triggerArrayLength = this._triggerArray.length; 3316 3317 if (triggerArrayLength > 0) { 3318 for (var i = 0; i < triggerArrayLength; i++) { 3319 var trigger = this._triggerArray[i]; 3320 var selector = Util.getSelectorFromElement(trigger); 3321 3322 if (selector !== null) { 3323 var $elem = $([].slice.call(document.querySelectorAll(selector))); 3324 3325 if (!$elem.hasClass(ClassName$3.SHOW)) { 3326 $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false); 3327 } 3328 } 3329 } 3330 } 3331 3332 this.setTransitioning(true); 3333 3334 var complete = function complete() { 3335 _this2.setTransitioning(false); 3336 3337 $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN); 3338 }; 3339 3340 this._element.style[dimension] = ''; 3341 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 3342 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 3343 }; 3344 3345 _proto.setTransitioning = function setTransitioning(isTransitioning) { 3346 this._isTransitioning = isTransitioning; 3347 }; 3348 3349 _proto.dispose = function dispose() { 3350 $.removeData(this._element, DATA_KEY$3); 3351 this._config = null; 3352 this._parent = null; 3353 this._element = null; 3354 this._triggerArray = null; 3355 this._isTransitioning = null; 3356 } // Private 3357 ; 3358 3359 _proto._getConfig = function _getConfig(config) { 3360 config = _objectSpread2({}, Default$1, {}, config); 3361 config.toggle = Boolean(config.toggle); // Coerce string values 3362 3363 Util.typeCheckConfig(NAME$3, config, DefaultType$1); 3364 return config; 3365 }; 3366 3367 _proto._getDimension = function _getDimension() { 3368 var hasWidth = $(this._element).hasClass(Dimension.WIDTH); 3369 return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT; 3370 }; 3371 3372 _proto._getParent = function _getParent() { 3373 var _this3 = this; 3374 3375 var parent; 3376 3377 if (Util.isElement(this._config.parent)) { 3378 parent = this._config.parent; // It's a jQuery object 3379 3380 if (typeof this._config.parent.jquery !== 'undefined') { 3381 parent = this._config.parent[0]; 3382 } 3383 } else { 3384 parent = document.querySelector(this._config.parent); 3385 } 3386 3387 var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]"; 3388 var children = [].slice.call(parent.querySelectorAll(selector)); 3389 $(children).each(function (i, element) { 3390 _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); 3391 }); 3392 return parent; 3393 }; 3394 3395 _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) { 3396 var isOpen = $(element).hasClass(ClassName$3.SHOW); 3397 3398 if (triggerArray.length) { 3399 $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen); 3400 } 3401 } // Static 3402 ; 3403 3404 Collapse._getTargetFromElement = function _getTargetFromElement(element) { 3405 var selector = Util.getSelectorFromElement(element); 3406 return selector ? document.querySelector(selector) : null; 3407 }; 3408 3409 Collapse._jQueryInterface = function _jQueryInterface(config) { 3410 return this.each(function () { 3411 var $this = $(this); 3412 var data = $this.data(DATA_KEY$3); 3413 3414 var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {}); 3415 3416 if (!data && _config.toggle && /show|hide/.test(config)) { 3417 _config.toggle = false; 3418 } 3419 3420 if (!data) { 3421 data = new Collapse(this, _config); 3422 $this.data(DATA_KEY$3, data); 3423 } 3424 3425 if (typeof config === 'string') { 3426 if (typeof data[config] === 'undefined') { 3427 throw new TypeError("No method named \"" + config + "\""); 3428 } 3429 3430 data[config](); 3431 } 3432 }); 3433 }; 3434 3435 _createClass(Collapse, null, [{ 3436 key: "VERSION", 3437 get: function get() { 3438 return VERSION$3; 3439 } 3440 }, { 3441 key: "Default", 3442 get: function get() { 3443 return Default$1; 3444 } 3445 }]); 3446 3447 return Collapse; 3448 }(); 3449 /** 3450 * ------------------------------------------------------------------------ 3451 * Data Api implementation 3452 * ------------------------------------------------------------------------ 3453 */ 3454 3455 3456 $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) { 3457 // preventDefault only for <a> elements (which change the URL) not inside the collapsible element 3458 if (event.currentTarget.tagName === 'A') { 3459 event.preventDefault(); 3460 } 3461 3462 var $trigger = $(this); 3463 var selector = Util.getSelectorFromElement(this); 3464 var selectors = [].slice.call(document.querySelectorAll(selector)); 3465 $(selectors).each(function () { 3466 var $target = $(this); 3467 var data = $target.data(DATA_KEY$3); 3468 var config = data ? 'toggle' : $trigger.data(); 3469 3470 Collapse._jQueryInterface.call($target, config); 3471 }); 3472 }); 3473 /** 3474 * ------------------------------------------------------------------------ 3475 * jQuery 3476 * ------------------------------------------------------------------------ 3477 */ 3478 3479 $.fn[NAME$3] = Collapse._jQueryInterface; 3480 $.fn[NAME$3].Constructor = Collapse; 3481 3482 $.fn[NAME$3].noConflict = function () { 3483 $.fn[NAME$3] = JQUERY_NO_CONFLICT$3; 3484 return Collapse._jQueryInterface; 3485 }; 3486 3487 /** 3488 * ------------------------------------------------------------------------ 3489 * Constants 3490 * ------------------------------------------------------------------------ 3491 */ 3492 3493 var NAME$4 = 'dropdown'; 3494 var VERSION$4 = '4.4.1'; 3495 var DATA_KEY$4 = 'bs.dropdown'; 3496 var EVENT_KEY$4 = "." + DATA_KEY$4; 3497 var DATA_API_KEY$4 = '.data-api'; 3498 var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4]; 3499 var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key 3500 3501 var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key 3502 3503 var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key 3504 3505 var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key 3506 3507 var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key 3508 3509 var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse) 3510 3511 var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE); 3512 var Event$4 = { 3513 HIDE: "hide" + EVENT_KEY$4, 3514 HIDDEN: "hidden" + EVENT_KEY$4, 3515 SHOW: "show" + EVENT_KEY$4, 3516 SHOWN: "shown" + EVENT_KEY$4, 3517 CLICK: "click" + EVENT_KEY$4, 3518 CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4, 3519 KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4, 3520 KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4 3521 }; 3522 var ClassName$4 = { 3523 DISABLED: 'disabled', 3524 SHOW: 'show', 3525 DROPUP: 'dropup', 3526 DROPRIGHT: 'dropright', 3527 DROPLEFT: 'dropleft', 3528 MENURIGHT: 'dropdown-menu-right', 3529 MENULEFT: 'dropdown-menu-left', 3530 POSITION_STATIC: 'position-static' 3531 }; 3532 var Selector$4 = { 3533 DATA_TOGGLE: '[data-toggle="dropdown"]', 3534 FORM_CHILD: '.dropdown form', 3535 MENU: '.dropdown-menu', 3536 NAVBAR_NAV: '.navbar-nav', 3537 VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)' 3538 }; 3539 var AttachmentMap = { 3540 TOP: 'top-start', 3541 TOPEND: 'top-end', 3542 BOTTOM: 'bottom-start', 3543 BOTTOMEND: 'bottom-end', 3544 RIGHT: 'right-start', 3545 RIGHTEND: 'right-end', 3546 LEFT: 'left-start', 3547 LEFTEND: 'left-end' 3548 }; 3549 var Default$2 = { 3550 offset: 0, 3551 flip: true, 3552 boundary: 'scrollParent', 3553 reference: 'toggle', 3554 display: 'dynamic', 3555 popperConfig: null 3556 }; 3557 var DefaultType$2 = { 3558 offset: '(number|string|function)', 3559 flip: 'boolean', 3560 boundary: '(string|element)', 3561 reference: '(string|element)', 3562 display: 'string', 3563 popperConfig: '(null|object)' 3564 }; 3565 /** 3566 * ------------------------------------------------------------------------ 3567 * Class Definition 3568 * ------------------------------------------------------------------------ 3569 */ 3570 3571 var Dropdown = 3572 /*#__PURE__*/ 3573 function () { 3574 function Dropdown(element, config) { 3575 this._element = element; 3576 this._popper = null; 3577 this._config = this._getConfig(config); 3578 this._menu = this._getMenuElement(); 3579 this._inNavbar = this._detectNavbar(); 3580 3581 this._addEventListeners(); 3582 } // Getters 3583 3584 3585 var _proto = Dropdown.prototype; 3586 3587 // Public 3588 _proto.toggle = function toggle() { 3589 if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) { 3590 return; 3591 } 3592 3593 var isActive = $(this._menu).hasClass(ClassName$4.SHOW); 3594 3595 Dropdown._clearMenus(); 3596 3597 if (isActive) { 3598 return; 3599 } 3600 3601 this.show(true); 3602 }; 3603 3604 _proto.show = function show(usePopper) { 3605 if (usePopper === void 0) { 3606 usePopper = false; 3607 } 3608 3609 if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) { 3610 return; 3611 } 3612 3613 var relatedTarget = { 3614 relatedTarget: this._element 3615 }; 3616 var showEvent = $.Event(Event$4.SHOW, relatedTarget); 3617 3618 var parent = Dropdown._getParentFromElement(this._element); 3619 3620 $(parent).trigger(showEvent); 3621 3622 if (showEvent.isDefaultPrevented()) { 3623 return; 3624 } // Disable totally Popper.js for Dropdown in Navbar 3625 3626 3627 if (!this._inNavbar && usePopper) { 3628 /** 3629 * Check for Popper dependency 3630 * Popper - https://popper.js.org 3631 */ 3632 if (typeof Popper === 'undefined') { 3633 throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)'); 3634 } 3635 3636 var referenceElement = this._element; 3637 3638 if (this._config.reference === 'parent') { 3639 referenceElement = parent; 3640 } else if (Util.isElement(this._config.reference)) { 3641 referenceElement = this._config.reference; // Check if it's jQuery element 3642 3643 if (typeof this._config.reference.jquery !== 'undefined') { 3644 referenceElement = this._config.reference[0]; 3645 } 3646 } // If boundary is not `scrollParent`, then set position to `static` 3647 // to allow the menu to "escape" the scroll parent's boundaries 3648 // https://github.com/twbs/bootstrap/issues/24251 3649 3650 3651 if (this._config.boundary !== 'scrollParent') { 3652 $(parent).addClass(ClassName$4.POSITION_STATIC); 3653 } 3654 3655 this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig()); 3656 } // If this is a touch-enabled device we add extra 3657 // empty mouseover listeners to the body's immediate children; 3658 // only needed because of broken event delegation on iOS 3659 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 3660 3661 3662 if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) { 3663 $(document.body).children().on('mouseover', null, $.noop); 3664 } 3665 3666 this._element.focus(); 3667 3668 this._element.setAttribute('aria-expanded', true); 3669 3670 $(this._menu).toggleClass(ClassName$4.SHOW); 3671 $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget)); 3672 }; 3673 3674 _proto.hide = function hide() { 3675 if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) { 3676 return; 3677 } 3678 3679 var relatedTarget = { 3680 relatedTarget: this._element 3681 }; 3682 var hideEvent = $.Event(Event$4.HIDE, relatedTarget); 3683 3684 var parent = Dropdown._getParentFromElement(this._element); 3685 3686 $(parent).trigger(hideEvent); 3687 3688 if (hideEvent.isDefaultPrevented()) { 3689 return; 3690 } 3691 3692 if (this._popper) { 3693 this._popper.destroy(); 3694 } 3695 3696 $(this._menu).toggleClass(ClassName$4.SHOW); 3697 $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget)); 3698 }; 3699 3700 _proto.dispose = function dispose() { 3701 $.removeData(this._element, DATA_KEY$4); 3702 $(this._element).off(EVENT_KEY$4); 3703 this._element = null; 3704 this._menu = null; 3705 3706 if (this._popper !== null) { 3707 this._popper.destroy(); 3708 3709 this._popper = null; 3710 } 3711 }; 3712 3713 _proto.update = function update() { 3714 this._inNavbar = this._detectNavbar(); 3715 3716 if (this._popper !== null) { 3717 this._popper.scheduleUpdate(); 3718 } 3719 } // Private 3720 ; 3721 3722 _proto._addEventListeners = function _addEventListeners() { 3723 var _this = this; 3724 3725 $(this._element).on(Event$4.CLICK, function (event) { 3726 event.preventDefault(); 3727 event.stopPropagation(); 3728 3729 _this.toggle(); 3730 }); 3731 }; 3732 3733 _proto._getConfig = function _getConfig(config) { 3734 config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config); 3735 Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType); 3736 return config; 3737 }; 3738 3739 _proto._getMenuElement = function _getMenuElement() { 3740 if (!this._menu) { 3741 var parent = Dropdown._getParentFromElement(this._element); 3742 3743 if (parent) { 3744 this._menu = parent.querySelector(Selector$4.MENU); 3745 } 3746 } 3747 3748 return this._menu; 3749 }; 3750 3751 _proto._getPlacement = function _getPlacement() { 3752 var $parentDropdown = $(this._element.parentNode); 3753 var placement = AttachmentMap.BOTTOM; // Handle dropup 3754 3755 if ($parentDropdown.hasClass(ClassName$4.DROPUP)) { 3756 placement = AttachmentMap.TOP; 3757 3758 if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) { 3759 placement = AttachmentMap.TOPEND; 3760 } 3761 } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) { 3762 placement = AttachmentMap.RIGHT; 3763 } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) { 3764 placement = AttachmentMap.LEFT; 3765 } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) { 3766 placement = AttachmentMap.BOTTOMEND; 3767 } 3768 3769 return placement; 3770 }; 3771 3772 _proto._detectNavbar = function _detectNavbar() { 3773 return $(this._element).closest('.navbar').length > 0; 3774 }; 3775 3776 _proto._getOffset = function _getOffset() { 3777 var _this2 = this; 3778 3779 var offset = {}; 3780 3781 if (typeof this._config.offset === 'function') { 3782 offset.fn = function (data) { 3783 data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {}); 3784 return data; 3785 }; 3786 } else { 3787 offset.offset = this._config.offset; 3788 } 3789 3790 return offset; 3791 }; 3792 3793 _proto._getPopperConfig = function _getPopperConfig() { 3794 var popperConfig = { 3795 placement: this._getPlacement(), 3796 modifiers: { 3797 offset: this._getOffset(), 3798 flip: { 3799 enabled: this._config.flip 3800 }, 3801 preventOverflow: { 3802 boundariesElement: this._config.boundary 3803 } 3804 } 3805 }; // Disable Popper.js if we have a static display 3806 3807 if (this._config.display === 'static') { 3808 popperConfig.modifiers.applyStyle = { 3809 enabled: false 3810 }; 3811 } 3812 3813 return _objectSpread2({}, popperConfig, {}, this._config.popperConfig); 3814 } // Static 3815 ; 3816 3817 Dropdown._jQueryInterface = function _jQueryInterface(config) { 3818 return this.each(function () { 3819 var data = $(this).data(DATA_KEY$4); 3820 3821 var _config = typeof config === 'object' ? config : null; 3822 3823 if (!data) { 3824 data = new Dropdown(this, _config); 3825 $(this).data(DATA_KEY$4, data); 3826 } 3827 3828 if (typeof config === 'string') { 3829 if (typeof data[config] === 'undefined') { 3830 throw new TypeError("No method named \"" + config + "\""); 3831 } 3832 3833 data[config](); 3834 } 3835 }); 3836 }; 3837 3838 Dropdown._clearMenus = function _clearMenus(event) { 3839 if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) { 3840 return; 3841 } 3842 3843 var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE)); 3844 3845 for (var i = 0, len = toggles.length; i < len; i++) { 3846 var parent = Dropdown._getParentFromElement(toggles[i]); 3847 3848 var context = $(toggles[i]).data(DATA_KEY$4); 3849 var relatedTarget = { 3850 relatedTarget: toggles[i] 3851 }; 3852 3853 if (event && event.type === 'click') { 3854 relatedTarget.clickEvent = event; 3855 } 3856 3857 if (!context) { 3858 continue; 3859 } 3860 3861 var dropdownMenu = context._menu; 3862 3863 if (!$(parent).hasClass(ClassName$4.SHOW)) { 3864 continue; 3865 } 3866 3867 if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) { 3868 continue; 3869 } 3870 3871 var hideEvent = $.Event(Event$4.HIDE, relatedTarget); 3872 $(parent).trigger(hideEvent); 3873 3874 if (hideEvent.isDefaultPrevented()) { 3875 continue; 3876 } // If this is a touch-enabled device we remove the extra 3877 // empty mouseover listeners we added for iOS support 3878 3879 3880 if ('ontouchstart' in document.documentElement) { 3881 $(document.body).children().off('mouseover', null, $.noop); 3882 } 3883 3884 toggles[i].setAttribute('aria-expanded', 'false'); 3885 3886 if (context._popper) { 3887 context._popper.destroy(); 3888 } 3889 3890 $(dropdownMenu).removeClass(ClassName$4.SHOW); 3891 $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget)); 3892 } 3893 }; 3894 3895 Dropdown._getParentFromElement = function _getParentFromElement(element) { 3896 var parent; 3897 var selector = Util.getSelectorFromElement(element); 3898 3899 if (selector) { 3900 parent = document.querySelector(selector); 3901 } 3902 3903 return parent || element.parentNode; 3904 } // eslint-disable-next-line complexity 3905 ; 3906 3907 Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) { 3908 // If not input/textarea: 3909 // - And not a key in REGEXP_KEYDOWN => not a dropdown command 3910 // If input/textarea: 3911 // - If space key => not a dropdown command 3912 // - If key is other than escape 3913 // - If key is not up or down => not a dropdown command 3914 // - If trigger inside the menu => not a dropdown command 3915 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$4.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) { 3916 return; 3917 } 3918 3919 event.preventDefault(); 3920 event.stopPropagation(); 3921 3922 if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) { 3923 return; 3924 } 3925 3926 var parent = Dropdown._getParentFromElement(this); 3927 3928 var isActive = $(parent).hasClass(ClassName$4.SHOW); 3929 3930 if (!isActive && event.which === ESCAPE_KEYCODE) { 3931 return; 3932 } 3933 3934 if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { 3935 if (event.which === ESCAPE_KEYCODE) { 3936 var toggle = parent.querySelector(Selector$4.DATA_TOGGLE); 3937 $(toggle).trigger('focus'); 3938 } 3939 3940 $(this).trigger('click'); 3941 return; 3942 } 3943 3944 var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) { 3945 return $(item).is(':visible'); 3946 }); 3947 3948 if (items.length === 0) { 3949 return; 3950 } 3951 3952 var index = items.indexOf(event.target); 3953 3954 if (event.which === ARROW_UP_KEYCODE && index > 0) { 3955 // Up 3956 index--; 3957 } 3958 3959 if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { 3960 // Down 3961 index++; 3962 } 3963 3964 if (index < 0) { 3965 index = 0; 3966 } 3967 3968 items[index].focus(); 3969 }; 3970 3971 _createClass(Dropdown, null, [{ 3972 key: "VERSION", 3973 get: function get() { 3974 return VERSION$4; 3975 } 3976 }, { 3977 key: "Default", 3978 get: function get() { 3979 return Default$2; 3980 } 3981 }, { 3982 key: "DefaultType", 3983 get: function get() { 3984 return DefaultType$2; 3985 } 3986 }]); 3987 3988 return Dropdown; 3989 }(); 3990 /** 3991 * ------------------------------------------------------------------------ 3992 * Data Api implementation 3993 * ------------------------------------------------------------------------ 3994 */ 3995 3996 3997 $(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) { 3998 event.preventDefault(); 3999 event.stopPropagation(); 4000 4001 Dropdown._jQueryInterface.call($(this), 'toggle'); 4002 }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) { 4003 e.stopPropagation(); 4004 }); 4005 /** 4006 * ------------------------------------------------------------------------ 4007 * jQuery 4008 * ------------------------------------------------------------------------ 4009 */ 4010 4011 $.fn[NAME$4] = Dropdown._jQueryInterface; 4012 $.fn[NAME$4].Constructor = Dropdown; 4013 4014 $.fn[NAME$4].noConflict = function () { 4015 $.fn[NAME$4] = JQUERY_NO_CONFLICT$4; 4016 return Dropdown._jQueryInterface; 4017 }; 4018 4019 /** 4020 * ------------------------------------------------------------------------ 4021 * Constants 4022 * ------------------------------------------------------------------------ 4023 */ 4024 4025 var NAME$5 = 'modal'; 4026 var VERSION$5 = '4.4.1'; 4027 var DATA_KEY$5 = 'bs.modal'; 4028 var EVENT_KEY$5 = "." + DATA_KEY$5; 4029 var DATA_API_KEY$5 = '.data-api'; 4030 var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5]; 4031 var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key 4032 4033 var Default$3 = { 4034 backdrop: true, 4035 keyboard: true, 4036 focus: true, 4037 show: true 4038 }; 4039 var DefaultType$3 = { 4040 backdrop: '(boolean|string)', 4041 keyboard: 'boolean', 4042 focus: 'boolean', 4043 show: 'boolean' 4044 }; 4045 var Event$5 = { 4046 HIDE: "hide" + EVENT_KEY$5, 4047 HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5, 4048 HIDDEN: "hidden" + EVENT_KEY$5, 4049 SHOW: "show" + EVENT_KEY$5, 4050 SHOWN: "shown" + EVENT_KEY$5, 4051 FOCUSIN: "focusin" + EVENT_KEY$5, 4052 RESIZE: "resize" + EVENT_KEY$5, 4053 CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5, 4054 KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5, 4055 MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5, 4056 MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5, 4057 CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5 4058 }; 4059 var ClassName$5 = { 4060 SCROLLABLE: 'modal-dialog-scrollable', 4061 SCROLLBAR_MEASURER: 'modal-scrollbar-measure', 4062 BACKDROP: 'modal-backdrop', 4063 OPEN: 'modal-open', 4064 FADE: 'fade', 4065 SHOW: 'show', 4066 STATIC: 'modal-static' 4067 }; 4068 var Selector$5 = { 4069 DIALOG: '.modal-dialog', 4070 MODAL_BODY: '.modal-body', 4071 DATA_TOGGLE: '[data-toggle="modal"]', 4072 DATA_DISMISS: '[data-dismiss="modal"]', 4073 FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top', 4074 STICKY_CONTENT: '.sticky-top' 4075 }; 4076 /** 4077 * ------------------------------------------------------------------------ 4078 * Class Definition 4079 * ------------------------------------------------------------------------ 4080 */ 4081 4082 var Modal = 4083 /*#__PURE__*/ 4084 function () { 4085 function Modal(element, config) { 4086 this._config = this._getConfig(config); 4087 this._element = element; 4088 this._dialog = element.querySelector(Selector$5.DIALOG); 4089 this._backdrop = null; 4090 this._isShown = false; 4091 this._isBodyOverflowing = false; 4092 this._ignoreBackdropClick = false; 4093 this._isTransitioning = false; 4094 this._scrollbarWidth = 0; 4095 } // Getters 4096 4097 4098 var _proto = Modal.prototype; 4099 4100 // Public 4101 _proto.toggle = function toggle(relatedTarget) { 4102 return this._isShown ? this.hide() : this.show(relatedTarget); 4103 }; 4104 4105 _proto.show = function show(relatedTarget) { 4106 var _this = this; 4107 4108 if (this._isShown || this._isTransitioning) { 4109 return; 4110 } 4111 4112 if ($(this._element).hasClass(ClassName$5.FADE)) { 4113 this._isTransitioning = true; 4114 } 4115 4116 var showEvent = $.Event(Event$5.SHOW, { 4117 relatedTarget: relatedTarget 4118 }); 4119 $(this._element).trigger(showEvent); 4120 4121 if (this._isShown || showEvent.isDefaultPrevented()) { 4122 return; 4123 } 4124 4125 this._isShown = true; 4126 4127 this._checkScrollbar(); 4128 4129 this._setScrollbar(); 4130 4131 this._adjustDialog(); 4132 4133 this._setEscapeEvent(); 4134 4135 this._setResizeEvent(); 4136 4137 $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) { 4138 return _this.hide(event); 4139 }); 4140 $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () { 4141 $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) { 4142 if ($(event.target).is(_this._element)) { 4143 _this._ignoreBackdropClick = true; 4144 } 4145 }); 4146 }); 4147 4148 this._showBackdrop(function () { 4149 return _this._showElement(relatedTarget); 4150 }); 4151 }; 4152 4153 _proto.hide = function hide(event) { 4154 var _this2 = this; 4155 4156 if (event) { 4157 event.preventDefault(); 4158 } 4159 4160 if (!this._isShown || this._isTransitioning) { 4161 return; 4162 } 4163 4164 var hideEvent = $.Event(Event$5.HIDE); 4165 $(this._element).trigger(hideEvent); 4166 4167 if (!this._isShown || hideEvent.isDefaultPrevented()) { 4168 return; 4169 } 4170 4171 this._isShown = false; 4172 var transition = $(this._element).hasClass(ClassName$5.FADE); 4173 4174 if (transition) { 4175 this._isTransitioning = true; 4176 } 4177 4178 this._setEscapeEvent(); 4179 4180 this._setResizeEvent(); 4181 4182 $(document).off(Event$5.FOCUSIN); 4183 $(this._element).removeClass(ClassName$5.SHOW); 4184 $(this._element).off(Event$5.CLICK_DISMISS); 4185 $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS); 4186 4187 if (transition) { 4188 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 4189 $(this._element).one(Util.TRANSITION_END, function (event) { 4190 return _this2._hideModal(event); 4191 }).emulateTransitionEnd(transitionDuration); 4192 } else { 4193 this._hideModal(); 4194 } 4195 }; 4196 4197 _proto.dispose = function dispose() { 4198 [window, this._element, this._dialog].forEach(function (htmlElement) { 4199 return $(htmlElement).off(EVENT_KEY$5); 4200 }); 4201 /** 4202 * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API` 4203 * Do not move `document` in `htmlElements` array 4204 * It will remove `Event.CLICK_DATA_API` event that should remain 4205 */ 4206 4207 $(document).off(Event$5.FOCUSIN); 4208 $.removeData(this._element, DATA_KEY$5); 4209 this._config = null; 4210 this._element = null; 4211 this._dialog = null; 4212 this._backdrop = null; 4213 this._isShown = null; 4214 this._isBodyOverflowing = null; 4215 this._ignoreBackdropClick = null; 4216 this._isTransitioning = null; 4217 this._scrollbarWidth = null; 4218 }; 4219 4220 _proto.handleUpdate = function handleUpdate() { 4221 this._adjustDialog(); 4222 } // Private 4223 ; 4224 4225 _proto._getConfig = function _getConfig(config) { 4226 config = _objectSpread2({}, Default$3, {}, config); 4227 Util.typeCheckConfig(NAME$5, config, DefaultType$3); 4228 return config; 4229 }; 4230 4231 _proto._triggerBackdropTransition = function _triggerBackdropTransition() { 4232 var _this3 = this; 4233 4234 if (this._config.backdrop === 'static') { 4235 var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED); 4236 $(this._element).trigger(hideEventPrevented); 4237 4238 if (hideEventPrevented.defaultPrevented) { 4239 return; 4240 } 4241 4242 this._element.classList.add(ClassName$5.STATIC); 4243 4244 var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element); 4245 $(this._element).one(Util.TRANSITION_END, function () { 4246 _this3._element.classList.remove(ClassName$5.STATIC); 4247 }).emulateTransitionEnd(modalTransitionDuration); 4248 4249 this._element.focus(); 4250 } else { 4251 this.hide(); 4252 } 4253 }; 4254 4255 _proto._showElement = function _showElement(relatedTarget) { 4256 var _this4 = this; 4257 4258 var transition = $(this._element).hasClass(ClassName$5.FADE); 4259 var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null; 4260 4261 if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { 4262 // Don't move modal's DOM position 4263 document.body.appendChild(this._element); 4264 } 4265 4266 this._element.style.display = 'block'; 4267 4268 this._element.removeAttribute('aria-hidden'); 4269 4270 this._element.setAttribute('aria-modal', true); 4271 4272 if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) { 4273 modalBody.scrollTop = 0; 4274 } else { 4275 this._element.scrollTop = 0; 4276 } 4277 4278 if (transition) { 4279 Util.reflow(this._element); 4280 } 4281 4282 $(this._element).addClass(ClassName$5.SHOW); 4283 4284 if (this._config.focus) { 4285 this._enforceFocus(); 4286 } 4287 4288 var shownEvent = $.Event(Event$5.SHOWN, { 4289 relatedTarget: relatedTarget 4290 }); 4291 4292 var transitionComplete = function transitionComplete() { 4293 if (_this4._config.focus) { 4294 _this4._element.focus(); 4295 } 4296 4297 _this4._isTransitioning = false; 4298 $(_this4._element).trigger(shownEvent); 4299 }; 4300 4301 if (transition) { 4302 var transitionDuration = Util.getTransitionDurationFromElement(this._dialog); 4303 $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration); 4304 } else { 4305 transitionComplete(); 4306 } 4307 }; 4308 4309 _proto._enforceFocus = function _enforceFocus() { 4310 var _this5 = this; 4311 4312 $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop 4313 .on(Event$5.FOCUSIN, function (event) { 4314 if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) { 4315 _this5._element.focus(); 4316 } 4317 }); 4318 }; 4319 4320 _proto._setEscapeEvent = function _setEscapeEvent() { 4321 var _this6 = this; 4322 4323 if (this._isShown && this._config.keyboard) { 4324 $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) { 4325 if (event.which === ESCAPE_KEYCODE$1) { 4326 _this6._triggerBackdropTransition(); 4327 } 4328 }); 4329 } else if (!this._isShown) { 4330 $(this._element).off(Event$5.KEYDOWN_DISMISS); 4331 } 4332 }; 4333 4334 _proto._setResizeEvent = function _setResizeEvent() { 4335 var _this7 = this; 4336 4337 if (this._isShown) { 4338 $(window).on(Event$5.RESIZE, function (event) { 4339 return _this7.handleUpdate(event); 4340 }); 4341 } else { 4342 $(window).off(Event$5.RESIZE); 4343 } 4344 }; 4345 4346 _proto._hideModal = function _hideModal() { 4347 var _this8 = this; 4348 4349 this._element.style.display = 'none'; 4350 4351 this._element.setAttribute('aria-hidden', true); 4352 4353 this._element.removeAttribute('aria-modal'); 4354 4355 this._isTransitioning = false; 4356 4357 this._showBackdrop(function () { 4358 $(document.body).removeClass(ClassName$5.OPEN); 4359 4360 _this8._resetAdjustments(); 4361 4362 _this8._resetScrollbar(); 4363 4364 $(_this8._element).trigger(Event$5.HIDDEN); 4365 }); 4366 }; 4367 4368 _proto._removeBackdrop = function _removeBackdrop() { 4369 if (this._backdrop) { 4370 $(this._backdrop).remove(); 4371 this._backdrop = null; 4372 } 4373 }; 4374 4375 _proto._showBackdrop = function _showBackdrop(callback) { 4376 var _this9 = this; 4377 4378 var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : ''; 4379 4380 if (this._isShown && this._config.backdrop) { 4381 this._backdrop = document.createElement('div'); 4382 this._backdrop.className = ClassName$5.BACKDROP; 4383 4384 if (animate) { 4385 this._backdrop.classList.add(animate); 4386 } 4387 4388 $(this._backdrop).appendTo(document.body); 4389 $(this._element).on(Event$5.CLICK_DISMISS, function (event) { 4390 if (_this9._ignoreBackdropClick) { 4391 _this9._ignoreBackdropClick = false; 4392 return; 4393 } 4394 4395 if (event.target !== event.currentTarget) { 4396 return; 4397 } 4398 4399 _this9._triggerBackdropTransition(); 4400 }); 4401 4402 if (animate) { 4403 Util.reflow(this._backdrop); 4404 } 4405 4406 $(this._backdrop).addClass(ClassName$5.SHOW); 4407 4408 if (!callback) { 4409 return; 4410 } 4411 4412 if (!animate) { 4413 callback(); 4414 return; 4415 } 4416 4417 var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 4418 $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration); 4419 } else if (!this._isShown && this._backdrop) { 4420 $(this._backdrop).removeClass(ClassName$5.SHOW); 4421 4422 var callbackRemove = function callbackRemove() { 4423 _this9._removeBackdrop(); 4424 4425 if (callback) { 4426 callback(); 4427 } 4428 }; 4429 4430 if ($(this._element).hasClass(ClassName$5.FADE)) { 4431 var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 4432 4433 $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration); 4434 } else { 4435 callbackRemove(); 4436 } 4437 } else if (callback) { 4438 callback(); 4439 } 4440 } // ---------------------------------------------------------------------- 4441 // the following methods are used to handle overflowing modals 4442 // todo (fat): these should probably be refactored out of modal.js 4443 // ---------------------------------------------------------------------- 4444 ; 4445 4446 _proto._adjustDialog = function _adjustDialog() { 4447 var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 4448 4449 if (!this._isBodyOverflowing && isModalOverflowing) { 4450 this._element.style.paddingLeft = this._scrollbarWidth + "px"; 4451 } 4452 4453 if (this._isBodyOverflowing && !isModalOverflowing) { 4454 this._element.style.paddingRight = this._scrollbarWidth + "px"; 4455 } 4456 }; 4457 4458 _proto._resetAdjustments = function _resetAdjustments() { 4459 this._element.style.paddingLeft = ''; 4460 this._element.style.paddingRight = ''; 4461 }; 4462 4463 _proto._checkScrollbar = function _checkScrollbar() { 4464 var rect = document.body.getBoundingClientRect(); 4465 this._isBodyOverflowing = rect.left + rect.right < window.innerWidth; 4466 this._scrollbarWidth = this._getScrollbarWidth(); 4467 }; 4468 4469 _proto._setScrollbar = function _setScrollbar() { 4470 var _this10 = this; 4471 4472 if (this._isBodyOverflowing) { 4473 // Note: DOMNode.style.paddingRight returns the actual value or '' if not set 4474 // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set 4475 var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT)); 4476 var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding 4477 4478 $(fixedContent).each(function (index, element) { 4479 var actualPadding = element.style.paddingRight; 4480 var calculatedPadding = $(element).css('padding-right'); 4481 $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px"); 4482 }); // Adjust sticky content margin 4483 4484 $(stickyContent).each(function (index, element) { 4485 var actualMargin = element.style.marginRight; 4486 var calculatedMargin = $(element).css('margin-right'); 4487 $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px"); 4488 }); // Adjust body padding 4489 4490 var actualPadding = document.body.style.paddingRight; 4491 var calculatedPadding = $(document.body).css('padding-right'); 4492 $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px"); 4493 } 4494 4495 $(document.body).addClass(ClassName$5.OPEN); 4496 }; 4497 4498 _proto._resetScrollbar = function _resetScrollbar() { 4499 // Restore fixed content padding 4500 var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT)); 4501 $(fixedContent).each(function (index, element) { 4502 var padding = $(element).data('padding-right'); 4503 $(element).removeData('padding-right'); 4504 element.style.paddingRight = padding ? padding : ''; 4505 }); // Restore sticky content 4506 4507 var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT)); 4508 $(elements).each(function (index, element) { 4509 var margin = $(element).data('margin-right'); 4510 4511 if (typeof margin !== 'undefined') { 4512 $(element).css('margin-right', margin).removeData('margin-right'); 4513 } 4514 }); // Restore body padding 4515 4516 var padding = $(document.body).data('padding-right'); 4517 $(document.body).removeData('padding-right'); 4518 document.body.style.paddingRight = padding ? padding : ''; 4519 }; 4520 4521 _proto._getScrollbarWidth = function _getScrollbarWidth() { 4522 // thx d.walsh 4523 var scrollDiv = document.createElement('div'); 4524 scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER; 4525 document.body.appendChild(scrollDiv); 4526 var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; 4527 document.body.removeChild(scrollDiv); 4528 return scrollbarWidth; 4529 } // Static 4530 ; 4531 4532 Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) { 4533 return this.each(function () { 4534 var data = $(this).data(DATA_KEY$5); 4535 4536 var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {}); 4537 4538 if (!data) { 4539 data = new Modal(this, _config); 4540 $(this).data(DATA_KEY$5, data); 4541 } 4542 4543 if (typeof config === 'string') { 4544 if (typeof data[config] === 'undefined') { 4545 throw new TypeError("No method named \"" + config + "\""); 4546 } 4547 4548 data[config](relatedTarget); 4549 } else if (_config.show) { 4550 data.show(relatedTarget); 4551 } 4552 }); 4553 }; 4554 4555 _createClass(Modal, null, [{ 4556 key: "VERSION", 4557 get: function get() { 4558 return VERSION$5; 4559 } 4560 }, { 4561 key: "Default", 4562 get: function get() { 4563 return Default$3; 4564 } 4565 }]); 4566 4567 return Modal; 4568 }(); 4569 /** 4570 * ------------------------------------------------------------------------ 4571 * Data Api implementation 4572 * ------------------------------------------------------------------------ 4573 */ 4574 4575 4576 $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) { 4577 var _this11 = this; 4578 4579 var target; 4580 var selector = Util.getSelectorFromElement(this); 4581 4582 if (selector) { 4583 target = document.querySelector(selector); 4584 } 4585 4586 var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data()); 4587 4588 if (this.tagName === 'A' || this.tagName === 'AREA') { 4589 event.preventDefault(); 4590 } 4591 4592 var $target = $(target).one(Event$5.SHOW, function (showEvent) { 4593 if (showEvent.isDefaultPrevented()) { 4594 // Only register focus restorer if modal will actually get shown 4595 return; 4596 } 4597 4598 $target.one(Event$5.HIDDEN, function () { 4599 if ($(_this11).is(':visible')) { 4600 _this11.focus(); 4601 } 4602 }); 4603 }); 4604 4605 Modal._jQueryInterface.call($(target), config, this); 4606 }); 4607 /** 4608 * ------------------------------------------------------------------------ 4609 * jQuery 4610 * ------------------------------------------------------------------------ 4611 */ 4612 4613 $.fn[NAME$5] = Modal._jQueryInterface; 4614 $.fn[NAME$5].Constructor = Modal; 4615 4616 $.fn[NAME$5].noConflict = function () { 4617 $.fn[NAME$5] = JQUERY_NO_CONFLICT$5; 4618 return Modal._jQueryInterface; 4619 }; 4620 4621 /** 4622 * -------------------------------------------------------------------------- 4623 * Bootstrap (v4.4.1): tools/sanitizer.js 4624 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 4625 * -------------------------------------------------------------------------- 4626 */ 4627 var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']; 4628 var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; 4629 var DefaultWhitelist = { 4630 // Global attributes allowed on any supplied element below. 4631 '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], 4632 a: ['target', 'href', 'title', 'rel'], 4633 area: [], 4634 b: [], 4635 br: [], 4636 col: [], 4637 code: [], 4638 div: [], 4639 em: [], 4640 hr: [], 4641 h1: [], 4642 h2: [], 4643 h3: [], 4644 h4: [], 4645 h5: [], 4646 h6: [], 4647 i: [], 4648 img: ['src', 'alt', 'title', 'width', 'height'], 4649 li: [], 4650 ol: [], 4651 p: [], 4652 pre: [], 4653 s: [], 4654 small: [], 4655 span: [], 4656 sub: [], 4657 sup: [], 4658 strong: [], 4659 u: [], 4660 ul: [] 4661 }; 4662 /** 4663 * A pattern that recognizes a commonly useful subset of URLs that are safe. 4664 * 4665 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts 4666 */ 4667 4668 var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi; 4669 /** 4670 * A pattern that matches safe data URLs. Only matches image, video and audio types. 4671 * 4672 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts 4673 */ 4674 4675 var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i; 4676 4677 function allowedAttribute(attr, allowedAttributeList) { 4678 var attrName = attr.nodeName.toLowerCase(); 4679 4680 if (allowedAttributeList.indexOf(attrName) !== -1) { 4681 if (uriAttrs.indexOf(attrName) !== -1) { 4682 return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)); 4683 } 4684 4685 return true; 4686 } 4687 4688 var regExp = allowedAttributeList.filter(function (attrRegex) { 4689 return attrRegex instanceof RegExp; 4690 }); // Check if a regular expression validates the attribute. 4691 4692 for (var i = 0, l = regExp.length; i < l; i++) { 4693 if (attrName.match(regExp[i])) { 4694 return true; 4695 } 4696 } 4697 4698 return false; 4699 } 4700 4701 function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) { 4702 if (unsafeHtml.length === 0) { 4703 return unsafeHtml; 4704 } 4705 4706 if (sanitizeFn && typeof sanitizeFn === 'function') { 4707 return sanitizeFn(unsafeHtml); 4708 } 4709 4710 var domParser = new window.DOMParser(); 4711 var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); 4712 var whitelistKeys = Object.keys(whiteList); 4713 var elements = [].slice.call(createdDocument.body.querySelectorAll('*')); 4714 4715 var _loop = function _loop(i, len) { 4716 var el = elements[i]; 4717 var elName = el.nodeName.toLowerCase(); 4718 4719 if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) { 4720 el.parentNode.removeChild(el); 4721 return "continue"; 4722 } 4723 4724 var attributeList = [].slice.call(el.attributes); 4725 var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []); 4726 attributeList.forEach(function (attr) { 4727 if (!allowedAttribute(attr, whitelistedAttributes)) { 4728 el.removeAttribute(attr.nodeName); 4729 } 4730 }); 4731 }; 4732 4733 for (var i = 0, len = elements.length; i < len; i++) { 4734 var _ret = _loop(i); 4735 4736 if (_ret === "continue") continue; 4737 } 4738 4739 return createdDocument.body.innerHTML; 4740 } 4741 4742 /** 4743 * ------------------------------------------------------------------------ 4744 * Constants 4745 * ------------------------------------------------------------------------ 4746 */ 4747 4748 var NAME$6 = 'tooltip'; 4749 var VERSION$6 = '4.4.1'; 4750 var DATA_KEY$6 = 'bs.tooltip'; 4751 var EVENT_KEY$6 = "." + DATA_KEY$6; 4752 var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6]; 4753 var CLASS_PREFIX = 'bs-tooltip'; 4754 var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); 4755 var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']; 4756 var DefaultType$4 = { 4757 animation: 'boolean', 4758 template: 'string', 4759 title: '(string|element|function)', 4760 trigger: 'string', 4761 delay: '(number|object)', 4762 html: 'boolean', 4763 selector: '(string|boolean)', 4764 placement: '(string|function)', 4765 offset: '(number|string|function)', 4766 container: '(string|element|boolean)', 4767 fallbackPlacement: '(string|array)', 4768 boundary: '(string|element)', 4769 sanitize: 'boolean', 4770 sanitizeFn: '(null|function)', 4771 whiteList: 'object', 4772 popperConfig: '(null|object)' 4773 }; 4774 var AttachmentMap$1 = { 4775 AUTO: 'auto', 4776 TOP: 'top', 4777 RIGHT: 'right', 4778 BOTTOM: 'bottom', 4779 LEFT: 'left' 4780 }; 4781 var Default$4 = { 4782 animation: true, 4783 template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>', 4784 trigger: 'hover focus', 4785 title: '', 4786 delay: 0, 4787 html: false, 4788 selector: false, 4789 placement: 'top', 4790 offset: 0, 4791 container: false, 4792 fallbackPlacement: 'flip', 4793 boundary: 'scrollParent', 4794 sanitize: true, 4795 sanitizeFn: null, 4796 whiteList: DefaultWhitelist, 4797 popperConfig: null 4798 }; 4799 var HoverState = { 4800 SHOW: 'show', 4801 OUT: 'out' 4802 }; 4803 var Event$6 = { 4804 HIDE: "hide" + EVENT_KEY$6, 4805 HIDDEN: "hidden" + EVENT_KEY$6, 4806 SHOW: "show" + EVENT_KEY$6, 4807 SHOWN: "shown" + EVENT_KEY$6, 4808 INSERTED: "inserted" + EVENT_KEY$6, 4809 CLICK: "click" + EVENT_KEY$6, 4810 FOCUSIN: "focusin" + EVENT_KEY$6, 4811 FOCUSOUT: "focusout" + EVENT_KEY$6, 4812 MOUSEENTER: "mouseenter" + EVENT_KEY$6, 4813 MOUSELEAVE: "mouseleave" + EVENT_KEY$6 4814 }; 4815 var ClassName$6 = { 4816 FADE: 'fade', 4817 SHOW: 'show' 4818 }; 4819 var Selector$6 = { 4820 TOOLTIP: '.tooltip', 4821 TOOLTIP_INNER: '.tooltip-inner', 4822 ARROW: '.arrow' 4823 }; 4824 var Trigger = { 4825 HOVER: 'hover', 4826 FOCUS: 'focus', 4827 CLICK: 'click', 4828 MANUAL: 'manual' 4829 }; 4830 /** 4831 * ------------------------------------------------------------------------ 4832 * Class Definition 4833 * ------------------------------------------------------------------------ 4834 */ 4835 4836 var Tooltip = 4837 /*#__PURE__*/ 4838 function () { 4839 function Tooltip(element, config) { 4840 if (typeof Popper === 'undefined') { 4841 throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)'); 4842 } // private 4843 4844 4845 this._isEnabled = true; 4846 this._timeout = 0; 4847 this._hoverState = ''; 4848 this._activeTrigger = {}; 4849 this._popper = null; // Protected 4850 4851 this.element = element; 4852 this.config = this._getConfig(config); 4853 this.tip = null; 4854 4855 this._setListeners(); 4856 } // Getters 4857 4858 4859 var _proto = Tooltip.prototype; 4860 4861 // Public 4862 _proto.enable = function enable() { 4863 this._isEnabled = true; 4864 }; 4865 4866 _proto.disable = function disable() { 4867 this._isEnabled = false; 4868 }; 4869 4870 _proto.toggleEnabled = function toggleEnabled() { 4871 this._isEnabled = !this._isEnabled; 4872 }; 4873 4874 _proto.toggle = function toggle(event) { 4875 if (!this._isEnabled) { 4876 return; 4877 } 4878 4879 if (event) { 4880 var dataKey = this.constructor.DATA_KEY; 4881 var context = $(event.currentTarget).data(dataKey); 4882 4883 if (!context) { 4884 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 4885 $(event.currentTarget).data(dataKey, context); 4886 } 4887 4888 context._activeTrigger.click = !context._activeTrigger.click; 4889 4890 if (context._isWithActiveTrigger()) { 4891 context._enter(null, context); 4892 } else { 4893 context._leave(null, context); 4894 } 4895 } else { 4896 if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) { 4897 this._leave(null, this); 4898 4899 return; 4900 } 4901 4902 this._enter(null, this); 4903 } 4904 }; 4905 4906 _proto.dispose = function dispose() { 4907 clearTimeout(this._timeout); 4908 $.removeData(this.element, this.constructor.DATA_KEY); 4909 $(this.element).off(this.constructor.EVENT_KEY); 4910 $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler); 4911 4912 if (this.tip) { 4913 $(this.tip).remove(); 4914 } 4915 4916 this._isEnabled = null; 4917 this._timeout = null; 4918 this._hoverState = null; 4919 this._activeTrigger = null; 4920 4921 if (this._popper) { 4922 this._popper.destroy(); 4923 } 4924 4925 this._popper = null; 4926 this.element = null; 4927 this.config = null; 4928 this.tip = null; 4929 }; 4930 4931 _proto.show = function show() { 4932 var _this = this; 4933 4934 if ($(this.element).css('display') === 'none') { 4935 throw new Error('Please use show on visible elements'); 4936 } 4937 4938 var showEvent = $.Event(this.constructor.Event.SHOW); 4939 4940 if (this.isWithContent() && this._isEnabled) { 4941 $(this.element).trigger(showEvent); 4942 var shadowRoot = Util.findShadowRoot(this.element); 4943 var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element); 4944 4945 if (showEvent.isDefaultPrevented() || !isInTheDom) { 4946 return; 4947 } 4948 4949 var tip = this.getTipElement(); 4950 var tipId = Util.getUID(this.constructor.NAME); 4951 tip.setAttribute('id', tipId); 4952 this.element.setAttribute('aria-describedby', tipId); 4953 this.setContent(); 4954 4955 if (this.config.animation) { 4956 $(tip).addClass(ClassName$6.FADE); 4957 } 4958 4959 var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; 4960 4961 var attachment = this._getAttachment(placement); 4962 4963 this.addAttachmentClass(attachment); 4964 4965 var container = this._getContainer(); 4966 4967 $(tip).data(this.constructor.DATA_KEY, this); 4968 4969 if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) { 4970 $(tip).appendTo(container); 4971 } 4972 4973 $(this.element).trigger(this.constructor.Event.INSERTED); 4974 this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment)); 4975 $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra 4976 // empty mouseover listeners to the body's immediate children; 4977 // only needed because of broken event delegation on iOS 4978 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 4979 4980 if ('ontouchstart' in document.documentElement) { 4981 $(document.body).children().on('mouseover', null, $.noop); 4982 } 4983 4984 var complete = function complete() { 4985 if (_this.config.animation) { 4986 _this._fixTransition(); 4987 } 4988 4989 var prevHoverState = _this._hoverState; 4990 _this._hoverState = null; 4991 $(_this.element).trigger(_this.constructor.Event.SHOWN); 4992 4993 if (prevHoverState === HoverState.OUT) { 4994 _this._leave(null, _this); 4995 } 4996 }; 4997 4998 if ($(this.tip).hasClass(ClassName$6.FADE)) { 4999 var transitionDuration = Util.getTransitionDurationFromElement(this.tip); 5000 $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 5001 } else { 5002 complete(); 5003 } 5004 } 5005 }; 5006 5007 _proto.hide = function hide(callback) { 5008 var _this2 = this; 5009 5010 var tip = this.getTipElement(); 5011 var hideEvent = $.Event(this.constructor.Event.HIDE); 5012 5013 var complete = function complete() { 5014 if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) { 5015 tip.parentNode.removeChild(tip); 5016 } 5017 5018 _this2._cleanTipClass(); 5019 5020 _this2.element.removeAttribute('aria-describedby'); 5021 5022 $(_this2.element).trigger(_this2.constructor.Event.HIDDEN); 5023 5024 if (_this2._popper !== null) { 5025 _this2._popper.destroy(); 5026 } 5027 5028 if (callback) { 5029 callback(); 5030 } 5031 }; 5032 5033 $(this.element).trigger(hideEvent); 5034 5035 if (hideEvent.isDefaultPrevented()) { 5036 return; 5037 } 5038 5039 $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra 5040 // empty mouseover listeners we added for iOS support 5041 5042 if ('ontouchstart' in document.documentElement) { 5043 $(document.body).children().off('mouseover', null, $.noop); 5044 } 5045 5046 this._activeTrigger[Trigger.CLICK] = false; 5047 this._activeTrigger[Trigger.FOCUS] = false; 5048 this._activeTrigger[Trigger.HOVER] = false; 5049 5050 if ($(this.tip).hasClass(ClassName$6.FADE)) { 5051 var transitionDuration = Util.getTransitionDurationFromElement(tip); 5052 $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 5053 } else { 5054 complete(); 5055 } 5056 5057 this._hoverState = ''; 5058 }; 5059 5060 _proto.update = function update() { 5061 if (this._popper !== null) { 5062 this._popper.scheduleUpdate(); 5063 } 5064 } // Protected 5065 ; 5066 5067 _proto.isWithContent = function isWithContent() { 5068 return Boolean(this.getTitle()); 5069 }; 5070 5071 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 5072 $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); 5073 }; 5074 5075 _proto.getTipElement = function getTipElement() { 5076 this.tip = this.tip || $(this.config.template)[0]; 5077 return this.tip; 5078 }; 5079 5080 _proto.setContent = function setContent() { 5081 var tip = this.getTipElement(); 5082 this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle()); 5083 $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW); 5084 }; 5085 5086 _proto.setElementContent = function setElementContent($element, content) { 5087 if (typeof content === 'object' && (content.nodeType || content.jquery)) { 5088 // Content is a DOM node or a jQuery 5089 if (this.config.html) { 5090 if (!$(content).parent().is($element)) { 5091 $element.empty().append(content); 5092 } 5093 } else { 5094 $element.text($(content).text()); 5095 } 5096 5097 return; 5098 } 5099 5100 if (this.config.html) { 5101 if (this.config.sanitize) { 5102 content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn); 5103 } 5104 5105 $element.html(content); 5106 } else { 5107 $element.text(content); 5108 } 5109 }; 5110 5111 _proto.getTitle = function getTitle() { 5112 var title = this.element.getAttribute('data-original-title'); 5113 5114 if (!title) { 5115 title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title; 5116 } 5117 5118 return title; 5119 } // Private 5120 ; 5121 5122 _proto._getPopperConfig = function _getPopperConfig(attachment) { 5123 var _this3 = this; 5124 5125 var defaultBsConfig = { 5126 placement: attachment, 5127 modifiers: { 5128 offset: this._getOffset(), 5129 flip: { 5130 behavior: this.config.fallbackPlacement 5131 }, 5132 arrow: { 5133 element: Selector$6.ARROW 5134 }, 5135 preventOverflow: { 5136 boundariesElement: this.config.boundary 5137 } 5138 }, 5139 onCreate: function onCreate(data) { 5140 if (data.originalPlacement !== data.placement) { 5141 _this3._handlePopperPlacementChange(data); 5142 } 5143 }, 5144 onUpdate: function onUpdate(data) { 5145 return _this3._handlePopperPlacementChange(data); 5146 } 5147 }; 5148 return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig); 5149 }; 5150 5151 _proto._getOffset = function _getOffset() { 5152 var _this4 = this; 5153 5154 var offset = {}; 5155 5156 if (typeof this.config.offset === 'function') { 5157 offset.fn = function (data) { 5158 data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {}); 5159 return data; 5160 }; 5161 } else { 5162 offset.offset = this.config.offset; 5163 } 5164 5165 return offset; 5166 }; 5167 5168 _proto._getContainer = function _getContainer() { 5169 if (this.config.container === false) { 5170 return document.body; 5171 } 5172 5173 if (Util.isElement(this.config.container)) { 5174 return $(this.config.container); 5175 } 5176 5177 return $(document).find(this.config.container); 5178 }; 5179 5180 _proto._getAttachment = function _getAttachment(placement) { 5181 return AttachmentMap$1[placement.toUpperCase()]; 5182 }; 5183 5184 _proto._setListeners = function _setListeners() { 5185 var _this5 = this; 5186 5187 var triggers = this.config.trigger.split(' '); 5188 triggers.forEach(function (trigger) { 5189 if (trigger === 'click') { 5190 $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) { 5191 return _this5.toggle(event); 5192 }); 5193 } else if (trigger !== Trigger.MANUAL) { 5194 var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN; 5195 var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT; 5196 $(_this5.element).on(eventIn, _this5.config.selector, function (event) { 5197 return _this5._enter(event); 5198 }).on(eventOut, _this5.config.selector, function (event) { 5199 return _this5._leave(event); 5200 }); 5201 } 5202 }); 5203 5204 this._hideModalHandler = function () { 5205 if (_this5.element) { 5206 _this5.hide(); 5207 } 5208 }; 5209 5210 $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler); 5211 5212 if (this.config.selector) { 5213 this.config = _objectSpread2({}, this.config, { 5214 trigger: 'manual', 5215 selector: '' 5216 }); 5217 } else { 5218 this._fixTitle(); 5219 } 5220 }; 5221 5222 _proto._fixTitle = function _fixTitle() { 5223 var titleType = typeof this.element.getAttribute('data-original-title'); 5224 5225 if (this.element.getAttribute('title') || titleType !== 'string') { 5226 this.element.setAttribute('data-original-title', this.element.getAttribute('title') || ''); 5227 this.element.setAttribute('title', ''); 5228 } 5229 }; 5230 5231 _proto._enter = function _enter(event, context) { 5232 var dataKey = this.constructor.DATA_KEY; 5233 context = context || $(event.currentTarget).data(dataKey); 5234 5235 if (!context) { 5236 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 5237 $(event.currentTarget).data(dataKey, context); 5238 } 5239 5240 if (event) { 5241 context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true; 5242 } 5243 5244 if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) { 5245 context._hoverState = HoverState.SHOW; 5246 return; 5247 } 5248 5249 clearTimeout(context._timeout); 5250 context._hoverState = HoverState.SHOW; 5251 5252 if (!context.config.delay || !context.config.delay.show) { 5253 context.show(); 5254 return; 5255 } 5256 5257 context._timeout = setTimeout(function () { 5258 if (context._hoverState === HoverState.SHOW) { 5259 context.show(); 5260 } 5261 }, context.config.delay.show); 5262 }; 5263 5264 _proto._leave = function _leave(event, context) { 5265 var dataKey = this.constructor.DATA_KEY; 5266 context = context || $(event.currentTarget).data(dataKey); 5267 5268 if (!context) { 5269 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 5270 $(event.currentTarget).data(dataKey, context); 5271 } 5272 5273 if (event) { 5274 context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false; 5275 } 5276 5277 if (context._isWithActiveTrigger()) { 5278 return; 5279 } 5280 5281 clearTimeout(context._timeout); 5282 context._hoverState = HoverState.OUT; 5283 5284 if (!context.config.delay || !context.config.delay.hide) { 5285 context.hide(); 5286 return; 5287 } 5288 5289 context._timeout = setTimeout(function () { 5290 if (context._hoverState === HoverState.OUT) { 5291 context.hide(); 5292 } 5293 }, context.config.delay.hide); 5294 }; 5295 5296 _proto._isWithActiveTrigger = function _isWithActiveTrigger() { 5297 for (var trigger in this._activeTrigger) { 5298 if (this._activeTrigger[trigger]) { 5299 return true; 5300 } 5301 } 5302 5303 return false; 5304 }; 5305 5306 _proto._getConfig = function _getConfig(config) { 5307 var dataAttributes = $(this.element).data(); 5308 Object.keys(dataAttributes).forEach(function (dataAttr) { 5309 if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) { 5310 delete dataAttributes[dataAttr]; 5311 } 5312 }); 5313 config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {}); 5314 5315 if (typeof config.delay === 'number') { 5316 config.delay = { 5317 show: config.delay, 5318 hide: config.delay 5319 }; 5320 } 5321 5322 if (typeof config.title === 'number') { 5323 config.title = config.title.toString(); 5324 } 5325 5326 if (typeof config.content === 'number') { 5327 config.content = config.content.toString(); 5328 } 5329 5330 Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType); 5331 5332 if (config.sanitize) { 5333 config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn); 5334 } 5335 5336 return config; 5337 }; 5338 5339 _proto._getDelegateConfig = function _getDelegateConfig() { 5340 var config = {}; 5341 5342 if (this.config) { 5343 for (var key in this.config) { 5344 if (this.constructor.Default[key] !== this.config[key]) { 5345 config[key] = this.config[key]; 5346 } 5347 } 5348 } 5349 5350 return config; 5351 }; 5352 5353 _proto._cleanTipClass = function _cleanTipClass() { 5354 var $tip = $(this.getTipElement()); 5355 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); 5356 5357 if (tabClass !== null && tabClass.length) { 5358 $tip.removeClass(tabClass.join('')); 5359 } 5360 }; 5361 5362 _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) { 5363 var popperInstance = popperData.instance; 5364 this.tip = popperInstance.popper; 5365 5366 this._cleanTipClass(); 5367 5368 this.addAttachmentClass(this._getAttachment(popperData.placement)); 5369 }; 5370 5371 _proto._fixTransition = function _fixTransition() { 5372 var tip = this.getTipElement(); 5373 var initConfigAnimation = this.config.animation; 5374 5375 if (tip.getAttribute('x-placement') !== null) { 5376 return; 5377 } 5378 5379 $(tip).removeClass(ClassName$6.FADE); 5380 this.config.animation = false; 5381 this.hide(); 5382 this.show(); 5383 this.config.animation = initConfigAnimation; 5384 } // Static 5385 ; 5386 5387 Tooltip._jQueryInterface = function _jQueryInterface(config) { 5388 return this.each(function () { 5389 var data = $(this).data(DATA_KEY$6); 5390 5391 var _config = typeof config === 'object' && config; 5392 5393 if (!data && /dispose|hide/.test(config)) { 5394 return; 5395 } 5396 5397 if (!data) { 5398 data = new Tooltip(this, _config); 5399 $(this).data(DATA_KEY$6, data); 5400 } 5401 5402 if (typeof config === 'string') { 5403 if (typeof data[config] === 'undefined') { 5404 throw new TypeError("No method named \"" + config + "\""); 5405 } 5406 5407 data[config](); 5408 } 5409 }); 5410 }; 5411 5412 _createClass(Tooltip, null, [{ 5413 key: "VERSION", 5414 get: function get() { 5415 return VERSION$6; 5416 } 5417 }, { 5418 key: "Default", 5419 get: function get() { 5420 return Default$4; 5421 } 5422 }, { 5423 key: "NAME", 5424 get: function get() { 5425 return NAME$6; 5426 } 5427 }, { 5428 key: "DATA_KEY", 5429 get: function get() { 5430 return DATA_KEY$6; 5431 } 5432 }, { 5433 key: "Event", 5434 get: function get() { 5435 return Event$6; 5436 } 5437 }, { 5438 key: "EVENT_KEY", 5439 get: function get() { 5440 return EVENT_KEY$6; 5441 } 5442 }, { 5443 key: "DefaultType", 5444 get: function get() { 5445 return DefaultType$4; 5446 } 5447 }]); 5448 5449 return Tooltip; 5450 }(); 5451 /** 5452 * ------------------------------------------------------------------------ 5453 * jQuery 5454 * ------------------------------------------------------------------------ 5455 */ 5456 5457 5458 $.fn[NAME$6] = Tooltip._jQueryInterface; 5459 $.fn[NAME$6].Constructor = Tooltip; 5460 5461 $.fn[NAME$6].noConflict = function () { 5462 $.fn[NAME$6] = JQUERY_NO_CONFLICT$6; 5463 return Tooltip._jQueryInterface; 5464 }; 5465 5466 /** 5467 * ------------------------------------------------------------------------ 5468 * Constants 5469 * ------------------------------------------------------------------------ 5470 */ 5471 5472 var NAME$7 = 'popover'; 5473 var VERSION$7 = '4.4.1'; 5474 var DATA_KEY$7 = 'bs.popover'; 5475 var EVENT_KEY$7 = "." + DATA_KEY$7; 5476 var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7]; 5477 var CLASS_PREFIX$1 = 'bs-popover'; 5478 var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g'); 5479 5480 var Default$5 = _objectSpread2({}, Tooltip.Default, { 5481 placement: 'right', 5482 trigger: 'click', 5483 content: '', 5484 template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>' 5485 }); 5486 5487 var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, { 5488 content: '(string|element|function)' 5489 }); 5490 5491 var ClassName$7 = { 5492 FADE: 'fade', 5493 SHOW: 'show' 5494 }; 5495 var Selector$7 = { 5496 TITLE: '.popover-header', 5497 CONTENT: '.popover-body' 5498 }; 5499 var Event$7 = { 5500 HIDE: "hide" + EVENT_KEY$7, 5501 HIDDEN: "hidden" + EVENT_KEY$7, 5502 SHOW: "show" + EVENT_KEY$7, 5503 SHOWN: "shown" + EVENT_KEY$7, 5504 INSERTED: "inserted" + EVENT_KEY$7, 5505 CLICK: "click" + EVENT_KEY$7, 5506 FOCUSIN: "focusin" + EVENT_KEY$7, 5507 FOCUSOUT: "focusout" + EVENT_KEY$7, 5508 MOUSEENTER: "mouseenter" + EVENT_KEY$7, 5509 MOUSELEAVE: "mouseleave" + EVENT_KEY$7 5510 }; 5511 /** 5512 * ------------------------------------------------------------------------ 5513 * Class Definition 5514 * ------------------------------------------------------------------------ 5515 */ 5516 5517 var Popover = 5518 /*#__PURE__*/ 5519 function (_Tooltip) { 5520 _inheritsLoose(Popover, _Tooltip); 5521 5522 function Popover() { 5523 return _Tooltip.apply(this, arguments) || this; 5524 } 5525 5526 var _proto = Popover.prototype; 5527 5528 // Overrides 5529 _proto.isWithContent = function isWithContent() { 5530 return this.getTitle() || this._getContent(); 5531 }; 5532 5533 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 5534 $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment); 5535 }; 5536 5537 _proto.getTipElement = function getTipElement() { 5538 this.tip = this.tip || $(this.config.template)[0]; 5539 return this.tip; 5540 }; 5541 5542 _proto.setContent = function setContent() { 5543 var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events 5544 5545 this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle()); 5546 5547 var content = this._getContent(); 5548 5549 if (typeof content === 'function') { 5550 content = content.call(this.element); 5551 } 5552 5553 this.setElementContent($tip.find(Selector$7.CONTENT), content); 5554 $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW); 5555 } // Private 5556 ; 5557 5558 _proto._getContent = function _getContent() { 5559 return this.element.getAttribute('data-content') || this.config.content; 5560 }; 5561 5562 _proto._cleanTipClass = function _cleanTipClass() { 5563 var $tip = $(this.getTipElement()); 5564 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1); 5565 5566 if (tabClass !== null && tabClass.length > 0) { 5567 $tip.removeClass(tabClass.join('')); 5568 } 5569 } // Static 5570 ; 5571 5572 Popover._jQueryInterface = function _jQueryInterface(config) { 5573 return this.each(function () { 5574 var data = $(this).data(DATA_KEY$7); 5575 5576 var _config = typeof config === 'object' ? config : null; 5577 5578 if (!data && /dispose|hide/.test(config)) { 5579 return; 5580 } 5581 5582 if (!data) { 5583 data = new Popover(this, _config); 5584 $(this).data(DATA_KEY$7, data); 5585 } 5586 5587 if (typeof config === 'string') { 5588 if (typeof data[config] === 'undefined') { 5589 throw new TypeError("No method named \"" + config + "\""); 5590 } 5591 5592 data[config](); 5593 } 5594 }); 5595 }; 5596 5597 _createClass(Popover, null, [{ 5598 key: "VERSION", 5599 // Getters 5600 get: function get() { 5601 return VERSION$7; 5602 } 5603 }, { 5604 key: "Default", 5605 get: function get() { 5606 return Default$5; 5607 } 5608 }, { 5609 key: "NAME", 5610 get: function get() { 5611 return NAME$7; 5612 } 5613 }, { 5614 key: "DATA_KEY", 5615 get: function get() { 5616 return DATA_KEY$7; 5617 } 5618 }, { 5619 key: "Event", 5620 get: function get() { 5621 return Event$7; 5622 } 5623 }, { 5624 key: "EVENT_KEY", 5625 get: function get() { 5626 return EVENT_KEY$7; 5627 } 5628 }, { 5629 key: "DefaultType", 5630 get: function get() { 5631 return DefaultType$5; 5632 } 5633 }]); 5634 5635 return Popover; 5636 }(Tooltip); 5637 /** 5638 * ------------------------------------------------------------------------ 5639 * jQuery 5640 * ------------------------------------------------------------------------ 5641 */ 5642 5643 5644 $.fn[NAME$7] = Popover._jQueryInterface; 5645 $.fn[NAME$7].Constructor = Popover; 5646 5647 $.fn[NAME$7].noConflict = function () { 5648 $.fn[NAME$7] = JQUERY_NO_CONFLICT$7; 5649 return Popover._jQueryInterface; 5650 }; 5651 5652 /** 5653 * ------------------------------------------------------------------------ 5654 * Constants 5655 * ------------------------------------------------------------------------ 5656 */ 5657 5658 var NAME$8 = 'scrollspy'; 5659 var VERSION$8 = '4.4.1'; 5660 var DATA_KEY$8 = 'bs.scrollspy'; 5661 var EVENT_KEY$8 = "." + DATA_KEY$8; 5662 var DATA_API_KEY$6 = '.data-api'; 5663 var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8]; 5664 var Default$6 = { 5665 offset: 10, 5666 method: 'auto', 5667 target: '' 5668 }; 5669 var DefaultType$6 = { 5670 offset: 'number', 5671 method: 'string', 5672 target: '(string|element)' 5673 }; 5674 var Event$8 = { 5675 ACTIVATE: "activate" + EVENT_KEY$8, 5676 SCROLL: "scroll" + EVENT_KEY$8, 5677 LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6 5678 }; 5679 var ClassName$8 = { 5680 DROPDOWN_ITEM: 'dropdown-item', 5681 DROPDOWN_MENU: 'dropdown-menu', 5682 ACTIVE: 'active' 5683 }; 5684 var Selector$8 = { 5685 DATA_SPY: '[data-spy="scroll"]', 5686 ACTIVE: '.active', 5687 NAV_LIST_GROUP: '.nav, .list-group', 5688 NAV_LINKS: '.nav-link', 5689 NAV_ITEMS: '.nav-item', 5690 LIST_ITEMS: '.list-group-item', 5691 DROPDOWN: '.dropdown', 5692 DROPDOWN_ITEMS: '.dropdown-item', 5693 DROPDOWN_TOGGLE: '.dropdown-toggle' 5694 }; 5695 var OffsetMethod = { 5696 OFFSET: 'offset', 5697 POSITION: 'position' 5698 }; 5699 /** 5700 * ------------------------------------------------------------------------ 5701 * Class Definition 5702 * ------------------------------------------------------------------------ 5703 */ 5704 5705 var ScrollSpy = 5706 /*#__PURE__*/ 5707 function () { 5708 function ScrollSpy(element, config) { 5709 var _this = this; 5710 5711 this._element = element; 5712 this._scrollElement = element.tagName === 'BODY' ? window : element; 5713 this._config = this._getConfig(config); 5714 this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS); 5715 this._offsets = []; 5716 this._targets = []; 5717 this._activeTarget = null; 5718 this._scrollHeight = 0; 5719 $(this._scrollElement).on(Event$8.SCROLL, function (event) { 5720 return _this._process(event); 5721 }); 5722 this.refresh(); 5723 5724 this._process(); 5725 } // Getters 5726 5727 5728 var _proto = ScrollSpy.prototype; 5729 5730 // Public 5731 _proto.refresh = function refresh() { 5732 var _this2 = this; 5733 5734 var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION; 5735 var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; 5736 var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0; 5737 this._offsets = []; 5738 this._targets = []; 5739 this._scrollHeight = this._getScrollHeight(); 5740 var targets = [].slice.call(document.querySelectorAll(this._selector)); 5741 targets.map(function (element) { 5742 var target; 5743 var targetSelector = Util.getSelectorFromElement(element); 5744 5745 if (targetSelector) { 5746 target = document.querySelector(targetSelector); 5747 } 5748 5749 if (target) { 5750 var targetBCR = target.getBoundingClientRect(); 5751 5752 if (targetBCR.width || targetBCR.height) { 5753 // TODO (fat): remove sketch reliance on jQuery position/offset 5754 return [$(target)[offsetMethod]().top + offsetBase, targetSelector]; 5755 } 5756 } 5757 5758 return null; 5759 }).filter(function (item) { 5760 return item; 5761 }).sort(function (a, b) { 5762 return a[0] - b[0]; 5763 }).forEach(function (item) { 5764 _this2._offsets.push(item[0]); 5765 5766 _this2._targets.push(item[1]); 5767 }); 5768 }; 5769 5770 _proto.dispose = function dispose() { 5771 $.removeData(this._element, DATA_KEY$8); 5772 $(this._scrollElement).off(EVENT_KEY$8); 5773 this._element = null; 5774 this._scrollElement = null; 5775 this._config = null; 5776 this._selector = null; 5777 this._offsets = null; 5778 this._targets = null; 5779 this._activeTarget = null; 5780 this._scrollHeight = null; 5781 } // Private 5782 ; 5783 5784 _proto._getConfig = function _getConfig(config) { 5785 config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {}); 5786 5787 if (typeof config.target !== 'string') { 5788 var id = $(config.target).attr('id'); 5789 5790 if (!id) { 5791 id = Util.getUID(NAME$8); 5792 $(config.target).attr('id', id); 5793 } 5794 5795 config.target = "#" + id; 5796 } 5797 5798 Util.typeCheckConfig(NAME$8, config, DefaultType$6); 5799 return config; 5800 }; 5801 5802 _proto._getScrollTop = function _getScrollTop() { 5803 return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; 5804 }; 5805 5806 _proto._getScrollHeight = function _getScrollHeight() { 5807 return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); 5808 }; 5809 5810 _proto._getOffsetHeight = function _getOffsetHeight() { 5811 return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; 5812 }; 5813 5814 _proto._process = function _process() { 5815 var scrollTop = this._getScrollTop() + this._config.offset; 5816 5817 var scrollHeight = this._getScrollHeight(); 5818 5819 var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); 5820 5821 if (this._scrollHeight !== scrollHeight) { 5822 this.refresh(); 5823 } 5824 5825 if (scrollTop >= maxScroll) { 5826 var target = this._targets[this._targets.length - 1]; 5827 5828 if (this._activeTarget !== target) { 5829 this._activate(target); 5830 } 5831 5832 return; 5833 } 5834 5835 if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { 5836 this._activeTarget = null; 5837 5838 this._clear(); 5839 5840 return; 5841 } 5842 5843 var offsetLength = this._offsets.length; 5844 5845 for (var i = offsetLength; i--;) { 5846 var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); 5847 5848 if (isActiveTarget) { 5849 this._activate(this._targets[i]); 5850 } 5851 } 5852 }; 5853 5854 _proto._activate = function _activate(target) { 5855 this._activeTarget = target; 5856 5857 this._clear(); 5858 5859 var queries = this._selector.split(',').map(function (selector) { 5860 return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]"; 5861 }); 5862 5863 var $link = $([].slice.call(document.querySelectorAll(queries.join(',')))); 5864 5865 if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) { 5866 $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE); 5867 $link.addClass(ClassName$8.ACTIVE); 5868 } else { 5869 // Set triggered link as active 5870 $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active 5871 // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor 5872 5873 $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_LINKS + ", " + Selector$8.LIST_ITEMS).addClass(ClassName$8.ACTIVE); // Handle special case when .nav-link is inside .nav-item 5874 5875 $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE); 5876 } 5877 5878 $(this._scrollElement).trigger(Event$8.ACTIVATE, { 5879 relatedTarget: target 5880 }); 5881 }; 5882 5883 _proto._clear = function _clear() { 5884 [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) { 5885 return node.classList.contains(ClassName$8.ACTIVE); 5886 }).forEach(function (node) { 5887 return node.classList.remove(ClassName$8.ACTIVE); 5888 }); 5889 } // Static 5890 ; 5891 5892 ScrollSpy._jQueryInterface = function _jQueryInterface(config) { 5893 return this.each(function () { 5894 var data = $(this).data(DATA_KEY$8); 5895 5896 var _config = typeof config === 'object' && config; 5897 5898 if (!data) { 5899 data = new ScrollSpy(this, _config); 5900 $(this).data(DATA_KEY$8, data); 5901 } 5902 5903 if (typeof config === 'string') { 5904 if (typeof data[config] === 'undefined') { 5905 throw new TypeError("No method named \"" + config + "\""); 5906 } 5907 5908 data[config](); 5909 } 5910 }); 5911 }; 5912 5913 _createClass(ScrollSpy, null, [{ 5914 key: "VERSION", 5915 get: function get() { 5916 return VERSION$8; 5917 } 5918 }, { 5919 key: "Default", 5920 get: function get() { 5921 return Default$6; 5922 } 5923 }]); 5924 5925 return ScrollSpy; 5926 }(); 5927 /** 5928 * ------------------------------------------------------------------------ 5929 * Data Api implementation 5930 * ------------------------------------------------------------------------ 5931 */ 5932 5933 5934 $(window).on(Event$8.LOAD_DATA_API, function () { 5935 var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY)); 5936 var scrollSpysLength = scrollSpys.length; 5937 5938 for (var i = scrollSpysLength; i--;) { 5939 var $spy = $(scrollSpys[i]); 5940 5941 ScrollSpy._jQueryInterface.call($spy, $spy.data()); 5942 } 5943 }); 5944 /** 5945 * ------------------------------------------------------------------------ 5946 * jQuery 5947 * ------------------------------------------------------------------------ 5948 */ 5949 5950 $.fn[NAME$8] = ScrollSpy._jQueryInterface; 5951 $.fn[NAME$8].Constructor = ScrollSpy; 5952 5953 $.fn[NAME$8].noConflict = function () { 5954 $.fn[NAME$8] = JQUERY_NO_CONFLICT$8; 5955 return ScrollSpy._jQueryInterface; 5956 }; 5957 5958 /** 5959 * ------------------------------------------------------------------------ 5960 * Constants 5961 * ------------------------------------------------------------------------ 5962 */ 5963 5964 var NAME$9 = 'tab'; 5965 var VERSION$9 = '4.4.1'; 5966 var DATA_KEY$9 = 'bs.tab'; 5967 var EVENT_KEY$9 = "." + DATA_KEY$9; 5968 var DATA_API_KEY$7 = '.data-api'; 5969 var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9]; 5970 var Event$9 = { 5971 HIDE: "hide" + EVENT_KEY$9, 5972 HIDDEN: "hidden" + EVENT_KEY$9, 5973 SHOW: "show" + EVENT_KEY$9, 5974 SHOWN: "shown" + EVENT_KEY$9, 5975 CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7 5976 }; 5977 var ClassName$9 = { 5978 DROPDOWN_MENU: 'dropdown-menu', 5979 ACTIVE: 'active', 5980 DISABLED: 'disabled', 5981 FADE: 'fade', 5982 SHOW: 'show' 5983 }; 5984 var Selector$9 = { 5985 DROPDOWN: '.dropdown', 5986 NAV_LIST_GROUP: '.nav, .list-group', 5987 ACTIVE: '.active', 5988 ACTIVE_UL: '> li > .active', 5989 DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]', 5990 DROPDOWN_TOGGLE: '.dropdown-toggle', 5991 DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active' 5992 }; 5993 /** 5994 * ------------------------------------------------------------------------ 5995 * Class Definition 5996 * ------------------------------------------------------------------------ 5997 */ 5998 5999 var Tab = 6000 /*#__PURE__*/ 6001 function () { 6002 function Tab(element) { 6003 this._element = element; 6004 } // Getters 6005 6006 6007 var _proto = Tab.prototype; 6008 6009 // Public 6010 _proto.show = function show() { 6011 var _this = this; 6012 6013 if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) { 6014 return; 6015 } 6016 6017 var target; 6018 var previous; 6019 var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0]; 6020 var selector = Util.getSelectorFromElement(this._element); 6021 6022 if (listElement) { 6023 var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE; 6024 previous = $.makeArray($(listElement).find(itemSelector)); 6025 previous = previous[previous.length - 1]; 6026 } 6027 6028 var hideEvent = $.Event(Event$9.HIDE, { 6029 relatedTarget: this._element 6030 }); 6031 var showEvent = $.Event(Event$9.SHOW, { 6032 relatedTarget: previous 6033 }); 6034 6035 if (previous) { 6036 $(previous).trigger(hideEvent); 6037 } 6038 6039 $(this._element).trigger(showEvent); 6040 6041 if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) { 6042 return; 6043 } 6044 6045 if (selector) { 6046 target = document.querySelector(selector); 6047 } 6048 6049 this._activate(this._element, listElement); 6050 6051 var complete = function complete() { 6052 var hiddenEvent = $.Event(Event$9.HIDDEN, { 6053 relatedTarget: _this._element 6054 }); 6055 var shownEvent = $.Event(Event$9.SHOWN, { 6056 relatedTarget: previous 6057 }); 6058 $(previous).trigger(hiddenEvent); 6059 $(_this._element).trigger(shownEvent); 6060 }; 6061 6062 if (target) { 6063 this._activate(target, target.parentNode, complete); 6064 } else { 6065 complete(); 6066 } 6067 }; 6068 6069 _proto.dispose = function dispose() { 6070 $.removeData(this._element, DATA_KEY$9); 6071 this._element = null; 6072 } // Private 6073 ; 6074 6075 _proto._activate = function _activate(element, container, callback) { 6076 var _this2 = this; 6077 6078 var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE); 6079 var active = activeElements[0]; 6080 var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE); 6081 6082 var complete = function complete() { 6083 return _this2._transitionComplete(element, active, callback); 6084 }; 6085 6086 if (active && isTransitioning) { 6087 var transitionDuration = Util.getTransitionDurationFromElement(active); 6088 $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 6089 } else { 6090 complete(); 6091 } 6092 }; 6093 6094 _proto._transitionComplete = function _transitionComplete(element, active, callback) { 6095 if (active) { 6096 $(active).removeClass(ClassName$9.ACTIVE); 6097 var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0]; 6098 6099 if (dropdownChild) { 6100 $(dropdownChild).removeClass(ClassName$9.ACTIVE); 6101 } 6102 6103 if (active.getAttribute('role') === 'tab') { 6104 active.setAttribute('aria-selected', false); 6105 } 6106 } 6107 6108 $(element).addClass(ClassName$9.ACTIVE); 6109 6110 if (element.getAttribute('role') === 'tab') { 6111 element.setAttribute('aria-selected', true); 6112 } 6113 6114 Util.reflow(element); 6115 6116 if (element.classList.contains(ClassName$9.FADE)) { 6117 element.classList.add(ClassName$9.SHOW); 6118 } 6119 6120 if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) { 6121 var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0]; 6122 6123 if (dropdownElement) { 6124 var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE)); 6125 $(dropdownToggleList).addClass(ClassName$9.ACTIVE); 6126 } 6127 6128 element.setAttribute('aria-expanded', true); 6129 } 6130 6131 if (callback) { 6132 callback(); 6133 } 6134 } // Static 6135 ; 6136 6137 Tab._jQueryInterface = function _jQueryInterface(config) { 6138 return this.each(function () { 6139 var $this = $(this); 6140 var data = $this.data(DATA_KEY$9); 6141 6142 if (!data) { 6143 data = new Tab(this); 6144 $this.data(DATA_KEY$9, data); 6145 } 6146 6147 if (typeof config === 'string') { 6148 if (typeof data[config] === 'undefined') { 6149 throw new TypeError("No method named \"" + config + "\""); 6150 } 6151 6152 data[config](); 6153 } 6154 }); 6155 }; 6156 6157 _createClass(Tab, null, [{ 6158 key: "VERSION", 6159 get: function get() { 6160 return VERSION$9; 6161 } 6162 }]); 6163 6164 return Tab; 6165 }(); 6166 /** 6167 * ------------------------------------------------------------------------ 6168 * Data Api implementation 6169 * ------------------------------------------------------------------------ 6170 */ 6171 6172 6173 $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) { 6174 event.preventDefault(); 6175 6176 Tab._jQueryInterface.call($(this), 'show'); 6177 }); 6178 /** 6179 * ------------------------------------------------------------------------ 6180 * jQuery 6181 * ------------------------------------------------------------------------ 6182 */ 6183 6184 $.fn[NAME$9] = Tab._jQueryInterface; 6185 $.fn[NAME$9].Constructor = Tab; 6186 6187 $.fn[NAME$9].noConflict = function () { 6188 $.fn[NAME$9] = JQUERY_NO_CONFLICT$9; 6189 return Tab._jQueryInterface; 6190 }; 6191 6192 /** 6193 * ------------------------------------------------------------------------ 6194 * Constants 6195 * ------------------------------------------------------------------------ 6196 */ 6197 6198 var NAME$a = 'toast'; 6199 var VERSION$a = '4.4.1'; 6200 var DATA_KEY$a = 'bs.toast'; 6201 var EVENT_KEY$a = "." + DATA_KEY$a; 6202 var JQUERY_NO_CONFLICT$a = $.fn[NAME$a]; 6203 var Event$a = { 6204 CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a, 6205 HIDE: "hide" + EVENT_KEY$a, 6206 HIDDEN: "hidden" + EVENT_KEY$a, 6207 SHOW: "show" + EVENT_KEY$a, 6208 SHOWN: "shown" + EVENT_KEY$a 6209 }; 6210 var ClassName$a = { 6211 FADE: 'fade', 6212 HIDE: 'hide', 6213 SHOW: 'show', 6214 SHOWING: 'showing' 6215 }; 6216 var DefaultType$7 = { 6217 animation: 'boolean', 6218 autohide: 'boolean', 6219 delay: 'number' 6220 }; 6221 var Default$7 = { 6222 animation: true, 6223 autohide: true, 6224 delay: 500 6225 }; 6226 var Selector$a = { 6227 DATA_DISMISS: '[data-dismiss="toast"]' 6228 }; 6229 /** 6230 * ------------------------------------------------------------------------ 6231 * Class Definition 6232 * ------------------------------------------------------------------------ 6233 */ 6234 6235 var Toast = 6236 /*#__PURE__*/ 6237 function () { 6238 function Toast(element, config) { 6239 this._element = element; 6240 this._config = this._getConfig(config); 6241 this._timeout = null; 6242 6243 this._setListeners(); 6244 } // Getters 6245 6246 6247 var _proto = Toast.prototype; 6248 6249 // Public 6250 _proto.show = function show() { 6251 var _this = this; 6252 6253 var showEvent = $.Event(Event$a.SHOW); 6254 $(this._element).trigger(showEvent); 6255 6256 if (showEvent.isDefaultPrevented()) { 6257 return; 6258 } 6259 6260 if (this._config.animation) { 6261 this._element.classList.add(ClassName$a.FADE); 6262 } 6263 6264 var complete = function complete() { 6265 _this._element.classList.remove(ClassName$a.SHOWING); 6266 6267 _this._element.classList.add(ClassName$a.SHOW); 6268 6269 $(_this._element).trigger(Event$a.SHOWN); 6270 6271 if (_this._config.autohide) { 6272 _this._timeout = setTimeout(function () { 6273 _this.hide(); 6274 }, _this._config.delay); 6275 } 6276 }; 6277 6278 this._element.classList.remove(ClassName$a.HIDE); 6279 6280 Util.reflow(this._element); 6281 6282 this._element.classList.add(ClassName$a.SHOWING); 6283 6284 if (this._config.animation) { 6285 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 6286 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 6287 } else { 6288 complete(); 6289 } 6290 }; 6291 6292 _proto.hide = function hide() { 6293 if (!this._element.classList.contains(ClassName$a.SHOW)) { 6294 return; 6295 } 6296 6297 var hideEvent = $.Event(Event$a.HIDE); 6298 $(this._element).trigger(hideEvent); 6299 6300 if (hideEvent.isDefaultPrevented()) { 6301 return; 6302 } 6303 6304 this._close(); 6305 }; 6306 6307 _proto.dispose = function dispose() { 6308 clearTimeout(this._timeout); 6309 this._timeout = null; 6310 6311 if (this._element.classList.contains(ClassName$a.SHOW)) { 6312 this._element.classList.remove(ClassName$a.SHOW); 6313 } 6314 6315 $(this._element).off(Event$a.CLICK_DISMISS); 6316 $.removeData(this._element, DATA_KEY$a); 6317 this._element = null; 6318 this._config = null; 6319 } // Private 6320 ; 6321 6322 _proto._getConfig = function _getConfig(config) { 6323 config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {}); 6324 Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType); 6325 return config; 6326 }; 6327 6328 _proto._setListeners = function _setListeners() { 6329 var _this2 = this; 6330 6331 $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () { 6332 return _this2.hide(); 6333 }); 6334 }; 6335 6336 _proto._close = function _close() { 6337 var _this3 = this; 6338 6339 var complete = function complete() { 6340 _this3._element.classList.add(ClassName$a.HIDE); 6341 6342 $(_this3._element).trigger(Event$a.HIDDEN); 6343 }; 6344 6345 this._element.classList.remove(ClassName$a.SHOW); 6346 6347 if (this._config.animation) { 6348 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 6349 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 6350 } else { 6351 complete(); 6352 } 6353 } // Static 6354 ; 6355 6356 Toast._jQueryInterface = function _jQueryInterface(config) { 6357 return this.each(function () { 6358 var $element = $(this); 6359 var data = $element.data(DATA_KEY$a); 6360 6361 var _config = typeof config === 'object' && config; 6362 6363 if (!data) { 6364 data = new Toast(this, _config); 6365 $element.data(DATA_KEY$a, data); 6366 } 6367 6368 if (typeof config === 'string') { 6369 if (typeof data[config] === 'undefined') { 6370 throw new TypeError("No method named \"" + config + "\""); 6371 } 6372 6373 data[config](this); 6374 } 6375 }); 6376 }; 6377 6378 _createClass(Toast, null, [{ 6379 key: "VERSION", 6380 get: function get() { 6381 return VERSION$a; 6382 } 6383 }, { 6384 key: "DefaultType", 6385 get: function get() { 6386 return DefaultType$7; 6387 } 6388 }, { 6389 key: "Default", 6390 get: function get() { 6391 return Default$7; 6392 } 6393 }]); 6394 6395 return Toast; 6396 }(); 6397 /** 6398 * ------------------------------------------------------------------------ 6399 * jQuery 6400 * ------------------------------------------------------------------------ 6401 */ 6402 6403 6404 $.fn[NAME$a] = Toast._jQueryInterface; 6405 $.fn[NAME$a].Constructor = Toast; 6406 6407 $.fn[NAME$a].noConflict = function () { 6408 $.fn[NAME$a] = JQUERY_NO_CONFLICT$a; 6409 return Toast._jQueryInterface; 6410 }; 6411 6412 exports.Alert = Alert; 6413 exports.Button = Button; 6414 exports.Carousel = Carousel; 6415 exports.Collapse = Collapse; 6416 exports.Dropdown = Dropdown; 6417 exports.Modal = Modal; 6418 exports.Popover = Popover; 6419 exports.Scrollspy = ScrollSpy; 6420 exports.Tab = Tab; 6421 exports.Toast = Toast; 6422 exports.Tooltip = Tooltip; 6423 exports.Util = Util; 6424 6425 Object.defineProperty(exports, '__esModule', { value: true }); 6426 6427}))); 6428//# sourceMappingURL=bootstrap.js.map 6429 6430 6431/***/ }), 6432
vendor: 280,859 bytes, lines 6433-17042
6433/***/ "./node_modules/jquery/dist/jquery.js": 6434/*!********************************************!*\ 6435 !*** ./node_modules/jquery/dist/jquery.js ***! 6436 \********************************************/ 6437/*! no static exports found */ 6438/***/ (function(module, exports, __webpack_require__) { 6439 6440var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 6441 * jQuery JavaScript Library v3.4.1 6442 * https://jquery.com/ 6443 * 6444 * Includes Sizzle.js 6445 * https://sizzlejs.com/ 6446 * 6447 * Copyright JS Foundation and other contributors 6448 * Released under the MIT license 6449 * https://jquery.org/license 6450 * 6451 * Date: 2019-05-01T21:04Z 6452 */ 6453( function( global, factory ) { 6454 6455 "use strict"; 6456 6457 if ( true && typeof module.exports === "object" ) { 6458 6459 // For CommonJS and CommonJS-like environments where a proper `window` 6460 // is present, execute the factory and get jQuery. 6461 // For environments that do not have a `window` with a `document` 6462 // (such as Node.js), expose a factory as module.exports. 6463 // This accentuates the need for the creation of a real `window`. 6464 // e.g. var jQuery = require("jquery")(window); 6465 // See ticket #14549 for more info. 6466 module.exports = global.document ? 6467 factory( global, true ) : 6468 function( w ) { 6469 if ( !w.document ) { 6470 throw new Error( "jQuery requires a window with a document" ); 6471 } 6472 return factory( w ); 6473 }; 6474 } else { 6475 factory( global ); 6476 } 6477 6478// Pass this if window is not defined yet 6479} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 6480 6481// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 6482// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 6483// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common 6484// enough that all such attempts are guarded in a try block. 6485"use strict"; 6486 6487var arr = []; 6488 6489var document = window.document; 6490 6491var getProto = Object.getPrototypeOf; 6492 6493var slice = arr.slice; 6494 6495var concat = arr.concat; 6496 6497var push = arr.push; 6498 6499var indexOf = arr.indexOf; 6500 6501var class2type = {}; 6502 6503var toString = class2type.toString; 6504 6505var hasOwn = class2type.hasOwnProperty; 6506 6507var fnToString = hasOwn.toString; 6508 6509var ObjectFunctionString = fnToString.call( Object ); 6510 6511var support = {}; 6512 6513var isFunction = function isFunction( obj ) { 6514 6515 // Support: Chrome <=57, Firefox <=52 6516 // In some browsers, typeof returns "function" for HTML <object> elements 6517 // (i.e., `typeof document.createElement( "object" ) === "function"`). 6518 // We don't want to classify *any* DOM node as a function. 6519 return typeof obj === "function" && typeof obj.nodeType !== "number"; 6520 }; 6521 6522 6523var isWindow = function isWindow( obj ) { 6524 return obj != null && obj === obj.window; 6525 }; 6526 6527 6528 6529 6530 var preservedScriptAttributes = { 6531 type: true, 6532 src: true, 6533 nonce: true, 6534 noModule: true 6535 }; 6536 6537 function DOMEval( code, node, doc ) { 6538 doc = doc || document; 6539 6540 var i, val, 6541 script = doc.createElement( "script" ); 6542 6543 script.text = code; 6544 if ( node ) { 6545 for ( i in preservedScriptAttributes ) { 6546 6547 // Support: Firefox 64+, Edge 18+ 6548 // Some browsers don't support the "nonce" property on scripts. 6549 // On the other hand, just using `getAttribute` is not enough as 6550 // the `nonce` attribute is reset to an empty string whenever it 6551 // becomes browsing-context connected. 6552 // See https://github.com/whatwg/html/issues/2369 6553 // See https://html.spec.whatwg.org/#nonce-attributes 6554 // The `node.getAttribute` check was added for the sake of 6555 // `jQuery.globalEval` so that it can fake a nonce-containing node 6556 // via an object. 6557 val = node[ i ] || node.getAttribute && node.getAttribute( i ); 6558 if ( val ) { 6559 script.setAttribute( i, val ); 6560 } 6561 } 6562 } 6563 doc.head.appendChild( script ).parentNode.removeChild( script ); 6564 } 6565 6566 6567function toType( obj ) { 6568 if ( obj == null ) { 6569 return obj + ""; 6570 } 6571 6572 // Support: Android <=2.3 only (functionish RegExp) 6573 return typeof obj === "object" || typeof obj === "function" ? 6574 class2type[ toString.call( obj ) ] || "object" : 6575 typeof obj; 6576} 6577/* global Symbol */ 6578// Defining this global in .eslintrc.json would create a danger of using the global 6579// unguarded in another place, it seems safer to define global only for this module 6580 6581 6582 6583var 6584 version = "3.4.1", 6585 6586 // Define a local copy of jQuery 6587 jQuery = function( selector, context ) { 6588 6589 // The jQuery object is actually just the init constructor 'enhanced' 6590 // Need init if jQuery is called (just allow error to be thrown if not included) 6591 return new jQuery.fn.init( selector, context ); 6592 }, 6593 6594 // Support: Android <=4.0 only 6595 // Make sure we trim BOM and NBSP 6596 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; 6597 6598jQuery.fn = jQuery.prototype = { 6599 6600 // The current version of jQuery being used 6601 jquery: version, 6602 6603 constructor: jQuery, 6604 6605 // The default length of a jQuery object is 0 6606 length: 0, 6607 6608 toArray: function() { 6609 return slice.call( this ); 6610 }, 6611 6612 // Get the Nth element in the matched element set OR 6613 // Get the whole matched element set as a clean array 6614 get: function( num ) { 6615 6616 // Return all the elements in a clean array 6617 if ( num == null ) { 6618 return slice.call( this ); 6619 } 6620 6621 // Return just the one element from the set 6622 return num < 0 ? this[ num + this.length ] : this[ num ]; 6623 }, 6624 6625 // Take an array of elements and push it onto the stack 6626 // (returning the new matched element set) 6627 pushStack: function( elems ) { 6628 6629 // Build a new jQuery matched element set 6630 var ret = jQuery.merge( this.constructor(), elems ); 6631 6632 // Add the old object onto the stack (as a reference) 6633 ret.prevObject = this; 6634 6635 // Return the newly-formed element set 6636 return ret; 6637 }, 6638 6639 // Execute a callback for every element in the matched set. 6640 each: function( callback ) { 6641 return jQuery.each( this, callback ); 6642 }, 6643 6644 map: function( callback ) { 6645 return this.pushStack( jQuery.map( this, function( elem, i ) { 6646 return callback.call( elem, i, elem ); 6647 } ) ); 6648 }, 6649 6650 slice: function() { 6651 return this.pushStack( slice.apply( this, arguments ) ); 6652 }, 6653 6654 first: function() { 6655 return this.eq( 0 ); 6656 }, 6657 6658 last: function() { 6659 return this.eq( -1 ); 6660 }, 6661 6662 eq: function( i ) { 6663 var len = this.length, 6664 j = +i + ( i < 0 ? len : 0 ); 6665 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 6666 }, 6667 6668 end: function() { 6669 return this.prevObject || this.constructor(); 6670 }, 6671 6672 // For internal use only. 6673 // Behaves like an Array's method, not like a jQuery method. 6674 push: push, 6675 sort: arr.sort, 6676 splice: arr.splice 6677}; 6678 6679jQuery.extend = jQuery.fn.extend = function() { 6680 var options, name, src, copy, copyIsArray, clone, 6681 target = arguments[ 0 ] || {}, 6682 i = 1, 6683 length = arguments.length, 6684 deep = false; 6685 6686 // Handle a deep copy situation 6687 if ( typeof target === "boolean" ) { 6688 deep = target; 6689 6690 // Skip the boolean and the target 6691 target = arguments[ i ] || {}; 6692 i++; 6693 } 6694 6695 // Handle case when target is a string or something (possible in deep copy) 6696 if ( typeof target !== "object" && !isFunction( target ) ) { 6697 target = {}; 6698 } 6699 6700 // Extend jQuery itself if only one argument is passed 6701 if ( i === length ) { 6702 target = this; 6703 i--; 6704 } 6705 6706 for ( ; i < length; i++ ) { 6707 6708 // Only deal with non-null/undefined values 6709 if ( ( options = arguments[ i ] ) != null ) { 6710 6711 // Extend the base object 6712 for ( name in options ) { 6713 copy = options[ name ]; 6714 6715 // Prevent Object.prototype pollution 6716 // Prevent never-ending loop 6717 if ( name === "__proto__" || target === copy ) { 6718 continue; 6719 } 6720 6721 // Recurse if we're merging plain objects or arrays 6722 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 6723 ( copyIsArray = Array.isArray( copy ) ) ) ) { 6724 src = target[ name ]; 6725 6726 // Ensure proper type for the source value 6727 if ( copyIsArray && !Array.isArray( src ) ) { 6728 clone = []; 6729 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { 6730 clone = {}; 6731 } else { 6732 clone = src; 6733 } 6734 copyIsArray = false; 6735 6736 // Never move original objects, clone them 6737 target[ name ] = jQuery.extend( deep, clone, copy ); 6738 6739 // Don't bring in undefined values 6740 } else if ( copy !== undefined ) { 6741 target[ name ] = copy; 6742 } 6743 } 6744 } 6745 } 6746 6747 // Return the modified object 6748 return target; 6749}; 6750 6751jQuery.extend( { 6752 6753 // Unique for each copy of jQuery on the page 6754 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 6755 6756 // Assume jQuery is ready without the ready module 6757 isReady: true, 6758 6759 error: function( msg ) { 6760 throw new Error( msg ); 6761 }, 6762 6763 noop: function() {}, 6764 6765 isPlainObject: function( obj ) { 6766 var proto, Ctor; 6767 6768 // Detect obvious negatives 6769 // Use toString instead of jQuery.type to catch host objects 6770 if ( !obj || toString.call( obj ) !== "[object Object]" ) { 6771 return false; 6772 } 6773 6774 proto = getProto( obj ); 6775 6776 // Objects with no prototype (e.g., `Object.create( null )`) are plain 6777 if ( !proto ) { 6778 return true; 6779 } 6780 6781 // Objects with prototype are plain iff they were constructed by a global Object function 6782 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; 6783 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; 6784 }, 6785 6786 isEmptyObject: function( obj ) { 6787 var name; 6788 6789 for ( name in obj ) { 6790 return false; 6791 } 6792 return true; 6793 }, 6794 6795 // Evaluates a script in a global context 6796 globalEval: function( code, options ) { 6797 DOMEval( code, { nonce: options && options.nonce } ); 6798 }, 6799 6800 each: function( obj, callback ) { 6801 var length, i = 0; 6802 6803 if ( isArrayLike( obj ) ) { 6804 length = obj.length; 6805 for ( ; i < length; i++ ) { 6806 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 6807 break; 6808 } 6809 } 6810 } else { 6811 for ( i in obj ) { 6812 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 6813 break; 6814 } 6815 } 6816 } 6817 6818 return obj; 6819 }, 6820 6821 // Support: Android <=4.0 only 6822 trim: function( text ) { 6823 return text == null ? 6824 "" : 6825 ( text + "" ).replace( rtrim, "" ); 6826 }, 6827 6828 // results is for internal usage only 6829 makeArray: function( arr, results ) { 6830 var ret = results || []; 6831 6832 if ( arr != null ) { 6833 if ( isArrayLike( Object( arr ) ) ) { 6834 jQuery.merge( ret, 6835 typeof arr === "string" ? 6836 [ arr ] : arr 6837 ); 6838 } else { 6839 push.call( ret, arr ); 6840 } 6841 } 6842 6843 return ret; 6844 }, 6845 6846 inArray: function( elem, arr, i ) { 6847 return arr == null ? -1 : indexOf.call( arr, elem, i ); 6848 }, 6849 6850 // Support: Android <=4.0 only, PhantomJS 1 only 6851 // push.apply(_, arraylike) throws on ancient WebKit 6852 merge: function( first, second ) { 6853 var len = +second.length, 6854 j = 0, 6855 i = first.length; 6856 6857 for ( ; j < len; j++ ) { 6858 first[ i++ ] = second[ j ]; 6859 } 6860 6861 first.length = i; 6862 6863 return first; 6864 }, 6865 6866 grep: function( elems, callback, invert ) { 6867 var callbackInverse, 6868 matches = [], 6869 i = 0, 6870 length = elems.length, 6871 callbackExpect = !invert; 6872 6873 // Go through the array, only saving the items 6874 // that pass the validator function 6875 for ( ; i < length; i++ ) { 6876 callbackInverse = !callback( elems[ i ], i ); 6877 if ( callbackInverse !== callbackExpect ) { 6878 matches.push( elems[ i ] ); 6879 } 6880 } 6881 6882 return matches; 6883 }, 6884 6885 // arg is for internal usage only 6886 map: function( elems, callback, arg ) { 6887 var length, value, 6888 i = 0, 6889 ret = []; 6890 6891 // Go through the array, translating each of the items to their new values 6892 if ( isArrayLike( elems ) ) { 6893 length = elems.length; 6894 for ( ; i < length; i++ ) { 6895 value = callback( elems[ i ], i, arg ); 6896 6897 if ( value != null ) { 6898 ret.push( value ); 6899 } 6900 } 6901 6902 // Go through every key on the object, 6903 } else { 6904 for ( i in elems ) { 6905 value = callback( elems[ i ], i, arg ); 6906 6907 if ( value != null ) { 6908 ret.push( value ); 6909 } 6910 } 6911 } 6912 6913 // Flatten any nested arrays 6914 return concat.apply( [], ret ); 6915 }, 6916 6917 // A global GUID counter for objects 6918 guid: 1, 6919 6920 // jQuery.support is not used in Core but other projects attach their 6921 // properties to it so it needs to exist. 6922 support: support 6923} ); 6924 6925if ( typeof Symbol === "function" ) { 6926 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 6927} 6928 6929// Populate the class2type map 6930jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 6931function( i, name ) { 6932 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 6933} ); 6934 6935function isArrayLike( obj ) { 6936 6937 // Support: real iOS 8.2 only (not reproducible in simulator) 6938 // `in` check used to prevent JIT error (gh-2145) 6939 // hasOwn isn't used here due to false negatives 6940 // regarding Nodelist length in IE 6941 var length = !!obj && "length" in obj && obj.length, 6942 type = toType( obj ); 6943 6944 if ( isFunction( obj ) || isWindow( obj ) ) { 6945 return false; 6946 } 6947 6948 return type === "array" || length === 0 || 6949 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 6950} 6951var Sizzle = 6952/*! 6953 * Sizzle CSS Selector Engine v2.3.4 6954 * https://sizzlejs.com/ 6955 * 6956 * Copyright JS Foundation and other contributors 6957 * Released under the MIT license 6958 * https://js.foundation/ 6959 * 6960 * Date: 2019-04-08 6961 */ 6962(function( window ) { 6963 6964var i, 6965 support, 6966 Expr, 6967 getText, 6968 isXML, 6969 tokenize, 6970 compile, 6971 select, 6972 outermostContext, 6973 sortInput, 6974 hasDuplicate, 6975 6976 // Local document vars 6977 setDocument, 6978 document, 6979 docElem, 6980 documentIsHTML, 6981 rbuggyQSA, 6982 rbuggyMatches, 6983 matches, 6984 contains, 6985 6986 // Instance-specific data 6987 expando = "sizzle" + 1 * new Date(), 6988 preferredDoc = window.document, 6989 dirruns = 0, 6990 done = 0, 6991 classCache = createCache(), 6992 tokenCache = createCache(), 6993 compilerCache = createCache(), 6994 nonnativeSelectorCache = createCache(), 6995 sortOrder = function( a, b ) { 6996 if ( a === b ) { 6997 hasDuplicate = true; 6998 } 6999 return 0; 7000 }, 7001 7002 // Instance methods 7003 hasOwn = ({}).hasOwnProperty, 7004 arr = [], 7005 pop = arr.pop, 7006 push_native = arr.push, 7007 push = arr.push, 7008 slice = arr.slice, 7009 // Use a stripped-down indexOf as it's faster than native 7010 // https://jsperf.com/thor-indexof-vs-for/5 7011 indexOf = function( list, elem ) { 7012 var i = 0, 7013 len = list.length; 7014 for ( ; i < len; i++ ) { 7015 if ( list[i] === elem ) { 7016 return i; 7017 } 7018 } 7019 return -1; 7020 }, 7021 7022 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", 7023 7024 // Regular expressions 7025 7026 // http://www.w3.org/TR/css3-selectors/#whitespace 7027 whitespace = "[\\x20\\t\\r\\n\\f]", 7028 7029 // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier 7030 identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", 7031 7032 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors 7033 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 7034 // Operator (capture 2) 7035 "*([*^$|!~]?=)" + whitespace + 7036 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 7037 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + 7038 "*\\]", 7039 7040 pseudos = ":(" + identifier + ")(?:\\((" + 7041 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 7042 // 1. quoted (capture 3; capture 4 or capture 5) 7043 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 7044 // 2. simple (capture 6) 7045 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 7046 // 3. anything else (capture 2) 7047 ".*" + 7048 ")\\)|)", 7049 7050 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 7051 rwhitespace = new RegExp( whitespace + "+", "g" ), 7052 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), 7053 7054 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 7055 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), 7056 rdescend = new RegExp( whitespace + "|>" ), 7057 7058 rpseudo = new RegExp( pseudos ), 7059 ridentifier = new RegExp( "^" + identifier + "$" ), 7060 7061 matchExpr = { 7062 "ID": new RegExp( "^#(" + identifier + ")" ), 7063 "CLASS": new RegExp( "^\\.(" + identifier + ")" ), 7064 "TAG": new RegExp( "^(" + identifier + "|[*])" ), 7065 "ATTR": new RegExp( "^" + attributes ), 7066 "PSEUDO": new RegExp( "^" + pseudos ), 7067 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + 7068 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + 7069 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 7070 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), 7071 // For use in libraries implementing .is() 7072 // We use this for POS matching in `select` 7073 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + 7074 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 7075 }, 7076 7077 rhtml = /HTML$/i, 7078 rinputs = /^(?:input|select|textarea|button)$/i, 7079 rheader = /^h\d$/i, 7080 7081 rnative = /^[^{]+\{\s*\[native \w/, 7082 7083 // Easily-parseable/retrievable ID or TAG or CLASS selectors 7084 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 7085 7086 rsibling = /[+~]/, 7087 7088 // CSS escapes 7089 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters 7090 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), 7091 funescape = function( _, escaped, escapedWhitespace ) { 7092 var high = "0x" + escaped - 0x10000; 7093 // NaN means non-codepoint 7094 // Support: Firefox<24 7095 // Workaround erroneous numeric interpretation of +"0x" 7096 return high !== high || escapedWhitespace ? 7097 escaped : 7098 high < 0 ? 7099 // BMP codepoint 7100 String.fromCharCode( high + 0x10000 ) : 7101 // Supplemental Plane codepoint (surrogate pair) 7102 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 7103 }, 7104 7105 // CSS string/identifier serialization 7106 // https://drafts.csswg.org/cssom/#common-serializing-idioms 7107 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, 7108 fcssescape = function( ch, asCodePoint ) { 7109 if ( asCodePoint ) { 7110 7111 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 7112 if ( ch === "\0" ) { 7113 return "\uFFFD"; 7114 } 7115 7116 // Control characters and (dependent upon position) numbers get escaped as code points 7117 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 7118 } 7119 7120 // Other potentially-special ASCII characters get backslash-escaped 7121 return "\\" + ch; 7122 }, 7123 7124 // Used for iframes 7125 // See setDocument() 7126 // Removing the function wrapper causes a "Permission Denied" 7127 // error in IE 7128 unloadHandler = function() { 7129 setDocument(); 7130 }, 7131 7132 inDisabledFieldset = addCombinator( 7133 function( elem ) { 7134 return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; 7135 }, 7136 { dir: "parentNode", next: "legend" } 7137 ); 7138 7139// Optimize for push.apply( _, NodeList ) 7140try { 7141 push.apply( 7142 (arr = slice.call( preferredDoc.childNodes )), 7143 preferredDoc.childNodes 7144 ); 7145 // Support: Android<4.0 7146 // Detect silently failing push.apply 7147 arr[ preferredDoc.childNodes.length ].nodeType; 7148} catch ( e ) { 7149 push = { apply: arr.length ? 7150 7151 // Leverage slice if possible 7152 function( target, els ) { 7153 push_native.apply( target, slice.call(els) ); 7154 } : 7155 7156 // Support: IE<9 7157 // Otherwise append directly 7158 function( target, els ) { 7159 var j = target.length, 7160 i = 0; 7161 // Can't trust NodeList.length 7162 while ( (target[j++] = els[i++]) ) {} 7163 target.length = j - 1; 7164 } 7165 }; 7166} 7167 7168function Sizzle( selector, context, results, seed ) { 7169 var m, i, elem, nid, match, groups, newSelector, 7170 newContext = context && context.ownerDocument, 7171 7172 // nodeType defaults to 9, since context defaults to document 7173 nodeType = context ? context.nodeType : 9; 7174 7175 results = results || []; 7176 7177 // Return early from calls with invalid selector or context 7178 if ( typeof selector !== "string" || !selector || 7179 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 7180 7181 return results; 7182 } 7183 7184 // Try to shortcut find operations (as opposed to filters) in HTML documents 7185 if ( !seed ) { 7186 7187 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { 7188 setDocument( context ); 7189 } 7190 context = context || document; 7191 7192 if ( documentIsHTML ) { 7193 7194 // If the selector is sufficiently simple, try using a "get*By*" DOM method 7195 // (excepting DocumentFragment context, where the methods don't exist) 7196 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { 7197 7198 // ID selector 7199 if ( (m = match[1]) ) { 7200 7201 // Document context 7202 if ( nodeType === 9 ) { 7203 if ( (elem = context.getElementById( m )) ) { 7204 7205 // Support: IE, Opera, Webkit 7206 // TODO: identify versions 7207 // getElementById can match elements by name instead of ID 7208 if ( elem.id === m ) { 7209 results.push( elem ); 7210 return results; 7211 } 7212 } else { 7213 return results; 7214 } 7215 7216 // Element context 7217 } else { 7218 7219 // Support: IE, Opera, Webkit 7220 // TODO: identify versions 7221 // getElementById can match elements by name instead of ID 7222 if ( newContext && (elem = newContext.getElementById( m )) && 7223 contains( context, elem ) && 7224 elem.id === m ) { 7225 7226 results.push( elem ); 7227 return results; 7228 } 7229 } 7230 7231 // Type selector 7232 } else if ( match[2] ) { 7233 push.apply( results, context.getElementsByTagName( selector ) ); 7234 return results; 7235 7236 // Class selector 7237 } else if ( (m = match[3]) && support.getElementsByClassName && 7238 context.getElementsByClassName ) { 7239 7240 push.apply( results, context.getElementsByClassName( m ) ); 7241 return results; 7242 } 7243 } 7244 7245 // Take advantage of querySelectorAll 7246 if ( support.qsa && 7247 !nonnativeSelectorCache[ selector + " " ] && 7248 (!rbuggyQSA || !rbuggyQSA.test( selector )) && 7249 7250 // Support: IE 8 only 7251 // Exclude object elements 7252 (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) { 7253 7254 newSelector = selector; 7255 newContext = context; 7256 7257 // qSA considers elements outside a scoping root when evaluating child or 7258 // descendant combinators, which is not what we want. 7259 // In such cases, we work around the behavior by prefixing every selector in the 7260 // list with an ID selector referencing the scope context. 7261 // Thanks to Andrew Dupont for this technique. 7262 if ( nodeType === 1 && rdescend.test( selector ) ) { 7263 7264 // Capture the context ID, setting it first if necessary 7265 if ( (nid = context.getAttribute( "id" )) ) { 7266 nid = nid.replace( rcssescape, fcssescape ); 7267 } else { 7268 context.setAttribute( "id", (nid = expando) ); 7269 } 7270 7271 // Prefix every selector in the list 7272 groups = tokenize( selector ); 7273 i = groups.length; 7274 while ( i-- ) { 7275 groups[i] = "#" + nid + " " + toSelector( groups[i] ); 7276 } 7277 newSelector = groups.join( "," ); 7278 7279 // Expand context for sibling selectors 7280 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 7281 context; 7282 } 7283 7284 try { 7285 push.apply( results, 7286 newContext.querySelectorAll( newSelector ) 7287 ); 7288 return results; 7289 } catch ( qsaError ) { 7290 nonnativeSelectorCache( selector, true ); 7291 } finally { 7292 if ( nid === expando ) { 7293 context.removeAttribute( "id" ); 7294 } 7295 } 7296 } 7297 } 7298 } 7299 7300 // All others 7301 return select( selector.replace( rtrim, "$1" ), context, results, seed ); 7302} 7303 7304/** 7305 * Create key-value caches of limited size 7306 * @returns {function(string, object)} Returns the Object data after storing it on itself with 7307 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 7308 * deleting the oldest entry 7309 */ 7310function createCache() { 7311 var keys = []; 7312 7313 function cache( key, value ) { 7314 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) 7315 if ( keys.push( key + " " ) > Expr.cacheLength ) { 7316 // Only keep the most recent entries 7317 delete cache[ keys.shift() ]; 7318 } 7319 return (cache[ key + " " ] = value); 7320 } 7321 return cache; 7322} 7323 7324/** 7325 * Mark a function for special use by Sizzle 7326 * @param {Function} fn The function to mark 7327 */ 7328function markFunction( fn ) { 7329 fn[ expando ] = true; 7330 return fn; 7331} 7332 7333/** 7334 * Support testing using an element 7335 * @param {Function} fn Passed the created element and returns a boolean result 7336 */ 7337function assert( fn ) { 7338 var el = document.createElement("fieldset"); 7339 7340 try { 7341 return !!fn( el ); 7342 } catch (e) { 7343 return false; 7344 } finally { 7345 // Remove from its parent by default 7346 if ( el.parentNode ) { 7347 el.parentNode.removeChild( el ); 7348 } 7349 // release memory in IE 7350 el = null; 7351 } 7352} 7353 7354/** 7355 * Adds the same handler for all of the specified attrs 7356 * @param {String} attrs Pipe-separated list of attributes 7357 * @param {Function} handler The method that will be applied 7358 */ 7359function addHandle( attrs, handler ) { 7360 var arr = attrs.split("|"), 7361 i = arr.length; 7362 7363 while ( i-- ) { 7364 Expr.attrHandle[ arr[i] ] = handler; 7365 } 7366} 7367 7368/** 7369 * Checks document order of two siblings 7370 * @param {Element} a 7371 * @param {Element} b 7372 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 7373 */ 7374function siblingCheck( a, b ) { 7375 var cur = b && a, 7376 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 7377 a.sourceIndex - b.sourceIndex; 7378 7379 // Use IE sourceIndex if available on both nodes 7380 if ( diff ) { 7381 return diff; 7382 } 7383 7384 // Check if b follows a 7385 if ( cur ) { 7386 while ( (cur = cur.nextSibling) ) { 7387 if ( cur === b ) { 7388 return -1; 7389 } 7390 } 7391 } 7392 7393 return a ? 1 : -1; 7394} 7395 7396/** 7397 * Returns a function to use in pseudos for input types 7398 * @param {String} type 7399 */ 7400function createInputPseudo( type ) { 7401 return function( elem ) { 7402 var name = elem.nodeName.toLowerCase(); 7403 return name === "input" && elem.type === type; 7404 }; 7405} 7406 7407/** 7408 * Returns a function to use in pseudos for buttons 7409 * @param {String} type 7410 */ 7411function createButtonPseudo( type ) { 7412 return function( elem ) { 7413 var name = elem.nodeName.toLowerCase(); 7414 return (name === "input" || name === "button") && elem.type === type; 7415 }; 7416} 7417 7418/** 7419 * Returns a function to use in pseudos for :enabled/:disabled 7420 * @param {Boolean} disabled true for :disabled; false for :enabled 7421 */ 7422function createDisabledPseudo( disabled ) { 7423 7424 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 7425 return function( elem ) { 7426 7427 // Only certain elements can match :enabled or :disabled 7428 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 7429 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 7430 if ( "form" in elem ) { 7431 7432 // Check for inherited disabledness on relevant non-disabled elements: 7433 // * listed form-associated elements in a disabled fieldset 7434 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 7435 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 7436 // * option elements in a disabled optgroup 7437 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 7438 // All such elements have a "form" property. 7439 if ( elem.parentNode && elem.disabled === false ) { 7440 7441 // Option elements defer to a parent optgroup if present 7442 if ( "label" in elem ) { 7443 if ( "label" in elem.parentNode ) { 7444 return elem.parentNode.disabled === disabled; 7445 } else { 7446 return elem.disabled === disabled; 7447 } 7448 } 7449 7450 // Support: IE 6 - 11 7451 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 7452 return elem.isDisabled === disabled || 7453 7454 // Where there is no isDisabled, check manually 7455 /* jshint -W018 */ 7456 elem.isDisabled !== !disabled && 7457 inDisabledFieldset( elem ) === disabled; 7458 } 7459 7460 return elem.disabled === disabled; 7461 7462 // Try to winnow out elements that can't be disabled before trusting the disabled property. 7463 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 7464 // even exist on them, let alone have a boolean value. 7465 } else if ( "label" in elem ) { 7466 return elem.disabled === disabled; 7467 } 7468 7469 // Remaining elements are neither :enabled nor :disabled 7470 return false; 7471 }; 7472} 7473 7474/** 7475 * Returns a function to use in pseudos for positionals 7476 * @param {Function} fn 7477 */ 7478function createPositionalPseudo( fn ) { 7479 return markFunction(function( argument ) { 7480 argument = +argument; 7481 return markFunction(function( seed, matches ) { 7482 var j, 7483 matchIndexes = fn( [], seed.length, argument ), 7484 i = matchIndexes.length; 7485 7486 // Match elements found at the specified indexes 7487 while ( i-- ) { 7488 if ( seed[ (j = matchIndexes[i]) ] ) { 7489 seed[j] = !(matches[j] = seed[j]); 7490 } 7491 } 7492 }); 7493 }); 7494} 7495 7496/** 7497 * Checks a node for validity as a Sizzle context 7498 * @param {Element|Object=} context 7499 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 7500 */ 7501function testContext( context ) { 7502 return context && typeof context.getElementsByTagName !== "undefined" && context; 7503} 7504 7505// Expose support vars for convenience 7506support = Sizzle.support = {}; 7507 7508/** 7509 * Detects XML nodes 7510 * @param {Element|Object} elem An element or a document 7511 * @returns {Boolean} True iff elem is a non-HTML XML node 7512 */ 7513isXML = Sizzle.isXML = function( elem ) { 7514 var namespace = elem.namespaceURI, 7515 docElem = (elem.ownerDocument || elem).documentElement; 7516 7517 // Support: IE <=8 7518 // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes 7519 // https://bugs.jquery.com/ticket/4833 7520 return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); 7521}; 7522 7523/** 7524 * Sets document-related variables once based on the current document 7525 * @param {Element|Object} [doc] An element or document object to use to set the document 7526 * @returns {Object} Returns the current document 7527 */ 7528setDocument = Sizzle.setDocument = function( node ) { 7529 var hasCompare, subWindow, 7530 doc = node ? node.ownerDocument || node : preferredDoc; 7531 7532 // Return early if doc is invalid or already selected 7533 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { 7534 return document; 7535 } 7536 7537 // Update global variables 7538 document = doc; 7539 docElem = document.documentElement; 7540 documentIsHTML = !isXML( document ); 7541 7542 // Support: IE 9-11, Edge 7543 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) 7544 if ( preferredDoc !== document && 7545 (subWindow = document.defaultView) && subWindow.top !== subWindow ) { 7546 7547 // Support: IE 11, Edge 7548 if ( subWindow.addEventListener ) { 7549 subWindow.addEventListener( "unload", unloadHandler, false ); 7550 7551 // Support: IE 9 - 10 only 7552 } else if ( subWindow.attachEvent ) { 7553 subWindow.attachEvent( "onunload", unloadHandler ); 7554 } 7555 } 7556 7557 /* Attributes 7558 ---------------------------------------------------------------------- */ 7559 7560 // Support: IE<8 7561 // Verify that getAttribute really returns attributes and not properties 7562 // (excepting IE8 booleans) 7563 support.attributes = assert(function( el ) { 7564 el.className = "i"; 7565 return !el.getAttribute("className"); 7566 }); 7567 7568 /* getElement(s)By* 7569 ---------------------------------------------------------------------- */ 7570 7571 // Check if getElementsByTagName("*") returns only elements 7572 support.getElementsByTagName = assert(function( el ) { 7573 el.appendChild( document.createComment("") ); 7574 return !el.getElementsByTagName("*").length; 7575 }); 7576 7577 // Support: IE<9 7578 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); 7579 7580 // Support: IE<10 7581 // Check if getElementById returns elements by name 7582 // The broken getElementById methods don't pick up programmatically-set names, 7583 // so use a roundabout getElementsByName test 7584 support.getById = assert(function( el ) { 7585 docElem.appendChild( el ).id = expando; 7586 return !document.getElementsByName || !document.getElementsByName( expando ).length; 7587 }); 7588 7589 // ID filter and find 7590 if ( support.getById ) { 7591 Expr.filter["ID"] = function( id ) { 7592 var attrId = id.replace( runescape, funescape ); 7593 return function( elem ) { 7594 return elem.getAttribute("id") === attrId; 7595 }; 7596 }; 7597 Expr.find["ID"] = function( id, context ) { 7598 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 7599 var elem = context.getElementById( id ); 7600 return elem ? [ elem ] : []; 7601 } 7602 }; 7603 } else { 7604 Expr.filter["ID"] = function( id ) { 7605 var attrId = id.replace( runescape, funescape ); 7606 return function( elem ) { 7607 var node = typeof elem.getAttributeNode !== "undefined" && 7608 elem.getAttributeNode("id"); 7609 return node && node.value === attrId; 7610 }; 7611 }; 7612 7613 // Support: IE 6 - 7 only 7614 // getElementById is not reliable as a find shortcut 7615 Expr.find["ID"] = function( id, context ) { 7616 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 7617 var node, i, elems, 7618 elem = context.getElementById( id ); 7619 7620 if ( elem ) { 7621 7622 // Verify the id attribute 7623 node = elem.getAttributeNode("id"); 7624 if ( node && node.value === id ) { 7625 return [ elem ]; 7626 } 7627 7628 // Fall back on getElementsByName 7629 elems = context.getElementsByName( id ); 7630 i = 0; 7631 while ( (elem = elems[i++]) ) { 7632 node = elem.getAttributeNode("id"); 7633 if ( node && node.value === id ) { 7634 return [ elem ]; 7635 } 7636 } 7637 } 7638 7639 return []; 7640 } 7641 }; 7642 } 7643 7644 // Tag 7645 Expr.find["TAG"] = support.getElementsByTagName ? 7646 function( tag, context ) { 7647 if ( typeof context.getElementsByTagName !== "undefined" ) { 7648 return context.getElementsByTagName( tag ); 7649 7650 // DocumentFragment nodes don't have gEBTN 7651 } else if ( support.qsa ) { 7652 return context.querySelectorAll( tag ); 7653 } 7654 } : 7655 7656 function( tag, context ) { 7657 var elem, 7658 tmp = [], 7659 i = 0, 7660 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too 7661 results = context.getElementsByTagName( tag ); 7662 7663 // Filter out possible comments 7664 if ( tag === "*" ) { 7665 while ( (elem = results[i++]) ) { 7666 if ( elem.nodeType === 1 ) { 7667 tmp.push( elem ); 7668 } 7669 } 7670 7671 return tmp; 7672 } 7673 return results; 7674 }; 7675 7676 // Class 7677 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { 7678 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 7679 return context.getElementsByClassName( className ); 7680 } 7681 }; 7682 7683 /* QSA/matchesSelector 7684 ---------------------------------------------------------------------- */ 7685 7686 // QSA and matchesSelector support 7687 7688 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 7689 rbuggyMatches = []; 7690 7691 // qSa(:focus) reports false when true (Chrome 21) 7692 // We allow this because of a bug in IE8/9 that throws an error 7693 // whenever `document.activeElement` is accessed on an iframe 7694 // So, we allow :focus to pass through QSA all the time to avoid the IE error 7695 // See https://bugs.jquery.com/ticket/13378 7696 rbuggyQSA = []; 7697 7698 if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { 7699 // Build QSA regex 7700 // Regex strategy adopted from Diego Perini 7701 assert(function( el ) { 7702 // Select is set to empty string on purpose 7703 // This is to test IE's treatment of not explicitly 7704 // setting a boolean content attribute, 7705 // since its presence should be enough 7706 // https://bugs.jquery.com/ticket/12359 7707 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + 7708 "<select id='" + expando + "-\r\\' msallowcapture=''>" + 7709 "<option selected=''></option></select>"; 7710 7711 // Support: IE8, Opera 11-12.16 7712 // Nothing should be selected when empty strings follow ^= or $= or *= 7713 // The test attribute must be unknown in Opera but "safe" for WinRT 7714 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section 7715 if ( el.querySelectorAll("[msallowcapture^='']").length ) { 7716 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); 7717 } 7718 7719 // Support: IE8 7720 // Boolean attributes and "value" are not treated correctly 7721 if ( !el.querySelectorAll("[selected]").length ) { 7722 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 7723 } 7724 7725 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ 7726 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 7727 rbuggyQSA.push("~="); 7728 } 7729 7730 // Webkit/Opera - :checked should return selected option elements 7731 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 7732 // IE8 throws error here and will not see later tests 7733 if ( !el.querySelectorAll(":checked").length ) { 7734 rbuggyQSA.push(":checked"); 7735 } 7736 7737 // Support: Safari 8+, iOS 8+ 7738 // https://bugs.webkit.org/show_bug.cgi?id=136851 7739 // In-page `selector#id sibling-combinator selector` fails 7740 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 7741 rbuggyQSA.push(".#.+[+~]"); 7742 } 7743 }); 7744 7745 assert(function( el ) { 7746 el.innerHTML = "<a href='' disabled='disabled'></a>" + 7747 "<select disabled='disabled'><option/></select>"; 7748 7749 // Support: Windows 8 Native Apps 7750 // The type and name attributes are restricted during .innerHTML assignment 7751 var input = document.createElement("input"); 7752 input.setAttribute( "type", "hidden" ); 7753 el.appendChild( input ).setAttribute( "name", "D" ); 7754 7755 // Support: IE8 7756 // Enforce case-sensitivity of name attribute 7757 if ( el.querySelectorAll("[name=d]").length ) { 7758 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); 7759 } 7760 7761 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 7762 // IE8 throws error here and will not see later tests 7763 if ( el.querySelectorAll(":enabled").length !== 2 ) { 7764 rbuggyQSA.push( ":enabled", ":disabled" ); 7765 } 7766 7767 // Support: IE9-11+ 7768 // IE's :disabled selector does not pick up the children of disabled fieldsets 7769 docElem.appendChild( el ).disabled = true; 7770 if ( el.querySelectorAll(":disabled").length !== 2 ) { 7771 rbuggyQSA.push( ":enabled", ":disabled" ); 7772 } 7773 7774 // Opera 10-11 does not throw on post-comma invalid pseudos 7775 el.querySelectorAll("*,:x"); 7776 rbuggyQSA.push(",.*:"); 7777 }); 7778 } 7779 7780 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || 7781 docElem.webkitMatchesSelector || 7782 docElem.mozMatchesSelector || 7783 docElem.oMatchesSelector || 7784 docElem.msMatchesSelector) )) ) { 7785 7786 assert(function( el ) { 7787 // Check to see if it's possible to do matchesSelector 7788 // on a disconnected node (IE 9) 7789 support.disconnectedMatch = matches.call( el, "*" ); 7790 7791 // This should fail with an exception 7792 // Gecko does not error, returns false instead 7793 matches.call( el, "[s!='']:x" ); 7794 rbuggyMatches.push( "!=", pseudos ); 7795 }); 7796 } 7797 7798 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); 7799 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); 7800 7801 /* Contains 7802 ---------------------------------------------------------------------- */ 7803 hasCompare = rnative.test( docElem.compareDocumentPosition ); 7804 7805 // Element contains another 7806 // Purposefully self-exclusive 7807 // As in, an element does not contain itself 7808 contains = hasCompare || rnative.test( docElem.contains ) ? 7809 function( a, b ) { 7810 var adown = a.nodeType === 9 ? a.documentElement : a, 7811 bup = b && b.parentNode; 7812 return a === bup || !!( bup && bup.nodeType === 1 && ( 7813 adown.contains ? 7814 adown.contains( bup ) : 7815 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 7816 )); 7817 } : 7818 function( a, b ) { 7819 if ( b ) { 7820 while ( (b = b.parentNode) ) { 7821 if ( b === a ) { 7822 return true; 7823 } 7824 } 7825 } 7826 return false; 7827 }; 7828 7829 /* Sorting 7830 ---------------------------------------------------------------------- */ 7831 7832 // Document order sorting 7833 sortOrder = hasCompare ? 7834 function( a, b ) { 7835 7836 // Flag for duplicate removal 7837 if ( a === b ) { 7838 hasDuplicate = true; 7839 return 0; 7840 } 7841 7842 // Sort on method existence if only one input has compareDocumentPosition 7843 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 7844 if ( compare ) { 7845 return compare; 7846 } 7847 7848 // Calculate position if both inputs belong to the same document 7849 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? 7850 a.compareDocumentPosition( b ) : 7851 7852 // Otherwise we know they are disconnected 7853 1; 7854 7855 // Disconnected nodes 7856 if ( compare & 1 || 7857 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { 7858 7859 // Choose the first element that is related to our preferred document 7860 if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { 7861 return -1; 7862 } 7863 if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { 7864 return 1; 7865 } 7866 7867 // Maintain original order 7868 return sortInput ? 7869 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 7870 0; 7871 } 7872 7873 return compare & 4 ? -1 : 1; 7874 } : 7875 function( a, b ) { 7876 // Exit early if the nodes are identical 7877 if ( a === b ) { 7878 hasDuplicate = true; 7879 return 0; 7880 } 7881 7882 var cur, 7883 i = 0, 7884 aup = a.parentNode, 7885 bup = b.parentNode, 7886 ap = [ a ], 7887 bp = [ b ]; 7888 7889 // Parentless nodes are either documents or disconnected 7890 if ( !aup || !bup ) { 7891 return a === document ? -1 : 7892 b === document ? 1 : 7893 aup ? -1 : 7894 bup ? 1 : 7895 sortInput ? 7896 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 7897 0; 7898 7899 // If the nodes are siblings, we can do a quick check 7900 } else if ( aup === bup ) { 7901 return siblingCheck( a, b ); 7902 } 7903 7904 // Otherwise we need full lists of their ancestors for comparison 7905 cur = a; 7906 while ( (cur = cur.parentNode) ) { 7907 ap.unshift( cur ); 7908 } 7909 cur = b; 7910 while ( (cur = cur.parentNode) ) { 7911 bp.unshift( cur ); 7912 } 7913 7914 // Walk down the tree looking for a discrepancy 7915 while ( ap[i] === bp[i] ) { 7916 i++; 7917 } 7918 7919 return i ? 7920 // Do a sibling check if the nodes have a common ancestor 7921 siblingCheck( ap[i], bp[i] ) : 7922 7923 // Otherwise nodes in our document sort first 7924 ap[i] === preferredDoc ? -1 : 7925 bp[i] === preferredDoc ? 1 : 7926 0; 7927 }; 7928 7929 return document; 7930}; 7931 7932Sizzle.matches = function( expr, elements ) { 7933 return Sizzle( expr, null, null, elements ); 7934}; 7935 7936Sizzle.matchesSelector = function( elem, expr ) { 7937 // Set document vars if needed 7938 if ( ( elem.ownerDocument || elem ) !== document ) { 7939 setDocument( elem ); 7940 } 7941 7942 if ( support.matchesSelector && documentIsHTML && 7943 !nonnativeSelectorCache[ expr + " " ] && 7944 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && 7945 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 7946 7947 try { 7948 var ret = matches.call( elem, expr ); 7949 7950 // IE 9's matchesSelector returns false on disconnected nodes 7951 if ( ret || support.disconnectedMatch || 7952 // As well, disconnected nodes are said to be in a document 7953 // fragment in IE 9 7954 elem.document && elem.document.nodeType !== 11 ) { 7955 return ret; 7956 } 7957 } catch (e) { 7958 nonnativeSelectorCache( expr, true ); 7959 } 7960 } 7961 7962 return Sizzle( expr, document, null, [ elem ] ).length > 0; 7963}; 7964 7965Sizzle.contains = function( context, elem ) { 7966 // Set document vars if needed 7967 if ( ( context.ownerDocument || context ) !== document ) { 7968 setDocument( context ); 7969 } 7970 return contains( context, elem ); 7971}; 7972 7973Sizzle.attr = function( elem, name ) { 7974 // Set document vars if needed 7975 if ( ( elem.ownerDocument || elem ) !== document ) { 7976 setDocument( elem ); 7977 } 7978 7979 var fn = Expr.attrHandle[ name.toLowerCase() ], 7980 // Don't get fooled by Object.prototype properties (jQuery #13807) 7981 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 7982 fn( elem, name, !documentIsHTML ) : 7983 undefined; 7984 7985 return val !== undefined ? 7986 val : 7987 support.attributes || !documentIsHTML ? 7988 elem.getAttribute( name ) : 7989 (val = elem.getAttributeNode(name)) && val.specified ? 7990 val.value : 7991 null; 7992}; 7993 7994Sizzle.escape = function( sel ) { 7995 return (sel + "").replace( rcssescape, fcssescape ); 7996}; 7997 7998Sizzle.error = function( msg ) { 7999 throw new Error( "Syntax error, unrecognized expression: " + msg ); 8000}; 8001 8002/** 8003 * Document sorting and removing duplicates 8004 * @param {ArrayLike} results 8005 */ 8006Sizzle.uniqueSort = function( results ) { 8007 var elem, 8008 duplicates = [], 8009 j = 0, 8010 i = 0; 8011 8012 // Unless we *know* we can detect duplicates, assume their presence 8013 hasDuplicate = !support.detectDuplicates; 8014 sortInput = !support.sortStable && results.slice( 0 ); 8015 results.sort( sortOrder ); 8016 8017 if ( hasDuplicate ) { 8018 while ( (elem = results[i++]) ) { 8019 if ( elem === results[ i ] ) { 8020 j = duplicates.push( i ); 8021 } 8022 } 8023 while ( j-- ) { 8024 results.splice( duplicates[ j ], 1 ); 8025 } 8026 } 8027 8028 // Clear input after sorting to release objects 8029 // See https://github.com/jquery/sizzle/pull/225 8030 sortInput = null; 8031 8032 return results; 8033}; 8034 8035/** 8036 * Utility function for retrieving the text value of an array of DOM nodes 8037 * @param {Array|Element} elem 8038 */ 8039getText = Sizzle.getText = function( elem ) { 8040 var node, 8041 ret = "", 8042 i = 0, 8043 nodeType = elem.nodeType; 8044 8045 if ( !nodeType ) { 8046 // If no nodeType, this is expected to be an array 8047 while ( (node = elem[i++]) ) { 8048 // Do not traverse comment nodes 8049 ret += getText( node ); 8050 } 8051 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 8052 // Use textContent for elements 8053 // innerText usage removed for consistency of new lines (jQuery #11153) 8054 if ( typeof elem.textContent === "string" ) { 8055 return elem.textContent; 8056 } else { 8057 // Traverse its children 8058 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 8059 ret += getText( elem ); 8060 } 8061 } 8062 } else if ( nodeType === 3 || nodeType === 4 ) { 8063 return elem.nodeValue; 8064 } 8065 // Do not include comment or processing instruction nodes 8066 8067 return ret; 8068}; 8069 8070Expr = Sizzle.selectors = { 8071 8072 // Can be adjusted by the user 8073 cacheLength: 50, 8074 8075 createPseudo: markFunction, 8076 8077 match: matchExpr, 8078 8079 attrHandle: {}, 8080 8081 find: {}, 8082 8083 relative: { 8084 ">": { dir: "parentNode", first: true }, 8085 " ": { dir: "parentNode" }, 8086 "+": { dir: "previousSibling", first: true }, 8087 "~": { dir: "previousSibling" } 8088 }, 8089 8090 preFilter: { 8091 "ATTR": function( match ) { 8092 match[1] = match[1].replace( runescape, funescape ); 8093 8094 // Move the given value to match[3] whether quoted or unquoted 8095 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); 8096 8097 if ( match[2] === "~=" ) { 8098 match[3] = " " + match[3] + " "; 8099 } 8100 8101 return match.slice( 0, 4 ); 8102 }, 8103 8104 "CHILD": function( match ) { 8105 /* matches from matchExpr["CHILD"] 8106 1 type (only|nth|...) 8107 2 what (child|of-type) 8108 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 8109 4 xn-component of xn+y argument ([+-]?\d*n|) 8110 5 sign of xn-component 8111 6 x of xn-component 8112 7 sign of y-component 8113 8 y of y-component 8114 */ 8115 match[1] = match[1].toLowerCase(); 8116 8117 if ( match[1].slice( 0, 3 ) === "nth" ) { 8118 // nth-* requires argument 8119 if ( !match[3] ) { 8120 Sizzle.error( match[0] ); 8121 } 8122 8123 // numeric x and y parameters for Expr.filter.CHILD 8124 // remember that false/true cast respectively to 0/1 8125 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); 8126 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); 8127 8128 // other types prohibit arguments 8129 } else if ( match[3] ) { 8130 Sizzle.error( match[0] ); 8131 } 8132 8133 return match; 8134 }, 8135 8136 "PSEUDO": function( match ) { 8137 var excess, 8138 unquoted = !match[6] && match[2]; 8139 8140 if ( matchExpr["CHILD"].test( match[0] ) ) { 8141 return null; 8142 } 8143 8144 // Accept quoted arguments as-is 8145 if ( match[3] ) { 8146 match[2] = match[4] || match[5] || ""; 8147 8148 // Strip excess characters from unquoted arguments 8149 } else if ( unquoted && rpseudo.test( unquoted ) && 8150 // Get excess from tokenize (recursively) 8151 (excess = tokenize( unquoted, true )) && 8152 // advance to the next closing parenthesis 8153 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { 8154 8155 // excess is a negative index 8156 match[0] = match[0].slice( 0, excess ); 8157 match[2] = unquoted.slice( 0, excess ); 8158 } 8159 8160 // Return only captures needed by the pseudo filter method (type and argument) 8161 return match.slice( 0, 3 ); 8162 } 8163 }, 8164 8165 filter: { 8166 8167 "TAG": function( nodeNameSelector ) { 8168 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 8169 return nodeNameSelector === "*" ? 8170 function() { return true; } : 8171 function( elem ) { 8172 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 8173 }; 8174 }, 8175 8176 "CLASS": function( className ) { 8177 var pattern = classCache[ className + " " ]; 8178 8179 return pattern || 8180 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && 8181 classCache( className, function( elem ) { 8182 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); 8183 }); 8184 }, 8185 8186 "ATTR": function( name, operator, check ) { 8187 return function( elem ) { 8188 var result = Sizzle.attr( elem, name ); 8189 8190 if ( result == null ) { 8191 return operator === "!="; 8192 } 8193 if ( !operator ) { 8194 return true; 8195 } 8196 8197 result += ""; 8198 8199 return operator === "=" ? result === check : 8200 operator === "!=" ? result !== check : 8201 operator === "^=" ? check && result.indexOf( check ) === 0 : 8202 operator === "*=" ? check && result.indexOf( check ) > -1 : 8203 operator === "$=" ? check && result.slice( -check.length ) === check : 8204 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : 8205 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : 8206 false; 8207 }; 8208 }, 8209 8210 "CHILD": function( type, what, argument, first, last ) { 8211 var simple = type.slice( 0, 3 ) !== "nth", 8212 forward = type.slice( -4 ) !== "last", 8213 ofType = what === "of-type"; 8214 8215 return first === 1 && last === 0 ? 8216 8217 // Shortcut for :nth-*(n) 8218 function( elem ) { 8219 return !!elem.parentNode; 8220 } : 8221 8222 function( elem, context, xml ) { 8223 var cache, uniqueCache, outerCache, node, nodeIndex, start, 8224 dir = simple !== forward ? "nextSibling" : "previousSibling", 8225 parent = elem.parentNode, 8226 name = ofType && elem.nodeName.toLowerCase(), 8227 useCache = !xml && !ofType, 8228 diff = false; 8229 8230 if ( parent ) { 8231 8232 // :(first|last|only)-(child|of-type) 8233 if ( simple ) { 8234 while ( dir ) { 8235 node = elem; 8236 while ( (node = node[ dir ]) ) { 8237 if ( ofType ? 8238 node.nodeName.toLowerCase() === name : 8239 node.nodeType === 1 ) { 8240 8241 return false; 8242 } 8243 } 8244 // Reverse direction for :only-* (if we haven't yet done so) 8245 start = dir = type === "only" && !start && "nextSibling"; 8246 } 8247 return true; 8248 } 8249 8250 start = [ forward ? parent.firstChild : parent.lastChild ]; 8251 8252 // non-xml :nth-child(...) stores cache data on `parent` 8253 if ( forward && useCache ) { 8254 8255 // Seek `elem` from a previously-cached index 8256 8257 // ...in a gzip-friendly way 8258 node = parent; 8259 outerCache = node[ expando ] || (node[ expando ] = {}); 8260 8261 // Support: IE <9 only 8262 // Defend against cloned attroperties (jQuery gh-1709) 8263 uniqueCache = outerCache[ node.uniqueID ] || 8264 (outerCache[ node.uniqueID ] = {}); 8265 8266 cache = uniqueCache[ type ] || []; 8267 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 8268 diff = nodeIndex && cache[ 2 ]; 8269 node = nodeIndex && parent.childNodes[ nodeIndex ]; 8270 8271 while ( (node = ++nodeIndex && node && node[ dir ] || 8272 8273 // Fallback to seeking `elem` from the start 8274 (diff = nodeIndex = 0) || start.pop()) ) { 8275 8276 // When found, cache indexes on `parent` and break 8277 if ( node.nodeType === 1 && ++diff && node === elem ) { 8278 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; 8279 break; 8280 } 8281 } 8282 8283 } else { 8284 // Use previously-cached element index if available 8285 if ( useCache ) { 8286 // ...in a gzip-friendly way 8287 node = elem; 8288 outerCache = node[ expando ] || (node[ expando ] = {}); 8289 8290 // Support: IE <9 only 8291 // Defend against cloned attroperties (jQuery gh-1709) 8292 uniqueCache = outerCache[ node.uniqueID ] || 8293 (outerCache[ node.uniqueID ] = {}); 8294 8295 cache = uniqueCache[ type ] || []; 8296 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 8297 diff = nodeIndex; 8298 } 8299 8300 // xml :nth-child(...) 8301 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 8302 if ( diff === false ) { 8303 // Use the same loop as above to seek `elem` from the start 8304 while ( (node = ++nodeIndex && node && node[ dir ] || 8305 (diff = nodeIndex = 0) || start.pop()) ) { 8306 8307 if ( ( ofType ? 8308 node.nodeName.toLowerCase() === name : 8309 node.nodeType === 1 ) && 8310 ++diff ) { 8311 8312 // Cache the index of each encountered element 8313 if ( useCache ) { 8314 outerCache = node[ expando ] || (node[ expando ] = {}); 8315 8316 // Support: IE <9 only 8317 // Defend against cloned attroperties (jQuery gh-1709) 8318 uniqueCache = outerCache[ node.uniqueID ] || 8319 (outerCache[ node.uniqueID ] = {}); 8320 8321 uniqueCache[ type ] = [ dirruns, diff ]; 8322 } 8323 8324 if ( node === elem ) { 8325 break; 8326 } 8327 } 8328 } 8329 } 8330 } 8331 8332 // Incorporate the offset, then check against cycle size 8333 diff -= last; 8334 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 8335 } 8336 }; 8337 }, 8338 8339 "PSEUDO": function( pseudo, argument ) { 8340 // pseudo-class names are case-insensitive 8341 // http://www.w3.org/TR/selectors/#pseudo-classes 8342 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 8343 // Remember that setFilters inherits from pseudos 8344 var args, 8345 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 8346 Sizzle.error( "unsupported pseudo: " + pseudo ); 8347 8348 // The user may use createPseudo to indicate that 8349 // arguments are needed to create the filter function 8350 // just as Sizzle does 8351 if ( fn[ expando ] ) { 8352 return fn( argument ); 8353 } 8354 8355 // But maintain support for old signatures 8356 if ( fn.length > 1 ) { 8357 args = [ pseudo, pseudo, "", argument ]; 8358 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 8359 markFunction(function( seed, matches ) { 8360 var idx, 8361 matched = fn( seed, argument ), 8362 i = matched.length; 8363 while ( i-- ) { 8364 idx = indexOf( seed, matched[i] ); 8365 seed[ idx ] = !( matches[ idx ] = matched[i] ); 8366 } 8367 }) : 8368 function( elem ) { 8369 return fn( elem, 0, args ); 8370 }; 8371 } 8372 8373 return fn; 8374 } 8375 }, 8376 8377 pseudos: { 8378 // Potentially complex pseudos 8379 "not": markFunction(function( selector ) { 8380 // Trim the selector passed to compile 8381 // to avoid treating leading and trailing 8382 // spaces as combinators 8383 var input = [], 8384 results = [], 8385 matcher = compile( selector.replace( rtrim, "$1" ) ); 8386 8387 return matcher[ expando ] ? 8388 markFunction(function( seed, matches, context, xml ) { 8389 var elem, 8390 unmatched = matcher( seed, null, xml, [] ), 8391 i = seed.length; 8392 8393 // Match elements unmatched by `matcher` 8394 while ( i-- ) { 8395 if ( (elem = unmatched[i]) ) { 8396 seed[i] = !(matches[i] = elem); 8397 } 8398 } 8399 }) : 8400 function( elem, context, xml ) { 8401 input[0] = elem; 8402 matcher( input, null, xml, results ); 8403 // Don't keep the element (issue #299) 8404 input[0] = null; 8405 return !results.pop(); 8406 }; 8407 }), 8408 8409 "has": markFunction(function( selector ) { 8410 return function( elem ) { 8411 return Sizzle( selector, elem ).length > 0; 8412 }; 8413 }), 8414 8415 "contains": markFunction(function( text ) { 8416 text = text.replace( runescape, funescape ); 8417 return function( elem ) { 8418 return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; 8419 }; 8420 }), 8421 8422 // "Whether an element is represented by a :lang() selector 8423 // is based solely on the element's language value 8424 // being equal to the identifier C, 8425 // or beginning with the identifier C immediately followed by "-". 8426 // The matching of C against the element's language value is performed case-insensitively. 8427 // The identifier C does not have to be a valid language name." 8428 // http://www.w3.org/TR/selectors/#lang-pseudo 8429 "lang": markFunction( function( lang ) { 8430 // lang value must be a valid identifier 8431 if ( !ridentifier.test(lang || "") ) { 8432 Sizzle.error( "unsupported lang: " + lang ); 8433 } 8434 lang = lang.replace( runescape, funescape ).toLowerCase(); 8435 return function( elem ) { 8436 var elemLang; 8437 do { 8438 if ( (elemLang = documentIsHTML ? 8439 elem.lang : 8440 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { 8441 8442 elemLang = elemLang.toLowerCase(); 8443 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 8444 } 8445 } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); 8446 return false; 8447 }; 8448 }), 8449 8450 // Miscellaneous 8451 "target": function( elem ) { 8452 var hash = window.location && window.location.hash; 8453 return hash && hash.slice( 1 ) === elem.id; 8454 }, 8455 8456 "root": function( elem ) { 8457 return elem === docElem; 8458 }, 8459 8460 "focus": function( elem ) { 8461 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); 8462 }, 8463 8464 // Boolean properties 8465 "enabled": createDisabledPseudo( false ), 8466 "disabled": createDisabledPseudo( true ), 8467 8468 "checked": function( elem ) { 8469 // In CSS3, :checked should return both checked and selected elements 8470 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 8471 var nodeName = elem.nodeName.toLowerCase(); 8472 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); 8473 }, 8474 8475 "selected": function( elem ) { 8476 // Accessing this property makes selected-by-default 8477 // options in Safari work properly 8478 if ( elem.parentNode ) { 8479 elem.parentNode.selectedIndex; 8480 } 8481 8482 return elem.selected === true; 8483 }, 8484 8485 // Contents 8486 "empty": function( elem ) { 8487 // http://www.w3.org/TR/selectors/#empty-pseudo 8488 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 8489 // but not by others (comment: 8; processing instruction: 7; etc.) 8490 // nodeType < 6 works because attributes (2) do not appear as children 8491 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 8492 if ( elem.nodeType < 6 ) { 8493 return false; 8494 } 8495 } 8496 return true; 8497 }, 8498 8499 "parent": function( elem ) { 8500 return !Expr.pseudos["empty"]( elem ); 8501 }, 8502 8503 // Element/input types 8504 "header": function( elem ) { 8505 return rheader.test( elem.nodeName ); 8506 }, 8507 8508 "input": function( elem ) { 8509 return rinputs.test( elem.nodeName ); 8510 }, 8511 8512 "button": function( elem ) { 8513 var name = elem.nodeName.toLowerCase(); 8514 return name === "input" && elem.type === "button" || name === "button"; 8515 }, 8516 8517 "text": function( elem ) { 8518 var attr; 8519 return elem.nodeName.toLowerCase() === "input" && 8520 elem.type === "text" && 8521 8522 // Support: IE<8 8523 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 8524 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); 8525 }, 8526 8527 // Position-in-collection 8528 "first": createPositionalPseudo(function() { 8529 return [ 0 ]; 8530 }), 8531 8532 "last": createPositionalPseudo(function( matchIndexes, length ) { 8533 return [ length - 1 ]; 8534 }), 8535 8536 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { 8537 return [ argument < 0 ? argument + length : argument ]; 8538 }), 8539 8540 "even": createPositionalPseudo(function( matchIndexes, length ) { 8541 var i = 0; 8542 for ( ; i < length; i += 2 ) { 8543 matchIndexes.push( i ); 8544 } 8545 return matchIndexes; 8546 }), 8547 8548 "odd": createPositionalPseudo(function( matchIndexes, length ) { 8549 var i = 1; 8550 for ( ; i < length; i += 2 ) { 8551 matchIndexes.push( i ); 8552 } 8553 return matchIndexes; 8554 }), 8555 8556 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { 8557 var i = argument < 0 ? 8558 argument + length : 8559 argument > length ? 8560 length : 8561 argument; 8562 for ( ; --i >= 0; ) { 8563 matchIndexes.push( i ); 8564 } 8565 return matchIndexes; 8566 }), 8567 8568 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { 8569 var i = argument < 0 ? argument + length : argument; 8570 for ( ; ++i < length; ) { 8571 matchIndexes.push( i ); 8572 } 8573 return matchIndexes; 8574 }) 8575 } 8576}; 8577 8578Expr.pseudos["nth"] = Expr.pseudos["eq"]; 8579 8580// Add button/input type pseudos 8581for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 8582 Expr.pseudos[ i ] = createInputPseudo( i ); 8583} 8584for ( i in { submit: true, reset: true } ) { 8585 Expr.pseudos[ i ] = createButtonPseudo( i ); 8586} 8587 8588// Easy API for creating new setFilters 8589function setFilters() {} 8590setFilters.prototype = Expr.filters = Expr.pseudos; 8591Expr.setFilters = new setFilters(); 8592 8593tokenize = Sizzle.tokenize = function( selector, parseOnly ) { 8594 var matched, match, tokens, type, 8595 soFar, groups, preFilters, 8596 cached = tokenCache[ selector + " " ]; 8597 8598 if ( cached ) { 8599 return parseOnly ? 0 : cached.slice( 0 ); 8600 } 8601 8602 soFar = selector; 8603 groups = []; 8604 preFilters = Expr.preFilter; 8605 8606 while ( soFar ) { 8607 8608 // Comma and first run 8609 if ( !matched || (match = rcomma.exec( soFar )) ) { 8610 if ( match ) { 8611 // Don't consume trailing commas as valid 8612 soFar = soFar.slice( match[0].length ) || soFar; 8613 } 8614 groups.push( (tokens = []) ); 8615 } 8616 8617 matched = false; 8618 8619 // Combinators 8620 if ( (match = rcombinators.exec( soFar )) ) { 8621 matched = match.shift(); 8622 tokens.push({ 8623 value: matched, 8624 // Cast descendant combinators to space 8625 type: match[0].replace( rtrim, " " ) 8626 }); 8627 soFar = soFar.slice( matched.length ); 8628 } 8629 8630 // Filters 8631 for ( type in Expr.filter ) { 8632 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || 8633 (match = preFilters[ type ]( match ))) ) { 8634 matched = match.shift(); 8635 tokens.push({ 8636 value: matched, 8637 type: type, 8638 matches: match 8639 }); 8640 soFar = soFar.slice( matched.length ); 8641 } 8642 } 8643 8644 if ( !matched ) { 8645 break; 8646 } 8647 } 8648 8649 // Return the length of the invalid excess 8650 // if we're just parsing 8651 // Otherwise, throw an error or return tokens 8652 return parseOnly ? 8653 soFar.length : 8654 soFar ? 8655 Sizzle.error( selector ) : 8656 // Cache the tokens 8657 tokenCache( selector, groups ).slice( 0 ); 8658}; 8659 8660function toSelector( tokens ) { 8661 var i = 0, 8662 len = tokens.length, 8663 selector = ""; 8664 for ( ; i < len; i++ ) { 8665 selector += tokens[i].value; 8666 } 8667 return selector; 8668} 8669 8670function addCombinator( matcher, combinator, base ) { 8671 var dir = combinator.dir, 8672 skip = combinator.next, 8673 key = skip || dir, 8674 checkNonElements = base && key === "parentNode", 8675 doneName = done++; 8676 8677 return combinator.first ? 8678 // Check against closest ancestor/preceding element 8679 function( elem, context, xml ) { 8680 while ( (elem = elem[ dir ]) ) { 8681 if ( elem.nodeType === 1 || checkNonElements ) { 8682 return matcher( elem, context, xml ); 8683 } 8684 } 8685 return false; 8686 } : 8687 8688 // Check against all ancestor/preceding elements 8689 function( elem, context, xml ) { 8690 var oldCache, uniqueCache, outerCache, 8691 newCache = [ dirruns, doneName ]; 8692 8693 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 8694 if ( xml ) { 8695 while ( (elem = elem[ dir ]) ) { 8696 if ( elem.nodeType === 1 || checkNonElements ) { 8697 if ( matcher( elem, context, xml ) ) { 8698 return true; 8699 } 8700 } 8701 } 8702 } else { 8703 while ( (elem = elem[ dir ]) ) { 8704 if ( elem.nodeType === 1 || checkNonElements ) { 8705 outerCache = elem[ expando ] || (elem[ expando ] = {}); 8706 8707 // Support: IE <9 only 8708 // Defend against cloned attroperties (jQuery gh-1709) 8709 uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); 8710 8711 if ( skip && skip === elem.nodeName.toLowerCase() ) { 8712 elem = elem[ dir ] || elem; 8713 } else if ( (oldCache = uniqueCache[ key ]) && 8714 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 8715 8716 // Assign to newCache so results back-propagate to previous elements 8717 return (newCache[ 2 ] = oldCache[ 2 ]); 8718 } else { 8719 // Reuse newcache so results back-propagate to previous elements 8720 uniqueCache[ key ] = newCache; 8721 8722 // A match means we're done; a fail means we have to keep checking 8723 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { 8724 return true; 8725 } 8726 } 8727 } 8728 } 8729 } 8730 return false; 8731 }; 8732} 8733 8734function elementMatcher( matchers ) { 8735 return matchers.length > 1 ? 8736 function( elem, context, xml ) { 8737 var i = matchers.length; 8738 while ( i-- ) { 8739 if ( !matchers[i]( elem, context, xml ) ) { 8740 return false; 8741 } 8742 } 8743 return true; 8744 } : 8745 matchers[0]; 8746} 8747 8748function multipleContexts( selector, contexts, results ) { 8749 var i = 0, 8750 len = contexts.length; 8751 for ( ; i < len; i++ ) { 8752 Sizzle( selector, contexts[i], results ); 8753 } 8754 return results; 8755} 8756 8757function condense( unmatched, map, filter, context, xml ) { 8758 var elem, 8759 newUnmatched = [], 8760 i = 0, 8761 len = unmatched.length, 8762 mapped = map != null; 8763 8764 for ( ; i < len; i++ ) { 8765 if ( (elem = unmatched[i]) ) { 8766 if ( !filter || filter( elem, context, xml ) ) { 8767 newUnmatched.push( elem ); 8768 if ( mapped ) { 8769 map.push( i ); 8770 } 8771 } 8772 } 8773 } 8774 8775 return newUnmatched; 8776} 8777 8778function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 8779 if ( postFilter && !postFilter[ expando ] ) { 8780 postFilter = setMatcher( postFilter ); 8781 } 8782 if ( postFinder && !postFinder[ expando ] ) { 8783 postFinder = setMatcher( postFinder, postSelector ); 8784 } 8785 return markFunction(function( seed, results, context, xml ) { 8786 var temp, i, elem, 8787 preMap = [], 8788 postMap = [], 8789 preexisting = results.length, 8790 8791 // Get initial elements from seed or context 8792 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), 8793 8794 // Prefilter to get matcher input, preserving a map for seed-results synchronization 8795 matcherIn = preFilter && ( seed || !selector ) ? 8796 condense( elems, preMap, preFilter, context, xml ) : 8797 elems, 8798 8799 matcherOut = matcher ? 8800 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 8801 postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 8802 8803 // ...intermediate processing is necessary 8804 [] : 8805 8806 // ...otherwise use results directly 8807 results : 8808 matcherIn; 8809 8810 // Find primary matches 8811 if ( matcher ) { 8812 matcher( matcherIn, matcherOut, context, xml ); 8813 } 8814 8815 // Apply postFilter 8816 if ( postFilter ) { 8817 temp = condense( matcherOut, postMap ); 8818 postFilter( temp, [], context, xml ); 8819 8820 // Un-match failing elements by moving them back to matcherIn 8821 i = temp.length; 8822 while ( i-- ) { 8823 if ( (elem = temp[i]) ) { 8824 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); 8825 } 8826 } 8827 } 8828 8829 if ( seed ) { 8830 if ( postFinder || preFilter ) { 8831 if ( postFinder ) { 8832 // Get the final matcherOut by condensing this intermediate into postFinder contexts 8833 temp = []; 8834 i = matcherOut.length; 8835 while ( i-- ) { 8836 if ( (elem = matcherOut[i]) ) { 8837 // Restore matcherIn since elem is not yet a final match 8838 temp.push( (matcherIn[i] = elem) ); 8839 } 8840 } 8841 postFinder( null, (matcherOut = []), temp, xml ); 8842 } 8843 8844 // Move matched elements from seed to results to keep them synchronized 8845 i = matcherOut.length; 8846 while ( i-- ) { 8847 if ( (elem = matcherOut[i]) && 8848 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { 8849 8850 seed[temp] = !(results[temp] = elem); 8851 } 8852 } 8853 } 8854 8855 // Add elements to results, through postFinder if defined 8856 } else { 8857 matcherOut = condense( 8858 matcherOut === results ? 8859 matcherOut.splice( preexisting, matcherOut.length ) : 8860 matcherOut 8861 ); 8862 if ( postFinder ) { 8863 postFinder( null, results, matcherOut, xml ); 8864 } else { 8865 push.apply( results, matcherOut ); 8866 } 8867 } 8868 }); 8869} 8870 8871function matcherFromTokens( tokens ) { 8872 var checkContext, matcher, j, 8873 len = tokens.length, 8874 leadingRelative = Expr.relative[ tokens[0].type ], 8875 implicitRelative = leadingRelative || Expr.relative[" "], 8876 i = leadingRelative ? 1 : 0, 8877 8878 // The foundational matcher ensures that elements are reachable from top-level context(s) 8879 matchContext = addCombinator( function( elem ) { 8880 return elem === checkContext; 8881 }, implicitRelative, true ), 8882 matchAnyContext = addCombinator( function( elem ) { 8883 return indexOf( checkContext, elem ) > -1; 8884 }, implicitRelative, true ), 8885 matchers = [ function( elem, context, xml ) { 8886 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( 8887 (checkContext = context).nodeType ? 8888 matchContext( elem, context, xml ) : 8889 matchAnyContext( elem, context, xml ) ); 8890 // Avoid hanging onto element (issue #299) 8891 checkContext = null; 8892 return ret; 8893 } ]; 8894 8895 for ( ; i < len; i++ ) { 8896 if ( (matcher = Expr.relative[ tokens[i].type ]) ) { 8897 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; 8898 } else { 8899 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); 8900 8901 // Return special upon seeing a positional matcher 8902 if ( matcher[ expando ] ) { 8903 // Find the next relative operator (if any) for proper handling 8904 j = ++i; 8905 for ( ; j < len; j++ ) { 8906 if ( Expr.relative[ tokens[j].type ] ) { 8907 break; 8908 } 8909 } 8910 return setMatcher( 8911 i > 1 && elementMatcher( matchers ), 8912 i > 1 && toSelector( 8913 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 8914 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) 8915 ).replace( rtrim, "$1" ), 8916 matcher, 8917 i < j && matcherFromTokens( tokens.slice( i, j ) ), 8918 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), 8919 j < len && toSelector( tokens ) 8920 ); 8921 } 8922 matchers.push( matcher ); 8923 } 8924 } 8925 8926 return elementMatcher( matchers ); 8927} 8928 8929function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 8930 var bySet = setMatchers.length > 0, 8931 byElement = elementMatchers.length > 0, 8932 superMatcher = function( seed, context, xml, results, outermost ) { 8933 var elem, j, matcher, 8934 matchedCount = 0, 8935 i = "0", 8936 unmatched = seed && [], 8937 setMatched = [], 8938 contextBackup = outermostContext, 8939 // We must always have either seed elements or outermost context 8940 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), 8941 // Use integer dirruns iff this is the outermost matcher 8942 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), 8943 len = elems.length; 8944 8945 if ( outermost ) { 8946 outermostContext = context === document || context || outermost; 8947 } 8948 8949 // Add elements passing elementMatchers directly to results 8950 // Support: IE<9, Safari 8951 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 8952 for ( ; i !== len && (elem = elems[i]) != null; i++ ) { 8953 if ( byElement && elem ) { 8954 j = 0; 8955 if ( !context && elem.ownerDocument !== document ) { 8956 setDocument( elem ); 8957 xml = !documentIsHTML; 8958 } 8959 while ( (matcher = elementMatchers[j++]) ) { 8960 if ( matcher( elem, context || document, xml) ) { 8961 results.push( elem ); 8962 break; 8963 } 8964 } 8965 if ( outermost ) { 8966 dirruns = dirrunsUnique; 8967 } 8968 } 8969 8970 // Track unmatched elements for set filters 8971 if ( bySet ) { 8972 // They will have gone through all possible matchers 8973 if ( (elem = !matcher && elem) ) { 8974 matchedCount--; 8975 } 8976 8977 // Lengthen the array for every element, matched or not 8978 if ( seed ) { 8979 unmatched.push( elem ); 8980 } 8981 } 8982 } 8983 8984 // `i` is now the count of elements visited above, and adding it to `matchedCount` 8985 // makes the latter nonnegative. 8986 matchedCount += i; 8987 8988 // Apply set filters to unmatched elements 8989 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 8990 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 8991 // no element matchers and no seed. 8992 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 8993 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 8994 // numerically zero. 8995 if ( bySet && i !== matchedCount ) { 8996 j = 0; 8997 while ( (matcher = setMatchers[j++]) ) { 8998 matcher( unmatched, setMatched, context, xml ); 8999 } 9000 9001 if ( seed ) { 9002 // Reintegrate element matches to eliminate the need for sorting 9003 if ( matchedCount > 0 ) { 9004 while ( i-- ) { 9005 if ( !(unmatched[i] || setMatched[i]) ) { 9006 setMatched[i] = pop.call( results ); 9007 } 9008 } 9009 } 9010 9011 // Discard index placeholder values to get only actual matches 9012 setMatched = condense( setMatched ); 9013 } 9014 9015 // Add matches to results 9016 push.apply( results, setMatched ); 9017 9018 // Seedless set matches succeeding multiple successful matchers stipulate sorting 9019 if ( outermost && !seed && setMatched.length > 0 && 9020 ( matchedCount + setMatchers.length ) > 1 ) { 9021 9022 Sizzle.uniqueSort( results ); 9023 } 9024 } 9025 9026 // Override manipulation of globals by nested matchers 9027 if ( outermost ) { 9028 dirruns = dirrunsUnique; 9029 outermostContext = contextBackup; 9030 } 9031 9032 return unmatched; 9033 }; 9034 9035 return bySet ? 9036 markFunction( superMatcher ) : 9037 superMatcher; 9038} 9039 9040compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { 9041 var i, 9042 setMatchers = [], 9043 elementMatchers = [], 9044 cached = compilerCache[ selector + " " ]; 9045 9046 if ( !cached ) { 9047 // Generate a function of recursive functions that can be used to check each element 9048 if ( !match ) { 9049 match = tokenize( selector ); 9050 } 9051 i = match.length; 9052 while ( i-- ) { 9053 cached = matcherFromTokens( match[i] ); 9054 if ( cached[ expando ] ) { 9055 setMatchers.push( cached ); 9056 } else { 9057 elementMatchers.push( cached ); 9058 } 9059 } 9060 9061 // Cache the compiled function 9062 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 9063 9064 // Save selector and tokenization 9065 cached.selector = selector; 9066 } 9067 return cached; 9068}; 9069 9070/** 9071 * A low-level selection function that works with Sizzle's compiled 9072 * selector functions 9073 * @param {String|Function} selector A selector or a pre-compiled 9074 * selector function built with Sizzle.compile 9075 * @param {Element} context 9076 * @param {Array} [results] 9077 * @param {Array} [seed] A set of elements to match against 9078 */ 9079select = Sizzle.select = function( selector, context, results, seed ) { 9080 var i, tokens, token, type, find, 9081 compiled = typeof selector === "function" && selector, 9082 match = !seed && tokenize( (selector = compiled.selector || selector) ); 9083 9084 results = results || []; 9085 9086 // Try to minimize operations if there is only one selector in the list and no seed 9087 // (the latter of which guarantees us context) 9088 if ( match.length === 1 ) { 9089 9090 // Reduce context if the leading compound selector is an ID 9091 tokens = match[0] = match[0].slice( 0 ); 9092 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && 9093 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { 9094 9095 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; 9096 if ( !context ) { 9097 return results; 9098 9099 // Precompiled matchers will still verify ancestry, so step up a level 9100 } else if ( compiled ) { 9101 context = context.parentNode; 9102 } 9103 9104 selector = selector.slice( tokens.shift().value.length ); 9105 } 9106 9107 // Fetch a seed set for right-to-left matching 9108 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; 9109 while ( i-- ) { 9110 token = tokens[i]; 9111 9112 // Abort if we hit a combinator 9113 if ( Expr.relative[ (type = token.type) ] ) { 9114 break; 9115 } 9116 if ( (find = Expr.find[ type ]) ) { 9117 // Search, expanding context for leading sibling combinators 9118 if ( (seed = find( 9119 token.matches[0].replace( runescape, funescape ), 9120 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context 9121 )) ) { 9122 9123 // If seed is empty or no tokens remain, we can return early 9124 tokens.splice( i, 1 ); 9125 selector = seed.length && toSelector( tokens ); 9126 if ( !selector ) { 9127 push.apply( results, seed ); 9128 return results; 9129 } 9130 9131 break; 9132 } 9133 } 9134 } 9135 } 9136 9137 // Compile and execute a filtering function if one is not provided 9138 // Provide `match` to avoid retokenization if we modified the selector above 9139 ( compiled || compile( selector, match ) )( 9140 seed, 9141 context, 9142 !documentIsHTML, 9143 results, 9144 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 9145 ); 9146 return results; 9147}; 9148 9149// One-time assignments 9150 9151// Sort stability 9152support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; 9153 9154// Support: Chrome 14-35+ 9155// Always assume duplicates if they aren't passed to the comparison function 9156support.detectDuplicates = !!hasDuplicate; 9157 9158// Initialize against the default document 9159setDocument(); 9160 9161// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 9162// Detached nodes confoundingly follow *each other* 9163support.sortDetached = assert(function( el ) { 9164 // Should return 1, but returns 4 (following) 9165 return el.compareDocumentPosition( document.createElement("fieldset") ) & 1; 9166}); 9167 9168// Support: IE<8 9169// Prevent attribute/property "interpolation" 9170// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 9171if ( !assert(function( el ) { 9172 el.innerHTML = "<a href='#'></a>"; 9173 return el.firstChild.getAttribute("href") === "#" ; 9174}) ) { 9175 addHandle( "type|href|height|width", function( elem, name, isXML ) { 9176 if ( !isXML ) { 9177 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); 9178 } 9179 }); 9180} 9181 9182// Support: IE<9 9183// Use defaultValue in place of getAttribute("value") 9184if ( !support.attributes || !assert(function( el ) { 9185 el.innerHTML = "<input/>"; 9186 el.firstChild.setAttribute( "value", "" ); 9187 return el.firstChild.getAttribute( "value" ) === ""; 9188}) ) { 9189 addHandle( "value", function( elem, name, isXML ) { 9190 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { 9191 return elem.defaultValue; 9192 } 9193 }); 9194} 9195 9196// Support: IE<9 9197// Use getAttributeNode to fetch booleans when getAttribute lies 9198if ( !assert(function( el ) { 9199 return el.getAttribute("disabled") == null; 9200}) ) { 9201 addHandle( booleans, function( elem, name, isXML ) { 9202 var val; 9203 if ( !isXML ) { 9204 return elem[ name ] === true ? name.toLowerCase() : 9205 (val = elem.getAttributeNode( name )) && val.specified ? 9206 val.value : 9207 null; 9208 } 9209 }); 9210} 9211 9212return Sizzle; 9213 9214})( window ); 9215 9216 9217 9218jQuery.find = Sizzle; 9219jQuery.expr = Sizzle.selectors; 9220 9221// Deprecated 9222jQuery.expr[ ":" ] = jQuery.expr.pseudos; 9223jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; 9224jQuery.text = Sizzle.getText; 9225jQuery.isXMLDoc = Sizzle.isXML; 9226jQuery.contains = Sizzle.contains; 9227jQuery.escapeSelector = Sizzle.escape; 9228 9229 9230 9231 9232var dir = function( elem, dir, until ) { 9233 var matched = [], 9234 truncate = until !== undefined; 9235 9236 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 9237 if ( elem.nodeType === 1 ) { 9238 if ( truncate && jQuery( elem ).is( until ) ) { 9239 break; 9240 } 9241 matched.push( elem ); 9242 } 9243 } 9244 return matched; 9245}; 9246 9247 9248var siblings = function( n, elem ) { 9249 var matched = []; 9250 9251 for ( ; n; n = n.nextSibling ) { 9252 if ( n.nodeType === 1 && n !== elem ) { 9253 matched.push( n ); 9254 } 9255 } 9256 9257 return matched; 9258}; 9259 9260 9261var rneedsContext = jQuery.expr.match.needsContext; 9262 9263 9264 9265function nodeName( elem, name ) { 9266 9267 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 9268 9269}; 9270var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); 9271 9272 9273 9274// Implement the identical functionality for filter and not 9275function winnow( elements, qualifier, not ) { 9276 if ( isFunction( qualifier ) ) { 9277 return jQuery.grep( elements, function( elem, i ) { 9278 return !!qualifier.call( elem, i, elem ) !== not; 9279 } ); 9280 } 9281 9282 // Single element 9283 if ( qualifier.nodeType ) { 9284 return jQuery.grep( elements, function( elem ) { 9285 return ( elem === qualifier ) !== not; 9286 } ); 9287 } 9288 9289 // Arraylike of elements (jQuery, arguments, Array) 9290 if ( typeof qualifier !== "string" ) { 9291 return jQuery.grep( elements, function( elem ) { 9292 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 9293 } ); 9294 } 9295 9296 // Filtered directly for both simple and complex selectors 9297 return jQuery.filter( qualifier, elements, not ); 9298} 9299 9300jQuery.filter = function( expr, elems, not ) { 9301 var elem = elems[ 0 ]; 9302 9303 if ( not ) { 9304 expr = ":not(" + expr + ")"; 9305 } 9306 9307 if ( elems.length === 1 && elem.nodeType === 1 ) { 9308 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; 9309 } 9310 9311 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 9312 return elem.nodeType === 1; 9313 } ) ); 9314}; 9315 9316jQuery.fn.extend( { 9317 find: function( selector ) { 9318 var i, ret, 9319 len = this.length, 9320 self = this; 9321 9322 if ( typeof selector !== "string" ) { 9323 return this.pushStack( jQuery( selector ).filter( function() { 9324 for ( i = 0; i < len; i++ ) { 9325 if ( jQuery.contains( self[ i ], this ) ) { 9326 return true; 9327 } 9328 } 9329 } ) ); 9330 } 9331 9332 ret = this.pushStack( [] ); 9333 9334 for ( i = 0; i < len; i++ ) { 9335 jQuery.find( selector, self[ i ], ret ); 9336 } 9337 9338 return len > 1 ? jQuery.uniqueSort( ret ) : ret; 9339 }, 9340 filter: function( selector ) { 9341 return this.pushStack( winnow( this, selector || [], false ) ); 9342 }, 9343 not: function( selector ) { 9344 return this.pushStack( winnow( this, selector || [], true ) ); 9345 }, 9346 is: function( selector ) { 9347 return !!winnow( 9348 this, 9349 9350 // If this is a positional/relative selector, check membership in the returned set 9351 // so $("p:first").is("p:last") won't return true for a doc with two "p". 9352 typeof selector === "string" && rneedsContext.test( selector ) ? 9353 jQuery( selector ) : 9354 selector || [], 9355 false 9356 ).length; 9357 } 9358} ); 9359 9360 9361// Initialize a jQuery object 9362 9363 9364// A central reference to the root jQuery(document) 9365var rootjQuery, 9366 9367 // A simple way to check for HTML strings 9368 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 9369 // Strict HTML recognition (#11290: must start with <) 9370 // Shortcut simple #id case for speed 9371 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 9372 9373 init = jQuery.fn.init = function( selector, context, root ) { 9374 var match, elem; 9375 9376 // HANDLE: $(""), $(null), $(undefined), $(false) 9377 if ( !selector ) { 9378 return this; 9379 } 9380 9381 // Method init() accepts an alternate rootjQuery 9382 // so migrate can support jQuery.sub (gh-2101) 9383 root = root || rootjQuery; 9384 9385 // Handle HTML strings 9386 if ( typeof selector === "string" ) { 9387 if ( selector[ 0 ] === "<" && 9388 selector[ selector.length - 1 ] === ">" && 9389 selector.length >= 3 ) { 9390 9391 // Assume that strings that start and end with <> are HTML and skip the regex check 9392 match = [ null, selector, null ]; 9393 9394 } else { 9395 match = rquickExpr.exec( selector ); 9396 } 9397 9398 // Match html or make sure no context is specified for #id 9399 if ( match && ( match[ 1 ] || !context ) ) { 9400 9401 // HANDLE: $(html) -> $(array) 9402 if ( match[ 1 ] ) { 9403 context = context instanceof jQuery ? context[ 0 ] : context; 9404 9405 // Option to run scripts is true for back-compat 9406 // Intentionally let the error be thrown if parseHTML is not present 9407 jQuery.merge( this, jQuery.parseHTML( 9408 match[ 1 ], 9409 context && context.nodeType ? context.ownerDocument || context : document, 9410 true 9411 ) ); 9412 9413 // HANDLE: $(html, props) 9414 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 9415 for ( match in context ) { 9416 9417 // Properties of context are called as methods if possible 9418 if ( isFunction( this[ match ] ) ) { 9419 this[ match ]( context[ match ] ); 9420 9421 // ...and otherwise set as attributes 9422 } else { 9423 this.attr( match, context[ match ] ); 9424 } 9425 } 9426 } 9427 9428 return this; 9429 9430 // HANDLE: $(#id) 9431 } else { 9432 elem = document.getElementById( match[ 2 ] ); 9433 9434 if ( elem ) { 9435 9436 // Inject the element directly into the jQuery object 9437 this[ 0 ] = elem; 9438 this.length = 1; 9439 } 9440 return this; 9441 } 9442 9443 // HANDLE: $(expr, $(...)) 9444 } else if ( !context || context.jquery ) { 9445 return ( context || root ).find( selector ); 9446 9447 // HANDLE: $(expr, context) 9448 // (which is just equivalent to: $(context).find(expr) 9449 } else { 9450 return this.constructor( context ).find( selector ); 9451 } 9452 9453 // HANDLE: $(DOMElement) 9454 } else if ( selector.nodeType ) { 9455 this[ 0 ] = selector; 9456 this.length = 1; 9457 return this; 9458 9459 // HANDLE: $(function) 9460 // Shortcut for document ready 9461 } else if ( isFunction( selector ) ) { 9462 return root.ready !== undefined ? 9463 root.ready( selector ) : 9464 9465 // Execute immediately if ready is not present 9466 selector( jQuery ); 9467 } 9468 9469 return jQuery.makeArray( selector, this ); 9470 }; 9471 9472// Give the init function the jQuery prototype for later instantiation 9473init.prototype = jQuery.fn; 9474 9475// Initialize central reference 9476rootjQuery = jQuery( document ); 9477 9478 9479var rparentsprev = /^(?:parents|prev(?:Until|All))/, 9480 9481 // Methods guaranteed to produce a unique set when starting from a unique set 9482 guaranteedUnique = { 9483 children: true, 9484 contents: true, 9485 next: true, 9486 prev: true 9487 }; 9488 9489jQuery.fn.extend( { 9490 has: function( target ) { 9491 var targets = jQuery( target, this ), 9492 l = targets.length; 9493 9494 return this.filter( function() { 9495 var i = 0; 9496 for ( ; i < l; i++ ) { 9497 if ( jQuery.contains( this, targets[ i ] ) ) { 9498 return true; 9499 } 9500 } 9501 } ); 9502 }, 9503 9504 closest: function( selectors, context ) { 9505 var cur, 9506 i = 0, 9507 l = this.length, 9508 matched = [], 9509 targets = typeof selectors !== "string" && jQuery( selectors ); 9510 9511 // Positional selectors never match, since there's no _selection_ context 9512 if ( !rneedsContext.test( selectors ) ) { 9513 for ( ; i < l; i++ ) { 9514 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 9515 9516 // Always skip document fragments 9517 if ( cur.nodeType < 11 && ( targets ? 9518 targets.index( cur ) > -1 : 9519 9520 // Don't pass non-elements to Sizzle 9521 cur.nodeType === 1 && 9522 jQuery.find.matchesSelector( cur, selectors ) ) ) { 9523 9524 matched.push( cur ); 9525 break; 9526 } 9527 } 9528 } 9529 } 9530 9531 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 9532 }, 9533 9534 // Determine the position of an element within the set 9535 index: function( elem ) { 9536 9537 // No argument, return index in parent 9538 if ( !elem ) { 9539 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 9540 } 9541 9542 // Index in selector 9543 if ( typeof elem === "string" ) { 9544 return indexOf.call( jQuery( elem ), this[ 0 ] ); 9545 } 9546 9547 // Locate the position of the desired element 9548 return indexOf.call( this, 9549 9550 // If it receives a jQuery object, the first element is used 9551 elem.jquery ? elem[ 0 ] : elem 9552 ); 9553 }, 9554 9555 add: function( selector, context ) { 9556 return this.pushStack( 9557 jQuery.uniqueSort( 9558 jQuery.merge( this.get(), jQuery( selector, context ) ) 9559 ) 9560 ); 9561 }, 9562 9563 addBack: function( selector ) { 9564 return this.add( selector == null ? 9565 this.prevObject : this.prevObject.filter( selector ) 9566 ); 9567 } 9568} ); 9569 9570function sibling( cur, dir ) { 9571 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 9572 return cur; 9573} 9574 9575jQuery.each( { 9576 parent: function( elem ) { 9577 var parent = elem.parentNode; 9578 return parent && parent.nodeType !== 11 ? parent : null; 9579 }, 9580 parents: function( elem ) { 9581 return dir( elem, "parentNode" ); 9582 }, 9583 parentsUntil: function( elem, i, until ) { 9584 return dir( elem, "parentNode", until ); 9585 }, 9586 next: function( elem ) { 9587 return sibling( elem, "nextSibling" ); 9588 }, 9589 prev: function( elem ) { 9590 return sibling( elem, "previousSibling" ); 9591 }, 9592 nextAll: function( elem ) { 9593 return dir( elem, "nextSibling" ); 9594 }, 9595 prevAll: function( elem ) { 9596 return dir( elem, "previousSibling" ); 9597 }, 9598 nextUntil: function( elem, i, until ) { 9599 return dir( elem, "nextSibling", until ); 9600 }, 9601 prevUntil: function( elem, i, until ) { 9602 return dir( elem, "previousSibling", until ); 9603 }, 9604 siblings: function( elem ) { 9605 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 9606 }, 9607 children: function( elem ) { 9608 return siblings( elem.firstChild ); 9609 }, 9610 contents: function( elem ) { 9611 if ( typeof elem.contentDocument !== "undefined" ) { 9612 return elem.contentDocument; 9613 } 9614 9615 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 9616 // Treat the template element as a regular one in browsers that 9617 // don't support it. 9618 if ( nodeName( elem, "template" ) ) { 9619 elem = elem.content || elem; 9620 } 9621 9622 return jQuery.merge( [], elem.childNodes ); 9623 } 9624}, function( name, fn ) { 9625 jQuery.fn[ name ] = function( until, selector ) { 9626 var matched = jQuery.map( this, fn, until ); 9627 9628 if ( name.slice( -5 ) !== "Until" ) { 9629 selector = until; 9630 } 9631 9632 if ( selector && typeof selector === "string" ) { 9633 matched = jQuery.filter( selector, matched ); 9634 } 9635 9636 if ( this.length > 1 ) { 9637 9638 // Remove duplicates 9639 if ( !guaranteedUnique[ name ] ) { 9640 jQuery.uniqueSort( matched ); 9641 } 9642 9643 // Reverse order for parents* and prev-derivatives 9644 if ( rparentsprev.test( name ) ) { 9645 matched.reverse(); 9646 } 9647 } 9648 9649 return this.pushStack( matched ); 9650 }; 9651} ); 9652var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); 9653 9654 9655 9656// Convert String-formatted options into Object-formatted ones 9657function createOptions( options ) { 9658 var object = {}; 9659 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { 9660 object[ flag ] = true; 9661 } ); 9662 return object; 9663} 9664 9665/* 9666 * Create a callback list using the following parameters: 9667 * 9668 * options: an optional list of space-separated options that will change how 9669 * the callback list behaves or a more traditional option object 9670 * 9671 * By default a callback list will act like an event callback list and can be 9672 * "fired" multiple times. 9673 * 9674 * Possible options: 9675 * 9676 * once: will ensure the callback list can only be fired once (like a Deferred) 9677 * 9678 * memory: will keep track of previous values and will call any callback added 9679 * after the list has been fired right away with the latest "memorized" 9680 * values (like a Deferred) 9681 * 9682 * unique: will ensure a callback can only be added once (no duplicate in the list) 9683 * 9684 * stopOnFalse: interrupt callings when a callback returns false 9685 * 9686 */ 9687jQuery.Callbacks = function( options ) { 9688 9689 // Convert options from String-formatted to Object-formatted if needed 9690 // (we check in cache first) 9691 options = typeof options === "string" ? 9692 createOptions( options ) : 9693 jQuery.extend( {}, options ); 9694 9695 var // Flag to know if list is currently firing 9696 firing, 9697 9698 // Last fire value for non-forgettable lists 9699 memory, 9700 9701 // Flag to know if list was already fired 9702 fired, 9703 9704 // Flag to prevent firing 9705 locked, 9706 9707 // Actual callback list 9708 list = [], 9709 9710 // Queue of execution data for repeatable lists 9711 queue = [], 9712 9713 // Index of currently firing callback (modified by add/remove as needed) 9714 firingIndex = -1, 9715 9716 // Fire callbacks 9717 fire = function() { 9718 9719 // Enforce single-firing 9720 locked = locked || options.once; 9721 9722 // Execute callbacks for all pending executions, 9723 // respecting firingIndex overrides and runtime changes 9724 fired = firing = true; 9725 for ( ; queue.length; firingIndex = -1 ) { 9726 memory = queue.shift(); 9727 while ( ++firingIndex < list.length ) { 9728 9729 // Run callback and check for early termination 9730 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 9731 options.stopOnFalse ) { 9732 9733 // Jump to end and forget the data so .add doesn't re-fire 9734 firingIndex = list.length; 9735 memory = false; 9736 } 9737 } 9738 } 9739 9740 // Forget the data if we're done with it 9741 if ( !options.memory ) { 9742 memory = false; 9743 } 9744 9745 firing = false; 9746 9747 // Clean up if we're done firing for good 9748 if ( locked ) { 9749 9750 // Keep an empty list if we have data for future add calls 9751 if ( memory ) { 9752 list = []; 9753 9754 // Otherwise, this object is spent 9755 } else { 9756 list = ""; 9757 } 9758 } 9759 }, 9760 9761 // Actual Callbacks object 9762 self = { 9763 9764 // Add a callback or a collection of callbacks to the list 9765 add: function() { 9766 if ( list ) { 9767 9768 // If we have memory from a past run, we should fire after adding 9769 if ( memory && !firing ) { 9770 firingIndex = list.length - 1; 9771 queue.push( memory ); 9772 } 9773 9774 ( function add( args ) { 9775 jQuery.each( args, function( _, arg ) { 9776 if ( isFunction( arg ) ) { 9777 if ( !options.unique || !self.has( arg ) ) { 9778 list.push( arg ); 9779 } 9780 } else if ( arg && arg.length && toType( arg ) !== "string" ) { 9781 9782 // Inspect recursively 9783 add( arg ); 9784 } 9785 } ); 9786 } )( arguments ); 9787 9788 if ( memory && !firing ) { 9789 fire(); 9790 } 9791 } 9792 return this; 9793 }, 9794 9795 // Remove a callback from the list 9796 remove: function() { 9797 jQuery.each( arguments, function( _, arg ) { 9798 var index; 9799 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 9800 list.splice( index, 1 ); 9801 9802 // Handle firing indexes 9803 if ( index <= firingIndex ) { 9804 firingIndex--; 9805 } 9806 } 9807 } ); 9808 return this; 9809 }, 9810 9811 // Check if a given callback is in the list. 9812 // If no argument is given, return whether or not list has callbacks attached. 9813 has: function( fn ) { 9814 return fn ? 9815 jQuery.inArray( fn, list ) > -1 : 9816 list.length > 0; 9817 }, 9818 9819 // Remove all callbacks from the list 9820 empty: function() { 9821 if ( list ) { 9822 list = []; 9823 } 9824 return this; 9825 }, 9826 9827 // Disable .fire and .add 9828 // Abort any current/pending executions 9829 // Clear all callbacks and values 9830 disable: function() { 9831 locked = queue = []; 9832 list = memory = ""; 9833 return this; 9834 }, 9835 disabled: function() { 9836 return !list; 9837 }, 9838 9839 // Disable .fire 9840 // Also disable .add unless we have memory (since it would have no effect) 9841 // Abort any pending executions 9842 lock: function() { 9843 locked = queue = []; 9844 if ( !memory && !firing ) { 9845 list = memory = ""; 9846 } 9847 return this; 9848 }, 9849 locked: function() { 9850 return !!locked; 9851 }, 9852 9853 // Call all callbacks with the given context and arguments 9854 fireWith: function( context, args ) { 9855 if ( !locked ) { 9856 args = args || []; 9857 args = [ context, args.slice ? args.slice() : args ]; 9858 queue.push( args ); 9859 if ( !firing ) { 9860 fire(); 9861 } 9862 } 9863 return this; 9864 }, 9865 9866 // Call all the callbacks with the given arguments 9867 fire: function() { 9868 self.fireWith( this, arguments ); 9869 return this; 9870 }, 9871 9872 // To know if the callbacks have already been called at least once 9873 fired: function() { 9874 return !!fired; 9875 } 9876 }; 9877 9878 return self; 9879}; 9880 9881 9882function Identity( v ) { 9883 return v; 9884} 9885function Thrower( ex ) { 9886 throw ex; 9887} 9888 9889function adoptValue( value, resolve, reject, noValue ) { 9890 var method; 9891 9892 try { 9893 9894 // Check for promise aspect first to privilege synchronous behavior 9895 if ( value && isFunction( ( method = value.promise ) ) ) { 9896 method.call( value ).done( resolve ).fail( reject ); 9897 9898 // Other thenables 9899 } else if ( value && isFunction( ( method = value.then ) ) ) { 9900 method.call( value, resolve, reject ); 9901 9902 // Other non-thenables 9903 } else { 9904 9905 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 9906 // * false: [ value ].slice( 0 ) => resolve( value ) 9907 // * true: [ value ].slice( 1 ) => resolve() 9908 resolve.apply( undefined, [ value ].slice( noValue ) ); 9909 } 9910 9911 // For Promises/A+, convert exceptions into rejections 9912 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 9913 // Deferred#then to conditionally suppress rejection. 9914 } catch ( value ) { 9915 9916 // Support: Android 4.0 only 9917 // Strict mode functions invoked without .call/.apply get global-object context 9918 reject.apply( undefined, [ value ] ); 9919 } 9920} 9921 9922jQuery.extend( { 9923 9924 Deferred: function( func ) { 9925 var tuples = [ 9926 9927 // action, add listener, callbacks, 9928 // ... .then handlers, argument index, [final state] 9929 [ "notify", "progress", jQuery.Callbacks( "memory" ), 9930 jQuery.Callbacks( "memory" ), 2 ], 9931 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 9932 jQuery.Callbacks( "once memory" ), 0, "resolved" ], 9933 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 9934 jQuery.Callbacks( "once memory" ), 1, "rejected" ] 9935 ], 9936 state = "pending", 9937 promise = { 9938 state: function() { 9939 return state; 9940 }, 9941 always: function() { 9942 deferred.done( arguments ).fail( arguments ); 9943 return this; 9944 }, 9945 "catch": function( fn ) { 9946 return promise.then( null, fn ); 9947 }, 9948 9949 // Keep pipe for back-compat 9950 pipe: function( /* fnDone, fnFail, fnProgress */ ) { 9951 var fns = arguments; 9952 9953 return jQuery.Deferred( function( newDefer ) { 9954 jQuery.each( tuples, function( i, tuple ) { 9955 9956 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 9957 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; 9958 9959 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 9960 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 9961 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 9962 deferred[ tuple[ 1 ] ]( function() { 9963 var returned = fn && fn.apply( this, arguments ); 9964 if ( returned && isFunction( returned.promise ) ) { 9965 returned.promise() 9966 .progress( newDefer.notify ) 9967 .done( newDefer.resolve ) 9968 .fail( newDefer.reject ); 9969 } else { 9970 newDefer[ tuple[ 0 ] + "With" ]( 9971 this, 9972 fn ? [ returned ] : arguments 9973 ); 9974 } 9975 } ); 9976 } ); 9977 fns = null; 9978 } ).promise(); 9979 }, 9980 then: function( onFulfilled, onRejected, onProgress ) { 9981 var maxDepth = 0; 9982 function resolve( depth, deferred, handler, special ) { 9983 return function() { 9984 var that = this, 9985 args = arguments, 9986 mightThrow = function() { 9987 var returned, then; 9988 9989 // Support: Promises/A+ section 2.3.3.3.3 9990 // https://promisesaplus.com/#point-59 9991 // Ignore double-resolution attempts 9992 if ( depth < maxDepth ) { 9993 return; 9994 } 9995 9996 returned = handler.apply( that, args ); 9997 9998 // Support: Promises/A+ section 2.3.1 9999 // https://promisesaplus.com/#point-48 10000 if ( returned === deferred.promise() ) { 10001 throw new TypeError( "Thenable self-resolution" ); 10002 } 10003 10004 // Support: Promises/A+ sections 2.3.3.1, 3.5 10005 // https://promisesaplus.com/#point-54 10006 // https://promisesaplus.com/#point-75 10007 // Retrieve `then` only once 10008 then = returned && 10009 10010 // Support: Promises/A+ section 2.3.4 10011 // https://promisesaplus.com/#point-64 10012 // Only check objects and functions for thenability 10013 ( typeof returned === "object" || 10014 typeof returned === "function" ) && 10015 returned.then; 10016 10017 // Handle a returned thenable 10018 if ( isFunction( then ) ) { 10019 10020 // Special processors (notify) just wait for resolution 10021 if ( special ) { 10022 then.call( 10023 returned, 10024 resolve( maxDepth, deferred, Identity, special ), 10025 resolve( maxDepth, deferred, Thrower, special ) 10026 ); 10027 10028 // Normal processors (resolve) also hook into progress 10029 } else { 10030 10031 // ...and disregard older resolution values 10032 maxDepth++; 10033 10034 then.call( 10035 returned, 10036 resolve( maxDepth, deferred, Identity, special ), 10037 resolve( maxDepth, deferred, Thrower, special ), 10038 resolve( maxDepth, deferred, Identity, 10039 deferred.notifyWith ) 10040 ); 10041 } 10042 10043 // Handle all other returned values 10044 } else { 10045 10046 // Only substitute handlers pass on context 10047 // and multiple values (non-spec behavior) 10048 if ( handler !== Identity ) { 10049 that = undefined; 10050 args = [ returned ]; 10051 } 10052 10053 // Process the value(s) 10054 // Default process is resolve 10055 ( special || deferred.resolveWith )( that, args ); 10056 } 10057 }, 10058 10059 // Only normal processors (resolve) catch and reject exceptions 10060 process = special ? 10061 mightThrow : 10062 function() { 10063 try { 10064 mightThrow(); 10065 } catch ( e ) { 10066 10067 if ( jQuery.Deferred.exceptionHook ) { 10068 jQuery.Deferred.exceptionHook( e, 10069 process.stackTrace ); 10070 } 10071 10072 // Support: Promises/A+ section 2.3.3.3.4.1 10073 // https://promisesaplus.com/#point-61 10074 // Ignore post-resolution exceptions 10075 if ( depth + 1 >= maxDepth ) { 10076 10077 // Only substitute handlers pass on context 10078 // and multiple values (non-spec behavior) 10079 if ( handler !== Thrower ) { 10080 that = undefined; 10081 args = [ e ]; 10082 } 10083 10084 deferred.rejectWith( that, args ); 10085 } 10086 } 10087 }; 10088 10089 // Support: Promises/A+ section 2.3.3.3.1 10090 // https://promisesaplus.com/#point-57 10091 // Re-resolve promises immediately to dodge false rejection from 10092 // subsequent errors 10093 if ( depth ) { 10094 process(); 10095 } else { 10096 10097 // Call an optional hook to record the stack, in case of exception 10098 // since it's otherwise lost when execution goes async 10099 if ( jQuery.Deferred.getStackHook ) { 10100 process.stackTrace = jQuery.Deferred.getStackHook(); 10101 } 10102 window.setTimeout( process ); 10103 } 10104 }; 10105 } 10106 10107 return jQuery.Deferred( function( newDefer ) { 10108 10109 // progress_handlers.add( ... ) 10110 tuples[ 0 ][ 3 ].add( 10111 resolve( 10112 0, 10113 newDefer, 10114 isFunction( onProgress ) ? 10115 onProgress : 10116 Identity, 10117 newDefer.notifyWith 10118 ) 10119 ); 10120 10121 // fulfilled_handlers.add( ... ) 10122 tuples[ 1 ][ 3 ].add( 10123 resolve( 10124 0, 10125 newDefer, 10126 isFunction( onFulfilled ) ? 10127 onFulfilled : 10128 Identity 10129 ) 10130 ); 10131 10132 // rejected_handlers.add( ... ) 10133 tuples[ 2 ][ 3 ].add( 10134 resolve( 10135 0, 10136 newDefer, 10137 isFunction( onRejected ) ? 10138 onRejected : 10139 Thrower 10140 ) 10141 ); 10142 } ).promise(); 10143 }, 10144 10145 // Get a promise for this deferred 10146 // If obj is provided, the promise aspect is added to the object 10147 promise: function( obj ) { 10148 return obj != null ? jQuery.extend( obj, promise ) : promise; 10149 } 10150 }, 10151 deferred = {}; 10152 10153 // Add list-specific methods 10154 jQuery.each( tuples, function( i, tuple ) { 10155 var list = tuple[ 2 ], 10156 stateString = tuple[ 5 ]; 10157 10158 // promise.progress = list.add 10159 // promise.done = list.add 10160 // promise.fail = list.add 10161 promise[ tuple[ 1 ] ] = list.add; 10162 10163 // Handle state 10164 if ( stateString ) { 10165 list.add( 10166 function() { 10167 10168 // state = "resolved" (i.e., fulfilled) 10169 // state = "rejected" 10170 state = stateString; 10171 }, 10172 10173 // rejected_callbacks.disable 10174 // fulfilled_callbacks.disable 10175 tuples[ 3 - i ][ 2 ].disable, 10176 10177 // rejected_handlers.disable 10178 // fulfilled_handlers.disable 10179 tuples[ 3 - i ][ 3 ].disable, 10180 10181 // progress_callbacks.lock 10182 tuples[ 0 ][ 2 ].lock, 10183 10184 // progress_handlers.lock 10185 tuples[ 0 ][ 3 ].lock 10186 ); 10187 } 10188 10189 // progress_handlers.fire 10190 // fulfilled_handlers.fire 10191 // rejected_handlers.fire 10192 list.add( tuple[ 3 ].fire ); 10193 10194 // deferred.notify = function() { deferred.notifyWith(...) } 10195 // deferred.resolve = function() { deferred.resolveWith(...) } 10196 // deferred.reject = function() { deferred.rejectWith(...) } 10197 deferred[ tuple[ 0 ] ] = function() { 10198 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); 10199 return this; 10200 }; 10201 10202 // deferred.notifyWith = list.fireWith 10203 // deferred.resolveWith = list.fireWith 10204 // deferred.rejectWith = list.fireWith 10205 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 10206 } ); 10207 10208 // Make the deferred a promise 10209 promise.promise( deferred ); 10210 10211 // Call given func if any 10212 if ( func ) { 10213 func.call( deferred, deferred ); 10214 } 10215 10216 // All done! 10217 return deferred; 10218 }, 10219 10220 // Deferred helper 10221 when: function( singleValue ) { 10222 var 10223 10224 // count of uncompleted subordinates 10225 remaining = arguments.length, 10226 10227 // count of unprocessed arguments 10228 i = remaining, 10229 10230 // subordinate fulfillment data 10231 resolveContexts = Array( i ), 10232 resolveValues = slice.call( arguments ), 10233 10234 // the master Deferred 10235 master = jQuery.Deferred(), 10236 10237 // subordinate callback factory 10238 updateFunc = function( i ) { 10239 return function( value ) { 10240 resolveContexts[ i ] = this; 10241 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 10242 if ( !( --remaining ) ) { 10243 master.resolveWith( resolveContexts, resolveValues ); 10244 } 10245 }; 10246 }; 10247 10248 // Single- and empty arguments are adopted like Promise.resolve 10249 if ( remaining <= 1 ) { 10250 adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, 10251 !remaining ); 10252 10253 // Use .then() to unwrap secondary thenables (cf. gh-3000) 10254 if ( master.state() === "pending" || 10255 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { 10256 10257 return master.then(); 10258 } 10259 } 10260 10261 // Multiple arguments are aggregated like Promise.all array elements 10262 while ( i-- ) { 10263 adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); 10264 } 10265 10266 return master.promise(); 10267 } 10268} ); 10269 10270 10271// These usually indicate a programmer mistake during development, 10272// warn about them ASAP rather than swallowing them by default. 10273var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 10274 10275jQuery.Deferred.exceptionHook = function( error, stack ) { 10276 10277 // Support: IE 8 - 9 only 10278 // Console exists when dev tools are open, which can happen at any time 10279 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 10280 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); 10281 } 10282}; 10283 10284 10285 10286 10287jQuery.readyException = function( error ) { 10288 window.setTimeout( function() { 10289 throw error; 10290 } ); 10291}; 10292 10293 10294 10295 10296// The deferred used on DOM ready 10297var readyList = jQuery.Deferred(); 10298 10299jQuery.fn.ready = function( fn ) { 10300 10301 readyList 10302 .then( fn ) 10303 10304 // Wrap jQuery.readyException in a function so that the lookup 10305 // happens at the time of error handling instead of callback 10306 // registration. 10307 .catch( function( error ) { 10308 jQuery.readyException( error ); 10309 } ); 10310 10311 return this; 10312}; 10313 10314jQuery.extend( { 10315 10316 // Is the DOM ready to be used? Set to true once it occurs. 10317 isReady: false, 10318 10319 // A counter to track how many items to wait for before 10320 // the ready event fires. See #6781 10321 readyWait: 1, 10322 10323 // Handle when the DOM is ready 10324 ready: function( wait ) { 10325 10326 // Abort if there are pending holds or we're already ready 10327 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 10328 return; 10329 } 10330 10331 // Remember that the DOM is ready 10332 jQuery.isReady = true; 10333 10334 // If a normal DOM Ready event fired, decrement, and wait if need be 10335 if ( wait !== true && --jQuery.readyWait > 0 ) { 10336 return; 10337 } 10338 10339 // If there are functions bound, to execute 10340 readyList.resolveWith( document, [ jQuery ] ); 10341 } 10342} ); 10343 10344jQuery.ready.then = readyList.then; 10345 10346// The ready event handler and self cleanup method 10347function completed() { 10348 document.removeEventListener( "DOMContentLoaded", completed ); 10349 window.removeEventListener( "load", completed ); 10350 jQuery.ready(); 10351} 10352 10353// Catch cases where $(document).ready() is called 10354// after the browser event has already occurred. 10355// Support: IE <=9 - 10 only 10356// Older IE sometimes signals "interactive" too soon 10357if ( document.readyState === "complete" || 10358 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 10359 10360 // Handle it asynchronously to allow scripts the opportunity to delay ready 10361 window.setTimeout( jQuery.ready ); 10362 10363} else { 10364 10365 // Use the handy event callback 10366 document.addEventListener( "DOMContentLoaded", completed ); 10367 10368 // A fallback to window.onload, that will always work 10369 window.addEventListener( "load", completed ); 10370} 10371 10372 10373 10374 10375// Multifunctional method to get and set values of a collection 10376// The value/s can optionally be executed if it's a function 10377var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 10378 var i = 0, 10379 len = elems.length, 10380 bulk = key == null; 10381 10382 // Sets many values 10383 if ( toType( key ) === "object" ) { 10384 chainable = true; 10385 for ( i in key ) { 10386 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 10387 } 10388 10389 // Sets one value 10390 } else if ( value !== undefined ) { 10391 chainable = true; 10392 10393 if ( !isFunction( value ) ) { 10394 raw = true; 10395 } 10396 10397 if ( bulk ) { 10398 10399 // Bulk operations run against the entire set 10400 if ( raw ) { 10401 fn.call( elems, value ); 10402 fn = null; 10403 10404 // ...except when executing function values 10405 } else { 10406 bulk = fn; 10407 fn = function( elem, key, value ) { 10408 return bulk.call( jQuery( elem ), value ); 10409 }; 10410 } 10411 } 10412 10413 if ( fn ) { 10414 for ( ; i < len; i++ ) { 10415 fn( 10416 elems[ i ], key, raw ? 10417 value : 10418 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 10419 ); 10420 } 10421 } 10422 } 10423 10424 if ( chainable ) { 10425 return elems; 10426 } 10427 10428 // Gets 10429 if ( bulk ) { 10430 return fn.call( elems ); 10431 } 10432 10433 return len ? fn( elems[ 0 ], key ) : emptyGet; 10434}; 10435 10436 10437// Matches dashed string for camelizing 10438var rmsPrefix = /^-ms-/, 10439 rdashAlpha = /-([a-z])/g; 10440 10441// Used by camelCase as callback to replace() 10442function fcamelCase( all, letter ) { 10443 return letter.toUpperCase(); 10444} 10445 10446// Convert dashed to camelCase; used by the css and data modules 10447// Support: IE <=9 - 11, Edge 12 - 15 10448// Microsoft forgot to hump their vendor prefix (#9572) 10449function camelCase( string ) { 10450 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 10451} 10452var acceptData = function( owner ) { 10453 10454 // Accepts only: 10455 // - Node 10456 // - Node.ELEMENT_NODE 10457 // - Node.DOCUMENT_NODE 10458 // - Object 10459 // - Any 10460 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 10461}; 10462 10463 10464 10465 10466function Data() { 10467 this.expando = jQuery.expando + Data.uid++; 10468} 10469 10470Data.uid = 1; 10471 10472Data.prototype = { 10473 10474 cache: function( owner ) { 10475 10476 // Check if the owner object already has a cache 10477 var value = owner[ this.expando ]; 10478 10479 // If not, create one 10480 if ( !value ) { 10481 value = {}; 10482 10483 // We can accept data for non-element nodes in modern browsers, 10484 // but we should not, see #8335. 10485 // Always return an empty object. 10486 if ( acceptData( owner ) ) { 10487 10488 // If it is a node unlikely to be stringify-ed or looped over 10489 // use plain assignment 10490 if ( owner.nodeType ) { 10491 owner[ this.expando ] = value; 10492 10493 // Otherwise secure it in a non-enumerable property 10494 // configurable must be true to allow the property to be 10495 // deleted when data is removed 10496 } else { 10497 Object.defineProperty( owner, this.expando, { 10498 value: value, 10499 configurable: true 10500 } ); 10501 } 10502 } 10503 } 10504 10505 return value; 10506 }, 10507 set: function( owner, data, value ) { 10508 var prop, 10509 cache = this.cache( owner ); 10510 10511 // Handle: [ owner, key, value ] args 10512 // Always use camelCase key (gh-2257) 10513 if ( typeof data === "string" ) { 10514 cache[ camelCase( data ) ] = value; 10515 10516 // Handle: [ owner, { properties } ] args 10517 } else { 10518 10519 // Copy the properties one-by-one to the cache object 10520 for ( prop in data ) { 10521 cache[ camelCase( prop ) ] = data[ prop ]; 10522 } 10523 } 10524 return cache; 10525 }, 10526 get: function( owner, key ) { 10527 return key === undefined ? 10528 this.cache( owner ) : 10529 10530 // Always use camelCase key (gh-2257) 10531 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; 10532 }, 10533 access: function( owner, key, value ) { 10534 10535 // In cases where either: 10536 // 10537 // 1. No key was specified 10538 // 2. A string key was specified, but no value provided 10539 // 10540 // Take the "read" path and allow the get method to determine 10541 // which value to return, respectively either: 10542 // 10543 // 1. The entire cache object 10544 // 2. The data stored at the key 10545 // 10546 if ( key === undefined || 10547 ( ( key && typeof key === "string" ) && value === undefined ) ) { 10548 10549 return this.get( owner, key ); 10550 } 10551 10552 // When the key is not a string, or both a key and value 10553 // are specified, set or extend (existing objects) with either: 10554 // 10555 // 1. An object of properties 10556 // 2. A key and value 10557 // 10558 this.set( owner, key, value ); 10559 10560 // Since the "set" path can have two possible entry points 10561 // return the expected data based on which path was taken[*] 10562 return value !== undefined ? value : key; 10563 }, 10564 remove: function( owner, key ) { 10565 var i, 10566 cache = owner[ this.expando ]; 10567 10568 if ( cache === undefined ) { 10569 return; 10570 } 10571 10572 if ( key !== undefined ) { 10573 10574 // Support array or space separated string of keys 10575 if ( Array.isArray( key ) ) { 10576 10577 // If key is an array of keys... 10578 // We always set camelCase keys, so remove that. 10579 key = key.map( camelCase ); 10580 } else { 10581 key = camelCase( key ); 10582 10583 // If a key with the spaces exists, use it. 10584 // Otherwise, create an array by matching non-whitespace 10585 key = key in cache ? 10586 [ key ] : 10587 ( key.match( rnothtmlwhite ) || [] ); 10588 } 10589 10590 i = key.length; 10591 10592 while ( i-- ) { 10593 delete cache[ key[ i ] ]; 10594 } 10595 } 10596 10597 // Remove the expando if there's no more data 10598 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 10599 10600 // Support: Chrome <=35 - 45 10601 // Webkit & Blink performance suffers when deleting properties 10602 // from DOM nodes, so set to undefined instead 10603 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 10604 if ( owner.nodeType ) { 10605 owner[ this.expando ] = undefined; 10606 } else { 10607 delete owner[ this.expando ]; 10608 } 10609 } 10610 }, 10611 hasData: function( owner ) { 10612 var cache = owner[ this.expando ]; 10613 return cache !== undefined && !jQuery.isEmptyObject( cache ); 10614 } 10615}; 10616var dataPriv = new Data(); 10617 10618var dataUser = new Data(); 10619 10620 10621 10622// Implementation Summary 10623// 10624// 1. Enforce API surface and semantic compatibility with 1.9.x branch 10625// 2. Improve the module's maintainability by reducing the storage 10626// paths to a single mechanism. 10627// 3. Use the same single mechanism to support "private" and "user" data. 10628// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 10629// 5. Avoid exposing implementation details on user objects (eg. expando properties) 10630// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 10631 10632var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 10633 rmultiDash = /[A-Z]/g; 10634 10635function getData( data ) { 10636 if ( data === "true" ) { 10637 return true; 10638 } 10639 10640 if ( data === "false" ) { 10641 return false; 10642 } 10643 10644 if ( data === "null" ) { 10645 return null; 10646 } 10647 10648 // Only convert to a number if it doesn't change the string 10649 if ( data === +data + "" ) { 10650 return +data; 10651 } 10652 10653 if ( rbrace.test( data ) ) { 10654 return JSON.parse( data ); 10655 } 10656 10657 return data; 10658} 10659 10660function dataAttr( elem, key, data ) { 10661 var name; 10662 10663 // If nothing was found internally, try to fetch any 10664 // data from the HTML5 data-* attribute 10665 if ( data === undefined && elem.nodeType === 1 ) { 10666 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 10667 data = elem.getAttribute( name ); 10668 10669 if ( typeof data === "string" ) { 10670 try { 10671 data = getData( data ); 10672 } catch ( e ) {} 10673 10674 // Make sure we set the data so it isn't changed later 10675 dataUser.set( elem, key, data ); 10676 } else { 10677 data = undefined; 10678 } 10679 } 10680 return data; 10681} 10682 10683jQuery.extend( { 10684 hasData: function( elem ) { 10685 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 10686 }, 10687 10688 data: function( elem, name, data ) { 10689 return dataUser.access( elem, name, data ); 10690 }, 10691 10692 removeData: function( elem, name ) { 10693 dataUser.remove( elem, name ); 10694 }, 10695 10696 // TODO: Now that all calls to _data and _removeData have been replaced 10697 // with direct calls to dataPriv methods, these can be deprecated. 10698 _data: function( elem, name, data ) { 10699 return dataPriv.access( elem, name, data ); 10700 }, 10701 10702 _removeData: function( elem, name ) { 10703 dataPriv.remove( elem, name ); 10704 } 10705} ); 10706 10707jQuery.fn.extend( { 10708 data: function( key, value ) { 10709 var i, name, data, 10710 elem = this[ 0 ], 10711 attrs = elem && elem.attributes; 10712 10713 // Gets all values 10714 if ( key === undefined ) { 10715 if ( this.length ) { 10716 data = dataUser.get( elem ); 10717 10718 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 10719 i = attrs.length; 10720 while ( i-- ) { 10721 10722 // Support: IE 11 only 10723 // The attrs elements can be null (#14894) 10724 if ( attrs[ i ] ) { 10725 name = attrs[ i ].name; 10726 if ( name.indexOf( "data-" ) === 0 ) { 10727 name = camelCase( name.slice( 5 ) ); 10728 dataAttr( elem, name, data[ name ] ); 10729 } 10730 } 10731 } 10732 dataPriv.set( elem, "hasDataAttrs", true ); 10733 } 10734 } 10735 10736 return data; 10737 } 10738 10739 // Sets multiple values 10740 if ( typeof key === "object" ) { 10741 return this.each( function() { 10742 dataUser.set( this, key ); 10743 } ); 10744 } 10745 10746 return access( this, function( value ) { 10747 var data; 10748 10749 // The calling jQuery object (element matches) is not empty 10750 // (and therefore has an element appears at this[ 0 ]) and the 10751 // `value` parameter was not undefined. An empty jQuery object 10752 // will result in `undefined` for elem = this[ 0 ] which will 10753 // throw an exception if an attempt to read a data cache is made. 10754 if ( elem && value === undefined ) { 10755 10756 // Attempt to get data from the cache 10757 // The key will always be camelCased in Data 10758 data = dataUser.get( elem, key ); 10759 if ( data !== undefined ) { 10760 return data; 10761 } 10762 10763 // Attempt to "discover" the data in 10764 // HTML5 custom data-* attrs 10765 data = dataAttr( elem, key ); 10766 if ( data !== undefined ) { 10767 return data; 10768 } 10769 10770 // We tried really hard, but the data doesn't exist. 10771 return; 10772 } 10773 10774 // Set the data... 10775 this.each( function() { 10776 10777 // We always store the camelCased key 10778 dataUser.set( this, key, value ); 10779 } ); 10780 }, null, value, arguments.length > 1, null, true ); 10781 }, 10782 10783 removeData: function( key ) { 10784 return this.each( function() { 10785 dataUser.remove( this, key ); 10786 } ); 10787 } 10788} ); 10789 10790 10791jQuery.extend( { 10792 queue: function( elem, type, data ) { 10793 var queue; 10794 10795 if ( elem ) { 10796 type = ( type || "fx" ) + "queue"; 10797 queue = dataPriv.get( elem, type ); 10798 10799 // Speed up dequeue by getting out quickly if this is just a lookup 10800 if ( data ) { 10801 if ( !queue || Array.isArray( data ) ) { 10802 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 10803 } else { 10804 queue.push( data ); 10805 } 10806 } 10807 return queue || []; 10808 } 10809 }, 10810 10811 dequeue: function( elem, type ) { 10812 type = type || "fx"; 10813 10814 var queue = jQuery.queue( elem, type ), 10815 startLength = queue.length, 10816 fn = queue.shift(), 10817 hooks = jQuery._queueHooks( elem, type ), 10818 next = function() { 10819 jQuery.dequeue( elem, type ); 10820 }; 10821 10822 // If the fx queue is dequeued, always remove the progress sentinel 10823 if ( fn === "inprogress" ) { 10824 fn = queue.shift(); 10825 startLength--; 10826 } 10827 10828 if ( fn ) { 10829 10830 // Add a progress sentinel to prevent the fx queue from being 10831 // automatically dequeued 10832 if ( type === "fx" ) { 10833 queue.unshift( "inprogress" ); 10834 } 10835 10836 // Clear up the last queue stop function 10837 delete hooks.stop; 10838 fn.call( elem, next, hooks ); 10839 } 10840 10841 if ( !startLength && hooks ) { 10842 hooks.empty.fire(); 10843 } 10844 }, 10845 10846 // Not public - generate a queueHooks object, or return the current one 10847 _queueHooks: function( elem, type ) { 10848 var key = type + "queueHooks"; 10849 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 10850 empty: jQuery.Callbacks( "once memory" ).add( function() { 10851 dataPriv.remove( elem, [ type + "queue", key ] ); 10852 } ) 10853 } ); 10854 } 10855} ); 10856 10857jQuery.fn.extend( { 10858 queue: function( type, data ) { 10859 var setter = 2; 10860 10861 if ( typeof type !== "string" ) { 10862 data = type; 10863 type = "fx"; 10864 setter--; 10865 } 10866 10867 if ( arguments.length < setter ) { 10868 return jQuery.queue( this[ 0 ], type ); 10869 } 10870 10871 return data === undefined ? 10872 this : 10873 this.each( function() { 10874 var queue = jQuery.queue( this, type, data ); 10875 10876 // Ensure a hooks for this queue 10877 jQuery._queueHooks( this, type ); 10878 10879 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 10880 jQuery.dequeue( this, type ); 10881 } 10882 } ); 10883 }, 10884 dequeue: function( type ) { 10885 return this.each( function() { 10886 jQuery.dequeue( this, type ); 10887 } ); 10888 }, 10889 clearQueue: function( type ) { 10890 return this.queue( type || "fx", [] ); 10891 }, 10892 10893 // Get a promise resolved when queues of a certain type 10894 // are emptied (fx is the type by default) 10895 promise: function( type, obj ) { 10896 var tmp, 10897 count = 1, 10898 defer = jQuery.Deferred(), 10899 elements = this, 10900 i = this.length, 10901 resolve = function() { 10902 if ( !( --count ) ) { 10903 defer.resolveWith( elements, [ elements ] ); 10904 } 10905 }; 10906 10907 if ( typeof type !== "string" ) { 10908 obj = type; 10909 type = undefined; 10910 } 10911 type = type || "fx"; 10912 10913 while ( i-- ) { 10914 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 10915 if ( tmp && tmp.empty ) { 10916 count++; 10917 tmp.empty.add( resolve ); 10918 } 10919 } 10920 resolve(); 10921 return defer.promise( obj ); 10922 } 10923} ); 10924var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 10925 10926var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 10927 10928 10929var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 10930 10931var documentElement = document.documentElement; 10932 10933 10934 10935 var isAttached = function( elem ) { 10936 return jQuery.contains( elem.ownerDocument, elem ); 10937 }, 10938 composed = { composed: true }; 10939 10940 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only 10941 // Check attachment across shadow DOM boundaries when possible (gh-3504) 10942 // Support: iOS 10.0-10.2 only 10943 // Early iOS 10 versions support `attachShadow` but not `getRootNode`, 10944 // leading to errors. We need to check for `getRootNode`. 10945 if ( documentElement.getRootNode ) { 10946 isAttached = function( elem ) { 10947 return jQuery.contains( elem.ownerDocument, elem ) || 10948 elem.getRootNode( composed ) === elem.ownerDocument; 10949 }; 10950 } 10951var isHiddenWithinTree = function( elem, el ) { 10952 10953 // isHiddenWithinTree might be called from jQuery#filter function; 10954 // in that case, element will be second argument 10955 elem = el || elem; 10956 10957 // Inline style trumps all 10958 return elem.style.display === "none" || 10959 elem.style.display === "" && 10960 10961 // Otherwise, check computed style 10962 // Support: Firefox <=43 - 45 10963 // Disconnected elements can have computed display: none, so first confirm that elem is 10964 // in the document. 10965 isAttached( elem ) && 10966 10967 jQuery.css( elem, "display" ) === "none"; 10968 }; 10969 10970var swap = function( elem, options, callback, args ) { 10971 var ret, name, 10972 old = {}; 10973 10974 // Remember the old values, and insert the new ones 10975 for ( name in options ) { 10976 old[ name ] = elem.style[ name ]; 10977 elem.style[ name ] = options[ name ]; 10978 } 10979 10980 ret = callback.apply( elem, args || [] ); 10981 10982 // Revert the old values 10983 for ( name in options ) { 10984 elem.style[ name ] = old[ name ]; 10985 } 10986 10987 return ret; 10988}; 10989 10990 10991 10992 10993function adjustCSS( elem, prop, valueParts, tween ) { 10994 var adjusted, scale, 10995 maxIterations = 20, 10996 currentValue = tween ? 10997 function() { 10998 return tween.cur(); 10999 } : 11000 function() { 11001 return jQuery.css( elem, prop, "" ); 11002 }, 11003 initial = currentValue(), 11004 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 11005 11006 // Starting value computation is required for potential unit mismatches 11007 initialInUnit = elem.nodeType && 11008 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 11009 rcssNum.exec( jQuery.css( elem, prop ) ); 11010 11011 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 11012 11013 // Support: Firefox <=54 11014 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 11015 initial = initial / 2; 11016 11017 // Trust units reported by jQuery.css 11018 unit = unit || initialInUnit[ 3 ]; 11019 11020 // Iteratively approximate from a nonzero starting point 11021 initialInUnit = +initial || 1; 11022 11023 while ( maxIterations-- ) { 11024 11025 // Evaluate and update our best guess (doubling guesses that zero out). 11026 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 11027 jQuery.style( elem, prop, initialInUnit + unit ); 11028 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { 11029 maxIterations = 0; 11030 } 11031 initialInUnit = initialInUnit / scale; 11032 11033 } 11034 11035 initialInUnit = initialInUnit * 2; 11036 jQuery.style( elem, prop, initialInUnit + unit ); 11037 11038 // Make sure we update the tween properties later on 11039 valueParts = valueParts || []; 11040 } 11041 11042 if ( valueParts ) { 11043 initialInUnit = +initialInUnit || +initial || 0; 11044 11045 // Apply relative offset (+=/-=) if specified 11046 adjusted = valueParts[ 1 ] ? 11047 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 11048 +valueParts[ 2 ]; 11049 if ( tween ) { 11050 tween.unit = unit; 11051 tween.start = initialInUnit; 11052 tween.end = adjusted; 11053 } 11054 } 11055 return adjusted; 11056} 11057 11058 11059var defaultDisplayMap = {}; 11060 11061function getDefaultDisplay( elem ) { 11062 var temp, 11063 doc = elem.ownerDocument, 11064 nodeName = elem.nodeName, 11065 display = defaultDisplayMap[ nodeName ]; 11066 11067 if ( display ) { 11068 return display; 11069 } 11070 11071 temp = doc.body.appendChild( doc.createElement( nodeName ) ); 11072 display = jQuery.css( temp, "display" ); 11073 11074 temp.parentNode.removeChild( temp ); 11075 11076 if ( display === "none" ) { 11077 display = "block"; 11078 } 11079 defaultDisplayMap[ nodeName ] = display; 11080 11081 return display; 11082} 11083 11084function showHide( elements, show ) { 11085 var display, elem, 11086 values = [], 11087 index = 0, 11088 length = elements.length; 11089 11090 // Determine new display value for elements that need to change 11091 for ( ; index < length; index++ ) { 11092 elem = elements[ index ]; 11093 if ( !elem.style ) { 11094 continue; 11095 } 11096 11097 display = elem.style.display; 11098 if ( show ) { 11099 11100 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 11101 // check is required in this first loop unless we have a nonempty display value (either 11102 // inline or about-to-be-restored) 11103 if ( display === "none" ) { 11104 values[ index ] = dataPriv.get( elem, "display" ) || null; 11105 if ( !values[ index ] ) { 11106 elem.style.display = ""; 11107 } 11108 } 11109 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { 11110 values[ index ] = getDefaultDisplay( elem ); 11111 } 11112 } else { 11113 if ( display !== "none" ) { 11114 values[ index ] = "none"; 11115 11116 // Remember what we're overwriting 11117 dataPriv.set( elem, "display", display ); 11118 } 11119 } 11120 } 11121 11122 // Set the display of the elements in a second loop to avoid constant reflow 11123 for ( index = 0; index < length; index++ ) { 11124 if ( values[ index ] != null ) { 11125 elements[ index ].style.display = values[ index ]; 11126 } 11127 } 11128 11129 return elements; 11130} 11131 11132jQuery.fn.extend( { 11133 show: function() { 11134 return showHide( this, true ); 11135 }, 11136 hide: function() { 11137 return showHide( this ); 11138 }, 11139 toggle: function( state ) { 11140 if ( typeof state === "boolean" ) { 11141 return state ? this.show() : this.hide(); 11142 } 11143 11144 return this.each( function() { 11145 if ( isHiddenWithinTree( this ) ) { 11146 jQuery( this ).show(); 11147 } else { 11148 jQuery( this ).hide(); 11149 } 11150 } ); 11151 } 11152} ); 11153var rcheckableType = ( /^(?:checkbox|radio)$/i ); 11154 11155var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); 11156 11157var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); 11158 11159 11160 11161// We have to close these tags to support XHTML (#13200) 11162var wrapMap = { 11163 11164 // Support: IE <=9 only 11165 option: [ 1, "<select multiple='multiple'>", "</select>" ], 11166 11167 // XHTML parsers do not magically insert elements in the 11168 // same way that tag soup parsers do. So we cannot shorten 11169 // this by omitting <tbody> or other required elements. 11170 thead: [ 1, "<table>", "</table>" ], 11171 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 11172 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 11173 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 11174 11175 _default: [ 0, "", "" ] 11176}; 11177 11178// Support: IE <=9 only 11179wrapMap.optgroup = wrapMap.option; 11180 11181wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 11182wrapMap.th = wrapMap.td; 11183 11184 11185function getAll( context, tag ) { 11186 11187 // Support: IE <=9 - 11 only 11188 // Use typeof to avoid zero-argument method invocation on host objects (#15151) 11189 var ret; 11190 11191 if ( typeof context.getElementsByTagName !== "undefined" ) { 11192 ret = context.getElementsByTagName( tag || "*" ); 11193 11194 } else if ( typeof context.querySelectorAll !== "undefined" ) { 11195 ret = context.querySelectorAll( tag || "*" ); 11196 11197 } else { 11198 ret = []; 11199 } 11200 11201 if ( tag === undefined || tag && nodeName( context, tag ) ) { 11202 return jQuery.merge( [ context ], ret ); 11203 } 11204 11205 return ret; 11206} 11207 11208 11209// Mark scripts as having already been evaluated 11210function setGlobalEval( elems, refElements ) { 11211 var i = 0, 11212 l = elems.length; 11213 11214 for ( ; i < l; i++ ) { 11215 dataPriv.set( 11216 elems[ i ], 11217 "globalEval", 11218 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 11219 ); 11220 } 11221} 11222 11223 11224var rhtml = /<|&#?\w+;/; 11225 11226function buildFragment( elems, context, scripts, selection, ignored ) { 11227 var elem, tmp, tag, wrap, attached, j, 11228 fragment = context.createDocumentFragment(), 11229 nodes = [], 11230 i = 0, 11231 l = elems.length; 11232 11233 for ( ; i < l; i++ ) { 11234 elem = elems[ i ]; 11235 11236 if ( elem || elem === 0 ) { 11237 11238 // Add nodes directly 11239 if ( toType( elem ) === "object" ) { 11240 11241 // Support: Android <=4.0 only, PhantomJS 1 only 11242 // push.apply(_, arraylike) throws on ancient WebKit 11243 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 11244 11245 // Convert non-html into a text node 11246 } else if ( !rhtml.test( elem ) ) { 11247 nodes.push( context.createTextNode( elem ) ); 11248 11249 // Convert html into DOM nodes 11250 } else { 11251 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 11252 11253 // Deserialize a standard representation 11254 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 11255 wrap = wrapMap[ tag ] || wrapMap._default; 11256 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 11257 11258 // Descend through wrappers to the right content 11259 j = wrap[ 0 ]; 11260 while ( j-- ) { 11261 tmp = tmp.lastChild; 11262 } 11263 11264 // Support: Android <=4.0 only, PhantomJS 1 only 11265 // push.apply(_, arraylike) throws on ancient WebKit 11266 jQuery.merge( nodes, tmp.childNodes ); 11267 11268 // Remember the top-level container 11269 tmp = fragment.firstChild; 11270 11271 // Ensure the created nodes are orphaned (#12392) 11272 tmp.textContent = ""; 11273 } 11274 } 11275 } 11276 11277 // Remove wrapper from fragment 11278 fragment.textContent = ""; 11279 11280 i = 0; 11281 while ( ( elem = nodes[ i++ ] ) ) { 11282 11283 // Skip elements already in the context collection (trac-4087) 11284 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 11285 if ( ignored ) { 11286 ignored.push( elem ); 11287 } 11288 continue; 11289 } 11290 11291 attached = isAttached( elem ); 11292 11293 // Append to fragment 11294 tmp = getAll( fragment.appendChild( elem ), "script" ); 11295 11296 // Preserve script evaluation history 11297 if ( attached ) { 11298 setGlobalEval( tmp ); 11299 } 11300 11301 // Capture executables 11302 if ( scripts ) { 11303 j = 0; 11304 while ( ( elem = tmp[ j++ ] ) ) { 11305 if ( rscriptType.test( elem.type || "" ) ) { 11306 scripts.push( elem ); 11307 } 11308 } 11309 } 11310 } 11311 11312 return fragment; 11313} 11314 11315 11316( function() { 11317 var fragment = document.createDocumentFragment(), 11318 div = fragment.appendChild( document.createElement( "div" ) ), 11319 input = document.createElement( "input" ); 11320 11321 // Support: Android 4.0 - 4.3 only 11322 // Check state lost if the name is set (#11217) 11323 // Support: Windows Web Apps (WWA) 11324 // `name` and `type` must use .setAttribute for WWA (#14901) 11325 input.setAttribute( "type", "radio" ); 11326 input.setAttribute( "checked", "checked" ); 11327 input.setAttribute( "name", "t" ); 11328 11329 div.appendChild( input ); 11330 11331 // Support: Android <=4.1 only 11332 // Older WebKit doesn't clone checked state correctly in fragments 11333 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 11334 11335 // Support: IE <=11 only 11336 // Make sure textarea (and checkbox) defaultValue is properly cloned 11337 div.innerHTML = "<textarea>x</textarea>"; 11338 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 11339} )(); 11340 11341 11342var 11343 rkeyEvent = /^key/, 11344 rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, 11345 rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 11346 11347function returnTrue() { 11348 return true; 11349} 11350 11351function returnFalse() { 11352 return false; 11353} 11354 11355// Support: IE <=9 - 11+ 11356// focus() and blur() are asynchronous, except when they are no-op. 11357// So expect focus to be synchronous when the element is already active, 11358// and blur to be synchronous when the element is not already active. 11359// (focus and blur are always synchronous in other supported browsers, 11360// this just defines when we can count on it). 11361function expectSync( elem, type ) { 11362 return ( elem === safeActiveElement() ) === ( type === "focus" ); 11363} 11364 11365// Support: IE <=9 only 11366// Accessing document.activeElement can throw unexpectedly 11367// https://bugs.jquery.com/ticket/13393 11368function safeActiveElement() { 11369 try { 11370 return document.activeElement; 11371 } catch ( err ) { } 11372} 11373 11374function on( elem, types, selector, data, fn, one ) { 11375 var origFn, type; 11376 11377 // Types can be a map of types/handlers 11378 if ( typeof types === "object" ) { 11379 11380 // ( types-Object, selector, data ) 11381 if ( typeof selector !== "string" ) { 11382 11383 // ( types-Object, data ) 11384 data = data || selector; 11385 selector = undefined; 11386 } 11387 for ( type in types ) { 11388 on( elem, type, selector, data, types[ type ], one ); 11389 } 11390 return elem; 11391 } 11392 11393 if ( data == null && fn == null ) { 11394 11395 // ( types, fn ) 11396 fn = selector; 11397 data = selector = undefined; 11398 } else if ( fn == null ) { 11399 if ( typeof selector === "string" ) { 11400 11401 // ( types, selector, fn ) 11402 fn = data; 11403 data = undefined; 11404 } else { 11405 11406 // ( types, data, fn ) 11407 fn = data; 11408 data = selector; 11409 selector = undefined; 11410 } 11411 } 11412 if ( fn === false ) { 11413 fn = returnFalse; 11414 } else if ( !fn ) { 11415 return elem; 11416 } 11417 11418 if ( one === 1 ) { 11419 origFn = fn; 11420 fn = function( event ) { 11421 11422 // Can use an empty set, since event contains the info 11423 jQuery().off( event ); 11424 return origFn.apply( this, arguments ); 11425 }; 11426 11427 // Use same guid so caller can remove using origFn 11428 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 11429 } 11430 return elem.each( function() { 11431 jQuery.event.add( this, types, fn, data, selector ); 11432 } ); 11433} 11434 11435/* 11436 * Helper functions for managing events -- not part of the public interface. 11437 * Props to Dean Edwards' addEvent library for many of the ideas. 11438 */ 11439jQuery.event = { 11440 11441 global: {}, 11442 11443 add: function( elem, types, handler, data, selector ) { 11444 11445 var handleObjIn, eventHandle, tmp, 11446 events, t, handleObj, 11447 special, handlers, type, namespaces, origType, 11448 elemData = dataPriv.get( elem ); 11449 11450 // Don't attach events to noData or text/comment nodes (but allow plain objects) 11451 if ( !elemData ) { 11452 return; 11453 } 11454 11455 // Caller can pass in an object of custom data in lieu of the handler 11456 if ( handler.handler ) { 11457 handleObjIn = handler; 11458 handler = handleObjIn.handler; 11459 selector = handleObjIn.selector; 11460 } 11461 11462 // Ensure that invalid selectors throw exceptions at attach time 11463 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 11464 if ( selector ) { 11465 jQuery.find.matchesSelector( documentElement, selector ); 11466 } 11467 11468 // Make sure that the handler has a unique ID, used to find/remove it later 11469 if ( !handler.guid ) { 11470 handler.guid = jQuery.guid++; 11471 } 11472 11473 // Init the element's event structure and main handler, if this is the first 11474 if ( !( events = elemData.events ) ) { 11475 events = elemData.events = {}; 11476 } 11477 if ( !( eventHandle = elemData.handle ) ) { 11478 eventHandle = elemData.handle = function( e ) { 11479 11480 // Discard the second event of a jQuery.event.trigger() and 11481 // when an event is called after a page has unloaded 11482 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 11483 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 11484 }; 11485 } 11486 11487 // Handle multiple events separated by a space 11488 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 11489 t = types.length; 11490 while ( t-- ) { 11491 tmp = rtypenamespace.exec( types[ t ] ) || []; 11492 type = origType = tmp[ 1 ]; 11493 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 11494 11495 // There *must* be a type, no attaching namespace-only handlers 11496 if ( !type ) { 11497 continue; 11498 } 11499 11500 // If event changes its type, use the special event handlers for the changed type 11501 special = jQuery.event.special[ type ] || {}; 11502 11503 // If selector defined, determine special event api type, otherwise given type 11504 type = ( selector ? special.delegateType : special.bindType ) || type; 11505 11506 // Update special based on newly reset type 11507 special = jQuery.event.special[ type ] || {}; 11508 11509 // handleObj is passed to all event handlers 11510 handleObj = jQuery.extend( { 11511 type: type, 11512 origType: origType, 11513 data: data, 11514 handler: handler, 11515 guid: handler.guid, 11516 selector: selector, 11517 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 11518 namespace: namespaces.join( "." ) 11519 }, handleObjIn ); 11520 11521 // Init the event handler queue if we're the first 11522 if ( !( handlers = events[ type ] ) ) { 11523 handlers = events[ type ] = []; 11524 handlers.delegateCount = 0; 11525 11526 // Only use addEventListener if the special events handler returns false 11527 if ( !special.setup || 11528 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 11529 11530 if ( elem.addEventListener ) { 11531 elem.addEventListener( type, eventHandle ); 11532 } 11533 } 11534 } 11535 11536 if ( special.add ) { 11537 special.add.call( elem, handleObj ); 11538 11539 if ( !handleObj.handler.guid ) { 11540 handleObj.handler.guid = handler.guid; 11541 } 11542 } 11543 11544 // Add to the element's handler list, delegates in front 11545 if ( selector ) { 11546 handlers.splice( handlers.delegateCount++, 0, handleObj ); 11547 } else { 11548 handlers.push( handleObj ); 11549 } 11550 11551 // Keep track of which events have ever been used, for event optimization 11552 jQuery.event.global[ type ] = true; 11553 } 11554 11555 }, 11556 11557 // Detach an event or set of events from an element 11558 remove: function( elem, types, handler, selector, mappedTypes ) { 11559 11560 var j, origCount, tmp, 11561 events, t, handleObj, 11562 special, handlers, type, namespaces, origType, 11563 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 11564 11565 if ( !elemData || !( events = elemData.events ) ) { 11566 return; 11567 } 11568 11569 // Once for each type.namespace in types; type may be omitted 11570 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 11571 t = types.length; 11572 while ( t-- ) { 11573 tmp = rtypenamespace.exec( types[ t ] ) || []; 11574 type = origType = tmp[ 1 ]; 11575 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 11576 11577 // Unbind all events (on this namespace, if provided) for the element 11578 if ( !type ) { 11579 for ( type in events ) { 11580 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 11581 } 11582 continue; 11583 } 11584 11585 special = jQuery.event.special[ type ] || {}; 11586 type = ( selector ? special.delegateType : special.bindType ) || type; 11587 handlers = events[ type ] || []; 11588 tmp = tmp[ 2 ] && 11589 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 11590 11591 // Remove matching events 11592 origCount = j = handlers.length; 11593 while ( j-- ) { 11594 handleObj = handlers[ j ]; 11595 11596 if ( ( mappedTypes || origType === handleObj.origType ) && 11597 ( !handler || handler.guid === handleObj.guid ) && 11598 ( !tmp || tmp.test( handleObj.namespace ) ) && 11599 ( !selector || selector === handleObj.selector || 11600 selector === "**" && handleObj.selector ) ) { 11601 handlers.splice( j, 1 ); 11602 11603 if ( handleObj.selector ) { 11604 handlers.delegateCount--; 11605 } 11606 if ( special.remove ) { 11607 special.remove.call( elem, handleObj ); 11608 } 11609 } 11610 } 11611 11612 // Remove generic event handler if we removed something and no more handlers exist 11613 // (avoids potential for endless recursion during removal of special event handlers) 11614 if ( origCount && !handlers.length ) { 11615 if ( !special.teardown || 11616 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 11617 11618 jQuery.removeEvent( elem, type, elemData.handle ); 11619 } 11620 11621 delete events[ type ]; 11622 } 11623 } 11624 11625 // Remove data and the expando if it's no longer used 11626 if ( jQuery.isEmptyObject( events ) ) { 11627 dataPriv.remove( elem, "handle events" ); 11628 } 11629 }, 11630 11631 dispatch: function( nativeEvent ) { 11632 11633 // Make a writable jQuery.Event from the native event object 11634 var event = jQuery.event.fix( nativeEvent ); 11635 11636 var i, j, ret, matched, handleObj, handlerQueue, 11637 args = new Array( arguments.length ), 11638 handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], 11639 special = jQuery.event.special[ event.type ] || {}; 11640 11641 // Use the fix-ed jQuery.Event rather than the (read-only) native event 11642 args[ 0 ] = event; 11643 11644 for ( i = 1; i < arguments.length; i++ ) { 11645 args[ i ] = arguments[ i ]; 11646 } 11647 11648 event.delegateTarget = this; 11649 11650 // Call the preDispatch hook for the mapped type, and let it bail if desired 11651 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 11652 return; 11653 } 11654 11655 // Determine handlers 11656 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 11657 11658 // Run delegates first; they may want to stop propagation beneath us 11659 i = 0; 11660 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 11661 event.currentTarget = matched.elem; 11662 11663 j = 0; 11664 while ( ( handleObj = matched.handlers[ j++ ] ) && 11665 !event.isImmediatePropagationStopped() ) { 11666 11667 // If the event is namespaced, then each handler is only invoked if it is 11668 // specially universal or its namespaces are a superset of the event's. 11669 if ( !event.rnamespace || handleObj.namespace === false || 11670 event.rnamespace.test( handleObj.namespace ) ) { 11671 11672 event.handleObj = handleObj; 11673 event.data = handleObj.data; 11674 11675 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 11676 handleObj.handler ).apply( matched.elem, args ); 11677 11678 if ( ret !== undefined ) { 11679 if ( ( event.result = ret ) === false ) { 11680 event.preventDefault(); 11681 event.stopPropagation(); 11682 } 11683 } 11684 } 11685 } 11686 } 11687 11688 // Call the postDispatch hook for the mapped type 11689 if ( special.postDispatch ) { 11690 special.postDispatch.call( this, event ); 11691 } 11692 11693 return event.result; 11694 }, 11695 11696 handlers: function( event, handlers ) { 11697 var i, handleObj, sel, matchedHandlers, matchedSelectors, 11698 handlerQueue = [], 11699 delegateCount = handlers.delegateCount, 11700 cur = event.target; 11701 11702 // Find delegate handlers 11703 if ( delegateCount && 11704 11705 // Support: IE <=9 11706 // Black-hole SVG <use> instance trees (trac-13180) 11707 cur.nodeType && 11708 11709 // Support: Firefox <=42 11710 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 11711 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 11712 // Support: IE 11 only 11713 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 11714 !( event.type === "click" && event.button >= 1 ) ) { 11715 11716 for ( ; cur !== this; cur = cur.parentNode || this ) { 11717 11718 // Don't check non-elements (#13208) 11719 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) 11720 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { 11721 matchedHandlers = []; 11722 matchedSelectors = {}; 11723 for ( i = 0; i < delegateCount; i++ ) { 11724 handleObj = handlers[ i ]; 11725 11726 // Don't conflict with Object.prototype properties (#13203) 11727 sel = handleObj.selector + " "; 11728 11729 if ( matchedSelectors[ sel ] === undefined ) { 11730 matchedSelectors[ sel ] = handleObj.needsContext ? 11731 jQuery( sel, this ).index( cur ) > -1 : 11732 jQuery.find( sel, this, null, [ cur ] ).length; 11733 } 11734 if ( matchedSelectors[ sel ] ) { 11735 matchedHandlers.push( handleObj ); 11736 } 11737 } 11738 if ( matchedHandlers.length ) { 11739 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); 11740 } 11741 } 11742 } 11743 } 11744 11745 // Add the remaining (directly-bound) handlers 11746 cur = this; 11747 if ( delegateCount < handlers.length ) { 11748 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); 11749 } 11750 11751 return handlerQueue; 11752 }, 11753 11754 addProp: function( name, hook ) { 11755 Object.defineProperty( jQuery.Event.prototype, name, { 11756 enumerable: true, 11757 configurable: true, 11758 11759 get: isFunction( hook ) ? 11760 function() { 11761 if ( this.originalEvent ) { 11762 return hook( this.originalEvent ); 11763 } 11764 } : 11765 function() { 11766 if ( this.originalEvent ) { 11767 return this.originalEvent[ name ]; 11768 } 11769 }, 11770 11771 set: function( value ) { 11772 Object.defineProperty( this, name, { 11773 enumerable: true, 11774 configurable: true, 11775 writable: true, 11776 value: value 11777 } ); 11778 } 11779 } ); 11780 }, 11781 11782 fix: function( originalEvent ) { 11783 return originalEvent[ jQuery.expando ] ? 11784 originalEvent : 11785 new jQuery.Event( originalEvent ); 11786 }, 11787 11788 special: { 11789 load: { 11790 11791 // Prevent triggered image.load events from bubbling to window.load 11792 noBubble: true 11793 }, 11794 click: { 11795 11796 // Utilize native event to ensure correct state for checkable inputs 11797 setup: function( data ) { 11798 11799 // For mutual compressibility with _default, replace `this` access with a local var. 11800 // `|| data` is dead code meant only to preserve the variable through minification. 11801 var el = this || data; 11802 11803 // Claim the first handler 11804 if ( rcheckableType.test( el.type ) && 11805 el.click && nodeName( el, "input" ) ) { 11806 11807 // dataPriv.set( el, "click", ... ) 11808 leverageNative( el, "click", returnTrue ); 11809 } 11810 11811 // Return false to allow normal processing in the caller 11812 return false; 11813 }, 11814 trigger: function( data ) { 11815 11816 // For mutual compressibility with _default, replace `this` access with a local var. 11817 // `|| data` is dead code meant only to preserve the variable through minification. 11818 var el = this || data; 11819 11820 // Force setup before triggering a click 11821 if ( rcheckableType.test( el.type ) && 11822 el.click && nodeName( el, "input" ) ) { 11823 11824 leverageNative( el, "click" ); 11825 } 11826 11827 // Return non-false to allow normal event-path propagation 11828 return true; 11829 }, 11830 11831 // For cross-browser consistency, suppress native .click() on links 11832 // Also prevent it if we're currently inside a leveraged native-event stack 11833 _default: function( event ) { 11834 var target = event.target; 11835 return rcheckableType.test( target.type ) && 11836 target.click && nodeName( target, "input" ) && 11837 dataPriv.get( target, "click" ) || 11838 nodeName( target, "a" ); 11839 } 11840 }, 11841 11842 beforeunload: { 11843 postDispatch: function( event ) { 11844 11845 // Support: Firefox 20+ 11846 // Firefox doesn't alert if the returnValue field is not set. 11847 if ( event.result !== undefined && event.originalEvent ) { 11848 event.originalEvent.returnValue = event.result; 11849 } 11850 } 11851 } 11852 } 11853}; 11854 11855// Ensure the presence of an event listener that handles manually-triggered 11856// synthetic events by interrupting progress until reinvoked in response to 11857// *native* events that it fires directly, ensuring that state changes have 11858// already occurred before other listeners are invoked. 11859function leverageNative( el, type, expectSync ) { 11860 11861 // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add 11862 if ( !expectSync ) { 11863 if ( dataPriv.get( el, type ) === undefined ) { 11864 jQuery.event.add( el, type, returnTrue ); 11865 } 11866 return; 11867 } 11868 11869 // Register the controller as a special universal handler for all event namespaces 11870 dataPriv.set( el, type, false ); 11871 jQuery.event.add( el, type, { 11872 namespace: false, 11873 handler: function( event ) { 11874 var notAsync, result, 11875 saved = dataPriv.get( this, type ); 11876 11877 if ( ( event.isTrigger & 1 ) && this[ type ] ) { 11878 11879 // Interrupt processing of the outer synthetic .trigger()ed event 11880 // Saved data should be false in such cases, but might be a leftover capture object 11881 // from an async native handler (gh-4350) 11882 if ( !saved.length ) { 11883 11884 // Store arguments for use when handling the inner native event 11885 // There will always be at least one argument (an event object), so this array 11886 // will not be confused with a leftover capture object. 11887 saved = slice.call( arguments ); 11888 dataPriv.set( this, type, saved ); 11889 11890 // Trigger the native event and capture its result 11891 // Support: IE <=9 - 11+ 11892 // focus() and blur() are asynchronous 11893 notAsync = expectSync( this, type ); 11894 this[ type ](); 11895 result = dataPriv.get( this, type ); 11896 if ( saved !== result || notAsync ) { 11897 dataPriv.set( this, type, false ); 11898 } else { 11899 result = {}; 11900 } 11901 if ( saved !== result ) { 11902 11903 // Cancel the outer synthetic event 11904 event.stopImmediatePropagation(); 11905 event.preventDefault(); 11906 return result.value; 11907 } 11908 11909 // If this is an inner synthetic event for an event with a bubbling surrogate 11910 // (focus or blur), assume that the surrogate already propagated from triggering the 11911 // native event and prevent that from happening again here. 11912 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the 11913 // bubbling surrogate propagates *after* the non-bubbling base), but that seems 11914 // less bad than duplication. 11915 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { 11916 event.stopPropagation(); 11917 } 11918 11919 // If this is a native event triggered above, everything is now in order 11920 // Fire an inner synthetic event with the original arguments 11921 } else if ( saved.length ) { 11922 11923 // ...and capture the result 11924 dataPriv.set( this, type, { 11925 value: jQuery.event.trigger( 11926 11927 // Support: IE <=9 - 11+ 11928 // Extend with the prototype to reset the above stopImmediatePropagation() 11929 jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), 11930 saved.slice( 1 ), 11931 this 11932 ) 11933 } ); 11934 11935 // Abort handling of the native event 11936 event.stopImmediatePropagation(); 11937 } 11938 } 11939 } ); 11940} 11941 11942jQuery.removeEvent = function( elem, type, handle ) { 11943 11944 // This "if" is needed for plain objects 11945 if ( elem.removeEventListener ) { 11946 elem.removeEventListener( type, handle ); 11947 } 11948}; 11949 11950jQuery.Event = function( src, props ) { 11951 11952 // Allow instantiation without the 'new' keyword 11953 if ( !( this instanceof jQuery.Event ) ) { 11954 return new jQuery.Event( src, props ); 11955 } 11956 11957 // Event object 11958 if ( src && src.type ) { 11959 this.originalEvent = src; 11960 this.type = src.type; 11961 11962 // Events bubbling up the document may have been marked as prevented 11963 // by a handler lower down the tree; reflect the correct value. 11964 this.isDefaultPrevented = src.defaultPrevented || 11965 src.defaultPrevented === undefined && 11966 11967 // Support: Android <=2.3 only 11968 src.returnValue === false ? 11969 returnTrue : 11970 returnFalse; 11971 11972 // Create target properties 11973 // Support: Safari <=6 - 7 only 11974 // Target should not be a text node (#504, #13143) 11975 this.target = ( src.target && src.target.nodeType === 3 ) ? 11976 src.target.parentNode : 11977 src.target; 11978 11979 this.currentTarget = src.currentTarget; 11980 this.relatedTarget = src.relatedTarget; 11981 11982 // Event type 11983 } else { 11984 this.type = src; 11985 } 11986 11987 // Put explicitly provided properties onto the event object 11988 if ( props ) { 11989 jQuery.extend( this, props ); 11990 } 11991 11992 // Create a timestamp if incoming event doesn't have one 11993 this.timeStamp = src && src.timeStamp || Date.now(); 11994 11995 // Mark it as fixed 11996 this[ jQuery.expando ] = true; 11997}; 11998 11999// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 12000// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 12001jQuery.Event.prototype = { 12002 constructor: jQuery.Event, 12003 isDefaultPrevented: returnFalse, 12004 isPropagationStopped: returnFalse, 12005 isImmediatePropagationStopped: returnFalse, 12006 isSimulated: false, 12007 12008 preventDefault: function() { 12009 var e = this.originalEvent; 12010 12011 this.isDefaultPrevented = returnTrue; 12012 12013 if ( e && !this.isSimulated ) { 12014 e.preventDefault(); 12015 } 12016 }, 12017 stopPropagation: function() { 12018 var e = this.originalEvent; 12019 12020 this.isPropagationStopped = returnTrue; 12021 12022 if ( e && !this.isSimulated ) { 12023 e.stopPropagation(); 12024 } 12025 }, 12026 stopImmediatePropagation: function() { 12027 var e = this.originalEvent; 12028 12029 this.isImmediatePropagationStopped = returnTrue; 12030 12031 if ( e && !this.isSimulated ) { 12032 e.stopImmediatePropagation(); 12033 } 12034 12035 this.stopPropagation(); 12036 } 12037}; 12038 12039// Includes all common event props including KeyEvent and MouseEvent specific props 12040jQuery.each( { 12041 altKey: true, 12042 bubbles: true, 12043 cancelable: true, 12044 changedTouches: true, 12045 ctrlKey: true, 12046 detail: true, 12047 eventPhase: true, 12048 metaKey: true, 12049 pageX: true, 12050 pageY: true, 12051 shiftKey: true, 12052 view: true, 12053 "char": true, 12054 code: true, 12055 charCode: true, 12056 key: true, 12057 keyCode: true, 12058 button: true, 12059 buttons: true, 12060 clientX: true, 12061 clientY: true, 12062 offsetX: true, 12063 offsetY: true, 12064 pointerId: true, 12065 pointerType: true, 12066 screenX: true, 12067 screenY: true, 12068 targetTouches: true, 12069 toElement: true, 12070 touches: true, 12071 12072 which: function( event ) { 12073 var button = event.button; 12074 12075 // Add which for key events 12076 if ( event.which == null && rkeyEvent.test( event.type ) ) { 12077 return event.charCode != null ? event.charCode : event.keyCode; 12078 } 12079 12080 // Add which for click: 1 === left; 2 === middle; 3 === right 12081 if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { 12082 if ( button & 1 ) { 12083 return 1; 12084 } 12085 12086 if ( button & 2 ) { 12087 return 3; 12088 } 12089 12090 if ( button & 4 ) { 12091 return 2; 12092 } 12093 12094 return 0; 12095 } 12096 12097 return event.which; 12098 } 12099}, jQuery.event.addProp ); 12100 12101jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { 12102 jQuery.event.special[ type ] = { 12103 12104 // Utilize native event if possible so blur/focus sequence is correct 12105 setup: function() { 12106 12107 // Claim the first handler 12108 // dataPriv.set( this, "focus", ... ) 12109 // dataPriv.set( this, "blur", ... ) 12110 leverageNative( this, type, expectSync ); 12111 12112 // Return false to allow normal processing in the caller 12113 return false; 12114 }, 12115 trigger: function() { 12116 12117 // Force setup before trigger 12118 leverageNative( this, type ); 12119 12120 // Return non-false to allow normal event-path propagation 12121 return true; 12122 }, 12123 12124 delegateType: delegateType 12125 }; 12126} ); 12127 12128// Create mouseenter/leave events using mouseover/out and event-time checks 12129// so that event delegation works in jQuery. 12130// Do the same for pointerenter/pointerleave and pointerover/pointerout 12131// 12132// Support: Safari 7 only 12133// Safari sends mouseenter too often; see: 12134// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 12135// for the description of the bug (it existed in older Chrome versions as well). 12136jQuery.each( { 12137 mouseenter: "mouseover", 12138 mouseleave: "mouseout", 12139 pointerenter: "pointerover", 12140 pointerleave: "pointerout" 12141}, function( orig, fix ) { 12142 jQuery.event.special[ orig ] = { 12143 delegateType: fix, 12144 bindType: fix, 12145 12146 handle: function( event ) { 12147 var ret, 12148 target = this, 12149 related = event.relatedTarget, 12150 handleObj = event.handleObj; 12151 12152 // For mouseenter/leave call the handler if related is outside the target. 12153 // NB: No relatedTarget if the mouse left/entered the browser window 12154 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 12155 event.type = handleObj.origType; 12156 ret = handleObj.handler.apply( this, arguments ); 12157 event.type = fix; 12158 } 12159 return ret; 12160 } 12161 }; 12162} ); 12163 12164jQuery.fn.extend( { 12165 12166 on: function( types, selector, data, fn ) { 12167 return on( this, types, selector, data, fn ); 12168 }, 12169 one: function( types, selector, data, fn ) { 12170 return on( this, types, selector, data, fn, 1 ); 12171 }, 12172 off: function( types, selector, fn ) { 12173 var handleObj, type; 12174 if ( types && types.preventDefault && types.handleObj ) { 12175 12176 // ( event ) dispatched jQuery.Event 12177 handleObj = types.handleObj; 12178 jQuery( types.delegateTarget ).off( 12179 handleObj.namespace ? 12180 handleObj.origType + "." + handleObj.namespace : 12181 handleObj.origType, 12182 handleObj.selector, 12183 handleObj.handler 12184 ); 12185 return this; 12186 } 12187 if ( typeof types === "object" ) { 12188 12189 // ( types-object [, selector] ) 12190 for ( type in types ) { 12191 this.off( type, selector, types[ type ] ); 12192 } 12193 return this; 12194 } 12195 if ( selector === false || typeof selector === "function" ) { 12196 12197 // ( types [, fn] ) 12198 fn = selector; 12199 selector = undefined; 12200 } 12201 if ( fn === false ) { 12202 fn = returnFalse; 12203 } 12204 return this.each( function() { 12205 jQuery.event.remove( this, types, fn, selector ); 12206 } ); 12207 } 12208} ); 12209 12210 12211var 12212 12213 /* eslint-disable max-len */ 12214 12215 // See https://github.com/eslint/eslint/issues/3229 12216 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, 12217 12218 /* eslint-enable */ 12219 12220 // Support: IE <=10 - 11, Edge 12 - 13 only 12221 // In IE/Edge using regex groups here causes severe slowdowns. 12222 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 12223 rnoInnerhtml = /<script|<style|<link/i, 12224 12225 // checked="checked" or checked 12226 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 12227 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; 12228 12229// Prefer a tbody over its parent table for containing new rows 12230function manipulationTarget( elem, content ) { 12231 if ( nodeName( elem, "table" ) && 12232 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { 12233 12234 return jQuery( elem ).children( "tbody" )[ 0 ] || elem; 12235 } 12236 12237 return elem; 12238} 12239 12240// Replace/restore the type attribute of script elements for safe DOM manipulation 12241function disableScript( elem ) { 12242 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 12243 return elem; 12244} 12245function restoreScript( elem ) { 12246 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { 12247 elem.type = elem.type.slice( 5 ); 12248 } else { 12249 elem.removeAttribute( "type" ); 12250 } 12251 12252 return elem; 12253} 12254 12255function cloneCopyEvent( src, dest ) { 12256 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; 12257 12258 if ( dest.nodeType !== 1 ) { 12259 return; 12260 } 12261 12262 // 1. Copy private data: events, handlers, etc. 12263 if ( dataPriv.hasData( src ) ) { 12264 pdataOld = dataPriv.access( src ); 12265 pdataCur = dataPriv.set( dest, pdataOld ); 12266 events = pdataOld.events; 12267 12268 if ( events ) { 12269 delete pdataCur.handle; 12270 pdataCur.events = {}; 12271 12272 for ( type in events ) { 12273 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 12274 jQuery.event.add( dest, type, events[ type ][ i ] ); 12275 } 12276 } 12277 } 12278 } 12279 12280 // 2. Copy user data 12281 if ( dataUser.hasData( src ) ) { 12282 udataOld = dataUser.access( src ); 12283 udataCur = jQuery.extend( {}, udataOld ); 12284 12285 dataUser.set( dest, udataCur ); 12286 } 12287} 12288 12289// Fix IE bugs, see support tests 12290function fixInput( src, dest ) { 12291 var nodeName = dest.nodeName.toLowerCase(); 12292 12293 // Fails to persist the checked state of a cloned checkbox or radio button. 12294 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 12295 dest.checked = src.checked; 12296 12297 // Fails to return the selected option to the default selected state when cloning options 12298 } else if ( nodeName === "input" || nodeName === "textarea" ) { 12299 dest.defaultValue = src.defaultValue; 12300 } 12301} 12302 12303function domManip( collection, args, callback, ignored ) { 12304 12305 // Flatten any nested arrays 12306 args = concat.apply( [], args ); 12307 12308 var fragment, first, scripts, hasScripts, node, doc, 12309 i = 0, 12310 l = collection.length, 12311 iNoClone = l - 1, 12312 value = args[ 0 ], 12313 valueIsFunction = isFunction( value ); 12314 12315 // We can't cloneNode fragments that contain checked, in WebKit 12316 if ( valueIsFunction || 12317 ( l > 1 && typeof value === "string" && 12318 !support.checkClone && rchecked.test( value ) ) ) { 12319 return collection.each( function( index ) { 12320 var self = collection.eq( index ); 12321 if ( valueIsFunction ) { 12322 args[ 0 ] = value.call( this, index, self.html() ); 12323 } 12324 domManip( self, args, callback, ignored ); 12325 } ); 12326 } 12327 12328 if ( l ) { 12329 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 12330 first = fragment.firstChild; 12331 12332 if ( fragment.childNodes.length === 1 ) { 12333 fragment = first; 12334 } 12335 12336 // Require either new content or an interest in ignored elements to invoke the callback 12337 if ( first || ignored ) { 12338 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 12339 hasScripts = scripts.length; 12340 12341 // Use the original fragment for the last item 12342 // instead of the first because it can end up 12343 // being emptied incorrectly in certain situations (#8070). 12344 for ( ; i < l; i++ ) { 12345 node = fragment; 12346 12347 if ( i !== iNoClone ) { 12348 node = jQuery.clone( node, true, true ); 12349 12350 // Keep references to cloned scripts for later restoration 12351 if ( hasScripts ) { 12352 12353 // Support: Android <=4.0 only, PhantomJS 1 only 12354 // push.apply(_, arraylike) throws on ancient WebKit 12355 jQuery.merge( scripts, getAll( node, "script" ) ); 12356 } 12357 } 12358 12359 callback.call( collection[ i ], node, i ); 12360 } 12361 12362 if ( hasScripts ) { 12363 doc = scripts[ scripts.length - 1 ].ownerDocument; 12364 12365 // Reenable scripts 12366 jQuery.map( scripts, restoreScript ); 12367 12368 // Evaluate executable scripts on first document insertion 12369 for ( i = 0; i < hasScripts; i++ ) { 12370 node = scripts[ i ]; 12371 if ( rscriptType.test( node.type || "" ) && 12372 !dataPriv.access( node, "globalEval" ) && 12373 jQuery.contains( doc, node ) ) { 12374 12375 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { 12376 12377 // Optional AJAX dependency, but won't run scripts if not present 12378 if ( jQuery._evalUrl && !node.noModule ) { 12379 jQuery._evalUrl( node.src, { 12380 nonce: node.nonce || node.getAttribute( "nonce" ) 12381 } ); 12382 } 12383 } else { 12384 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); 12385 } 12386 } 12387 } 12388 } 12389 } 12390 } 12391 12392 return collection; 12393} 12394 12395function remove( elem, selector, keepData ) { 12396 var node, 12397 nodes = selector ? jQuery.filter( selector, elem ) : elem, 12398 i = 0; 12399 12400 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 12401 if ( !keepData && node.nodeType === 1 ) { 12402 jQuery.cleanData( getAll( node ) ); 12403 } 12404 12405 if ( node.parentNode ) { 12406 if ( keepData && isAttached( node ) ) { 12407 setGlobalEval( getAll( node, "script" ) ); 12408 } 12409 node.parentNode.removeChild( node ); 12410 } 12411 } 12412 12413 return elem; 12414} 12415 12416jQuery.extend( { 12417 htmlPrefilter: function( html ) { 12418 return html.replace( rxhtmlTag, "<$1></$2>" ); 12419 }, 12420 12421 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 12422 var i, l, srcElements, destElements, 12423 clone = elem.cloneNode( true ), 12424 inPage = isAttached( elem ); 12425 12426 // Fix IE cloning issues 12427 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 12428 !jQuery.isXMLDoc( elem ) ) { 12429 12430 // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 12431 destElements = getAll( clone ); 12432 srcElements = getAll( elem ); 12433 12434 for ( i = 0, l = srcElements.length; i < l; i++ ) { 12435 fixInput( srcElements[ i ], destElements[ i ] ); 12436 } 12437 } 12438 12439 // Copy the events from the original to the clone 12440 if ( dataAndEvents ) { 12441 if ( deepDataAndEvents ) { 12442 srcElements = srcElements || getAll( elem ); 12443 destElements = destElements || getAll( clone ); 12444 12445 for ( i = 0, l = srcElements.length; i < l; i++ ) { 12446 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 12447 } 12448 } else { 12449 cloneCopyEvent( elem, clone ); 12450 } 12451 } 12452 12453 // Preserve script evaluation history 12454 destElements = getAll( clone, "script" ); 12455 if ( destElements.length > 0 ) { 12456 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 12457 } 12458 12459 // Return the cloned set 12460 return clone; 12461 }, 12462 12463 cleanData: function( elems ) { 12464 var data, elem, type, 12465 special = jQuery.event.special, 12466 i = 0; 12467 12468 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 12469 if ( acceptData( elem ) ) { 12470 if ( ( data = elem[ dataPriv.expando ] ) ) { 12471 if ( data.events ) { 12472 for ( type in data.events ) { 12473 if ( special[ type ] ) { 12474 jQuery.event.remove( elem, type ); 12475 12476 // This is a shortcut to avoid jQuery.event.remove's overhead 12477 } else { 12478 jQuery.removeEvent( elem, type, data.handle ); 12479 } 12480 } 12481 } 12482 12483 // Support: Chrome <=35 - 45+ 12484 // Assign undefined instead of using delete, see Data#remove 12485 elem[ dataPriv.expando ] = undefined; 12486 } 12487 if ( elem[ dataUser.expando ] ) { 12488 12489 // Support: Chrome <=35 - 45+ 12490 // Assign undefined instead of using delete, see Data#remove 12491 elem[ dataUser.expando ] = undefined; 12492 } 12493 } 12494 } 12495 } 12496} ); 12497 12498jQuery.fn.extend( { 12499 detach: function( selector ) { 12500 return remove( this, selector, true ); 12501 }, 12502 12503 remove: function( selector ) { 12504 return remove( this, selector ); 12505 }, 12506 12507 text: function( value ) { 12508 return access( this, function( value ) { 12509 return value === undefined ? 12510 jQuery.text( this ) : 12511 this.empty().each( function() { 12512 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 12513 this.textContent = value; 12514 } 12515 } ); 12516 }, null, value, arguments.length ); 12517 }, 12518 12519 append: function() { 12520 return domManip( this, arguments, function( elem ) { 12521 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 12522 var target = manipulationTarget( this, elem ); 12523 target.appendChild( elem ); 12524 } 12525 } ); 12526 }, 12527 12528 prepend: function() { 12529 return domManip( this, arguments, function( elem ) { 12530 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 12531 var target = manipulationTarget( this, elem ); 12532 target.insertBefore( elem, target.firstChild ); 12533 } 12534 } ); 12535 }, 12536 12537 before: function() { 12538 return domManip( this, arguments, function( elem ) { 12539 if ( this.parentNode ) { 12540 this.parentNode.insertBefore( elem, this ); 12541 } 12542 } ); 12543 }, 12544 12545 after: function() { 12546 return domManip( this, arguments, function( elem ) { 12547 if ( this.parentNode ) { 12548 this.parentNode.insertBefore( elem, this.nextSibling ); 12549 } 12550 } ); 12551 }, 12552 12553 empty: function() { 12554 var elem, 12555 i = 0; 12556 12557 for ( ; ( elem = this[ i ] ) != null; i++ ) { 12558 if ( elem.nodeType === 1 ) { 12559 12560 // Prevent memory leaks 12561 jQuery.cleanData( getAll( elem, false ) ); 12562 12563 // Remove any remaining nodes 12564 elem.textContent = ""; 12565 } 12566 } 12567 12568 return this; 12569 }, 12570 12571 clone: function( dataAndEvents, deepDataAndEvents ) { 12572 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 12573 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 12574 12575 return this.map( function() { 12576 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 12577 } ); 12578 }, 12579 12580 html: function( value ) { 12581 return access( this, function( value ) { 12582 var elem = this[ 0 ] || {}, 12583 i = 0, 12584 l = this.length; 12585 12586 if ( value === undefined && elem.nodeType === 1 ) { 12587 return elem.innerHTML; 12588 } 12589 12590 // See if we can take a shortcut and just use innerHTML 12591 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 12592 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 12593 12594 value = jQuery.htmlPrefilter( value ); 12595 12596 try { 12597 for ( ; i < l; i++ ) { 12598 elem = this[ i ] || {}; 12599 12600 // Remove element nodes and prevent memory leaks 12601 if ( elem.nodeType === 1 ) { 12602 jQuery.cleanData( getAll( elem, false ) ); 12603 elem.innerHTML = value; 12604 } 12605 } 12606 12607 elem = 0; 12608 12609 // If using innerHTML throws an exception, use the fallback method 12610 } catch ( e ) {} 12611 } 12612 12613 if ( elem ) { 12614 this.empty().append( value ); 12615 } 12616 }, null, value, arguments.length ); 12617 }, 12618 12619 replaceWith: function() { 12620 var ignored = []; 12621 12622 // Make the changes, replacing each non-ignored context element with the new content 12623 return domManip( this, arguments, function( elem ) { 12624 var parent = this.parentNode; 12625 12626 if ( jQuery.inArray( this, ignored ) < 0 ) { 12627 jQuery.cleanData( getAll( this ) ); 12628 if ( parent ) { 12629 parent.replaceChild( elem, this ); 12630 } 12631 } 12632 12633 // Force callback invocation 12634 }, ignored ); 12635 } 12636} ); 12637 12638jQuery.each( { 12639 appendTo: "append", 12640 prependTo: "prepend", 12641 insertBefore: "before", 12642 insertAfter: "after", 12643 replaceAll: "replaceWith" 12644}, function( name, original ) { 12645 jQuery.fn[ name ] = function( selector ) { 12646 var elems, 12647 ret = [], 12648 insert = jQuery( selector ), 12649 last = insert.length - 1, 12650 i = 0; 12651 12652 for ( ; i <= last; i++ ) { 12653 elems = i === last ? this : this.clone( true ); 12654 jQuery( insert[ i ] )[ original ]( elems ); 12655 12656 // Support: Android <=4.0 only, PhantomJS 1 only 12657 // .get() because push.apply(_, arraylike) throws on ancient WebKit 12658 push.apply( ret, elems.get() ); 12659 } 12660 12661 return this.pushStack( ret ); 12662 }; 12663} ); 12664var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 12665 12666var getStyles = function( elem ) { 12667 12668 // Support: IE <=11 only, Firefox <=30 (#15098, #14150) 12669 // IE throws on elements created in popups 12670 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 12671 var view = elem.ownerDocument.defaultView; 12672 12673 if ( !view || !view.opener ) { 12674 view = window; 12675 } 12676 12677 return view.getComputedStyle( elem ); 12678 }; 12679 12680var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); 12681 12682 12683 12684( function() { 12685 12686 // Executing both pixelPosition & boxSizingReliable tests require only one layout 12687 // so they're executed at the same time to save the second computation. 12688 function computeStyleTests() { 12689 12690 // This is a singleton, we need to execute it only once 12691 if ( !div ) { 12692 return; 12693 } 12694 12695 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + 12696 "margin-top:1px;padding:0;border:0"; 12697 div.style.cssText = 12698 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 12699 "margin:auto;border:1px;padding:1px;" + 12700 "width:60%;top:1%"; 12701 documentElement.appendChild( container ).appendChild( div ); 12702 12703 var divStyle = window.getComputedStyle( div ); 12704 pixelPositionVal = divStyle.top !== "1%"; 12705 12706 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 12707 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; 12708 12709 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 12710 // Some styles come back with percentage values, even though they shouldn't 12711 div.style.right = "60%"; 12712 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; 12713 12714 // Support: IE 9 - 11 only 12715 // Detect misreporting of content dimensions for box-sizing:border-box elements 12716 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; 12717 12718 // Support: IE 9 only 12719 // Detect overflow:scroll screwiness (gh-3699) 12720 // Support: Chrome <=64 12721 // Don't get tricked when zoom affects offsetWidth (gh-4029) 12722 div.style.position = "absolute"; 12723 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; 12724 12725 documentElement.removeChild( container ); 12726 12727 // Nullify the div so it wouldn't be stored in the memory and 12728 // it will also be a sign that checks already performed 12729 div = null; 12730 } 12731 12732 function roundPixelMeasures( measure ) { 12733 return Math.round( parseFloat( measure ) ); 12734 } 12735 12736 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 12737 reliableMarginLeftVal, 12738 container = document.createElement( "div" ), 12739 div = document.createElement( "div" ); 12740 12741 // Finish early in limited (non-browser) environments 12742 if ( !div.style ) { 12743 return; 12744 } 12745 12746 // Support: IE <=9 - 11 only 12747 // Style of cloned element affects source element cloned (#8908) 12748 div.style.backgroundClip = "content-box"; 12749 div.cloneNode( true ).style.backgroundClip = ""; 12750 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 12751 12752 jQuery.extend( support, { 12753 boxSizingReliable: function() { 12754 computeStyleTests(); 12755 return boxSizingReliableVal; 12756 }, 12757 pixelBoxStyles: function() { 12758 computeStyleTests(); 12759 return pixelBoxStylesVal; 12760 }, 12761 pixelPosition: function() { 12762 computeStyleTests(); 12763 return pixelPositionVal; 12764 }, 12765 reliableMarginLeft: function() { 12766 computeStyleTests(); 12767 return reliableMarginLeftVal; 12768 }, 12769 scrollboxSize: function() { 12770 computeStyleTests(); 12771 return scrollboxSizeVal; 12772 } 12773 } ); 12774} )(); 12775 12776 12777function curCSS( elem, name, computed ) { 12778 var width, minWidth, maxWidth, ret, 12779 12780 // Support: Firefox 51+ 12781 // Retrieving style before computed somehow 12782 // fixes an issue with getting wrong values 12783 // on detached elements 12784 style = elem.style; 12785 12786 computed = computed || getStyles( elem ); 12787 12788 // getPropertyValue is needed for: 12789 // .css('filter') (IE 9 only, #12537) 12790 // .css('--customProperty) (#3144) 12791 if ( computed ) { 12792 ret = computed.getPropertyValue( name ) || computed[ name ]; 12793 12794 if ( ret === "" && !isAttached( elem ) ) { 12795 ret = jQuery.style( elem, name ); 12796 } 12797 12798 // A tribute to the "awesome hack by Dean Edwards" 12799 // Android Browser returns percentage for some values, 12800 // but width seems to be reliably pixels. 12801 // This is against the CSSOM draft spec: 12802 // https://drafts.csswg.org/cssom/#resolved-values 12803 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { 12804 12805 // Remember the original values 12806 width = style.width; 12807 minWidth = style.minWidth; 12808 maxWidth = style.maxWidth; 12809 12810 // Put in the new values to get a computed value out 12811 style.minWidth = style.maxWidth = style.width = ret; 12812 ret = computed.width; 12813 12814 // Revert the changed values 12815 style.width = width; 12816 style.minWidth = minWidth; 12817 style.maxWidth = maxWidth; 12818 } 12819 } 12820 12821 return ret !== undefined ? 12822 12823 // Support: IE <=9 - 11 only 12824 // IE returns zIndex value as an integer. 12825 ret + "" : 12826 ret; 12827} 12828 12829 12830function addGetHookIf( conditionFn, hookFn ) { 12831 12832 // Define the hook, we'll check on the first run if it's really needed. 12833 return { 12834 get: function() { 12835 if ( conditionFn() ) { 12836 12837 // Hook not needed (or it's not possible to use it due 12838 // to missing dependency), remove it. 12839 delete this.get; 12840 return; 12841 } 12842 12843 // Hook needed; redefine it so that the support test is not executed again. 12844 return ( this.get = hookFn ).apply( this, arguments ); 12845 } 12846 }; 12847} 12848 12849 12850var cssPrefixes = [ "Webkit", "Moz", "ms" ], 12851 emptyStyle = document.createElement( "div" ).style, 12852 vendorProps = {}; 12853 12854// Return a vendor-prefixed property or undefined 12855function vendorPropName( name ) { 12856 12857 // Check for vendor prefixed names 12858 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 12859 i = cssPrefixes.length; 12860 12861 while ( i-- ) { 12862 name = cssPrefixes[ i ] + capName; 12863 if ( name in emptyStyle ) { 12864 return name; 12865 } 12866 } 12867} 12868 12869// Return a potentially-mapped jQuery.cssProps or vendor prefixed property 12870function finalPropName( name ) { 12871 var final = jQuery.cssProps[ name ] || vendorProps[ name ]; 12872 12873 if ( final ) { 12874 return final; 12875 } 12876 if ( name in emptyStyle ) { 12877 return name; 12878 } 12879 return vendorProps[ name ] = vendorPropName( name ) || name; 12880} 12881 12882 12883var 12884 12885 // Swappable if display is none or starts with table 12886 // except "table", "table-cell", or "table-caption" 12887 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 12888 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 12889 rcustomProp = /^--/, 12890 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 12891 cssNormalTransform = { 12892 letterSpacing: "0", 12893 fontWeight: "400" 12894 }; 12895 12896function setPositiveNumber( elem, value, subtract ) { 12897 12898 // Any relative (+/-) values have already been 12899 // normalized at this point 12900 var matches = rcssNum.exec( value ); 12901 return matches ? 12902 12903 // Guard against undefined "subtract", e.g., when used as in cssHooks 12904 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 12905 value; 12906} 12907 12908function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { 12909 var i = dimension === "width" ? 1 : 0, 12910 extra = 0, 12911 delta = 0; 12912 12913 // Adjustment may not be necessary 12914 if ( box === ( isBorderBox ? "border" : "content" ) ) { 12915 return 0; 12916 } 12917 12918 for ( ; i < 4; i += 2 ) { 12919 12920 // Both box models exclude margin 12921 if ( box === "margin" ) { 12922 delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); 12923 } 12924 12925 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 12926 if ( !isBorderBox ) { 12927 12928 // Add padding 12929 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 12930 12931 // For "border" or "margin", add border 12932 if ( box !== "padding" ) { 12933 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 12934 12935 // But still keep track of it otherwise 12936 } else { 12937 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 12938 } 12939 12940 // If we get here with a border-box (content + padding + border), we're seeking "content" or 12941 // "padding" or "margin" 12942 } else { 12943 12944 // For "content", subtract padding 12945 if ( box === "content" ) { 12946 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 12947 } 12948 12949 // For "content" or "padding", subtract border 12950 if ( box !== "margin" ) { 12951 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 12952 } 12953 } 12954 } 12955 12956 // Account for positive content-box scroll gutter when requested by providing computedVal 12957 if ( !isBorderBox && computedVal >= 0 ) { 12958 12959 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 12960 // Assuming integer scroll gutter, subtract the rest and round down 12961 delta += Math.max( 0, Math.ceil( 12962 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 12963 computedVal - 12964 delta - 12965 extra - 12966 0.5 12967 12968 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 12969 // Use an explicit zero to avoid NaN (gh-3964) 12970 ) ) || 0; 12971 } 12972 12973 return delta; 12974} 12975 12976function getWidthOrHeight( elem, dimension, extra ) { 12977 12978 // Start with computed style 12979 var styles = getStyles( elem ), 12980 12981 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). 12982 // Fake content-box until we know it's needed to know the true value. 12983 boxSizingNeeded = !support.boxSizingReliable() || extra, 12984 isBorderBox = boxSizingNeeded && 12985 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 12986 valueIsBorderBox = isBorderBox, 12987 12988 val = curCSS( elem, dimension, styles ), 12989 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); 12990 12991 // Support: Firefox <=54 12992 // Return a confounding non-pixel value or feign ignorance, as appropriate. 12993 if ( rnumnonpx.test( val ) ) { 12994 if ( !extra ) { 12995 return val; 12996 } 12997 val = "auto"; 12998 } 12999 13000 13001 // Fall back to offsetWidth/offsetHeight when value is "auto" 13002 // This happens for inline elements with no explicit setting (gh-3571) 13003 // Support: Android <=4.1 - 4.3 only 13004 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 13005 // Support: IE 9-11 only 13006 // Also use offsetWidth/offsetHeight for when box sizing is unreliable 13007 // We use getClientRects() to check for hidden/disconnected. 13008 // In those cases, the computed value can be trusted to be border-box 13009 if ( ( !support.boxSizingReliable() && isBorderBox || 13010 val === "auto" || 13011 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && 13012 elem.getClientRects().length ) { 13013 13014 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 13015 13016 // Where available, offsetWidth/offsetHeight approximate border box dimensions. 13017 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the 13018 // retrieved value as a content box dimension. 13019 valueIsBorderBox = offsetProp in elem; 13020 if ( valueIsBorderBox ) { 13021 val = elem[ offsetProp ]; 13022 } 13023 } 13024 13025 // Normalize "" and auto 13026 val = parseFloat( val ) || 0; 13027 13028 // Adjust for the element's box model 13029 return ( val + 13030 boxModelAdjustment( 13031 elem, 13032 dimension, 13033 extra || ( isBorderBox ? "border" : "content" ), 13034 valueIsBorderBox, 13035 styles, 13036 13037 // Provide the current computed size to request scroll gutter calculation (gh-3589) 13038 val 13039 ) 13040 ) + "px"; 13041} 13042 13043jQuery.extend( { 13044 13045 // Add in style property hooks for overriding the default 13046 // behavior of getting and setting a style property 13047 cssHooks: { 13048 opacity: { 13049 get: function( elem, computed ) { 13050 if ( computed ) { 13051 13052 // We should always get a number back from opacity 13053 var ret = curCSS( elem, "opacity" ); 13054 return ret === "" ? "1" : ret; 13055 } 13056 } 13057 } 13058 }, 13059 13060 // Don't automatically add "px" to these possibly-unitless properties 13061 cssNumber: { 13062 "animationIterationCount": true, 13063 "columnCount": true, 13064 "fillOpacity": true, 13065 "flexGrow": true, 13066 "flexShrink": true, 13067 "fontWeight": true, 13068 "gridArea": true, 13069 "gridColumn": true, 13070 "gridColumnEnd": true, 13071 "gridColumnStart": true, 13072 "gridRow": true, 13073 "gridRowEnd": true, 13074 "gridRowStart": true, 13075 "lineHeight": true, 13076 "opacity": true, 13077 "order": true, 13078 "orphans": true, 13079 "widows": true, 13080 "zIndex": true, 13081 "zoom": true 13082 }, 13083 13084 // Add in properties whose names you wish to fix before 13085 // setting or getting the value 13086 cssProps: {}, 13087 13088 // Get and set the style property on a DOM Node 13089 style: function( elem, name, value, extra ) { 13090 13091 // Don't set styles on text and comment nodes 13092 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 13093 return; 13094 } 13095 13096 // Make sure that we're working with the right name 13097 var ret, type, hooks, 13098 origName = camelCase( name ), 13099 isCustomProp = rcustomProp.test( name ), 13100 style = elem.style; 13101 13102 // Make sure that we're working with the right name. We don't 13103 // want to query the value if it is a CSS custom property 13104 // since they are user-defined. 13105 if ( !isCustomProp ) { 13106 name = finalPropName( origName ); 13107 } 13108 13109 // Gets hook for the prefixed version, then unprefixed version 13110 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 13111 13112 // Check if we're setting a value 13113 if ( value !== undefined ) { 13114 type = typeof value; 13115 13116 // Convert "+=" or "-=" to relative numbers (#7345) 13117 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 13118 value = adjustCSS( elem, name, ret ); 13119 13120 // Fixes bug #9237 13121 type = "number"; 13122 } 13123 13124 // Make sure that null and NaN values aren't set (#7116) 13125 if ( value == null || value !== value ) { 13126 return; 13127 } 13128 13129 // If a number was passed in, add the unit (except for certain CSS properties) 13130 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append 13131 // "px" to a few hardcoded values. 13132 if ( type === "number" && !isCustomProp ) { 13133 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 13134 } 13135 13136 // background-* props affect original clone's values 13137 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 13138 style[ name ] = "inherit"; 13139 } 13140 13141 // If a hook was provided, use that value, otherwise just set the specified value 13142 if ( !hooks || !( "set" in hooks ) || 13143 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 13144 13145 if ( isCustomProp ) { 13146 style.setProperty( name, value ); 13147 } else { 13148 style[ name ] = value; 13149 } 13150 } 13151 13152 } else { 13153 13154 // If a hook was provided get the non-computed value from there 13155 if ( hooks && "get" in hooks && 13156 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 13157 13158 return ret; 13159 } 13160 13161 // Otherwise just get the value from the style object 13162 return style[ name ]; 13163 } 13164 }, 13165 13166 css: function( elem, name, extra, styles ) { 13167 var val, num, hooks, 13168 origName = camelCase( name ), 13169 isCustomProp = rcustomProp.test( name ); 13170 13171 // Make sure that we're working with the right name. We don't 13172 // want to modify the value if it is a CSS custom property 13173 // since they are user-defined. 13174 if ( !isCustomProp ) { 13175 name = finalPropName( origName ); 13176 } 13177 13178 // Try prefixed name followed by the unprefixed name 13179 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 13180 13181 // If a hook was provided get the computed value from there 13182 if ( hooks && "get" in hooks ) { 13183 val = hooks.get( elem, true, extra ); 13184 } 13185 13186 // Otherwise, if a way to get the computed value exists, use that 13187 if ( val === undefined ) { 13188 val = curCSS( elem, name, styles ); 13189 } 13190 13191 // Convert "normal" to computed value 13192 if ( val === "normal" && name in cssNormalTransform ) { 13193 val = cssNormalTransform[ name ]; 13194 } 13195 13196 // Make numeric if forced or a qualifier was provided and val looks numeric 13197 if ( extra === "" || extra ) { 13198 num = parseFloat( val ); 13199 return extra === true || isFinite( num ) ? num || 0 : val; 13200 } 13201 13202 return val; 13203 } 13204} ); 13205 13206jQuery.each( [ "height", "width" ], function( i, dimension ) { 13207 jQuery.cssHooks[ dimension ] = { 13208 get: function( elem, computed, extra ) { 13209 if ( computed ) { 13210 13211 // Certain elements can have dimension info if we invisibly show them 13212 // but it must have a current display style that would benefit 13213 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 13214 13215 // Support: Safari 8+ 13216 // Table columns in Safari have non-zero offsetWidth & zero 13217 // getBoundingClientRect().width unless display is changed. 13218 // Support: IE <=11 only 13219 // Running getBoundingClientRect on a disconnected node 13220 // in IE throws an error. 13221 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? 13222 swap( elem, cssShow, function() { 13223 return getWidthOrHeight( elem, dimension, extra ); 13224 } ) : 13225 getWidthOrHeight( elem, dimension, extra ); 13226 } 13227 }, 13228 13229 set: function( elem, value, extra ) { 13230 var matches, 13231 styles = getStyles( elem ), 13232 13233 // Only read styles.position if the test has a chance to fail 13234 // to avoid forcing a reflow. 13235 scrollboxSizeBuggy = !support.scrollboxSize() && 13236 styles.position === "absolute", 13237 13238 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) 13239 boxSizingNeeded = scrollboxSizeBuggy || extra, 13240 isBorderBox = boxSizingNeeded && 13241 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 13242 subtract = extra ? 13243 boxModelAdjustment( 13244 elem, 13245 dimension, 13246 extra, 13247 isBorderBox, 13248 styles 13249 ) : 13250 0; 13251 13252 // Account for unreliable border-box dimensions by comparing offset* to computed and 13253 // faking a content-box to get border and padding (gh-3699) 13254 if ( isBorderBox && scrollboxSizeBuggy ) { 13255 subtract -= Math.ceil( 13256 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 13257 parseFloat( styles[ dimension ] ) - 13258 boxModelAdjustment( elem, dimension, "border", false, styles ) - 13259 0.5 13260 ); 13261 } 13262 13263 // Convert to pixels if value adjustment is needed 13264 if ( subtract && ( matches = rcssNum.exec( value ) ) && 13265 ( matches[ 3 ] || "px" ) !== "px" ) { 13266 13267 elem.style[ dimension ] = value; 13268 value = jQuery.css( elem, dimension ); 13269 } 13270 13271 return setPositiveNumber( elem, value, subtract ); 13272 } 13273 }; 13274} ); 13275 13276jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 13277 function( elem, computed ) { 13278 if ( computed ) { 13279 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 13280 elem.getBoundingClientRect().left - 13281 swap( elem, { marginLeft: 0 }, function() { 13282 return elem.getBoundingClientRect().left; 13283 } ) 13284 ) + "px"; 13285 } 13286 } 13287); 13288 13289// These hooks are used by animate to expand properties 13290jQuery.each( { 13291 margin: "", 13292 padding: "", 13293 border: "Width" 13294}, function( prefix, suffix ) { 13295 jQuery.cssHooks[ prefix + suffix ] = { 13296 expand: function( value ) { 13297 var i = 0, 13298 expanded = {}, 13299 13300 // Assumes a single number if not a string 13301 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 13302 13303 for ( ; i < 4; i++ ) { 13304 expanded[ prefix + cssExpand[ i ] + suffix ] = 13305 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 13306 } 13307 13308 return expanded; 13309 } 13310 }; 13311 13312 if ( prefix !== "margin" ) { 13313 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 13314 } 13315} ); 13316 13317jQuery.fn.extend( { 13318 css: function( name, value ) { 13319 return access( this, function( elem, name, value ) { 13320 var styles, len, 13321 map = {}, 13322 i = 0; 13323 13324 if ( Array.isArray( name ) ) { 13325 styles = getStyles( elem ); 13326 len = name.length; 13327 13328 for ( ; i < len; i++ ) { 13329 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 13330 } 13331 13332 return map; 13333 } 13334 13335 return value !== undefined ? 13336 jQuery.style( elem, name, value ) : 13337 jQuery.css( elem, name ); 13338 }, name, value, arguments.length > 1 ); 13339 } 13340} ); 13341 13342 13343function Tween( elem, options, prop, end, easing ) { 13344 return new Tween.prototype.init( elem, options, prop, end, easing ); 13345} 13346jQuery.Tween = Tween; 13347 13348Tween.prototype = { 13349 constructor: Tween, 13350 init: function( elem, options, prop, end, easing, unit ) { 13351 this.elem = elem; 13352 this.prop = prop; 13353 this.easing = easing || jQuery.easing._default; 13354 this.options = options; 13355 this.start = this.now = this.cur(); 13356 this.end = end; 13357 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 13358 }, 13359 cur: function() { 13360 var hooks = Tween.propHooks[ this.prop ]; 13361 13362 return hooks && hooks.get ? 13363 hooks.get( this ) : 13364 Tween.propHooks._default.get( this ); 13365 }, 13366 run: function( percent ) { 13367 var eased, 13368 hooks = Tween.propHooks[ this.prop ]; 13369 13370 if ( this.options.duration ) { 13371 this.pos = eased = jQuery.easing[ this.easing ]( 13372 percent, this.options.duration * percent, 0, 1, this.options.duration 13373 ); 13374 } else { 13375 this.pos = eased = percent; 13376 } 13377 this.now = ( this.end - this.start ) * eased + this.start; 13378 13379 if ( this.options.step ) { 13380 this.options.step.call( this.elem, this.now, this ); 13381 } 13382 13383 if ( hooks && hooks.set ) { 13384 hooks.set( this ); 13385 } else { 13386 Tween.propHooks._default.set( this ); 13387 } 13388 return this; 13389 } 13390}; 13391 13392Tween.prototype.init.prototype = Tween.prototype; 13393 13394Tween.propHooks = { 13395 _default: { 13396 get: function( tween ) { 13397 var result; 13398 13399 // Use a property on the element directly when it is not a DOM element, 13400 // or when there is no matching style property that exists. 13401 if ( tween.elem.nodeType !== 1 || 13402 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 13403 return tween.elem[ tween.prop ]; 13404 } 13405 13406 // Passing an empty string as a 3rd parameter to .css will automatically 13407 // attempt a parseFloat and fallback to a string if the parse fails. 13408 // Simple values such as "10px" are parsed to Float; 13409 // complex values such as "rotate(1rad)" are returned as-is. 13410 result = jQuery.css( tween.elem, tween.prop, "" ); 13411 13412 // Empty strings, null, undefined and "auto" are converted to 0. 13413 return !result || result === "auto" ? 0 : result; 13414 }, 13415 set: function( tween ) { 13416 13417 // Use step hook for back compat. 13418 // Use cssHook if its there. 13419 // Use .style if available and use plain properties where available. 13420 if ( jQuery.fx.step[ tween.prop ] ) { 13421 jQuery.fx.step[ tween.prop ]( tween ); 13422 } else if ( tween.elem.nodeType === 1 && ( 13423 jQuery.cssHooks[ tween.prop ] || 13424 tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { 13425 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 13426 } else { 13427 tween.elem[ tween.prop ] = tween.now; 13428 } 13429 } 13430 } 13431}; 13432 13433// Support: IE <=9 only 13434// Panic based approach to setting things on disconnected nodes 13435Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 13436 set: function( tween ) { 13437 if ( tween.elem.nodeType && tween.elem.parentNode ) { 13438 tween.elem[ tween.prop ] = tween.now; 13439 } 13440 } 13441}; 13442 13443jQuery.easing = { 13444 linear: function( p ) { 13445 return p; 13446 }, 13447 swing: function( p ) { 13448 return 0.5 - Math.cos( p * Math.PI ) / 2; 13449 }, 13450 _default: "swing" 13451}; 13452 13453jQuery.fx = Tween.prototype.init; 13454 13455// Back compat <1.8 extension point 13456jQuery.fx.step = {}; 13457 13458 13459 13460 13461var 13462 fxNow, inProgress, 13463 rfxtypes = /^(?:toggle|show|hide)$/, 13464 rrun = /queueHooks$/; 13465 13466function schedule() { 13467 if ( inProgress ) { 13468 if ( document.hidden === false && window.requestAnimationFrame ) { 13469 window.requestAnimationFrame( schedule ); 13470 } else { 13471 window.setTimeout( schedule, jQuery.fx.interval ); 13472 } 13473 13474 jQuery.fx.tick(); 13475 } 13476} 13477 13478// Animations created synchronously will run synchronously 13479function createFxNow() { 13480 window.setTimeout( function() { 13481 fxNow = undefined; 13482 } ); 13483 return ( fxNow = Date.now() ); 13484} 13485 13486// Generate parameters to create a standard animation 13487function genFx( type, includeWidth ) { 13488 var which, 13489 i = 0, 13490 attrs = { height: type }; 13491 13492 // If we include width, step value is 1 to do all cssExpand values, 13493 // otherwise step value is 2 to skip over Left and Right 13494 includeWidth = includeWidth ? 1 : 0; 13495 for ( ; i < 4; i += 2 - includeWidth ) { 13496 which = cssExpand[ i ]; 13497 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 13498 } 13499 13500 if ( includeWidth ) { 13501 attrs.opacity = attrs.width = type; 13502 } 13503 13504 return attrs; 13505} 13506 13507function createTween( value, prop, animation ) { 13508 var tween, 13509 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 13510 index = 0, 13511 length = collection.length; 13512 for ( ; index < length; index++ ) { 13513 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 13514 13515 // We're done with this property 13516 return tween; 13517 } 13518 } 13519} 13520 13521function defaultPrefilter( elem, props, opts ) { 13522 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 13523 isBox = "width" in props || "height" in props, 13524 anim = this, 13525 orig = {}, 13526 style = elem.style, 13527 hidden = elem.nodeType && isHiddenWithinTree( elem ), 13528 dataShow = dataPriv.get( elem, "fxshow" ); 13529 13530 // Queue-skipping animations hijack the fx hooks 13531 if ( !opts.queue ) { 13532 hooks = jQuery._queueHooks( elem, "fx" ); 13533 if ( hooks.unqueued == null ) { 13534 hooks.unqueued = 0; 13535 oldfire = hooks.empty.fire; 13536 hooks.empty.fire = function() { 13537 if ( !hooks.unqueued ) { 13538 oldfire(); 13539 } 13540 }; 13541 } 13542 hooks.unqueued++; 13543 13544 anim.always( function() { 13545 13546 // Ensure the complete handler is called before this completes 13547 anim.always( function() { 13548 hooks.unqueued--; 13549 if ( !jQuery.queue( elem, "fx" ).length ) { 13550 hooks.empty.fire(); 13551 } 13552 } ); 13553 } ); 13554 } 13555 13556 // Detect show/hide animations 13557 for ( prop in props ) { 13558 value = props[ prop ]; 13559 if ( rfxtypes.test( value ) ) { 13560 delete props[ prop ]; 13561 toggle = toggle || value === "toggle"; 13562 if ( value === ( hidden ? "hide" : "show" ) ) { 13563 13564 // Pretend to be hidden if this is a "show" and 13565 // there is still data from a stopped show/hide 13566 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 13567 hidden = true; 13568 13569 // Ignore all other no-op show/hide data 13570 } else { 13571 continue; 13572 } 13573 } 13574 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 13575 } 13576 } 13577 13578 // Bail out if this is a no-op like .hide().hide() 13579 propTween = !jQuery.isEmptyObject( props ); 13580 if ( !propTween && jQuery.isEmptyObject( orig ) ) { 13581 return; 13582 } 13583 13584 // Restrict "overflow" and "display" styles during box animations 13585 if ( isBox && elem.nodeType === 1 ) { 13586 13587 // Support: IE <=9 - 11, Edge 12 - 15 13588 // Record all 3 overflow attributes because IE does not infer the shorthand 13589 // from identically-valued overflowX and overflowY and Edge just mirrors 13590 // the overflowX value there. 13591 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 13592 13593 // Identify a display type, preferring old show/hide data over the CSS cascade 13594 restoreDisplay = dataShow && dataShow.display; 13595 if ( restoreDisplay == null ) { 13596 restoreDisplay = dataPriv.get( elem, "display" ); 13597 } 13598 display = jQuery.css( elem, "display" ); 13599 if ( display === "none" ) { 13600 if ( restoreDisplay ) { 13601 display = restoreDisplay; 13602 } else { 13603 13604 // Get nonempty value(s) by temporarily forcing visibility 13605 showHide( [ elem ], true ); 13606 restoreDisplay = elem.style.display || restoreDisplay; 13607 display = jQuery.css( elem, "display" ); 13608 showHide( [ elem ] ); 13609 } 13610 } 13611 13612 // Animate inline elements as inline-block 13613 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { 13614 if ( jQuery.css( elem, "float" ) === "none" ) { 13615 13616 // Restore the original display value at the end of pure show/hide animations 13617 if ( !propTween ) { 13618 anim.done( function() { 13619 style.display = restoreDisplay; 13620 } ); 13621 if ( restoreDisplay == null ) { 13622 display = style.display; 13623 restoreDisplay = display === "none" ? "" : display; 13624 } 13625 } 13626 style.display = "inline-block"; 13627 } 13628 } 13629 } 13630 13631 if ( opts.overflow ) { 13632 style.overflow = "hidden"; 13633 anim.always( function() { 13634 style.overflow = opts.overflow[ 0 ]; 13635 style.overflowX = opts.overflow[ 1 ]; 13636 style.overflowY = opts.overflow[ 2 ]; 13637 } ); 13638 } 13639 13640 // Implement show/hide animations 13641 propTween = false; 13642 for ( prop in orig ) { 13643 13644 // General show/hide setup for this element animation 13645 if ( !propTween ) { 13646 if ( dataShow ) { 13647 if ( "hidden" in dataShow ) { 13648 hidden = dataShow.hidden; 13649 } 13650 } else { 13651 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); 13652 } 13653 13654 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 13655 if ( toggle ) { 13656 dataShow.hidden = !hidden; 13657 } 13658 13659 // Show elements before animating them 13660 if ( hidden ) { 13661 showHide( [ elem ], true ); 13662 } 13663 13664 /* eslint-disable no-loop-func */ 13665 13666 anim.done( function() { 13667 13668 /* eslint-enable no-loop-func */ 13669 13670 // The final step of a "hide" animation is actually hiding the element 13671 if ( !hidden ) { 13672 showHide( [ elem ] ); 13673 } 13674 dataPriv.remove( elem, "fxshow" ); 13675 for ( prop in orig ) { 13676 jQuery.style( elem, prop, orig[ prop ] ); 13677 } 13678 } ); 13679 } 13680 13681 // Per-property setup 13682 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 13683 if ( !( prop in dataShow ) ) { 13684 dataShow[ prop ] = propTween.start; 13685 if ( hidden ) { 13686 propTween.end = propTween.start; 13687 propTween.start = 0; 13688 } 13689 } 13690 } 13691} 13692 13693function propFilter( props, specialEasing ) { 13694 var index, name, easing, value, hooks; 13695 13696 // camelCase, specialEasing and expand cssHook pass 13697 for ( index in props ) { 13698 name = camelCase( index ); 13699 easing = specialEasing[ name ]; 13700 value = props[ index ]; 13701 if ( Array.isArray( value ) ) { 13702 easing = value[ 1 ]; 13703 value = props[ index ] = value[ 0 ]; 13704 } 13705 13706 if ( index !== name ) { 13707 props[ name ] = value; 13708 delete props[ index ]; 13709 } 13710 13711 hooks = jQuery.cssHooks[ name ]; 13712 if ( hooks && "expand" in hooks ) { 13713 value = hooks.expand( value ); 13714 delete props[ name ]; 13715 13716 // Not quite $.extend, this won't overwrite existing keys. 13717 // Reusing 'index' because we have the correct "name" 13718 for ( index in value ) { 13719 if ( !( index in props ) ) { 13720 props[ index ] = value[ index ]; 13721 specialEasing[ index ] = easing; 13722 } 13723 } 13724 } else { 13725 specialEasing[ name ] = easing; 13726 } 13727 } 13728} 13729 13730function Animation( elem, properties, options ) { 13731 var result, 13732 stopped, 13733 index = 0, 13734 length = Animation.prefilters.length, 13735 deferred = jQuery.Deferred().always( function() { 13736 13737 // Don't match elem in the :animated selector 13738 delete tick.elem; 13739 } ), 13740 tick = function() { 13741 if ( stopped ) { 13742 return false; 13743 } 13744 var currentTime = fxNow || createFxNow(), 13745 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 13746 13747 // Support: Android 2.3 only 13748 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) 13749 temp = remaining / animation.duration || 0, 13750 percent = 1 - temp, 13751 index = 0, 13752 length = animation.tweens.length; 13753 13754 for ( ; index < length; index++ ) { 13755 animation.tweens[ index ].run( percent ); 13756 } 13757 13758 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 13759 13760 // If there's more to do, yield 13761 if ( percent < 1 && length ) { 13762 return remaining; 13763 } 13764 13765 // If this was an empty animation, synthesize a final progress notification 13766 if ( !length ) { 13767 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 13768 } 13769 13770 // Resolve the animation and report its conclusion 13771 deferred.resolveWith( elem, [ animation ] ); 13772 return false; 13773 }, 13774 animation = deferred.promise( { 13775 elem: elem, 13776 props: jQuery.extend( {}, properties ), 13777 opts: jQuery.extend( true, { 13778 specialEasing: {}, 13779 easing: jQuery.easing._default 13780 }, options ), 13781 originalProperties: properties, 13782 originalOptions: options, 13783 startTime: fxNow || createFxNow(), 13784 duration: options.duration, 13785 tweens: [], 13786 createTween: function( prop, end ) { 13787 var tween = jQuery.Tween( elem, animation.opts, prop, end, 13788 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 13789 animation.tweens.push( tween ); 13790 return tween; 13791 }, 13792 stop: function( gotoEnd ) { 13793 var index = 0, 13794 13795 // If we are going to the end, we want to run all the tweens 13796 // otherwise we skip this part 13797 length = gotoEnd ? animation.tweens.length : 0; 13798 if ( stopped ) { 13799 return this; 13800 } 13801 stopped = true; 13802 for ( ; index < length; index++ ) { 13803 animation.tweens[ index ].run( 1 ); 13804 } 13805 13806 // Resolve when we played the last frame; otherwise, reject 13807 if ( gotoEnd ) { 13808 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 13809 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 13810 } else { 13811 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 13812 } 13813 return this; 13814 } 13815 } ), 13816 props = animation.props; 13817 13818 propFilter( props, animation.opts.specialEasing ); 13819 13820 for ( ; index < length; index++ ) { 13821 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 13822 if ( result ) { 13823 if ( isFunction( result.stop ) ) { 13824 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 13825 result.stop.bind( result ); 13826 } 13827 return result; 13828 } 13829 } 13830 13831 jQuery.map( props, createTween, animation ); 13832 13833 if ( isFunction( animation.opts.start ) ) { 13834 animation.opts.start.call( elem, animation ); 13835 } 13836 13837 // Attach callbacks from options 13838 animation 13839 .progress( animation.opts.progress ) 13840 .done( animation.opts.done, animation.opts.complete ) 13841 .fail( animation.opts.fail ) 13842 .always( animation.opts.always ); 13843 13844 jQuery.fx.timer( 13845 jQuery.extend( tick, { 13846 elem: elem, 13847 anim: animation, 13848 queue: animation.opts.queue 13849 } ) 13850 ); 13851 13852 return animation; 13853} 13854 13855jQuery.Animation = jQuery.extend( Animation, { 13856 13857 tweeners: { 13858 "*": [ function( prop, value ) { 13859 var tween = this.createTween( prop, value ); 13860 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 13861 return tween; 13862 } ] 13863 }, 13864 13865 tweener: function( props, callback ) { 13866 if ( isFunction( props ) ) { 13867 callback = props; 13868 props = [ "*" ]; 13869 } else { 13870 props = props.match( rnothtmlwhite ); 13871 } 13872 13873 var prop, 13874 index = 0, 13875 length = props.length; 13876 13877 for ( ; index < length; index++ ) { 13878 prop = props[ index ]; 13879 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 13880 Animation.tweeners[ prop ].unshift( callback ); 13881 } 13882 }, 13883 13884 prefilters: [ defaultPrefilter ], 13885 13886 prefilter: function( callback, prepend ) { 13887 if ( prepend ) { 13888 Animation.prefilters.unshift( callback ); 13889 } else { 13890 Animation.prefilters.push( callback ); 13891 } 13892 } 13893} ); 13894 13895jQuery.speed = function( speed, easing, fn ) { 13896 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 13897 complete: fn || !fn && easing || 13898 isFunction( speed ) && speed, 13899 duration: speed, 13900 easing: fn && easing || easing && !isFunction( easing ) && easing 13901 }; 13902 13903 // Go to the end state if fx are off 13904 if ( jQuery.fx.off ) { 13905 opt.duration = 0; 13906 13907 } else { 13908 if ( typeof opt.duration !== "number" ) { 13909 if ( opt.duration in jQuery.fx.speeds ) { 13910 opt.duration = jQuery.fx.speeds[ opt.duration ]; 13911 13912 } else { 13913 opt.duration = jQuery.fx.speeds._default; 13914 } 13915 } 13916 } 13917 13918 // Normalize opt.queue - true/undefined/null -> "fx" 13919 if ( opt.queue == null || opt.queue === true ) { 13920 opt.queue = "fx"; 13921 } 13922 13923 // Queueing 13924 opt.old = opt.complete; 13925 13926 opt.complete = function() { 13927 if ( isFunction( opt.old ) ) { 13928 opt.old.call( this ); 13929 } 13930 13931 if ( opt.queue ) { 13932 jQuery.dequeue( this, opt.queue ); 13933 } 13934 }; 13935 13936 return opt; 13937}; 13938 13939jQuery.fn.extend( { 13940 fadeTo: function( speed, to, easing, callback ) { 13941 13942 // Show any hidden elements after setting opacity to 0 13943 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() 13944 13945 // Animate to the value specified 13946 .end().animate( { opacity: to }, speed, easing, callback ); 13947 }, 13948 animate: function( prop, speed, easing, callback ) { 13949 var empty = jQuery.isEmptyObject( prop ), 13950 optall = jQuery.speed( speed, easing, callback ), 13951 doAnimation = function() { 13952 13953 // Operate on a copy of prop so per-property easing won't be lost 13954 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 13955 13956 // Empty animations, or finishing resolves immediately 13957 if ( empty || dataPriv.get( this, "finish" ) ) { 13958 anim.stop( true ); 13959 } 13960 }; 13961 doAnimation.finish = doAnimation; 13962 13963 return empty || optall.queue === false ? 13964 this.each( doAnimation ) : 13965 this.queue( optall.queue, doAnimation ); 13966 }, 13967 stop: function( type, clearQueue, gotoEnd ) { 13968 var stopQueue = function( hooks ) { 13969 var stop = hooks.stop; 13970 delete hooks.stop; 13971 stop( gotoEnd ); 13972 }; 13973 13974 if ( typeof type !== "string" ) { 13975 gotoEnd = clearQueue; 13976 clearQueue = type; 13977 type = undefined; 13978 } 13979 if ( clearQueue && type !== false ) { 13980 this.queue( type || "fx", [] ); 13981 } 13982 13983 return this.each( function() { 13984 var dequeue = true, 13985 index = type != null && type + "queueHooks", 13986 timers = jQuery.timers, 13987 data = dataPriv.get( this ); 13988 13989 if ( index ) { 13990 if ( data[ index ] && data[ index ].stop ) { 13991 stopQueue( data[ index ] ); 13992 } 13993 } else { 13994 for ( index in data ) { 13995 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 13996 stopQueue( data[ index ] ); 13997 } 13998 } 13999 } 14000 14001 for ( index = timers.length; index--; ) { 14002 if ( timers[ index ].elem === this && 14003 ( type == null || timers[ index ].queue === type ) ) { 14004 14005 timers[ index ].anim.stop( gotoEnd ); 14006 dequeue = false; 14007 timers.splice( index, 1 ); 14008 } 14009 } 14010 14011 // Start the next in the queue if the last step wasn't forced. 14012 // Timers currently will call their complete callbacks, which 14013 // will dequeue but only if they were gotoEnd. 14014 if ( dequeue || !gotoEnd ) { 14015 jQuery.dequeue( this, type ); 14016 } 14017 } ); 14018 }, 14019 finish: function( type ) { 14020 if ( type !== false ) { 14021 type = type || "fx"; 14022 } 14023 return this.each( function() { 14024 var index, 14025 data = dataPriv.get( this ), 14026 queue = data[ type + "queue" ], 14027 hooks = data[ type + "queueHooks" ], 14028 timers = jQuery.timers, 14029 length = queue ? queue.length : 0; 14030 14031 // Enable finishing flag on private data 14032 data.finish = true; 14033 14034 // Empty the queue first 14035 jQuery.queue( this, type, [] ); 14036 14037 if ( hooks && hooks.stop ) { 14038 hooks.stop.call( this, true ); 14039 } 14040 14041 // Look for any active animations, and finish them 14042 for ( index = timers.length; index--; ) { 14043 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 14044 timers[ index ].anim.stop( true ); 14045 timers.splice( index, 1 ); 14046 } 14047 } 14048 14049 // Look for any animations in the old queue and finish them 14050 for ( index = 0; index < length; index++ ) { 14051 if ( queue[ index ] && queue[ index ].finish ) { 14052 queue[ index ].finish.call( this ); 14053 } 14054 } 14055 14056 // Turn off finishing flag 14057 delete data.finish; 14058 } ); 14059 } 14060} ); 14061 14062jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { 14063 var cssFn = jQuery.fn[ name ]; 14064 jQuery.fn[ name ] = function( speed, easing, callback ) { 14065 return speed == null || typeof speed === "boolean" ? 14066 cssFn.apply( this, arguments ) : 14067 this.animate( genFx( name, true ), speed, easing, callback ); 14068 }; 14069} ); 14070 14071// Generate shortcuts for custom animations 14072jQuery.each( { 14073 slideDown: genFx( "show" ), 14074 slideUp: genFx( "hide" ), 14075 slideToggle: genFx( "toggle" ), 14076 fadeIn: { opacity: "show" }, 14077 fadeOut: { opacity: "hide" }, 14078 fadeToggle: { opacity: "toggle" } 14079}, function( name, props ) { 14080 jQuery.fn[ name ] = function( speed, easing, callback ) { 14081 return this.animate( props, speed, easing, callback ); 14082 }; 14083} ); 14084 14085jQuery.timers = []; 14086jQuery.fx.tick = function() { 14087 var timer, 14088 i = 0, 14089 timers = jQuery.timers; 14090 14091 fxNow = Date.now(); 14092 14093 for ( ; i < timers.length; i++ ) { 14094 timer = timers[ i ]; 14095 14096 // Run the timer and safely remove it when done (allowing for external removal) 14097 if ( !timer() && timers[ i ] === timer ) { 14098 timers.splice( i--, 1 ); 14099 } 14100 } 14101 14102 if ( !timers.length ) { 14103 jQuery.fx.stop(); 14104 } 14105 fxNow = undefined; 14106}; 14107 14108jQuery.fx.timer = function( timer ) { 14109 jQuery.timers.push( timer ); 14110 jQuery.fx.start(); 14111}; 14112 14113jQuery.fx.interval = 13; 14114jQuery.fx.start = function() { 14115 if ( inProgress ) { 14116 return; 14117 } 14118 14119 inProgress = true; 14120 schedule(); 14121}; 14122 14123jQuery.fx.stop = function() { 14124 inProgress = null; 14125}; 14126 14127jQuery.fx.speeds = { 14128 slow: 600, 14129 fast: 200, 14130 14131 // Default speed 14132 _default: 400 14133}; 14134 14135 14136// Based off of the plugin by Clint Helfers, with permission. 14137// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ 14138jQuery.fn.delay = function( time, type ) { 14139 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 14140 type = type || "fx"; 14141 14142 return this.queue( type, function( next, hooks ) { 14143 var timeout = window.setTimeout( next, time ); 14144 hooks.stop = function() { 14145 window.clearTimeout( timeout ); 14146 }; 14147 } ); 14148}; 14149 14150 14151( function() { 14152 var input = document.createElement( "input" ), 14153 select = document.createElement( "select" ), 14154 opt = select.appendChild( document.createElement( "option" ) ); 14155 14156 input.type = "checkbox"; 14157 14158 // Support: Android <=4.3 only 14159 // Default value for a checkbox should be "on" 14160 support.checkOn = input.value !== ""; 14161 14162 // Support: IE <=11 only 14163 // Must access selectedIndex to make default options select 14164 support.optSelected = opt.selected; 14165 14166 // Support: IE <=11 only 14167 // An input loses its value after becoming a radio 14168 input = document.createElement( "input" ); 14169 input.value = "t"; 14170 input.type = "radio"; 14171 support.radioValue = input.value === "t"; 14172} )(); 14173 14174 14175var boolHook, 14176 attrHandle = jQuery.expr.attrHandle; 14177 14178jQuery.fn.extend( { 14179 attr: function( name, value ) { 14180 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 14181 }, 14182 14183 removeAttr: function( name ) { 14184 return this.each( function() { 14185 jQuery.removeAttr( this, name ); 14186 } ); 14187 } 14188} ); 14189 14190jQuery.extend( { 14191 attr: function( elem, name, value ) { 14192 var ret, hooks, 14193 nType = elem.nodeType; 14194 14195 // Don't get/set attributes on text, comment and attribute nodes 14196 if ( nType === 3 || nType === 8 || nType === 2 ) { 14197 return; 14198 } 14199 14200 // Fallback to prop when attributes are not supported 14201 if ( typeof elem.getAttribute === "undefined" ) { 14202 return jQuery.prop( elem, name, value ); 14203 } 14204 14205 // Attribute hooks are determined by the lowercase version 14206 // Grab necessary hook if one is defined 14207 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 14208 hooks = jQuery.attrHooks[ name.toLowerCase() ] || 14209 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 14210 } 14211 14212 if ( value !== undefined ) { 14213 if ( value === null ) { 14214 jQuery.removeAttr( elem, name ); 14215 return; 14216 } 14217 14218 if ( hooks && "set" in hooks && 14219 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 14220 return ret; 14221 } 14222 14223 elem.setAttribute( name, value + "" ); 14224 return value; 14225 } 14226 14227 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 14228 return ret; 14229 } 14230 14231 ret = jQuery.find.attr( elem, name ); 14232 14233 // Non-existent attributes return null, we normalize to undefined 14234 return ret == null ? undefined : ret; 14235 }, 14236 14237 attrHooks: { 14238 type: { 14239 set: function( elem, value ) { 14240 if ( !support.radioValue && value === "radio" && 14241 nodeName( elem, "input" ) ) { 14242 var val = elem.value; 14243 elem.setAttribute( "type", value ); 14244 if ( val ) { 14245 elem.value = val; 14246 } 14247 return value; 14248 } 14249 } 14250 } 14251 }, 14252 14253 removeAttr: function( elem, value ) { 14254 var name, 14255 i = 0, 14256 14257 // Attribute names can contain non-HTML whitespace characters 14258 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 14259 attrNames = value && value.match( rnothtmlwhite ); 14260 14261 if ( attrNames && elem.nodeType === 1 ) { 14262 while ( ( name = attrNames[ i++ ] ) ) { 14263 elem.removeAttribute( name ); 14264 } 14265 } 14266 } 14267} ); 14268 14269// Hooks for boolean attributes 14270boolHook = { 14271 set: function( elem, value, name ) { 14272 if ( value === false ) { 14273 14274 // Remove boolean attributes when set to false 14275 jQuery.removeAttr( elem, name ); 14276 } else { 14277 elem.setAttribute( name, name ); 14278 } 14279 return name; 14280 } 14281}; 14282 14283jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { 14284 var getter = attrHandle[ name ] || jQuery.find.attr; 14285 14286 attrHandle[ name ] = function( elem, name, isXML ) { 14287 var ret, handle, 14288 lowercaseName = name.toLowerCase(); 14289 14290 if ( !isXML ) { 14291 14292 // Avoid an infinite loop by temporarily removing this function from the getter 14293 handle = attrHandle[ lowercaseName ]; 14294 attrHandle[ lowercaseName ] = ret; 14295 ret = getter( elem, name, isXML ) != null ? 14296 lowercaseName : 14297 null; 14298 attrHandle[ lowercaseName ] = handle; 14299 } 14300 return ret; 14301 }; 14302} ); 14303 14304 14305 14306 14307var rfocusable = /^(?:input|select|textarea|button)$/i, 14308 rclickable = /^(?:a|area)$/i; 14309 14310jQuery.fn.extend( { 14311 prop: function( name, value ) { 14312 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 14313 }, 14314 14315 removeProp: function( name ) { 14316 return this.each( function() { 14317 delete this[ jQuery.propFix[ name ] || name ]; 14318 } ); 14319 } 14320} ); 14321 14322jQuery.extend( { 14323 prop: function( elem, name, value ) { 14324 var ret, hooks, 14325 nType = elem.nodeType; 14326 14327 // Don't get/set properties on text, comment and attribute nodes 14328 if ( nType === 3 || nType === 8 || nType === 2 ) { 14329 return; 14330 } 14331 14332 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 14333 14334 // Fix name and attach hooks 14335 name = jQuery.propFix[ name ] || name; 14336 hooks = jQuery.propHooks[ name ]; 14337 } 14338 14339 if ( value !== undefined ) { 14340 if ( hooks && "set" in hooks && 14341 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 14342 return ret; 14343 } 14344 14345 return ( elem[ name ] = value ); 14346 } 14347 14348 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 14349 return ret; 14350 } 14351 14352 return elem[ name ]; 14353 }, 14354 14355 propHooks: { 14356 tabIndex: { 14357 get: function( elem ) { 14358 14359 // Support: IE <=9 - 11 only 14360 // elem.tabIndex doesn't always return the 14361 // correct value when it hasn't been explicitly set 14362 // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 14363 // Use proper attribute retrieval(#12072) 14364 var tabindex = jQuery.find.attr( elem, "tabindex" ); 14365 14366 if ( tabindex ) { 14367 return parseInt( tabindex, 10 ); 14368 } 14369 14370 if ( 14371 rfocusable.test( elem.nodeName ) || 14372 rclickable.test( elem.nodeName ) && 14373 elem.href 14374 ) { 14375 return 0; 14376 } 14377 14378 return -1; 14379 } 14380 } 14381 }, 14382 14383 propFix: { 14384 "for": "htmlFor", 14385 "class": "className" 14386 } 14387} ); 14388 14389// Support: IE <=11 only 14390// Accessing the selectedIndex property 14391// forces the browser to respect setting selected 14392// on the option 14393// The getter ensures a default option is selected 14394// when in an optgroup 14395// eslint rule "no-unused-expressions" is disabled for this code 14396// since it considers such accessions noop 14397if ( !support.optSelected ) { 14398 jQuery.propHooks.selected = { 14399 get: function( elem ) { 14400 14401 /* eslint no-unused-expressions: "off" */ 14402 14403 var parent = elem.parentNode; 14404 if ( parent && parent.parentNode ) { 14405 parent.parentNode.selectedIndex; 14406 } 14407 return null; 14408 }, 14409 set: function( elem ) { 14410 14411 /* eslint no-unused-expressions: "off" */ 14412 14413 var parent = elem.parentNode; 14414 if ( parent ) { 14415 parent.selectedIndex; 14416 14417 if ( parent.parentNode ) { 14418 parent.parentNode.selectedIndex; 14419 } 14420 } 14421 } 14422 }; 14423} 14424 14425jQuery.each( [ 14426 "tabIndex", 14427 "readOnly", 14428 "maxLength", 14429 "cellSpacing", 14430 "cellPadding", 14431 "rowSpan", 14432 "colSpan", 14433 "useMap", 14434 "frameBorder", 14435 "contentEditable" 14436], function() { 14437 jQuery.propFix[ this.toLowerCase() ] = this; 14438} ); 14439 14440 14441 14442 14443 // Strip and collapse whitespace according to HTML spec 14444 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 14445 function stripAndCollapse( value ) { 14446 var tokens = value.match( rnothtmlwhite ) || []; 14447 return tokens.join( " " ); 14448 } 14449 14450 14451function getClass( elem ) { 14452 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 14453} 14454 14455function classesToArray( value ) { 14456 if ( Array.isArray( value ) ) { 14457 return value; 14458 } 14459 if ( typeof value === "string" ) { 14460 return value.match( rnothtmlwhite ) || []; 14461 } 14462 return []; 14463} 14464 14465jQuery.fn.extend( { 14466 addClass: function( value ) { 14467 var classes, elem, cur, curValue, clazz, j, finalValue, 14468 i = 0; 14469 14470 if ( isFunction( value ) ) { 14471 return this.each( function( j ) { 14472 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 14473 } ); 14474 } 14475 14476 classes = classesToArray( value ); 14477 14478 if ( classes.length ) { 14479 while ( ( elem = this[ i++ ] ) ) { 14480 curValue = getClass( elem ); 14481 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 14482 14483 if ( cur ) { 14484 j = 0; 14485 while ( ( clazz = classes[ j++ ] ) ) { 14486 if ( cur.indexOf( " " + clazz + " " ) < 0 ) { 14487 cur += clazz + " "; 14488 } 14489 } 14490 14491 // Only assign if different to avoid unneeded rendering. 14492 finalValue = stripAndCollapse( cur ); 14493 if ( curValue !== finalValue ) { 14494 elem.setAttribute( "class", finalValue ); 14495 } 14496 } 14497 } 14498 } 14499 14500 return this; 14501 }, 14502 14503 removeClass: function( value ) { 14504 var classes, elem, cur, curValue, clazz, j, finalValue, 14505 i = 0; 14506 14507 if ( isFunction( value ) ) { 14508 return this.each( function( j ) { 14509 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 14510 } ); 14511 } 14512 14513 if ( !arguments.length ) { 14514 return this.attr( "class", "" ); 14515 } 14516 14517 classes = classesToArray( value ); 14518 14519 if ( classes.length ) { 14520 while ( ( elem = this[ i++ ] ) ) { 14521 curValue = getClass( elem ); 14522 14523 // This expression is here for better compressibility (see addClass) 14524 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 14525 14526 if ( cur ) { 14527 j = 0; 14528 while ( ( clazz = classes[ j++ ] ) ) { 14529 14530 // Remove *all* instances 14531 while ( cur.indexOf( " " + clazz + " " ) > -1 ) { 14532 cur = cur.replace( " " + clazz + " ", " " ); 14533 } 14534 } 14535 14536 // Only assign if different to avoid unneeded rendering. 14537 finalValue = stripAndCollapse( cur ); 14538 if ( curValue !== finalValue ) { 14539 elem.setAttribute( "class", finalValue ); 14540 } 14541 } 14542 } 14543 } 14544 14545 return this; 14546 }, 14547 14548 toggleClass: function( value, stateVal ) { 14549 var type = typeof value, 14550 isValidValue = type === "string" || Array.isArray( value ); 14551 14552 if ( typeof stateVal === "boolean" && isValidValue ) { 14553 return stateVal ? this.addClass( value ) : this.removeClass( value ); 14554 } 14555 14556 if ( isFunction( value ) ) { 14557 return this.each( function( i ) { 14558 jQuery( this ).toggleClass( 14559 value.call( this, i, getClass( this ), stateVal ), 14560 stateVal 14561 ); 14562 } ); 14563 } 14564 14565 return this.each( function() { 14566 var className, i, self, classNames; 14567 14568 if ( isValidValue ) { 14569 14570 // Toggle individual class names 14571 i = 0; 14572 self = jQuery( this ); 14573 classNames = classesToArray( value ); 14574 14575 while ( ( className = classNames[ i++ ] ) ) { 14576 14577 // Check each className given, space separated list 14578 if ( self.hasClass( className ) ) { 14579 self.removeClass( className ); 14580 } else { 14581 self.addClass( className ); 14582 } 14583 } 14584 14585 // Toggle whole class name 14586 } else if ( value === undefined || type === "boolean" ) { 14587 className = getClass( this ); 14588 if ( className ) { 14589 14590 // Store className if set 14591 dataPriv.set( this, "__className__", className ); 14592 } 14593 14594 // If the element has a class name or if we're passed `false`, 14595 // then remove the whole classname (if there was one, the above saved it). 14596 // Otherwise bring back whatever was previously saved (if anything), 14597 // falling back to the empty string if nothing was stored. 14598 if ( this.setAttribute ) { 14599 this.setAttribute( "class", 14600 className || value === false ? 14601 "" : 14602 dataPriv.get( this, "__className__" ) || "" 14603 ); 14604 } 14605 } 14606 } ); 14607 }, 14608 14609 hasClass: function( selector ) { 14610 var className, elem, 14611 i = 0; 14612 14613 className = " " + selector + " "; 14614 while ( ( elem = this[ i++ ] ) ) { 14615 if ( elem.nodeType === 1 && 14616 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { 14617 return true; 14618 } 14619 } 14620 14621 return false; 14622 } 14623} ); 14624 14625 14626 14627 14628var rreturn = /\r/g; 14629 14630jQuery.fn.extend( { 14631 val: function( value ) { 14632 var hooks, ret, valueIsFunction, 14633 elem = this[ 0 ]; 14634 14635 if ( !arguments.length ) { 14636 if ( elem ) { 14637 hooks = jQuery.valHooks[ elem.type ] || 14638 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 14639 14640 if ( hooks && 14641 "get" in hooks && 14642 ( ret = hooks.get( elem, "value" ) ) !== undefined 14643 ) { 14644 return ret; 14645 } 14646 14647 ret = elem.value; 14648 14649 // Handle most common string cases 14650 if ( typeof ret === "string" ) { 14651 return ret.replace( rreturn, "" ); 14652 } 14653 14654 // Handle cases where value is null/undef or number 14655 return ret == null ? "" : ret; 14656 } 14657 14658 return; 14659 } 14660 14661 valueIsFunction = isFunction( value ); 14662 14663 return this.each( function( i ) { 14664 var val; 14665 14666 if ( this.nodeType !== 1 ) { 14667 return; 14668 } 14669 14670 if ( valueIsFunction ) { 14671 val = value.call( this, i, jQuery( this ).val() ); 14672 } else { 14673 val = value; 14674 } 14675 14676 // Treat null/undefined as ""; convert numbers to string 14677 if ( val == null ) { 14678 val = ""; 14679 14680 } else if ( typeof val === "number" ) { 14681 val += ""; 14682 14683 } else if ( Array.isArray( val ) ) { 14684 val = jQuery.map( val, function( value ) { 14685 return value == null ? "" : value + ""; 14686 } ); 14687 } 14688 14689 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 14690 14691 // If set returns undefined, fall back to normal setting 14692 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 14693 this.value = val; 14694 } 14695 } ); 14696 } 14697} ); 14698 14699jQuery.extend( { 14700 valHooks: { 14701 option: { 14702 get: function( elem ) { 14703 14704 var val = jQuery.find.attr( elem, "value" ); 14705 return val != null ? 14706 val : 14707 14708 // Support: IE <=10 - 11 only 14709 // option.text throws exceptions (#14686, #14858) 14710 // Strip and collapse whitespace 14711 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 14712 stripAndCollapse( jQuery.text( elem ) ); 14713 } 14714 }, 14715 select: { 14716 get: function( elem ) { 14717 var value, option, i, 14718 options = elem.options, 14719 index = elem.selectedIndex, 14720 one = elem.type === "select-one", 14721 values = one ? null : [], 14722 max = one ? index + 1 : options.length; 14723 14724 if ( index < 0 ) { 14725 i = max; 14726 14727 } else { 14728 i = one ? index : 0; 14729 } 14730 14731 // Loop through all the selected options 14732 for ( ; i < max; i++ ) { 14733 option = options[ i ]; 14734 14735 // Support: IE <=9 only 14736 // IE8-9 doesn't update selected after form reset (#2551) 14737 if ( ( option.selected || i === index ) && 14738 14739 // Don't return options that are disabled or in a disabled optgroup 14740 !option.disabled && 14741 ( !option.parentNode.disabled || 14742 !nodeName( option.parentNode, "optgroup" ) ) ) { 14743 14744 // Get the specific value for the option 14745 value = jQuery( option ).val(); 14746 14747 // We don't need an array for one selects 14748 if ( one ) { 14749 return value; 14750 } 14751 14752 // Multi-Selects return an array 14753 values.push( value ); 14754 } 14755 } 14756 14757 return values; 14758 }, 14759 14760 set: function( elem, value ) { 14761 var optionSet, option, 14762 options = elem.options, 14763 values = jQuery.makeArray( value ), 14764 i = options.length; 14765 14766 while ( i-- ) { 14767 option = options[ i ]; 14768 14769 /* eslint-disable no-cond-assign */ 14770 14771 if ( option.selected = 14772 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 14773 ) { 14774 optionSet = true; 14775 } 14776 14777 /* eslint-enable no-cond-assign */ 14778 } 14779 14780 // Force browsers to behave consistently when non-matching value is set 14781 if ( !optionSet ) { 14782 elem.selectedIndex = -1; 14783 } 14784 return values; 14785 } 14786 } 14787 } 14788} ); 14789 14790// Radios and checkboxes getter/setter 14791jQuery.each( [ "radio", "checkbox" ], function() { 14792 jQuery.valHooks[ this ] = { 14793 set: function( elem, value ) { 14794 if ( Array.isArray( value ) ) { 14795 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 14796 } 14797 } 14798 }; 14799 if ( !support.checkOn ) { 14800 jQuery.valHooks[ this ].get = function( elem ) { 14801 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 14802 }; 14803 } 14804} ); 14805 14806 14807 14808 14809// Return jQuery for attributes-only inclusion 14810 14811 14812support.focusin = "onfocusin" in window; 14813 14814 14815var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 14816 stopPropagationCallback = function( e ) { 14817 e.stopPropagation(); 14818 }; 14819 14820jQuery.extend( jQuery.event, { 14821 14822 trigger: function( event, data, elem, onlyHandlers ) { 14823 14824 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 14825 eventPath = [ elem || document ], 14826 type = hasOwn.call( event, "type" ) ? event.type : event, 14827 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 14828 14829 cur = lastElement = tmp = elem = elem || document; 14830 14831 // Don't do events on text and comment nodes 14832 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 14833 return; 14834 } 14835 14836 // focus/blur morphs to focusin/out; ensure we're not firing them right now 14837 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 14838 return; 14839 } 14840 14841 if ( type.indexOf( "." ) > -1 ) { 14842 14843 // Namespaced trigger; create a regexp to match event type in handle() 14844 namespaces = type.split( "." ); 14845 type = namespaces.shift(); 14846 namespaces.sort(); 14847 } 14848 ontype = type.indexOf( ":" ) < 0 && "on" + type; 14849 14850 // Caller can pass in a jQuery.Event object, Object, or just an event type string 14851 event = event[ jQuery.expando ] ? 14852 event : 14853 new jQuery.Event( type, typeof event === "object" && event ); 14854 14855 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 14856 event.isTrigger = onlyHandlers ? 2 : 3; 14857 event.namespace = namespaces.join( "." ); 14858 event.rnamespace = event.namespace ? 14859 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 14860 null; 14861 14862 // Clean up the event in case it is being reused 14863 event.result = undefined; 14864 if ( !event.target ) { 14865 event.target = elem; 14866 } 14867 14868 // Clone any incoming data and prepend the event, creating the handler arg list 14869 data = data == null ? 14870 [ event ] : 14871 jQuery.makeArray( data, [ event ] ); 14872 14873 // Allow special events to draw outside the lines 14874 special = jQuery.event.special[ type ] || {}; 14875 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 14876 return; 14877 } 14878 14879 // Determine event propagation path in advance, per W3C events spec (#9951) 14880 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 14881 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { 14882 14883 bubbleType = special.delegateType || type; 14884 if ( !rfocusMorph.test( bubbleType + type ) ) { 14885 cur = cur.parentNode; 14886 } 14887 for ( ; cur; cur = cur.parentNode ) { 14888 eventPath.push( cur ); 14889 tmp = cur; 14890 } 14891 14892 // Only add window if we got to document (e.g., not plain obj or detached DOM) 14893 if ( tmp === ( elem.ownerDocument || document ) ) { 14894 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 14895 } 14896 } 14897 14898 // Fire handlers on the event path 14899 i = 0; 14900 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 14901 lastElement = cur; 14902 event.type = i > 1 ? 14903 bubbleType : 14904 special.bindType || type; 14905 14906 // jQuery handler 14907 handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] && 14908 dataPriv.get( cur, "handle" ); 14909 if ( handle ) { 14910 handle.apply( cur, data ); 14911 } 14912 14913 // Native handler 14914 handle = ontype && cur[ ontype ]; 14915 if ( handle && handle.apply && acceptData( cur ) ) { 14916 event.result = handle.apply( cur, data ); 14917 if ( event.result === false ) { 14918 event.preventDefault(); 14919 } 14920 } 14921 } 14922 event.type = type; 14923 14924 // If nobody prevented the default action, do it now 14925 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 14926 14927 if ( ( !special._default || 14928 special._default.apply( eventPath.pop(), data ) === false ) && 14929 acceptData( elem ) ) { 14930 14931 // Call a native DOM method on the target with the same name as the event. 14932 // Don't do default actions on window, that's where global variables be (#6170) 14933 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { 14934 14935 // Don't re-trigger an onFOO event when we call its FOO() method 14936 tmp = elem[ ontype ]; 14937 14938 if ( tmp ) { 14939 elem[ ontype ] = null; 14940 } 14941 14942 // Prevent re-triggering of the same event, since we already bubbled it above 14943 jQuery.event.triggered = type; 14944 14945 if ( event.isPropagationStopped() ) { 14946 lastElement.addEventListener( type, stopPropagationCallback ); 14947 } 14948 14949 elem[ type ](); 14950 14951 if ( event.isPropagationStopped() ) { 14952 lastElement.removeEventListener( type, stopPropagationCallback ); 14953 } 14954 14955 jQuery.event.triggered = undefined; 14956 14957 if ( tmp ) { 14958 elem[ ontype ] = tmp; 14959 } 14960 } 14961 } 14962 } 14963 14964 return event.result; 14965 }, 14966 14967 // Piggyback on a donor event to simulate a different one 14968 // Used only for `focus(in | out)` events 14969 simulate: function( type, elem, event ) { 14970 var e = jQuery.extend( 14971 new jQuery.Event(), 14972 event, 14973 { 14974 type: type, 14975 isSimulated: true 14976 } 14977 ); 14978 14979 jQuery.event.trigger( e, null, elem ); 14980 } 14981 14982} ); 14983 14984jQuery.fn.extend( { 14985 14986 trigger: function( type, data ) { 14987 return this.each( function() { 14988 jQuery.event.trigger( type, data, this ); 14989 } ); 14990 }, 14991 triggerHandler: function( type, data ) { 14992 var elem = this[ 0 ]; 14993 if ( elem ) { 14994 return jQuery.event.trigger( type, data, elem, true ); 14995 } 14996 } 14997} ); 14998 14999 15000// Support: Firefox <=44 15001// Firefox doesn't have focus(in | out) events 15002// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 15003// 15004// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 15005// focus(in | out) events fire after focus & blur events, 15006// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 15007// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 15008if ( !support.focusin ) { 15009 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { 15010 15011 // Attach a single capturing handler on the document while someone wants focusin/focusout 15012 var handler = function( event ) { 15013 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); 15014 }; 15015 15016 jQuery.event.special[ fix ] = { 15017 setup: function() { 15018 var doc = this.ownerDocument || this, 15019 attaches = dataPriv.access( doc, fix ); 15020 15021 if ( !attaches ) { 15022 doc.addEventListener( orig, handler, true ); 15023 } 15024 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); 15025 }, 15026 teardown: function() { 15027 var doc = this.ownerDocument || this, 15028 attaches = dataPriv.access( doc, fix ) - 1; 15029 15030 if ( !attaches ) { 15031 doc.removeEventListener( orig, handler, true ); 15032 dataPriv.remove( doc, fix ); 15033 15034 } else { 15035 dataPriv.access( doc, fix, attaches ); 15036 } 15037 } 15038 }; 15039 } ); 15040} 15041var location = window.location; 15042 15043var nonce = Date.now(); 15044 15045var rquery = ( /\?/ ); 15046 15047 15048 15049// Cross-browser xml parsing 15050jQuery.parseXML = function( data ) { 15051 var xml; 15052 if ( !data || typeof data !== "string" ) { 15053 return null; 15054 } 15055 15056 // Support: IE 9 - 11 only 15057 // IE throws on parseFromString with invalid input. 15058 try { 15059 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 15060 } catch ( e ) { 15061 xml = undefined; 15062 } 15063 15064 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { 15065 jQuery.error( "Invalid XML: " + data ); 15066 } 15067 return xml; 15068}; 15069 15070 15071var 15072 rbracket = /\[\]$/, 15073 rCRLF = /\r?\n/g, 15074 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 15075 rsubmittable = /^(?:input|select|textarea|keygen)/i; 15076 15077function buildParams( prefix, obj, traditional, add ) { 15078 var name; 15079 15080 if ( Array.isArray( obj ) ) { 15081 15082 // Serialize array item. 15083 jQuery.each( obj, function( i, v ) { 15084 if ( traditional || rbracket.test( prefix ) ) { 15085 15086 // Treat each array item as a scalar. 15087 add( prefix, v ); 15088 15089 } else { 15090 15091 // Item is non-scalar (array or object), encode its numeric index. 15092 buildParams( 15093 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 15094 v, 15095 traditional, 15096 add 15097 ); 15098 } 15099 } ); 15100 15101 } else if ( !traditional && toType( obj ) === "object" ) { 15102 15103 // Serialize object item. 15104 for ( name in obj ) { 15105 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 15106 } 15107 15108 } else { 15109 15110 // Serialize scalar item. 15111 add( prefix, obj ); 15112 } 15113} 15114 15115// Serialize an array of form elements or a set of 15116// key/values into a query string 15117jQuery.param = function( a, traditional ) { 15118 var prefix, 15119 s = [], 15120 add = function( key, valueOrFunction ) { 15121 15122 // If value is a function, invoke it and use its return value 15123 var value = isFunction( valueOrFunction ) ? 15124 valueOrFunction() : 15125 valueOrFunction; 15126 15127 s[ s.length ] = encodeURIComponent( key ) + "=" + 15128 encodeURIComponent( value == null ? "" : value ); 15129 }; 15130 15131 if ( a == null ) { 15132 return ""; 15133 } 15134 15135 // If an array was passed in, assume that it is an array of form elements. 15136 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 15137 15138 // Serialize the form elements 15139 jQuery.each( a, function() { 15140 add( this.name, this.value ); 15141 } ); 15142 15143 } else { 15144 15145 // If traditional, encode the "old" way (the way 1.3.2 or older 15146 // did it), otherwise encode params recursively. 15147 for ( prefix in a ) { 15148 buildParams( prefix, a[ prefix ], traditional, add ); 15149 } 15150 } 15151 15152 // Return the resulting serialization 15153 return s.join( "&" ); 15154}; 15155 15156jQuery.fn.extend( { 15157 serialize: function() { 15158 return jQuery.param( this.serializeArray() ); 15159 }, 15160 serializeArray: function() { 15161 return this.map( function() { 15162 15163 // Can add propHook for "elements" to filter or add form elements 15164 var elements = jQuery.prop( this, "elements" ); 15165 return elements ? jQuery.makeArray( elements ) : this; 15166 } ) 15167 .filter( function() { 15168 var type = this.type; 15169 15170 // Use .is( ":disabled" ) so that fieldset[disabled] works 15171 return this.name && !jQuery( this ).is( ":disabled" ) && 15172 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 15173 ( this.checked || !rcheckableType.test( type ) ); 15174 } ) 15175 .map( function( i, elem ) { 15176 var val = jQuery( this ).val(); 15177 15178 if ( val == null ) { 15179 return null; 15180 } 15181 15182 if ( Array.isArray( val ) ) { 15183 return jQuery.map( val, function( val ) { 15184 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 15185 } ); 15186 } 15187 15188 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 15189 } ).get(); 15190 } 15191} ); 15192 15193 15194var 15195 r20 = /%20/g, 15196 rhash = /#.*$/, 15197 rantiCache = /([?&])_=[^&]*/, 15198 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 15199 15200 // #7653, #8125, #8152: local protocol detection 15201 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 15202 rnoContent = /^(?:GET|HEAD)$/, 15203 rprotocol = /^\/\//, 15204 15205 /* Prefilters 15206 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 15207 * 2) These are called: 15208 * - BEFORE asking for a transport 15209 * - AFTER param serialization (s.data is a string if s.processData is true) 15210 * 3) key is the dataType 15211 * 4) the catchall symbol "*" can be used 15212 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 15213 */ 15214 prefilters = {}, 15215 15216 /* Transports bindings 15217 * 1) key is the dataType 15218 * 2) the catchall symbol "*" can be used 15219 * 3) selection will start with transport dataType and THEN go to "*" if needed 15220 */ 15221 transports = {}, 15222 15223 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 15224 allTypes = "*/".concat( "*" ), 15225 15226 // Anchor tag for parsing the document origin 15227 originAnchor = document.createElement( "a" ); 15228 originAnchor.href = location.href; 15229 15230// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 15231function addToPrefiltersOrTransports( structure ) { 15232 15233 // dataTypeExpression is optional and defaults to "*" 15234 return function( dataTypeExpression, func ) { 15235 15236 if ( typeof dataTypeExpression !== "string" ) { 15237 func = dataTypeExpression; 15238 dataTypeExpression = "*"; 15239 } 15240 15241 var dataType, 15242 i = 0, 15243 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; 15244 15245 if ( isFunction( func ) ) { 15246 15247 // For each dataType in the dataTypeExpression 15248 while ( ( dataType = dataTypes[ i++ ] ) ) { 15249 15250 // Prepend if requested 15251 if ( dataType[ 0 ] === "+" ) { 15252 dataType = dataType.slice( 1 ) || "*"; 15253 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 15254 15255 // Otherwise append 15256 } else { 15257 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 15258 } 15259 } 15260 } 15261 }; 15262} 15263 15264// Base inspection function for prefilters and transports 15265function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 15266 15267 var inspected = {}, 15268 seekingTransport = ( structure === transports ); 15269 15270 function inspect( dataType ) { 15271 var selected; 15272 inspected[ dataType ] = true; 15273 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 15274 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 15275 if ( typeof dataTypeOrTransport === "string" && 15276 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 15277 15278 options.dataTypes.unshift( dataTypeOrTransport ); 15279 inspect( dataTypeOrTransport ); 15280 return false; 15281 } else if ( seekingTransport ) { 15282 return !( selected = dataTypeOrTransport ); 15283 } 15284 } ); 15285 return selected; 15286 } 15287 15288 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 15289} 15290 15291// A special extend for ajax options 15292// that takes "flat" options (not to be deep extended) 15293// Fixes #9887 15294function ajaxExtend( target, src ) { 15295 var key, deep, 15296 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 15297 15298 for ( key in src ) { 15299 if ( src[ key ] !== undefined ) { 15300 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 15301 } 15302 } 15303 if ( deep ) { 15304 jQuery.extend( true, target, deep ); 15305 } 15306 15307 return target; 15308} 15309 15310/* Handles responses to an ajax request: 15311 * - finds the right dataType (mediates between content-type and expected dataType) 15312 * - returns the corresponding response 15313 */ 15314function ajaxHandleResponses( s, jqXHR, responses ) { 15315 15316 var ct, type, finalDataType, firstDataType, 15317 contents = s.contents, 15318 dataTypes = s.dataTypes; 15319 15320 // Remove auto dataType and get content-type in the process 15321 while ( dataTypes[ 0 ] === "*" ) { 15322 dataTypes.shift(); 15323 if ( ct === undefined ) { 15324 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 15325 } 15326 } 15327 15328 // Check if we're dealing with a known content-type 15329 if ( ct ) { 15330 for ( type in contents ) { 15331 if ( contents[ type ] && contents[ type ].test( ct ) ) { 15332 dataTypes.unshift( type ); 15333 break; 15334 } 15335 } 15336 } 15337 15338 // Check to see if we have a response for the expected dataType 15339 if ( dataTypes[ 0 ] in responses ) { 15340 finalDataType = dataTypes[ 0 ]; 15341 } else { 15342 15343 // Try convertible dataTypes 15344 for ( type in responses ) { 15345 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 15346 finalDataType = type; 15347 break; 15348 } 15349 if ( !firstDataType ) { 15350 firstDataType = type; 15351 } 15352 } 15353 15354 // Or just use first one 15355 finalDataType = finalDataType || firstDataType; 15356 } 15357 15358 // If we found a dataType 15359 // We add the dataType to the list if needed 15360 // and return the corresponding response 15361 if ( finalDataType ) { 15362 if ( finalDataType !== dataTypes[ 0 ] ) { 15363 dataTypes.unshift( finalDataType ); 15364 } 15365 return responses[ finalDataType ]; 15366 } 15367} 15368 15369/* Chain conversions given the request and the original response 15370 * Also sets the responseXXX fields on the jqXHR instance 15371 */ 15372function ajaxConvert( s, response, jqXHR, isSuccess ) { 15373 var conv2, current, conv, tmp, prev, 15374 converters = {}, 15375 15376 // Work with a copy of dataTypes in case we need to modify it for conversion 15377 dataTypes = s.dataTypes.slice(); 15378 15379 // Create converters map with lowercased keys 15380 if ( dataTypes[ 1 ] ) { 15381 for ( conv in s.converters ) { 15382 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 15383 } 15384 } 15385 15386 current = dataTypes.shift(); 15387 15388 // Convert to each sequential dataType 15389 while ( current ) { 15390 15391 if ( s.responseFields[ current ] ) { 15392 jqXHR[ s.responseFields[ current ] ] = response; 15393 } 15394 15395 // Apply the dataFilter if provided 15396 if ( !prev && isSuccess && s.dataFilter ) { 15397 response = s.dataFilter( response, s.dataType ); 15398 } 15399 15400 prev = current; 15401 current = dataTypes.shift(); 15402 15403 if ( current ) { 15404 15405 // There's only work to do if current dataType is non-auto 15406 if ( current === "*" ) { 15407 15408 current = prev; 15409 15410 // Convert response if prev dataType is non-auto and differs from current 15411 } else if ( prev !== "*" && prev !== current ) { 15412 15413 // Seek a direct converter 15414 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 15415 15416 // If none found, seek a pair 15417 if ( !conv ) { 15418 for ( conv2 in converters ) { 15419 15420 // If conv2 outputs current 15421 tmp = conv2.split( " " ); 15422 if ( tmp[ 1 ] === current ) { 15423 15424 // If prev can be converted to accepted input 15425 conv = converters[ prev + " " + tmp[ 0 ] ] || 15426 converters[ "* " + tmp[ 0 ] ]; 15427 if ( conv ) { 15428 15429 // Condense equivalence converters 15430 if ( conv === true ) { 15431 conv = converters[ conv2 ]; 15432 15433 // Otherwise, insert the intermediate dataType 15434 } else if ( converters[ conv2 ] !== true ) { 15435 current = tmp[ 0 ]; 15436 dataTypes.unshift( tmp[ 1 ] ); 15437 } 15438 break; 15439 } 15440 } 15441 } 15442 } 15443 15444 // Apply converter (if not an equivalence) 15445 if ( conv !== true ) { 15446 15447 // Unless errors are allowed to bubble, catch and return them 15448 if ( conv && s.throws ) { 15449 response = conv( response ); 15450 } else { 15451 try { 15452 response = conv( response ); 15453 } catch ( e ) { 15454 return { 15455 state: "parsererror", 15456 error: conv ? e : "No conversion from " + prev + " to " + current 15457 }; 15458 } 15459 } 15460 } 15461 } 15462 } 15463 } 15464 15465 return { state: "success", data: response }; 15466} 15467 15468jQuery.extend( { 15469 15470 // Counter for holding the number of active queries 15471 active: 0, 15472 15473 // Last-Modified header cache for next request 15474 lastModified: {}, 15475 etag: {}, 15476 15477 ajaxSettings: { 15478 url: location.href, 15479 type: "GET", 15480 isLocal: rlocalProtocol.test( location.protocol ), 15481 global: true, 15482 processData: true, 15483 async: true, 15484 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 15485 15486 /* 15487 timeout: 0, 15488 data: null, 15489 dataType: null, 15490 username: null, 15491 password: null, 15492 cache: null, 15493 throws: false, 15494 traditional: false, 15495 headers: {}, 15496 */ 15497 15498 accepts: { 15499 "*": allTypes, 15500 text: "text/plain", 15501 html: "text/html", 15502 xml: "application/xml, text/xml", 15503 json: "application/json, text/javascript" 15504 }, 15505 15506 contents: { 15507 xml: /\bxml\b/, 15508 html: /\bhtml/, 15509 json: /\bjson\b/ 15510 }, 15511 15512 responseFields: { 15513 xml: "responseXML", 15514 text: "responseText", 15515 json: "responseJSON" 15516 }, 15517 15518 // Data converters 15519 // Keys separate source (or catchall "*") and destination types with a single space 15520 converters: { 15521 15522 // Convert anything to text 15523 "* text": String, 15524 15525 // Text to html (true = no transformation) 15526 "text html": true, 15527 15528 // Evaluate text as a json expression 15529 "text json": JSON.parse, 15530 15531 // Parse text as xml 15532 "text xml": jQuery.parseXML 15533 }, 15534 15535 // For options that shouldn't be deep extended: 15536 // you can add your own custom options here if 15537 // and when you create one that shouldn't be 15538 // deep extended (see ajaxExtend) 15539 flatOptions: { 15540 url: true, 15541 context: true 15542 } 15543 }, 15544 15545 // Creates a full fledged settings object into target 15546 // with both ajaxSettings and settings fields. 15547 // If target is omitted, writes into ajaxSettings. 15548 ajaxSetup: function( target, settings ) { 15549 return settings ? 15550 15551 // Building a settings object 15552 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 15553 15554 // Extending ajaxSettings 15555 ajaxExtend( jQuery.ajaxSettings, target ); 15556 }, 15557 15558 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 15559 ajaxTransport: addToPrefiltersOrTransports( transports ), 15560 15561 // Main method 15562 ajax: function( url, options ) { 15563 15564 // If url is an object, simulate pre-1.5 signature 15565 if ( typeof url === "object" ) { 15566 options = url; 15567 url = undefined; 15568 } 15569 15570 // Force options to be an object 15571 options = options || {}; 15572 15573 var transport, 15574 15575 // URL without anti-cache param 15576 cacheURL, 15577 15578 // Response headers 15579 responseHeadersString, 15580 responseHeaders, 15581 15582 // timeout handle 15583 timeoutTimer, 15584 15585 // Url cleanup var 15586 urlAnchor, 15587 15588 // Request state (becomes false upon send and true upon completion) 15589 completed, 15590 15591 // To know if global events are to be dispatched 15592 fireGlobals, 15593 15594 // Loop variable 15595 i, 15596 15597 // uncached part of the url 15598 uncached, 15599 15600 // Create the final options object 15601 s = jQuery.ajaxSetup( {}, options ), 15602 15603 // Callbacks context 15604 callbackContext = s.context || s, 15605 15606 // Context for global events is callbackContext if it is a DOM node or jQuery collection 15607 globalEventContext = s.context && 15608 ( callbackContext.nodeType || callbackContext.jquery ) ? 15609 jQuery( callbackContext ) : 15610 jQuery.event, 15611 15612 // Deferreds 15613 deferred = jQuery.Deferred(), 15614 completeDeferred = jQuery.Callbacks( "once memory" ), 15615 15616 // Status-dependent callbacks 15617 statusCode = s.statusCode || {}, 15618 15619 // Headers (they are sent all at once) 15620 requestHeaders = {}, 15621 requestHeadersNames = {}, 15622 15623 // Default abort message 15624 strAbort = "canceled", 15625 15626 // Fake xhr 15627 jqXHR = { 15628 readyState: 0, 15629 15630 // Builds headers hashtable if needed 15631 getResponseHeader: function( key ) { 15632 var match; 15633 if ( completed ) { 15634 if ( !responseHeaders ) { 15635 responseHeaders = {}; 15636 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 15637 responseHeaders[ match[ 1 ].toLowerCase() + " " ] = 15638 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) 15639 .concat( match[ 2 ] ); 15640 } 15641 } 15642 match = responseHeaders[ key.toLowerCase() + " " ]; 15643 } 15644 return match == null ? null : match.join( ", " ); 15645 }, 15646 15647 // Raw string 15648 getAllResponseHeaders: function() { 15649 return completed ? responseHeadersString : null; 15650 }, 15651 15652 // Caches the header 15653 setRequestHeader: function( name, value ) { 15654 if ( completed == null ) { 15655 name = requestHeadersNames[ name.toLowerCase() ] = 15656 requestHeadersNames[ name.toLowerCase() ] || name; 15657 requestHeaders[ name ] = value; 15658 } 15659 return this; 15660 }, 15661 15662 // Overrides response content-type header 15663 overrideMimeType: function( type ) { 15664 if ( completed == null ) { 15665 s.mimeType = type; 15666 } 15667 return this; 15668 }, 15669 15670 // Status-dependent callbacks 15671 statusCode: function( map ) { 15672 var code; 15673 if ( map ) { 15674 if ( completed ) { 15675 15676 // Execute the appropriate callbacks 15677 jqXHR.always( map[ jqXHR.status ] ); 15678 } else { 15679 15680 // Lazy-add the new callbacks in a way that preserves old ones 15681 for ( code in map ) { 15682 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 15683 } 15684 } 15685 } 15686 return this; 15687 }, 15688 15689 // Cancel the request 15690 abort: function( statusText ) { 15691 var finalText = statusText || strAbort; 15692 if ( transport ) { 15693 transport.abort( finalText ); 15694 } 15695 done( 0, finalText ); 15696 return this; 15697 } 15698 }; 15699 15700 // Attach deferreds 15701 deferred.promise( jqXHR ); 15702 15703 // Add protocol if not provided (prefilters might expect it) 15704 // Handle falsy url in the settings object (#10093: consistency with old signature) 15705 // We also use the url parameter if available 15706 s.url = ( ( url || s.url || location.href ) + "" ) 15707 .replace( rprotocol, location.protocol + "//" ); 15708 15709 // Alias method option to type as per ticket #12004 15710 s.type = options.method || options.type || s.method || s.type; 15711 15712 // Extract dataTypes list 15713 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; 15714 15715 // A cross-domain request is in order when the origin doesn't match the current origin. 15716 if ( s.crossDomain == null ) { 15717 urlAnchor = document.createElement( "a" ); 15718 15719 // Support: IE <=8 - 11, Edge 12 - 15 15720 // IE throws exception on accessing the href property if url is malformed, 15721 // e.g. http://example.com:80x/ 15722 try { 15723 urlAnchor.href = s.url; 15724 15725 // Support: IE <=8 - 11 only 15726 // Anchor's host property isn't correctly set when s.url is relative 15727 urlAnchor.href = urlAnchor.href; 15728 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 15729 urlAnchor.protocol + "//" + urlAnchor.host; 15730 } catch ( e ) { 15731 15732 // If there is an error parsing the URL, assume it is crossDomain, 15733 // it can be rejected by the transport if it is invalid 15734 s.crossDomain = true; 15735 } 15736 } 15737 15738 // Convert data if not already a string 15739 if ( s.data && s.processData && typeof s.data !== "string" ) { 15740 s.data = jQuery.param( s.data, s.traditional ); 15741 } 15742 15743 // Apply prefilters 15744 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 15745 15746 // If request was aborted inside a prefilter, stop there 15747 if ( completed ) { 15748 return jqXHR; 15749 } 15750 15751 // We can fire global events as of now if asked to 15752 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) 15753 fireGlobals = jQuery.event && s.global; 15754 15755 // Watch for a new set of requests 15756 if ( fireGlobals && jQuery.active++ === 0 ) { 15757 jQuery.event.trigger( "ajaxStart" ); 15758 } 15759 15760 // Uppercase the type 15761 s.type = s.type.toUpperCase(); 15762 15763 // Determine if request has content 15764 s.hasContent = !rnoContent.test( s.type ); 15765 15766 // Save the URL in case we're toying with the If-Modified-Since 15767 // and/or If-None-Match header later on 15768 // Remove hash to simplify url manipulation 15769 cacheURL = s.url.replace( rhash, "" ); 15770 15771 // More options handling for requests with no content 15772 if ( !s.hasContent ) { 15773 15774 // Remember the hash so we can put it back 15775 uncached = s.url.slice( cacheURL.length ); 15776 15777 // If data is available and should be processed, append data to url 15778 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { 15779 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; 15780 15781 // #9682: remove data so that it's not used in an eventual retry 15782 delete s.data; 15783 } 15784 15785 // Add or update anti-cache param if needed 15786 if ( s.cache === false ) { 15787 cacheURL = cacheURL.replace( rantiCache, "$1" ); 15788 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached; 15789 } 15790 15791 // Put hash and anti-cache on the URL that will be requested (gh-1732) 15792 s.url = cacheURL + uncached; 15793 15794 // Change '%20' to '+' if this is encoded form body content (gh-2658) 15795 } else if ( s.data && s.processData && 15796 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { 15797 s.data = s.data.replace( r20, "+" ); 15798 } 15799 15800 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 15801 if ( s.ifModified ) { 15802 if ( jQuery.lastModified[ cacheURL ] ) { 15803 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 15804 } 15805 if ( jQuery.etag[ cacheURL ] ) { 15806 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 15807 } 15808 } 15809 15810 // Set the correct header, if data is being sent 15811 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 15812 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 15813 } 15814 15815 // Set the Accepts header for the server, depending on the dataType 15816 jqXHR.setRequestHeader( 15817 "Accept", 15818 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 15819 s.accepts[ s.dataTypes[ 0 ] ] + 15820 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 15821 s.accepts[ "*" ] 15822 ); 15823 15824 // Check for headers option 15825 for ( i in s.headers ) { 15826 jqXHR.setRequestHeader( i, s.headers[ i ] ); 15827 } 15828 15829 // Allow custom headers/mimetypes and early abort 15830 if ( s.beforeSend && 15831 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { 15832 15833 // Abort if not done already and return 15834 return jqXHR.abort(); 15835 } 15836 15837 // Aborting is no longer a cancellation 15838 strAbort = "abort"; 15839 15840 // Install callbacks on deferreds 15841 completeDeferred.add( s.complete ); 15842 jqXHR.done( s.success ); 15843 jqXHR.fail( s.error ); 15844 15845 // Get transport 15846 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 15847 15848 // If no transport, we auto-abort 15849 if ( !transport ) { 15850 done( -1, "No Transport" ); 15851 } else { 15852 jqXHR.readyState = 1; 15853 15854 // Send global event 15855 if ( fireGlobals ) { 15856 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 15857 } 15858 15859 // If request was aborted inside ajaxSend, stop there 15860 if ( completed ) { 15861 return jqXHR; 15862 } 15863 15864 // Timeout 15865 if ( s.async && s.timeout > 0 ) { 15866 timeoutTimer = window.setTimeout( function() { 15867 jqXHR.abort( "timeout" ); 15868 }, s.timeout ); 15869 } 15870 15871 try { 15872 completed = false; 15873 transport.send( requestHeaders, done ); 15874 } catch ( e ) { 15875 15876 // Rethrow post-completion exceptions 15877 if ( completed ) { 15878 throw e; 15879 } 15880 15881 // Propagate others as results 15882 done( -1, e ); 15883 } 15884 } 15885 15886 // Callback for when everything is done 15887 function done( status, nativeStatusText, responses, headers ) { 15888 var isSuccess, success, error, response, modified, 15889 statusText = nativeStatusText; 15890 15891 // Ignore repeat invocations 15892 if ( completed ) { 15893 return; 15894 } 15895 15896 completed = true; 15897 15898 // Clear timeout if it exists 15899 if ( timeoutTimer ) { 15900 window.clearTimeout( timeoutTimer ); 15901 } 15902 15903 // Dereference transport for early garbage collection 15904 // (no matter how long the jqXHR object will be used) 15905 transport = undefined; 15906 15907 // Cache response headers 15908 responseHeadersString = headers || ""; 15909 15910 // Set readyState 15911 jqXHR.readyState = status > 0 ? 4 : 0; 15912 15913 // Determine if successful 15914 isSuccess = status >= 200 && status < 300 || status === 304; 15915 15916 // Get response data 15917 if ( responses ) { 15918 response = ajaxHandleResponses( s, jqXHR, responses ); 15919 } 15920 15921 // Convert no matter what (that way responseXXX fields are always set) 15922 response = ajaxConvert( s, response, jqXHR, isSuccess ); 15923 15924 // If successful, handle type chaining 15925 if ( isSuccess ) { 15926 15927 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 15928 if ( s.ifModified ) { 15929 modified = jqXHR.getResponseHeader( "Last-Modified" ); 15930 if ( modified ) { 15931 jQuery.lastModified[ cacheURL ] = modified; 15932 } 15933 modified = jqXHR.getResponseHeader( "etag" ); 15934 if ( modified ) { 15935 jQuery.etag[ cacheURL ] = modified; 15936 } 15937 } 15938 15939 // if no content 15940 if ( status === 204 || s.type === "HEAD" ) { 15941 statusText = "nocontent"; 15942 15943 // if not modified 15944 } else if ( status === 304 ) { 15945 statusText = "notmodified"; 15946 15947 // If we have data, let's convert it 15948 } else { 15949 statusText = response.state; 15950 success = response.data; 15951 error = response.error; 15952 isSuccess = !error; 15953 } 15954 } else { 15955 15956 // Extract error from statusText and normalize for non-aborts 15957 error = statusText; 15958 if ( status || !statusText ) { 15959 statusText = "error"; 15960 if ( status < 0 ) { 15961 status = 0; 15962 } 15963 } 15964 } 15965 15966 // Set data for the fake xhr object 15967 jqXHR.status = status; 15968 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 15969 15970 // Success/Error 15971 if ( isSuccess ) { 15972 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 15973 } else { 15974 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 15975 } 15976 15977 // Status-dependent callbacks 15978 jqXHR.statusCode( statusCode ); 15979 statusCode = undefined; 15980 15981 if ( fireGlobals ) { 15982 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 15983 [ jqXHR, s, isSuccess ? success : error ] ); 15984 } 15985 15986 // Complete 15987 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 15988 15989 if ( fireGlobals ) { 15990 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 15991 15992 // Handle the global AJAX counter 15993 if ( !( --jQuery.active ) ) { 15994 jQuery.event.trigger( "ajaxStop" ); 15995 } 15996 } 15997 } 15998 15999 return jqXHR; 16000 }, 16001 16002 getJSON: function( url, data, callback ) { 16003 return jQuery.get( url, data, callback, "json" ); 16004 }, 16005 16006 getScript: function( url, callback ) { 16007 return jQuery.get( url, undefined, callback, "script" ); 16008 } 16009} ); 16010 16011jQuery.each( [ "get", "post" ], function( i, method ) { 16012 jQuery[ method ] = function( url, data, callback, type ) { 16013 16014 // Shift arguments if data argument was omitted 16015 if ( isFunction( data ) ) { 16016 type = type || callback; 16017 callback = data; 16018 data = undefined; 16019 } 16020 16021 // The url can be an options object (which then must have .url) 16022 return jQuery.ajax( jQuery.extend( { 16023 url: url, 16024 type: method, 16025 dataType: type, 16026 data: data, 16027 success: callback 16028 }, jQuery.isPlainObject( url ) && url ) ); 16029 }; 16030} ); 16031 16032 16033jQuery._evalUrl = function( url, options ) { 16034 return jQuery.ajax( { 16035 url: url, 16036 16037 // Make this explicit, since user can override this through ajaxSetup (#11264) 16038 type: "GET", 16039 dataType: "script", 16040 cache: true, 16041 async: false, 16042 global: false, 16043 16044 // Only evaluate the response if it is successful (gh-4126) 16045 // dataFilter is not invoked for failure responses, so using it instead 16046 // of the default converter is kludgy but it works. 16047 converters: { 16048 "text script": function() {} 16049 }, 16050 dataFilter: function( response ) { 16051 jQuery.globalEval( response, options ); 16052 } 16053 } ); 16054}; 16055 16056 16057jQuery.fn.extend( { 16058 wrapAll: function( html ) { 16059 var wrap; 16060 16061 if ( this[ 0 ] ) { 16062 if ( isFunction( html ) ) { 16063 html = html.call( this[ 0 ] ); 16064 } 16065 16066 // The elements to wrap the target around 16067 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 16068 16069 if ( this[ 0 ].parentNode ) { 16070 wrap.insertBefore( this[ 0 ] ); 16071 } 16072 16073 wrap.map( function() { 16074 var elem = this; 16075 16076 while ( elem.firstElementChild ) { 16077 elem = elem.firstElementChild; 16078 } 16079 16080 return elem; 16081 } ).append( this ); 16082 } 16083 16084 return this; 16085 }, 16086 16087 wrapInner: function( html ) { 16088 if ( isFunction( html ) ) { 16089 return this.each( function( i ) { 16090 jQuery( this ).wrapInner( html.call( this, i ) ); 16091 } ); 16092 } 16093 16094 return this.each( function() { 16095 var self = jQuery( this ), 16096 contents = self.contents(); 16097 16098 if ( contents.length ) { 16099 contents.wrapAll( html ); 16100 16101 } else { 16102 self.append( html ); 16103 } 16104 } ); 16105 }, 16106 16107 wrap: function( html ) { 16108 var htmlIsFunction = isFunction( html ); 16109 16110 return this.each( function( i ) { 16111 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); 16112 } ); 16113 }, 16114 16115 unwrap: function( selector ) { 16116 this.parent( selector ).not( "body" ).each( function() { 16117 jQuery( this ).replaceWith( this.childNodes ); 16118 } ); 16119 return this; 16120 } 16121} ); 16122 16123 16124jQuery.expr.pseudos.hidden = function( elem ) { 16125 return !jQuery.expr.pseudos.visible( elem ); 16126}; 16127jQuery.expr.pseudos.visible = function( elem ) { 16128 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); 16129}; 16130 16131 16132 16133 16134jQuery.ajaxSettings.xhr = function() { 16135 try { 16136 return new window.XMLHttpRequest(); 16137 } catch ( e ) {} 16138}; 16139 16140var xhrSuccessStatus = { 16141 16142 // File protocol always yields status code 0, assume 200 16143 0: 200, 16144 16145 // Support: IE <=9 only 16146 // #1450: sometimes IE returns 1223 when it should be 204 16147 1223: 204 16148 }, 16149 xhrSupported = jQuery.ajaxSettings.xhr(); 16150 16151support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 16152support.ajax = xhrSupported = !!xhrSupported; 16153 16154jQuery.ajaxTransport( function( options ) { 16155 var callback, errorCallback; 16156 16157 // Cross domain only allowed if supported through XMLHttpRequest 16158 if ( support.cors || xhrSupported && !options.crossDomain ) { 16159 return { 16160 send: function( headers, complete ) { 16161 var i, 16162 xhr = options.xhr(); 16163 16164 xhr.open( 16165 options.type, 16166 options.url, 16167 options.async, 16168 options.username, 16169 options.password 16170 ); 16171 16172 // Apply custom fields if provided 16173 if ( options.xhrFields ) { 16174 for ( i in options.xhrFields ) { 16175 xhr[ i ] = options.xhrFields[ i ]; 16176 } 16177 } 16178 16179 // Override mime type if needed 16180 if ( options.mimeType && xhr.overrideMimeType ) { 16181 xhr.overrideMimeType( options.mimeType ); 16182 } 16183 16184 // X-Requested-With header 16185 // For cross-domain requests, seeing as conditions for a preflight are 16186 // akin to a jigsaw puzzle, we simply never set it to be sure. 16187 // (it can always be set on a per-request basis or even using ajaxSetup) 16188 // For same-domain requests, won't change header if already provided. 16189 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 16190 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 16191 } 16192 16193 // Set headers 16194 for ( i in headers ) { 16195 xhr.setRequestHeader( i, headers[ i ] ); 16196 } 16197 16198 // Callback 16199 callback = function( type ) { 16200 return function() { 16201 if ( callback ) { 16202 callback = errorCallback = xhr.onload = 16203 xhr.onerror = xhr.onabort = xhr.ontimeout = 16204 xhr.onreadystatechange = null; 16205 16206 if ( type === "abort" ) { 16207 xhr.abort(); 16208 } else if ( type === "error" ) { 16209 16210 // Support: IE <=9 only 16211 // On a manual native abort, IE9 throws 16212 // errors on any property access that is not readyState 16213 if ( typeof xhr.status !== "number" ) { 16214 complete( 0, "error" ); 16215 } else { 16216 complete( 16217 16218 // File: protocol always yields status 0; see #8605, #14207 16219 xhr.status, 16220 xhr.statusText 16221 ); 16222 } 16223 } else { 16224 complete( 16225 xhrSuccessStatus[ xhr.status ] || xhr.status, 16226 xhr.statusText, 16227 16228 // Support: IE <=9 only 16229 // IE9 has no XHR2 but throws on binary (trac-11426) 16230 // For XHR2 non-text, let the caller handle it (gh-2498) 16231 ( xhr.responseType || "text" ) !== "text" || 16232 typeof xhr.responseText !== "string" ? 16233 { binary: xhr.response } : 16234 { text: xhr.responseText }, 16235 xhr.getAllResponseHeaders() 16236 ); 16237 } 16238 } 16239 }; 16240 }; 16241 16242 // Listen to events 16243 xhr.onload = callback(); 16244 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); 16245 16246 // Support: IE 9 only 16247 // Use onreadystatechange to replace onabort 16248 // to handle uncaught aborts 16249 if ( xhr.onabort !== undefined ) { 16250 xhr.onabort = errorCallback; 16251 } else { 16252 xhr.onreadystatechange = function() { 16253 16254 // Check readyState before timeout as it changes 16255 if ( xhr.readyState === 4 ) { 16256 16257 // Allow onerror to be called first, 16258 // but that will not handle a native abort 16259 // Also, save errorCallback to a variable 16260 // as xhr.onerror cannot be accessed 16261 window.setTimeout( function() { 16262 if ( callback ) { 16263 errorCallback(); 16264 } 16265 } ); 16266 } 16267 }; 16268 } 16269 16270 // Create the abort callback 16271 callback = callback( "abort" ); 16272 16273 try { 16274 16275 // Do send the request (this may raise an exception) 16276 xhr.send( options.hasContent && options.data || null ); 16277 } catch ( e ) { 16278 16279 // #14683: Only rethrow if this hasn't been notified as an error yet 16280 if ( callback ) { 16281 throw e; 16282 } 16283 } 16284 }, 16285 16286 abort: function() { 16287 if ( callback ) { 16288 callback(); 16289 } 16290 } 16291 }; 16292 } 16293} ); 16294 16295 16296 16297 16298// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 16299jQuery.ajaxPrefilter( function( s ) { 16300 if ( s.crossDomain ) { 16301 s.contents.script = false; 16302 } 16303} ); 16304 16305// Install script dataType 16306jQuery.ajaxSetup( { 16307 accepts: { 16308 script: "text/javascript, application/javascript, " + 16309 "application/ecmascript, application/x-ecmascript" 16310 }, 16311 contents: { 16312 script: /\b(?:java|ecma)script\b/ 16313 }, 16314 converters: { 16315 "text script": function( text ) { 16316 jQuery.globalEval( text ); 16317 return text; 16318 } 16319 } 16320} ); 16321 16322// Handle cache's special case and crossDomain 16323jQuery.ajaxPrefilter( "script", function( s ) { 16324 if ( s.cache === undefined ) { 16325 s.cache = false; 16326 } 16327 if ( s.crossDomain ) { 16328 s.type = "GET"; 16329 } 16330} ); 16331 16332// Bind script tag hack transport 16333jQuery.ajaxTransport( "script", function( s ) { 16334 16335 // This transport only deals with cross domain or forced-by-attrs requests 16336 if ( s.crossDomain || s.scriptAttrs ) { 16337 var script, callback; 16338 return { 16339 send: function( _, complete ) { 16340 script = jQuery( "<script>" ) 16341 .attr( s.scriptAttrs || {} ) 16342 .prop( { charset: s.scriptCharset, src: s.url } ) 16343 .on( "load error", callback = function( evt ) { 16344 script.remove(); 16345 callback = null; 16346 if ( evt ) { 16347 complete( evt.type === "error" ? 404 : 200, evt.type ); 16348 } 16349 } ); 16350 16351 // Use native DOM manipulation to avoid our domManip AJAX trickery 16352 document.head.appendChild( script[ 0 ] ); 16353 }, 16354 abort: function() { 16355 if ( callback ) { 16356 callback(); 16357 } 16358 } 16359 }; 16360 } 16361} ); 16362 16363 16364 16365 16366var oldCallbacks = [], 16367 rjsonp = /(=)\?(?=&|$)|\?\?/; 16368 16369// Default jsonp settings 16370jQuery.ajaxSetup( { 16371 jsonp: "callback", 16372 jsonpCallback: function() { 16373 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); 16374 this[ callback ] = true; 16375 return callback; 16376 } 16377} ); 16378 16379// Detect, normalize options and install callbacks for jsonp requests 16380jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 16381 16382 var callbackName, overwritten, responseContainer, 16383 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 16384 "url" : 16385 typeof s.data === "string" && 16386 ( s.contentType || "" ) 16387 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 16388 rjsonp.test( s.data ) && "data" 16389 ); 16390 16391 // Handle iff the expected data type is "jsonp" or we have a parameter to set 16392 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 16393 16394 // Get callback name, remembering preexisting value associated with it 16395 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? 16396 s.jsonpCallback() : 16397 s.jsonpCallback; 16398 16399 // Insert callback into url or form data 16400 if ( jsonProp ) { 16401 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 16402 } else if ( s.jsonp !== false ) { 16403 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 16404 } 16405 16406 // Use data converter to retrieve json after script execution 16407 s.converters[ "script json" ] = function() { 16408 if ( !responseContainer ) { 16409 jQuery.error( callbackName + " was not called" ); 16410 } 16411 return responseContainer[ 0 ]; 16412 }; 16413 16414 // Force json dataType 16415 s.dataTypes[ 0 ] = "json"; 16416 16417 // Install callback 16418 overwritten = window[ callbackName ]; 16419 window[ callbackName ] = function() { 16420 responseContainer = arguments; 16421 }; 16422 16423 // Clean-up function (fires after converters) 16424 jqXHR.always( function() { 16425 16426 // If previous value didn't exist - remove it 16427 if ( overwritten === undefined ) { 16428 jQuery( window ).removeProp( callbackName ); 16429 16430 // Otherwise restore preexisting value 16431 } else { 16432 window[ callbackName ] = overwritten; 16433 } 16434 16435 // Save back as free 16436 if ( s[ callbackName ] ) { 16437 16438 // Make sure that re-using the options doesn't screw things around 16439 s.jsonpCallback = originalSettings.jsonpCallback; 16440 16441 // Save the callback name for future use 16442 oldCallbacks.push( callbackName ); 16443 } 16444 16445 // Call if it was a function and we have a response 16446 if ( responseContainer && isFunction( overwritten ) ) { 16447 overwritten( responseContainer[ 0 ] ); 16448 } 16449 16450 responseContainer = overwritten = undefined; 16451 } ); 16452 16453 // Delegate to script 16454 return "script"; 16455 } 16456} ); 16457 16458 16459 16460 16461// Support: Safari 8 only 16462// In Safari 8 documents created via document.implementation.createHTMLDocument 16463// collapse sibling forms: the second one becomes a child of the first one. 16464// Because of that, this security measure has to be disabled in Safari 8. 16465// https://bugs.webkit.org/show_bug.cgi?id=137337 16466support.createHTMLDocument = ( function() { 16467 var body = document.implementation.createHTMLDocument( "" ).body; 16468 body.innerHTML = "<form></form><form></form>"; 16469 return body.childNodes.length === 2; 16470} )(); 16471 16472 16473// Argument "data" should be string of html 16474// context (optional): If specified, the fragment will be created in this context, 16475// defaults to document 16476// keepScripts (optional): If true, will include scripts passed in the html string 16477jQuery.parseHTML = function( data, context, keepScripts ) { 16478 if ( typeof data !== "string" ) { 16479 return []; 16480 } 16481 if ( typeof context === "boolean" ) { 16482 keepScripts = context; 16483 context = false; 16484 } 16485 16486 var base, parsed, scripts; 16487 16488 if ( !context ) { 16489 16490 // Stop scripts or inline event handlers from being executed immediately 16491 // by using document.implementation 16492 if ( support.createHTMLDocument ) { 16493 context = document.implementation.createHTMLDocument( "" ); 16494 16495 // Set the base href for the created document 16496 // so any parsed elements with URLs 16497 // are based on the document's URL (gh-2965) 16498 base = context.createElement( "base" ); 16499 base.href = document.location.href; 16500 context.head.appendChild( base ); 16501 } else { 16502 context = document; 16503 } 16504 } 16505 16506 parsed = rsingleTag.exec( data ); 16507 scripts = !keepScripts && []; 16508 16509 // Single tag 16510 if ( parsed ) { 16511 return [ context.createElement( parsed[ 1 ] ) ]; 16512 } 16513 16514 parsed = buildFragment( [ data ], context, scripts ); 16515 16516 if ( scripts && scripts.length ) { 16517 jQuery( scripts ).remove(); 16518 } 16519 16520 return jQuery.merge( [], parsed.childNodes ); 16521}; 16522 16523 16524/** 16525 * Load a url into a page 16526 */ 16527jQuery.fn.load = function( url, params, callback ) { 16528 var selector, type, response, 16529 self = this, 16530 off = url.indexOf( " " ); 16531 16532 if ( off > -1 ) { 16533 selector = stripAndCollapse( url.slice( off ) ); 16534 url = url.slice( 0, off ); 16535 } 16536 16537 // If it's a function 16538 if ( isFunction( params ) ) { 16539 16540 // We assume that it's the callback 16541 callback = params; 16542 params = undefined; 16543 16544 // Otherwise, build a param string 16545 } else if ( params && typeof params === "object" ) { 16546 type = "POST"; 16547 } 16548 16549 // If we have elements to modify, make the request 16550 if ( self.length > 0 ) { 16551 jQuery.ajax( { 16552 url: url, 16553 16554 // If "type" variable is undefined, then "GET" method will be used. 16555 // Make value of this field explicit since 16556 // user can override it through ajaxSetup method 16557 type: type || "GET", 16558 dataType: "html", 16559 data: params 16560 } ).done( function( responseText ) { 16561 16562 // Save response for use in complete callback 16563 response = arguments; 16564 16565 self.html( selector ? 16566 16567 // If a selector was specified, locate the right elements in a dummy div 16568 // Exclude scripts to avoid IE 'Permission Denied' errors 16569 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 16570 16571 // Otherwise use the full result 16572 responseText ); 16573 16574 // If the request succeeds, this function gets "data", "status", "jqXHR" 16575 // but they are ignored because response was set above. 16576 // If it fails, this function gets "jqXHR", "status", "error" 16577 } ).always( callback && function( jqXHR, status ) { 16578 self.each( function() { 16579 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 16580 } ); 16581 } ); 16582 } 16583 16584 return this; 16585}; 16586 16587 16588 16589 16590// Attach a bunch of functions for handling common AJAX events 16591jQuery.each( [ 16592 "ajaxStart", 16593 "ajaxStop", 16594 "ajaxComplete", 16595 "ajaxError", 16596 "ajaxSuccess", 16597 "ajaxSend" 16598], function( i, type ) { 16599 jQuery.fn[ type ] = function( fn ) { 16600 return this.on( type, fn ); 16601 }; 16602} ); 16603 16604 16605 16606 16607jQuery.expr.pseudos.animated = function( elem ) { 16608 return jQuery.grep( jQuery.timers, function( fn ) { 16609 return elem === fn.elem; 16610 } ).length; 16611}; 16612 16613 16614 16615 16616jQuery.offset = { 16617 setOffset: function( elem, options, i ) { 16618 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 16619 position = jQuery.css( elem, "position" ), 16620 curElem = jQuery( elem ), 16621 props = {}; 16622 16623 // Set position first, in-case top/left are set even on static elem 16624 if ( position === "static" ) { 16625 elem.style.position = "relative"; 16626 } 16627 16628 curOffset = curElem.offset(); 16629 curCSSTop = jQuery.css( elem, "top" ); 16630 curCSSLeft = jQuery.css( elem, "left" ); 16631 calculatePosition = ( position === "absolute" || position === "fixed" ) && 16632 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 16633 16634 // Need to be able to calculate position if either 16635 // top or left is auto and position is either absolute or fixed 16636 if ( calculatePosition ) { 16637 curPosition = curElem.position(); 16638 curTop = curPosition.top; 16639 curLeft = curPosition.left; 16640 16641 } else { 16642 curTop = parseFloat( curCSSTop ) || 0; 16643 curLeft = parseFloat( curCSSLeft ) || 0; 16644 } 16645 16646 if ( isFunction( options ) ) { 16647 16648 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 16649 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 16650 } 16651 16652 if ( options.top != null ) { 16653 props.top = ( options.top - curOffset.top ) + curTop; 16654 } 16655 if ( options.left != null ) { 16656 props.left = ( options.left - curOffset.left ) + curLeft; 16657 } 16658 16659 if ( "using" in options ) { 16660 options.using.call( elem, props ); 16661 16662 } else { 16663 curElem.css( props ); 16664 } 16665 } 16666}; 16667 16668jQuery.fn.extend( { 16669 16670 // offset() relates an element's border box to the document origin 16671 offset: function( options ) { 16672 16673 // Preserve chaining for setter 16674 if ( arguments.length ) { 16675 return options === undefined ? 16676 this : 16677 this.each( function( i ) { 16678 jQuery.offset.setOffset( this, options, i ); 16679 } ); 16680 } 16681 16682 var rect, win, 16683 elem = this[ 0 ]; 16684 16685 if ( !elem ) { 16686 return; 16687 } 16688 16689 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 16690 // Support: IE <=11 only 16691 // Running getBoundingClientRect on a 16692 // disconnected node in IE throws an error 16693 if ( !elem.getClientRects().length ) { 16694 return { top: 0, left: 0 }; 16695 } 16696 16697 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 16698 rect = elem.getBoundingClientRect(); 16699 win = elem.ownerDocument.defaultView; 16700 return { 16701 top: rect.top + win.pageYOffset, 16702 left: rect.left + win.pageXOffset 16703 }; 16704 }, 16705 16706 // position() relates an element's margin box to its offset parent's padding box 16707 // This corresponds to the behavior of CSS absolute positioning 16708 position: function() { 16709 if ( !this[ 0 ] ) { 16710 return; 16711 } 16712 16713 var offsetParent, offset, doc, 16714 elem = this[ 0 ], 16715 parentOffset = { top: 0, left: 0 }; 16716 16717 // position:fixed elements are offset from the viewport, which itself always has zero offset 16718 if ( jQuery.css( elem, "position" ) === "fixed" ) { 16719 16720 // Assume position:fixed implies availability of getBoundingClientRect 16721 offset = elem.getBoundingClientRect(); 16722 16723 } else { 16724 offset = this.offset(); 16725 16726 // Account for the *real* offset parent, which can be the document or its root element 16727 // when a statically positioned element is identified 16728 doc = elem.ownerDocument; 16729 offsetParent = elem.offsetParent || doc.documentElement; 16730 while ( offsetParent && 16731 ( offsetParent === doc.body || offsetParent === doc.documentElement ) && 16732 jQuery.css( offsetParent, "position" ) === "static" ) { 16733 16734 offsetParent = offsetParent.parentNode; 16735 } 16736 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { 16737 16738 // Incorporate borders into its offset, since they are outside its content origin 16739 parentOffset = jQuery( offsetParent ).offset(); 16740 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); 16741 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); 16742 } 16743 } 16744 16745 // Subtract parent offsets and element margins 16746 return { 16747 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 16748 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 16749 }; 16750 }, 16751 16752 // This method will return documentElement in the following cases: 16753 // 1) For the element inside the iframe without offsetParent, this method will return 16754 // documentElement of the parent window 16755 // 2) For the hidden or detached element 16756 // 3) For body or html element, i.e. in case of the html node - it will return itself 16757 // 16758 // but those exceptions were never presented as a real life use-cases 16759 // and might be considered as more preferable results. 16760 // 16761 // This logic, however, is not guaranteed and can change at any point in the future 16762 offsetParent: function() { 16763 return this.map( function() { 16764 var offsetParent = this.offsetParent; 16765 16766 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 16767 offsetParent = offsetParent.offsetParent; 16768 } 16769 16770 return offsetParent || documentElement; 16771 } ); 16772 } 16773} ); 16774 16775// Create scrollLeft and scrollTop methods 16776jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 16777 var top = "pageYOffset" === prop; 16778 16779 jQuery.fn[ method ] = function( val ) { 16780 return access( this, function( elem, method, val ) { 16781 16782 // Coalesce documents and windows 16783 var win; 16784 if ( isWindow( elem ) ) { 16785 win = elem; 16786 } else if ( elem.nodeType === 9 ) { 16787 win = elem.defaultView; 16788 } 16789 16790 if ( val === undefined ) { 16791 return win ? win[ prop ] : elem[ method ]; 16792 } 16793 16794 if ( win ) { 16795 win.scrollTo( 16796 !top ? val : win.pageXOffset, 16797 top ? val : win.pageYOffset 16798 ); 16799 16800 } else { 16801 elem[ method ] = val; 16802 } 16803 }, method, val, arguments.length ); 16804 }; 16805} ); 16806 16807// Support: Safari <=7 - 9.1, Chrome <=37 - 49 16808// Add the top/left cssHooks using jQuery.fn.position 16809// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 16810// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 16811// getComputedStyle returns percent when specified for top/left/bottom/right; 16812// rather than make the css module depend on the offset module, just check for it here 16813jQuery.each( [ "top", "left" ], function( i, prop ) { 16814 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 16815 function( elem, computed ) { 16816 if ( computed ) { 16817 computed = curCSS( elem, prop ); 16818 16819 // If curCSS returns percentage, fallback to offset 16820 return rnumnonpx.test( computed ) ? 16821 jQuery( elem ).position()[ prop ] + "px" : 16822 computed; 16823 } 16824 } 16825 ); 16826} ); 16827 16828 16829// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 16830jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 16831 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, 16832 function( defaultExtra, funcName ) { 16833 16834 // Margin is only for outerHeight, outerWidth 16835 jQuery.fn[ funcName ] = function( margin, value ) { 16836 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 16837 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 16838 16839 return access( this, function( elem, type, value ) { 16840 var doc; 16841 16842 if ( isWindow( elem ) ) { 16843 16844 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 16845 return funcName.indexOf( "outer" ) === 0 ? 16846 elem[ "inner" + name ] : 16847 elem.document.documentElement[ "client" + name ]; 16848 } 16849 16850 // Get document width or height 16851 if ( elem.nodeType === 9 ) { 16852 doc = elem.documentElement; 16853 16854 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 16855 // whichever is greatest 16856 return Math.max( 16857 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 16858 elem.body[ "offset" + name ], doc[ "offset" + name ], 16859 doc[ "client" + name ] 16860 ); 16861 } 16862 16863 return value === undefined ? 16864 16865 // Get width or height on the element, requesting but not forcing parseFloat 16866 jQuery.css( elem, type, extra ) : 16867 16868 // Set width or height on the element 16869 jQuery.style( elem, type, value, extra ); 16870 }, type, chainable ? margin : undefined, chainable ); 16871 }; 16872 } ); 16873} ); 16874 16875 16876jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + 16877 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 16878 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 16879 function( i, name ) { 16880 16881 // Handle event binding 16882 jQuery.fn[ name ] = function( data, fn ) { 16883 return arguments.length > 0 ? 16884 this.on( name, null, data, fn ) : 16885 this.trigger( name ); 16886 }; 16887} ); 16888 16889jQuery.fn.extend( { 16890 hover: function( fnOver, fnOut ) { 16891 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 16892 } 16893} ); 16894 16895 16896 16897 16898jQuery.fn.extend( { 16899 16900 bind: function( types, data, fn ) { 16901 return this.on( types, null, data, fn ); 16902 }, 16903 unbind: function( types, fn ) { 16904 return this.off( types, null, fn ); 16905 }, 16906 16907 delegate: function( selector, types, data, fn ) { 16908 return this.on( types, selector, data, fn ); 16909 }, 16910 undelegate: function( selector, types, fn ) { 16911 16912 // ( namespace ) or ( selector, types [, fn] ) 16913 return arguments.length === 1 ? 16914 this.off( selector, "**" ) : 16915 this.off( types, selector || "**", fn ); 16916 } 16917} ); 16918 16919// Bind a function to a context, optionally partially applying any 16920// arguments. 16921// jQuery.proxy is deprecated to promote standards (specifically Function#bind) 16922// However, it is not slated for removal any time soon 16923jQuery.proxy = function( fn, context ) { 16924 var tmp, args, proxy; 16925 16926 if ( typeof context === "string" ) { 16927 tmp = fn[ context ]; 16928 context = fn; 16929 fn = tmp; 16930 } 16931 16932 // Quick check to determine if target is callable, in the spec 16933 // this throws a TypeError, but we will just return undefined. 16934 if ( !isFunction( fn ) ) { 16935 return undefined; 16936 } 16937 16938 // Simulated bind 16939 args = slice.call( arguments, 2 ); 16940 proxy = function() { 16941 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 16942 }; 16943 16944 // Set the guid of unique handler to the same of original handler, so it can be removed 16945 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 16946 16947 return proxy; 16948}; 16949 16950jQuery.holdReady = function( hold ) { 16951 if ( hold ) { 16952 jQuery.readyWait++; 16953 } else { 16954 jQuery.ready( true ); 16955 } 16956}; 16957jQuery.isArray = Array.isArray; 16958jQuery.parseJSON = JSON.parse; 16959jQuery.nodeName = nodeName; 16960jQuery.isFunction = isFunction; 16961jQuery.isWindow = isWindow; 16962jQuery.camelCase = camelCase; 16963jQuery.type = toType; 16964 16965jQuery.now = Date.now; 16966 16967jQuery.isNumeric = function( obj ) { 16968 16969 // As of jQuery 3.0, isNumeric is limited to 16970 // strings and numbers (primitives or objects) 16971 // that can be coerced to finite numbers (gh-2662) 16972 var type = jQuery.type( obj ); 16973 return ( type === "number" || type === "string" ) && 16974 16975 // parseFloat NaNs numeric-cast false positives ("") 16976 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 16977 // subtraction forces infinities to NaN 16978 !isNaN( obj - parseFloat( obj ) ); 16979}; 16980 16981 16982 16983 16984// Register as a named AMD module, since jQuery can be concatenated with other 16985// files that may use define, but not via a proper concatenation script that 16986// understands anonymous AMD modules. A named AMD is safest and most robust 16987// way to register. Lowercase jquery is used because AMD module names are 16988// derived from file names, and jQuery is normally delivered in a lowercase 16989// file name. Do this after creating the global so that if an AMD module wants 16990// to call noConflict to hide this version of jQuery, it will work. 16991 16992// Note that for maximum portability, libraries that are not jQuery should 16993// declare themselves as anonymous modules, and avoid setting a global if an 16994// AMD loader is present. jQuery is a special case. For more information, see 16995// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 16996 16997if ( true ) { 16998 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() { 16999 return jQuery; 17000 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 17001 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 17002} 17003 17004 17005 17006 17007var 17008 17009 // Map over jQuery in case of overwrite 17010 _jQuery = window.jQuery, 17011 17012 // Map over the $ in case of overwrite 17013 _$ = window.$; 17014 17015jQuery.noConflict = function( deep ) { 17016 if ( window.$ === jQuery ) { 17017 window.$ = _$; 17018 } 17019 17020 if ( deep && window.jQuery === jQuery ) { 17021 window.jQuery = _jQuery; 17022 } 17023 17024 return jQuery; 17025}; 17026 17027// Expose jQuery and $ identifiers, even in AMD 17028// (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 17029// and CommonJS for browser emulators (#13566) 17030if ( !noGlobal ) { 17031 window.jQuery = window.$ = jQuery; 17032} 17033 17034 17035 17036 17037return jQuery; 17038} ); 17039 17040 17041/***/ }), 17042
vendor: 541,016 bytes, lines 17043-34158
17043/***/ "./node_modules/lodash/lodash.js": 17044/*!***************************************!*\ 17045 !*** ./node_modules/lodash/lodash.js ***! 17046 \***************************************/ 17047/*! no static exports found */ 17048/***/ (function(module, exports, __webpack_require__) { 17049 17050/* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/** 17051 * @license 17052 * Lodash <https://lodash.com/> 17053 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/> 17054 * Released under MIT license <https://lodash.com/license> 17055 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 17056 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 17057 */ 17058;(function() { 17059 17060 /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 17061 var undefined; 17062 17063 /** Used as the semantic version number. */ 17064 var VERSION = '4.17.15'; 17065 17066 /** Used as the size to enable large array optimizations. */ 17067 var LARGE_ARRAY_SIZE = 200; 17068 17069 /** Error message constants. */ 17070 var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', 17071 FUNC_ERROR_TEXT = 'Expected a function'; 17072 17073 /** Used to stand-in for `undefined` hash values. */ 17074 var HASH_UNDEFINED = '__lodash_hash_undefined__'; 17075 17076 /** Used as the maximum memoize cache size. */ 17077 var MAX_MEMOIZE_SIZE = 500; 17078 17079 /** Used as the internal argument placeholder. */ 17080 var PLACEHOLDER = '__lodash_placeholder__'; 17081 17082 /** Used to compose bitmasks for cloning. */ 17083 var CLONE_DEEP_FLAG = 1, 17084 CLONE_FLAT_FLAG = 2, 17085 CLONE_SYMBOLS_FLAG = 4; 17086 17087 /** Used to compose bitmasks for value comparisons. */ 17088 var COMPARE_PARTIAL_FLAG = 1, 17089 COMPARE_UNORDERED_FLAG = 2; 17090 17091 /** Used to compose bitmasks for function metadata. */ 17092 var WRAP_BIND_FLAG = 1, 17093 WRAP_BIND_KEY_FLAG = 2, 17094 WRAP_CURRY_BOUND_FLAG = 4, 17095 WRAP_CURRY_FLAG = 8, 17096 WRAP_CURRY_RIGHT_FLAG = 16, 17097 WRAP_PARTIAL_FLAG = 32, 17098 WRAP_PARTIAL_RIGHT_FLAG = 64, 17099 WRAP_ARY_FLAG = 128, 17100 WRAP_REARG_FLAG = 256, 17101 WRAP_FLIP_FLAG = 512; 17102 17103 /** Used as default options for `_.truncate`. */ 17104 var DEFAULT_TRUNC_LENGTH = 30, 17105 DEFAULT_TRUNC_OMISSION = '...'; 17106 17107 /** Used to detect hot functions by number of calls within a span of milliseconds. */ 17108 var HOT_COUNT = 800, 17109 HOT_SPAN = 16; 17110 17111 /** Used to indicate the type of lazy iteratees. */ 17112 var LAZY_FILTER_FLAG = 1, 17113 LAZY_MAP_FLAG = 2, 17114 LAZY_WHILE_FLAG = 3; 17115 17116 /** Used as references for various `Number` constants. */ 17117 var INFINITY = 1 / 0, 17118 MAX_SAFE_INTEGER = 9007199254740991, 17119 MAX_INTEGER = 1.7976931348623157e+308, 17120 NAN = 0 / 0; 17121 17122 /** Used as references for the maximum length and index of an array. */ 17123 var MAX_ARRAY_LENGTH = 4294967295, 17124 MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, 17125 HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; 17126 17127 /** Used to associate wrap methods with their bit flags. */ 17128 var wrapFlags = [ 17129 ['ary', WRAP_ARY_FLAG], 17130 ['bind', WRAP_BIND_FLAG], 17131 ['bindKey', WRAP_BIND_KEY_FLAG], 17132 ['curry', WRAP_CURRY_FLAG], 17133 ['curryRight', WRAP_CURRY_RIGHT_FLAG], 17134 ['flip', WRAP_FLIP_FLAG], 17135 ['partial', WRAP_PARTIAL_FLAG], 17136 ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], 17137 ['rearg', WRAP_REARG_FLAG] 17138 ]; 17139 17140 /** `Object#toString` result references. */ 17141 var argsTag = '[object Arguments]', 17142 arrayTag = '[object Array]', 17143 asyncTag = '[object AsyncFunction]', 17144 boolTag = '[object Boolean]', 17145 dateTag = '[object Date]', 17146 domExcTag = '[object DOMException]', 17147 errorTag = '[object Error]', 17148 funcTag = '[object Function]', 17149 genTag = '[object GeneratorFunction]', 17150 mapTag = '[object Map]', 17151 numberTag = '[object Number]', 17152 nullTag = '[object Null]', 17153 objectTag = '[object Object]', 17154 promiseTag = '[object Promise]', 17155 proxyTag = '[object Proxy]', 17156 regexpTag = '[object RegExp]', 17157 setTag = '[object Set]', 17158 stringTag = '[object String]', 17159 symbolTag = '[object Symbol]', 17160 undefinedTag = '[object Undefined]', 17161 weakMapTag = '[object WeakMap]', 17162 weakSetTag = '[object WeakSet]'; 17163 17164 var arrayBufferTag = '[object ArrayBuffer]', 17165 dataViewTag = '[object DataView]', 17166 float32Tag = '[object Float32Array]', 17167 float64Tag = '[object Float64Array]', 17168 int8Tag = '[object Int8Array]', 17169 int16Tag = '[object Int16Array]', 17170 int32Tag = '[object Int32Array]', 17171 uint8Tag = '[object Uint8Array]', 17172 uint8ClampedTag = '[object Uint8ClampedArray]', 17173 uint16Tag = '[object Uint16Array]', 17174 uint32Tag = '[object Uint32Array]'; 17175 17176 /** Used to match empty string literals in compiled template source. */ 17177 var reEmptyStringLeading = /\b__p \+= '';/g, 17178 reEmptyStringMiddle = /\b(__p \+=) '' \+/g, 17179 reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; 17180 17181 /** Used to match HTML entities and HTML characters. */ 17182 var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, 17183 reUnescapedHtml = /[&<>"']/g, 17184 reHasEscapedHtml = RegExp(reEscapedHtml.source), 17185 reHasUnescapedHtml = RegExp(reUnescapedHtml.source); 17186 17187 /** Used to match template delimiters. */ 17188 var reEscape = /<%-([\s\S]+?)%>/g, 17189 reEvaluate = /<%([\s\S]+?)%>/g, 17190 reInterpolate = /<%=([\s\S]+?)%>/g; 17191 17192 /** Used to match property names within property paths. */ 17193 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, 17194 reIsPlainProp = /^\w*$/, 17195 rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; 17196 17197 /** 17198 * Used to match `RegExp` 17199 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). 17200 */ 17201 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, 17202 reHasRegExpChar = RegExp(reRegExpChar.source); 17203 17204 /** Used to match leading and trailing whitespace. */ 17205 var reTrim = /^\s+|\s+$/g, 17206 reTrimStart = /^\s+/, 17207 reTrimEnd = /\s+$/; 17208 17209 /** Used to match wrap detail comments. */ 17210 var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, 17211 reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, 17212 reSplitDetails = /,? & /; 17213 17214 /** Used to match words composed of alphanumeric characters. */ 17215 var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; 17216 17217 /** Used to match backslashes in property paths. */ 17218 var reEscapeChar = /\\(\\)?/g; 17219 17220 /** 17221 * Used to match 17222 * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). 17223 */ 17224 var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; 17225 17226 /** Used to match `RegExp` flags from their coerced string values. */ 17227 var reFlags = /\w*$/; 17228 17229 /** Used to detect bad signed hexadecimal string values. */ 17230 var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; 17231 17232 /** Used to detect binary string values. */ 17233 var reIsBinary = /^0b[01]+$/i; 17234 17235 /** Used to detect host constructors (Safari). */ 17236 var reIsHostCtor = /^\[object .+?Constructor\]$/; 17237 17238 /** Used to detect octal string values. */ 17239 var reIsOctal = /^0o[0-7]+$/i; 17240 17241 /** Used to detect unsigned integer values. */ 17242 var reIsUint = /^(?:0|[1-9]\d*)$/; 17243 17244 /** Used to match Latin Unicode letters (excluding mathematical operators). */ 17245 var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; 17246 17247 /** Used to ensure capturing order of template delimiters. */ 17248 var reNoMatch = /($^)/; 17249 17250 /** Used to match unescaped characters in compiled string literals. */ 17251 var reUnescapedString = /['\n\r\u2028\u2029\\]/g; 17252 17253 /** Used to compose unicode character classes. */ 17254 var rsAstralRange = '\\ud800-\\udfff', 17255 rsComboMarksRange = '\\u0300-\\u036f', 17256 reComboHalfMarksRange = '\\ufe20-\\ufe2f', 17257 rsComboSymbolsRange = '\\u20d0-\\u20ff', 17258 rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, 17259 rsDingbatRange = '\\u2700-\\u27bf', 17260 rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', 17261 rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', 17262 rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', 17263 rsPunctuationRange = '\\u2000-\\u206f', 17264 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', 17265 rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', 17266 rsVarRange = '\\ufe0e\\ufe0f', 17267 rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; 17268 17269 /** Used to compose unicode capture groups. */ 17270 var rsApos = "['\u2019]", 17271 rsAstral = '[' + rsAstralRange + ']', 17272 rsBreak = '[' + rsBreakRange + ']', 17273 rsCombo = '[' + rsComboRange + ']', 17274 rsDigits = '\\d+', 17275 rsDingbat = '[' + rsDingbatRange + ']', 17276 rsLower = '[' + rsLowerRange + ']', 17277 rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', 17278 rsFitz = '\\ud83c[\\udffb-\\udfff]', 17279 rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', 17280 rsNonAstral = '[^' + rsAstralRange + ']', 17281 rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', 17282 rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', 17283 rsUpper = '[' + rsUpperRange + ']', 17284 rsZWJ = '\\u200d'; 17285 17286 /** Used to compose unicode regexes. */ 17287 var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', 17288 rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', 17289 rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', 17290 rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', 17291 reOptMod = rsModifier + '?', 17292 rsOptVar = '[' + rsVarRange + ']?', 17293 rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', 17294 rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', 17295 rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', 17296 rsSeq = rsOptVar + reOptMod + rsOptJoin, 17297 rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, 17298 rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; 17299 17300 /** Used to match apostrophes. */ 17301 var reApos = RegExp(rsApos, 'g'); 17302 17303 /** 17304 * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and 17305 * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). 17306 */ 17307 var reComboMark = RegExp(rsCombo, 'g'); 17308 17309 /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ 17310 var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); 17311 17312 /** Used to match complex or compound words. */ 17313 var reUnicodeWord = RegExp([ 17314 rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', 17315 rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', 17316 rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, 17317 rsUpper + '+' + rsOptContrUpper, 17318 rsOrdUpper, 17319 rsOrdLower, 17320 rsDigits, 17321 rsEmoji 17322 ].join('|'), 'g'); 17323 17324 /** 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/). */ 17325 var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); 17326 17327 /** Used to detect strings that need a more robust regexp to match words. */ 17328 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 ]/; 17329 17330 /** Used to assign default `context` object properties. */ 17331 var contextProps = [ 17332 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', 17333 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', 17334 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', 17335 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', 17336 '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' 17337 ]; 17338 17339 /** Used to make template sourceURLs easier to identify. */ 17340 var templateCounter = -1; 17341 17342 /** Used to identify `toStringTag` values of typed arrays. */ 17343 var typedArrayTags = {}; 17344 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = 17345 typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = 17346 typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = 17347 typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = 17348 typedArrayTags[uint32Tag] = true; 17349 typedArrayTags[argsTag] = typedArrayTags[arrayTag] = 17350 typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = 17351 typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = 17352 typedArrayTags[errorTag] = typedArrayTags[funcTag] = 17353 typedArrayTags[mapTag] = typedArrayTags[numberTag] = 17354 typedArrayTags[objectTag] = typedArrayTags[regexpTag] = 17355 typedArrayTags[setTag] = typedArrayTags[stringTag] = 17356 typedArrayTags[weakMapTag] = false; 17357 17358 /** Used to identify `toStringTag` values supported by `_.clone`. */ 17359 var cloneableTags = {}; 17360 cloneableTags[argsTag] = cloneableTags[arrayTag] = 17361 cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = 17362 cloneableTags[boolTag] = cloneableTags[dateTag] = 17363 cloneableTags[float32Tag] = cloneableTags[float64Tag] = 17364 cloneableTags[int8Tag] = cloneableTags[int16Tag] = 17365 cloneableTags[int32Tag] = cloneableTags[mapTag] = 17366 cloneableTags[numberTag] = cloneableTags[objectTag] = 17367 cloneableTags[regexpTag] = cloneableTags[setTag] = 17368 cloneableTags[stringTag] = cloneableTags[symbolTag] = 17369 cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = 17370 cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; 17371 cloneableTags[errorTag] = cloneableTags[funcTag] = 17372 cloneableTags[weakMapTag] = false; 17373 17374 /** Used to map Latin Unicode letters to basic Latin letters. */ 17375 var deburredLetters = { 17376 // Latin-1 Supplement block. 17377 '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', 17378 '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', 17379 '\xc7': 'C', '\xe7': 'c', 17380 '\xd0': 'D', '\xf0': 'd', 17381 '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', 17382 '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', 17383 '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', 17384 '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', 17385 '\xd1': 'N', '\xf1': 'n', 17386 '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', 17387 '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', 17388 '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', 17389 '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', 17390 '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', 17391 '\xc6': 'Ae', '\xe6': 'ae', 17392 '\xde': 'Th', '\xfe': 'th', 17393 '\xdf': 'ss', 17394 // Latin Extended-A block. 17395 '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', 17396 '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', 17397 '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', 17398 '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', 17399 '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', 17400 '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', 17401 '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', 17402 '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', 17403 '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', 17404 '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', 17405 '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', 17406 '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', 17407 '\u0134': 'J', '\u0135': 'j', 17408 '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', 17409 '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', 17410 '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', 17411 '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', 17412 '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', 17413 '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', 17414 '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', 17415 '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', 17416 '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', 17417 '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', 17418 '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', 17419 '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', 17420 '\u0163': 't', '\u0165': 't', '\u0167': 't', 17421 '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', 17422 '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', 17423 '\u0174': 'W', '\u0175': 'w', 17424 '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', 17425 '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', 17426 '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', 17427 '\u0132': 'IJ', '\u0133': 'ij', 17428 '\u0152': 'Oe', '\u0153': 'oe', 17429 '\u0149': "'n", '\u017f': 's' 17430 }; 17431 17432 /** Used to map characters to HTML entities. */ 17433 var htmlEscapes = { 17434 '&': '&', 17435 '<': '<', 17436 '>': '>', 17437 '"': '"', 17438 "'": ''' 17439 }; 17440 17441 /** Used to map HTML entities to characters. */ 17442 var htmlUnescapes = { 17443 '&': '&', 17444 '<': '<', 17445 '>': '>', 17446 '"': '"', 17447 ''': "'" 17448 }; 17449 17450 /** Used to escape characters for inclusion in compiled string literals. */ 17451 var stringEscapes = { 17452 '\\': '\\', 17453 "'": "'", 17454 '\n': 'n', 17455 '\r': 'r', 17456 '\u2028': 'u2028', 17457 '\u2029': 'u2029' 17458 }; 17459 17460 /** Built-in method references without a dependency on `root`. */ 17461 var freeParseFloat = parseFloat, 17462 freeParseInt = parseInt; 17463 17464 /** Detect free variable `global` from Node.js. */ 17465 var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; 17466 17467 /** Detect free variable `self`. */ 17468 var freeSelf = typeof self == 'object' && self && self.Object === Object && self; 17469 17470 /** Used as a reference to the global object. */ 17471 var root = freeGlobal || freeSelf || Function('return this')(); 17472 17473 /** Detect free variable `exports`. */ 17474 var freeExports = true && exports && !exports.nodeType && exports; 17475 17476 /** Detect free variable `module`. */ 17477 var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; 17478 17479 /** Detect the popular CommonJS extension `module.exports`. */ 17480 var moduleExports = freeModule && freeModule.exports === freeExports; 17481 17482 /** Detect free variable `process` from Node.js. */ 17483 var freeProcess = moduleExports && freeGlobal.process; 17484 17485 /** Used to access faster Node.js helpers. */ 17486 var nodeUtil = (function() { 17487 try { 17488 // Use `util.types` for Node.js 10+. 17489 var types = freeModule && freeModule.require && freeModule.require('util').types; 17490 17491 if (types) { 17492 return types; 17493 } 17494 17495 // Legacy `process.binding('util')` for Node.js < 10. 17496 return freeProcess && freeProcess.binding && freeProcess.binding('util'); 17497 } catch (e) {} 17498 }()); 17499 17500 /* Node.js helper references. */ 17501 var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, 17502 nodeIsDate = nodeUtil && nodeUtil.isDate, 17503 nodeIsMap = nodeUtil && nodeUtil.isMap, 17504 nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, 17505 nodeIsSet = nodeUtil && nodeUtil.isSet, 17506 nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; 17507 17508 /*--------------------------------------------------------------------------*/ 17509 17510 /** 17511 * A faster alternative to `Function#apply`, this function invokes `func` 17512 * with the `this` binding of `thisArg` and the arguments of `args`. 17513 * 17514 * @private 17515 * @param {Function} func The function to invoke. 17516 * @param {*} thisArg The `this` binding of `func`. 17517 * @param {Array} args The arguments to invoke `func` with. 17518 * @returns {*} Returns the result of `func`. 17519 */ 17520 function apply(func, thisArg, args) { 17521 switch (args.length) { 17522 case 0: return func.call(thisArg); 17523 case 1: return func.call(thisArg, args[0]); 17524 case 2: return func.call(thisArg, args[0], args[1]); 17525 case 3: return func.call(thisArg, args[0], args[1], args[2]); 17526 } 17527 return func.apply(thisArg, args); 17528 } 17529 17530 /** 17531 * A specialized version of `baseAggregator` for arrays. 17532 * 17533 * @private 17534 * @param {Array} [array] The array to iterate over. 17535 * @param {Function} setter The function to set `accumulator` values. 17536 * @param {Function} iteratee The iteratee to transform keys. 17537 * @param {Object} accumulator The initial aggregated object. 17538 * @returns {Function} Returns `accumulator`. 17539 */ 17540 function arrayAggregator(array, setter, iteratee, accumulator) { 17541 var index = -1, 17542 length = array == null ? 0 : array.length; 17543 17544 while (++index < length) { 17545 var value = array[index]; 17546 setter(accumulator, value, iteratee(value), array); 17547 } 17548 return accumulator; 17549 } 17550 17551 /** 17552 * A specialized version of `_.forEach` for arrays without support for 17553 * iteratee shorthands. 17554 * 17555 * @private 17556 * @param {Array} [array] The array to iterate over. 17557 * @param {Function} iteratee The function invoked per iteration. 17558 * @returns {Array} Returns `array`. 17559 */ 17560 function arrayEach(array, iteratee) { 17561 var index = -1, 17562 length = array == null ? 0 : array.length; 17563 17564 while (++index < length) { 17565 if (iteratee(array[index], index, array) === false) { 17566 break; 17567 } 17568 } 17569 return array; 17570 } 17571 17572 /** 17573 * A specialized version of `_.forEachRight` for arrays without support for 17574 * iteratee shorthands. 17575 * 17576 * @private 17577 * @param {Array} [array] The array to iterate over. 17578 * @param {Function} iteratee The function invoked per iteration. 17579 * @returns {Array} Returns `array`. 17580 */ 17581 function arrayEachRight(array, iteratee) { 17582 var length = array == null ? 0 : array.length; 17583 17584 while (length--) { 17585 if (iteratee(array[length], length, array) === false) { 17586 break; 17587 } 17588 } 17589 return array; 17590 } 17591 17592 /** 17593 * A specialized version of `_.every` for arrays without support for 17594 * iteratee shorthands. 17595 * 17596 * @private 17597 * @param {Array} [array] The array to iterate over. 17598 * @param {Function} predicate The function invoked per iteration. 17599 * @returns {boolean} Returns `true` if all elements pass the predicate check, 17600 * else `false`. 17601 */ 17602 function arrayEvery(array, predicate) { 17603 var index = -1, 17604 length = array == null ? 0 : array.length; 17605 17606 while (++index < length) { 17607 if (!predicate(array[index], index, array)) { 17608 return false; 17609 } 17610 } 17611 return true; 17612 } 17613 17614 /** 17615 * A specialized version of `_.filter` for arrays without support for 17616 * iteratee shorthands. 17617 * 17618 * @private 17619 * @param {Array} [array] The array to iterate over. 17620 * @param {Function} predicate The function invoked per iteration. 17621 * @returns {Array} Returns the new filtered array. 17622 */ 17623 function arrayFilter(array, predicate) { 17624 var index = -1, 17625 length = array == null ? 0 : array.length, 17626 resIndex = 0, 17627 result = []; 17628 17629 while (++index < length) { 17630 var value = array[index]; 17631 if (predicate(value, index, array)) { 17632 result[resIndex++] = value; 17633 } 17634 } 17635 return result; 17636 } 17637 17638 /** 17639 * A specialized version of `_.includes` for arrays without support for 17640 * specifying an index to search from. 17641 * 17642 * @private 17643 * @param {Array} [array] The array to inspect. 17644 * @param {*} target The value to search for. 17645 * @returns {boolean} Returns `true` if `target` is found, else `false`. 17646 */ 17647 function arrayIncludes(array, value) { 17648 var length = array == null ? 0 : array.length; 17649 return !!length && baseIndexOf(array, value, 0) > -1; 17650 } 17651 17652 /** 17653 * This function is like `arrayIncludes` except that it accepts a comparator. 17654 * 17655 * @private 17656 * @param {Array} [array] The array to inspect. 17657 * @param {*} target The value to search for. 17658 * @param {Function} comparator The comparator invoked per element. 17659 * @returns {boolean} Returns `true` if `target` is found, else `false`. 17660 */ 17661 function arrayIncludesWith(array, value, comparator) { 17662 var index = -1, 17663 length = array == null ? 0 : array.length; 17664 17665 while (++index < length) { 17666 if (comparator(value, array[index])) { 17667 return true; 17668 } 17669 } 17670 return false; 17671 } 17672 17673 /** 17674 * A specialized version of `_.map` for arrays without support for iteratee 17675 * shorthands. 17676 * 17677 * @private 17678 * @param {Array} [array] The array to iterate over. 17679 * @param {Function} iteratee The function invoked per iteration. 17680 * @returns {Array} Returns the new mapped array. 17681 */ 17682 function arrayMap(array, iteratee) { 17683 var index = -1, 17684 length = array == null ? 0 : array.length, 17685 result = Array(length); 17686 17687 while (++index < length) { 17688 result[index] = iteratee(array[index], index, array); 17689 } 17690 return result; 17691 } 17692 17693 /** 17694 * Appends the elements of `values` to `array`. 17695 * 17696 * @private 17697 * @param {Array} array The array to modify. 17698 * @param {Array} values The values to append. 17699 * @returns {Array} Returns `array`. 17700 */ 17701 function arrayPush(array, values) { 17702 var index = -1, 17703 length = values.length, 17704 offset = array.length; 17705 17706 while (++index < length) { 17707 array[offset + index] = values[index]; 17708 } 17709 return array; 17710 } 17711 17712 /** 17713 * A specialized version of `_.reduce` for arrays without support for 17714 * iteratee shorthands. 17715 * 17716 * @private 17717 * @param {Array} [array] The array to iterate over. 17718 * @param {Function} iteratee The function invoked per iteration. 17719 * @param {*} [accumulator] The initial value. 17720 * @param {boolean} [initAccum] Specify using the first element of `array` as 17721 * the initial value. 17722 * @returns {*} Returns the accumulated value. 17723 */ 17724 function arrayReduce(array, iteratee, accumulator, initAccum) { 17725 var index = -1, 17726 length = array == null ? 0 : array.length; 17727 17728 if (initAccum && length) { 17729 accumulator = array[++index]; 17730 } 17731 while (++index < length) { 17732 accumulator = iteratee(accumulator, array[index], index, array); 17733 } 17734 return accumulator; 17735 } 17736 17737 /** 17738 * A specialized version of `_.reduceRight` for arrays without support for 17739 * iteratee shorthands. 17740 * 17741 * @private 17742 * @param {Array} [array] The array to iterate over. 17743 * @param {Function} iteratee The function invoked per iteration. 17744 * @param {*} [accumulator] The initial value. 17745 * @param {boolean} [initAccum] Specify using the last element of `array` as 17746 * the initial value. 17747 * @returns {*} Returns the accumulated value. 17748 */ 17749 function arrayReduceRight(array, iteratee, accumulator, initAccum) { 17750 var length = array == null ? 0 : array.length; 17751 if (initAccum && length) { 17752 accumulator = array[--length]; 17753 } 17754 while (length--) { 17755 accumulator = iteratee(accumulator, array[length], length, array); 17756 } 17757 return accumulator; 17758 } 17759 17760 /** 17761 * A specialized version of `_.some` for arrays without support for iteratee 17762 * shorthands. 17763 * 17764 * @private 17765 * @param {Array} [array] The array to iterate over. 17766 * @param {Function} predicate The function invoked per iteration. 17767 * @returns {boolean} Returns `true` if any element passes the predicate check, 17768 * else `false`. 17769 */ 17770 function arraySome(array, predicate) { 17771 var index = -1, 17772 length = array == null ? 0 : array.length; 17773 17774 while (++index < length) { 17775 if (predicate(array[index], index, array)) { 17776 return true; 17777 } 17778 } 17779 return false; 17780 } 17781 17782 /** 17783 * Gets the size of an ASCII `string`. 17784 * 17785 * @private 17786 * @param {string} string The string inspect. 17787 * @returns {number} Returns the string size. 17788 */ 17789 var asciiSize = baseProperty('length'); 17790 17791 /** 17792 * Converts an ASCII `string` to an array. 17793 * 17794 * @private 17795 * @param {string} string The string to convert. 17796 * @returns {Array} Returns the converted array. 17797 */ 17798 function asciiToArray(string) { 17799 return string.split(''); 17800 } 17801 17802 /** 17803 * Splits an ASCII `string` into an array of its words. 17804 * 17805 * @private 17806 * @param {string} The string to inspect. 17807 * @returns {Array} Returns the words of `string`. 17808 */ 17809 function asciiWords(string) { 17810 return string.match(reAsciiWord) || []; 17811 } 17812 17813 /** 17814 * The base implementation of methods like `_.findKey` and `_.findLastKey`, 17815 * without support for iteratee shorthands, which iterates over `collection` 17816 * using `eachFunc`. 17817 * 17818 * @private 17819 * @param {Array|Object} collection The collection to inspect. 17820 * @param {Function} predicate The function invoked per iteration. 17821 * @param {Function} eachFunc The function to iterate over `collection`. 17822 * @returns {*} Returns the found element or its key, else `undefined`. 17823 */ 17824 function baseFindKey(collection, predicate, eachFunc) { 17825 var result; 17826 eachFunc(collection, function(value, key, collection) { 17827 if (predicate(value, key, collection)) { 17828 result = key; 17829 return false; 17830 } 17831 }); 17832 return result; 17833 } 17834 17835 /** 17836 * The base implementation of `_.findIndex` and `_.findLastIndex` without 17837 * support for iteratee shorthands. 17838 * 17839 * @private 17840 * @param {Array} array The array to inspect. 17841 * @param {Function} predicate The function invoked per iteration. 17842 * @param {number} fromIndex The index to search from. 17843 * @param {boolean} [fromRight] Specify iterating from right to left. 17844 * @returns {number} Returns the index of the matched value, else `-1`. 17845 */ 17846 function baseFindIndex(array, predicate, fromIndex, fromRight) { 17847 var length = array.length, 17848 index = fromIndex + (fromRight ? 1 : -1); 17849 17850 while ((fromRight ? index-- : ++index < length)) { 17851 if (predicate(array[index], index, array)) { 17852 return index; 17853 } 17854 } 17855 return -1; 17856 } 17857 17858 /** 17859 * The base implementation of `_.indexOf` without `fromIndex` bounds checks. 17860 * 17861 * @private 17862 * @param {Array} array The array to inspect. 17863 * @param {*} value The value to search for. 17864 * @param {number} fromIndex The index to search from. 17865 * @returns {number} Returns the index of the matched value, else `-1`. 17866 */ 17867 function baseIndexOf(array, value, fromIndex) { 17868 return value === value 17869 ? strictIndexOf(array, value, fromIndex) 17870 : baseFindIndex(array, baseIsNaN, fromIndex); 17871 } 17872 17873 /** 17874 * This function is like `baseIndexOf` except that it accepts a comparator. 17875 * 17876 * @private 17877 * @param {Array} array The array to inspect. 17878 * @param {*} value The value to search for. 17879 * @param {number} fromIndex The index to search from. 17880 * @param {Function} comparator The comparator invoked per element. 17881 * @returns {number} Returns the index of the matched value, else `-1`. 17882 */ 17883 function baseIndexOfWith(array, value, fromIndex, comparator) { 17884 var index = fromIndex - 1, 17885 length = array.length; 17886 17887 while (++index < length) { 17888 if (comparator(array[index], value)) { 17889 return index; 17890 } 17891 } 17892 return -1; 17893 } 17894 17895 /** 17896 * The base implementation of `_.isNaN` without support for number objects. 17897 * 17898 * @private 17899 * @param {*} value The value to check. 17900 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. 17901 */ 17902 function baseIsNaN(value) { 17903 return value !== value; 17904 } 17905 17906 /** 17907 * The base implementation of `_.mean` and `_.meanBy` without support for 17908 * iteratee shorthands. 17909 * 17910 * @private 17911 * @param {Array} array The array to iterate over. 17912 * @param {Function} iteratee The function invoked per iteration. 17913 * @returns {number} Returns the mean. 17914 */ 17915 function baseMean(array, iteratee) { 17916 var length = array == null ? 0 : array.length; 17917 return length ? (baseSum(array, iteratee) / length) : NAN; 17918 } 17919 17920 /** 17921 * The base implementation of `_.property` without support for deep paths. 17922 * 17923 * @private 17924 * @param {string} key The key of the property to get. 17925 * @returns {Function} Returns the new accessor function. 17926 */ 17927 function baseProperty(key) { 17928 return function(object) { 17929 return object == null ? undefined : object[key]; 17930 }; 17931 } 17932 17933 /** 17934 * The base implementation of `_.propertyOf` without support for deep paths. 17935 * 17936 * @private 17937 * @param {Object} object The object to query. 17938 * @returns {Function} Returns the new accessor function. 17939 */ 17940 function basePropertyOf(object) { 17941 return function(key) { 17942 return object == null ? undefined : object[key]; 17943 }; 17944 } 17945 17946 /** 17947 * The base implementation of `_.reduce` and `_.reduceRight`, without support 17948 * for iteratee shorthands, which iterates over `collection` using `eachFunc`. 17949 * 17950 * @private 17951 * @param {Array|Object} collection The collection to iterate over. 17952 * @param {Function} iteratee The function invoked per iteration. 17953 * @param {*} accumulator The initial value. 17954 * @param {boolean} initAccum Specify using the first or last element of 17955 * `collection` as the initial value. 17956 * @param {Function} eachFunc The function to iterate over `collection`. 17957 * @returns {*} Returns the accumulated value. 17958 */ 17959 function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { 17960 eachFunc(collection, function(value, index, collection) { 17961 accumulator = initAccum 17962 ? (initAccum = false, value) 17963 : iteratee(accumulator, value, index, collection); 17964 }); 17965 return accumulator; 17966 } 17967 17968 /** 17969 * The base implementation of `_.sortBy` which uses `comparer` to define the 17970 * sort order of `array` and replaces criteria objects with their corresponding 17971 * values. 17972 * 17973 * @private 17974 * @param {Array} array The array to sort. 17975 * @param {Function} comparer The function to define sort order. 17976 * @returns {Array} Returns `array`. 17977 */ 17978 function baseSortBy(array, comparer) { 17979 var length = array.length; 17980 17981 array.sort(comparer); 17982 while (length--) { 17983 array[length] = array[length].value; 17984 } 17985 return array; 17986 } 17987 17988 /** 17989 * The base implementation of `_.sum` and `_.sumBy` without support for 17990 * iteratee shorthands. 17991 * 17992 * @private 17993 * @param {Array} array The array to iterate over. 17994 * @param {Function} iteratee The function invoked per iteration. 17995 * @returns {number} Returns the sum. 17996 */ 17997 function baseSum(array, iteratee) { 17998 var result, 17999 index = -1, 18000 length = array.length; 18001 18002 while (++index < length) { 18003 var current = iteratee(array[index]); 18004 if (current !== undefined) { 18005 result = result === undefined ? current : (result + current); 18006 } 18007 } 18008 return result; 18009 } 18010 18011 /** 18012 * The base implementation of `_.times` without support for iteratee shorthands 18013 * or max array length checks. 18014 * 18015 * @private 18016 * @param {number} n The number of times to invoke `iteratee`. 18017 * @param {Function} iteratee The function invoked per iteration. 18018 * @returns {Array} Returns the array of results. 18019 */ 18020 function baseTimes(n, iteratee) { 18021 var index = -1, 18022 result = Array(n); 18023 18024 while (++index < n) { 18025 result[index] = iteratee(index); 18026 } 18027 return result; 18028 } 18029 18030 /** 18031 * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array 18032 * of key-value pairs for `object` corresponding to the property names of `props`. 18033 * 18034 * @private 18035 * @param {Object} object The object to query. 18036 * @param {Array} props The property names to get values for. 18037 * @returns {Object} Returns the key-value pairs. 18038 */ 18039 function baseToPairs(object, props) { 18040 return arrayMap(props, function(key) { 18041 return [key, object[key]]; 18042 }); 18043 } 18044 18045 /** 18046 * The base implementation of `_.unary` without support for storing metadata. 18047 * 18048 * @private 18049 * @param {Function} func The function to cap arguments for. 18050 * @returns {Function} Returns the new capped function. 18051 */ 18052 function baseUnary(func) { 18053 return function(value) { 18054 return func(value); 18055 }; 18056 } 18057 18058 /** 18059 * The base implementation of `_.values` and `_.valuesIn` which creates an 18060 * array of `object` property values corresponding to the property names 18061 * of `props`. 18062 * 18063 * @private 18064 * @param {Object} object The object to query. 18065 * @param {Array} props The property names to get values for. 18066 * @returns {Object} Returns the array of property values. 18067 */ 18068 function baseValues(object, props) { 18069 return arrayMap(props, function(key) { 18070 return object[key]; 18071 }); 18072 } 18073 18074 /** 18075 * Checks if a `cache` value for `key` exists. 18076 * 18077 * @private 18078 * @param {Object} cache The cache to query. 18079 * @param {string} key The key of the entry to check. 18080 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 18081 */ 18082 function cacheHas(cache, key) { 18083 return cache.has(key); 18084 } 18085 18086 /** 18087 * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol 18088 * that is not found in the character symbols. 18089 * 18090 * @private 18091 * @param {Array} strSymbols The string symbols to inspect. 18092 * @param {Array} chrSymbols The character symbols to find. 18093 * @returns {number} Returns the index of the first unmatched string symbol. 18094 */ 18095 function charsStartIndex(strSymbols, chrSymbols) { 18096 var index = -1, 18097 length = strSymbols.length; 18098 18099 while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} 18100 return index; 18101 } 18102 18103 /** 18104 * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol 18105 * that is not found in the character symbols. 18106 * 18107 * @private 18108 * @param {Array} strSymbols The string symbols to inspect. 18109 * @param {Array} chrSymbols The character symbols to find. 18110 * @returns {number} Returns the index of the last unmatched string symbol. 18111 */ 18112 function charsEndIndex(strSymbols, chrSymbols) { 18113 var index = strSymbols.length; 18114 18115 while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} 18116 return index; 18117 } 18118 18119 /** 18120 * Gets the number of `placeholder` occurrences in `array`. 18121 * 18122 * @private 18123 * @param {Array} array The array to inspect. 18124 * @param {*} placeholder The placeholder to search for. 18125 * @returns {number} Returns the placeholder count. 18126 */ 18127 function countHolders(array, placeholder) { 18128 var length = array.length, 18129 result = 0; 18130 18131 while (length--) { 18132 if (array[length] === placeholder) { 18133 ++result; 18134 } 18135 } 18136 return result; 18137 } 18138 18139 /** 18140 * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A 18141 * letters to basic Latin letters. 18142 * 18143 * @private 18144 * @param {string} letter The matched letter to deburr. 18145 * @returns {string} Returns the deburred letter. 18146 */ 18147 var deburrLetter = basePropertyOf(deburredLetters); 18148 18149 /** 18150 * Used by `_.escape` to convert characters to HTML entities. 18151 * 18152 * @private 18153 * @param {string} chr The matched character to escape. 18154 * @returns {string} Returns the escaped character. 18155 */ 18156 var escapeHtmlChar = basePropertyOf(htmlEscapes); 18157 18158 /** 18159 * Used by `_.template` to escape characters for inclusion in compiled string literals. 18160 * 18161 * @private 18162 * @param {string} chr The matched character to escape. 18163 * @returns {string} Returns the escaped character. 18164 */ 18165 function escapeStringChar(chr) { 18166 return '\\' + stringEscapes[chr]; 18167 } 18168 18169 /** 18170 * Gets the value at `key` of `object`. 18171 * 18172 * @private 18173 * @param {Object} [object] The object to query. 18174 * @param {string} key The key of the property to get. 18175 * @returns {*} Returns the property value. 18176 */ 18177 function getValue(object, key) { 18178 return object == null ? undefined : object[key]; 18179 } 18180 18181 /** 18182 * Checks if `string` contains Unicode symbols. 18183 * 18184 * @private 18185 * @param {string} string The string to inspect. 18186 * @returns {boolean} Returns `true` if a symbol is found, else `false`. 18187 */ 18188 function hasUnicode(string) { 18189 return reHasUnicode.test(string); 18190 } 18191 18192 /** 18193 * Checks if `string` contains a word composed of Unicode symbols. 18194 * 18195 * @private 18196 * @param {string} string The string to inspect. 18197 * @returns {boolean} Returns `true` if a word is found, else `false`. 18198 */ 18199 function hasUnicodeWord(string) { 18200 return reHasUnicodeWord.test(string); 18201 } 18202 18203 /** 18204 * Converts `iterator` to an array. 18205 * 18206 * @private 18207 * @param {Object} iterator The iterator to convert. 18208 * @returns {Array} Returns the converted array. 18209 */ 18210 function iteratorToArray(iterator) { 18211 var data, 18212 result = []; 18213 18214 while (!(data = iterator.next()).done) { 18215 result.push(data.value); 18216 } 18217 return result; 18218 } 18219 18220 /** 18221 * Converts `map` to its key-value pairs. 18222 * 18223 * @private 18224 * @param {Object} map The map to convert. 18225 * @returns {Array} Returns the key-value pairs. 18226 */ 18227 function mapToArray(map) { 18228 var index = -1, 18229 result = Array(map.size); 18230 18231 map.forEach(function(value, key) { 18232 result[++index] = [key, value]; 18233 }); 18234 return result; 18235 } 18236 18237 /** 18238 * Creates a unary function that invokes `func` with its argument transformed. 18239 * 18240 * @private 18241 * @param {Function} func The function to wrap. 18242 * @param {Function} transform The argument transform. 18243 * @returns {Function} Returns the new function. 18244 */ 18245 function overArg(func, transform) { 18246 return function(arg) { 18247 return func(transform(arg)); 18248 }; 18249 } 18250 18251 /** 18252 * Replaces all `placeholder` elements in `array` with an internal placeholder 18253 * and returns an array of their indexes. 18254 * 18255 * @private 18256 * @param {Array} array The array to modify. 18257 * @param {*} placeholder The placeholder to replace. 18258 * @returns {Array} Returns the new array of placeholder indexes. 18259 */ 18260 function replaceHolders(array, placeholder) { 18261 var index = -1, 18262 length = array.length, 18263 resIndex = 0, 18264 result = []; 18265 18266 while (++index < length) { 18267 var value = array[index]; 18268 if (value === placeholder || value === PLACEHOLDER) { 18269 array[index] = PLACEHOLDER; 18270 result[resIndex++] = index; 18271 } 18272 } 18273 return result; 18274 } 18275 18276 /** 18277 * Converts `set` to an array of its values. 18278 * 18279 * @private 18280 * @param {Object} set The set to convert. 18281 * @returns {Array} Returns the values. 18282 */ 18283 function setToArray(set) { 18284 var index = -1, 18285 result = Array(set.size); 18286 18287 set.forEach(function(value) { 18288 result[++index] = value; 18289 }); 18290 return result; 18291 } 18292 18293 /** 18294 * Converts `set` to its value-value pairs. 18295 * 18296 * @private 18297 * @param {Object} set The set to convert. 18298 * @returns {Array} Returns the value-value pairs. 18299 */ 18300 function setToPairs(set) { 18301 var index = -1, 18302 result = Array(set.size); 18303 18304 set.forEach(function(value) { 18305 result[++index] = [value, value]; 18306 }); 18307 return result; 18308 } 18309 18310 /** 18311 * A specialized version of `_.indexOf` which performs strict equality 18312 * comparisons of values, i.e. `===`. 18313 * 18314 * @private 18315 * @param {Array} array The array to inspect. 18316 * @param {*} value The value to search for. 18317 * @param {number} fromIndex The index to search from. 18318 * @returns {number} Returns the index of the matched value, else `-1`. 18319 */ 18320 function strictIndexOf(array, value, fromIndex) { 18321 var index = fromIndex - 1, 18322 length = array.length; 18323 18324 while (++index < length) { 18325 if (array[index] === value) { 18326 return index; 18327 } 18328 } 18329 return -1; 18330 } 18331 18332 /** 18333 * A specialized version of `_.lastIndexOf` which performs strict equality 18334 * comparisons of values, i.e. `===`. 18335 * 18336 * @private 18337 * @param {Array} array The array to inspect. 18338 * @param {*} value The value to search for. 18339 * @param {number} fromIndex The index to search from. 18340 * @returns {number} Returns the index of the matched value, else `-1`. 18341 */ 18342 function strictLastIndexOf(array, value, fromIndex) { 18343 var index = fromIndex + 1; 18344 while (index--) { 18345 if (array[index] === value) { 18346 return index; 18347 } 18348 } 18349 return index; 18350 } 18351 18352 /** 18353 * Gets the number of symbols in `string`. 18354 * 18355 * @private 18356 * @param {string} string The string to inspect. 18357 * @returns {number} Returns the string size. 18358 */ 18359 function stringSize(string) { 18360 return hasUnicode(string) 18361 ? unicodeSize(string) 18362 : asciiSize(string); 18363 } 18364 18365 /** 18366 * Converts `string` to an array. 18367 * 18368 * @private 18369 * @param {string} string The string to convert. 18370 * @returns {Array} Returns the converted array. 18371 */ 18372 function stringToArray(string) { 18373 return hasUnicode(string) 18374 ? unicodeToArray(string) 18375 : asciiToArray(string); 18376 } 18377 18378 /** 18379 * Used by `_.unescape` to convert HTML entities to characters. 18380 * 18381 * @private 18382 * @param {string} chr The matched character to unescape. 18383 * @returns {string} Returns the unescaped character. 18384 */ 18385 var unescapeHtmlChar = basePropertyOf(htmlUnescapes); 18386 18387 /** 18388 * Gets the size of a Unicode `string`. 18389 * 18390 * @private 18391 * @param {string} string The string inspect. 18392 * @returns {number} Returns the string size. 18393 */ 18394 function unicodeSize(string) { 18395 var result = reUnicode.lastIndex = 0; 18396 while (reUnicode.test(string)) { 18397 ++result; 18398 } 18399 return result; 18400 } 18401 18402 /** 18403 * Converts a Unicode `string` to an array. 18404 * 18405 * @private 18406 * @param {string} string The string to convert. 18407 * @returns {Array} Returns the converted array. 18408 */ 18409 function unicodeToArray(string) { 18410 return string.match(reUnicode) || []; 18411 } 18412 18413 /** 18414 * Splits a Unicode `string` into an array of its words. 18415 * 18416 * @private 18417 * @param {string} The string to inspect. 18418 * @returns {Array} Returns the words of `string`. 18419 */ 18420 function unicodeWords(string) { 18421 return string.match(reUnicodeWord) || []; 18422 } 18423 18424 /*--------------------------------------------------------------------------*/ 18425 18426 /** 18427 * Create a new pristine `lodash` function using the `context` object. 18428 * 18429 * @static 18430 * @memberOf _ 18431 * @since 1.1.0 18432 * @category Util 18433 * @param {Object} [context=root] The context object. 18434 * @returns {Function} Returns a new `lodash` function. 18435 * @example 18436 * 18437 * _.mixin({ 'foo': _.constant('foo') }); 18438 * 18439 * var lodash = _.runInContext(); 18440 * lodash.mixin({ 'bar': lodash.constant('bar') }); 18441 * 18442 * _.isFunction(_.foo); 18443 * // => true 18444 * _.isFunction(_.bar); 18445 * // => false 18446 * 18447 * lodash.isFunction(lodash.foo); 18448 * // => false 18449 * lodash.isFunction(lodash.bar); 18450 * // => true 18451 * 18452 * // Create a suped-up `defer` in Node.js. 18453 * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; 18454 */ 18455 var runInContext = (function runInContext(context) { 18456 context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); 18457 18458 /** Built-in constructor references. */ 18459 var Array = context.Array, 18460 Date = context.Date, 18461 Error = context.Error, 18462 Function = context.Function, 18463 Math = context.Math, 18464 Object = context.Object, 18465 RegExp = context.RegExp, 18466 String = context.String, 18467 TypeError = context.TypeError; 18468 18469 /** Used for built-in method references. */ 18470 var arrayProto = Array.prototype, 18471 funcProto = Function.prototype, 18472 objectProto = Object.prototype; 18473 18474 /** Used to detect overreaching core-js shims. */ 18475 var coreJsData = context['__core-js_shared__']; 18476 18477 /** Used to resolve the decompiled source of functions. */ 18478 var funcToString = funcProto.toString; 18479 18480 /** Used to check objects for own properties. */ 18481 var hasOwnProperty = objectProto.hasOwnProperty; 18482 18483 /** Used to generate unique IDs. */ 18484 var idCounter = 0; 18485 18486 /** Used to detect methods masquerading as native. */ 18487 var maskSrcKey = (function() { 18488 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); 18489 return uid ? ('Symbol(src)_1.' + uid) : ''; 18490 }()); 18491 18492 /** 18493 * Used to resolve the 18494 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) 18495 * of values. 18496 */ 18497 var nativeObjectToString = objectProto.toString; 18498 18499 /** Used to infer the `Object` constructor. */ 18500 var objectCtorString = funcToString.call(Object); 18501 18502 /** Used to restore the original `_` reference in `_.noConflict`. */ 18503 var oldDash = root._; 18504 18505 /** Used to detect if a method is native. */ 18506 var reIsNative = RegExp('^' + 18507 funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') 18508 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' 18509 ); 18510 18511 /** Built-in value references. */ 18512 var Buffer = moduleExports ? context.Buffer : undefined, 18513 Symbol = context.Symbol, 18514 Uint8Array = context.Uint8Array, 18515 allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined, 18516 getPrototype = overArg(Object.getPrototypeOf, Object), 18517 objectCreate = Object.create, 18518 propertyIsEnumerable = objectProto.propertyIsEnumerable, 18519 splice = arrayProto.splice, 18520 spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined, 18521 symIterator = Symbol ? Symbol.iterator : undefined, 18522 symToStringTag = Symbol ? Symbol.toStringTag : undefined; 18523 18524 var defineProperty = (function() { 18525 try { 18526 var func = getNative(Object, 'defineProperty'); 18527 func({}, '', {}); 18528 return func; 18529 } catch (e) {} 18530 }()); 18531 18532 /** Mocked built-ins. */ 18533 var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, 18534 ctxNow = Date && Date.now !== root.Date.now && Date.now, 18535 ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; 18536 18537 /* Built-in method references for those with the same name as other `lodash` methods. */ 18538 var nativeCeil = Math.ceil, 18539 nativeFloor = Math.floor, 18540 nativeGetSymbols = Object.getOwnPropertySymbols, 18541 nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, 18542 nativeIsFinite = context.isFinite, 18543 nativeJoin = arrayProto.join, 18544 nativeKeys = overArg(Object.keys, Object), 18545 nativeMax = Math.max, 18546 nativeMin = Math.min, 18547 nativeNow = Date.now, 18548 nativeParseInt = context.parseInt, 18549 nativeRandom = Math.random, 18550 nativeReverse = arrayProto.reverse; 18551 18552 /* Built-in method references that are verified to be native. */ 18553 var DataView = getNative(context, 'DataView'), 18554 Map = getNative(context, 'Map'), 18555 Promise = getNative(context, 'Promise'), 18556 Set = getNative(context, 'Set'), 18557 WeakMap = getNative(context, 'WeakMap'), 18558 nativeCreate = getNative(Object, 'create'); 18559 18560 /** Used to store function metadata. */ 18561 var metaMap = WeakMap && new WeakMap; 18562 18563 /** Used to lookup unminified function names. */ 18564 var realNames = {}; 18565 18566 /** Used to detect maps, sets, and weakmaps. */ 18567 var dataViewCtorString = toSource(DataView), 18568 mapCtorString = toSource(Map), 18569 promiseCtorString = toSource(Promise), 18570 setCtorString = toSource(Set), 18571 weakMapCtorString = toSource(WeakMap); 18572 18573 /** Used to convert symbols to primitives and strings. */ 18574 var symbolProto = Symbol ? Symbol.prototype : undefined, 18575 symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, 18576 symbolToString = symbolProto ? symbolProto.toString : undefined; 18577 18578 /*------------------------------------------------------------------------*/ 18579 18580 /** 18581 * Creates a `lodash` object which wraps `value` to enable implicit method 18582 * chain sequences. Methods that operate on and return arrays, collections, 18583 * and functions can be chained together. Methods that retrieve a single value 18584 * or may return a primitive value will automatically end the chain sequence 18585 * and return the unwrapped value. Otherwise, the value must be unwrapped 18586 * with `_#value`. 18587 * 18588 * Explicit chain sequences, which must be unwrapped with `_#value`, may be 18589 * enabled using `_.chain`. 18590 * 18591 * The execution of chained methods is lazy, that is, it's deferred until 18592 * `_#value` is implicitly or explicitly called. 18593 * 18594 * Lazy evaluation allows several methods to support shortcut fusion. 18595 * Shortcut fusion is an optimization to merge iteratee calls; this avoids 18596 * the creation of intermediate arrays and can greatly reduce the number of 18597 * iteratee executions. Sections of a chain sequence qualify for shortcut 18598 * fusion if the section is applied to an array and iteratees accept only 18599 * one argument. The heuristic for whether a section qualifies for shortcut 18600 * fusion is subject to change. 18601 * 18602 * Chaining is supported in custom builds as long as the `_#value` method is 18603 * directly or indirectly included in the build. 18604 * 18605 * In addition to lodash methods, wrappers have `Array` and `String` methods. 18606 * 18607 * The wrapper `Array` methods are: 18608 * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` 18609 * 18610 * The wrapper `String` methods are: 18611 * `replace` and `split` 18612 * 18613 * The wrapper methods that support shortcut fusion are: 18614 * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, 18615 * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, 18616 * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` 18617 * 18618 * The chainable wrapper methods are: 18619 * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, 18620 * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, 18621 * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, 18622 * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, 18623 * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, 18624 * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, 18625 * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, 18626 * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, 18627 * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, 18628 * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, 18629 * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, 18630 * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, 18631 * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, 18632 * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, 18633 * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, 18634 * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, 18635 * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, 18636 * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, 18637 * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, 18638 * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, 18639 * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, 18640 * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, 18641 * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, 18642 * `zipObject`, `zipObjectDeep`, and `zipWith` 18643 * 18644 * The wrapper methods that are **not** chainable by default are: 18645 * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, 18646 * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, 18647 * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, 18648 * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, 18649 * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, 18650 * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, 18651 * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, 18652 * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, 18653 * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, 18654 * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, 18655 * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, 18656 * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, 18657 * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, 18658 * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, 18659 * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, 18660 * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, 18661 * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, 18662 * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, 18663 * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, 18664 * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, 18665 * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, 18666 * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, 18667 * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, 18668 * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, 18669 * `upperFirst`, `value`, and `words` 18670 * 18671 * @name _ 18672 * @constructor 18673 * @category Seq 18674 * @param {*} value The value to wrap in a `lodash` instance. 18675 * @returns {Object} Returns the new `lodash` wrapper instance. 18676 * @example 18677 * 18678 * function square(n) { 18679 * return n * n; 18680 * } 18681 * 18682 * var wrapped = _([1, 2, 3]); 18683 * 18684 * // Returns an unwrapped value. 18685 * wrapped.reduce(_.add); 18686 * // => 6 18687 * 18688 * // Returns a wrapped value. 18689 * var squares = wrapped.map(square); 18690 * 18691 * _.isArray(squares); 18692 * // => false 18693 * 18694 * _.isArray(squares.value()); 18695 * // => true 18696 */ 18697 function lodash(value) { 18698 if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { 18699 if (value instanceof LodashWrapper) { 18700 return value; 18701 } 18702 if (hasOwnProperty.call(value, '__wrapped__')) { 18703 return wrapperClone(value); 18704 } 18705 } 18706 return new LodashWrapper(value); 18707 } 18708 18709 /** 18710 * The base implementation of `_.create` without support for assigning 18711 * properties to the created object. 18712 * 18713 * @private 18714 * @param {Object} proto The object to inherit from. 18715 * @returns {Object} Returns the new object. 18716 */ 18717 var baseCreate = (function() { 18718 function object() {} 18719 return function(proto) { 18720 if (!isObject(proto)) { 18721 return {}; 18722 } 18723 if (objectCreate) { 18724 return objectCreate(proto); 18725 } 18726 object.prototype = proto; 18727 var result = new object; 18728 object.prototype = undefined; 18729 return result; 18730 }; 18731 }()); 18732 18733 /** 18734 * The function whose prototype chain sequence wrappers inherit from. 18735 * 18736 * @private 18737 */ 18738 function baseLodash() { 18739 // No operation performed. 18740 } 18741 18742 /** 18743 * The base constructor for creating `lodash` wrapper objects. 18744 * 18745 * @private 18746 * @param {*} value The value to wrap. 18747 * @param {boolean} [chainAll] Enable explicit method chain sequences. 18748 */ 18749 function LodashWrapper(value, chainAll) { 18750 this.__wrapped__ = value; 18751 this.__actions__ = []; 18752 this.__chain__ = !!chainAll; 18753 this.__index__ = 0; 18754 this.__values__ = undefined; 18755 } 18756 18757 /** 18758 * By default, the template delimiters used by lodash are like those in 18759 * embedded Ruby (ERB) as well as ES2015 template strings. Change the 18760 * following template settings to use alternative delimiters. 18761 * 18762 * @static 18763 * @memberOf _ 18764 * @type {Object} 18765 */ 18766 lodash.templateSettings = { 18767 18768 /** 18769 * Used to detect `data` property values to be HTML-escaped. 18770 * 18771 * @memberOf _.templateSettings 18772 * @type {RegExp} 18773 */ 18774 'escape': reEscape, 18775 18776 /** 18777 * Used to detect code to be evaluated. 18778 * 18779 * @memberOf _.templateSettings 18780 * @type {RegExp} 18781 */ 18782 'evaluate': reEvaluate, 18783 18784 /** 18785 * Used to detect `data` property values to inject. 18786 * 18787 * @memberOf _.templateSettings 18788 * @type {RegExp} 18789 */ 18790 'interpolate': reInterpolate, 18791 18792 /** 18793 * Used to reference the data object in the template text. 18794 * 18795 * @memberOf _.templateSettings 18796 * @type {string} 18797 */ 18798 'variable': '', 18799 18800 /** 18801 * Used to import variables into the compiled template. 18802 * 18803 * @memberOf _.templateSettings 18804 * @type {Object} 18805 */ 18806 'imports': { 18807 18808 /** 18809 * A reference to the `lodash` function. 18810 * 18811 * @memberOf _.templateSettings.imports 18812 * @type {Function} 18813 */ 18814 '_': lodash 18815 } 18816 }; 18817 18818 // Ensure wrappers are instances of `baseLodash`. 18819 lodash.prototype = baseLodash.prototype; 18820 lodash.prototype.constructor = lodash; 18821 18822 LodashWrapper.prototype = baseCreate(baseLodash.prototype); 18823 LodashWrapper.prototype.constructor = LodashWrapper; 18824 18825 /*------------------------------------------------------------------------*/ 18826 18827 /** 18828 * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. 18829 * 18830 * @private 18831 * @constructor 18832 * @param {*} value The value to wrap. 18833 */ 18834 function LazyWrapper(value) { 18835 this.__wrapped__ = value; 18836 this.__actions__ = []; 18837 this.__dir__ = 1; 18838 this.__filtered__ = false; 18839 this.__iteratees__ = []; 18840 this.__takeCount__ = MAX_ARRAY_LENGTH; 18841 this.__views__ = []; 18842 } 18843 18844 /** 18845 * Creates a clone of the lazy wrapper object. 18846 * 18847 * @private 18848 * @name clone 18849 * @memberOf LazyWrapper 18850 * @returns {Object} Returns the cloned `LazyWrapper` object. 18851 */ 18852 function lazyClone() { 18853 var result = new LazyWrapper(this.__wrapped__); 18854 result.__actions__ = copyArray(this.__actions__); 18855 result.__dir__ = this.__dir__; 18856 result.__filtered__ = this.__filtered__; 18857 result.__iteratees__ = copyArray(this.__iteratees__); 18858 result.__takeCount__ = this.__takeCount__; 18859 result.__views__ = copyArray(this.__views__); 18860 return result; 18861 } 18862 18863 /** 18864 * Reverses the direction of lazy iteration. 18865 * 18866 * @private 18867 * @name reverse 18868 * @memberOf LazyWrapper 18869 * @returns {Object} Returns the new reversed `LazyWrapper` object. 18870 */ 18871 function lazyReverse() { 18872 if (this.__filtered__) { 18873 var result = new LazyWrapper(this); 18874 result.__dir__ = -1; 18875 result.__filtered__ = true; 18876 } else { 18877 result = this.clone(); 18878 result.__dir__ *= -1; 18879 } 18880 return result; 18881 } 18882 18883 /** 18884 * Extracts the unwrapped value from its lazy wrapper. 18885 * 18886 * @private 18887 * @name value 18888 * @memberOf LazyWrapper 18889 * @returns {*} Returns the unwrapped value. 18890 */ 18891 function lazyValue() { 18892 var array = this.__wrapped__.value(), 18893 dir = this.__dir__, 18894 isArr = isArray(array), 18895 isRight = dir < 0, 18896 arrLength = isArr ? array.length : 0, 18897 view = getView(0, arrLength, this.__views__), 18898 start = view.start, 18899 end = view.end, 18900 length = end - start, 18901 index = isRight ? end : (start - 1), 18902 iteratees = this.__iteratees__, 18903 iterLength = iteratees.length, 18904 resIndex = 0, 18905 takeCount = nativeMin(length, this.__takeCount__); 18906 18907 if (!isArr || (!isRight && arrLength == length && takeCount == length)) { 18908 return baseWrapperValue(array, this.__actions__); 18909 } 18910 var result = []; 18911 18912 outer: 18913 while (length-- && resIndex < takeCount) { 18914 index += dir; 18915 18916 var iterIndex = -1, 18917 value = array[index]; 18918 18919 while (++iterIndex < iterLength) { 18920 var data = iteratees[iterIndex], 18921 iteratee = data.iteratee, 18922 type = data.type, 18923 computed = iteratee(value); 18924 18925 if (type == LAZY_MAP_FLAG) { 18926 value = computed; 18927 } else if (!computed) { 18928 if (type == LAZY_FILTER_FLAG) { 18929 continue outer; 18930 } else { 18931 break outer; 18932 } 18933 } 18934 } 18935 result[resIndex++] = value; 18936 } 18937 return result; 18938 } 18939 18940 // Ensure `LazyWrapper` is an instance of `baseLodash`. 18941 LazyWrapper.prototype = baseCreate(baseLodash.prototype); 18942 LazyWrapper.prototype.constructor = LazyWrapper; 18943 18944 /*------------------------------------------------------------------------*/ 18945 18946 /** 18947 * Creates a hash object. 18948 * 18949 * @private 18950 * @constructor 18951 * @param {Array} [entries] The key-value pairs to cache. 18952 */ 18953 function Hash(entries) { 18954 var index = -1, 18955 length = entries == null ? 0 : entries.length; 18956 18957 this.clear(); 18958 while (++index < length) { 18959 var entry = entries[index]; 18960 this.set(entry[0], entry[1]); 18961 } 18962 } 18963 18964 /** 18965 * Removes all key-value entries from the hash. 18966 * 18967 * @private 18968 * @name clear 18969 * @memberOf Hash 18970 */ 18971 function hashClear() { 18972 this.__data__ = nativeCreate ? nativeCreate(null) : {}; 18973 this.size = 0; 18974 } 18975 18976 /** 18977 * Removes `key` and its value from the hash. 18978 * 18979 * @private 18980 * @name delete 18981 * @memberOf Hash 18982 * @param {Object} hash The hash to modify. 18983 * @param {string} key The key of the value to remove. 18984 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 18985 */ 18986 function hashDelete(key) { 18987 var result = this.has(key) && delete this.__data__[key]; 18988 this.size -= result ? 1 : 0; 18989 return result; 18990 } 18991 18992 /** 18993 * Gets the hash value for `key`. 18994 * 18995 * @private 18996 * @name get 18997 * @memberOf Hash 18998 * @param {string} key The key of the value to get. 18999 * @returns {*} Returns the entry value. 19000 */ 19001 function hashGet(key) { 19002 var data = this.__data__; 19003 if (nativeCreate) { 19004 var result = data[key]; 19005 return result === HASH_UNDEFINED ? undefined : result; 19006 } 19007 return hasOwnProperty.call(data, key) ? data[key] : undefined; 19008 } 19009 19010 /** 19011 * Checks if a hash value for `key` exists. 19012 * 19013 * @private 19014 * @name has 19015 * @memberOf Hash 19016 * @param {string} key The key of the entry to check. 19017 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 19018 */ 19019 function hashHas(key) { 19020 var data = this.__data__; 19021 return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); 19022 } 19023 19024 /** 19025 * Sets the hash `key` to `value`. 19026 * 19027 * @private 19028 * @name set 19029 * @memberOf Hash 19030 * @param {string} key The key of the value to set. 19031 * @param {*} value The value to set. 19032 * @returns {Object} Returns the hash instance. 19033 */ 19034 function hashSet(key, value) { 19035 var data = this.__data__; 19036 this.size += this.has(key) ? 0 : 1; 19037 data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; 19038 return this; 19039 } 19040 19041 // Add methods to `Hash`. 19042 Hash.prototype.clear = hashClear; 19043 Hash.prototype['delete'] = hashDelete; 19044 Hash.prototype.get = hashGet; 19045 Hash.prototype.has = hashHas; 19046 Hash.prototype.set = hashSet; 19047 19048 /*------------------------------------------------------------------------*/ 19049 19050 /** 19051 * Creates an list cache object. 19052 * 19053 * @private 19054 * @constructor 19055 * @param {Array} [entries] The key-value pairs to cache. 19056 */ 19057 function ListCache(entries) { 19058 var index = -1, 19059 length = entries == null ? 0 : entries.length; 19060 19061 this.clear(); 19062 while (++index < length) { 19063 var entry = entries[index]; 19064 this.set(entry[0], entry[1]); 19065 } 19066 } 19067 19068 /** 19069 * Removes all key-value entries from the list cache. 19070 * 19071 * @private 19072 * @name clear 19073 * @memberOf ListCache 19074 */ 19075 function listCacheClear() { 19076 this.__data__ = []; 19077 this.size = 0; 19078 } 19079 19080 /** 19081 * Removes `key` and its value from the list cache. 19082 * 19083 * @private 19084 * @name delete 19085 * @memberOf ListCache 19086 * @param {string} key The key of the value to remove. 19087 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 19088 */ 19089 function listCacheDelete(key) { 19090 var data = this.__data__, 19091 index = assocIndexOf(data, key); 19092 19093 if (index < 0) { 19094 return false; 19095 } 19096 var lastIndex = data.length - 1; 19097 if (index == lastIndex) { 19098 data.pop(); 19099 } else { 19100 splice.call(data, index, 1); 19101 } 19102 --this.size; 19103 return true; 19104 } 19105 19106 /** 19107 * Gets the list cache value for `key`. 19108 * 19109 * @private 19110 * @name get 19111 * @memberOf ListCache 19112 * @param {string} key The key of the value to get. 19113 * @returns {*} Returns the entry value. 19114 */ 19115 function listCacheGet(key) { 19116 var data = this.__data__, 19117 index = assocIndexOf(data, key); 19118 19119 return index < 0 ? undefined : data[index][1]; 19120 } 19121 19122 /** 19123 * Checks if a list cache value for `key` exists. 19124 * 19125 * @private 19126 * @name has 19127 * @memberOf ListCache 19128 * @param {string} key The key of the entry to check. 19129 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 19130 */ 19131 function listCacheHas(key) { 19132 return assocIndexOf(this.__data__, key) > -1; 19133 } 19134 19135 /** 19136 * Sets the list cache `key` to `value`. 19137 * 19138 * @private 19139 * @name set 19140 * @memberOf ListCache 19141 * @param {string} key The key of the value to set. 19142 * @param {*} value The value to set. 19143 * @returns {Object} Returns the list cache instance. 19144 */ 19145 function listCacheSet(key, value) { 19146 var data = this.__data__, 19147 index = assocIndexOf(data, key); 19148 19149 if (index < 0) { 19150 ++this.size; 19151 data.push([key, value]); 19152 } else { 19153 data[index][1] = value; 19154 } 19155 return this; 19156 } 19157 19158 // Add methods to `ListCache`. 19159 ListCache.prototype.clear = listCacheClear; 19160 ListCache.prototype['delete'] = listCacheDelete; 19161 ListCache.prototype.get = listCacheGet; 19162 ListCache.prototype.has = listCacheHas; 19163 ListCache.prototype.set = listCacheSet; 19164 19165 /*------------------------------------------------------------------------*/ 19166 19167 /** 19168 * Creates a map cache object to store key-value pairs. 19169 * 19170 * @private 19171 * @constructor 19172 * @param {Array} [entries] The key-value pairs to cache. 19173 */ 19174 function MapCache(entries) { 19175 var index = -1, 19176 length = entries == null ? 0 : entries.length; 19177 19178 this.clear(); 19179 while (++index < length) { 19180 var entry = entries[index]; 19181 this.set(entry[0], entry[1]); 19182 } 19183 } 19184 19185 /** 19186 * Removes all key-value entries from the map. 19187 * 19188 * @private 19189 * @name clear 19190 * @memberOf MapCache 19191 */ 19192 function mapCacheClear() { 19193 this.size = 0; 19194 this.__data__ = { 19195 'hash': new Hash, 19196 'map': new (Map || ListCache), 19197 'string': new Hash 19198 }; 19199 } 19200 19201 /** 19202 * Removes `key` and its value from the map. 19203 * 19204 * @private 19205 * @name delete 19206 * @memberOf MapCache 19207 * @param {string} key The key of the value to remove. 19208 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 19209 */ 19210 function mapCacheDelete(key) { 19211 var result = getMapData(this, key)['delete'](key); 19212 this.size -= result ? 1 : 0; 19213 return result; 19214 } 19215 19216 /** 19217 * Gets the map value for `key`. 19218 * 19219 * @private 19220 * @name get 19221 * @memberOf MapCache 19222 * @param {string} key The key of the value to get. 19223 * @returns {*} Returns the entry value. 19224 */ 19225 function mapCacheGet(key) { 19226 return getMapData(this, key).get(key); 19227 } 19228 19229 /** 19230 * Checks if a map value for `key` exists. 19231 * 19232 * @private 19233 * @name has 19234 * @memberOf MapCache 19235 * @param {string} key The key of the entry to check. 19236 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 19237 */ 19238 function mapCacheHas(key) { 19239 return getMapData(this, key).has(key); 19240 } 19241 19242 /** 19243 * Sets the map `key` to `value`. 19244 * 19245 * @private 19246 * @name set 19247 * @memberOf MapCache 19248 * @param {string} key The key of the value to set. 19249 * @param {*} value The value to set. 19250 * @returns {Object} Returns the map cache instance. 19251 */ 19252 function mapCacheSet(key, value) { 19253 var data = getMapData(this, key), 19254 size = data.size; 19255 19256 data.set(key, value); 19257 this.size += data.size == size ? 0 : 1; 19258 return this; 19259 } 19260 19261 // Add methods to `MapCache`. 19262 MapCache.prototype.clear = mapCacheClear; 19263 MapCache.prototype['delete'] = mapCacheDelete; 19264 MapCache.prototype.get = mapCacheGet; 19265 MapCache.prototype.has = mapCacheHas; 19266 MapCache.prototype.set = mapCacheSet; 19267 19268 /*------------------------------------------------------------------------*/ 19269 19270 /** 19271 * 19272 * Creates an array cache object to store unique values. 19273 * 19274 * @private 19275 * @constructor 19276 * @param {Array} [values] The values to cache. 19277 */ 19278 function SetCache(values) { 19279 var index = -1, 19280 length = values == null ? 0 : values.length; 19281 19282 this.__data__ = new MapCache; 19283 while (++index < length) { 19284 this.add(values[index]); 19285 } 19286 } 19287 19288 /** 19289 * Adds `value` to the array cache. 19290 * 19291 * @private 19292 * @name add 19293 * @memberOf SetCache 19294 * @alias push 19295 * @param {*} value The value to cache. 19296 * @returns {Object} Returns the cache instance. 19297 */ 19298 function setCacheAdd(value) { 19299 this.__data__.set(value, HASH_UNDEFINED); 19300 return this; 19301 } 19302 19303 /** 19304 * Checks if `value` is in the array cache. 19305 * 19306 * @private 19307 * @name has 19308 * @memberOf SetCache 19309 * @param {*} value The value to search for. 19310 * @returns {number} Returns `true` if `value` is found, else `false`. 19311 */ 19312 function setCacheHas(value) { 19313 return this.__data__.has(value); 19314 } 19315 19316 // Add methods to `SetCache`. 19317 SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; 19318 SetCache.prototype.has = setCacheHas; 19319 19320 /*------------------------------------------------------------------------*/ 19321 19322 /** 19323 * Creates a stack cache object to store key-value pairs. 19324 * 19325 * @private 19326 * @constructor 19327 * @param {Array} [entries] The key-value pairs to cache. 19328 */ 19329 function Stack(entries) { 19330 var data = this.__data__ = new ListCache(entries); 19331 this.size = data.size; 19332 } 19333 19334 /** 19335 * Removes all key-value entries from the stack. 19336 * 19337 * @private 19338 * @name clear 19339 * @memberOf Stack 19340 */ 19341 function stackClear() { 19342 this.__data__ = new ListCache; 19343 this.size = 0; 19344 } 19345 19346 /** 19347 * Removes `key` and its value from the stack. 19348 * 19349 * @private 19350 * @name delete 19351 * @memberOf Stack 19352 * @param {string} key The key of the value to remove. 19353 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 19354 */ 19355 function stackDelete(key) { 19356 var data = this.__data__, 19357 result = data['delete'](key); 19358 19359 this.size = data.size; 19360 return result; 19361 } 19362 19363 /** 19364 * Gets the stack value for `key`. 19365 * 19366 * @private 19367 * @name get 19368 * @memberOf Stack 19369 * @param {string} key The key of the value to get. 19370 * @returns {*} Returns the entry value. 19371 */ 19372 function stackGet(key) { 19373 return this.__data__.get(key); 19374 } 19375 19376 /** 19377 * Checks if a stack value for `key` exists. 19378 * 19379 * @private 19380 * @name has 19381 * @memberOf Stack 19382 * @param {string} key The key of the entry to check. 19383 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 19384 */ 19385 function stackHas(key) { 19386 return this.__data__.has(key); 19387 } 19388 19389 /** 19390 * Sets the stack `key` to `value`. 19391 * 19392 * @private 19393 * @name set 19394 * @memberOf Stack 19395 * @param {string} key The key of the value to set. 19396 * @param {*} value The value to set. 19397 * @returns {Object} Returns the stack cache instance. 19398 */ 19399 function stackSet(key, value) { 19400 var data = this.__data__; 19401 if (data instanceof ListCache) { 19402 var pairs = data.__data__; 19403 if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { 19404 pairs.push([key, value]); 19405 this.size = ++data.size; 19406 return this; 19407 } 19408 data = this.__data__ = new MapCache(pairs); 19409 } 19410 data.set(key, value); 19411 this.size = data.size; 19412 return this; 19413 } 19414 19415 // Add methods to `Stack`. 19416 Stack.prototype.clear = stackClear; 19417 Stack.prototype['delete'] = stackDelete; 19418 Stack.prototype.get = stackGet; 19419 Stack.prototype.has = stackHas; 19420 Stack.prototype.set = stackSet; 19421 19422 /*------------------------------------------------------------------------*/ 19423 19424 /** 19425 * Creates an array of the enumerable property names of the array-like `value`. 19426 * 19427 * @private 19428 * @param {*} value The value to query. 19429 * @param {boolean} inherited Specify returning inherited property names. 19430 * @returns {Array} Returns the array of property names. 19431 */ 19432 function arrayLikeKeys(value, inherited) { 19433 var isArr = isArray(value), 19434 isArg = !isArr && isArguments(value), 19435 isBuff = !isArr && !isArg && isBuffer(value), 19436 isType = !isArr && !isArg && !isBuff && isTypedArray(value), 19437 skipIndexes = isArr || isArg || isBuff || isType, 19438 result = skipIndexes ? baseTimes(value.length, String) : [], 19439 length = result.length; 19440 19441 for (var key in value) { 19442 if ((inherited || hasOwnProperty.call(value, key)) && 19443 !(skipIndexes && ( 19444 // Safari 9 has enumerable `arguments.length` in strict mode. 19445 key == 'length' || 19446 // Node.js 0.10 has enumerable non-index properties on buffers. 19447 (isBuff && (key == 'offset' || key == 'parent')) || 19448 // PhantomJS 2 has enumerable non-index properties on typed arrays. 19449 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || 19450 // Skip index properties. 19451 isIndex(key, length) 19452 ))) { 19453 result.push(key); 19454 } 19455 } 19456 return result; 19457 } 19458 19459 /** 19460 * A specialized version of `_.sample` for arrays. 19461 * 19462 * @private 19463 * @param {Array} array The array to sample. 19464 * @returns {*} Returns the random element. 19465 */ 19466 function arraySample(array) { 19467 var length = array.length; 19468 return length ? array[baseRandom(0, length - 1)] : undefined; 19469 } 19470 19471 /** 19472 * A specialized version of `_.sampleSize` for arrays. 19473 * 19474 * @private 19475 * @param {Array} array The array to sample. 19476 * @param {number} n The number of elements to sample. 19477 * @returns {Array} Returns the random elements. 19478 */ 19479 function arraySampleSize(array, n) { 19480 return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); 19481 } 19482 19483 /** 19484 * A specialized version of `_.shuffle` for arrays. 19485 * 19486 * @private 19487 * @param {Array} array The array to shuffle. 19488 * @returns {Array} Returns the new shuffled array. 19489 */ 19490 function arrayShuffle(array) { 19491 return shuffleSelf(copyArray(array)); 19492 } 19493 19494 /** 19495 * This function is like `assignValue` except that it doesn't assign 19496 * `undefined` values. 19497 * 19498 * @private 19499 * @param {Object} object The object to modify. 19500 * @param {string} key The key of the property to assign. 19501 * @param {*} value The value to assign. 19502 */ 19503 function assignMergeValue(object, key, value) { 19504 if ((value !== undefined && !eq(object[key], value)) || 19505 (value === undefined && !(key in object))) { 19506 baseAssignValue(object, key, value); 19507 } 19508 } 19509 19510 /** 19511 * Assigns `value` to `key` of `object` if the existing value is not equivalent 19512 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 19513 * for equality comparisons. 19514 * 19515 * @private 19516 * @param {Object} object The object to modify. 19517 * @param {string} key The key of the property to assign. 19518 * @param {*} value The value to assign. 19519 */ 19520 function assignValue(object, key, value) { 19521 var objValue = object[key]; 19522 if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || 19523 (value === undefined && !(key in object))) { 19524 baseAssignValue(object, key, value); 19525 } 19526 } 19527 19528 /** 19529 * Gets the index at which the `key` is found in `array` of key-value pairs. 19530 * 19531 * @private 19532 * @param {Array} array The array to inspect. 19533 * @param {*} key The key to search for. 19534 * @returns {number} Returns the index of the matched value, else `-1`. 19535 */ 19536 function assocIndexOf(array, key) { 19537 var length = array.length; 19538 while (length--) { 19539 if (eq(array[length][0], key)) { 19540 return length; 19541 } 19542 } 19543 return -1; 19544 } 19545 19546 /** 19547 * Aggregates elements of `collection` on `accumulator` with keys transformed 19548 * by `iteratee` and values set by `setter`. 19549 * 19550 * @private 19551 * @param {Array|Object} collection The collection to iterate over. 19552 * @param {Function} setter The function to set `accumulator` values. 19553 * @param {Function} iteratee The iteratee to transform keys. 19554 * @param {Object} accumulator The initial aggregated object. 19555 * @returns {Function} Returns `accumulator`. 19556 */ 19557 function baseAggregator(collection, setter, iteratee, accumulator) { 19558 baseEach(collection, function(value, key, collection) { 19559 setter(accumulator, value, iteratee(value), collection); 19560 }); 19561 return accumulator; 19562 } 19563 19564 /** 19565 * The base implementation of `_.assign` without support for multiple sources 19566 * or `customizer` functions. 19567 * 19568 * @private 19569 * @param {Object} object The destination object. 19570 * @param {Object} source The source object. 19571 * @returns {Object} Returns `object`. 19572 */ 19573 function baseAssign(object, source) { 19574 return object && copyObject(source, keys(source), object); 19575 } 19576 19577 /** 19578 * The base implementation of `_.assignIn` without support for multiple sources 19579 * or `customizer` functions. 19580 * 19581 * @private 19582 * @param {Object} object The destination object. 19583 * @param {Object} source The source object. 19584 * @returns {Object} Returns `object`. 19585 */ 19586 function baseAssignIn(object, source) { 19587 return object && copyObject(source, keysIn(source), object); 19588 } 19589 19590 /** 19591 * The base implementation of `assignValue` and `assignMergeValue` without 19592 * value checks. 19593 * 19594 * @private 19595 * @param {Object} object The object to modify. 19596 * @param {string} key The key of the property to assign. 19597 * @param {*} value The value to assign. 19598 */ 19599 function baseAssignValue(object, key, value) { 19600 if (key == '__proto__' && defineProperty) { 19601 defineProperty(object, key, { 19602 'configurable': true, 19603 'enumerable': true, 19604 'value': value, 19605 'writable': true 19606 }); 19607 } else { 19608 object[key] = value; 19609 } 19610 } 19611 19612 /** 19613 * The base implementation of `_.at` without support for individual paths. 19614 * 19615 * @private 19616 * @param {Object} object The object to iterate over. 19617 * @param {string[]} paths The property paths to pick. 19618 * @returns {Array} Returns the picked elements. 19619 */ 19620 function baseAt(object, paths) { 19621 var index = -1, 19622 length = paths.length, 19623 result = Array(length), 19624 skip = object == null; 19625 19626 while (++index < length) { 19627 result[index] = skip ? undefined : get(object, paths[index]); 19628 } 19629 return result; 19630 } 19631 19632 /** 19633 * The base implementation of `_.clamp` which doesn't coerce arguments. 19634 * 19635 * @private 19636 * @param {number} number The number to clamp. 19637 * @param {number} [lower] The lower bound. 19638 * @param {number} upper The upper bound. 19639 * @returns {number} Returns the clamped number. 19640 */ 19641 function baseClamp(number, lower, upper) { 19642 if (number === number) { 19643 if (upper !== undefined) { 19644 number = number <= upper ? number : upper; 19645 } 19646 if (lower !== undefined) { 19647 number = number >= lower ? number : lower; 19648 } 19649 } 19650 return number; 19651 } 19652 19653 /** 19654 * The base implementation of `_.clone` and `_.cloneDeep` which tracks 19655 * traversed objects. 19656 * 19657 * @private 19658 * @param {*} value The value to clone. 19659 * @param {boolean} bitmask The bitmask flags. 19660 * 1 - Deep clone 19661 * 2 - Flatten inherited properties 19662 * 4 - Clone symbols 19663 * @param {Function} [customizer] The function to customize cloning. 19664 * @param {string} [key] The key of `value`. 19665 * @param {Object} [object] The parent object of `value`. 19666 * @param {Object} [stack] Tracks traversed objects and their clone counterparts. 19667 * @returns {*} Returns the cloned value. 19668 */ 19669 function baseClone(value, bitmask, customizer, key, object, stack) { 19670 var result, 19671 isDeep = bitmask & CLONE_DEEP_FLAG, 19672 isFlat = bitmask & CLONE_FLAT_FLAG, 19673 isFull = bitmask & CLONE_SYMBOLS_FLAG; 19674 19675 if (customizer) { 19676 result = object ? customizer(value, key, object, stack) : customizer(value); 19677 } 19678 if (result !== undefined) { 19679 return result; 19680 } 19681 if (!isObject(value)) { 19682 return value; 19683 } 19684 var isArr = isArray(value); 19685 if (isArr) { 19686 result = initCloneArray(value); 19687 if (!isDeep) { 19688 return copyArray(value, result); 19689 } 19690 } else { 19691 var tag = getTag(value), 19692 isFunc = tag == funcTag || tag == genTag; 19693 19694 if (isBuffer(value)) { 19695 return cloneBuffer(value, isDeep); 19696 } 19697 if (tag == objectTag || tag == argsTag || (isFunc && !object)) { 19698 result = (isFlat || isFunc) ? {} : initCloneObject(value); 19699 if (!isDeep) { 19700 return isFlat 19701 ? copySymbolsIn(value, baseAssignIn(result, value)) 19702 : copySymbols(value, baseAssign(result, value)); 19703 } 19704 } else { 19705 if (!cloneableTags[tag]) { 19706 return object ? value : {}; 19707 } 19708 result = initCloneByTag(value, tag, isDeep); 19709 } 19710 } 19711 // Check for circular references and return its corresponding clone. 19712 stack || (stack = new Stack); 19713 var stacked = stack.get(value); 19714 if (stacked) { 19715 return stacked; 19716 } 19717 stack.set(value, result); 19718 19719 if (isSet(value)) { 19720 value.forEach(function(subValue) { 19721 result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); 19722 }); 19723 } else if (isMap(value)) { 19724 value.forEach(function(subValue, key) { 19725 result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); 19726 }); 19727 } 19728 19729 var keysFunc = isFull 19730 ? (isFlat ? getAllKeysIn : getAllKeys) 19731 : (isFlat ? keysIn : keys); 19732 19733 var props = isArr ? undefined : keysFunc(value); 19734 arrayEach(props || value, function(subValue, key) { 19735 if (props) { 19736 key = subValue; 19737 subValue = value[key]; 19738 } 19739 // Recursively populate clone (susceptible to call stack limits). 19740 assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); 19741 }); 19742 return result; 19743 } 19744 19745 /** 19746 * The base implementation of `_.conforms` which doesn't clone `source`. 19747 * 19748 * @private 19749 * @param {Object} source The object of property predicates to conform to. 19750 * @returns {Function} Returns the new spec function. 19751 */ 19752 function baseConforms(source) { 19753 var props = keys(source); 19754 return function(object) { 19755 return baseConformsTo(object, source, props); 19756 }; 19757 } 19758 19759 /** 19760 * The base implementation of `_.conformsTo` which accepts `props` to check. 19761 * 19762 * @private 19763 * @param {Object} object The object to inspect. 19764 * @param {Object} source The object of property predicates to conform to. 19765 * @returns {boolean} Returns `true` if `object` conforms, else `false`. 19766 */ 19767 function baseConformsTo(object, source, props) { 19768 var length = props.length; 19769 if (object == null) { 19770 return !length; 19771 } 19772 object = Object(object); 19773 while (length--) { 19774 var key = props[length], 19775 predicate = source[key], 19776 value = object[key]; 19777 19778 if ((value === undefined && !(key in object)) || !predicate(value)) { 19779 return false; 19780 } 19781 } 19782 return true; 19783 } 19784 19785 /** 19786 * The base implementation of `_.delay` and `_.defer` which accepts `args` 19787 * to provide to `func`. 19788 * 19789 * @private 19790 * @param {Function} func The function to delay. 19791 * @param {number} wait The number of milliseconds to delay invocation. 19792 * @param {Array} args The arguments to provide to `func`. 19793 * @returns {number|Object} Returns the timer id or timeout object. 19794 */ 19795 function baseDelay(func, wait, args) { 19796 if (typeof func != 'function') { 19797 throw new TypeError(FUNC_ERROR_TEXT); 19798 } 19799 return setTimeout(function() { func.apply(undefined, args); }, wait); 19800 } 19801 19802 /** 19803 * The base implementation of methods like `_.difference` without support 19804 * for excluding multiple arrays or iteratee shorthands. 19805 * 19806 * @private 19807 * @param {Array} array The array to inspect. 19808 * @param {Array} values The values to exclude. 19809 * @param {Function} [iteratee] The iteratee invoked per element. 19810 * @param {Function} [comparator] The comparator invoked per element. 19811 * @returns {Array} Returns the new array of filtered values. 19812 */ 19813 function baseDifference(array, values, iteratee, comparator) { 19814 var index = -1, 19815 includes = arrayIncludes, 19816 isCommon = true, 19817 length = array.length, 19818 result = [], 19819 valuesLength = values.length; 19820 19821 if (!length) { 19822 return result; 19823 } 19824 if (iteratee) { 19825 values = arrayMap(values, baseUnary(iteratee)); 19826 } 19827 if (comparator) { 19828 includes = arrayIncludesWith; 19829 isCommon = false; 19830 } 19831 else if (values.length >= LARGE_ARRAY_SIZE) { 19832 includes = cacheHas; 19833 isCommon = false; 19834 values = new SetCache(values); 19835 } 19836 outer: 19837 while (++index < length) { 19838 var value = array[index], 19839 computed = iteratee == null ? value : iteratee(value); 19840 19841 value = (comparator || value !== 0) ? value : 0; 19842 if (isCommon && computed === computed) { 19843 var valuesIndex = valuesLength; 19844 while (valuesIndex--) { 19845 if (values[valuesIndex] === computed) { 19846 continue outer; 19847 } 19848 } 19849 result.push(value); 19850 } 19851 else if (!includes(values, computed, comparator)) { 19852 result.push(value); 19853 } 19854 } 19855 return result; 19856 } 19857 19858 /** 19859 * The base implementation of `_.forEach` without support for iteratee shorthands. 19860 * 19861 * @private 19862 * @param {Array|Object} collection The collection to iterate over. 19863 * @param {Function} iteratee The function invoked per iteration. 19864 * @returns {Array|Object} Returns `collection`. 19865 */ 19866 var baseEach = createBaseEach(baseForOwn); 19867 19868 /** 19869 * The base implementation of `_.forEachRight` without support for iteratee shorthands. 19870 * 19871 * @private 19872 * @param {Array|Object} collection The collection to iterate over. 19873 * @param {Function} iteratee The function invoked per iteration. 19874 * @returns {Array|Object} Returns `collection`. 19875 */ 19876 var baseEachRight = createBaseEach(baseForOwnRight, true); 19877 19878 /** 19879 * The base implementation of `_.every` without support for iteratee shorthands. 19880 * 19881 * @private 19882 * @param {Array|Object} collection The collection to iterate over. 19883 * @param {Function} predicate The function invoked per iteration. 19884 * @returns {boolean} Returns `true` if all elements pass the predicate check, 19885 * else `false` 19886 */ 19887 function baseEvery(collection, predicate) { 19888 var result = true; 19889 baseEach(collection, function(value, index, collection) { 19890 result = !!predicate(value, index, collection); 19891 return result; 19892 }); 19893 return result; 19894 } 19895 19896 /** 19897 * The base implementation of methods like `_.max` and `_.min` which accepts a 19898 * `comparator` to determine the extremum value. 19899 * 19900 * @private 19901 * @param {Array} array The array to iterate over. 19902 * @param {Function} iteratee The iteratee invoked per iteration. 19903 * @param {Function} comparator The comparator used to compare values. 19904 * @returns {*} Returns the extremum value. 19905 */ 19906 function baseExtremum(array, iteratee, comparator) { 19907 var index = -1, 19908 length = array.length; 19909 19910 while (++index < length) { 19911 var value = array[index], 19912 current = iteratee(value); 19913 19914 if (current != null && (computed === undefined 19915 ? (current === current && !isSymbol(current)) 19916 : comparator(current, computed) 19917 )) { 19918 var computed = current, 19919 result = value; 19920 } 19921 } 19922 return result; 19923 } 19924 19925 /** 19926 * The base implementation of `_.fill` without an iteratee call guard. 19927 * 19928 * @private 19929 * @param {Array} array The array to fill. 19930 * @param {*} value The value to fill `array` with. 19931 * @param {number} [start=0] The start position. 19932 * @param {number} [end=array.length] The end position. 19933 * @returns {Array} Returns `array`. 19934 */ 19935 function baseFill(array, value, start, end) { 19936 var length = array.length; 19937 19938 start = toInteger(start); 19939 if (start < 0) { 19940 start = -start > length ? 0 : (length + start); 19941 } 19942 end = (end === undefined || end > length) ? length : toInteger(end); 19943 if (end < 0) { 19944 end += length; 19945 } 19946 end = start > end ? 0 : toLength(end); 19947 while (start < end) { 19948 array[start++] = value; 19949 } 19950 return array; 19951 } 19952 19953 /** 19954 * The base implementation of `_.filter` without support for iteratee shorthands. 19955 * 19956 * @private 19957 * @param {Array|Object} collection The collection to iterate over. 19958 * @param {Function} predicate The function invoked per iteration. 19959 * @returns {Array} Returns the new filtered array. 19960 */ 19961 function baseFilter(collection, predicate) { 19962 var result = []; 19963 baseEach(collection, function(value, index, collection) { 19964 if (predicate(value, index, collection)) { 19965 result.push(value); 19966 } 19967 }); 19968 return result; 19969 } 19970 19971 /** 19972 * The base implementation of `_.flatten` with support for restricting flattening. 19973 * 19974 * @private 19975 * @param {Array} array The array to flatten. 19976 * @param {number} depth The maximum recursion depth. 19977 * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. 19978 * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. 19979 * @param {Array} [result=[]] The initial result value. 19980 * @returns {Array} Returns the new flattened array. 19981 */ 19982 function baseFlatten(array, depth, predicate, isStrict, result) { 19983 var index = -1, 19984 length = array.length; 19985 19986 predicate || (predicate = isFlattenable); 19987 result || (result = []); 19988 19989 while (++index < length) { 19990 var value = array[index]; 19991 if (depth > 0 && predicate(value)) { 19992 if (depth > 1) { 19993 // Recursively flatten arrays (susceptible to call stack limits). 19994 baseFlatten(value, depth - 1, predicate, isStrict, result); 19995 } else { 19996 arrayPush(result, value); 19997 } 19998 } else if (!isStrict) { 19999 result[result.length] = value; 20000 } 20001 } 20002 return result; 20003 } 20004 20005 /** 20006 * The base implementation of `baseForOwn` which iterates over `object` 20007 * properties returned by `keysFunc` and invokes `iteratee` for each property. 20008 * Iteratee functions may exit iteration early by explicitly returning `false`. 20009 * 20010 * @private 20011 * @param {Object} object The object to iterate over. 20012 * @param {Function} iteratee The function invoked per iteration. 20013 * @param {Function} keysFunc The function to get the keys of `object`. 20014 * @returns {Object} Returns `object`. 20015 */ 20016 var baseFor = createBaseFor(); 20017 20018 /** 20019 * This function is like `baseFor` except that it iterates over properties 20020 * in the opposite order. 20021 * 20022 * @private 20023 * @param {Object} object The object to iterate over. 20024 * @param {Function} iteratee The function invoked per iteration. 20025 * @param {Function} keysFunc The function to get the keys of `object`. 20026 * @returns {Object} Returns `object`. 20027 */ 20028 var baseForRight = createBaseFor(true); 20029 20030 /** 20031 * The base implementation of `_.forOwn` without support for iteratee shorthands. 20032 * 20033 * @private 20034 * @param {Object} object The object to iterate over. 20035 * @param {Function} iteratee The function invoked per iteration. 20036 * @returns {Object} Returns `object`. 20037 */ 20038 function baseForOwn(object, iteratee) { 20039 return object && baseFor(object, iteratee, keys); 20040 } 20041 20042 /** 20043 * The base implementation of `_.forOwnRight` without support for iteratee shorthands. 20044 * 20045 * @private 20046 * @param {Object} object The object to iterate over. 20047 * @param {Function} iteratee The function invoked per iteration. 20048 * @returns {Object} Returns `object`. 20049 */ 20050 function baseForOwnRight(object, iteratee) { 20051 return object && baseForRight(object, iteratee, keys); 20052 } 20053 20054 /** 20055 * The base implementation of `_.functions` which creates an array of 20056 * `object` function property names filtered from `props`. 20057 * 20058 * @private 20059 * @param {Object} object The object to inspect. 20060 * @param {Array} props The property names to filter. 20061 * @returns {Array} Returns the function names. 20062 */ 20063 function baseFunctions(object, props) { 20064 return arrayFilter(props, function(key) { 20065 return isFunction(object[key]); 20066 }); 20067 } 20068 20069 /** 20070 * The base implementation of `_.get` without support for default values. 20071 * 20072 * @private 20073 * @param {Object} object The object to query. 20074 * @param {Array|string} path The path of the property to get. 20075 * @returns {*} Returns the resolved value. 20076 */ 20077 function baseGet(object, path) { 20078 path = castPath(path, object); 20079 20080 var index = 0, 20081 length = path.length; 20082 20083 while (object != null && index < length) { 20084 object = object[toKey(path[index++])]; 20085 } 20086 return (index && index == length) ? object : undefined; 20087 } 20088 20089 /** 20090 * The base implementation of `getAllKeys` and `getAllKeysIn` which uses 20091 * `keysFunc` and `symbolsFunc` to get the enumerable property names and 20092 * symbols of `object`. 20093 * 20094 * @private 20095 * @param {Object} object The object to query. 20096 * @param {Function} keysFunc The function to get the keys of `object`. 20097 * @param {Function} symbolsFunc The function to get the symbols of `object`. 20098 * @returns {Array} Returns the array of property names and symbols. 20099 */ 20100 function baseGetAllKeys(object, keysFunc, symbolsFunc) { 20101 var result = keysFunc(object); 20102 return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); 20103 } 20104 20105 /** 20106 * The base implementation of `getTag` without fallbacks for buggy environments. 20107 * 20108 * @private 20109 * @param {*} value The value to query. 20110 * @returns {string} Returns the `toStringTag`. 20111 */ 20112 function baseGetTag(value) { 20113 if (value == null) { 20114 return value === undefined ? undefinedTag : nullTag; 20115 } 20116 return (symToStringTag && symToStringTag in Object(value)) 20117 ? getRawTag(value) 20118 : objectToString(value); 20119 } 20120 20121 /** 20122 * The base implementation of `_.gt` which doesn't coerce arguments. 20123 * 20124 * @private 20125 * @param {*} value The value to compare. 20126 * @param {*} other The other value to compare. 20127 * @returns {boolean} Returns `true` if `value` is greater than `other`, 20128 * else `false`. 20129 */ 20130 function baseGt(value, other) { 20131 return value > other; 20132 } 20133 20134 /** 20135 * The base implementation of `_.has` without support for deep paths. 20136 * 20137 * @private 20138 * @param {Object} [object] The object to query. 20139 * @param {Array|string} key The key to check. 20140 * @returns {boolean} Returns `true` if `key` exists, else `false`. 20141 */ 20142 function baseHas(object, key) { 20143 return object != null && hasOwnProperty.call(object, key); 20144 } 20145 20146 /** 20147 * The base implementation of `_.hasIn` without support for deep paths. 20148 * 20149 * @private 20150 * @param {Object} [object] The object to query. 20151 * @param {Array|string} key The key to check. 20152 * @returns {boolean} Returns `true` if `key` exists, else `false`. 20153 */ 20154 function baseHasIn(object, key) { 20155 return object != null && key in Object(object); 20156 } 20157 20158 /** 20159 * The base implementation of `_.inRange` which doesn't coerce arguments. 20160 * 20161 * @private 20162 * @param {number} number The number to check. 20163 * @param {number} start The start of the range. 20164 * @param {number} end The end of the range. 20165 * @returns {boolean} Returns `true` if `number` is in the range, else `false`. 20166 */ 20167 function baseInRange(number, start, end) { 20168 return number >= nativeMin(start, end) && number < nativeMax(start, end); 20169 } 20170 20171 /** 20172 * The base implementation of methods like `_.intersection`, without support 20173 * for iteratee shorthands, that accepts an array of arrays to inspect. 20174 * 20175 * @private 20176 * @param {Array} arrays The arrays to inspect. 20177 * @param {Function} [iteratee] The iteratee invoked per element. 20178 * @param {Function} [comparator] The comparator invoked per element. 20179 * @returns {Array} Returns the new array of shared values. 20180 */ 20181 function baseIntersection(arrays, iteratee, comparator) { 20182 var includes = comparator ? arrayIncludesWith : arrayIncludes, 20183 length = arrays[0].length, 20184 othLength = arrays.length, 20185 othIndex = othLength, 20186 caches = Array(othLength), 20187 maxLength = Infinity, 20188 result = []; 20189 20190 while (othIndex--) { 20191 var array = arrays[othIndex]; 20192 if (othIndex && iteratee) { 20193 array = arrayMap(array, baseUnary(iteratee)); 20194 } 20195 maxLength = nativeMin(array.length, maxLength); 20196 caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) 20197 ? new SetCache(othIndex && array) 20198 : undefined; 20199 } 20200 array = arrays[0]; 20201 20202 var index = -1, 20203 seen = caches[0]; 20204 20205 outer: 20206 while (++index < length && result.length < maxLength) { 20207 var value = array[index], 20208 computed = iteratee ? iteratee(value) : value; 20209 20210 value = (comparator || value !== 0) ? value : 0; 20211 if (!(seen 20212 ? cacheHas(seen, computed) 20213 : includes(result, computed, comparator) 20214 )) { 20215 othIndex = othLength; 20216 while (--othIndex) { 20217 var cache = caches[othIndex]; 20218 if (!(cache 20219 ? cacheHas(cache, computed) 20220 : includes(arrays[othIndex], computed, comparator)) 20221 ) { 20222 continue outer; 20223 } 20224 } 20225 if (seen) { 20226 seen.push(computed); 20227 } 20228 result.push(value); 20229 } 20230 } 20231 return result; 20232 } 20233 20234 /** 20235 * The base implementation of `_.invert` and `_.invertBy` which inverts 20236 * `object` with values transformed by `iteratee` and set by `setter`. 20237 * 20238 * @private 20239 * @param {Object} object The object to iterate over. 20240 * @param {Function} setter The function to set `accumulator` values. 20241 * @param {Function} iteratee The iteratee to transform values. 20242 * @param {Object} accumulator The initial inverted object. 20243 * @returns {Function} Returns `accumulator`. 20244 */ 20245 function baseInverter(object, setter, iteratee, accumulator) { 20246 baseForOwn(object, function(value, key, object) { 20247 setter(accumulator, iteratee(value), key, object); 20248 }); 20249 return accumulator; 20250 } 20251 20252 /** 20253 * The base implementation of `_.invoke` without support for individual 20254 * method arguments. 20255 * 20256 * @private 20257 * @param {Object} object The object to query. 20258 * @param {Array|string} path The path of the method to invoke. 20259 * @param {Array} args The arguments to invoke the method with. 20260 * @returns {*} Returns the result of the invoked method. 20261 */ 20262 function baseInvoke(object, path, args) { 20263 path = castPath(path, object); 20264 object = parent(object, path); 20265 var func = object == null ? object : object[toKey(last(path))]; 20266 return func == null ? undefined : apply(func, object, args); 20267 } 20268 20269 /** 20270 * The base implementation of `_.isArguments`. 20271 * 20272 * @private 20273 * @param {*} value The value to check. 20274 * @returns {boolean} Returns `true` if `value` is an `arguments` object, 20275 */ 20276 function baseIsArguments(value) { 20277 return isObjectLike(value) && baseGetTag(value) == argsTag; 20278 } 20279 20280 /** 20281 * The base implementation of `_.isArrayBuffer` without Node.js optimizations. 20282 * 20283 * @private 20284 * @param {*} value The value to check. 20285 * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. 20286 */ 20287 function baseIsArrayBuffer(value) { 20288 return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; 20289 } 20290 20291 /** 20292 * The base implementation of `_.isDate` without Node.js optimizations. 20293 * 20294 * @private 20295 * @param {*} value The value to check. 20296 * @returns {boolean} Returns `true` if `value` is a date object, else `false`. 20297 */ 20298 function baseIsDate(value) { 20299 return isObjectLike(value) && baseGetTag(value) == dateTag; 20300 } 20301 20302 /** 20303 * The base implementation of `_.isEqual` which supports partial comparisons 20304 * and tracks traversed objects. 20305 * 20306 * @private 20307 * @param {*} value The value to compare. 20308 * @param {*} other The other value to compare. 20309 * @param {boolean} bitmask The bitmask flags. 20310 * 1 - Unordered comparison 20311 * 2 - Partial comparison 20312 * @param {Function} [customizer] The function to customize comparisons. 20313 * @param {Object} [stack] Tracks traversed `value` and `other` objects. 20314 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 20315 */ 20316 function baseIsEqual(value, other, bitmask, customizer, stack) { 20317 if (value === other) { 20318 return true; 20319 } 20320 if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { 20321 return value !== value && other !== other; 20322 } 20323 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); 20324 } 20325 20326 /** 20327 * A specialized version of `baseIsEqual` for arrays and objects which performs 20328 * deep comparisons and tracks traversed objects enabling objects with circular 20329 * references to be compared. 20330 * 20331 * @private 20332 * @param {Object} object The object to compare. 20333 * @param {Object} other The other object to compare. 20334 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 20335 * @param {Function} customizer The function to customize comparisons. 20336 * @param {Function} equalFunc The function to determine equivalents of values. 20337 * @param {Object} [stack] Tracks traversed `object` and `other` objects. 20338 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 20339 */ 20340 function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { 20341 var objIsArr = isArray(object), 20342 othIsArr = isArray(other), 20343 objTag = objIsArr ? arrayTag : getTag(object), 20344 othTag = othIsArr ? arrayTag : getTag(other); 20345 20346 objTag = objTag == argsTag ? objectTag : objTag; 20347 othTag = othTag == argsTag ? objectTag : othTag; 20348 20349 var objIsObj = objTag == objectTag, 20350 othIsObj = othTag == objectTag, 20351 isSameTag = objTag == othTag; 20352 20353 if (isSameTag && isBuffer(object)) { 20354 if (!isBuffer(other)) { 20355 return false; 20356 } 20357 objIsArr = true; 20358 objIsObj = false; 20359 } 20360 if (isSameTag && !objIsObj) { 20361 stack || (stack = new Stack); 20362 return (objIsArr || isTypedArray(object)) 20363 ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) 20364 : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); 20365 } 20366 if (!(bitmask & COMPARE_PARTIAL_FLAG)) { 20367 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), 20368 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); 20369 20370 if (objIsWrapped || othIsWrapped) { 20371 var objUnwrapped = objIsWrapped ? object.value() : object, 20372 othUnwrapped = othIsWrapped ? other.value() : other; 20373 20374 stack || (stack = new Stack); 20375 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); 20376 } 20377 } 20378 if (!isSameTag) { 20379 return false; 20380 } 20381 stack || (stack = new Stack); 20382 return equalObjects(object, other, bitmask, customizer, equalFunc, stack); 20383 } 20384 20385 /** 20386 * The base implementation of `_.isMap` without Node.js optimizations. 20387 * 20388 * @private 20389 * @param {*} value The value to check. 20390 * @returns {boolean} Returns `true` if `value` is a map, else `false`. 20391 */ 20392 function baseIsMap(value) { 20393 return isObjectLike(value) && getTag(value) == mapTag; 20394 } 20395 20396 /** 20397 * The base implementation of `_.isMatch` without support for iteratee shorthands. 20398 * 20399 * @private 20400 * @param {Object} object The object to inspect. 20401 * @param {Object} source The object of property values to match. 20402 * @param {Array} matchData The property names, values, and compare flags to match. 20403 * @param {Function} [customizer] The function to customize comparisons. 20404 * @returns {boolean} Returns `true` if `object` is a match, else `false`. 20405 */ 20406 function baseIsMatch(object, source, matchData, customizer) { 20407 var index = matchData.length, 20408 length = index, 20409 noCustomizer = !customizer; 20410 20411 if (object == null) { 20412 return !length; 20413 } 20414 object = Object(object); 20415 while (index--) { 20416 var data = matchData[index]; 20417 if ((noCustomizer && data[2]) 20418 ? data[1] !== object[data[0]] 20419 : !(data[0] in object) 20420 ) { 20421 return false; 20422 } 20423 } 20424 while (++index < length) { 20425 data = matchData[index]; 20426 var key = data[0], 20427 objValue = object[key], 20428 srcValue = data[1]; 20429 20430 if (noCustomizer && data[2]) { 20431 if (objValue === undefined && !(key in object)) { 20432 return false; 20433 } 20434 } else { 20435 var stack = new Stack; 20436 if (customizer) { 20437 var result = customizer(objValue, srcValue, key, object, source, stack); 20438 } 20439 if (!(result === undefined 20440 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) 20441 : result 20442 )) { 20443 return false; 20444 } 20445 } 20446 } 20447 return true; 20448 } 20449 20450 /** 20451 * The base implementation of `_.isNative` without bad shim checks. 20452 * 20453 * @private 20454 * @param {*} value The value to check. 20455 * @returns {boolean} Returns `true` if `value` is a native function, 20456 * else `false`. 20457 */ 20458 function baseIsNative(value) { 20459 if (!isObject(value) || isMasked(value)) { 20460 return false; 20461 } 20462 var pattern = isFunction(value) ? reIsNative : reIsHostCtor; 20463 return pattern.test(toSource(value)); 20464 } 20465 20466 /** 20467 * The base implementation of `_.isRegExp` without Node.js optimizations. 20468 * 20469 * @private 20470 * @param {*} value The value to check. 20471 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. 20472 */ 20473 function baseIsRegExp(value) { 20474 return isObjectLike(value) && baseGetTag(value) == regexpTag; 20475 } 20476 20477 /** 20478 * The base implementation of `_.isSet` without Node.js optimizations. 20479 * 20480 * @private 20481 * @param {*} value The value to check. 20482 * @returns {boolean} Returns `true` if `value` is a set, else `false`. 20483 */ 20484 function baseIsSet(value) { 20485 return isObjectLike(value) && getTag(value) == setTag; 20486 } 20487 20488 /** 20489 * The base implementation of `_.isTypedArray` without Node.js optimizations. 20490 * 20491 * @private 20492 * @param {*} value The value to check. 20493 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. 20494 */ 20495 function baseIsTypedArray(value) { 20496 return isObjectLike(value) && 20497 isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; 20498 } 20499 20500 /** 20501 * The base implementation of `_.iteratee`. 20502 * 20503 * @private 20504 * @param {*} [value=_.identity] The value to convert to an iteratee. 20505 * @returns {Function} Returns the iteratee. 20506 */ 20507 function baseIteratee(value) { 20508 // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. 20509 // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. 20510 if (typeof value == 'function') { 20511 return value; 20512 } 20513 if (value == null) { 20514 return identity; 20515 } 20516 if (typeof value == 'object') { 20517 return isArray(value) 20518 ? baseMatchesProperty(value[0], value[1]) 20519 : baseMatches(value); 20520 } 20521 return property(value); 20522 } 20523 20524 /** 20525 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. 20526 * 20527 * @private 20528 * @param {Object} object The object to query. 20529 * @returns {Array} Returns the array of property names. 20530 */ 20531 function baseKeys(object) { 20532 if (!isPrototype(object)) { 20533 return nativeKeys(object); 20534 } 20535 var result = []; 20536 for (var key in Object(object)) { 20537 if (hasOwnProperty.call(object, key) && key != 'constructor') { 20538 result.push(key); 20539 } 20540 } 20541 return result; 20542 } 20543 20544 /** 20545 * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. 20546 * 20547 * @private 20548 * @param {Object} object The object to query. 20549 * @returns {Array} Returns the array of property names. 20550 */ 20551 function baseKeysIn(object) { 20552 if (!isObject(object)) { 20553 return nativeKeysIn(object); 20554 } 20555 var isProto = isPrototype(object), 20556 result = []; 20557 20558 for (var key in object) { 20559 if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { 20560 result.push(key); 20561 } 20562 } 20563 return result; 20564 } 20565 20566 /** 20567 * The base implementation of `_.lt` which doesn't coerce arguments. 20568 * 20569 * @private 20570 * @param {*} value The value to compare. 20571 * @param {*} other The other value to compare. 20572 * @returns {boolean} Returns `true` if `value` is less than `other`, 20573 * else `false`. 20574 */ 20575 function baseLt(value, other) { 20576 return value < other; 20577 } 20578 20579 /** 20580 * The base implementation of `_.map` without support for iteratee shorthands. 20581 * 20582 * @private 20583 * @param {Array|Object} collection The collection to iterate over. 20584 * @param {Function} iteratee The function invoked per iteration. 20585 * @returns {Array} Returns the new mapped array. 20586 */ 20587 function baseMap(collection, iteratee) { 20588 var index = -1, 20589 result = isArrayLike(collection) ? Array(collection.length) : []; 20590 20591 baseEach(collection, function(value, key, collection) { 20592 result[++index] = iteratee(value, key, collection); 20593 }); 20594 return result; 20595 } 20596 20597 /** 20598 * The base implementation of `_.matches` which doesn't clone `source`. 20599 * 20600 * @private 20601 * @param {Object} source The object of property values to match. 20602 * @returns {Function} Returns the new spec function. 20603 */ 20604 function baseMatches(source) { 20605 var matchData = getMatchData(source); 20606 if (matchData.length == 1 && matchData[0][2]) { 20607 return matchesStrictComparable(matchData[0][0], matchData[0][1]); 20608 } 20609 return function(object) { 20610 return object === source || baseIsMatch(object, source, matchData); 20611 }; 20612 } 20613 20614 /** 20615 * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. 20616 * 20617 * @private 20618 * @param {string} path The path of the property to get. 20619 * @param {*} srcValue The value to match. 20620 * @returns {Function} Returns the new spec function. 20621 */ 20622 function baseMatchesProperty(path, srcValue) { 20623 if (isKey(path) && isStrictComparable(srcValue)) { 20624 return matchesStrictComparable(toKey(path), srcValue); 20625 } 20626 return function(object) { 20627 var objValue = get(object, path); 20628 return (objValue === undefined && objValue === srcValue) 20629 ? hasIn(object, path) 20630 : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); 20631 }; 20632 } 20633 20634 /** 20635 * The base implementation of `_.merge` without support for multiple sources. 20636 * 20637 * @private 20638 * @param {Object} object The destination object. 20639 * @param {Object} source The source object. 20640 * @param {number} srcIndex The index of `source`. 20641 * @param {Function} [customizer] The function to customize merged values. 20642 * @param {Object} [stack] Tracks traversed source values and their merged 20643 * counterparts. 20644 */ 20645 function baseMerge(object, source, srcIndex, customizer, stack) { 20646 if (object === source) { 20647 return; 20648 } 20649 baseFor(source, function(srcValue, key) { 20650 stack || (stack = new Stack); 20651 if (isObject(srcValue)) { 20652 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); 20653 } 20654 else { 20655 var newValue = customizer 20656 ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) 20657 : undefined; 20658 20659 if (newValue === undefined) { 20660 newValue = srcValue; 20661 } 20662 assignMergeValue(object, key, newValue); 20663 } 20664 }, keysIn); 20665 } 20666 20667 /** 20668 * A specialized version of `baseMerge` for arrays and objects which performs 20669 * deep merges and tracks traversed objects enabling objects with circular 20670 * references to be merged. 20671 * 20672 * @private 20673 * @param {Object} object The destination object. 20674 * @param {Object} source The source object. 20675 * @param {string} key The key of the value to merge. 20676 * @param {number} srcIndex The index of `source`. 20677 * @param {Function} mergeFunc The function to merge values. 20678 * @param {Function} [customizer] The function to customize assigned values. 20679 * @param {Object} [stack] Tracks traversed source values and their merged 20680 * counterparts. 20681 */ 20682 function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { 20683 var objValue = safeGet(object, key), 20684 srcValue = safeGet(source, key), 20685 stacked = stack.get(srcValue); 20686 20687 if (stacked) { 20688 assignMergeValue(object, key, stacked); 20689 return; 20690 } 20691 var newValue = customizer 20692 ? customizer(objValue, srcValue, (key + ''), object, source, stack) 20693 : undefined; 20694 20695 var isCommon = newValue === undefined; 20696 20697 if (isCommon) { 20698 var isArr = isArray(srcValue), 20699 isBuff = !isArr && isBuffer(srcValue), 20700 isTyped = !isArr && !isBuff && isTypedArray(srcValue); 20701 20702 newValue = srcValue; 20703 if (isArr || isBuff || isTyped) { 20704 if (isArray(objValue)) { 20705 newValue = objValue; 20706 } 20707 else if (isArrayLikeObject(objValue)) { 20708 newValue = copyArray(objValue); 20709 } 20710 else if (isBuff) { 20711 isCommon = false; 20712 newValue = cloneBuffer(srcValue, true); 20713 } 20714 else if (isTyped) { 20715 isCommon = false; 20716 newValue = cloneTypedArray(srcValue, true); 20717 } 20718 else { 20719 newValue = []; 20720 } 20721 } 20722 else if (isPlainObject(srcValue) || isArguments(srcValue)) { 20723 newValue = objValue; 20724 if (isArguments(objValue)) { 20725 newValue = toPlainObject(objValue); 20726 } 20727 else if (!isObject(objValue) || isFunction(objValue)) { 20728 newValue = initCloneObject(srcValue); 20729 } 20730 } 20731 else { 20732 isCommon = false; 20733 } 20734 } 20735 if (isCommon) { 20736 // Recursively merge objects and arrays (susceptible to call stack limits). 20737 stack.set(srcValue, newValue); 20738 mergeFunc(newValue, srcValue, srcIndex, customizer, stack); 20739 stack['delete'](srcValue); 20740 } 20741 assignMergeValue(object, key, newValue); 20742 } 20743 20744 /** 20745 * The base implementation of `_.nth` which doesn't coerce arguments. 20746 * 20747 * @private 20748 * @param {Array} array The array to query. 20749 * @param {number} n The index of the element to return. 20750 * @returns {*} Returns the nth element of `array`. 20751 */ 20752 function baseNth(array, n) { 20753 var length = array.length; 20754 if (!length) { 20755 return; 20756 } 20757 n += n < 0 ? length : 0; 20758 return isIndex(n, length) ? array[n] : undefined; 20759 } 20760 20761 /** 20762 * The base implementation of `_.orderBy` without param guards. 20763 * 20764 * @private 20765 * @param {Array|Object} collection The collection to iterate over. 20766 * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. 20767 * @param {string[]} orders The sort orders of `iteratees`. 20768 * @returns {Array} Returns the new sorted array. 20769 */ 20770 function baseOrderBy(collection, iteratees, orders) { 20771 var index = -1; 20772 iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee())); 20773 20774 var result = baseMap(collection, function(value, key, collection) { 20775 var criteria = arrayMap(iteratees, function(iteratee) { 20776 return iteratee(value); 20777 }); 20778 return { 'criteria': criteria, 'index': ++index, 'value': value }; 20779 }); 20780 20781 return baseSortBy(result, function(object, other) { 20782 return compareMultiple(object, other, orders); 20783 }); 20784 } 20785 20786 /** 20787 * The base implementation of `_.pick` without support for individual 20788 * property identifiers. 20789 * 20790 * @private 20791 * @param {Object} object The source object. 20792 * @param {string[]} paths The property paths to pick. 20793 * @returns {Object} Returns the new object. 20794 */ 20795 function basePick(object, paths) { 20796 return basePickBy(object, paths, function(value, path) { 20797 return hasIn(object, path); 20798 }); 20799 } 20800 20801 /** 20802 * The base implementation of `_.pickBy` without support for iteratee shorthands. 20803 * 20804 * @private 20805 * @param {Object} object The source object. 20806 * @param {string[]} paths The property paths to pick. 20807 * @param {Function} predicate The function invoked per property. 20808 * @returns {Object} Returns the new object. 20809 */ 20810 function basePickBy(object, paths, predicate) { 20811 var index = -1, 20812 length = paths.length, 20813 result = {}; 20814 20815 while (++index < length) { 20816 var path = paths[index], 20817 value = baseGet(object, path); 20818 20819 if (predicate(value, path)) { 20820 baseSet(result, castPath(path, object), value); 20821 } 20822 } 20823 return result; 20824 } 20825 20826 /** 20827 * A specialized version of `baseProperty` which supports deep paths. 20828 * 20829 * @private 20830 * @param {Array|string} path The path of the property to get. 20831 * @returns {Function} Returns the new accessor function. 20832 */ 20833 function basePropertyDeep(path) { 20834 return function(object) { 20835 return baseGet(object, path); 20836 }; 20837 } 20838 20839 /** 20840 * The base implementation of `_.pullAllBy` without support for iteratee 20841 * shorthands. 20842 * 20843 * @private 20844 * @param {Array} array The array to modify. 20845 * @param {Array} values The values to remove. 20846 * @param {Function} [iteratee] The iteratee invoked per element. 20847 * @param {Function} [comparator] The comparator invoked per element. 20848 * @returns {Array} Returns `array`. 20849 */ 20850 function basePullAll(array, values, iteratee, comparator) { 20851 var indexOf = comparator ? baseIndexOfWith : baseIndexOf, 20852 index = -1, 20853 length = values.length, 20854 seen = array; 20855 20856 if (array === values) { 20857 values = copyArray(values); 20858 } 20859 if (iteratee) { 20860 seen = arrayMap(array, baseUnary(iteratee)); 20861 } 20862 while (++index < length) { 20863 var fromIndex = 0, 20864 value = values[index], 20865 computed = iteratee ? iteratee(value) : value; 20866 20867 while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { 20868 if (seen !== array) { 20869 splice.call(seen, fromIndex, 1); 20870 } 20871 splice.call(array, fromIndex, 1); 20872 } 20873 } 20874 return array; 20875 } 20876 20877 /** 20878 * The base implementation of `_.pullAt` without support for individual 20879 * indexes or capturing the removed elements. 20880 * 20881 * @private 20882 * @param {Array} array The array to modify. 20883 * @param {number[]} indexes The indexes of elements to remove. 20884 * @returns {Array} Returns `array`. 20885 */ 20886 function basePullAt(array, indexes) { 20887 var length = array ? indexes.length : 0, 20888 lastIndex = length - 1; 20889 20890 while (length--) { 20891 var index = indexes[length]; 20892 if (length == lastIndex || index !== previous) { 20893 var previous = index; 20894 if (isIndex(index)) { 20895 splice.call(array, index, 1); 20896 } else { 20897 baseUnset(array, index); 20898 } 20899 } 20900 } 20901 return array; 20902 } 20903 20904 /** 20905 * The base implementation of `_.random` without support for returning 20906 * floating-point numbers. 20907 * 20908 * @private 20909 * @param {number} lower The lower bound. 20910 * @param {number} upper The upper bound. 20911 * @returns {number} Returns the random number. 20912 */ 20913 function baseRandom(lower, upper) { 20914 return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); 20915 } 20916 20917 /** 20918 * The base implementation of `_.range` and `_.rangeRight` which doesn't 20919 * coerce arguments. 20920 * 20921 * @private 20922 * @param {number} start The start of the range. 20923 * @param {number} end The end of the range. 20924 * @param {number} step The value to increment or decrement by. 20925 * @param {boolean} [fromRight] Specify iterating from right to left. 20926 * @returns {Array} Returns the range of numbers. 20927 */ 20928 function baseRange(start, end, step, fromRight) { 20929 var index = -1, 20930 length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), 20931 result = Array(length); 20932 20933 while (length--) { 20934 result[fromRight ? length : ++index] = start; 20935 start += step; 20936 } 20937 return result; 20938 } 20939 20940 /** 20941 * The base implementation of `_.repeat` which doesn't coerce arguments. 20942 * 20943 * @private 20944 * @param {string} string The string to repeat. 20945 * @param {number} n The number of times to repeat the string. 20946 * @returns {string} Returns the repeated string. 20947 */ 20948 function baseRepeat(string, n) { 20949 var result = ''; 20950 if (!string || n < 1 || n > MAX_SAFE_INTEGER) { 20951 return result; 20952 } 20953 // Leverage the exponentiation by squaring algorithm for a faster repeat. 20954 // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. 20955 do { 20956 if (n % 2) { 20957 result += string; 20958 } 20959 n = nativeFloor(n / 2); 20960 if (n) { 20961 string += string; 20962 } 20963 } while (n); 20964 20965 return result; 20966 } 20967 20968 /** 20969 * The base implementation of `_.rest` which doesn't validate or coerce arguments. 20970 * 20971 * @private 20972 * @param {Function} func The function to apply a rest parameter to. 20973 * @param {number} [start=func.length-1] The start position of the rest parameter. 20974 * @returns {Function} Returns the new function. 20975 */ 20976 function baseRest(func, start) { 20977 return setToString(overRest(func, start, identity), func + ''); 20978 } 20979 20980 /** 20981 * The base implementation of `_.sample`. 20982 * 20983 * @private 20984 * @param {Array|Object} collection The collection to sample. 20985 * @returns {*} Returns the random element. 20986 */ 20987 function baseSample(collection) { 20988 return arraySample(values(collection)); 20989 } 20990 20991 /** 20992 * The base implementation of `_.sampleSize` without param guards. 20993 * 20994 * @private 20995 * @param {Array|Object} collection The collection to sample. 20996 * @param {number} n The number of elements to sample. 20997 * @returns {Array} Returns the random elements. 20998 */ 20999 function baseSampleSize(collection, n) { 21000 var array = values(collection); 21001 return shuffleSelf(array, baseClamp(n, 0, array.length)); 21002 } 21003 21004 /** 21005 * The base implementation of `_.set`. 21006 * 21007 * @private 21008 * @param {Object} object The object to modify. 21009 * @param {Array|string} path The path of the property to set. 21010 * @param {*} value The value to set. 21011 * @param {Function} [customizer] The function to customize path creation. 21012 * @returns {Object} Returns `object`. 21013 */ 21014 function baseSet(object, path, value, customizer) { 21015 if (!isObject(object)) { 21016 return object; 21017 } 21018 path = castPath(path, object); 21019 21020 var index = -1, 21021 length = path.length, 21022 lastIndex = length - 1, 21023 nested = object; 21024 21025 while (nested != null && ++index < length) { 21026 var key = toKey(path[index]), 21027 newValue = value; 21028 21029 if (index != lastIndex) { 21030 var objValue = nested[key]; 21031 newValue = customizer ? customizer(objValue, key, nested) : undefined; 21032 if (newValue === undefined) { 21033 newValue = isObject(objValue) 21034 ? objValue 21035 : (isIndex(path[index + 1]) ? [] : {}); 21036 } 21037 } 21038 assignValue(nested, key, newValue); 21039 nested = nested[key]; 21040 } 21041 return object; 21042 } 21043 21044 /** 21045 * The base implementation of `setData` without support for hot loop shorting. 21046 * 21047 * @private 21048 * @param {Function} func The function to associate metadata with. 21049 * @param {*} data The metadata. 21050 * @returns {Function} Returns `func`. 21051 */ 21052 var baseSetData = !metaMap ? identity : function(func, data) { 21053 metaMap.set(func, data); 21054 return func; 21055 }; 21056 21057 /** 21058 * The base implementation of `setToString` without support for hot loop shorting. 21059 * 21060 * @private 21061 * @param {Function} func The function to modify. 21062 * @param {Function} string The `toString` result. 21063 * @returns {Function} Returns `func`. 21064 */ 21065 var baseSetToString = !defineProperty ? identity : function(func, string) { 21066 return defineProperty(func, 'toString', { 21067 'configurable': true, 21068 'enumerable': false, 21069 'value': constant(string), 21070 'writable': true 21071 }); 21072 }; 21073 21074 /** 21075 * The base implementation of `_.shuffle`. 21076 * 21077 * @private 21078 * @param {Array|Object} collection The collection to shuffle. 21079 * @returns {Array} Returns the new shuffled array. 21080 */ 21081 function baseShuffle(collection) { 21082 return shuffleSelf(values(collection)); 21083 } 21084 21085 /** 21086 * The base implementation of `_.slice` without an iteratee call guard. 21087 * 21088 * @private 21089 * @param {Array} array The array to slice. 21090 * @param {number} [start=0] The start position. 21091 * @param {number} [end=array.length] The end position. 21092 * @returns {Array} Returns the slice of `array`. 21093 */ 21094 function baseSlice(array, start, end) { 21095 var index = -1, 21096 length = array.length; 21097 21098 if (start < 0) { 21099 start = -start > length ? 0 : (length + start); 21100 } 21101 end = end > length ? length : end; 21102 if (end < 0) { 21103 end += length; 21104 } 21105 length = start > end ? 0 : ((end - start) >>> 0); 21106 start >>>= 0; 21107 21108 var result = Array(length); 21109 while (++index < length) { 21110 result[index] = array[index + start]; 21111 } 21112 return result; 21113 } 21114 21115 /** 21116 * The base implementation of `_.some` without support for iteratee shorthands. 21117 * 21118 * @private 21119 * @param {Array|Object} collection The collection to iterate over. 21120 * @param {Function} predicate The function invoked per iteration. 21121 * @returns {boolean} Returns `true` if any element passes the predicate check, 21122 * else `false`. 21123 */ 21124 function baseSome(collection, predicate) { 21125 var result; 21126 21127 baseEach(collection, function(value, index, collection) { 21128 result = predicate(value, index, collection); 21129 return !result; 21130 }); 21131 return !!result; 21132 } 21133 21134 /** 21135 * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which 21136 * performs a binary search of `array` to determine the index at which `value` 21137 * should be inserted into `array` in order to maintain its sort order. 21138 * 21139 * @private 21140 * @param {Array} array The sorted array to inspect. 21141 * @param {*} value The value to evaluate. 21142 * @param {boolean} [retHighest] Specify returning the highest qualified index. 21143 * @returns {number} Returns the index at which `value` should be inserted 21144 * into `array`. 21145 */ 21146 function baseSortedIndex(array, value, retHighest) { 21147 var low = 0, 21148 high = array == null ? low : array.length; 21149 21150 if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { 21151 while (low < high) { 21152 var mid = (low + high) >>> 1, 21153 computed = array[mid]; 21154 21155 if (computed !== null && !isSymbol(computed) && 21156 (retHighest ? (computed <= value) : (computed < value))) { 21157 low = mid + 1; 21158 } else { 21159 high = mid; 21160 } 21161 } 21162 return high; 21163 } 21164 return baseSortedIndexBy(array, value, identity, retHighest); 21165 } 21166 21167 /** 21168 * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` 21169 * which invokes `iteratee` for `value` and each element of `array` to compute 21170 * their sort ranking. The iteratee is invoked with one argument; (value). 21171 * 21172 * @private 21173 * @param {Array} array The sorted array to inspect. 21174 * @param {*} value The value to evaluate. 21175 * @param {Function} iteratee The iteratee invoked per element. 21176 * @param {boolean} [retHighest] Specify returning the highest qualified index. 21177 * @returns {number} Returns the index at which `value` should be inserted 21178 * into `array`. 21179 */ 21180 function baseSortedIndexBy(array, value, iteratee, retHighest) { 21181 value = iteratee(value); 21182 21183 var low = 0, 21184 high = array == null ? 0 : array.length, 21185 valIsNaN = value !== value, 21186 valIsNull = value === null, 21187 valIsSymbol = isSymbol(value), 21188 valIsUndefined = value === undefined; 21189 21190 while (low < high) { 21191 var mid = nativeFloor((low + high) / 2), 21192 computed = iteratee(array[mid]), 21193 othIsDefined = computed !== undefined, 21194 othIsNull = computed === null, 21195 othIsReflexive = computed === computed, 21196 othIsSymbol = isSymbol(computed); 21197 21198 if (valIsNaN) { 21199 var setLow = retHighest || othIsReflexive; 21200 } else if (valIsUndefined) { 21201 setLow = othIsReflexive && (retHighest || othIsDefined); 21202 } else if (valIsNull) { 21203 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); 21204 } else if (valIsSymbol) { 21205 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); 21206 } else if (othIsNull || othIsSymbol) { 21207 setLow = false; 21208 } else { 21209 setLow = retHighest ? (computed <= value) : (computed < value); 21210 } 21211 if (setLow) { 21212 low = mid + 1; 21213 } else { 21214 high = mid; 21215 } 21216 } 21217 return nativeMin(high, MAX_ARRAY_INDEX); 21218 } 21219 21220 /** 21221 * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without 21222 * support for iteratee shorthands. 21223 * 21224 * @private 21225 * @param {Array} array The array to inspect. 21226 * @param {Function} [iteratee] The iteratee invoked per element. 21227 * @returns {Array} Returns the new duplicate free array. 21228 */ 21229 function baseSortedUniq(array, iteratee) { 21230 var index = -1, 21231 length = array.length, 21232 resIndex = 0, 21233 result = []; 21234 21235 while (++index < length) { 21236 var value = array[index], 21237 computed = iteratee ? iteratee(value) : value; 21238 21239 if (!index || !eq(computed, seen)) { 21240 var seen = computed; 21241 result[resIndex++] = value === 0 ? 0 : value; 21242 } 21243 } 21244 return result; 21245 } 21246 21247 /** 21248 * The base implementation of `_.toNumber` which doesn't ensure correct 21249 * conversions of binary, hexadecimal, or octal string values. 21250 * 21251 * @private 21252 * @param {*} value The value to process. 21253 * @returns {number} Returns the number. 21254 */ 21255 function baseToNumber(value) { 21256 if (typeof value == 'number') { 21257 return value; 21258 } 21259 if (isSymbol(value)) { 21260 return NAN; 21261 } 21262 return +value; 21263 } 21264 21265 /** 21266 * The base implementation of `_.toString` which doesn't convert nullish 21267 * values to empty strings. 21268 * 21269 * @private 21270 * @param {*} value The value to process. 21271 * @returns {string} Returns the string. 21272 */ 21273 function baseToString(value) { 21274 // Exit early for strings to avoid a performance hit in some environments. 21275 if (typeof value == 'string') { 21276 return value; 21277 } 21278 if (isArray(value)) { 21279 // Recursively convert values (susceptible to call stack limits). 21280 return arrayMap(value, baseToString) + ''; 21281 } 21282 if (isSymbol(value)) { 21283 return symbolToString ? symbolToString.call(value) : ''; 21284 } 21285 var result = (value + ''); 21286 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; 21287 } 21288 21289 /** 21290 * The base implementation of `_.uniqBy` without support for iteratee shorthands. 21291 * 21292 * @private 21293 * @param {Array} array The array to inspect. 21294 * @param {Function} [iteratee] The iteratee invoked per element. 21295 * @param {Function} [comparator] The comparator invoked per element. 21296 * @returns {Array} Returns the new duplicate free array. 21297 */ 21298 function baseUniq(array, iteratee, comparator) { 21299 var index = -1, 21300 includes = arrayIncludes, 21301 length = array.length, 21302 isCommon = true, 21303 result = [], 21304 seen = result; 21305 21306 if (comparator) { 21307 isCommon = false; 21308 includes = arrayIncludesWith; 21309 } 21310 else if (length >= LARGE_ARRAY_SIZE) { 21311 var set = iteratee ? null : createSet(array); 21312 if (set) { 21313 return setToArray(set); 21314 } 21315 isCommon = false; 21316 includes = cacheHas; 21317 seen = new SetCache; 21318 } 21319 else { 21320 seen = iteratee ? [] : result; 21321 } 21322 outer: 21323 while (++index < length) { 21324 var value = array[index], 21325 computed = iteratee ? iteratee(value) : value; 21326 21327 value = (comparator || value !== 0) ? value : 0; 21328 if (isCommon && computed === computed) { 21329 var seenIndex = seen.length; 21330 while (seenIndex--) { 21331 if (seen[seenIndex] === computed) { 21332 continue outer; 21333 } 21334 } 21335 if (iteratee) { 21336 seen.push(computed); 21337 } 21338 result.push(value); 21339 } 21340 else if (!includes(seen, computed, comparator)) { 21341 if (seen !== result) { 21342 seen.push(computed); 21343 } 21344 result.push(value); 21345 } 21346 } 21347 return result; 21348 } 21349 21350 /** 21351 * The base implementation of `_.unset`. 21352 * 21353 * @private 21354 * @param {Object} object The object to modify. 21355 * @param {Array|string} path The property path to unset. 21356 * @returns {boolean} Returns `true` if the property is deleted, else `false`. 21357 */ 21358 function baseUnset(object, path) { 21359 path = castPath(path, object); 21360 object = parent(object, path); 21361 return object == null || delete object[toKey(last(path))]; 21362 } 21363 21364 /** 21365 * The base implementation of `_.update`. 21366 * 21367 * @private 21368 * @param {Object} object The object to modify. 21369 * @param {Array|string} path The path of the property to update. 21370 * @param {Function} updater The function to produce the updated value. 21371 * @param {Function} [customizer] The function to customize path creation. 21372 * @returns {Object} Returns `object`. 21373 */ 21374 function baseUpdate(object, path, updater, customizer) { 21375 return baseSet(object, path, updater(baseGet(object, path)), customizer); 21376 } 21377 21378 /** 21379 * The base implementation of methods like `_.dropWhile` and `_.takeWhile` 21380 * without support for iteratee shorthands. 21381 * 21382 * @private 21383 * @param {Array} array The array to query. 21384 * @param {Function} predicate The function invoked per iteration. 21385 * @param {boolean} [isDrop] Specify dropping elements instead of taking them. 21386 * @param {boolean} [fromRight] Specify iterating from right to left. 21387 * @returns {Array} Returns the slice of `array`. 21388 */ 21389 function baseWhile(array, predicate, isDrop, fromRight) { 21390 var length = array.length, 21391 index = fromRight ? length : -1; 21392 21393 while ((fromRight ? index-- : ++index < length) && 21394 predicate(array[index], index, array)) {} 21395 21396 return isDrop 21397 ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) 21398 : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); 21399 } 21400 21401 /** 21402 * The base implementation of `wrapperValue` which returns the result of 21403 * performing a sequence of actions on the unwrapped `value`, where each 21404 * successive action is supplied the return value of the previous. 21405 * 21406 * @private 21407 * @param {*} value The unwrapped value. 21408 * @param {Array} actions Actions to perform to resolve the unwrapped value. 21409 * @returns {*} Returns the resolved value. 21410 */ 21411 function baseWrapperValue(value, actions) { 21412 var result = value; 21413 if (result instanceof LazyWrapper) { 21414 result = result.value(); 21415 } 21416 return arrayReduce(actions, function(result, action) { 21417 return action.func.apply(action.thisArg, arrayPush([result], action.args)); 21418 }, result); 21419 } 21420 21421 /** 21422 * The base implementation of methods like `_.xor`, without support for 21423 * iteratee shorthands, that accepts an array of arrays to inspect. 21424 * 21425 * @private 21426 * @param {Array} arrays The arrays to inspect. 21427 * @param {Function} [iteratee] The iteratee invoked per element. 21428 * @param {Function} [comparator] The comparator invoked per element. 21429 * @returns {Array} Returns the new array of values. 21430 */ 21431 function baseXor(arrays, iteratee, comparator) { 21432 var length = arrays.length; 21433 if (length < 2) { 21434 return length ? baseUniq(arrays[0]) : []; 21435 } 21436 var index = -1, 21437 result = Array(length); 21438 21439 while (++index < length) { 21440 var array = arrays[index], 21441 othIndex = -1; 21442 21443 while (++othIndex < length) { 21444 if (othIndex != index) { 21445 result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); 21446 } 21447 } 21448 } 21449 return baseUniq(baseFlatten(result, 1), iteratee, comparator); 21450 } 21451 21452 /** 21453 * This base implementation of `_.zipObject` which assigns values using `assignFunc`. 21454 * 21455 * @private 21456 * @param {Array} props The property identifiers. 21457 * @param {Array} values The property values. 21458 * @param {Function} assignFunc The function to assign values. 21459 * @returns {Object} Returns the new object. 21460 */ 21461 function baseZipObject(props, values, assignFunc) { 21462 var index = -1, 21463 length = props.length, 21464 valsLength = values.length, 21465 result = {}; 21466 21467 while (++index < length) { 21468 var value = index < valsLength ? values[index] : undefined; 21469 assignFunc(result, props[index], value); 21470 } 21471 return result; 21472 } 21473 21474 /** 21475 * Casts `value` to an empty array if it's not an array like object. 21476 * 21477 * @private 21478 * @param {*} value The value to inspect. 21479 * @returns {Array|Object} Returns the cast array-like object. 21480 */ 21481 function castArrayLikeObject(value) { 21482 return isArrayLikeObject(value) ? value : []; 21483 } 21484 21485 /** 21486 * Casts `value` to `identity` if it's not a function. 21487 * 21488 * @private 21489 * @param {*} value The value to inspect. 21490 * @returns {Function} Returns cast function. 21491 */ 21492 function castFunction(value) { 21493 return typeof value == 'function' ? value : identity; 21494 } 21495 21496 /** 21497 * Casts `value` to a path array if it's not one. 21498 * 21499 * @private 21500 * @param {*} value The value to inspect. 21501 * @param {Object} [object] The object to query keys on. 21502 * @returns {Array} Returns the cast property path array. 21503 */ 21504 function castPath(value, object) { 21505 if (isArray(value)) { 21506 return value; 21507 } 21508 return isKey(value, object) ? [value] : stringToPath(toString(value)); 21509 } 21510 21511 /** 21512 * A `baseRest` alias which can be replaced with `identity` by module 21513 * replacement plugins. 21514 * 21515 * @private 21516 * @type {Function} 21517 * @param {Function} func The function to apply a rest parameter to. 21518 * @returns {Function} Returns the new function. 21519 */ 21520 var castRest = baseRest; 21521 21522 /** 21523 * Casts `array` to a slice if it's needed. 21524 * 21525 * @private 21526 * @param {Array} array The array to inspect. 21527 * @param {number} start The start position. 21528 * @param {number} [end=array.length] The end position. 21529 * @returns {Array} Returns the cast slice. 21530 */ 21531 function castSlice(array, start, end) { 21532 var length = array.length; 21533 end = end === undefined ? length : end; 21534 return (!start && end >= length) ? array : baseSlice(array, start, end); 21535 } 21536 21537 /** 21538 * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout). 21539 * 21540 * @private 21541 * @param {number|Object} id The timer id or timeout object of the timer to clear. 21542 */ 21543 var clearTimeout = ctxClearTimeout || function(id) { 21544 return root.clearTimeout(id); 21545 }; 21546 21547 /** 21548 * Creates a clone of `buffer`. 21549 * 21550 * @private 21551 * @param {Buffer} buffer The buffer to clone. 21552 * @param {boolean} [isDeep] Specify a deep clone. 21553 * @returns {Buffer} Returns the cloned buffer. 21554 */ 21555 function cloneBuffer(buffer, isDeep) { 21556 if (isDeep) { 21557 return buffer.slice(); 21558 } 21559 var length = buffer.length, 21560 result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); 21561 21562 buffer.copy(result); 21563 return result; 21564 } 21565 21566 /** 21567 * Creates a clone of `arrayBuffer`. 21568 * 21569 * @private 21570 * @param {ArrayBuffer} arrayBuffer The array buffer to clone. 21571 * @returns {ArrayBuffer} Returns the cloned array buffer. 21572 */ 21573 function cloneArrayBuffer(arrayBuffer) { 21574 var result = new arrayBuffer.constructor(arrayBuffer.byteLength); 21575 new Uint8Array(result).set(new Uint8Array(arrayBuffer)); 21576 return result; 21577 } 21578 21579 /** 21580 * Creates a clone of `dataView`. 21581 * 21582 * @private 21583 * @param {Object} dataView The data view to clone. 21584 * @param {boolean} [isDeep] Specify a deep clone. 21585 * @returns {Object} Returns the cloned data view. 21586 */ 21587 function cloneDataView(dataView, isDeep) { 21588 var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; 21589 return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); 21590 } 21591 21592 /** 21593 * Creates a clone of `regexp`. 21594 * 21595 * @private 21596 * @param {Object} regexp The regexp to clone. 21597 * @returns {Object} Returns the cloned regexp. 21598 */ 21599 function cloneRegExp(regexp) { 21600 var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); 21601 result.lastIndex = regexp.lastIndex; 21602 return result; 21603 } 21604 21605 /** 21606 * Creates a clone of the `symbol` object. 21607 * 21608 * @private 21609 * @param {Object} symbol The symbol object to clone. 21610 * @returns {Object} Returns the cloned symbol object. 21611 */ 21612 function cloneSymbol(symbol) { 21613 return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; 21614 } 21615 21616 /** 21617 * Creates a clone of `typedArray`. 21618 * 21619 * @private 21620 * @param {Object} typedArray The typed array to clone. 21621 * @param {boolean} [isDeep] Specify a deep clone. 21622 * @returns {Object} Returns the cloned typed array. 21623 */ 21624 function cloneTypedArray(typedArray, isDeep) { 21625 var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; 21626 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); 21627 } 21628 21629 /** 21630 * Compares values to sort them in ascending order. 21631 * 21632 * @private 21633 * @param {*} value The value to compare. 21634 * @param {*} other The other value to compare. 21635 * @returns {number} Returns the sort order indicator for `value`. 21636 */ 21637 function compareAscending(value, other) { 21638 if (value !== other) { 21639 var valIsDefined = value !== undefined, 21640 valIsNull = value === null, 21641 valIsReflexive = value === value, 21642 valIsSymbol = isSymbol(value); 21643 21644 var othIsDefined = other !== undefined, 21645 othIsNull = other === null, 21646 othIsReflexive = other === other, 21647 othIsSymbol = isSymbol(other); 21648 21649 if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || 21650 (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || 21651 (valIsNull && othIsDefined && othIsReflexive) || 21652 (!valIsDefined && othIsReflexive) || 21653 !valIsReflexive) { 21654 return 1; 21655 } 21656 if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || 21657 (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || 21658 (othIsNull && valIsDefined && valIsReflexive) || 21659 (!othIsDefined && valIsReflexive) || 21660 !othIsReflexive) { 21661 return -1; 21662 } 21663 } 21664 return 0; 21665 } 21666 21667 /** 21668 * Used by `_.orderBy` to compare multiple properties of a value to another 21669 * and stable sort them. 21670 * 21671 * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, 21672 * specify an order of "desc" for descending or "asc" for ascending sort order 21673 * of corresponding values. 21674 * 21675 * @private 21676 * @param {Object} object The object to compare. 21677 * @param {Object} other The other object to compare. 21678 * @param {boolean[]|string[]} orders The order to sort by for each property. 21679 * @returns {number} Returns the sort order indicator for `object`. 21680 */ 21681 function compareMultiple(object, other, orders) { 21682 var index = -1, 21683 objCriteria = object.criteria, 21684 othCriteria = other.criteria, 21685 length = objCriteria.length, 21686 ordersLength = orders.length; 21687 21688 while (++index < length) { 21689 var result = compareAscending(objCriteria[index], othCriteria[index]); 21690 if (result) { 21691 if (index >= ordersLength) { 21692 return result; 21693 } 21694 var order = orders[index]; 21695 return result * (order == 'desc' ? -1 : 1); 21696 } 21697 } 21698 // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications 21699 // that causes it, under certain circumstances, to provide the same value for 21700 // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 21701 // for more details. 21702 // 21703 // This also ensures a stable sort in V8 and other engines. 21704 // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. 21705 return object.index - other.index; 21706 } 21707 21708 /** 21709 * Creates an array that is the composition of partially applied arguments, 21710 * placeholders, and provided arguments into a single array of arguments. 21711 * 21712 * @private 21713 * @param {Array} args The provided arguments. 21714 * @param {Array} partials The arguments to prepend to those provided. 21715 * @param {Array} holders The `partials` placeholder indexes. 21716 * @params {boolean} [isCurried] Specify composing for a curried function. 21717 * @returns {Array} Returns the new array of composed arguments. 21718 */ 21719 function composeArgs(args, partials, holders, isCurried) { 21720 var argsIndex = -1, 21721 argsLength = args.length, 21722 holdersLength = holders.length, 21723 leftIndex = -1, 21724 leftLength = partials.length, 21725 rangeLength = nativeMax(argsLength - holdersLength, 0), 21726 result = Array(leftLength + rangeLength), 21727 isUncurried = !isCurried; 21728 21729 while (++leftIndex < leftLength) { 21730 result[leftIndex] = partials[leftIndex]; 21731 } 21732 while (++argsIndex < holdersLength) { 21733 if (isUncurried || argsIndex < argsLength) { 21734 result[holders[argsIndex]] = args[argsIndex]; 21735 } 21736 } 21737 while (rangeLength--) { 21738 result[leftIndex++] = args[argsIndex++]; 21739 } 21740 return result; 21741 } 21742 21743 /** 21744 * This function is like `composeArgs` except that the arguments composition 21745 * is tailored for `_.partialRight`. 21746 * 21747 * @private 21748 * @param {Array} args The provided arguments. 21749 * @param {Array} partials The arguments to append to those provided. 21750 * @param {Array} holders The `partials` placeholder indexes. 21751 * @params {boolean} [isCurried] Specify composing for a curried function. 21752 * @returns {Array} Returns the new array of composed arguments. 21753 */ 21754 function composeArgsRight(args, partials, holders, isCurried) { 21755 var argsIndex = -1, 21756 argsLength = args.length, 21757 holdersIndex = -1, 21758 holdersLength = holders.length, 21759 rightIndex = -1, 21760 rightLength = partials.length, 21761 rangeLength = nativeMax(argsLength - holdersLength, 0), 21762 result = Array(rangeLength + rightLength), 21763 isUncurried = !isCurried; 21764 21765 while (++argsIndex < rangeLength) { 21766 result[argsIndex] = args[argsIndex]; 21767 } 21768 var offset = argsIndex; 21769 while (++rightIndex < rightLength) { 21770 result[offset + rightIndex] = partials[rightIndex]; 21771 } 21772 while (++holdersIndex < holdersLength) { 21773 if (isUncurried || argsIndex < argsLength) { 21774 result[offset + holders[holdersIndex]] = args[argsIndex++]; 21775 } 21776 } 21777 return result; 21778 } 21779 21780 /** 21781 * Copies the values of `source` to `array`. 21782 * 21783 * @private 21784 * @param {Array} source The array to copy values from. 21785 * @param {Array} [array=[]] The array to copy values to. 21786 * @returns {Array} Returns `array`. 21787 */ 21788 function copyArray(source, array) { 21789 var index = -1, 21790 length = source.length; 21791 21792 array || (array = Array(length)); 21793 while (++index < length) { 21794 array[index] = source[index]; 21795 } 21796 return array; 21797 } 21798 21799 /** 21800 * Copies properties of `source` to `object`. 21801 * 21802 * @private 21803 * @param {Object} source The object to copy properties from. 21804 * @param {Array} props The property identifiers to copy. 21805 * @param {Object} [object={}] The object to copy properties to. 21806 * @param {Function} [customizer] The function to customize copied values. 21807 * @returns {Object} Returns `object`. 21808 */ 21809 function copyObject(source, props, object, customizer) { 21810 var isNew = !object; 21811 object || (object = {}); 21812 21813 var index = -1, 21814 length = props.length; 21815 21816 while (++index < length) { 21817 var key = props[index]; 21818 21819 var newValue = customizer 21820 ? customizer(object[key], source[key], key, object, source) 21821 : undefined; 21822 21823 if (newValue === undefined) { 21824 newValue = source[key]; 21825 } 21826 if (isNew) { 21827 baseAssignValue(object, key, newValue); 21828 } else { 21829 assignValue(object, key, newValue); 21830 } 21831 } 21832 return object; 21833 } 21834 21835 /** 21836 * Copies own symbols of `source` to `object`. 21837 * 21838 * @private 21839 * @param {Object} source The object to copy symbols from. 21840 * @param {Object} [object={}] The object to copy symbols to. 21841 * @returns {Object} Returns `object`. 21842 */ 21843 function copySymbols(source, object) { 21844 return copyObject(source, getSymbols(source), object); 21845 } 21846 21847 /** 21848 * Copies own and inherited symbols of `source` to `object`. 21849 * 21850 * @private 21851 * @param {Object} source The object to copy symbols from. 21852 * @param {Object} [object={}] The object to copy symbols to. 21853 * @returns {Object} Returns `object`. 21854 */ 21855 function copySymbolsIn(source, object) { 21856 return copyObject(source, getSymbolsIn(source), object); 21857 } 21858 21859 /** 21860 * Creates a function like `_.groupBy`. 21861 * 21862 * @private 21863 * @param {Function} setter The function to set accumulator values. 21864 * @param {Function} [initializer] The accumulator object initializer. 21865 * @returns {Function} Returns the new aggregator function. 21866 */ 21867 function createAggregator(setter, initializer) { 21868 return function(collection, iteratee) { 21869 var func = isArray(collection) ? arrayAggregator : baseAggregator, 21870 accumulator = initializer ? initializer() : {}; 21871 21872 return func(collection, setter, getIteratee(iteratee, 2), accumulator); 21873 }; 21874 } 21875 21876 /** 21877 * Creates a function like `_.assign`. 21878 * 21879 * @private 21880 * @param {Function} assigner The function to assign values. 21881 * @returns {Function} Returns the new assigner function. 21882 */ 21883 function createAssigner(assigner) { 21884 return baseRest(function(object, sources) { 21885 var index = -1, 21886 length = sources.length, 21887 customizer = length > 1 ? sources[length - 1] : undefined, 21888 guard = length > 2 ? sources[2] : undefined; 21889 21890 customizer = (assigner.length > 3 && typeof customizer == 'function') 21891 ? (length--, customizer) 21892 : undefined; 21893 21894 if (guard && isIterateeCall(sources[0], sources[1], guard)) { 21895 customizer = length < 3 ? undefined : customizer; 21896 length = 1; 21897 } 21898 object = Object(object); 21899 while (++index < length) { 21900 var source = sources[index]; 21901 if (source) { 21902 assigner(object, source, index, customizer); 21903 } 21904 } 21905 return object; 21906 }); 21907 } 21908 21909 /** 21910 * Creates a `baseEach` or `baseEachRight` function. 21911 * 21912 * @private 21913 * @param {Function} eachFunc The function to iterate over a collection. 21914 * @param {boolean} [fromRight] Specify iterating from right to left. 21915 * @returns {Function} Returns the new base function. 21916 */ 21917 function createBaseEach(eachFunc, fromRight) { 21918 return function(collection, iteratee) { 21919 if (collection == null) { 21920 return collection; 21921 } 21922 if (!isArrayLike(collection)) { 21923 return eachFunc(collection, iteratee); 21924 } 21925 var length = collection.length, 21926 index = fromRight ? length : -1, 21927 iterable = Object(collection); 21928 21929 while ((fromRight ? index-- : ++index < length)) { 21930 if (iteratee(iterable[index], index, iterable) === false) { 21931 break; 21932 } 21933 } 21934 return collection; 21935 }; 21936 } 21937 21938 /** 21939 * Creates a base function for methods like `_.forIn` and `_.forOwn`. 21940 * 21941 * @private 21942 * @param {boolean} [fromRight] Specify iterating from right to left. 21943 * @returns {Function} Returns the new base function. 21944 */ 21945 function createBaseFor(fromRight) { 21946 return function(object, iteratee, keysFunc) { 21947 var index = -1, 21948 iterable = Object(object), 21949 props = keysFunc(object), 21950 length = props.length; 21951 21952 while (length--) { 21953 var key = props[fromRight ? length : ++index]; 21954 if (iteratee(iterable[key], key, iterable) === false) { 21955 break; 21956 } 21957 } 21958 return object; 21959 }; 21960 } 21961 21962 /** 21963 * Creates a function that wraps `func` to invoke it with the optional `this` 21964 * binding of `thisArg`. 21965 * 21966 * @private 21967 * @param {Function} func The function to wrap. 21968 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 21969 * @param {*} [thisArg] The `this` binding of `func`. 21970 * @returns {Function} Returns the new wrapped function. 21971 */ 21972 function createBind(func, bitmask, thisArg) { 21973 var isBind = bitmask & WRAP_BIND_FLAG, 21974 Ctor = createCtor(func); 21975 21976 function wrapper() { 21977 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 21978 return fn.apply(isBind ? thisArg : this, arguments); 21979 } 21980 return wrapper; 21981 } 21982 21983 /** 21984 * Creates a function like `_.lowerFirst`. 21985 * 21986 * @private 21987 * @param {string} methodName The name of the `String` case method to use. 21988 * @returns {Function} Returns the new case function. 21989 */ 21990 function createCaseFirst(methodName) { 21991 return function(string) { 21992 string = toString(string); 21993 21994 var strSymbols = hasUnicode(string) 21995 ? stringToArray(string) 21996 : undefined; 21997 21998 var chr = strSymbols 21999 ? strSymbols[0] 22000 : string.charAt(0); 22001 22002 var trailing = strSymbols 22003 ? castSlice(strSymbols, 1).join('') 22004 : string.slice(1); 22005 22006 return chr[methodName]() + trailing; 22007 }; 22008 } 22009 22010 /** 22011 * Creates a function like `_.camelCase`. 22012 * 22013 * @private 22014 * @param {Function} callback The function to combine each word. 22015 * @returns {Function} Returns the new compounder function. 22016 */ 22017 function createCompounder(callback) { 22018 return function(string) { 22019 return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); 22020 }; 22021 } 22022 22023 /** 22024 * Creates a function that produces an instance of `Ctor` regardless of 22025 * whether it was invoked as part of a `new` expression or by `call` or `apply`. 22026 * 22027 * @private 22028 * @param {Function} Ctor The constructor to wrap. 22029 * @returns {Function} Returns the new wrapped function. 22030 */ 22031 function createCtor(Ctor) { 22032 return function() { 22033 // Use a `switch` statement to work with class constructors. See 22034 // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist 22035 // for more details. 22036 var args = arguments; 22037 switch (args.length) { 22038 case 0: return new Ctor; 22039 case 1: return new Ctor(args[0]); 22040 case 2: return new Ctor(args[0], args[1]); 22041 case 3: return new Ctor(args[0], args[1], args[2]); 22042 case 4: return new Ctor(args[0], args[1], args[2], args[3]); 22043 case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); 22044 case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); 22045 case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); 22046 } 22047 var thisBinding = baseCreate(Ctor.prototype), 22048 result = Ctor.apply(thisBinding, args); 22049 22050 // Mimic the constructor's `return` behavior. 22051 // See https://es5.github.io/#x13.2.2 for more details. 22052 return isObject(result) ? result : thisBinding; 22053 }; 22054 } 22055 22056 /** 22057 * Creates a function that wraps `func` to enable currying. 22058 * 22059 * @private 22060 * @param {Function} func The function to wrap. 22061 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 22062 * @param {number} arity The arity of `func`. 22063 * @returns {Function} Returns the new wrapped function. 22064 */ 22065 function createCurry(func, bitmask, arity) { 22066 var Ctor = createCtor(func); 22067 22068 function wrapper() { 22069 var length = arguments.length, 22070 args = Array(length), 22071 index = length, 22072 placeholder = getHolder(wrapper); 22073 22074 while (index--) { 22075 args[index] = arguments[index]; 22076 } 22077 var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) 22078 ? [] 22079 : replaceHolders(args, placeholder); 22080 22081 length -= holders.length; 22082 if (length < arity) { 22083 return createRecurry( 22084 func, bitmask, createHybrid, wrapper.placeholder, undefined, 22085 args, holders, undefined, undefined, arity - length); 22086 } 22087 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 22088 return apply(fn, this, args); 22089 } 22090 return wrapper; 22091 } 22092 22093 /** 22094 * Creates a `_.find` or `_.findLast` function. 22095 * 22096 * @private 22097 * @param {Function} findIndexFunc The function to find the collection index. 22098 * @returns {Function} Returns the new find function. 22099 */ 22100 function createFind(findIndexFunc) { 22101 return function(collection, predicate, fromIndex) { 22102 var iterable = Object(collection); 22103 if (!isArrayLike(collection)) { 22104 var iteratee = getIteratee(predicate, 3); 22105 collection = keys(collection); 22106 predicate = function(key) { return iteratee(iterable[key], key, iterable); }; 22107 } 22108 var index = findIndexFunc(collection, predicate, fromIndex); 22109 return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; 22110 }; 22111 } 22112 22113 /** 22114 * Creates a `_.flow` or `_.flowRight` function. 22115 * 22116 * @private 22117 * @param {boolean} [fromRight] Specify iterating from right to left. 22118 * @returns {Function} Returns the new flow function. 22119 */ 22120 function createFlow(fromRight) { 22121 return flatRest(function(funcs) { 22122 var length = funcs.length, 22123 index = length, 22124 prereq = LodashWrapper.prototype.thru; 22125 22126 if (fromRight) { 22127 funcs.reverse(); 22128 } 22129 while (index--) { 22130 var func = funcs[index]; 22131 if (typeof func != 'function') { 22132 throw new TypeError(FUNC_ERROR_TEXT); 22133 } 22134 if (prereq && !wrapper && getFuncName(func) == 'wrapper') { 22135 var wrapper = new LodashWrapper([], true); 22136 } 22137 } 22138 index = wrapper ? index : length; 22139 while (++index < length) { 22140 func = funcs[index]; 22141 22142 var funcName = getFuncName(func), 22143 data = funcName == 'wrapper' ? getData(func) : undefined; 22144 22145 if (data && isLaziable(data[0]) && 22146 data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && 22147 !data[4].length && data[9] == 1 22148 ) { 22149 wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); 22150 } else { 22151 wrapper = (func.length == 1 && isLaziable(func)) 22152 ? wrapper[funcName]() 22153 : wrapper.thru(func); 22154 } 22155 } 22156 return function() { 22157 var args = arguments, 22158 value = args[0]; 22159 22160 if (wrapper && args.length == 1 && isArray(value)) { 22161 return wrapper.plant(value).value(); 22162 } 22163 var index = 0, 22164 result = length ? funcs[index].apply(this, args) : value; 22165 22166 while (++index < length) { 22167 result = funcs[index].call(this, result); 22168 } 22169 return result; 22170 }; 22171 }); 22172 } 22173 22174 /** 22175 * Creates a function that wraps `func` to invoke it with optional `this` 22176 * binding of `thisArg`, partial application, and currying. 22177 * 22178 * @private 22179 * @param {Function|string} func The function or method name to wrap. 22180 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 22181 * @param {*} [thisArg] The `this` binding of `func`. 22182 * @param {Array} [partials] The arguments to prepend to those provided to 22183 * the new function. 22184 * @param {Array} [holders] The `partials` placeholder indexes. 22185 * @param {Array} [partialsRight] The arguments to append to those provided 22186 * to the new function. 22187 * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. 22188 * @param {Array} [argPos] The argument positions of the new function. 22189 * @param {number} [ary] The arity cap of `func`. 22190 * @param {number} [arity] The arity of `func`. 22191 * @returns {Function} Returns the new wrapped function. 22192 */ 22193 function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { 22194 var isAry = bitmask & WRAP_ARY_FLAG, 22195 isBind = bitmask & WRAP_BIND_FLAG, 22196 isBindKey = bitmask & WRAP_BIND_KEY_FLAG, 22197 isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), 22198 isFlip = bitmask & WRAP_FLIP_FLAG, 22199 Ctor = isBindKey ? undefined : createCtor(func); 22200 22201 function wrapper() { 22202 var length = arguments.length, 22203 args = Array(length), 22204 index = length; 22205 22206 while (index--) { 22207 args[index] = arguments[index]; 22208 } 22209 if (isCurried) { 22210 var placeholder = getHolder(wrapper), 22211 holdersCount = countHolders(args, placeholder); 22212 } 22213 if (partials) { 22214 args = composeArgs(args, partials, holders, isCurried); 22215 } 22216 if (partialsRight) { 22217 args = composeArgsRight(args, partialsRight, holdersRight, isCurried); 22218 } 22219 length -= holdersCount; 22220 if (isCurried && length < arity) { 22221 var newHolders = replaceHolders(args, placeholder); 22222 return createRecurry( 22223 func, bitmask, createHybrid, wrapper.placeholder, thisArg, 22224 args, newHolders, argPos, ary, arity - length 22225 ); 22226 } 22227 var thisBinding = isBind ? thisArg : this, 22228 fn = isBindKey ? thisBinding[func] : func; 22229 22230 length = args.length; 22231 if (argPos) { 22232 args = reorder(args, argPos); 22233 } else if (isFlip && length > 1) { 22234 args.reverse(); 22235 } 22236 if (isAry && ary < length) { 22237 args.length = ary; 22238 } 22239 if (this && this !== root && this instanceof wrapper) { 22240 fn = Ctor || createCtor(fn); 22241 } 22242 return fn.apply(thisBinding, args); 22243 } 22244 return wrapper; 22245 } 22246 22247 /** 22248 * Creates a function like `_.invertBy`. 22249 * 22250 * @private 22251 * @param {Function} setter The function to set accumulator values. 22252 * @param {Function} toIteratee The function to resolve iteratees. 22253 * @returns {Function} Returns the new inverter function. 22254 */ 22255 function createInverter(setter, toIteratee) { 22256 return function(object, iteratee) { 22257 return baseInverter(object, setter, toIteratee(iteratee), {}); 22258 }; 22259 } 22260 22261 /** 22262 * Creates a function that performs a mathematical operation on two values. 22263 * 22264 * @private 22265 * @param {Function} operator The function to perform the operation. 22266 * @param {number} [defaultValue] The value used for `undefined` arguments. 22267 * @returns {Function} Returns the new mathematical operation function. 22268 */ 22269 function createMathOperation(operator, defaultValue) { 22270 return function(value, other) { 22271 var result; 22272 if (value === undefined && other === undefined) { 22273 return defaultValue; 22274 } 22275 if (value !== undefined) { 22276 result = value; 22277 } 22278 if (other !== undefined) { 22279 if (result === undefined) { 22280 return other; 22281 } 22282 if (typeof value == 'string' || typeof other == 'string') { 22283 value = baseToString(value); 22284 other = baseToString(other); 22285 } else { 22286 value = baseToNumber(value); 22287 other = baseToNumber(other); 22288 } 22289 result = operator(value, other); 22290 } 22291 return result; 22292 }; 22293 } 22294 22295 /** 22296 * Creates a function like `_.over`. 22297 * 22298 * @private 22299 * @param {Function} arrayFunc The function to iterate over iteratees. 22300 * @returns {Function} Returns the new over function. 22301 */ 22302 function createOver(arrayFunc) { 22303 return flatRest(function(iteratees) { 22304 iteratees = arrayMap(iteratees, baseUnary(getIteratee())); 22305 return baseRest(function(args) { 22306 var thisArg = this; 22307 return arrayFunc(iteratees, function(iteratee) { 22308 return apply(iteratee, thisArg, args); 22309 }); 22310 }); 22311 }); 22312 } 22313 22314 /** 22315 * Creates the padding for `string` based on `length`. The `chars` string 22316 * is truncated if the number of characters exceeds `length`. 22317 * 22318 * @private 22319 * @param {number} length The padding length. 22320 * @param {string} [chars=' '] The string used as padding. 22321 * @returns {string} Returns the padding for `string`. 22322 */ 22323 function createPadding(length, chars) { 22324 chars = chars === undefined ? ' ' : baseToString(chars); 22325 22326 var charsLength = chars.length; 22327 if (charsLength < 2) { 22328 return charsLength ? baseRepeat(chars, length) : chars; 22329 } 22330 var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); 22331 return hasUnicode(chars) 22332 ? castSlice(stringToArray(result), 0, length).join('') 22333 : result.slice(0, length); 22334 } 22335 22336 /** 22337 * Creates a function that wraps `func` to invoke it with the `this` binding 22338 * of `thisArg` and `partials` prepended to the arguments it receives. 22339 * 22340 * @private 22341 * @param {Function} func The function to wrap. 22342 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 22343 * @param {*} thisArg The `this` binding of `func`. 22344 * @param {Array} partials The arguments to prepend to those provided to 22345 * the new function. 22346 * @returns {Function} Returns the new wrapped function. 22347 */ 22348 function createPartial(func, bitmask, thisArg, partials) { 22349 var isBind = bitmask & WRAP_BIND_FLAG, 22350 Ctor = createCtor(func); 22351 22352 function wrapper() { 22353 var argsIndex = -1, 22354 argsLength = arguments.length, 22355 leftIndex = -1, 22356 leftLength = partials.length, 22357 args = Array(leftLength + argsLength), 22358 fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 22359 22360 while (++leftIndex < leftLength) { 22361 args[leftIndex] = partials[leftIndex]; 22362 } 22363 while (argsLength--) { 22364 args[leftIndex++] = arguments[++argsIndex]; 22365 } 22366 return apply(fn, isBind ? thisArg : this, args); 22367 } 22368 return wrapper; 22369 } 22370 22371 /** 22372 * Creates a `_.range` or `_.rangeRight` function. 22373 * 22374 * @private 22375 * @param {boolean} [fromRight] Specify iterating from right to left. 22376 * @returns {Function} Returns the new range function. 22377 */ 22378 function createRange(fromRight) { 22379 return function(start, end, step) { 22380 if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { 22381 end = step = undefined; 22382 } 22383 // Ensure the sign of `-0` is preserved. 22384 start = toFinite(start); 22385 if (end === undefined) { 22386 end = start; 22387 start = 0; 22388 } else { 22389 end = toFinite(end); 22390 } 22391 step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); 22392 return baseRange(start, end, step, fromRight); 22393 }; 22394 } 22395 22396 /** 22397 * Creates a function that performs a relational operation on two values. 22398 * 22399 * @private 22400 * @param {Function} operator The function to perform the operation. 22401 * @returns {Function} Returns the new relational operation function. 22402 */ 22403 function createRelationalOperation(operator) { 22404 return function(value, other) { 22405 if (!(typeof value == 'string' && typeof other == 'string')) { 22406 value = toNumber(value); 22407 other = toNumber(other); 22408 } 22409 return operator(value, other); 22410 }; 22411 } 22412 22413 /** 22414 * Creates a function that wraps `func` to continue currying. 22415 * 22416 * @private 22417 * @param {Function} func The function to wrap. 22418 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 22419 * @param {Function} wrapFunc The function to create the `func` wrapper. 22420 * @param {*} placeholder The placeholder value. 22421 * @param {*} [thisArg] The `this` binding of `func`. 22422 * @param {Array} [partials] The arguments to prepend to those provided to 22423 * the new function. 22424 * @param {Array} [holders] The `partials` placeholder indexes. 22425 * @param {Array} [argPos] The argument positions of the new function. 22426 * @param {number} [ary] The arity cap of `func`. 22427 * @param {number} [arity] The arity of `func`. 22428 * @returns {Function} Returns the new wrapped function. 22429 */ 22430 function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { 22431 var isCurry = bitmask & WRAP_CURRY_FLAG, 22432 newHolders = isCurry ? holders : undefined, 22433 newHoldersRight = isCurry ? undefined : holders, 22434 newPartials = isCurry ? partials : undefined, 22435 newPartialsRight = isCurry ? undefined : partials; 22436 22437 bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); 22438 bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); 22439 22440 if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { 22441 bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); 22442 } 22443 var newData = [ 22444 func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, 22445 newHoldersRight, argPos, ary, arity 22446 ]; 22447 22448 var result = wrapFunc.apply(undefined, newData); 22449 if (isLaziable(func)) { 22450 setData(result, newData); 22451 } 22452 result.placeholder = placeholder; 22453 return setWrapToString(result, func, bitmask); 22454 } 22455 22456 /** 22457 * Creates a function like `_.round`. 22458 * 22459 * @private 22460 * @param {string} methodName The name of the `Math` method to use when rounding. 22461 * @returns {Function} Returns the new round function. 22462 */ 22463 function createRound(methodName) { 22464 var func = Math[methodName]; 22465 return function(number, precision) { 22466 number = toNumber(number); 22467 precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); 22468 if (precision && nativeIsFinite(number)) { 22469 // Shift with exponential notation to avoid floating-point issues. 22470 // See [MDN](https://mdn.io/round#Examples) for more details. 22471 var pair = (toString(number) + 'e').split('e'), 22472 value = func(pair[0] + 'e' + (+pair[1] + precision)); 22473 22474 pair = (toString(value) + 'e').split('e'); 22475 return +(pair[0] + 'e' + (+pair[1] - precision)); 22476 } 22477 return func(number); 22478 }; 22479 } 22480 22481 /** 22482 * Creates a set object of `values`. 22483 * 22484 * @private 22485 * @param {Array} values The values to add to the set. 22486 * @returns {Object} Returns the new set. 22487 */ 22488 var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { 22489 return new Set(values); 22490 }; 22491 22492 /** 22493 * Creates a `_.toPairs` or `_.toPairsIn` function. 22494 * 22495 * @private 22496 * @param {Function} keysFunc The function to get the keys of a given object. 22497 * @returns {Function} Returns the new pairs function. 22498 */ 22499 function createToPairs(keysFunc) { 22500 return function(object) { 22501 var tag = getTag(object); 22502 if (tag == mapTag) { 22503 return mapToArray(object); 22504 } 22505 if (tag == setTag) { 22506 return setToPairs(object); 22507 } 22508 return baseToPairs(object, keysFunc(object)); 22509 }; 22510 } 22511 22512 /** 22513 * Creates a function that either curries or invokes `func` with optional 22514 * `this` binding and partially applied arguments. 22515 * 22516 * @private 22517 * @param {Function|string} func The function or method name to wrap. 22518 * @param {number} bitmask The bitmask flags. 22519 * 1 - `_.bind` 22520 * 2 - `_.bindKey` 22521 * 4 - `_.curry` or `_.curryRight` of a bound function 22522 * 8 - `_.curry` 22523 * 16 - `_.curryRight` 22524 * 32 - `_.partial` 22525 * 64 - `_.partialRight` 22526 * 128 - `_.rearg` 22527 * 256 - `_.ary` 22528 * 512 - `_.flip` 22529 * @param {*} [thisArg] The `this` binding of `func`. 22530 * @param {Array} [partials] The arguments to be partially applied. 22531 * @param {Array} [holders] The `partials` placeholder indexes. 22532 * @param {Array} [argPos] The argument positions of the new function. 22533 * @param {number} [ary] The arity cap of `func`. 22534 * @param {number} [arity] The arity of `func`. 22535 * @returns {Function} Returns the new wrapped function. 22536 */ 22537 function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { 22538 var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; 22539 if (!isBindKey && typeof func != 'function') { 22540 throw new TypeError(FUNC_ERROR_TEXT); 22541 } 22542 var length = partials ? partials.length : 0; 22543 if (!length) { 22544 bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); 22545 partials = holders = undefined; 22546 } 22547 ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); 22548 arity = arity === undefined ? arity : toInteger(arity); 22549 length -= holders ? holders.length : 0; 22550 22551 if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { 22552 var partialsRight = partials, 22553 holdersRight = holders; 22554 22555 partials = holders = undefined; 22556 } 22557 var data = isBindKey ? undefined : getData(func); 22558 22559 var newData = [ 22560 func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, 22561 argPos, ary, arity 22562 ]; 22563 22564 if (data) { 22565 mergeData(newData, data); 22566 } 22567 func = newData[0]; 22568 bitmask = newData[1]; 22569 thisArg = newData[2]; 22570 partials = newData[3]; 22571 holders = newData[4]; 22572 arity = newData[9] = newData[9] === undefined 22573 ? (isBindKey ? 0 : func.length) 22574 : nativeMax(newData[9] - length, 0); 22575 22576 if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { 22577 bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); 22578 } 22579 if (!bitmask || bitmask == WRAP_BIND_FLAG) { 22580 var result = createBind(func, bitmask, thisArg); 22581 } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { 22582 result = createCurry(func, bitmask, arity); 22583 } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { 22584 result = createPartial(func, bitmask, thisArg, partials); 22585 } else { 22586 result = createHybrid.apply(undefined, newData); 22587 } 22588 var setter = data ? baseSetData : setData; 22589 return setWrapToString(setter(result, newData), func, bitmask); 22590 } 22591 22592 /** 22593 * Used by `_.defaults` to customize its `_.assignIn` use to assign properties 22594 * of source objects to the destination object for all destination properties 22595 * that resolve to `undefined`. 22596 * 22597 * @private 22598 * @param {*} objValue The destination value. 22599 * @param {*} srcValue The source value. 22600 * @param {string} key The key of the property to assign. 22601 * @param {Object} object The parent object of `objValue`. 22602 * @returns {*} Returns the value to assign. 22603 */ 22604 function customDefaultsAssignIn(objValue, srcValue, key, object) { 22605 if (objValue === undefined || 22606 (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { 22607 return srcValue; 22608 } 22609 return objValue; 22610 } 22611 22612 /** 22613 * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source 22614 * objects into destination objects that are passed thru. 22615 * 22616 * @private 22617 * @param {*} objValue The destination value. 22618 * @param {*} srcValue The source value. 22619 * @param {string} key The key of the property to merge. 22620 * @param {Object} object The parent object of `objValue`. 22621 * @param {Object} source The parent object of `srcValue`. 22622 * @param {Object} [stack] Tracks traversed source values and their merged 22623 * counterparts. 22624 * @returns {*} Returns the value to assign. 22625 */ 22626 function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { 22627 if (isObject(objValue) && isObject(srcValue)) { 22628 // Recursively merge objects and arrays (susceptible to call stack limits). 22629 stack.set(srcValue, objValue); 22630 baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); 22631 stack['delete'](srcValue); 22632 } 22633 return objValue; 22634 } 22635 22636 /** 22637 * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain 22638 * objects. 22639 * 22640 * @private 22641 * @param {*} value The value to inspect. 22642 * @param {string} key The key of the property to inspect. 22643 * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. 22644 */ 22645 function customOmitClone(value) { 22646 return isPlainObject(value) ? undefined : value; 22647 } 22648 22649 /** 22650 * A specialized version of `baseIsEqualDeep` for arrays with support for 22651 * partial deep comparisons. 22652 * 22653 * @private 22654 * @param {Array} array The array to compare. 22655 * @param {Array} other The other array to compare. 22656 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 22657 * @param {Function} customizer The function to customize comparisons. 22658 * @param {Function} equalFunc The function to determine equivalents of values. 22659 * @param {Object} stack Tracks traversed `array` and `other` objects. 22660 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. 22661 */ 22662 function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { 22663 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, 22664 arrLength = array.length, 22665 othLength = other.length; 22666 22667 if (arrLength != othLength && !(isPartial && othLength > arrLength)) { 22668 return false; 22669 } 22670 // Assume cyclic values are equal. 22671 var stacked = stack.get(array); 22672 if (stacked && stack.get(other)) { 22673 return stacked == other; 22674 } 22675 var index = -1, 22676 result = true, 22677 seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; 22678 22679 stack.set(array, other); 22680 stack.set(other, array); 22681 22682 // Ignore non-index properties. 22683 while (++index < arrLength) { 22684 var arrValue = array[index], 22685 othValue = other[index]; 22686 22687 if (customizer) { 22688 var compared = isPartial 22689 ? customizer(othValue, arrValue, index, other, array, stack) 22690 : customizer(arrValue, othValue, index, array, other, stack); 22691 } 22692 if (compared !== undefined) { 22693 if (compared) { 22694 continue; 22695 } 22696 result = false; 22697 break; 22698 } 22699 // Recursively compare arrays (susceptible to call stack limits). 22700 if (seen) { 22701 if (!arraySome(other, function(othValue, othIndex) { 22702 if (!cacheHas(seen, othIndex) && 22703 (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { 22704 return seen.push(othIndex); 22705 } 22706 })) { 22707 result = false; 22708 break; 22709 } 22710 } else if (!( 22711 arrValue === othValue || 22712 equalFunc(arrValue, othValue, bitmask, customizer, stack) 22713 )) { 22714 result = false; 22715 break; 22716 } 22717 } 22718 stack['delete'](array); 22719 stack['delete'](other); 22720 return result; 22721 } 22722 22723 /** 22724 * A specialized version of `baseIsEqualDeep` for comparing objects of 22725 * the same `toStringTag`. 22726 * 22727 * **Note:** This function only supports comparing values with tags of 22728 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. 22729 * 22730 * @private 22731 * @param {Object} object The object to compare. 22732 * @param {Object} other The other object to compare. 22733 * @param {string} tag The `toStringTag` of the objects to compare. 22734 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 22735 * @param {Function} customizer The function to customize comparisons. 22736 * @param {Function} equalFunc The function to determine equivalents of values. 22737 * @param {Object} stack Tracks traversed `object` and `other` objects. 22738 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 22739 */ 22740 function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { 22741 switch (tag) { 22742 case dataViewTag: 22743 if ((object.byteLength != other.byteLength) || 22744 (object.byteOffset != other.byteOffset)) { 22745 return false; 22746 } 22747 object = object.buffer; 22748 other = other.buffer; 22749 22750 case arrayBufferTag: 22751 if ((object.byteLength != other.byteLength) || 22752 !equalFunc(new Uint8Array(object), new Uint8Array(other))) { 22753 return false; 22754 } 22755 return true; 22756 22757 case boolTag: 22758 case dateTag: 22759 case numberTag: 22760 // Coerce booleans to `1` or `0` and dates to milliseconds. 22761 // Invalid dates are coerced to `NaN`. 22762 return eq(+object, +other); 22763 22764 case errorTag: 22765 return object.name == other.name && object.message == other.message; 22766 22767 case regexpTag: 22768 case stringTag: 22769 // Coerce regexes to strings and treat strings, primitives and objects, 22770 // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring 22771 // for more details. 22772 return object == (other + ''); 22773 22774 case mapTag: 22775 var convert = mapToArray; 22776 22777 case setTag: 22778 var isPartial = bitmask & COMPARE_PARTIAL_FLAG; 22779 convert || (convert = setToArray); 22780 22781 if (object.size != other.size && !isPartial) { 22782 return false; 22783 } 22784 // Assume cyclic values are equal. 22785 var stacked = stack.get(object); 22786 if (stacked) { 22787 return stacked == other; 22788 } 22789 bitmask |= COMPARE_UNORDERED_FLAG; 22790 22791 // Recursively compare objects (susceptible to call stack limits). 22792 stack.set(object, other); 22793 var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); 22794 stack['delete'](object); 22795 return result; 22796 22797 case symbolTag: 22798 if (symbolValueOf) { 22799 return symbolValueOf.call(object) == symbolValueOf.call(other); 22800 } 22801 } 22802 return false; 22803 } 22804 22805 /** 22806 * A specialized version of `baseIsEqualDeep` for objects with support for 22807 * partial deep comparisons. 22808 * 22809 * @private 22810 * @param {Object} object The object to compare. 22811 * @param {Object} other The other object to compare. 22812 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 22813 * @param {Function} customizer The function to customize comparisons. 22814 * @param {Function} equalFunc The function to determine equivalents of values. 22815 * @param {Object} stack Tracks traversed `object` and `other` objects. 22816 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 22817 */ 22818 function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { 22819 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, 22820 objProps = getAllKeys(object), 22821 objLength = objProps.length, 22822 othProps = getAllKeys(other), 22823 othLength = othProps.length; 22824 22825 if (objLength != othLength && !isPartial) { 22826 return false; 22827 } 22828 var index = objLength; 22829 while (index--) { 22830 var key = objProps[index]; 22831 if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { 22832 return false; 22833 } 22834 } 22835 // Assume cyclic values are equal. 22836 var stacked = stack.get(object); 22837 if (stacked && stack.get(other)) { 22838 return stacked == other; 22839 } 22840 var result = true; 22841 stack.set(object, other); 22842 stack.set(other, object); 22843 22844 var skipCtor = isPartial; 22845 while (++index < objLength) { 22846 key = objProps[index]; 22847 var objValue = object[key], 22848 othValue = other[key]; 22849 22850 if (customizer) { 22851 var compared = isPartial 22852 ? customizer(othValue, objValue, key, other, object, stack) 22853 : customizer(objValue, othValue, key, object, other, stack); 22854 } 22855 // Recursively compare objects (susceptible to call stack limits). 22856 if (!(compared === undefined 22857 ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) 22858 : compared 22859 )) { 22860 result = false; 22861 break; 22862 } 22863 skipCtor || (skipCtor = key == 'constructor'); 22864 } 22865 if (result && !skipCtor) { 22866 var objCtor = object.constructor, 22867 othCtor = other.constructor; 22868 22869 // Non `Object` object instances with different constructors are not equal. 22870 if (objCtor != othCtor && 22871 ('constructor' in object && 'constructor' in other) && 22872 !(typeof objCtor == 'function' && objCtor instanceof objCtor && 22873 typeof othCtor == 'function' && othCtor instanceof othCtor)) { 22874 result = false; 22875 } 22876 } 22877 stack['delete'](object); 22878 stack['delete'](other); 22879 return result; 22880 } 22881 22882 /** 22883 * A specialized version of `baseRest` which flattens the rest array. 22884 * 22885 * @private 22886 * @param {Function} func The function to apply a rest parameter to. 22887 * @returns {Function} Returns the new function. 22888 */ 22889 function flatRest(func) { 22890 return setToString(overRest(func, undefined, flatten), func + ''); 22891 } 22892 22893 /** 22894 * Creates an array of own enumerable property names and symbols of `object`. 22895 * 22896 * @private 22897 * @param {Object} object The object to query. 22898 * @returns {Array} Returns the array of property names and symbols. 22899 */ 22900 function getAllKeys(object) { 22901 return baseGetAllKeys(object, keys, getSymbols); 22902 } 22903 22904 /** 22905 * Creates an array of own and inherited enumerable property names and 22906 * symbols of `object`. 22907 * 22908 * @private 22909 * @param {Object} object The object to query. 22910 * @returns {Array} Returns the array of property names and symbols. 22911 */ 22912 function getAllKeysIn(object) { 22913 return baseGetAllKeys(object, keysIn, getSymbolsIn); 22914 } 22915 22916 /** 22917 * Gets metadata for `func`. 22918 * 22919 * @private 22920 * @param {Function} func The function to query. 22921 * @returns {*} Returns the metadata for `func`. 22922 */ 22923 var getData = !metaMap ? noop : function(func) { 22924 return metaMap.get(func); 22925 }; 22926 22927 /** 22928 * Gets the name of `func`. 22929 * 22930 * @private 22931 * @param {Function} func The function to query. 22932 * @returns {string} Returns the function name. 22933 */ 22934 function getFuncName(func) { 22935 var result = (func.name + ''), 22936 array = realNames[result], 22937 length = hasOwnProperty.call(realNames, result) ? array.length : 0; 22938 22939 while (length--) { 22940 var data = array[length], 22941 otherFunc = data.func; 22942 if (otherFunc == null || otherFunc == func) { 22943 return data.name; 22944 } 22945 } 22946 return result; 22947 } 22948 22949 /** 22950 * Gets the argument placeholder value for `func`. 22951 * 22952 * @private 22953 * @param {Function} func The function to inspect. 22954 * @returns {*} Returns the placeholder value. 22955 */ 22956 function getHolder(func) { 22957 var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; 22958 return object.placeholder; 22959 } 22960 22961 /** 22962 * Gets the appropriate "iteratee" function. If `_.iteratee` is customized, 22963 * this function returns the custom method, otherwise it returns `baseIteratee`. 22964 * If arguments are provided, the chosen function is invoked with them and 22965 * its result is returned. 22966 * 22967 * @private 22968 * @param {*} [value] The value to convert to an iteratee. 22969 * @param {number} [arity] The arity of the created iteratee. 22970 * @returns {Function} Returns the chosen function or its result. 22971 */ 22972 function getIteratee() { 22973 var result = lodash.iteratee || iteratee; 22974 result = result === iteratee ? baseIteratee : result; 22975 return arguments.length ? result(arguments[0], arguments[1]) : result; 22976 } 22977 22978 /** 22979 * Gets the data for `map`. 22980 * 22981 * @private 22982 * @param {Object} map The map to query. 22983 * @param {string} key The reference key. 22984 * @returns {*} Returns the map data. 22985 */ 22986 function getMapData(map, key) { 22987 var data = map.__data__; 22988 return isKeyable(key) 22989 ? data[typeof key == 'string' ? 'string' : 'hash'] 22990 : data.map; 22991 } 22992 22993 /** 22994 * Gets the property names, values, and compare flags of `object`. 22995 * 22996 * @private 22997 * @param {Object} object The object to query. 22998 * @returns {Array} Returns the match data of `object`. 22999 */ 23000 function getMatchData(object) { 23001 var result = keys(object), 23002 length = result.length; 23003 23004 while (length--) { 23005 var key = result[length], 23006 value = object[key]; 23007 23008 result[length] = [key, value, isStrictComparable(value)]; 23009 } 23010 return result; 23011 } 23012 23013 /** 23014 * Gets the native function at `key` of `object`. 23015 * 23016 * @private 23017 * @param {Object} object The object to query. 23018 * @param {string} key The key of the method to get. 23019 * @returns {*} Returns the function if it's native, else `undefined`. 23020 */ 23021 function getNative(object, key) { 23022 var value = getValue(object, key); 23023 return baseIsNative(value) ? value : undefined; 23024 } 23025 23026 /** 23027 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. 23028 * 23029 * @private 23030 * @param {*} value The value to query. 23031 * @returns {string} Returns the raw `toStringTag`. 23032 */ 23033 function getRawTag(value) { 23034 var isOwn = hasOwnProperty.call(value, symToStringTag), 23035 tag = value[symToStringTag]; 23036 23037 try { 23038 value[symToStringTag] = undefined; 23039 var unmasked = true; 23040 } catch (e) {} 23041 23042 var result = nativeObjectToString.call(value); 23043 if (unmasked) { 23044 if (isOwn) { 23045 value[symToStringTag] = tag; 23046 } else { 23047 delete value[symToStringTag]; 23048 } 23049 } 23050 return result; 23051 } 23052 23053 /** 23054 * Creates an array of the own enumerable symbols of `object`. 23055 * 23056 * @private 23057 * @param {Object} object The object to query. 23058 * @returns {Array} Returns the array of symbols. 23059 */ 23060 var getSymbols = !nativeGetSymbols ? stubArray : function(object) { 23061 if (object == null) { 23062 return []; 23063 } 23064 object = Object(object); 23065 return arrayFilter(nativeGetSymbols(object), function(symbol) { 23066 return propertyIsEnumerable.call(object, symbol); 23067 }); 23068 }; 23069 23070 /** 23071 * Creates an array of the own and inherited enumerable symbols of `object`. 23072 * 23073 * @private 23074 * @param {Object} object The object to query. 23075 * @returns {Array} Returns the array of symbols. 23076 */ 23077 var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { 23078 var result = []; 23079 while (object) { 23080 arrayPush(result, getSymbols(object)); 23081 object = getPrototype(object); 23082 } 23083 return result; 23084 }; 23085 23086 /** 23087 * Gets the `toStringTag` of `value`. 23088 * 23089 * @private 23090 * @param {*} value The value to query. 23091 * @returns {string} Returns the `toStringTag`. 23092 */ 23093 var getTag = baseGetTag; 23094 23095 // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. 23096 if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || 23097 (Map && getTag(new Map) != mapTag) || 23098 (Promise && getTag(Promise.resolve()) != promiseTag) || 23099 (Set && getTag(new Set) != setTag) || 23100 (WeakMap && getTag(new WeakMap) != weakMapTag)) { 23101 getTag = function(value) { 23102 var result = baseGetTag(value), 23103 Ctor = result == objectTag ? value.constructor : undefined, 23104 ctorString = Ctor ? toSource(Ctor) : ''; 23105 23106 if (ctorString) { 23107 switch (ctorString) { 23108 case dataViewCtorString: return dataViewTag; 23109 case mapCtorString: return mapTag; 23110 case promiseCtorString: return promiseTag; 23111 case setCtorString: return setTag; 23112 case weakMapCtorString: return weakMapTag; 23113 } 23114 } 23115 return result; 23116 }; 23117 } 23118 23119 /** 23120 * Gets the view, applying any `transforms` to the `start` and `end` positions. 23121 * 23122 * @private 23123 * @param {number} start The start of the view. 23124 * @param {number} end The end of the view. 23125 * @param {Array} transforms The transformations to apply to the view. 23126 * @returns {Object} Returns an object containing the `start` and `end` 23127 * positions of the view. 23128 */ 23129 function getView(start, end, transforms) { 23130 var index = -1, 23131 length = transforms.length; 23132 23133 while (++index < length) { 23134 var data = transforms[index], 23135 size = data.size; 23136 23137 switch (data.type) { 23138 case 'drop': start += size; break; 23139 case 'dropRight': end -= size; break; 23140 case 'take': end = nativeMin(end, start + size); break; 23141 case 'takeRight': start = nativeMax(start, end - size); break; 23142 } 23143 } 23144 return { 'start': start, 'end': end }; 23145 } 23146 23147 /** 23148 * Extracts wrapper details from the `source` body comment. 23149 * 23150 * @private 23151 * @param {string} source The source to inspect. 23152 * @returns {Array} Returns the wrapper details. 23153 */ 23154 function getWrapDetails(source) { 23155 var match = source.match(reWrapDetails); 23156 return match ? match[1].split(reSplitDetails) : []; 23157 } 23158 23159 /** 23160 * Checks if `path` exists on `object`. 23161 * 23162 * @private 23163 * @param {Object} object The object to query. 23164 * @param {Array|string} path The path to check. 23165 * @param {Function} hasFunc The function to check properties. 23166 * @returns {boolean} Returns `true` if `path` exists, else `false`. 23167 */ 23168 function hasPath(object, path, hasFunc) { 23169 path = castPath(path, object); 23170 23171 var index = -1, 23172 length = path.length, 23173 result = false; 23174 23175 while (++index < length) { 23176 var key = toKey(path[index]); 23177 if (!(result = object != null && hasFunc(object, key))) { 23178 break; 23179 } 23180 object = object[key]; 23181 } 23182 if (result || ++index != length) { 23183 return result; 23184 } 23185 length = object == null ? 0 : object.length; 23186 return !!length && isLength(length) && isIndex(key, length) && 23187 (isArray(object) || isArguments(object)); 23188 } 23189 23190 /** 23191 * Initializes an array clone. 23192 * 23193 * @private 23194 * @param {Array} array The array to clone. 23195 * @returns {Array} Returns the initialized clone. 23196 */ 23197 function initCloneArray(array) { 23198 var length = array.length, 23199 result = new array.constructor(length); 23200 23201 // Add properties assigned by `RegExp#exec`. 23202 if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { 23203 result.index = array.index; 23204 result.input = array.input; 23205 } 23206 return result; 23207 } 23208 23209 /** 23210 * Initializes an object clone. 23211 * 23212 * @private 23213 * @param {Object} object The object to clone. 23214 * @returns {Object} Returns the initialized clone. 23215 */ 23216 function initCloneObject(object) { 23217 return (typeof object.constructor == 'function' && !isPrototype(object)) 23218 ? baseCreate(getPrototype(object)) 23219 : {}; 23220 } 23221 23222 /** 23223 * Initializes an object clone based on its `toStringTag`. 23224 * 23225 * **Note:** This function only supports cloning values with tags of 23226 * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. 23227 * 23228 * @private 23229 * @param {Object} object The object to clone. 23230 * @param {string} tag The `toStringTag` of the object to clone. 23231 * @param {boolean} [isDeep] Specify a deep clone. 23232 * @returns {Object} Returns the initialized clone. 23233 */ 23234 function initCloneByTag(object, tag, isDeep) { 23235 var Ctor = object.constructor; 23236 switch (tag) { 23237 case arrayBufferTag: 23238 return cloneArrayBuffer(object); 23239 23240 case boolTag: 23241 case dateTag: 23242 return new Ctor(+object); 23243 23244 case dataViewTag: 23245 return cloneDataView(object, isDeep); 23246 23247 case float32Tag: case float64Tag: 23248 case int8Tag: case int16Tag: case int32Tag: 23249 case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: 23250 return cloneTypedArray(object, isDeep); 23251 23252 case mapTag: 23253 return new Ctor; 23254 23255 case numberTag: 23256 case stringTag: 23257 return new Ctor(object); 23258 23259 case regexpTag: 23260 return cloneRegExp(object); 23261 23262 case setTag: 23263 return new Ctor; 23264 23265 case symbolTag: 23266 return cloneSymbol(object); 23267 } 23268 } 23269 23270 /** 23271 * Inserts wrapper `details` in a comment at the top of the `source` body. 23272 * 23273 * @private 23274 * @param {string} source The source to modify. 23275 * @returns {Array} details The details to insert. 23276 * @returns {string} Returns the modified source. 23277 */ 23278 function insertWrapDetails(source, details) { 23279 var length = details.length; 23280 if (!length) { 23281 return source; 23282 } 23283 var lastIndex = length - 1; 23284 details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; 23285 details = details.join(length > 2 ? ', ' : ' '); 23286 return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); 23287 } 23288 23289 /** 23290 * Checks if `value` is a flattenable `arguments` object or array. 23291 * 23292 * @private 23293 * @param {*} value The value to check. 23294 * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. 23295 */ 23296 function isFlattenable(value) { 23297 return isArray(value) || isArguments(value) || 23298 !!(spreadableSymbol && value && value[spreadableSymbol]); 23299 } 23300 23301 /** 23302 * Checks if `value` is a valid array-like index. 23303 * 23304 * @private 23305 * @param {*} value The value to check. 23306 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. 23307 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. 23308 */ 23309 function isIndex(value, length) { 23310 var type = typeof value; 23311 length = length == null ? MAX_SAFE_INTEGER : length; 23312 23313 return !!length && 23314 (type == 'number' || 23315 (type != 'symbol' && reIsUint.test(value))) && 23316 (value > -1 && value % 1 == 0 && value < length); 23317 } 23318 23319 /** 23320 * Checks if the given arguments are from an iteratee call. 23321 * 23322 * @private 23323 * @param {*} value The potential iteratee value argument. 23324 * @param {*} index The potential iteratee index or key argument. 23325 * @param {*} object The potential iteratee object argument. 23326 * @returns {boolean} Returns `true` if the arguments are from an iteratee call, 23327 * else `false`. 23328 */ 23329 function isIterateeCall(value, index, object) { 23330 if (!isObject(object)) { 23331 return false; 23332 } 23333 var type = typeof index; 23334 if (type == 'number' 23335 ? (isArrayLike(object) && isIndex(index, object.length)) 23336 : (type == 'string' && index in object) 23337 ) { 23338 return eq(object[index], value); 23339 } 23340 return false; 23341 } 23342 23343 /** 23344 * Checks if `value` is a property name and not a property path. 23345 * 23346 * @private 23347 * @param {*} value The value to check. 23348 * @param {Object} [object] The object to query keys on. 23349 * @returns {boolean} Returns `true` if `value` is a property name, else `false`. 23350 */ 23351 function isKey(value, object) { 23352 if (isArray(value)) { 23353 return false; 23354 } 23355 var type = typeof value; 23356 if (type == 'number' || type == 'symbol' || type == 'boolean' || 23357 value == null || isSymbol(value)) { 23358 return true; 23359 } 23360 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || 23361 (object != null && value in Object(object)); 23362 } 23363 23364 /** 23365 * Checks if `value` is suitable for use as unique object key. 23366 * 23367 * @private 23368 * @param {*} value The value to check. 23369 * @returns {boolean} Returns `true` if `value` is suitable, else `false`. 23370 */ 23371 function isKeyable(value) { 23372 var type = typeof value; 23373 return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') 23374 ? (value !== '__proto__') 23375 : (value === null); 23376 } 23377 23378 /** 23379 * Checks if `func` has a lazy counterpart. 23380 * 23381 * @private 23382 * @param {Function} func The function to check. 23383 * @returns {boolean} Returns `true` if `func` has a lazy counterpart, 23384 * else `false`. 23385 */ 23386 function isLaziable(func) { 23387 var funcName = getFuncName(func), 23388 other = lodash[funcName]; 23389 23390 if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { 23391 return false; 23392 } 23393 if (func === other) { 23394 return true; 23395 } 23396 var data = getData(other); 23397 return !!data && func === data[0]; 23398 } 23399 23400 /** 23401 * Checks if `func` has its source masked. 23402 * 23403 * @private 23404 * @param {Function} func The function to check. 23405 * @returns {boolean} Returns `true` if `func` is masked, else `false`. 23406 */ 23407 function isMasked(func) { 23408 return !!maskSrcKey && (maskSrcKey in func); 23409 } 23410 23411 /** 23412 * Checks if `func` is capable of being masked. 23413 * 23414 * @private 23415 * @param {*} value The value to check. 23416 * @returns {boolean} Returns `true` if `func` is maskable, else `false`. 23417 */ 23418 var isMaskable = coreJsData ? isFunction : stubFalse; 23419 23420 /** 23421 * Checks if `value` is likely a prototype object. 23422 * 23423 * @private 23424 * @param {*} value The value to check. 23425 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. 23426 */ 23427 function isPrototype(value) { 23428 var Ctor = value && value.constructor, 23429 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; 23430 23431 return value === proto; 23432 } 23433 23434 /** 23435 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. 23436 * 23437 * @private 23438 * @param {*} value The value to check. 23439 * @returns {boolean} Returns `true` if `value` if suitable for strict 23440 * equality comparisons, else `false`. 23441 */ 23442 function isStrictComparable(value) { 23443 return value === value && !isObject(value); 23444 } 23445 23446 /** 23447 * A specialized version of `matchesProperty` for source values suitable 23448 * for strict equality comparisons, i.e. `===`. 23449 * 23450 * @private 23451 * @param {string} key The key of the property to get. 23452 * @param {*} srcValue The value to match. 23453 * @returns {Function} Returns the new spec function. 23454 */ 23455 function matchesStrictComparable(key, srcValue) { 23456 return function(object) { 23457 if (object == null) { 23458 return false; 23459 } 23460 return object[key] === srcValue && 23461 (srcValue !== undefined || (key in Object(object))); 23462 }; 23463 } 23464 23465 /** 23466 * A specialized version of `_.memoize` which clears the memoized function's 23467 * cache when it exceeds `MAX_MEMOIZE_SIZE`. 23468 * 23469 * @private 23470 * @param {Function} func The function to have its output memoized. 23471 * @returns {Function} Returns the new memoized function. 23472 */ 23473 function memoizeCapped(func) { 23474 var result = memoize(func, function(key) { 23475 if (cache.size === MAX_MEMOIZE_SIZE) { 23476 cache.clear(); 23477 } 23478 return key; 23479 }); 23480 23481 var cache = result.cache; 23482 return result; 23483 } 23484 23485 /** 23486 * Merges the function metadata of `source` into `data`. 23487 * 23488 * Merging metadata reduces the number of wrappers used to invoke a function. 23489 * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` 23490 * may be applied regardless of execution order. Methods like `_.ary` and 23491 * `_.rearg` modify function arguments, making the order in which they are 23492 * executed important, preventing the merging of metadata. However, we make 23493 * an exception for a safe combined case where curried functions have `_.ary` 23494 * and or `_.rearg` applied. 23495 * 23496 * @private 23497 * @param {Array} data The destination metadata. 23498 * @param {Array} source The source metadata. 23499 * @returns {Array} Returns `data`. 23500 */ 23501 function mergeData(data, source) { 23502 var bitmask = data[1], 23503 srcBitmask = source[1], 23504 newBitmask = bitmask | srcBitmask, 23505 isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); 23506 23507 var isCombo = 23508 ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || 23509 ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || 23510 ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); 23511 23512 // Exit early if metadata can't be merged. 23513 if (!(isCommon || isCombo)) { 23514 return data; 23515 } 23516 // Use source `thisArg` if available. 23517 if (srcBitmask & WRAP_BIND_FLAG) { 23518 data[2] = source[2]; 23519 // Set when currying a bound function. 23520 newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; 23521 } 23522 // Compose partial arguments. 23523 var value = source[3]; 23524 if (value) { 23525 var partials = data[3]; 23526 data[3] = partials ? composeArgs(partials, value, source[4]) : value; 23527 data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; 23528 } 23529 // Compose partial right arguments. 23530 value = source[5]; 23531 if (value) { 23532 partials = data[5]; 23533 data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; 23534 data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; 23535 } 23536 // Use source `argPos` if available. 23537 value = source[7]; 23538 if (value) { 23539 data[7] = value; 23540 } 23541 // Use source `ary` if it's smaller. 23542 if (srcBitmask & WRAP_ARY_FLAG) { 23543 data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); 23544 } 23545 // Use source `arity` if one is not provided. 23546 if (data[9] == null) { 23547 data[9] = source[9]; 23548 } 23549 // Use source `func` and merge bitmasks. 23550 data[0] = source[0]; 23551 data[1] = newBitmask; 23552 23553 return data; 23554 } 23555 23556 /** 23557 * This function is like 23558 * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) 23559 * except that it includes inherited enumerable properties. 23560 * 23561 * @private 23562 * @param {Object} object The object to query. 23563 * @returns {Array} Returns the array of property names. 23564 */ 23565 function nativeKeysIn(object) { 23566 var result = []; 23567 if (object != null) { 23568 for (var key in Object(object)) { 23569 result.push(key); 23570 } 23571 } 23572 return result; 23573 } 23574 23575 /** 23576 * Converts `value` to a string using `Object.prototype.toString`. 23577 * 23578 * @private 23579 * @param {*} value The value to convert. 23580 * @returns {string} Returns the converted string. 23581 */ 23582 function objectToString(value) { 23583 return nativeObjectToString.call(value); 23584 } 23585 23586 /** 23587 * A specialized version of `baseRest` which transforms the rest array. 23588 * 23589 * @private 23590 * @param {Function} func The function to apply a rest parameter to. 23591 * @param {number} [start=func.length-1] The start position of the rest parameter. 23592 * @param {Function} transform The rest array transform. 23593 * @returns {Function} Returns the new function. 23594 */ 23595 function overRest(func, start, transform) { 23596 start = nativeMax(start === undefined ? (func.length - 1) : start, 0); 23597 return function() { 23598 var args = arguments, 23599 index = -1, 23600 length = nativeMax(args.length - start, 0), 23601 array = Array(length); 23602 23603 while (++index < length) { 23604 array[index] = args[start + index]; 23605 } 23606 index = -1; 23607 var otherArgs = Array(start + 1); 23608 while (++index < start) { 23609 otherArgs[index] = args[index]; 23610 } 23611 otherArgs[start] = transform(array); 23612 return apply(func, this, otherArgs); 23613 }; 23614 } 23615 23616 /** 23617 * Gets the parent value at `path` of `object`. 23618 * 23619 * @private 23620 * @param {Object} object The object to query. 23621 * @param {Array} path The path to get the parent value of. 23622 * @returns {*} Returns the parent value. 23623 */ 23624 function parent(object, path) { 23625 return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); 23626 } 23627 23628 /** 23629 * Reorder `array` according to the specified indexes where the element at 23630 * the first index is assigned as the first element, the element at 23631 * the second index is assigned as the second element, and so on. 23632 * 23633 * @private 23634 * @param {Array} array The array to reorder. 23635 * @param {Array} indexes The arranged array indexes. 23636 * @returns {Array} Returns `array`. 23637 */ 23638 function reorder(array, indexes) { 23639 var arrLength = array.length, 23640 length = nativeMin(indexes.length, arrLength), 23641 oldArray = copyArray(array); 23642 23643 while (length--) { 23644 var index = indexes[length]; 23645 array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; 23646 } 23647 return array; 23648 } 23649 23650 /** 23651 * Gets the value at `key`, unless `key` is "__proto__" or "constructor". 23652 * 23653 * @private 23654 * @param {Object} object The object to query. 23655 * @param {string} key The key of the property to get. 23656 * @returns {*} Returns the property value. 23657 */ 23658 function safeGet(object, key) { 23659 if (key === 'constructor' && typeof object[key] === 'function') { 23660 return; 23661 } 23662 23663 if (key == '__proto__') { 23664 return; 23665 } 23666 23667 return object[key]; 23668 } 23669 23670 /** 23671 * Sets metadata for `func`. 23672 * 23673 * **Note:** If this function becomes hot, i.e. is invoked a lot in a short 23674 * period of time, it will trip its breaker and transition to an identity 23675 * function to avoid garbage collection pauses in V8. See 23676 * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) 23677 * for more details. 23678 * 23679 * @private 23680 * @param {Function} func The function to associate metadata with. 23681 * @param {*} data The metadata. 23682 * @returns {Function} Returns `func`. 23683 */ 23684 var setData = shortOut(baseSetData); 23685 23686 /** 23687 * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout). 23688 * 23689 * @private 23690 * @param {Function} func The function to delay. 23691 * @param {number} wait The number of milliseconds to delay invocation. 23692 * @returns {number|Object} Returns the timer id or timeout object. 23693 */ 23694 var setTimeout = ctxSetTimeout || function(func, wait) { 23695 return root.setTimeout(func, wait); 23696 }; 23697 23698 /** 23699 * Sets the `toString` method of `func` to return `string`. 23700 * 23701 * @private 23702 * @param {Function} func The function to modify. 23703 * @param {Function} string The `toString` result. 23704 * @returns {Function} Returns `func`. 23705 */ 23706 var setToString = shortOut(baseSetToString); 23707 23708 /** 23709 * Sets the `toString` method of `wrapper` to mimic the source of `reference` 23710 * with wrapper details in a comment at the top of the source body. 23711 * 23712 * @private 23713 * @param {Function} wrapper The function to modify. 23714 * @param {Function} reference The reference function. 23715 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 23716 * @returns {Function} Returns `wrapper`. 23717 */ 23718 function setWrapToString(wrapper, reference, bitmask) { 23719 var source = (reference + ''); 23720 return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); 23721 } 23722 23723 /** 23724 * Creates a function that'll short out and invoke `identity` instead 23725 * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` 23726 * milliseconds. 23727 * 23728 * @private 23729 * @param {Function} func The function to restrict. 23730 * @returns {Function} Returns the new shortable function. 23731 */ 23732 function shortOut(func) { 23733 var count = 0, 23734 lastCalled = 0; 23735 23736 return function() { 23737 var stamp = nativeNow(), 23738 remaining = HOT_SPAN - (stamp - lastCalled); 23739 23740 lastCalled = stamp; 23741 if (remaining > 0) { 23742 if (++count >= HOT_COUNT) { 23743 return arguments[0]; 23744 } 23745 } else { 23746 count = 0; 23747 } 23748 return func.apply(undefined, arguments); 23749 }; 23750 } 23751 23752 /** 23753 * A specialized version of `_.shuffle` which mutates and sets the size of `array`. 23754 * 23755 * @private 23756 * @param {Array} array The array to shuffle. 23757 * @param {number} [size=array.length] The size of `array`. 23758 * @returns {Array} Returns `array`. 23759 */ 23760 function shuffleSelf(array, size) { 23761 var index = -1, 23762 length = array.length, 23763 lastIndex = length - 1; 23764 23765 size = size === undefined ? length : size; 23766 while (++index < size) { 23767 var rand = baseRandom(index, lastIndex), 23768 value = array[rand]; 23769 23770 array[rand] = array[index]; 23771 array[index] = value; 23772 } 23773 array.length = size; 23774 return array; 23775 } 23776 23777 /** 23778 * Converts `string` to a property path array. 23779 * 23780 * @private 23781 * @param {string} string The string to convert. 23782 * @returns {Array} Returns the property path array. 23783 */ 23784 var stringToPath = memoizeCapped(function(string) { 23785 var result = []; 23786 if (string.charCodeAt(0) === 46 /* . */) { 23787 result.push(''); 23788 } 23789 string.replace(rePropName, function(match, number, quote, subString) { 23790 result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); 23791 }); 23792 return result; 23793 }); 23794 23795 /** 23796 * Converts `value` to a string key if it's not a string or symbol. 23797 * 23798 * @private 23799 * @param {*} value The value to inspect. 23800 * @returns {string|symbol} Returns the key. 23801 */ 23802 function toKey(value) { 23803 if (typeof value == 'string' || isSymbol(value)) { 23804 return value; 23805 } 23806 var result = (value + ''); 23807 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; 23808 } 23809 23810 /** 23811 * Converts `func` to its source code. 23812 * 23813 * @private 23814 * @param {Function} func The function to convert. 23815 * @returns {string} Returns the source code. 23816 */ 23817 function toSource(func) { 23818 if (func != null) { 23819 try { 23820 return funcToString.call(func); 23821 } catch (e) {} 23822 try { 23823 return (func + ''); 23824 } catch (e) {} 23825 } 23826 return ''; 23827 } 23828 23829 /** 23830 * Updates wrapper `details` based on `bitmask` flags. 23831 * 23832 * @private 23833 * @returns {Array} details The details to modify. 23834 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 23835 * @returns {Array} Returns `details`. 23836 */ 23837 function updateWrapDetails(details, bitmask) { 23838 arrayEach(wrapFlags, function(pair) { 23839 var value = '_.' + pair[0]; 23840 if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { 23841 details.push(value); 23842 } 23843 }); 23844 return details.sort(); 23845 } 23846 23847 /** 23848 * Creates a clone of `wrapper`. 23849 * 23850 * @private 23851 * @param {Object} wrapper The wrapper to clone. 23852 * @returns {Object} Returns the cloned wrapper. 23853 */ 23854 function wrapperClone(wrapper) { 23855 if (wrapper instanceof LazyWrapper) { 23856 return wrapper.clone(); 23857 } 23858 var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); 23859 result.__actions__ = copyArray(wrapper.__actions__); 23860 result.__index__ = wrapper.__index__; 23861 result.__values__ = wrapper.__values__; 23862 return result; 23863 } 23864 23865 /*------------------------------------------------------------------------*/ 23866 23867 /** 23868 * Creates an array of elements split into groups the length of `size`. 23869 * If `array` can't be split evenly, the final chunk will be the remaining 23870 * elements. 23871 * 23872 * @static 23873 * @memberOf _ 23874 * @since 3.0.0 23875 * @category Array 23876 * @param {Array} array The array to process. 23877 * @param {number} [size=1] The length of each chunk 23878 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 23879 * @returns {Array} Returns the new array of chunks. 23880 * @example 23881 * 23882 * _.chunk(['a', 'b', 'c', 'd'], 2); 23883 * // => [['a', 'b'], ['c', 'd']] 23884 * 23885 * _.chunk(['a', 'b', 'c', 'd'], 3); 23886 * // => [['a', 'b', 'c'], ['d']] 23887 */ 23888 function chunk(array, size, guard) { 23889 if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { 23890 size = 1; 23891 } else { 23892 size = nativeMax(toInteger(size), 0); 23893 } 23894 var length = array == null ? 0 : array.length; 23895 if (!length || size < 1) { 23896 return []; 23897 } 23898 var index = 0, 23899 resIndex = 0, 23900 result = Array(nativeCeil(length / size)); 23901 23902 while (index < length) { 23903 result[resIndex++] = baseSlice(array, index, (index += size)); 23904 } 23905 return result; 23906 } 23907 23908 /** 23909 * Creates an array with all falsey values removed. The values `false`, `null`, 23910 * `0`, `""`, `undefined`, and `NaN` are falsey. 23911 * 23912 * @static 23913 * @memberOf _ 23914 * @since 0.1.0 23915 * @category Array 23916 * @param {Array} array The array to compact. 23917 * @returns {Array} Returns the new array of filtered values. 23918 * @example 23919 * 23920 * _.compact([0, 1, false, 2, '', 3]); 23921 * // => [1, 2, 3] 23922 */ 23923 function compact(array) { 23924 var index = -1, 23925 length = array == null ? 0 : array.length, 23926 resIndex = 0, 23927 result = []; 23928 23929 while (++index < length) { 23930 var value = array[index]; 23931 if (value) { 23932 result[resIndex++] = value; 23933 } 23934 } 23935 return result; 23936 } 23937 23938 /** 23939 * Creates a new array concatenating `array` with any additional arrays 23940 * and/or values. 23941 * 23942 * @static 23943 * @memberOf _ 23944 * @since 4.0.0 23945 * @category Array 23946 * @param {Array} array The array to concatenate. 23947 * @param {...*} [values] The values to concatenate. 23948 * @returns {Array} Returns the new concatenated array. 23949 * @example 23950 * 23951 * var array = [1]; 23952 * var other = _.concat(array, 2, [3], [[4]]); 23953 * 23954 * console.log(other); 23955 * // => [1, 2, 3, [4]] 23956 * 23957 * console.log(array); 23958 * // => [1] 23959 */ 23960 function concat() { 23961 var length = arguments.length; 23962 if (!length) { 23963 return []; 23964 } 23965 var args = Array(length - 1), 23966 array = arguments[0], 23967 index = length; 23968 23969 while (index--) { 23970 args[index - 1] = arguments[index]; 23971 } 23972 return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); 23973 } 23974 23975 /** 23976 * Creates an array of `array` values not included in the other given arrays 23977 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 23978 * for equality comparisons. The order and references of result values are 23979 * determined by the first array. 23980 * 23981 * **Note:** Unlike `_.pullAll`, this method returns a new array. 23982 * 23983 * @static 23984 * @memberOf _ 23985 * @since 0.1.0 23986 * @category Array 23987 * @param {Array} array The array to inspect. 23988 * @param {...Array} [values] The values to exclude. 23989 * @returns {Array} Returns the new array of filtered values. 23990 * @see _.without, _.xor 23991 * @example 23992 * 23993 * _.difference([2, 1], [2, 3]); 23994 * // => [1] 23995 */ 23996 var difference = baseRest(function(array, values) { 23997 return isArrayLikeObject(array) 23998 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) 23999 : []; 24000 }); 24001 24002 /** 24003 * This method is like `_.difference` except that it accepts `iteratee` which 24004 * is invoked for each element of `array` and `values` to generate the criterion 24005 * by which they're compared. The order and references of result values are 24006 * determined by the first array. The iteratee is invoked with one argument: 24007 * (value). 24008 * 24009 * **Note:** Unlike `_.pullAllBy`, this method returns a new array. 24010 * 24011 * @static 24012 * @memberOf _ 24013 * @since 4.0.0 24014 * @category Array 24015 * @param {Array} array The array to inspect. 24016 * @param {...Array} [values] The values to exclude. 24017 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 24018 * @returns {Array} Returns the new array of filtered values. 24019 * @example 24020 * 24021 * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); 24022 * // => [1.2] 24023 * 24024 * // The `_.property` iteratee shorthand. 24025 * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); 24026 * // => [{ 'x': 2 }] 24027 */ 24028 var differenceBy = baseRest(function(array, values) { 24029 var iteratee = last(values); 24030 if (isArrayLikeObject(iteratee)) { 24031 iteratee = undefined; 24032 } 24033 return isArrayLikeObject(array) 24034 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)) 24035 : []; 24036 }); 24037 24038 /** 24039 * This method is like `_.difference` except that it accepts `comparator` 24040 * which is invoked to compare elements of `array` to `values`. The order and 24041 * references of result values are determined by the first array. The comparator 24042 * is invoked with two arguments: (arrVal, othVal). 24043 * 24044 * **Note:** Unlike `_.pullAllWith`, this method returns a new array. 24045 * 24046 * @static 24047 * @memberOf _ 24048 * @since 4.0.0 24049 * @category Array 24050 * @param {Array} array The array to inspect. 24051 * @param {...Array} [values] The values to exclude. 24052 * @param {Function} [comparator] The comparator invoked per element. 24053 * @returns {Array} Returns the new array of filtered values. 24054 * @example 24055 * 24056 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 24057 * 24058 * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); 24059 * // => [{ 'x': 2, 'y': 1 }] 24060 */ 24061 var differenceWith = baseRest(function(array, values) { 24062 var comparator = last(values); 24063 if (isArrayLikeObject(comparator)) { 24064 comparator = undefined; 24065 } 24066 return isArrayLikeObject(array) 24067 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) 24068 : []; 24069 }); 24070 24071 /** 24072 * Creates a slice of `array` with `n` elements dropped from the beginning. 24073 * 24074 * @static 24075 * @memberOf _ 24076 * @since 0.5.0 24077 * @category Array 24078 * @param {Array} array The array to query. 24079 * @param {number} [n=1] The number of elements to drop. 24080 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 24081 * @returns {Array} Returns the slice of `array`. 24082 * @example 24083 * 24084 * _.drop([1, 2, 3]); 24085 * // => [2, 3] 24086 * 24087 * _.drop([1, 2, 3], 2); 24088 * // => [3] 24089 * 24090 * _.drop([1, 2, 3], 5); 24091 * // => [] 24092 * 24093 * _.drop([1, 2, 3], 0); 24094 * // => [1, 2, 3] 24095 */ 24096 function drop(array, n, guard) { 24097 var length = array == null ? 0 : array.length; 24098 if (!length) { 24099 return []; 24100 } 24101 n = (guard || n === undefined) ? 1 : toInteger(n); 24102 return baseSlice(array, n < 0 ? 0 : n, length); 24103 } 24104 24105 /** 24106 * Creates a slice of `array` with `n` elements dropped from the end. 24107 * 24108 * @static 24109 * @memberOf _ 24110 * @since 3.0.0 24111 * @category Array 24112 * @param {Array} array The array to query. 24113 * @param {number} [n=1] The number of elements to drop. 24114 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 24115 * @returns {Array} Returns the slice of `array`. 24116 * @example 24117 * 24118 * _.dropRight([1, 2, 3]); 24119 * // => [1, 2] 24120 * 24121 * _.dropRight([1, 2, 3], 2); 24122 * // => [1] 24123 * 24124 * _.dropRight([1, 2, 3], 5); 24125 * // => [] 24126 * 24127 * _.dropRight([1, 2, 3], 0); 24128 * // => [1, 2, 3] 24129 */ 24130 function dropRight(array, n, guard) { 24131 var length = array == null ? 0 : array.length; 24132 if (!length) { 24133 return []; 24134 } 24135 n = (guard || n === undefined) ? 1 : toInteger(n); 24136 n = length - n; 24137 return baseSlice(array, 0, n < 0 ? 0 : n); 24138 } 24139 24140 /** 24141 * Creates a slice of `array` excluding elements dropped from the end. 24142 * Elements are dropped until `predicate` returns falsey. The predicate is 24143 * invoked with three arguments: (value, index, array). 24144 * 24145 * @static 24146 * @memberOf _ 24147 * @since 3.0.0 24148 * @category Array 24149 * @param {Array} array The array to query. 24150 * @param {Function} [predicate=_.identity] The function invoked per iteration. 24151 * @returns {Array} Returns the slice of `array`. 24152 * @example 24153 * 24154 * var users = [ 24155 * { 'user': 'barney', 'active': true }, 24156 * { 'user': 'fred', 'active': false }, 24157 * { 'user': 'pebbles', 'active': false } 24158 * ]; 24159 * 24160 * _.dropRightWhile(users, function(o) { return !o.active; }); 24161 * // => objects for ['barney'] 24162 * 24163 * // The `_.matches` iteratee shorthand. 24164 * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); 24165 * // => objects for ['barney', 'fred'] 24166 * 24167 * // The `_.matchesProperty` iteratee shorthand. 24168 * _.dropRightWhile(users, ['active', false]); 24169 * // => objects for ['barney'] 24170 * 24171 * // The `_.property` iteratee shorthand. 24172 * _.dropRightWhile(users, 'active'); 24173 * // => objects for ['barney', 'fred', 'pebbles'] 24174 */ 24175 function dropRightWhile(array, predicate) { 24176 return (array && array.length) 24177 ? baseWhile(array, getIteratee(predicate, 3), true, true) 24178 : []; 24179 } 24180 24181 /** 24182 * Creates a slice of `array` excluding elements dropped from the beginning. 24183 * Elements are dropped until `predicate` returns falsey. The predicate is 24184 * invoked with three arguments: (value, index, array). 24185 * 24186 * @static 24187 * @memberOf _ 24188 * @since 3.0.0 24189 * @category Array 24190 * @param {Array} array The array to query. 24191 * @param {Function} [predicate=_.identity] The function invoked per iteration. 24192 * @returns {Array} Returns the slice of `array`. 24193 * @example 24194 * 24195 * var users = [ 24196 * { 'user': 'barney', 'active': false }, 24197 * { 'user': 'fred', 'active': false }, 24198 * { 'user': 'pebbles', 'active': true } 24199 * ]; 24200 * 24201 * _.dropWhile(users, function(o) { return !o.active; }); 24202 * // => objects for ['pebbles'] 24203 * 24204 * // The `_.matches` iteratee shorthand. 24205 * _.dropWhile(users, { 'user': 'barney', 'active': false }); 24206 * // => objects for ['fred', 'pebbles'] 24207 * 24208 * // The `_.matchesProperty` iteratee shorthand. 24209 * _.dropWhile(users, ['active', false]); 24210 * // => objects for ['pebbles'] 24211 * 24212 * // The `_.property` iteratee shorthand. 24213 * _.dropWhile(users, 'active'); 24214 * // => objects for ['barney', 'fred', 'pebbles'] 24215 */ 24216 function dropWhile(array, predicate) { 24217 return (array && array.length) 24218 ? baseWhile(array, getIteratee(predicate, 3), true) 24219 : []; 24220 } 24221 24222 /** 24223 * Fills elements of `array` with `value` from `start` up to, but not 24224 * including, `end`. 24225 * 24226 * **Note:** This method mutates `array`. 24227 * 24228 * @static 24229 * @memberOf _ 24230 * @since 3.2.0 24231 * @category Array 24232 * @param {Array} array The array to fill. 24233 * @param {*} value The value to fill `array` with. 24234 * @param {number} [start=0] The start position. 24235 * @param {number} [end=array.length] The end position. 24236 * @returns {Array} Returns `array`. 24237 * @example 24238 * 24239 * var array = [1, 2, 3]; 24240 * 24241 * _.fill(array, 'a'); 24242 * console.log(array); 24243 * // => ['a', 'a', 'a'] 24244 * 24245 * _.fill(Array(3), 2); 24246 * // => [2, 2, 2] 24247 * 24248 * _.fill([4, 6, 8, 10], '*', 1, 3); 24249 * // => [4, '*', '*', 10] 24250 */ 24251 function fill(array, value, start, end) { 24252 var length = array == null ? 0 : array.length; 24253 if (!length) { 24254 return []; 24255 } 24256 if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { 24257 start = 0; 24258 end = length; 24259 } 24260 return baseFill(array, value, start, end); 24261 } 24262 24263 /** 24264 * This method is like `_.find` except that it returns the index of the first 24265 * element `predicate` returns truthy for instead of the element itself. 24266 * 24267 * @static 24268 * @memberOf _ 24269 * @since 1.1.0 24270 * @category Array 24271 * @param {Array} array The array to inspect. 24272 * @param {Function} [predicate=_.identity] The function invoked per iteration. 24273 * @param {number} [fromIndex=0] The index to search from. 24274 * @returns {number} Returns the index of the found element, else `-1`. 24275 * @example 24276 * 24277 * var users = [ 24278 * { 'user': 'barney', 'active': false }, 24279 * { 'user': 'fred', 'active': false }, 24280 * { 'user': 'pebbles', 'active': true } 24281 * ]; 24282 * 24283 * _.findIndex(users, function(o) { return o.user == 'barney'; }); 24284 * // => 0 24285 * 24286 * // The `_.matches` iteratee shorthand. 24287 * _.findIndex(users, { 'user': 'fred', 'active': false }); 24288 * // => 1 24289 * 24290 * // The `_.matchesProperty` iteratee shorthand. 24291 * _.findIndex(users, ['active', false]); 24292 * // => 0 24293 * 24294 * // The `_.property` iteratee shorthand. 24295 * _.findIndex(users, 'active'); 24296 * // => 2 24297 */ 24298 function findIndex(array, predicate, fromIndex) { 24299 var length = array == null ? 0 : array.length; 24300 if (!length) { 24301 return -1; 24302 } 24303 var index = fromIndex == null ? 0 : toInteger(fromIndex); 24304 if (index < 0) { 24305 index = nativeMax(length + index, 0); 24306 } 24307 return baseFindIndex(array, getIteratee(predicate, 3), index); 24308 } 24309 24310 /** 24311 * This method is like `_.findIndex` except that it iterates over elements 24312 * of `collection` from right to left. 24313 * 24314 * @static 24315 * @memberOf _ 24316 * @since 2.0.0 24317 * @category Array 24318 * @param {Array} array The array to inspect. 24319 * @param {Function} [predicate=_.identity] The function invoked per iteration. 24320 * @param {number} [fromIndex=array.length-1] The index to search from. 24321 * @returns {number} Returns the index of the found element, else `-1`. 24322 * @example 24323 * 24324 * var users = [ 24325 * { 'user': 'barney', 'active': true }, 24326 * { 'user': 'fred', 'active': false }, 24327 * { 'user': 'pebbles', 'active': false } 24328 * ]; 24329 * 24330 * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); 24331 * // => 2 24332 * 24333 * // The `_.matches` iteratee shorthand. 24334 * _.findLastIndex(users, { 'user': 'barney', 'active': true }); 24335 * // => 0 24336 * 24337 * // The `_.matchesProperty` iteratee shorthand. 24338 * _.findLastIndex(users, ['active', false]); 24339 * // => 2 24340 * 24341 * // The `_.property` iteratee shorthand. 24342 * _.findLastIndex(users, 'active'); 24343 * // => 0 24344 */ 24345 function findLastIndex(array, predicate, fromIndex) { 24346 var length = array == null ? 0 : array.length; 24347 if (!length) { 24348 return -1; 24349 } 24350 var index = length - 1; 24351 if (fromIndex !== undefined) { 24352 index = toInteger(fromIndex); 24353 index = fromIndex < 0 24354 ? nativeMax(length + index, 0) 24355 : nativeMin(index, length - 1); 24356 } 24357 return baseFindIndex(array, getIteratee(predicate, 3), index, true); 24358 } 24359 24360 /** 24361 * Flattens `array` a single level deep. 24362 * 24363 * @static 24364 * @memberOf _ 24365 * @since 0.1.0 24366 * @category Array 24367 * @param {Array} array The array to flatten. 24368 * @returns {Array} Returns the new flattened array. 24369 * @example 24370 * 24371 * _.flatten([1, [2, [3, [4]], 5]]); 24372 * // => [1, 2, [3, [4]], 5] 24373 */ 24374 function flatten(array) { 24375 var length = array == null ? 0 : array.length; 24376 return length ? baseFlatten(array, 1) : []; 24377 } 24378 24379 /** 24380 * Recursively flattens `array`. 24381 * 24382 * @static 24383 * @memberOf _ 24384 * @since 3.0.0 24385 * @category Array 24386 * @param {Array} array The array to flatten. 24387 * @returns {Array} Returns the new flattened array. 24388 * @example 24389 * 24390 * _.flattenDeep([1, [2, [3, [4]], 5]]); 24391 * // => [1, 2, 3, 4, 5] 24392 */ 24393 function flattenDeep(array) { 24394 var length = array == null ? 0 : array.length; 24395 return length ? baseFlatten(array, INFINITY) : []; 24396 } 24397 24398 /** 24399 * Recursively flatten `array` up to `depth` times. 24400 * 24401 * @static 24402 * @memberOf _ 24403 * @since 4.4.0 24404 * @category Array 24405 * @param {Array} array The array to flatten. 24406 * @param {number} [depth=1] The maximum recursion depth. 24407 * @returns {Array} Returns the new flattened array. 24408 * @example 24409 * 24410 * var array = [1, [2, [3, [4]], 5]]; 24411 * 24412 * _.flattenDepth(array, 1); 24413 * // => [1, 2, [3, [4]], 5] 24414 * 24415 * _.flattenDepth(array, 2); 24416 * // => [1, 2, 3, [4], 5] 24417 */ 24418 function flattenDepth(array, depth) { 24419 var length = array == null ? 0 : array.length; 24420 if (!length) { 24421 return []; 24422 } 24423 depth = depth === undefined ? 1 : toInteger(depth); 24424 return baseFlatten(array, depth); 24425 } 24426 24427 /** 24428 * The inverse of `_.toPairs`; this method returns an object composed 24429 * from key-value `pairs`. 24430 * 24431 * @static 24432 * @memberOf _ 24433 * @since 4.0.0 24434 * @category Array 24435 * @param {Array} pairs The key-value pairs. 24436 * @returns {Object} Returns the new object. 24437 * @example 24438 * 24439 * _.fromPairs([['a', 1], ['b', 2]]); 24440 * // => { 'a': 1, 'b': 2 } 24441 */ 24442 function fromPairs(pairs) { 24443 var index = -1, 24444 length = pairs == null ? 0 : pairs.length, 24445 result = {}; 24446 24447 while (++index < length) { 24448 var pair = pairs[index]; 24449 result[pair[0]] = pair[1]; 24450 } 24451 return result; 24452 } 24453 24454 /** 24455 * Gets the first element of `array`. 24456 * 24457 * @static 24458 * @memberOf _ 24459 * @since 0.1.0 24460 * @alias first 24461 * @category Array 24462 * @param {Array} array The array to query. 24463 * @returns {*} Returns the first element of `array`. 24464 * @example 24465 * 24466 * _.head([1, 2, 3]); 24467 * // => 1 24468 * 24469 * _.head([]); 24470 * // => undefined 24471 */ 24472 function head(array) { 24473 return (array && array.length) ? array[0] : undefined; 24474 } 24475 24476 /** 24477 * Gets the index at which the first occurrence of `value` is found in `array` 24478 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 24479 * for equality comparisons. If `fromIndex` is negative, it's used as the 24480 * offset from the end of `array`. 24481 * 24482 * @static 24483 * @memberOf _ 24484 * @since 0.1.0 24485 * @category Array 24486 * @param {Array} array The array to inspect. 24487 * @param {*} value The value to search for. 24488 * @param {number} [fromIndex=0] The index to search from. 24489 * @returns {number} Returns the index of the matched value, else `-1`. 24490 * @example 24491 * 24492 * _.indexOf([1, 2, 1, 2], 2); 24493 * // => 1 24494 * 24495 * // Search from the `fromIndex`. 24496 * _.indexOf([1, 2, 1, 2], 2, 2); 24497 * // => 3 24498 */ 24499 function indexOf(array, value, fromIndex) { 24500 var length = array == null ? 0 : array.length; 24501 if (!length) { 24502 return -1; 24503 } 24504 var index = fromIndex == null ? 0 : toInteger(fromIndex); 24505 if (index < 0) { 24506 index = nativeMax(length + index, 0); 24507 } 24508 return baseIndexOf(array, value, index); 24509 } 24510 24511 /** 24512 * Gets all but the last element of `array`. 24513 * 24514 * @static 24515 * @memberOf _ 24516 * @since 0.1.0 24517 * @category Array 24518 * @param {Array} array The array to query. 24519 * @returns {Array} Returns the slice of `array`. 24520 * @example 24521 * 24522 * _.initial([1, 2, 3]); 24523 * // => [1, 2] 24524 */ 24525 function initial(array) { 24526 var length = array == null ? 0 : array.length; 24527 return length ? baseSlice(array, 0, -1) : []; 24528 } 24529 24530 /** 24531 * Creates an array of unique values that are included in all given arrays 24532 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 24533 * for equality comparisons. The order and references of result values are 24534 * determined by the first array. 24535 * 24536 * @static 24537 * @memberOf _ 24538 * @since 0.1.0 24539 * @category Array 24540 * @param {...Array} [arrays] The arrays to inspect. 24541 * @returns {Array} Returns the new array of intersecting values. 24542 * @example 24543 * 24544 * _.intersection([2, 1], [2, 3]); 24545 * // => [2] 24546 */ 24547 var intersection = baseRest(function(arrays) { 24548 var mapped = arrayMap(arrays, castArrayLikeObject); 24549 return (mapped.length && mapped[0] === arrays[0]) 24550 ? baseIntersection(mapped) 24551 : []; 24552 }); 24553 24554 /** 24555 * This method is like `_.intersection` except that it accepts `iteratee` 24556 * which is invoked for each element of each `arrays` to generate the criterion 24557 * by which they're compared. The order and references of result values are 24558 * determined by the first array. The iteratee is invoked with one argument: 24559 * (value). 24560 * 24561 * @static 24562 * @memberOf _ 24563 * @since 4.0.0 24564 * @category Array 24565 * @param {...Array} [arrays] The arrays to inspect. 24566 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 24567 * @returns {Array} Returns the new array of intersecting values. 24568 * @example 24569 * 24570 * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); 24571 * // => [2.1] 24572 * 24573 * // The `_.property` iteratee shorthand. 24574 * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 24575 * // => [{ 'x': 1 }] 24576 */ 24577 var intersectionBy = baseRest(function(arrays) { 24578 var iteratee = last(arrays), 24579 mapped = arrayMap(arrays, castArrayLikeObject); 24580 24581 if (iteratee === last(mapped)) { 24582 iteratee = undefined; 24583 } else { 24584 mapped.pop(); 24585 } 24586 return (mapped.length && mapped[0] === arrays[0]) 24587 ? baseIntersection(mapped, getIteratee(iteratee, 2)) 24588 : []; 24589 }); 24590 24591 /** 24592 * This method is like `_.intersection` except that it accepts `comparator` 24593 * which is invoked to compare elements of `arrays`. The order and references 24594 * of result values are determined by the first array. The comparator is 24595 * invoked with two arguments: (arrVal, othVal). 24596 * 24597 * @static 24598 * @memberOf _ 24599 * @since 4.0.0 24600 * @category Array 24601 * @param {...Array} [arrays] The arrays to inspect. 24602 * @param {Function} [comparator] The comparator invoked per element. 24603 * @returns {Array} Returns the new array of intersecting values. 24604 * @example 24605 * 24606 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 24607 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 24608 * 24609 * _.intersectionWith(objects, others, _.isEqual); 24610 * // => [{ 'x': 1, 'y': 2 }] 24611 */ 24612 var intersectionWith = baseRest(function(arrays) { 24613 var comparator = last(arrays), 24614 mapped = arrayMap(arrays, castArrayLikeObject); 24615 24616 comparator = typeof comparator == 'function' ? comparator : undefined; 24617 if (comparator) { 24618 mapped.pop(); 24619 } 24620 return (mapped.length && mapped[0] === arrays[0]) 24621 ? baseIntersection(mapped, undefined, comparator) 24622 : []; 24623 }); 24624 24625 /** 24626 * Converts all elements in `array` into a string separated by `separator`. 24627 * 24628 * @static 24629 * @memberOf _ 24630 * @since 4.0.0 24631 * @category Array 24632 * @param {Array} array The array to convert. 24633 * @param {string} [separator=','] The element separator. 24634 * @returns {string} Returns the joined string. 24635 * @example 24636 * 24637 * _.join(['a', 'b', 'c'], '~'); 24638 * // => 'a~b~c' 24639 */ 24640 function join(array, separator) { 24641 return array == null ? '' : nativeJoin.call(array, separator); 24642 } 24643 24644 /** 24645 * Gets the last element of `array`. 24646 * 24647 * @static 24648 * @memberOf _ 24649 * @since 0.1.0 24650 * @category Array 24651 * @param {Array} array The array to query. 24652 * @returns {*} Returns the last element of `array`. 24653 * @example 24654 * 24655 * _.last([1, 2, 3]); 24656 * // => 3 24657 */ 24658 function last(array) { 24659 var length = array == null ? 0 : array.length; 24660 return length ? array[length - 1] : undefined; 24661 } 24662 24663 /** 24664 * This method is like `_.indexOf` except that it iterates over elements of 24665 * `array` from right to left. 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=array.length-1] The index to search from. 24674 * @returns {number} Returns the index of the matched value, else `-1`. 24675 * @example 24676 * 24677 * _.lastIndexOf([1, 2, 1, 2], 2); 24678 * // => 3 24679 * 24680 * // Search from the `fromIndex`. 24681 * _.lastIndexOf([1, 2, 1, 2], 2, 2); 24682 * // => 1 24683 */ 24684 function lastIndexOf(array, value, fromIndex) { 24685 var length = array == null ? 0 : array.length; 24686 if (!length) { 24687 return -1; 24688 } 24689 var index = length; 24690 if (fromIndex !== undefined) { 24691 index = toInteger(fromIndex); 24692 index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); 24693 } 24694 return value === value 24695 ? strictLastIndexOf(array, value, index) 24696 : baseFindIndex(array, baseIsNaN, index, true); 24697 } 24698 24699 /** 24700 * Gets the element at index `n` of `array`. If `n` is negative, the nth 24701 * element from the end is returned. 24702 * 24703 * @static 24704 * @memberOf _ 24705 * @since 4.11.0 24706 * @category Array 24707 * @param {Array} array The array to query. 24708 * @param {number} [n=0] The index of the element to return. 24709 * @returns {*} Returns the nth element of `array`. 24710 * @example 24711 * 24712 * var array = ['a', 'b', 'c', 'd']; 24713 * 24714 * _.nth(array, 1); 24715 * // => 'b' 24716 * 24717 * _.nth(array, -2); 24718 * // => 'c'; 24719 */ 24720 function nth(array, n) { 24721 return (array && array.length) ? baseNth(array, toInteger(n)) : undefined; 24722 } 24723 24724 /** 24725 * Removes all given values from `array` using 24726 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 24727 * for equality comparisons. 24728 * 24729 * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` 24730 * to remove elements from an array by predicate. 24731 * 24732 * @static 24733 * @memberOf _ 24734 * @since 2.0.0 24735 * @category Array 24736 * @param {Array} array The array to modify. 24737 * @param {...*} [values] The values to remove. 24738 * @returns {Array} Returns `array`. 24739 * @example 24740 * 24741 * var array = ['a', 'b', 'c', 'a', 'b', 'c']; 24742 * 24743 * _.pull(array, 'a', 'c'); 24744 * console.log(array); 24745 * // => ['b', 'b'] 24746 */ 24747 var pull = baseRest(pullAll); 24748 24749 /** 24750 * This method is like `_.pull` except that it accepts an array of values to remove. 24751 * 24752 * **Note:** Unlike `_.difference`, this method mutates `array`. 24753 * 24754 * @static 24755 * @memberOf _ 24756 * @since 4.0.0 24757 * @category Array 24758 * @param {Array} array The array to modify. 24759 * @param {Array} values The values to remove. 24760 * @returns {Array} Returns `array`. 24761 * @example 24762 * 24763 * var array = ['a', 'b', 'c', 'a', 'b', 'c']; 24764 * 24765 * _.pullAll(array, ['a', 'c']); 24766 * console.log(array); 24767 * // => ['b', 'b'] 24768 */ 24769 function pullAll(array, values) { 24770 return (array && array.length && values && values.length) 24771 ? basePullAll(array, values) 24772 : array; 24773 } 24774 24775 /** 24776 * This method is like `_.pullAll` except that it accepts `iteratee` which is 24777 * invoked for each element of `array` and `values` to generate the criterion 24778 * by which they're compared. The iteratee is invoked with one argument: (value). 24779 * 24780 * **Note:** Unlike `_.differenceBy`, this method mutates `array`. 24781 * 24782 * @static 24783 * @memberOf _ 24784 * @since 4.0.0 24785 * @category Array 24786 * @param {Array} array The array to modify. 24787 * @param {Array} values The values to remove. 24788 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 24789 * @returns {Array} Returns `array`. 24790 * @example 24791 * 24792 * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; 24793 * 24794 * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); 24795 * console.log(array); 24796 * // => [{ 'x': 2 }] 24797 */ 24798 function pullAllBy(array, values, iteratee) { 24799 return (array && array.length && values && values.length) 24800 ? basePullAll(array, values, getIteratee(iteratee, 2)) 24801 : array; 24802 } 24803 24804 /** 24805 * This method is like `_.pullAll` except that it accepts `comparator` which 24806 * is invoked to compare elements of `array` to `values`. The comparator is 24807 * invoked with two arguments: (arrVal, othVal). 24808 * 24809 * **Note:** Unlike `_.differenceWith`, this method mutates `array`. 24810 * 24811 * @static 24812 * @memberOf _ 24813 * @since 4.6.0 24814 * @category Array 24815 * @param {Array} array The array to modify. 24816 * @param {Array} values The values to remove. 24817 * @param {Function} [comparator] The comparator invoked per element. 24818 * @returns {Array} Returns `array`. 24819 * @example 24820 * 24821 * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; 24822 * 24823 * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); 24824 * console.log(array); 24825 * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] 24826 */ 24827 function pullAllWith(array, values, comparator) { 24828 return (array && array.length && values && values.length) 24829 ? basePullAll(array, values, undefined, comparator) 24830 : array; 24831 } 24832 24833 /** 24834 * Removes elements from `array` corresponding to `indexes` and returns an 24835 * array of removed elements. 24836 * 24837 * **Note:** Unlike `_.at`, this method mutates `array`. 24838 * 24839 * @static 24840 * @memberOf _ 24841 * @since 3.0.0 24842 * @category Array 24843 * @param {Array} array The array to modify. 24844 * @param {...(number|number[])} [indexes] The indexes of elements to remove. 24845 * @returns {Array} Returns the new array of removed elements. 24846 * @example 24847 * 24848 * var array = ['a', 'b', 'c', 'd']; 24849 * var pulled = _.pullAt(array, [1, 3]); 24850 * 24851 * console.log(array); 24852 * // => ['a', 'c'] 24853 * 24854 * console.log(pulled); 24855 * // => ['b', 'd'] 24856 */ 24857 var pullAt = flatRest(function(array, indexes) { 24858 var length = array == null ? 0 : array.length, 24859 result = baseAt(array, indexes); 24860 24861 basePullAt(array, arrayMap(indexes, function(index) { 24862 return isIndex(index, length) ? +index : index; 24863 }).sort(compareAscending)); 24864 24865 return result; 24866 }); 24867 24868 /** 24869 * Removes all elements from `array` that `predicate` returns truthy for 24870 * and returns an array of the removed elements. The predicate is invoked 24871 * with three arguments: (value, index, array). 24872 * 24873 * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` 24874 * to pull elements from an array by value. 24875 * 24876 * @static 24877 * @memberOf _ 24878 * @since 2.0.0 24879 * @category Array 24880 * @param {Array} array The array to modify. 24881 * @param {Function} [predicate=_.identity] The function invoked per iteration. 24882 * @returns {Array} Returns the new array of removed elements. 24883 * @example 24884 * 24885 * var array = [1, 2, 3, 4]; 24886 * var evens = _.remove(array, function(n) { 24887 * return n % 2 == 0; 24888 * }); 24889 * 24890 * console.log(array); 24891 * // => [1, 3] 24892 * 24893 * console.log(evens); 24894 * // => [2, 4] 24895 */ 24896 function remove(array, predicate) { 24897 var result = []; 24898 if (!(array && array.length)) { 24899 return result; 24900 } 24901 var index = -1, 24902 indexes = [], 24903 length = array.length; 24904 24905 predicate = getIteratee(predicate, 3); 24906 while (++index < length) { 24907 var value = array[index]; 24908 if (predicate(value, index, array)) { 24909 result.push(value); 24910 indexes.push(index); 24911 } 24912 } 24913 basePullAt(array, indexes); 24914 return result; 24915 } 24916 24917 /** 24918 * Reverses `array` so that the first element becomes the last, the second 24919 * element becomes the second to last, and so on. 24920 * 24921 * **Note:** This method mutates `array` and is based on 24922 * [`Array#reverse`](https://mdn.io/Array/reverse). 24923 * 24924 * @static 24925 * @memberOf _ 24926 * @since 4.0.0 24927 * @category Array 24928 * @param {Array} array The array to modify. 24929 * @returns {Array} Returns `array`. 24930 * @example 24931 * 24932 * var array = [1, 2, 3]; 24933 * 24934 * _.reverse(array); 24935 * // => [3, 2, 1] 24936 * 24937 * console.log(array); 24938 * // => [3, 2, 1] 24939 */ 24940 function reverse(array) { 24941 return array == null ? array : nativeReverse.call(array); 24942 } 24943 24944 /** 24945 * Creates a slice of `array` from `start` up to, but not including, `end`. 24946 * 24947 * **Note:** This method is used instead of 24948 * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are 24949 * returned. 24950 * 24951 * @static 24952 * @memberOf _ 24953 * @since 3.0.0 24954 * @category Array 24955 * @param {Array} array The array to slice. 24956 * @param {number} [start=0] The start position. 24957 * @param {number} [end=array.length] The end position. 24958 * @returns {Array} Returns the slice of `array`. 24959 */ 24960 function slice(array, start, end) { 24961 var length = array == null ? 0 : array.length; 24962 if (!length) { 24963 return []; 24964 } 24965 if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { 24966 start = 0; 24967 end = length; 24968 } 24969 else { 24970 start = start == null ? 0 : toInteger(start); 24971 end = end === undefined ? length : toInteger(end); 24972 } 24973 return baseSlice(array, start, end); 24974 } 24975 24976 /** 24977 * Uses a binary search to determine the lowest index at which `value` 24978 * should be inserted into `array` in order to maintain its sort order. 24979 * 24980 * @static 24981 * @memberOf _ 24982 * @since 0.1.0 24983 * @category Array 24984 * @param {Array} array The sorted array to inspect. 24985 * @param {*} value The value to evaluate. 24986 * @returns {number} Returns the index at which `value` should be inserted 24987 * into `array`. 24988 * @example 24989 * 24990 * _.sortedIndex([30, 50], 40); 24991 * // => 1 24992 */ 24993 function sortedIndex(array, value) { 24994 return baseSortedIndex(array, value); 24995 } 24996 24997 /** 24998 * This method is like `_.sortedIndex` except that it accepts `iteratee` 24999 * which is invoked for `value` and each element of `array` to compute their 25000 * sort ranking. The iteratee is invoked with one argument: (value). 25001 * 25002 * @static 25003 * @memberOf _ 25004 * @since 4.0.0 25005 * @category Array 25006 * @param {Array} array The sorted array to inspect. 25007 * @param {*} value The value to evaluate. 25008 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 25009 * @returns {number} Returns the index at which `value` should be inserted 25010 * into `array`. 25011 * @example 25012 * 25013 * var objects = [{ 'x': 4 }, { 'x': 5 }]; 25014 * 25015 * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); 25016 * // => 0 25017 * 25018 * // The `_.property` iteratee shorthand. 25019 * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); 25020 * // => 0 25021 */ 25022 function sortedIndexBy(array, value, iteratee) { 25023 return baseSortedIndexBy(array, value, getIteratee(iteratee, 2)); 25024 } 25025 25026 /** 25027 * This method is like `_.indexOf` except that it performs a binary 25028 * search on a sorted `array`. 25029 * 25030 * @static 25031 * @memberOf _ 25032 * @since 4.0.0 25033 * @category Array 25034 * @param {Array} array The array to inspect. 25035 * @param {*} value The value to search for. 25036 * @returns {number} Returns the index of the matched value, else `-1`. 25037 * @example 25038 * 25039 * _.sortedIndexOf([4, 5, 5, 5, 6], 5); 25040 * // => 1 25041 */ 25042 function sortedIndexOf(array, value) { 25043 var length = array == null ? 0 : array.length; 25044 if (length) { 25045 var index = baseSortedIndex(array, value); 25046 if (index < length && eq(array[index], value)) { 25047 return index; 25048 } 25049 } 25050 return -1; 25051 } 25052 25053 /** 25054 * This method is like `_.sortedIndex` except that it returns the highest 25055 * index at which `value` should be inserted into `array` in order to 25056 * maintain its sort order. 25057 * 25058 * @static 25059 * @memberOf _ 25060 * @since 3.0.0 25061 * @category Array 25062 * @param {Array} array The sorted array to inspect. 25063 * @param {*} value The value to evaluate. 25064 * @returns {number} Returns the index at which `value` should be inserted 25065 * into `array`. 25066 * @example 25067 * 25068 * _.sortedLastIndex([4, 5, 5, 5, 6], 5); 25069 * // => 4 25070 */ 25071 function sortedLastIndex(array, value) { 25072 return baseSortedIndex(array, value, true); 25073 } 25074 25075 /** 25076 * This method is like `_.sortedLastIndex` except that it accepts `iteratee` 25077 * which is invoked for `value` and each element of `array` to compute their 25078 * sort ranking. The iteratee is invoked with one argument: (value). 25079 * 25080 * @static 25081 * @memberOf _ 25082 * @since 4.0.0 25083 * @category Array 25084 * @param {Array} array The sorted array to inspect. 25085 * @param {*} value The value to evaluate. 25086 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 25087 * @returns {number} Returns the index at which `value` should be inserted 25088 * into `array`. 25089 * @example 25090 * 25091 * var objects = [{ 'x': 4 }, { 'x': 5 }]; 25092 * 25093 * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); 25094 * // => 1 25095 * 25096 * // The `_.property` iteratee shorthand. 25097 * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); 25098 * // => 1 25099 */ 25100 function sortedLastIndexBy(array, value, iteratee) { 25101 return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true); 25102 } 25103 25104 /** 25105 * This method is like `_.lastIndexOf` except that it performs a binary 25106 * search on a sorted `array`. 25107 * 25108 * @static 25109 * @memberOf _ 25110 * @since 4.0.0 25111 * @category Array 25112 * @param {Array} array The array to inspect. 25113 * @param {*} value The value to search for. 25114 * @returns {number} Returns the index of the matched value, else `-1`. 25115 * @example 25116 * 25117 * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); 25118 * // => 3 25119 */ 25120 function sortedLastIndexOf(array, value) { 25121 var length = array == null ? 0 : array.length; 25122 if (length) { 25123 var index = baseSortedIndex(array, value, true) - 1; 25124 if (eq(array[index], value)) { 25125 return index; 25126 } 25127 } 25128 return -1; 25129 } 25130 25131 /** 25132 * This method is like `_.uniq` except that it's designed and optimized 25133 * for sorted arrays. 25134 * 25135 * @static 25136 * @memberOf _ 25137 * @since 4.0.0 25138 * @category Array 25139 * @param {Array} array The array to inspect. 25140 * @returns {Array} Returns the new duplicate free array. 25141 * @example 25142 * 25143 * _.sortedUniq([1, 1, 2]); 25144 * // => [1, 2] 25145 */ 25146 function sortedUniq(array) { 25147 return (array && array.length) 25148 ? baseSortedUniq(array) 25149 : []; 25150 } 25151 25152 /** 25153 * This method is like `_.uniqBy` except that it's designed and optimized 25154 * for sorted arrays. 25155 * 25156 * @static 25157 * @memberOf _ 25158 * @since 4.0.0 25159 * @category Array 25160 * @param {Array} array The array to inspect. 25161 * @param {Function} [iteratee] The iteratee invoked per element. 25162 * @returns {Array} Returns the new duplicate free array. 25163 * @example 25164 * 25165 * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); 25166 * // => [1.1, 2.3] 25167 */ 25168 function sortedUniqBy(array, iteratee) { 25169 return (array && array.length) 25170 ? baseSortedUniq(array, getIteratee(iteratee, 2)) 25171 : []; 25172 } 25173 25174 /** 25175 * Gets all but the first element of `array`. 25176 * 25177 * @static 25178 * @memberOf _ 25179 * @since 4.0.0 25180 * @category Array 25181 * @param {Array} array The array to query. 25182 * @returns {Array} Returns the slice of `array`. 25183 * @example 25184 * 25185 * _.tail([1, 2, 3]); 25186 * // => [2, 3] 25187 */ 25188 function tail(array) { 25189 var length = array == null ? 0 : array.length; 25190 return length ? baseSlice(array, 1, length) : []; 25191 } 25192 25193 /** 25194 * Creates a slice of `array` with `n` elements taken from the beginning. 25195 * 25196 * @static 25197 * @memberOf _ 25198 * @since 0.1.0 25199 * @category Array 25200 * @param {Array} array The array to query. 25201 * @param {number} [n=1] The number of elements to take. 25202 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 25203 * @returns {Array} Returns the slice of `array`. 25204 * @example 25205 * 25206 * _.take([1, 2, 3]); 25207 * // => [1] 25208 * 25209 * _.take([1, 2, 3], 2); 25210 * // => [1, 2] 25211 * 25212 * _.take([1, 2, 3], 5); 25213 * // => [1, 2, 3] 25214 * 25215 * _.take([1, 2, 3], 0); 25216 * // => [] 25217 */ 25218 function take(array, n, guard) { 25219 if (!(array && array.length)) { 25220 return []; 25221 } 25222 n = (guard || n === undefined) ? 1 : toInteger(n); 25223 return baseSlice(array, 0, n < 0 ? 0 : n); 25224 } 25225 25226 /** 25227 * Creates a slice of `array` with `n` elements taken from the end. 25228 * 25229 * @static 25230 * @memberOf _ 25231 * @since 3.0.0 25232 * @category Array 25233 * @param {Array} array The array to query. 25234 * @param {number} [n=1] The number of elements to take. 25235 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 25236 * @returns {Array} Returns the slice of `array`. 25237 * @example 25238 * 25239 * _.takeRight([1, 2, 3]); 25240 * // => [3] 25241 * 25242 * _.takeRight([1, 2, 3], 2); 25243 * // => [2, 3] 25244 * 25245 * _.takeRight([1, 2, 3], 5); 25246 * // => [1, 2, 3] 25247 * 25248 * _.takeRight([1, 2, 3], 0); 25249 * // => [] 25250 */ 25251 function takeRight(array, n, guard) { 25252 var length = array == null ? 0 : array.length; 25253 if (!length) { 25254 return []; 25255 } 25256 n = (guard || n === undefined) ? 1 : toInteger(n); 25257 n = length - n; 25258 return baseSlice(array, n < 0 ? 0 : n, length); 25259 } 25260 25261 /** 25262 * Creates a slice of `array` with elements taken from the end. Elements are 25263 * taken until `predicate` returns falsey. The predicate is invoked with 25264 * three arguments: (value, index, array). 25265 * 25266 * @static 25267 * @memberOf _ 25268 * @since 3.0.0 25269 * @category Array 25270 * @param {Array} array The array to query. 25271 * @param {Function} [predicate=_.identity] The function invoked per iteration. 25272 * @returns {Array} Returns the slice of `array`. 25273 * @example 25274 * 25275 * var users = [ 25276 * { 'user': 'barney', 'active': true }, 25277 * { 'user': 'fred', 'active': false }, 25278 * { 'user': 'pebbles', 'active': false } 25279 * ]; 25280 * 25281 * _.takeRightWhile(users, function(o) { return !o.active; }); 25282 * // => objects for ['fred', 'pebbles'] 25283 * 25284 * // The `_.matches` iteratee shorthand. 25285 * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); 25286 * // => objects for ['pebbles'] 25287 * 25288 * // The `_.matchesProperty` iteratee shorthand. 25289 * _.takeRightWhile(users, ['active', false]); 25290 * // => objects for ['fred', 'pebbles'] 25291 * 25292 * // The `_.property` iteratee shorthand. 25293 * _.takeRightWhile(users, 'active'); 25294 * // => [] 25295 */ 25296 function takeRightWhile(array, predicate) { 25297 return (array && array.length) 25298 ? baseWhile(array, getIteratee(predicate, 3), false, true) 25299 : []; 25300 } 25301 25302 /** 25303 * Creates a slice of `array` with elements taken from the beginning. Elements 25304 * are taken until `predicate` returns falsey. The predicate is invoked with 25305 * three arguments: (value, index, array). 25306 * 25307 * @static 25308 * @memberOf _ 25309 * @since 3.0.0 25310 * @category Array 25311 * @param {Array} array The array to query. 25312 * @param {Function} [predicate=_.identity] The function invoked per iteration. 25313 * @returns {Array} Returns the slice of `array`. 25314 * @example 25315 * 25316 * var users = [ 25317 * { 'user': 'barney', 'active': false }, 25318 * { 'user': 'fred', 'active': false }, 25319 * { 'user': 'pebbles', 'active': true } 25320 * ]; 25321 * 25322 * _.takeWhile(users, function(o) { return !o.active; }); 25323 * // => objects for ['barney', 'fred'] 25324 * 25325 * // The `_.matches` iteratee shorthand. 25326 * _.takeWhile(users, { 'user': 'barney', 'active': false }); 25327 * // => objects for ['barney'] 25328 * 25329 * // The `_.matchesProperty` iteratee shorthand. 25330 * _.takeWhile(users, ['active', false]); 25331 * // => objects for ['barney', 'fred'] 25332 * 25333 * // The `_.property` iteratee shorthand. 25334 * _.takeWhile(users, 'active'); 25335 * // => [] 25336 */ 25337 function takeWhile(array, predicate) { 25338 return (array && array.length) 25339 ? baseWhile(array, getIteratee(predicate, 3)) 25340 : []; 25341 } 25342 25343 /** 25344 * Creates an array of unique values, in order, from all given arrays using 25345 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 25346 * for equality comparisons. 25347 * 25348 * @static 25349 * @memberOf _ 25350 * @since 0.1.0 25351 * @category Array 25352 * @param {...Array} [arrays] The arrays to inspect. 25353 * @returns {Array} Returns the new array of combined values. 25354 * @example 25355 * 25356 * _.union([2], [1, 2]); 25357 * // => [2, 1] 25358 */ 25359 var union = baseRest(function(arrays) { 25360 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); 25361 }); 25362 25363 /** 25364 * This method is like `_.union` except that it accepts `iteratee` which is 25365 * invoked for each element of each `arrays` to generate the criterion by 25366 * which uniqueness is computed. Result values are chosen from the first 25367 * array in which the value occurs. The iteratee is invoked with one argument: 25368 * (value). 25369 * 25370 * @static 25371 * @memberOf _ 25372 * @since 4.0.0 25373 * @category Array 25374 * @param {...Array} [arrays] The arrays to inspect. 25375 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 25376 * @returns {Array} Returns the new array of combined values. 25377 * @example 25378 * 25379 * _.unionBy([2.1], [1.2, 2.3], Math.floor); 25380 * // => [2.1, 1.2] 25381 * 25382 * // The `_.property` iteratee shorthand. 25383 * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 25384 * // => [{ 'x': 1 }, { 'x': 2 }] 25385 */ 25386 var unionBy = baseRest(function(arrays) { 25387 var iteratee = last(arrays); 25388 if (isArrayLikeObject(iteratee)) { 25389 iteratee = undefined; 25390 } 25391 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)); 25392 }); 25393 25394 /** 25395 * This method is like `_.union` except that it accepts `comparator` which 25396 * is invoked to compare elements of `arrays`. Result values are chosen from 25397 * the first array in which the value occurs. The comparator is invoked 25398 * with two arguments: (arrVal, othVal). 25399 * 25400 * @static 25401 * @memberOf _ 25402 * @since 4.0.0 25403 * @category Array 25404 * @param {...Array} [arrays] The arrays to inspect. 25405 * @param {Function} [comparator] The comparator invoked per element. 25406 * @returns {Array} Returns the new array of combined values. 25407 * @example 25408 * 25409 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 25410 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 25411 * 25412 * _.unionWith(objects, others, _.isEqual); 25413 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] 25414 */ 25415 var unionWith = baseRest(function(arrays) { 25416 var comparator = last(arrays); 25417 comparator = typeof comparator == 'function' ? comparator : undefined; 25418 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator); 25419 }); 25420 25421 /** 25422 * Creates a duplicate-free version of an array, using 25423 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 25424 * for equality comparisons, in which only the first occurrence of each element 25425 * is kept. The order of result values is determined by the order they occur 25426 * in the array. 25427 * 25428 * @static 25429 * @memberOf _ 25430 * @since 0.1.0 25431 * @category Array 25432 * @param {Array} array The array to inspect. 25433 * @returns {Array} Returns the new duplicate free array. 25434 * @example 25435 * 25436 * _.uniq([2, 1, 2]); 25437 * // => [2, 1] 25438 */ 25439 function uniq(array) { 25440 return (array && array.length) ? baseUniq(array) : []; 25441 } 25442 25443 /** 25444 * This method is like `_.uniq` except that it accepts `iteratee` which is 25445 * invoked for each element in `array` to generate the criterion by which 25446 * uniqueness is computed. The order of result values is determined by the 25447 * order they occur in the array. The iteratee is invoked with one argument: 25448 * (value). 25449 * 25450 * @static 25451 * @memberOf _ 25452 * @since 4.0.0 25453 * @category Array 25454 * @param {Array} array The array to inspect. 25455 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 25456 * @returns {Array} Returns the new duplicate free array. 25457 * @example 25458 * 25459 * _.uniqBy([2.1, 1.2, 2.3], Math.floor); 25460 * // => [2.1, 1.2] 25461 * 25462 * // The `_.property` iteratee shorthand. 25463 * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); 25464 * // => [{ 'x': 1 }, { 'x': 2 }] 25465 */ 25466 function uniqBy(array, iteratee) { 25467 return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : []; 25468 } 25469 25470 /** 25471 * This method is like `_.uniq` except that it accepts `comparator` which 25472 * is invoked to compare elements of `array`. The order of result values is 25473 * determined by the order they occur in the array.The comparator is invoked 25474 * with two arguments: (arrVal, othVal). 25475 * 25476 * @static 25477 * @memberOf _ 25478 * @since 4.0.0 25479 * @category Array 25480 * @param {Array} array The array to inspect. 25481 * @param {Function} [comparator] The comparator invoked per element. 25482 * @returns {Array} Returns the new duplicate free array. 25483 * @example 25484 * 25485 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; 25486 * 25487 * _.uniqWith(objects, _.isEqual); 25488 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] 25489 */ 25490 function uniqWith(array, comparator) { 25491 comparator = typeof comparator == 'function' ? comparator : undefined; 25492 return (array && array.length) ? baseUniq(array, undefined, comparator) : []; 25493 } 25494 25495 /** 25496 * This method is like `_.zip` except that it accepts an array of grouped 25497 * elements and creates an array regrouping the elements to their pre-zip 25498 * configuration. 25499 * 25500 * @static 25501 * @memberOf _ 25502 * @since 1.2.0 25503 * @category Array 25504 * @param {Array} array The array of grouped elements to process. 25505 * @returns {Array} Returns the new array of regrouped elements. 25506 * @example 25507 * 25508 * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]); 25509 * // => [['a', 1, true], ['b', 2, false]] 25510 * 25511 * _.unzip(zipped); 25512 * // => [['a', 'b'], [1, 2], [true, false]] 25513 */ 25514 function unzip(array) { 25515 if (!(array && array.length)) { 25516 return []; 25517 } 25518 var length = 0; 25519 array = arrayFilter(array, function(group) { 25520 if (isArrayLikeObject(group)) { 25521 length = nativeMax(group.length, length); 25522 return true; 25523 } 25524 }); 25525 return baseTimes(length, function(index) { 25526 return arrayMap(array, baseProperty(index)); 25527 }); 25528 } 25529 25530 /** 25531 * This method is like `_.unzip` except that it accepts `iteratee` to specify 25532 * how regrouped values should be combined. The iteratee is invoked with the 25533 * elements of each group: (...group). 25534 * 25535 * @static 25536 * @memberOf _ 25537 * @since 3.8.0 25538 * @category Array 25539 * @param {Array} array The array of grouped elements to process. 25540 * @param {Function} [iteratee=_.identity] The function to combine 25541 * regrouped values. 25542 * @returns {Array} Returns the new array of regrouped elements. 25543 * @example 25544 * 25545 * var zipped = _.zip([1, 2], [10, 20], [100, 200]); 25546 * // => [[1, 10, 100], [2, 20, 200]] 25547 * 25548 * _.unzipWith(zipped, _.add); 25549 * // => [3, 30, 300] 25550 */ 25551 function unzipWith(array, iteratee) { 25552 if (!(array && array.length)) { 25553 return []; 25554 } 25555 var result = unzip(array); 25556 if (iteratee == null) { 25557 return result; 25558 } 25559 return arrayMap(result, function(group) { 25560 return apply(iteratee, undefined, group); 25561 }); 25562 } 25563 25564 /** 25565 * Creates an array excluding all given values using 25566 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 25567 * for equality comparisons. 25568 * 25569 * **Note:** Unlike `_.pull`, this method returns a new array. 25570 * 25571 * @static 25572 * @memberOf _ 25573 * @since 0.1.0 25574 * @category Array 25575 * @param {Array} array The array to inspect. 25576 * @param {...*} [values] The values to exclude. 25577 * @returns {Array} Returns the new array of filtered values. 25578 * @see _.difference, _.xor 25579 * @example 25580 * 25581 * _.without([2, 1, 2, 3], 1, 2); 25582 * // => [3] 25583 */ 25584 var without = baseRest(function(array, values) { 25585 return isArrayLikeObject(array) 25586 ? baseDifference(array, values) 25587 : []; 25588 }); 25589 25590 /** 25591 * Creates an array of unique values that is the 25592 * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) 25593 * of the given arrays. The order of result values is determined by the order 25594 * they occur in the arrays. 25595 * 25596 * @static 25597 * @memberOf _ 25598 * @since 2.4.0 25599 * @category Array 25600 * @param {...Array} [arrays] The arrays to inspect. 25601 * @returns {Array} Returns the new array of filtered values. 25602 * @see _.difference, _.without 25603 * @example 25604 * 25605 * _.xor([2, 1], [2, 3]); 25606 * // => [1, 3] 25607 */ 25608 var xor = baseRest(function(arrays) { 25609 return baseXor(arrayFilter(arrays, isArrayLikeObject)); 25610 }); 25611 25612 /** 25613 * This method is like `_.xor` except that it accepts `iteratee` which is 25614 * invoked for each element of each `arrays` to generate the criterion by 25615 * which by which they're compared. The order of result values is determined 25616 * by the order they occur in the arrays. The iteratee is invoked with one 25617 * argument: (value). 25618 * 25619 * @static 25620 * @memberOf _ 25621 * @since 4.0.0 25622 * @category Array 25623 * @param {...Array} [arrays] The arrays to inspect. 25624 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 25625 * @returns {Array} Returns the new array of filtered values. 25626 * @example 25627 * 25628 * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); 25629 * // => [1.2, 3.4] 25630 * 25631 * // The `_.property` iteratee shorthand. 25632 * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 25633 * // => [{ 'x': 2 }] 25634 */ 25635 var xorBy = baseRest(function(arrays) { 25636 var iteratee = last(arrays); 25637 if (isArrayLikeObject(iteratee)) { 25638 iteratee = undefined; 25639 } 25640 return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2)); 25641 }); 25642 25643 /** 25644 * This method is like `_.xor` except that it accepts `comparator` which is 25645 * invoked to compare elements of `arrays`. The order of result values is 25646 * determined by the order they occur in the arrays. The comparator is invoked 25647 * with two arguments: (arrVal, othVal). 25648 * 25649 * @static 25650 * @memberOf _ 25651 * @since 4.0.0 25652 * @category Array 25653 * @param {...Array} [arrays] The arrays to inspect. 25654 * @param {Function} [comparator] The comparator invoked per element. 25655 * @returns {Array} Returns the new array of filtered values. 25656 * @example 25657 * 25658 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 25659 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 25660 * 25661 * _.xorWith(objects, others, _.isEqual); 25662 * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] 25663 */ 25664 var xorWith = baseRest(function(arrays) { 25665 var comparator = last(arrays); 25666 comparator = typeof comparator == 'function' ? comparator : undefined; 25667 return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator); 25668 }); 25669 25670 /** 25671 * Creates an array of grouped elements, the first of which contains the 25672 * first elements of the given arrays, the second of which contains the 25673 * second elements of the given arrays, and so on. 25674 * 25675 * @static 25676 * @memberOf _ 25677 * @since 0.1.0 25678 * @category Array 25679 * @param {...Array} [arrays] The arrays to process. 25680 * @returns {Array} Returns the new array of grouped elements. 25681 * @example 25682 * 25683 * _.zip(['a', 'b'], [1, 2], [true, false]); 25684 * // => [['a', 1, true], ['b', 2, false]] 25685 */ 25686 var zip = baseRest(unzip); 25687 25688 /** 25689 * This method is like `_.fromPairs` except that it accepts two arrays, 25690 * one of property identifiers and one of corresponding values. 25691 * 25692 * @static 25693 * @memberOf _ 25694 * @since 0.4.0 25695 * @category Array 25696 * @param {Array} [props=[]] The property identifiers. 25697 * @param {Array} [values=[]] The property values. 25698 * @returns {Object} Returns the new object. 25699 * @example 25700 * 25701 * _.zipObject(['a', 'b'], [1, 2]); 25702 * // => { 'a': 1, 'b': 2 } 25703 */ 25704 function zipObject(props, values) { 25705 return baseZipObject(props || [], values || [], assignValue); 25706 } 25707 25708 /** 25709 * This method is like `_.zipObject` except that it supports property paths. 25710 * 25711 * @static 25712 * @memberOf _ 25713 * @since 4.1.0 25714 * @category Array 25715 * @param {Array} [props=[]] The property identifiers. 25716 * @param {Array} [values=[]] The property values. 25717 * @returns {Object} Returns the new object. 25718 * @example 25719 * 25720 * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); 25721 * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } 25722 */ 25723 function zipObjectDeep(props, values) { 25724 return baseZipObject(props || [], values || [], baseSet); 25725 } 25726 25727 /** 25728 * This method is like `_.zip` except that it accepts `iteratee` to specify 25729 * how grouped values should be combined. The iteratee is invoked with the 25730 * elements of each group: (...group). 25731 * 25732 * @static 25733 * @memberOf _ 25734 * @since 3.8.0 25735 * @category Array 25736 * @param {...Array} [arrays] The arrays to process. 25737 * @param {Function} [iteratee=_.identity] The function to combine 25738 * grouped values. 25739 * @returns {Array} Returns the new array of grouped elements. 25740 * @example 25741 * 25742 * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { 25743 * return a + b + c; 25744 * }); 25745 * // => [111, 222] 25746 */ 25747 var zipWith = baseRest(function(arrays) { 25748 var length = arrays.length, 25749 iteratee = length > 1 ? arrays[length - 1] : undefined; 25750 25751 iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; 25752 return unzipWith(arrays, iteratee); 25753 }); 25754 25755 /*------------------------------------------------------------------------*/ 25756 25757 /** 25758 * Creates a `lodash` wrapper instance that wraps `value` with explicit method 25759 * chain sequences enabled. The result of such sequences must be unwrapped 25760 * with `_#value`. 25761 * 25762 * @static 25763 * @memberOf _ 25764 * @since 1.3.0 25765 * @category Seq 25766 * @param {*} value The value to wrap. 25767 * @returns {Object} Returns the new `lodash` wrapper instance. 25768 * @example 25769 * 25770 * var users = [ 25771 * { 'user': 'barney', 'age': 36 }, 25772 * { 'user': 'fred', 'age': 40 }, 25773 * { 'user': 'pebbles', 'age': 1 } 25774 * ]; 25775 * 25776 * var youngest = _ 25777 * .chain(users) 25778 * .sortBy('age') 25779 * .map(function(o) { 25780 * return o.user + ' is ' + o.age; 25781 * }) 25782 * .head() 25783 * .value(); 25784 * // => 'pebbles is 1' 25785 */ 25786 function chain(value) { 25787 var result = lodash(value); 25788 result.__chain__ = true; 25789 return result; 25790 } 25791 25792 /** 25793 * This method invokes `interceptor` and returns `value`. The interceptor 25794 * is invoked with one argument; (value). The purpose of this method is to 25795 * "tap into" a method chain sequence in order to modify intermediate results. 25796 * 25797 * @static 25798 * @memberOf _ 25799 * @since 0.1.0 25800 * @category Seq 25801 * @param {*} value The value to provide to `interceptor`. 25802 * @param {Function} interceptor The function to invoke. 25803 * @returns {*} Returns `value`. 25804 * @example 25805 * 25806 * _([1, 2, 3]) 25807 * .tap(function(array) { 25808 * // Mutate input array. 25809 * array.pop(); 25810 * }) 25811 * .reverse() 25812 * .value(); 25813 * // => [2, 1] 25814 */ 25815 function tap(value, interceptor) { 25816 interceptor(value); 25817 return value; 25818 } 25819 25820 /** 25821 * This method is like `_.tap` except that it returns the result of `interceptor`. 25822 * The purpose of this method is to "pass thru" values replacing intermediate 25823 * results in a method chain sequence. 25824 * 25825 * @static 25826 * @memberOf _ 25827 * @since 3.0.0 25828 * @category Seq 25829 * @param {*} value The value to provide to `interceptor`. 25830 * @param {Function} interceptor The function to invoke. 25831 * @returns {*} Returns the result of `interceptor`. 25832 * @example 25833 * 25834 * _(' abc ') 25835 * .chain() 25836 * .trim() 25837 * .thru(function(value) { 25838 * return [value]; 25839 * }) 25840 * .value(); 25841 * // => ['abc'] 25842 */ 25843 function thru(value, interceptor) { 25844 return interceptor(value); 25845 } 25846 25847 /** 25848 * This method is the wrapper version of `_.at`. 25849 * 25850 * @name at 25851 * @memberOf _ 25852 * @since 1.0.0 25853 * @category Seq 25854 * @param {...(string|string[])} [paths] The property paths to pick. 25855 * @returns {Object} Returns the new `lodash` wrapper instance. 25856 * @example 25857 * 25858 * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; 25859 * 25860 * _(object).at(['a[0].b.c', 'a[1]']).value(); 25861 * // => [3, 4] 25862 */ 25863 var wrapperAt = flatRest(function(paths) { 25864 var length = paths.length, 25865 start = length ? paths[0] : 0, 25866 value = this.__wrapped__, 25867 interceptor = function(object) { return baseAt(object, paths); }; 25868 25869 if (length > 1 || this.__actions__.length || 25870 !(value instanceof LazyWrapper) || !isIndex(start)) { 25871 return this.thru(interceptor); 25872 } 25873 value = value.slice(start, +start + (length ? 1 : 0)); 25874 value.__actions__.push({ 25875 'func': thru, 25876 'args': [interceptor], 25877 'thisArg': undefined 25878 }); 25879 return new LodashWrapper(value, this.__chain__).thru(function(array) { 25880 if (length && !array.length) { 25881 array.push(undefined); 25882 } 25883 return array; 25884 }); 25885 }); 25886 25887 /** 25888 * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. 25889 * 25890 * @name chain 25891 * @memberOf _ 25892 * @since 0.1.0 25893 * @category Seq 25894 * @returns {Object} Returns the new `lodash` wrapper instance. 25895 * @example 25896 * 25897 * var users = [ 25898 * { 'user': 'barney', 'age': 36 }, 25899 * { 'user': 'fred', 'age': 40 } 25900 * ]; 25901 * 25902 * // A sequence without explicit chaining. 25903 * _(users).head(); 25904 * // => { 'user': 'barney', 'age': 36 } 25905 * 25906 * // A sequence with explicit chaining. 25907 * _(users) 25908 * .chain() 25909 * .head() 25910 * .pick('user') 25911 * .value(); 25912 * // => { 'user': 'barney' } 25913 */ 25914 function wrapperChain() { 25915 return chain(this); 25916 } 25917 25918 /** 25919 * Executes the chain sequence and returns the wrapped result. 25920 * 25921 * @name commit 25922 * @memberOf _ 25923 * @since 3.2.0 25924 * @category Seq 25925 * @returns {Object} Returns the new `lodash` wrapper instance. 25926 * @example 25927 * 25928 * var array = [1, 2]; 25929 * var wrapped = _(array).push(3); 25930 * 25931 * console.log(array); 25932 * // => [1, 2] 25933 * 25934 * wrapped = wrapped.commit(); 25935 * console.log(array); 25936 * // => [1, 2, 3] 25937 * 25938 * wrapped.last(); 25939 * // => 3 25940 * 25941 * console.log(array); 25942 * // => [1, 2, 3] 25943 */ 25944 function wrapperCommit() { 25945 return new LodashWrapper(this.value(), this.__chain__); 25946 } 25947 25948 /** 25949 * Gets the next value on a wrapped object following the 25950 * [iterator protocol](https://mdn.io/iteration_protocols#iterator). 25951 * 25952 * @name next 25953 * @memberOf _ 25954 * @since 4.0.0 25955 * @category Seq 25956 * @returns {Object} Returns the next iterator value. 25957 * @example 25958 * 25959 * var wrapped = _([1, 2]); 25960 * 25961 * wrapped.next(); 25962 * // => { 'done': false, 'value': 1 } 25963 * 25964 * wrapped.next(); 25965 * // => { 'done': false, 'value': 2 } 25966 * 25967 * wrapped.next(); 25968 * // => { 'done': true, 'value': undefined } 25969 */ 25970 function wrapperNext() { 25971 if (this.__values__ === undefined) { 25972 this.__values__ = toArray(this.value()); 25973 } 25974 var done = this.__index__ >= this.__values__.length, 25975 value = done ? undefined : this.__values__[this.__index__++]; 25976 25977 return { 'done': done, 'value': value }; 25978 } 25979 25980 /** 25981 * Enables the wrapper to be iterable. 25982 * 25983 * @name Symbol.iterator 25984 * @memberOf _ 25985 * @since 4.0.0 25986 * @category Seq 25987 * @returns {Object} Returns the wrapper object. 25988 * @example 25989 * 25990 * var wrapped = _([1, 2]); 25991 * 25992 * wrapped[Symbol.iterator]() === wrapped; 25993 * // => true 25994 * 25995 * Array.from(wrapped); 25996 * // => [1, 2] 25997 */ 25998 function wrapperToIterator() { 25999 return this; 26000 } 26001 26002 /** 26003 * Creates a clone of the chain sequence planting `value` as the wrapped value. 26004 * 26005 * @name plant 26006 * @memberOf _ 26007 * @since 3.2.0 26008 * @category Seq 26009 * @param {*} value The value to plant. 26010 * @returns {Object} Returns the new `lodash` wrapper instance. 26011 * @example 26012 * 26013 * function square(n) { 26014 * return n * n; 26015 * } 26016 * 26017 * var wrapped = _([1, 2]).map(square); 26018 * var other = wrapped.plant([3, 4]); 26019 * 26020 * other.value(); 26021 * // => [9, 16] 26022 * 26023 * wrapped.value(); 26024 * // => [1, 4] 26025 */ 26026 function wrapperPlant(value) { 26027 var result, 26028 parent = this; 26029 26030 while (parent instanceof baseLodash) { 26031 var clone = wrapperClone(parent); 26032 clone.__index__ = 0; 26033 clone.__values__ = undefined; 26034 if (result) { 26035 previous.__wrapped__ = clone; 26036 } else { 26037 result = clone; 26038 } 26039 var previous = clone; 26040 parent = parent.__wrapped__; 26041 } 26042 previous.__wrapped__ = value; 26043 return result; 26044 } 26045 26046 /** 26047 * This method is the wrapper version of `_.reverse`. 26048 * 26049 * **Note:** This method mutates the wrapped array. 26050 * 26051 * @name reverse 26052 * @memberOf _ 26053 * @since 0.1.0 26054 * @category Seq 26055 * @returns {Object} Returns the new `lodash` wrapper instance. 26056 * @example 26057 * 26058 * var array = [1, 2, 3]; 26059 * 26060 * _(array).reverse().value() 26061 * // => [3, 2, 1] 26062 * 26063 * console.log(array); 26064 * // => [3, 2, 1] 26065 */ 26066 function wrapperReverse() { 26067 var value = this.__wrapped__; 26068 if (value instanceof LazyWrapper) { 26069 var wrapped = value; 26070 if (this.__actions__.length) { 26071 wrapped = new LazyWrapper(this); 26072 } 26073 wrapped = wrapped.reverse(); 26074 wrapped.__actions__.push({ 26075 'func': thru, 26076 'args': [reverse], 26077 'thisArg': undefined 26078 }); 26079 return new LodashWrapper(wrapped, this.__chain__); 26080 } 26081 return this.thru(reverse); 26082 } 26083 26084 /** 26085 * Executes the chain sequence to resolve the unwrapped value. 26086 * 26087 * @name value 26088 * @memberOf _ 26089 * @since 0.1.0 26090 * @alias toJSON, valueOf 26091 * @category Seq 26092 * @returns {*} Returns the resolved unwrapped value. 26093 * @example 26094 * 26095 * _([1, 2, 3]).value(); 26096 * // => [1, 2, 3] 26097 */ 26098 function wrapperValue() { 26099 return baseWrapperValue(this.__wrapped__, this.__actions__); 26100 } 26101 26102 /*------------------------------------------------------------------------*/ 26103 26104 /** 26105 * Creates an object composed of keys generated from the results of running 26106 * each element of `collection` thru `iteratee`. The corresponding value of 26107 * each key is the number of times the key was returned by `iteratee`. The 26108 * iteratee is invoked with one argument: (value). 26109 * 26110 * @static 26111 * @memberOf _ 26112 * @since 0.5.0 26113 * @category Collection 26114 * @param {Array|Object} collection The collection to iterate over. 26115 * @param {Function} [iteratee=_.identity] The iteratee to transform keys. 26116 * @returns {Object} Returns the composed aggregate object. 26117 * @example 26118 * 26119 * _.countBy([6.1, 4.2, 6.3], Math.floor); 26120 * // => { '4': 1, '6': 2 } 26121 * 26122 * // The `_.property` iteratee shorthand. 26123 * _.countBy(['one', 'two', 'three'], 'length'); 26124 * // => { '3': 2, '5': 1 } 26125 */ 26126 var countBy = createAggregator(function(result, value, key) { 26127 if (hasOwnProperty.call(result, key)) { 26128 ++result[key]; 26129 } else { 26130 baseAssignValue(result, key, 1); 26131 } 26132 }); 26133 26134 /** 26135 * Checks if `predicate` returns truthy for **all** elements of `collection`. 26136 * Iteration is stopped once `predicate` returns falsey. The predicate is 26137 * invoked with three arguments: (value, index|key, collection). 26138 * 26139 * **Note:** This method returns `true` for 26140 * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because 26141 * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of 26142 * elements of empty collections. 26143 * 26144 * @static 26145 * @memberOf _ 26146 * @since 0.1.0 26147 * @category Collection 26148 * @param {Array|Object} collection The collection to iterate over. 26149 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26150 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 26151 * @returns {boolean} Returns `true` if all elements pass the predicate check, 26152 * else `false`. 26153 * @example 26154 * 26155 * _.every([true, 1, null, 'yes'], Boolean); 26156 * // => false 26157 * 26158 * var users = [ 26159 * { 'user': 'barney', 'age': 36, 'active': false }, 26160 * { 'user': 'fred', 'age': 40, 'active': false } 26161 * ]; 26162 * 26163 * // The `_.matches` iteratee shorthand. 26164 * _.every(users, { 'user': 'barney', 'active': false }); 26165 * // => false 26166 * 26167 * // The `_.matchesProperty` iteratee shorthand. 26168 * _.every(users, ['active', false]); 26169 * // => true 26170 * 26171 * // The `_.property` iteratee shorthand. 26172 * _.every(users, 'active'); 26173 * // => false 26174 */ 26175 function every(collection, predicate, guard) { 26176 var func = isArray(collection) ? arrayEvery : baseEvery; 26177 if (guard && isIterateeCall(collection, predicate, guard)) { 26178 predicate = undefined; 26179 } 26180 return func(collection, getIteratee(predicate, 3)); 26181 } 26182 26183 /** 26184 * Iterates over elements of `collection`, returning an array of all elements 26185 * `predicate` returns truthy for. The predicate is invoked with three 26186 * arguments: (value, index|key, collection). 26187 * 26188 * **Note:** Unlike `_.remove`, this method returns a new array. 26189 * 26190 * @static 26191 * @memberOf _ 26192 * @since 0.1.0 26193 * @category Collection 26194 * @param {Array|Object} collection The collection to iterate over. 26195 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26196 * @returns {Array} Returns the new filtered array. 26197 * @see _.reject 26198 * @example 26199 * 26200 * var users = [ 26201 * { 'user': 'barney', 'age': 36, 'active': true }, 26202 * { 'user': 'fred', 'age': 40, 'active': false } 26203 * ]; 26204 * 26205 * _.filter(users, function(o) { return !o.active; }); 26206 * // => objects for ['fred'] 26207 * 26208 * // The `_.matches` iteratee shorthand. 26209 * _.filter(users, { 'age': 36, 'active': true }); 26210 * // => objects for ['barney'] 26211 * 26212 * // The `_.matchesProperty` iteratee shorthand. 26213 * _.filter(users, ['active', false]); 26214 * // => objects for ['fred'] 26215 * 26216 * // The `_.property` iteratee shorthand. 26217 * _.filter(users, 'active'); 26218 * // => objects for ['barney'] 26219 */ 26220 function filter(collection, predicate) { 26221 var func = isArray(collection) ? arrayFilter : baseFilter; 26222 return func(collection, getIteratee(predicate, 3)); 26223 } 26224 26225 /** 26226 * Iterates over elements of `collection`, returning the first element 26227 * `predicate` returns truthy for. The predicate is invoked with three 26228 * arguments: (value, index|key, collection). 26229 * 26230 * @static 26231 * @memberOf _ 26232 * @since 0.1.0 26233 * @category Collection 26234 * @param {Array|Object} collection The collection to inspect. 26235 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26236 * @param {number} [fromIndex=0] The index to search from. 26237 * @returns {*} Returns the matched element, else `undefined`. 26238 * @example 26239 * 26240 * var users = [ 26241 * { 'user': 'barney', 'age': 36, 'active': true }, 26242 * { 'user': 'fred', 'age': 40, 'active': false }, 26243 * { 'user': 'pebbles', 'age': 1, 'active': true } 26244 * ]; 26245 * 26246 * _.find(users, function(o) { return o.age < 40; }); 26247 * // => object for 'barney' 26248 * 26249 * // The `_.matches` iteratee shorthand. 26250 * _.find(users, { 'age': 1, 'active': true }); 26251 * // => object for 'pebbles' 26252 * 26253 * // The `_.matchesProperty` iteratee shorthand. 26254 * _.find(users, ['active', false]); 26255 * // => object for 'fred' 26256 * 26257 * // The `_.property` iteratee shorthand. 26258 * _.find(users, 'active'); 26259 * // => object for 'barney' 26260 */ 26261 var find = createFind(findIndex); 26262 26263 /** 26264 * This method is like `_.find` except that it iterates over elements of 26265 * `collection` from right to left. 26266 * 26267 * @static 26268 * @memberOf _ 26269 * @since 2.0.0 26270 * @category Collection 26271 * @param {Array|Object} collection The collection to inspect. 26272 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26273 * @param {number} [fromIndex=collection.length-1] The index to search from. 26274 * @returns {*} Returns the matched element, else `undefined`. 26275 * @example 26276 * 26277 * _.findLast([1, 2, 3, 4], function(n) { 26278 * return n % 2 == 1; 26279 * }); 26280 * // => 3 26281 */ 26282 var findLast = createFind(findLastIndex); 26283 26284 /** 26285 * Creates a flattened array of values by running each element in `collection` 26286 * thru `iteratee` and flattening the mapped results. The iteratee is invoked 26287 * with three arguments: (value, index|key, collection). 26288 * 26289 * @static 26290 * @memberOf _ 26291 * @since 4.0.0 26292 * @category Collection 26293 * @param {Array|Object} collection The collection to iterate over. 26294 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 26295 * @returns {Array} Returns the new flattened array. 26296 * @example 26297 * 26298 * function duplicate(n) { 26299 * return [n, n]; 26300 * } 26301 * 26302 * _.flatMap([1, 2], duplicate); 26303 * // => [1, 1, 2, 2] 26304 */ 26305 function flatMap(collection, iteratee) { 26306 return baseFlatten(map(collection, iteratee), 1); 26307 } 26308 26309 /** 26310 * This method is like `_.flatMap` except that it recursively flattens the 26311 * mapped results. 26312 * 26313 * @static 26314 * @memberOf _ 26315 * @since 4.7.0 26316 * @category Collection 26317 * @param {Array|Object} collection The collection to iterate over. 26318 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 26319 * @returns {Array} Returns the new flattened array. 26320 * @example 26321 * 26322 * function duplicate(n) { 26323 * return [[[n, n]]]; 26324 * } 26325 * 26326 * _.flatMapDeep([1, 2], duplicate); 26327 * // => [1, 1, 2, 2] 26328 */ 26329 function flatMapDeep(collection, iteratee) { 26330 return baseFlatten(map(collection, iteratee), INFINITY); 26331 } 26332 26333 /** 26334 * This method is like `_.flatMap` except that it recursively flattens the 26335 * mapped results up to `depth` times. 26336 * 26337 * @static 26338 * @memberOf _ 26339 * @since 4.7.0 26340 * @category Collection 26341 * @param {Array|Object} collection The collection to iterate over. 26342 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 26343 * @param {number} [depth=1] The maximum recursion depth. 26344 * @returns {Array} Returns the new flattened array. 26345 * @example 26346 * 26347 * function duplicate(n) { 26348 * return [[[n, n]]]; 26349 * } 26350 * 26351 * _.flatMapDepth([1, 2], duplicate, 2); 26352 * // => [[1, 1], [2, 2]] 26353 */ 26354 function flatMapDepth(collection, iteratee, depth) { 26355 depth = depth === undefined ? 1 : toInteger(depth); 26356 return baseFlatten(map(collection, iteratee), depth); 26357 } 26358 26359 /** 26360 * Iterates over elements of `collection` and invokes `iteratee` for each element. 26361 * The iteratee is invoked with three arguments: (value, index|key, collection). 26362 * Iteratee functions may exit iteration early by explicitly returning `false`. 26363 * 26364 * **Note:** As with other "Collections" methods, objects with a "length" 26365 * property are iterated like arrays. To avoid this behavior use `_.forIn` 26366 * or `_.forOwn` for object iteration. 26367 * 26368 * @static 26369 * @memberOf _ 26370 * @since 0.1.0 26371 * @alias each 26372 * @category Collection 26373 * @param {Array|Object} collection The collection to iterate over. 26374 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 26375 * @returns {Array|Object} Returns `collection`. 26376 * @see _.forEachRight 26377 * @example 26378 * 26379 * _.forEach([1, 2], function(value) { 26380 * console.log(value); 26381 * }); 26382 * // => Logs `1` then `2`. 26383 * 26384 * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { 26385 * console.log(key); 26386 * }); 26387 * // => Logs 'a' then 'b' (iteration order is not guaranteed). 26388 */ 26389 function forEach(collection, iteratee) { 26390 var func = isArray(collection) ? arrayEach : baseEach; 26391 return func(collection, getIteratee(iteratee, 3)); 26392 } 26393 26394 /** 26395 * This method is like `_.forEach` except that it iterates over elements of 26396 * `collection` from right to left. 26397 * 26398 * @static 26399 * @memberOf _ 26400 * @since 2.0.0 26401 * @alias eachRight 26402 * @category Collection 26403 * @param {Array|Object} collection The collection to iterate over. 26404 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 26405 * @returns {Array|Object} Returns `collection`. 26406 * @see _.forEach 26407 * @example 26408 * 26409 * _.forEachRight([1, 2], function(value) { 26410 * console.log(value); 26411 * }); 26412 * // => Logs `2` then `1`. 26413 */ 26414 function forEachRight(collection, iteratee) { 26415 var func = isArray(collection) ? arrayEachRight : baseEachRight; 26416 return func(collection, getIteratee(iteratee, 3)); 26417 } 26418 26419 /** 26420 * Creates an object composed of keys generated from the results of running 26421 * each element of `collection` thru `iteratee`. The order of grouped values 26422 * is determined by the order they occur in `collection`. The corresponding 26423 * value of each key is an array of elements responsible for generating the 26424 * key. The iteratee is invoked with one argument: (value). 26425 * 26426 * @static 26427 * @memberOf _ 26428 * @since 0.1.0 26429 * @category Collection 26430 * @param {Array|Object} collection The collection to iterate over. 26431 * @param {Function} [iteratee=_.identity] The iteratee to transform keys. 26432 * @returns {Object} Returns the composed aggregate object. 26433 * @example 26434 * 26435 * _.groupBy([6.1, 4.2, 6.3], Math.floor); 26436 * // => { '4': [4.2], '6': [6.1, 6.3] } 26437 * 26438 * // The `_.property` iteratee shorthand. 26439 * _.groupBy(['one', 'two', 'three'], 'length'); 26440 * // => { '3': ['one', 'two'], '5': ['three'] } 26441 */ 26442 var groupBy = createAggregator(function(result, value, key) { 26443 if (hasOwnProperty.call(result, key)) { 26444 result[key].push(value); 26445 } else { 26446 baseAssignValue(result, key, [value]); 26447 } 26448 }); 26449 26450 /** 26451 * Checks if `value` is in `collection`. If `collection` is a string, it's 26452 * checked for a substring of `value`, otherwise 26453 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 26454 * is used for equality comparisons. If `fromIndex` is negative, it's used as 26455 * the offset from the end of `collection`. 26456 * 26457 * @static 26458 * @memberOf _ 26459 * @since 0.1.0 26460 * @category Collection 26461 * @param {Array|Object|string} collection The collection to inspect. 26462 * @param {*} value The value to search for. 26463 * @param {number} [fromIndex=0] The index to search from. 26464 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. 26465 * @returns {boolean} Returns `true` if `value` is found, else `false`. 26466 * @example 26467 * 26468 * _.includes([1, 2, 3], 1); 26469 * // => true 26470 * 26471 * _.includes([1, 2, 3], 1, 2); 26472 * // => false 26473 * 26474 * _.includes({ 'a': 1, 'b': 2 }, 1); 26475 * // => true 26476 * 26477 * _.includes('abcd', 'bc'); 26478 * // => true 26479 */ 26480 function includes(collection, value, fromIndex, guard) { 26481 collection = isArrayLike(collection) ? collection : values(collection); 26482 fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; 26483 26484 var length = collection.length; 26485 if (fromIndex < 0) { 26486 fromIndex = nativeMax(length + fromIndex, 0); 26487 } 26488 return isString(collection) 26489 ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) 26490 : (!!length && baseIndexOf(collection, value, fromIndex) > -1); 26491 } 26492 26493 /** 26494 * Invokes the method at `path` of each element in `collection`, returning 26495 * an array of the results of each invoked method. Any additional arguments 26496 * are provided to each invoked method. If `path` is a function, it's invoked 26497 * for, and `this` bound to, each element in `collection`. 26498 * 26499 * @static 26500 * @memberOf _ 26501 * @since 4.0.0 26502 * @category Collection 26503 * @param {Array|Object} collection The collection to iterate over. 26504 * @param {Array|Function|string} path The path of the method to invoke or 26505 * the function invoked per iteration. 26506 * @param {...*} [args] The arguments to invoke each method with. 26507 * @returns {Array} Returns the array of results. 26508 * @example 26509 * 26510 * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); 26511 * // => [[1, 5, 7], [1, 2, 3]] 26512 * 26513 * _.invokeMap([123, 456], String.prototype.split, ''); 26514 * // => [['1', '2', '3'], ['4', '5', '6']] 26515 */ 26516 var invokeMap = baseRest(function(collection, path, args) { 26517 var index = -1, 26518 isFunc = typeof path == 'function', 26519 result = isArrayLike(collection) ? Array(collection.length) : []; 26520 26521 baseEach(collection, function(value) { 26522 result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); 26523 }); 26524 return result; 26525 }); 26526 26527 /** 26528 * Creates an object composed of keys generated from the results of running 26529 * each element of `collection` thru `iteratee`. The corresponding value of 26530 * each key is the last element responsible for generating the key. The 26531 * iteratee is invoked with one argument: (value). 26532 * 26533 * @static 26534 * @memberOf _ 26535 * @since 4.0.0 26536 * @category Collection 26537 * @param {Array|Object} collection The collection to iterate over. 26538 * @param {Function} [iteratee=_.identity] The iteratee to transform keys. 26539 * @returns {Object} Returns the composed aggregate object. 26540 * @example 26541 * 26542 * var array = [ 26543 * { 'dir': 'left', 'code': 97 }, 26544 * { 'dir': 'right', 'code': 100 } 26545 * ]; 26546 * 26547 * _.keyBy(array, function(o) { 26548 * return String.fromCharCode(o.code); 26549 * }); 26550 * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } 26551 * 26552 * _.keyBy(array, 'dir'); 26553 * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } 26554 */ 26555 var keyBy = createAggregator(function(result, value, key) { 26556 baseAssignValue(result, key, value); 26557 }); 26558 26559 /** 26560 * Creates an array of values by running each element in `collection` thru 26561 * `iteratee`. The iteratee is invoked with three arguments: 26562 * (value, index|key, collection). 26563 * 26564 * Many lodash methods are guarded to work as iteratees for methods like 26565 * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. 26566 * 26567 * The guarded methods are: 26568 * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, 26569 * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, 26570 * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, 26571 * `template`, `trim`, `trimEnd`, `trimStart`, and `words` 26572 * 26573 * @static 26574 * @memberOf _ 26575 * @since 0.1.0 26576 * @category Collection 26577 * @param {Array|Object} collection The collection to iterate over. 26578 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 26579 * @returns {Array} Returns the new mapped array. 26580 * @example 26581 * 26582 * function square(n) { 26583 * return n * n; 26584 * } 26585 * 26586 * _.map([4, 8], square); 26587 * // => [16, 64] 26588 * 26589 * _.map({ 'a': 4, 'b': 8 }, square); 26590 * // => [16, 64] (iteration order is not guaranteed) 26591 * 26592 * var users = [ 26593 * { 'user': 'barney' }, 26594 * { 'user': 'fred' } 26595 * ]; 26596 * 26597 * // The `_.property` iteratee shorthand. 26598 * _.map(users, 'user'); 26599 * // => ['barney', 'fred'] 26600 */ 26601 function map(collection, iteratee) { 26602 var func = isArray(collection) ? arrayMap : baseMap; 26603 return func(collection, getIteratee(iteratee, 3)); 26604 } 26605 26606 /** 26607 * This method is like `_.sortBy` except that it allows specifying the sort 26608 * orders of the iteratees to sort by. If `orders` is unspecified, all values 26609 * are sorted in ascending order. Otherwise, specify an order of "desc" for 26610 * descending or "asc" for ascending sort order of corresponding values. 26611 * 26612 * @static 26613 * @memberOf _ 26614 * @since 4.0.0 26615 * @category Collection 26616 * @param {Array|Object} collection The collection to iterate over. 26617 * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] 26618 * The iteratees to sort by. 26619 * @param {string[]} [orders] The sort orders of `iteratees`. 26620 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. 26621 * @returns {Array} Returns the new sorted array. 26622 * @example 26623 * 26624 * var users = [ 26625 * { 'user': 'fred', 'age': 48 }, 26626 * { 'user': 'barney', 'age': 34 }, 26627 * { 'user': 'fred', 'age': 40 }, 26628 * { 'user': 'barney', 'age': 36 } 26629 * ]; 26630 * 26631 * // Sort by `user` in ascending order and by `age` in descending order. 26632 * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); 26633 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] 26634 */ 26635 function orderBy(collection, iteratees, orders, guard) { 26636 if (collection == null) { 26637 return []; 26638 } 26639 if (!isArray(iteratees)) { 26640 iteratees = iteratees == null ? [] : [iteratees]; 26641 } 26642 orders = guard ? undefined : orders; 26643 if (!isArray(orders)) { 26644 orders = orders == null ? [] : [orders]; 26645 } 26646 return baseOrderBy(collection, iteratees, orders); 26647 } 26648 26649 /** 26650 * Creates an array of elements split into two groups, the first of which 26651 * contains elements `predicate` returns truthy for, the second of which 26652 * contains elements `predicate` returns falsey for. The predicate is 26653 * invoked with one argument: (value). 26654 * 26655 * @static 26656 * @memberOf _ 26657 * @since 3.0.0 26658 * @category Collection 26659 * @param {Array|Object} collection The collection to iterate over. 26660 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26661 * @returns {Array} Returns the array of grouped elements. 26662 * @example 26663 * 26664 * var users = [ 26665 * { 'user': 'barney', 'age': 36, 'active': false }, 26666 * { 'user': 'fred', 'age': 40, 'active': true }, 26667 * { 'user': 'pebbles', 'age': 1, 'active': false } 26668 * ]; 26669 * 26670 * _.partition(users, function(o) { return o.active; }); 26671 * // => objects for [['fred'], ['barney', 'pebbles']] 26672 * 26673 * // The `_.matches` iteratee shorthand. 26674 * _.partition(users, { 'age': 1, 'active': false }); 26675 * // => objects for [['pebbles'], ['barney', 'fred']] 26676 * 26677 * // The `_.matchesProperty` iteratee shorthand. 26678 * _.partition(users, ['active', false]); 26679 * // => objects for [['barney', 'pebbles'], ['fred']] 26680 * 26681 * // The `_.property` iteratee shorthand. 26682 * _.partition(users, 'active'); 26683 * // => objects for [['fred'], ['barney', 'pebbles']] 26684 */ 26685 var partition = createAggregator(function(result, value, key) { 26686 result[key ? 0 : 1].push(value); 26687 }, function() { return [[], []]; }); 26688 26689 /** 26690 * Reduces `collection` to a value which is the accumulated result of running 26691 * each element in `collection` thru `iteratee`, where each successive 26692 * invocation is supplied the return value of the previous. If `accumulator` 26693 * is not given, the first element of `collection` is used as the initial 26694 * value. The iteratee is invoked with four arguments: 26695 * (accumulator, value, index|key, collection). 26696 * 26697 * Many lodash methods are guarded to work as iteratees for methods like 26698 * `_.reduce`, `_.reduceRight`, and `_.transform`. 26699 * 26700 * The guarded methods are: 26701 * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, 26702 * and `sortBy` 26703 * 26704 * @static 26705 * @memberOf _ 26706 * @since 0.1.0 26707 * @category Collection 26708 * @param {Array|Object} collection The collection to iterate over. 26709 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 26710 * @param {*} [accumulator] The initial value. 26711 * @returns {*} Returns the accumulated value. 26712 * @see _.reduceRight 26713 * @example 26714 * 26715 * _.reduce([1, 2], function(sum, n) { 26716 * return sum + n; 26717 * }, 0); 26718 * // => 3 26719 * 26720 * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { 26721 * (result[value] || (result[value] = [])).push(key); 26722 * return result; 26723 * }, {}); 26724 * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) 26725 */ 26726 function reduce(collection, iteratee, accumulator) { 26727 var func = isArray(collection) ? arrayReduce : baseReduce, 26728 initAccum = arguments.length < 3; 26729 26730 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach); 26731 } 26732 26733 /** 26734 * This method is like `_.reduce` except that it iterates over elements of 26735 * `collection` from right to left. 26736 * 26737 * @static 26738 * @memberOf _ 26739 * @since 0.1.0 26740 * @category Collection 26741 * @param {Array|Object} collection The collection to iterate over. 26742 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 26743 * @param {*} [accumulator] The initial value. 26744 * @returns {*} Returns the accumulated value. 26745 * @see _.reduce 26746 * @example 26747 * 26748 * var array = [[0, 1], [2, 3], [4, 5]]; 26749 * 26750 * _.reduceRight(array, function(flattened, other) { 26751 * return flattened.concat(other); 26752 * }, []); 26753 * // => [4, 5, 2, 3, 0, 1] 26754 */ 26755 function reduceRight(collection, iteratee, accumulator) { 26756 var func = isArray(collection) ? arrayReduceRight : baseReduce, 26757 initAccum = arguments.length < 3; 26758 26759 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); 26760 } 26761 26762 /** 26763 * The opposite of `_.filter`; this method returns the elements of `collection` 26764 * that `predicate` does **not** return truthy for. 26765 * 26766 * @static 26767 * @memberOf _ 26768 * @since 0.1.0 26769 * @category Collection 26770 * @param {Array|Object} collection The collection to iterate over. 26771 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26772 * @returns {Array} Returns the new filtered array. 26773 * @see _.filter 26774 * @example 26775 * 26776 * var users = [ 26777 * { 'user': 'barney', 'age': 36, 'active': false }, 26778 * { 'user': 'fred', 'age': 40, 'active': true } 26779 * ]; 26780 * 26781 * _.reject(users, function(o) { return !o.active; }); 26782 * // => objects for ['fred'] 26783 * 26784 * // The `_.matches` iteratee shorthand. 26785 * _.reject(users, { 'age': 40, 'active': true }); 26786 * // => objects for ['barney'] 26787 * 26788 * // The `_.matchesProperty` iteratee shorthand. 26789 * _.reject(users, ['active', false]); 26790 * // => objects for ['fred'] 26791 * 26792 * // The `_.property` iteratee shorthand. 26793 * _.reject(users, 'active'); 26794 * // => objects for ['barney'] 26795 */ 26796 function reject(collection, predicate) { 26797 var func = isArray(collection) ? arrayFilter : baseFilter; 26798 return func(collection, negate(getIteratee(predicate, 3))); 26799 } 26800 26801 /** 26802 * Gets a random element from `collection`. 26803 * 26804 * @static 26805 * @memberOf _ 26806 * @since 2.0.0 26807 * @category Collection 26808 * @param {Array|Object} collection The collection to sample. 26809 * @returns {*} Returns the random element. 26810 * @example 26811 * 26812 * _.sample([1, 2, 3, 4]); 26813 * // => 2 26814 */ 26815 function sample(collection) { 26816 var func = isArray(collection) ? arraySample : baseSample; 26817 return func(collection); 26818 } 26819 26820 /** 26821 * Gets `n` random elements at unique keys from `collection` up to the 26822 * size of `collection`. 26823 * 26824 * @static 26825 * @memberOf _ 26826 * @since 4.0.0 26827 * @category Collection 26828 * @param {Array|Object} collection The collection to sample. 26829 * @param {number} [n=1] The number of elements to sample. 26830 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 26831 * @returns {Array} Returns the random elements. 26832 * @example 26833 * 26834 * _.sampleSize([1, 2, 3], 2); 26835 * // => [3, 1] 26836 * 26837 * _.sampleSize([1, 2, 3], 4); 26838 * // => [2, 3, 1] 26839 */ 26840 function sampleSize(collection, n, guard) { 26841 if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { 26842 n = 1; 26843 } else { 26844 n = toInteger(n); 26845 } 26846 var func = isArray(collection) ? arraySampleSize : baseSampleSize; 26847 return func(collection, n); 26848 } 26849 26850 /** 26851 * Creates an array of shuffled values, using a version of the 26852 * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). 26853 * 26854 * @static 26855 * @memberOf _ 26856 * @since 0.1.0 26857 * @category Collection 26858 * @param {Array|Object} collection The collection to shuffle. 26859 * @returns {Array} Returns the new shuffled array. 26860 * @example 26861 * 26862 * _.shuffle([1, 2, 3, 4]); 26863 * // => [4, 1, 3, 2] 26864 */ 26865 function shuffle(collection) { 26866 var func = isArray(collection) ? arrayShuffle : baseShuffle; 26867 return func(collection); 26868 } 26869 26870 /** 26871 * Gets the size of `collection` by returning its length for array-like 26872 * values or the number of own enumerable string keyed properties for objects. 26873 * 26874 * @static 26875 * @memberOf _ 26876 * @since 0.1.0 26877 * @category Collection 26878 * @param {Array|Object|string} collection The collection to inspect. 26879 * @returns {number} Returns the collection size. 26880 * @example 26881 * 26882 * _.size([1, 2, 3]); 26883 * // => 3 26884 * 26885 * _.size({ 'a': 1, 'b': 2 }); 26886 * // => 2 26887 * 26888 * _.size('pebbles'); 26889 * // => 7 26890 */ 26891 function size(collection) { 26892 if (collection == null) { 26893 return 0; 26894 } 26895 if (isArrayLike(collection)) { 26896 return isString(collection) ? stringSize(collection) : collection.length; 26897 } 26898 var tag = getTag(collection); 26899 if (tag == mapTag || tag == setTag) { 26900 return collection.size; 26901 } 26902 return baseKeys(collection).length; 26903 } 26904 26905 /** 26906 * Checks if `predicate` returns truthy for **any** element of `collection`. 26907 * Iteration is stopped once `predicate` returns truthy. The predicate is 26908 * invoked with three arguments: (value, index|key, collection). 26909 * 26910 * @static 26911 * @memberOf _ 26912 * @since 0.1.0 26913 * @category Collection 26914 * @param {Array|Object} collection The collection to iterate over. 26915 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26916 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 26917 * @returns {boolean} Returns `true` if any element passes the predicate check, 26918 * else `false`. 26919 * @example 26920 * 26921 * _.some([null, 0, 'yes', false], Boolean); 26922 * // => true 26923 * 26924 * var users = [ 26925 * { 'user': 'barney', 'active': true }, 26926 * { 'user': 'fred', 'active': false } 26927 * ]; 26928 * 26929 * // The `_.matches` iteratee shorthand. 26930 * _.some(users, { 'user': 'barney', 'active': false }); 26931 * // => false 26932 * 26933 * // The `_.matchesProperty` iteratee shorthand. 26934 * _.some(users, ['active', false]); 26935 * // => true 26936 * 26937 * // The `_.property` iteratee shorthand. 26938 * _.some(users, 'active'); 26939 * // => true 26940 */ 26941 function some(collection, predicate, guard) { 26942 var func = isArray(collection) ? arraySome : baseSome; 26943 if (guard && isIterateeCall(collection, predicate, guard)) { 26944 predicate = undefined; 26945 } 26946 return func(collection, getIteratee(predicate, 3)); 26947 } 26948 26949 /** 26950 * Creates an array of elements, sorted in ascending order by the results of 26951 * running each element in a collection thru each iteratee. This method 26952 * performs a stable sort, that is, it preserves the original sort order of 26953 * equal elements. The iteratees are invoked with one argument: (value). 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|Function[])} [iteratees=[_.identity]] 26961 * The iteratees to sort by. 26962 * @returns {Array} Returns the new sorted array. 26963 * @example 26964 * 26965 * var users = [ 26966 * { 'user': 'fred', 'age': 48 }, 26967 * { 'user': 'barney', 'age': 36 }, 26968 * { 'user': 'fred', 'age': 40 }, 26969 * { 'user': 'barney', 'age': 34 } 26970 * ]; 26971 * 26972 * _.sortBy(users, [function(o) { return o.user; }]); 26973 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] 26974 * 26975 * _.sortBy(users, ['user', 'age']); 26976 * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] 26977 */ 26978 var sortBy = baseRest(function(collection, iteratees) { 26979 if (collection == null) { 26980 return []; 26981 } 26982 var length = iteratees.length; 26983 if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { 26984 iteratees = []; 26985 } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { 26986 iteratees = [iteratees[0]]; 26987 } 26988 return baseOrderBy(collection, baseFlatten(iteratees, 1), []); 26989 }); 26990 26991 /*------------------------------------------------------------------------*/ 26992 26993 /** 26994 * Gets the timestamp of the number of milliseconds that have elapsed since 26995 * the Unix epoch (1 January 1970 00:00:00 UTC). 26996 * 26997 * @static 26998 * @memberOf _ 26999 * @since 2.4.0 27000 * @category Date 27001 * @returns {number} Returns the timestamp. 27002 * @example 27003 * 27004 * _.defer(function(stamp) { 27005 * console.log(_.now() - stamp); 27006 * }, _.now()); 27007 * // => Logs the number of milliseconds it took for the deferred invocation. 27008 */ 27009 var now = ctxNow || function() { 27010 return root.Date.now(); 27011 }; 27012 27013 /*------------------------------------------------------------------------*/ 27014 27015 /** 27016 * The opposite of `_.before`; this method creates a function that invokes 27017 * `func` once it's called `n` or more times. 27018 * 27019 * @static 27020 * @memberOf _ 27021 * @since 0.1.0 27022 * @category Function 27023 * @param {number} n The number of calls before `func` is invoked. 27024 * @param {Function} func The function to restrict. 27025 * @returns {Function} Returns the new restricted function. 27026 * @example 27027 * 27028 * var saves = ['profile', 'settings']; 27029 * 27030 * var done = _.after(saves.length, function() { 27031 * console.log('done saving!'); 27032 * }); 27033 * 27034 * _.forEach(saves, function(type) { 27035 * asyncSave({ 'type': type, 'complete': done }); 27036 * }); 27037 * // => Logs 'done saving!' after the two async saves have completed. 27038 */ 27039 function after(n, func) { 27040 if (typeof func != 'function') { 27041 throw new TypeError(FUNC_ERROR_TEXT); 27042 } 27043 n = toInteger(n); 27044 return function() { 27045 if (--n < 1) { 27046 return func.apply(this, arguments); 27047 } 27048 }; 27049 } 27050 27051 /** 27052 * Creates a function that invokes `func`, with up to `n` arguments, 27053 * ignoring any additional arguments. 27054 * 27055 * @static 27056 * @memberOf _ 27057 * @since 3.0.0 27058 * @category Function 27059 * @param {Function} func The function to cap arguments for. 27060 * @param {number} [n=func.length] The arity cap. 27061 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 27062 * @returns {Function} Returns the new capped function. 27063 * @example 27064 * 27065 * _.map(['6', '8', '10'], _.ary(parseInt, 1)); 27066 * // => [6, 8, 10] 27067 */ 27068 function ary(func, n, guard) { 27069 n = guard ? undefined : n; 27070 n = (func && n == null) ? func.length : n; 27071 return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n); 27072 } 27073 27074 /** 27075 * Creates a function that invokes `func`, with the `this` binding and arguments 27076 * of the created function, while it's called less than `n` times. Subsequent 27077 * calls to the created function return the result of the last `func` invocation. 27078 * 27079 * @static 27080 * @memberOf _ 27081 * @since 3.0.0 27082 * @category Function 27083 * @param {number} n The number of calls at which `func` is no longer invoked. 27084 * @param {Function} func The function to restrict. 27085 * @returns {Function} Returns the new restricted function. 27086 * @example 27087 * 27088 * jQuery(element).on('click', _.before(5, addContactToList)); 27089 * // => Allows adding up to 4 contacts to the list. 27090 */ 27091 function before(n, func) { 27092 var result; 27093 if (typeof func != 'function') { 27094 throw new TypeError(FUNC_ERROR_TEXT); 27095 } 27096 n = toInteger(n); 27097 return function() { 27098 if (--n > 0) { 27099 result = func.apply(this, arguments); 27100 } 27101 if (n <= 1) { 27102 func = undefined; 27103 } 27104 return result; 27105 }; 27106 } 27107 27108 /** 27109 * Creates a function that invokes `func` with the `this` binding of `thisArg` 27110 * and `partials` prepended to the arguments it receives. 27111 * 27112 * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, 27113 * may be used as a placeholder for partially applied arguments. 27114 * 27115 * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" 27116 * property of bound functions. 27117 * 27118 * @static 27119 * @memberOf _ 27120 * @since 0.1.0 27121 * @category Function 27122 * @param {Function} func The function to bind. 27123 * @param {*} thisArg The `this` binding of `func`. 27124 * @param {...*} [partials] The arguments to be partially applied. 27125 * @returns {Function} Returns the new bound function. 27126 * @example 27127 * 27128 * function greet(greeting, punctuation) { 27129 * return greeting + ' ' + this.user + punctuation; 27130 * } 27131 * 27132 * var object = { 'user': 'fred' }; 27133 * 27134 * var bound = _.bind(greet, object, 'hi'); 27135 * bound('!'); 27136 * // => 'hi fred!' 27137 * 27138 * // Bound with placeholders. 27139 * var bound = _.bind(greet, object, _, '!'); 27140 * bound('hi'); 27141 * // => 'hi fred!' 27142 */ 27143 var bind = baseRest(function(func, thisArg, partials) { 27144 var bitmask = WRAP_BIND_FLAG; 27145 if (partials.length) { 27146 var holders = replaceHolders(partials, getHolder(bind)); 27147 bitmask |= WRAP_PARTIAL_FLAG; 27148 } 27149 return createWrap(func, bitmask, thisArg, partials, holders); 27150 }); 27151 27152 /** 27153 * Creates a function that invokes the method at `object[key]` with `partials` 27154 * prepended to the arguments it receives. 27155 * 27156 * This method differs from `_.bind` by allowing bound functions to reference 27157 * methods that may be redefined or don't yet exist. See 27158 * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) 27159 * for more details. 27160 * 27161 * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic 27162 * builds, may be used as a placeholder for partially applied arguments. 27163 * 27164 * @static 27165 * @memberOf _ 27166 * @since 0.10.0 27167 * @category Function 27168 * @param {Object} object The object to invoke the method on. 27169 * @param {string} key The key of the method. 27170 * @param {...*} [partials] The arguments to be partially applied. 27171 * @returns {Function} Returns the new bound function. 27172 * @example 27173 * 27174 * var object = { 27175 * 'user': 'fred', 27176 * 'greet': function(greeting, punctuation) { 27177 * return greeting + ' ' + this.user + punctuation; 27178 * } 27179 * }; 27180 * 27181 * var bound = _.bindKey(object, 'greet', 'hi'); 27182 * bound('!'); 27183 * // => 'hi fred!' 27184 * 27185 * object.greet = function(greeting, punctuation) { 27186 * return greeting + 'ya ' + this.user + punctuation; 27187 * }; 27188 * 27189 * bound('!'); 27190 * // => 'hiya fred!' 27191 * 27192 * // Bound with placeholders. 27193 * var bound = _.bindKey(object, 'greet', _, '!'); 27194 * bound('hi'); 27195 * // => 'hiya fred!' 27196 */ 27197 var bindKey = baseRest(function(object, key, partials) { 27198 var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; 27199 if (partials.length) { 27200 var holders = replaceHolders(partials, getHolder(bindKey)); 27201 bitmask |= WRAP_PARTIAL_FLAG; 27202 } 27203 return createWrap(key, bitmask, object, partials, holders); 27204 }); 27205 27206 /** 27207 * Creates a function that accepts arguments of `func` and either invokes 27208 * `func` returning its result, if at least `arity` number of arguments have 27209 * been provided, or returns a function that accepts the remaining `func` 27210 * arguments, and so on. The arity of `func` may be specified if `func.length` 27211 * is not sufficient. 27212 * 27213 * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, 27214 * may be used as a placeholder for provided arguments. 27215 * 27216 * **Note:** This method doesn't set the "length" property of curried functions. 27217 * 27218 * @static 27219 * @memberOf _ 27220 * @since 2.0.0 27221 * @category Function 27222 * @param {Function} func The function to curry. 27223 * @param {number} [arity=func.length] The arity of `func`. 27224 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 27225 * @returns {Function} Returns the new curried function. 27226 * @example 27227 * 27228 * var abc = function(a, b, c) { 27229 * return [a, b, c]; 27230 * }; 27231 * 27232 * var curried = _.curry(abc); 27233 * 27234 * curried(1)(2)(3); 27235 * // => [1, 2, 3] 27236 * 27237 * curried(1, 2)(3); 27238 * // => [1, 2, 3] 27239 * 27240 * curried(1, 2, 3); 27241 * // => [1, 2, 3] 27242 * 27243 * // Curried with placeholders. 27244 * curried(1)(_, 3)(2); 27245 * // => [1, 2, 3] 27246 */ 27247 function curry(func, arity, guard) { 27248 arity = guard ? undefined : arity; 27249 var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); 27250 result.placeholder = curry.placeholder; 27251 return result; 27252 } 27253 27254 /** 27255 * This method is like `_.curry` except that arguments are applied to `func` 27256 * in the manner of `_.partialRight` instead of `_.partial`. 27257 * 27258 * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic 27259 * builds, may be used as a placeholder for provided arguments. 27260 * 27261 * **Note:** This method doesn't set the "length" property of curried functions. 27262 * 27263 * @static 27264 * @memberOf _ 27265 * @since 3.0.0 27266 * @category Function 27267 * @param {Function} func The function to curry. 27268 * @param {number} [arity=func.length] The arity of `func`. 27269 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 27270 * @returns {Function} Returns the new curried function. 27271 * @example 27272 * 27273 * var abc = function(a, b, c) { 27274 * return [a, b, c]; 27275 * }; 27276 * 27277 * var curried = _.curryRight(abc); 27278 * 27279 * curried(3)(2)(1); 27280 * // => [1, 2, 3] 27281 * 27282 * curried(2, 3)(1); 27283 * // => [1, 2, 3] 27284 * 27285 * curried(1, 2, 3); 27286 * // => [1, 2, 3] 27287 * 27288 * // Curried with placeholders. 27289 * curried(3)(1, _)(2); 27290 * // => [1, 2, 3] 27291 */ 27292 function curryRight(func, arity, guard) { 27293 arity = guard ? undefined : arity; 27294 var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); 27295 result.placeholder = curryRight.placeholder; 27296 return result; 27297 } 27298 27299 /** 27300 * Creates a debounced function that delays invoking `func` until after `wait` 27301 * milliseconds have elapsed since the last time the debounced function was 27302 * invoked. The debounced function comes with a `cancel` method to cancel 27303 * delayed `func` invocations and a `flush` method to immediately invoke them. 27304 * Provide `options` to indicate whether `func` should be invoked on the 27305 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked 27306 * with the last arguments provided to the debounced function. Subsequent 27307 * calls to the debounced function return the result of the last `func` 27308 * invocation. 27309 * 27310 * **Note:** If `leading` and `trailing` options are `true`, `func` is 27311 * invoked on the trailing edge of the timeout only if the debounced function 27312 * is invoked more than once during the `wait` timeout. 27313 * 27314 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 27315 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 27316 * 27317 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 27318 * for details over the differences between `_.debounce` and `_.throttle`. 27319 * 27320 * @static 27321 * @memberOf _ 27322 * @since 0.1.0 27323 * @category Function 27324 * @param {Function} func The function to debounce. 27325 * @param {number} [wait=0] The number of milliseconds to delay. 27326 * @param {Object} [options={}] The options object. 27327 * @param {boolean} [options.leading=false] 27328 * Specify invoking on the leading edge of the timeout. 27329 * @param {number} [options.maxWait] 27330 * The maximum time `func` is allowed to be delayed before it's invoked. 27331 * @param {boolean} [options.trailing=true] 27332 * Specify invoking on the trailing edge of the timeout. 27333 * @returns {Function} Returns the new debounced function. 27334 * @example 27335 * 27336 * // Avoid costly calculations while the window size is in flux. 27337 * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); 27338 * 27339 * // Invoke `sendMail` when clicked, debouncing subsequent calls. 27340 * jQuery(element).on('click', _.debounce(sendMail, 300, { 27341 * 'leading': true, 27342 * 'trailing': false 27343 * })); 27344 * 27345 * // Ensure `batchLog` is invoked once after 1 second of debounced calls. 27346 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); 27347 * var source = new EventSource('/stream'); 27348 * jQuery(source).on('message', debounced); 27349 * 27350 * // Cancel the trailing debounced invocation. 27351 * jQuery(window).on('popstate', debounced.cancel); 27352 */ 27353 function debounce(func, wait, options) { 27354 var lastArgs, 27355 lastThis, 27356 maxWait, 27357 result, 27358 timerId, 27359 lastCallTime, 27360 lastInvokeTime = 0, 27361 leading = false, 27362 maxing = false, 27363 trailing = true; 27364 27365 if (typeof func != 'function') { 27366 throw new TypeError(FUNC_ERROR_TEXT); 27367 } 27368 wait = toNumber(wait) || 0; 27369 if (isObject(options)) { 27370 leading = !!options.leading; 27371 maxing = 'maxWait' in options; 27372 maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; 27373 trailing = 'trailing' in options ? !!options.trailing : trailing; 27374 } 27375 27376 function invokeFunc(time) { 27377 var args = lastArgs, 27378 thisArg = lastThis; 27379 27380 lastArgs = lastThis = undefined; 27381 lastInvokeTime = time; 27382 result = func.apply(thisArg, args); 27383 return result; 27384 } 27385 27386 function leadingEdge(time) { 27387 // Reset any `maxWait` timer. 27388 lastInvokeTime = time; 27389 // Start the timer for the trailing edge. 27390 timerId = setTimeout(timerExpired, wait); 27391 // Invoke the leading edge. 27392 return leading ? invokeFunc(time) : result; 27393 } 27394 27395 function remainingWait(time) { 27396 var timeSinceLastCall = time - lastCallTime, 27397 timeSinceLastInvoke = time - lastInvokeTime, 27398 timeWaiting = wait - timeSinceLastCall; 27399 27400 return maxing 27401 ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) 27402 : timeWaiting; 27403 } 27404 27405 function shouldInvoke(time) { 27406 var timeSinceLastCall = time - lastCallTime, 27407 timeSinceLastInvoke = time - lastInvokeTime; 27408 27409 // Either this is the first call, activity has stopped and we're at the 27410 // trailing edge, the system time has gone backwards and we're treating 27411 // it as the trailing edge, or we've hit the `maxWait` limit. 27412 return (lastCallTime === undefined || (timeSinceLastCall >= wait) || 27413 (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); 27414 } 27415 27416 function timerExpired() { 27417 var time = now(); 27418 if (shouldInvoke(time)) { 27419 return trailingEdge(time); 27420 } 27421 // Restart the timer. 27422 timerId = setTimeout(timerExpired, remainingWait(time)); 27423 } 27424 27425 function trailingEdge(time) { 27426 timerId = undefined; 27427 27428 // Only invoke if we have `lastArgs` which means `func` has been 27429 // debounced at least once. 27430 if (trailing && lastArgs) { 27431 return invokeFunc(time); 27432 } 27433 lastArgs = lastThis = undefined; 27434 return result; 27435 } 27436 27437 function cancel() { 27438 if (timerId !== undefined) { 27439 clearTimeout(timerId); 27440 } 27441 lastInvokeTime = 0; 27442 lastArgs = lastCallTime = lastThis = timerId = undefined; 27443 } 27444 27445 function flush() { 27446 return timerId === undefined ? result : trailingEdge(now()); 27447 } 27448 27449 function debounced() { 27450 var time = now(), 27451 isInvoking = shouldInvoke(time); 27452 27453 lastArgs = arguments; 27454 lastThis = this; 27455 lastCallTime = time; 27456 27457 if (isInvoking) { 27458 if (timerId === undefined) { 27459 return leadingEdge(lastCallTime); 27460 } 27461 if (maxing) { 27462 // Handle invocations in a tight loop. 27463 clearTimeout(timerId); 27464 timerId = setTimeout(timerExpired, wait); 27465 return invokeFunc(lastCallTime); 27466 } 27467 } 27468 if (timerId === undefined) { 27469 timerId = setTimeout(timerExpired, wait); 27470 } 27471 return result; 27472 } 27473 debounced.cancel = cancel; 27474 debounced.flush = flush; 27475 return debounced; 27476 } 27477 27478 /** 27479 * Defers invoking the `func` until the current call stack has cleared. Any 27480 * additional arguments are provided to `func` when it's invoked. 27481 * 27482 * @static 27483 * @memberOf _ 27484 * @since 0.1.0 27485 * @category Function 27486 * @param {Function} func The function to defer. 27487 * @param {...*} [args] The arguments to invoke `func` with. 27488 * @returns {number} Returns the timer id. 27489 * @example 27490 * 27491 * _.defer(function(text) { 27492 * console.log(text); 27493 * }, 'deferred'); 27494 * // => Logs 'deferred' after one millisecond. 27495 */ 27496 var defer = baseRest(function(func, args) { 27497 return baseDelay(func, 1, args); 27498 }); 27499 27500 /** 27501 * Invokes `func` after `wait` milliseconds. Any additional arguments are 27502 * provided to `func` when it's invoked. 27503 * 27504 * @static 27505 * @memberOf _ 27506 * @since 0.1.0 27507 * @category Function 27508 * @param {Function} func The function to delay. 27509 * @param {number} wait The number of milliseconds to delay invocation. 27510 * @param {...*} [args] The arguments to invoke `func` with. 27511 * @returns {number} Returns the timer id. 27512 * @example 27513 * 27514 * _.delay(function(text) { 27515 * console.log(text); 27516 * }, 1000, 'later'); 27517 * // => Logs 'later' after one second. 27518 */ 27519 var delay = baseRest(function(func, wait, args) { 27520 return baseDelay(func, toNumber(wait) || 0, args); 27521 }); 27522 27523 /** 27524 * Creates a function that invokes `func` with arguments reversed. 27525 * 27526 * @static 27527 * @memberOf _ 27528 * @since 4.0.0 27529 * @category Function 27530 * @param {Function} func The function to flip arguments for. 27531 * @returns {Function} Returns the new flipped function. 27532 * @example 27533 * 27534 * var flipped = _.flip(function() { 27535 * return _.toArray(arguments); 27536 * }); 27537 * 27538 * flipped('a', 'b', 'c', 'd'); 27539 * // => ['d', 'c', 'b', 'a'] 27540 */ 27541 function flip(func) { 27542 return createWrap(func, WRAP_FLIP_FLAG); 27543 } 27544 27545 /** 27546 * Creates a function that memoizes the result of `func`. If `resolver` is 27547 * provided, it determines the cache key for storing the result based on the 27548 * arguments provided to the memoized function. By default, the first argument 27549 * provided to the memoized function is used as the map cache key. The `func` 27550 * is invoked with the `this` binding of the memoized function. 27551 * 27552 * **Note:** The cache is exposed as the `cache` property on the memoized 27553 * function. Its creation may be customized by replacing the `_.memoize.Cache` 27554 * constructor with one whose instances implement the 27555 * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) 27556 * method interface of `clear`, `delete`, `get`, `has`, and `set`. 27557 * 27558 * @static 27559 * @memberOf _ 27560 * @since 0.1.0 27561 * @category Function 27562 * @param {Function} func The function to have its output memoized. 27563 * @param {Function} [resolver] The function to resolve the cache key. 27564 * @returns {Function} Returns the new memoized function. 27565 * @example 27566 * 27567 * var object = { 'a': 1, 'b': 2 }; 27568 * var other = { 'c': 3, 'd': 4 }; 27569 * 27570 * var values = _.memoize(_.values); 27571 * values(object); 27572 * // => [1, 2] 27573 * 27574 * values(other); 27575 * // => [3, 4] 27576 * 27577 * object.a = 2; 27578 * values(object); 27579 * // => [1, 2] 27580 * 27581 * // Modify the result cache. 27582 * values.cache.set(object, ['a', 'b']); 27583 * values(object); 27584 * // => ['a', 'b'] 27585 * 27586 * // Replace `_.memoize.Cache`. 27587 * _.memoize.Cache = WeakMap; 27588 */ 27589 function memoize(func, resolver) { 27590 if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { 27591 throw new TypeError(FUNC_ERROR_TEXT); 27592 } 27593 var memoized = function() { 27594 var args = arguments, 27595 key = resolver ? resolver.apply(this, args) : args[0], 27596 cache = memoized.cache; 27597 27598 if (cache.has(key)) { 27599 return cache.get(key); 27600 } 27601 var result = func.apply(this, args); 27602 memoized.cache = cache.set(key, result) || cache; 27603 return result; 27604 }; 27605 memoized.cache = new (memoize.Cache || MapCache); 27606 return memoized; 27607 } 27608 27609 // Expose `MapCache`. 27610 memoize.Cache = MapCache; 27611 27612 /** 27613 * Creates a function that negates the result of the predicate `func`. The 27614 * `func` predicate is invoked with the `this` binding and arguments of the 27615 * created function. 27616 * 27617 * @static 27618 * @memberOf _ 27619 * @since 3.0.0 27620 * @category Function 27621 * @param {Function} predicate The predicate to negate. 27622 * @returns {Function} Returns the new negated function. 27623 * @example 27624 * 27625 * function isEven(n) { 27626 * return n % 2 == 0; 27627 * } 27628 * 27629 * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); 27630 * // => [1, 3, 5] 27631 */ 27632 function negate(predicate) { 27633 if (typeof predicate != 'function') { 27634 throw new TypeError(FUNC_ERROR_TEXT); 27635 } 27636 return function() { 27637 var args = arguments; 27638 switch (args.length) { 27639 case 0: return !predicate.call(this); 27640 case 1: return !predicate.call(this, args[0]); 27641 case 2: return !predicate.call(this, args[0], args[1]); 27642 case 3: return !predicate.call(this, args[0], args[1], args[2]); 27643 } 27644 return !predicate.apply(this, args); 27645 }; 27646 } 27647 27648 /** 27649 * Creates a function that is restricted to invoking `func` once. Repeat calls 27650 * to the function return the value of the first invocation. The `func` is 27651 * invoked with the `this` binding and arguments of the created function. 27652 * 27653 * @static 27654 * @memberOf _ 27655 * @since 0.1.0 27656 * @category Function 27657 * @param {Function} func The function to restrict. 27658 * @returns {Function} Returns the new restricted function. 27659 * @example 27660 * 27661 * var initialize = _.once(createApplication); 27662 * initialize(); 27663 * initialize(); 27664 * // => `createApplication` is invoked once 27665 */ 27666 function once(func) { 27667 return before(2, func); 27668 } 27669 27670 /** 27671 * Creates a function that invokes `func` with its arguments transformed. 27672 * 27673 * @static 27674 * @since 4.0.0 27675 * @memberOf _ 27676 * @category Function 27677 * @param {Function} func The function to wrap. 27678 * @param {...(Function|Function[])} [transforms=[_.identity]] 27679 * The argument transforms. 27680 * @returns {Function} Returns the new function. 27681 * @example 27682 * 27683 * function doubled(n) { 27684 * return n * 2; 27685 * } 27686 * 27687 * function square(n) { 27688 * return n * n; 27689 * } 27690 * 27691 * var func = _.overArgs(function(x, y) { 27692 * return [x, y]; 27693 * }, [square, doubled]); 27694 * 27695 * func(9, 3); 27696 * // => [81, 6] 27697 * 27698 * func(10, 5); 27699 * // => [100, 10] 27700 */ 27701 var overArgs = castRest(function(func, transforms) { 27702 transforms = (transforms.length == 1 && isArray(transforms[0])) 27703 ? arrayMap(transforms[0], baseUnary(getIteratee())) 27704 : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); 27705 27706 var funcsLength = transforms.length; 27707 return baseRest(function(args) { 27708 var index = -1, 27709 length = nativeMin(args.length, funcsLength); 27710 27711 while (++index < length) { 27712 args[index] = transforms[index].call(this, args[index]); 27713 } 27714 return apply(func, this, args); 27715 }); 27716 }); 27717 27718 /** 27719 * Creates a function that invokes `func` with `partials` prepended to the 27720 * arguments it receives. This method is like `_.bind` except it does **not** 27721 * alter the `this` binding. 27722 * 27723 * The `_.partial.placeholder` value, which defaults to `_` in monolithic 27724 * builds, may be used as a placeholder for partially applied arguments. 27725 * 27726 * **Note:** This method doesn't set the "length" property of partially 27727 * applied functions. 27728 * 27729 * @static 27730 * @memberOf _ 27731 * @since 0.2.0 27732 * @category Function 27733 * @param {Function} func The function to partially apply arguments to. 27734 * @param {...*} [partials] The arguments to be partially applied. 27735 * @returns {Function} Returns the new partially applied function. 27736 * @example 27737 * 27738 * function greet(greeting, name) { 27739 * return greeting + ' ' + name; 27740 * } 27741 * 27742 * var sayHelloTo = _.partial(greet, 'hello'); 27743 * sayHelloTo('fred'); 27744 * // => 'hello fred' 27745 * 27746 * // Partially applied with placeholders. 27747 * var greetFred = _.partial(greet, _, 'fred'); 27748 * greetFred('hi'); 27749 * // => 'hi fred' 27750 */ 27751 var partial = baseRest(function(func, partials) { 27752 var holders = replaceHolders(partials, getHolder(partial)); 27753 return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders); 27754 }); 27755 27756 /** 27757 * This method is like `_.partial` except that partially applied arguments 27758 * are appended to the arguments it receives. 27759 * 27760 * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic 27761 * builds, may be used as a placeholder for partially applied arguments. 27762 * 27763 * **Note:** This method doesn't set the "length" property of partially 27764 * applied functions. 27765 * 27766 * @static 27767 * @memberOf _ 27768 * @since 1.0.0 27769 * @category Function 27770 * @param {Function} func The function to partially apply arguments to. 27771 * @param {...*} [partials] The arguments to be partially applied. 27772 * @returns {Function} Returns the new partially applied function. 27773 * @example 27774 * 27775 * function greet(greeting, name) { 27776 * return greeting + ' ' + name; 27777 * } 27778 * 27779 * var greetFred = _.partialRight(greet, 'fred'); 27780 * greetFred('hi'); 27781 * // => 'hi fred' 27782 * 27783 * // Partially applied with placeholders. 27784 * var sayHelloTo = _.partialRight(greet, 'hello', _); 27785 * sayHelloTo('fred'); 27786 * // => 'hello fred' 27787 */ 27788 var partialRight = baseRest(function(func, partials) { 27789 var holders = replaceHolders(partials, getHolder(partialRight)); 27790 return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders); 27791 }); 27792 27793 /** 27794 * Creates a function that invokes `func` with arguments arranged according 27795 * to the specified `indexes` where the argument value at the first index is 27796 * provided as the first argument, the argument value at the second index is 27797 * provided as the second argument, and so on. 27798 * 27799 * @static 27800 * @memberOf _ 27801 * @since 3.0.0 27802 * @category Function 27803 * @param {Function} func The function to rearrange arguments for. 27804 * @param {...(number|number[])} indexes The arranged argument indexes. 27805 * @returns {Function} Returns the new function. 27806 * @example 27807 * 27808 * var rearged = _.rearg(function(a, b, c) { 27809 * return [a, b, c]; 27810 * }, [2, 0, 1]); 27811 * 27812 * rearged('b', 'c', 'a') 27813 * // => ['a', 'b', 'c'] 27814 */ 27815 var rearg = flatRest(function(func, indexes) { 27816 return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes); 27817 }); 27818 27819 /** 27820 * Creates a function that invokes `func` with the `this` binding of the 27821 * created function and arguments from `start` and beyond provided as 27822 * an array. 27823 * 27824 * **Note:** This method is based on the 27825 * [rest parameter](https://mdn.io/rest_parameters). 27826 * 27827 * @static 27828 * @memberOf _ 27829 * @since 4.0.0 27830 * @category Function 27831 * @param {Function} func The function to apply a rest parameter to. 27832 * @param {number} [start=func.length-1] The start position of the rest parameter. 27833 * @returns {Function} Returns the new function. 27834 * @example 27835 * 27836 * var say = _.rest(function(what, names) { 27837 * return what + ' ' + _.initial(names).join(', ') + 27838 * (_.size(names) > 1 ? ', & ' : '') + _.last(names); 27839 * }); 27840 * 27841 * say('hello', 'fred', 'barney', 'pebbles'); 27842 * // => 'hello fred, barney, & pebbles' 27843 */ 27844 function rest(func, start) { 27845 if (typeof func != 'function') { 27846 throw new TypeError(FUNC_ERROR_TEXT); 27847 } 27848 start = start === undefined ? start : toInteger(start); 27849 return baseRest(func, start); 27850 } 27851 27852 /** 27853 * Creates a function that invokes `func` with the `this` binding of the 27854 * create function and an array of arguments much like 27855 * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply). 27856 * 27857 * **Note:** This method is based on the 27858 * [spread operator](https://mdn.io/spread_operator). 27859 * 27860 * @static 27861 * @memberOf _ 27862 * @since 3.2.0 27863 * @category Function 27864 * @param {Function} func The function to spread arguments over. 27865 * @param {number} [start=0] The start position of the spread. 27866 * @returns {Function} Returns the new function. 27867 * @example 27868 * 27869 * var say = _.spread(function(who, what) { 27870 * return who + ' says ' + what; 27871 * }); 27872 * 27873 * say(['fred', 'hello']); 27874 * // => 'fred says hello' 27875 * 27876 * var numbers = Promise.all([ 27877 * Promise.resolve(40), 27878 * Promise.resolve(36) 27879 * ]); 27880 * 27881 * numbers.then(_.spread(function(x, y) { 27882 * return x + y; 27883 * })); 27884 * // => a Promise of 76 27885 */ 27886 function spread(func, start) { 27887 if (typeof func != 'function') { 27888 throw new TypeError(FUNC_ERROR_TEXT); 27889 } 27890 start = start == null ? 0 : nativeMax(toInteger(start), 0); 27891 return baseRest(function(args) { 27892 var array = args[start], 27893 otherArgs = castSlice(args, 0, start); 27894 27895 if (array) { 27896 arrayPush(otherArgs, array); 27897 } 27898 return apply(func, this, otherArgs); 27899 }); 27900 } 27901 27902 /** 27903 * Creates a throttled function that only invokes `func` at most once per 27904 * every `wait` milliseconds. The throttled function comes with a `cancel` 27905 * method to cancel delayed `func` invocations and a `flush` method to 27906 * immediately invoke them. Provide `options` to indicate whether `func` 27907 * should be invoked on the leading and/or trailing edge of the `wait` 27908 * timeout. The `func` is invoked with the last arguments provided to the 27909 * throttled function. Subsequent calls to the throttled function return the 27910 * result of the last `func` invocation. 27911 * 27912 * **Note:** If `leading` and `trailing` options are `true`, `func` is 27913 * invoked on the trailing edge of the timeout only if the throttled function 27914 * is invoked more than once during the `wait` timeout. 27915 * 27916 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 27917 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 27918 * 27919 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 27920 * for details over the differences between `_.throttle` and `_.debounce`. 27921 * 27922 * @static 27923 * @memberOf _ 27924 * @since 0.1.0 27925 * @category Function 27926 * @param {Function} func The function to throttle. 27927 * @param {number} [wait=0] The number of milliseconds to throttle invocations to. 27928 * @param {Object} [options={}] The options object. 27929 * @param {boolean} [options.leading=true] 27930 * Specify invoking on the leading edge of the timeout. 27931 * @param {boolean} [options.trailing=true] 27932 * Specify invoking on the trailing edge of the timeout. 27933 * @returns {Function} Returns the new throttled function. 27934 * @example 27935 * 27936 * // Avoid excessively updating the position while scrolling. 27937 * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); 27938 * 27939 * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. 27940 * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); 27941 * jQuery(element).on('click', throttled); 27942 * 27943 * // Cancel the trailing throttled invocation. 27944 * jQuery(window).on('popstate', throttled.cancel); 27945 */ 27946 function throttle(func, wait, options) { 27947 var leading = true, 27948 trailing = true; 27949 27950 if (typeof func != 'function') { 27951 throw new TypeError(FUNC_ERROR_TEXT); 27952 } 27953 if (isObject(options)) { 27954 leading = 'leading' in options ? !!options.leading : leading; 27955 trailing = 'trailing' in options ? !!options.trailing : trailing; 27956 } 27957 return debounce(func, wait, { 27958 'leading': leading, 27959 'maxWait': wait, 27960 'trailing': trailing 27961 }); 27962 } 27963 27964 /** 27965 * Creates a function that accepts up to one argument, ignoring any 27966 * additional arguments. 27967 * 27968 * @static 27969 * @memberOf _ 27970 * @since 4.0.0 27971 * @category Function 27972 * @param {Function} func The function to cap arguments for. 27973 * @returns {Function} Returns the new capped function. 27974 * @example 27975 * 27976 * _.map(['6', '8', '10'], _.unary(parseInt)); 27977 * // => [6, 8, 10] 27978 */ 27979 function unary(func) { 27980 return ary(func, 1); 27981 } 27982 27983 /** 27984 * Creates a function that provides `value` to `wrapper` as its first 27985 * argument. Any additional arguments provided to the function are appended 27986 * to those provided to the `wrapper`. The wrapper is invoked with the `this` 27987 * binding of the created function. 27988 * 27989 * @static 27990 * @memberOf _ 27991 * @since 0.1.0 27992 * @category Function 27993 * @param {*} value The value to wrap. 27994 * @param {Function} [wrapper=identity] The wrapper function. 27995 * @returns {Function} Returns the new function. 27996 * @example 27997 * 27998 * var p = _.wrap(_.escape, function(func, text) { 27999 * return '<p>' + func(text) + '</p>'; 28000 * }); 28001 * 28002 * p('fred, barney, & pebbles'); 28003 * // => '<p>fred, barney, & pebbles</p>' 28004 */ 28005 function wrap(value, wrapper) { 28006 return partial(castFunction(wrapper), value); 28007 } 28008 28009 /*------------------------------------------------------------------------*/ 28010 28011 /** 28012 * Casts `value` as an array if it's not one. 28013 * 28014 * @static 28015 * @memberOf _ 28016 * @since 4.4.0 28017 * @category Lang 28018 * @param {*} value The value to inspect. 28019 * @returns {Array} Returns the cast array. 28020 * @example 28021 * 28022 * _.castArray(1); 28023 * // => [1] 28024 * 28025 * _.castArray({ 'a': 1 }); 28026 * // => [{ 'a': 1 }] 28027 * 28028 * _.castArray('abc'); 28029 * // => ['abc'] 28030 * 28031 * _.castArray(null); 28032 * // => [null] 28033 * 28034 * _.castArray(undefined); 28035 * // => [undefined] 28036 * 28037 * _.castArray(); 28038 * // => [] 28039 * 28040 * var array = [1, 2, 3]; 28041 * console.log(_.castArray(array) === array); 28042 * // => true 28043 */ 28044 function castArray() { 28045 if (!arguments.length) { 28046 return []; 28047 } 28048 var value = arguments[0]; 28049 return isArray(value) ? value : [value]; 28050 } 28051 28052 /** 28053 * Creates a shallow clone of `value`. 28054 * 28055 * **Note:** This method is loosely based on the 28056 * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) 28057 * and supports cloning arrays, array buffers, booleans, date objects, maps, 28058 * numbers, `Object` objects, regexes, sets, strings, symbols, and typed 28059 * arrays. The own enumerable properties of `arguments` objects are cloned 28060 * as plain objects. An empty object is returned for uncloneable values such 28061 * as error objects, functions, DOM nodes, and WeakMaps. 28062 * 28063 * @static 28064 * @memberOf _ 28065 * @since 0.1.0 28066 * @category Lang 28067 * @param {*} value The value to clone. 28068 * @returns {*} Returns the cloned value. 28069 * @see _.cloneDeep 28070 * @example 28071 * 28072 * var objects = [{ 'a': 1 }, { 'b': 2 }]; 28073 * 28074 * var shallow = _.clone(objects); 28075 * console.log(shallow[0] === objects[0]); 28076 * // => true 28077 */ 28078 function clone(value) { 28079 return baseClone(value, CLONE_SYMBOLS_FLAG); 28080 } 28081 28082 /** 28083 * This method is like `_.clone` except that it accepts `customizer` which 28084 * is invoked to produce the cloned value. If `customizer` returns `undefined`, 28085 * cloning is handled by the method instead. The `customizer` is invoked with 28086 * up to four arguments; (value [, index|key, object, stack]). 28087 * 28088 * @static 28089 * @memberOf _ 28090 * @since 4.0.0 28091 * @category Lang 28092 * @param {*} value The value to clone. 28093 * @param {Function} [customizer] The function to customize cloning. 28094 * @returns {*} Returns the cloned value. 28095 * @see _.cloneDeepWith 28096 * @example 28097 * 28098 * function customizer(value) { 28099 * if (_.isElement(value)) { 28100 * return value.cloneNode(false); 28101 * } 28102 * } 28103 * 28104 * var el = _.cloneWith(document.body, customizer); 28105 * 28106 * console.log(el === document.body); 28107 * // => false 28108 * console.log(el.nodeName); 28109 * // => 'BODY' 28110 * console.log(el.childNodes.length); 28111 * // => 0 28112 */ 28113 function cloneWith(value, customizer) { 28114 customizer = typeof customizer == 'function' ? customizer : undefined; 28115 return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); 28116 } 28117 28118 /** 28119 * This method is like `_.clone` except that it recursively clones `value`. 28120 * 28121 * @static 28122 * @memberOf _ 28123 * @since 1.0.0 28124 * @category Lang 28125 * @param {*} value The value to recursively clone. 28126 * @returns {*} Returns the deep cloned value. 28127 * @see _.clone 28128 * @example 28129 * 28130 * var objects = [{ 'a': 1 }, { 'b': 2 }]; 28131 * 28132 * var deep = _.cloneDeep(objects); 28133 * console.log(deep[0] === objects[0]); 28134 * // => false 28135 */ 28136 function cloneDeep(value) { 28137 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); 28138 } 28139 28140 /** 28141 * This method is like `_.cloneWith` except that it recursively clones `value`. 28142 * 28143 * @static 28144 * @memberOf _ 28145 * @since 4.0.0 28146 * @category Lang 28147 * @param {*} value The value to recursively clone. 28148 * @param {Function} [customizer] The function to customize cloning. 28149 * @returns {*} Returns the deep cloned value. 28150 * @see _.cloneWith 28151 * @example 28152 * 28153 * function customizer(value) { 28154 * if (_.isElement(value)) { 28155 * return value.cloneNode(true); 28156 * } 28157 * } 28158 * 28159 * var el = _.cloneDeepWith(document.body, customizer); 28160 * 28161 * console.log(el === document.body); 28162 * // => false 28163 * console.log(el.nodeName); 28164 * // => 'BODY' 28165 * console.log(el.childNodes.length); 28166 * // => 20 28167 */ 28168 function cloneDeepWith(value, customizer) { 28169 customizer = typeof customizer == 'function' ? customizer : undefined; 28170 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); 28171 } 28172 28173 /** 28174 * Checks if `object` conforms to `source` by invoking the predicate 28175 * properties of `source` with the corresponding property values of `object`. 28176 * 28177 * **Note:** This method is equivalent to `_.conforms` when `source` is 28178 * partially applied. 28179 * 28180 * @static 28181 * @memberOf _ 28182 * @since 4.14.0 28183 * @category Lang 28184 * @param {Object} object The object to inspect. 28185 * @param {Object} source The object of property predicates to conform to. 28186 * @returns {boolean} Returns `true` if `object` conforms, else `false`. 28187 * @example 28188 * 28189 * var object = { 'a': 1, 'b': 2 }; 28190 * 28191 * _.conformsTo(object, { 'b': function(n) { return n > 1; } }); 28192 * // => true 28193 * 28194 * _.conformsTo(object, { 'b': function(n) { return n > 2; } }); 28195 * // => false 28196 */ 28197 function conformsTo(object, source) { 28198 return source == null || baseConformsTo(object, source, keys(source)); 28199 } 28200 28201 /** 28202 * Performs a 28203 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 28204 * comparison between two values to determine if they are equivalent. 28205 * 28206 * @static 28207 * @memberOf _ 28208 * @since 4.0.0 28209 * @category Lang 28210 * @param {*} value The value to compare. 28211 * @param {*} other The other value to compare. 28212 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 28213 * @example 28214 * 28215 * var object = { 'a': 1 }; 28216 * var other = { 'a': 1 }; 28217 * 28218 * _.eq(object, object); 28219 * // => true 28220 * 28221 * _.eq(object, other); 28222 * // => false 28223 * 28224 * _.eq('a', 'a'); 28225 * // => true 28226 * 28227 * _.eq('a', Object('a')); 28228 * // => false 28229 * 28230 * _.eq(NaN, NaN); 28231 * // => true 28232 */ 28233 function eq(value, other) { 28234 return value === other || (value !== value && other !== other); 28235 } 28236 28237 /** 28238 * Checks if `value` is greater than `other`. 28239 * 28240 * @static 28241 * @memberOf _ 28242 * @since 3.9.0 28243 * @category Lang 28244 * @param {*} value The value to compare. 28245 * @param {*} other The other value to compare. 28246 * @returns {boolean} Returns `true` if `value` is greater than `other`, 28247 * else `false`. 28248 * @see _.lt 28249 * @example 28250 * 28251 * _.gt(3, 1); 28252 * // => true 28253 * 28254 * _.gt(3, 3); 28255 * // => false 28256 * 28257 * _.gt(1, 3); 28258 * // => false 28259 */ 28260 var gt = createRelationalOperation(baseGt); 28261 28262 /** 28263 * Checks if `value` is greater than or equal to `other`. 28264 * 28265 * @static 28266 * @memberOf _ 28267 * @since 3.9.0 28268 * @category Lang 28269 * @param {*} value The value to compare. 28270 * @param {*} other The other value to compare. 28271 * @returns {boolean} Returns `true` if `value` is greater than or equal to 28272 * `other`, else `false`. 28273 * @see _.lte 28274 * @example 28275 * 28276 * _.gte(3, 1); 28277 * // => true 28278 * 28279 * _.gte(3, 3); 28280 * // => true 28281 * 28282 * _.gte(1, 3); 28283 * // => false 28284 */ 28285 var gte = createRelationalOperation(function(value, other) { 28286 return value >= other; 28287 }); 28288 28289 /** 28290 * Checks if `value` is likely an `arguments` object. 28291 * 28292 * @static 28293 * @memberOf _ 28294 * @since 0.1.0 28295 * @category Lang 28296 * @param {*} value The value to check. 28297 * @returns {boolean} Returns `true` if `value` is an `arguments` object, 28298 * else `false`. 28299 * @example 28300 * 28301 * _.isArguments(function() { return arguments; }()); 28302 * // => true 28303 * 28304 * _.isArguments([1, 2, 3]); 28305 * // => false 28306 */ 28307 var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { 28308 return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && 28309 !propertyIsEnumerable.call(value, 'callee'); 28310 }; 28311 28312 /** 28313 * Checks if `value` is classified as an `Array` object. 28314 * 28315 * @static 28316 * @memberOf _ 28317 * @since 0.1.0 28318 * @category Lang 28319 * @param {*} value The value to check. 28320 * @returns {boolean} Returns `true` if `value` is an array, else `false`. 28321 * @example 28322 * 28323 * _.isArray([1, 2, 3]); 28324 * // => true 28325 * 28326 * _.isArray(document.body.children); 28327 * // => false 28328 * 28329 * _.isArray('abc'); 28330 * // => false 28331 * 28332 * _.isArray(_.noop); 28333 * // => false 28334 */ 28335 var isArray = Array.isArray; 28336 28337 /** 28338 * Checks if `value` is classified as an `ArrayBuffer` object. 28339 * 28340 * @static 28341 * @memberOf _ 28342 * @since 4.3.0 28343 * @category Lang 28344 * @param {*} value The value to check. 28345 * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. 28346 * @example 28347 * 28348 * _.isArrayBuffer(new ArrayBuffer(2)); 28349 * // => true 28350 * 28351 * _.isArrayBuffer(new Array(2)); 28352 * // => false 28353 */ 28354 var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; 28355 28356 /** 28357 * Checks if `value` is array-like. A value is considered array-like if it's 28358 * not a function and has a `value.length` that's an integer greater than or 28359 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. 28360 * 28361 * @static 28362 * @memberOf _ 28363 * @since 4.0.0 28364 * @category Lang 28365 * @param {*} value The value to check. 28366 * @returns {boolean} Returns `true` if `value` is array-like, else `false`. 28367 * @example 28368 * 28369 * _.isArrayLike([1, 2, 3]); 28370 * // => true 28371 * 28372 * _.isArrayLike(document.body.children); 28373 * // => true 28374 * 28375 * _.isArrayLike('abc'); 28376 * // => true 28377 * 28378 * _.isArrayLike(_.noop); 28379 * // => false 28380 */ 28381 function isArrayLike(value) { 28382 return value != null && isLength(value.length) && !isFunction(value); 28383 } 28384 28385 /** 28386 * This method is like `_.isArrayLike` except that it also checks if `value` 28387 * is an object. 28388 * 28389 * @static 28390 * @memberOf _ 28391 * @since 4.0.0 28392 * @category Lang 28393 * @param {*} value The value to check. 28394 * @returns {boolean} Returns `true` if `value` is an array-like object, 28395 * else `false`. 28396 * @example 28397 * 28398 * _.isArrayLikeObject([1, 2, 3]); 28399 * // => true 28400 * 28401 * _.isArrayLikeObject(document.body.children); 28402 * // => true 28403 * 28404 * _.isArrayLikeObject('abc'); 28405 * // => false 28406 * 28407 * _.isArrayLikeObject(_.noop); 28408 * // => false 28409 */ 28410 function isArrayLikeObject(value) { 28411 return isObjectLike(value) && isArrayLike(value); 28412 } 28413 28414 /** 28415 * Checks if `value` is classified as a boolean primitive or object. 28416 * 28417 * @static 28418 * @memberOf _ 28419 * @since 0.1.0 28420 * @category Lang 28421 * @param {*} value The value to check. 28422 * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. 28423 * @example 28424 * 28425 * _.isBoolean(false); 28426 * // => true 28427 * 28428 * _.isBoolean(null); 28429 * // => false 28430 */ 28431 function isBoolean(value) { 28432 return value === true || value === false || 28433 (isObjectLike(value) && baseGetTag(value) == boolTag); 28434 } 28435 28436 /** 28437 * Checks if `value` is a buffer. 28438 * 28439 * @static 28440 * @memberOf _ 28441 * @since 4.3.0 28442 * @category Lang 28443 * @param {*} value The value to check. 28444 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. 28445 * @example 28446 * 28447 * _.isBuffer(new Buffer(2)); 28448 * // => true 28449 * 28450 * _.isBuffer(new Uint8Array(2)); 28451 * // => false 28452 */ 28453 var isBuffer = nativeIsBuffer || stubFalse; 28454 28455 /** 28456 * Checks if `value` is classified as a `Date` object. 28457 * 28458 * @static 28459 * @memberOf _ 28460 * @since 0.1.0 28461 * @category Lang 28462 * @param {*} value The value to check. 28463 * @returns {boolean} Returns `true` if `value` is a date object, else `false`. 28464 * @example 28465 * 28466 * _.isDate(new Date); 28467 * // => true 28468 * 28469 * _.isDate('Mon April 23 2012'); 28470 * // => false 28471 */ 28472 var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; 28473 28474 /** 28475 * Checks if `value` is likely a DOM element. 28476 * 28477 * @static 28478 * @memberOf _ 28479 * @since 0.1.0 28480 * @category Lang 28481 * @param {*} value The value to check. 28482 * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. 28483 * @example 28484 * 28485 * _.isElement(document.body); 28486 * // => true 28487 * 28488 * _.isElement('<body>'); 28489 * // => false 28490 */ 28491 function isElement(value) { 28492 return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); 28493 } 28494 28495 /** 28496 * Checks if `value` is an empty object, collection, map, or set. 28497 * 28498 * Objects are considered empty if they have no own enumerable string keyed 28499 * properties. 28500 * 28501 * Array-like values such as `arguments` objects, arrays, buffers, strings, or 28502 * jQuery-like collections are considered empty if they have a `length` of `0`. 28503 * Similarly, maps and sets are considered empty if they have a `size` of `0`. 28504 * 28505 * @static 28506 * @memberOf _ 28507 * @since 0.1.0 28508 * @category Lang 28509 * @param {*} value The value to check. 28510 * @returns {boolean} Returns `true` if `value` is empty, else `false`. 28511 * @example 28512 * 28513 * _.isEmpty(null); 28514 * // => true 28515 * 28516 * _.isEmpty(true); 28517 * // => true 28518 * 28519 * _.isEmpty(1); 28520 * // => true 28521 * 28522 * _.isEmpty([1, 2, 3]); 28523 * // => false 28524 * 28525 * _.isEmpty({ 'a': 1 }); 28526 * // => false 28527 */ 28528 function isEmpty(value) { 28529 if (value == null) { 28530 return true; 28531 } 28532 if (isArrayLike(value) && 28533 (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || 28534 isBuffer(value) || isTypedArray(value) || isArguments(value))) { 28535 return !value.length; 28536 } 28537 var tag = getTag(value); 28538 if (tag == mapTag || tag == setTag) { 28539 return !value.size; 28540 } 28541 if (isPrototype(value)) { 28542 return !baseKeys(value).length; 28543 } 28544 for (var key in value) { 28545 if (hasOwnProperty.call(value, key)) { 28546 return false; 28547 } 28548 } 28549 return true; 28550 } 28551 28552 /** 28553 * Performs a deep comparison between two values to determine if they are 28554 * equivalent. 28555 * 28556 * **Note:** This method supports comparing arrays, array buffers, booleans, 28557 * date objects, error objects, maps, numbers, `Object` objects, regexes, 28558 * sets, strings, symbols, and typed arrays. `Object` objects are compared 28559 * by their own, not inherited, enumerable properties. Functions and DOM 28560 * nodes are compared by strict equality, i.e. `===`. 28561 * 28562 * @static 28563 * @memberOf _ 28564 * @since 0.1.0 28565 * @category Lang 28566 * @param {*} value The value to compare. 28567 * @param {*} other The other value to compare. 28568 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 28569 * @example 28570 * 28571 * var object = { 'a': 1 }; 28572 * var other = { 'a': 1 }; 28573 * 28574 * _.isEqual(object, other); 28575 * // => true 28576 * 28577 * object === other; 28578 * // => false 28579 */ 28580 function isEqual(value, other) { 28581 return baseIsEqual(value, other); 28582 } 28583 28584 /** 28585 * This method is like `_.isEqual` except that it accepts `customizer` which 28586 * is invoked to compare values. If `customizer` returns `undefined`, comparisons 28587 * are handled by the method instead. The `customizer` is invoked with up to 28588 * six arguments: (objValue, othValue [, index|key, object, other, stack]). 28589 * 28590 * @static 28591 * @memberOf _ 28592 * @since 4.0.0 28593 * @category Lang 28594 * @param {*} value The value to compare. 28595 * @param {*} other The other value to compare. 28596 * @param {Function} [customizer] The function to customize comparisons. 28597 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 28598 * @example 28599 * 28600 * function isGreeting(value) { 28601 * return /^h(?:i|ello)$/.test(value); 28602 * } 28603 * 28604 * function customizer(objValue, othValue) { 28605 * if (isGreeting(objValue) && isGreeting(othValue)) { 28606 * return true; 28607 * } 28608 * } 28609 * 28610 * var array = ['hello', 'goodbye']; 28611 * var other = ['hi', 'goodbye']; 28612 * 28613 * _.isEqualWith(array, other, customizer); 28614 * // => true 28615 */ 28616 function isEqualWith(value, other, customizer) { 28617 customizer = typeof customizer == 'function' ? customizer : undefined; 28618 var result = customizer ? customizer(value, other) : undefined; 28619 return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result; 28620 } 28621 28622 /** 28623 * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, 28624 * `SyntaxError`, `TypeError`, or `URIError` object. 28625 * 28626 * @static 28627 * @memberOf _ 28628 * @since 3.0.0 28629 * @category Lang 28630 * @param {*} value The value to check. 28631 * @returns {boolean} Returns `true` if `value` is an error object, else `false`. 28632 * @example 28633 * 28634 * _.isError(new Error); 28635 * // => true 28636 * 28637 * _.isError(Error); 28638 * // => false 28639 */ 28640 function isError(value) { 28641 if (!isObjectLike(value)) { 28642 return false; 28643 } 28644 var tag = baseGetTag(value); 28645 return tag == errorTag || tag == domExcTag || 28646 (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); 28647 } 28648 28649 /** 28650 * Checks if `value` is a finite primitive number. 28651 * 28652 * **Note:** This method is based on 28653 * [`Number.isFinite`](https://mdn.io/Number/isFinite). 28654 * 28655 * @static 28656 * @memberOf _ 28657 * @since 0.1.0 28658 * @category Lang 28659 * @param {*} value The value to check. 28660 * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. 28661 * @example 28662 * 28663 * _.isFinite(3); 28664 * // => true 28665 * 28666 * _.isFinite(Number.MIN_VALUE); 28667 * // => true 28668 * 28669 * _.isFinite(Infinity); 28670 * // => false 28671 * 28672 * _.isFinite('3'); 28673 * // => false 28674 */ 28675 function isFinite(value) { 28676 return typeof value == 'number' && nativeIsFinite(value); 28677 } 28678 28679 /** 28680 * Checks if `value` is classified as a `Function` object. 28681 * 28682 * @static 28683 * @memberOf _ 28684 * @since 0.1.0 28685 * @category Lang 28686 * @param {*} value The value to check. 28687 * @returns {boolean} Returns `true` if `value` is a function, else `false`. 28688 * @example 28689 * 28690 * _.isFunction(_); 28691 * // => true 28692 * 28693 * _.isFunction(/abc/); 28694 * // => false 28695 */ 28696 function isFunction(value) { 28697 if (!isObject(value)) { 28698 return false; 28699 } 28700 // The use of `Object#toString` avoids issues with the `typeof` operator 28701 // in Safari 9 which returns 'object' for typed arrays and other constructors. 28702 var tag = baseGetTag(value); 28703 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; 28704 } 28705 28706 /** 28707 * Checks if `value` is an integer. 28708 * 28709 * **Note:** This method is based on 28710 * [`Number.isInteger`](https://mdn.io/Number/isInteger). 28711 * 28712 * @static 28713 * @memberOf _ 28714 * @since 4.0.0 28715 * @category Lang 28716 * @param {*} value The value to check. 28717 * @returns {boolean} Returns `true` if `value` is an integer, else `false`. 28718 * @example 28719 * 28720 * _.isInteger(3); 28721 * // => true 28722 * 28723 * _.isInteger(Number.MIN_VALUE); 28724 * // => false 28725 * 28726 * _.isInteger(Infinity); 28727 * // => false 28728 * 28729 * _.isInteger('3'); 28730 * // => false 28731 */ 28732 function isInteger(value) { 28733 return typeof value == 'number' && value == toInteger(value); 28734 } 28735 28736 /** 28737 * Checks if `value` is a valid array-like length. 28738 * 28739 * **Note:** This method is loosely based on 28740 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). 28741 * 28742 * @static 28743 * @memberOf _ 28744 * @since 4.0.0 28745 * @category Lang 28746 * @param {*} value The value to check. 28747 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. 28748 * @example 28749 * 28750 * _.isLength(3); 28751 * // => true 28752 * 28753 * _.isLength(Number.MIN_VALUE); 28754 * // => false 28755 * 28756 * _.isLength(Infinity); 28757 * // => false 28758 * 28759 * _.isLength('3'); 28760 * // => false 28761 */ 28762 function isLength(value) { 28763 return typeof value == 'number' && 28764 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; 28765 } 28766 28767 /** 28768 * Checks if `value` is the 28769 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) 28770 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) 28771 * 28772 * @static 28773 * @memberOf _ 28774 * @since 0.1.0 28775 * @category Lang 28776 * @param {*} value The value to check. 28777 * @returns {boolean} Returns `true` if `value` is an object, else `false`. 28778 * @example 28779 * 28780 * _.isObject({}); 28781 * // => true 28782 * 28783 * _.isObject([1, 2, 3]); 28784 * // => true 28785 * 28786 * _.isObject(_.noop); 28787 * // => true 28788 * 28789 * _.isObject(null); 28790 * // => false 28791 */ 28792 function isObject(value) { 28793 var type = typeof value; 28794 return value != null && (type == 'object' || type == 'function'); 28795 } 28796 28797 /** 28798 * Checks if `value` is object-like. A value is object-like if it's not `null` 28799 * and has a `typeof` result of "object". 28800 * 28801 * @static 28802 * @memberOf _ 28803 * @since 4.0.0 28804 * @category Lang 28805 * @param {*} value The value to check. 28806 * @returns {boolean} Returns `true` if `value` is object-like, else `false`. 28807 * @example 28808 * 28809 * _.isObjectLike({}); 28810 * // => true 28811 * 28812 * _.isObjectLike([1, 2, 3]); 28813 * // => true 28814 * 28815 * _.isObjectLike(_.noop); 28816 * // => false 28817 * 28818 * _.isObjectLike(null); 28819 * // => false 28820 */ 28821 function isObjectLike(value) { 28822 return value != null && typeof value == 'object'; 28823 } 28824 28825 /** 28826 * Checks if `value` is classified as a `Map` object. 28827 * 28828 * @static 28829 * @memberOf _ 28830 * @since 4.3.0 28831 * @category Lang 28832 * @param {*} value The value to check. 28833 * @returns {boolean} Returns `true` if `value` is a map, else `false`. 28834 * @example 28835 * 28836 * _.isMap(new Map); 28837 * // => true 28838 * 28839 * _.isMap(new WeakMap); 28840 * // => false 28841 */ 28842 var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; 28843 28844 /** 28845 * Performs a partial deep comparison between `object` and `source` to 28846 * determine if `object` contains equivalent property values. 28847 * 28848 * **Note:** This method is equivalent to `_.matches` when `source` is 28849 * partially applied. 28850 * 28851 * Partial comparisons will match empty array and empty object `source` 28852 * values against any array or object value, respectively. See `_.isEqual` 28853 * for a list of supported value comparisons. 28854 * 28855 * @static 28856 * @memberOf _ 28857 * @since 3.0.0 28858 * @category Lang 28859 * @param {Object} object The object to inspect. 28860 * @param {Object} source The object of property values to match. 28861 * @returns {boolean} Returns `true` if `object` is a match, else `false`. 28862 * @example 28863 * 28864 * var object = { 'a': 1, 'b': 2 }; 28865 * 28866 * _.isMatch(object, { 'b': 2 }); 28867 * // => true 28868 * 28869 * _.isMatch(object, { 'b': 1 }); 28870 * // => false 28871 */ 28872 function isMatch(object, source) { 28873 return object === source || baseIsMatch(object, source, getMatchData(source)); 28874 } 28875 28876 /** 28877 * This method is like `_.isMatch` except that it accepts `customizer` which 28878 * is invoked to compare values. If `customizer` returns `undefined`, comparisons 28879 * are handled by the method instead. The `customizer` is invoked with five 28880 * arguments: (objValue, srcValue, index|key, object, source). 28881 * 28882 * @static 28883 * @memberOf _ 28884 * @since 4.0.0 28885 * @category Lang 28886 * @param {Object} object The object to inspect. 28887 * @param {Object} source The object of property values to match. 28888 * @param {Function} [customizer] The function to customize comparisons. 28889 * @returns {boolean} Returns `true` if `object` is a match, else `false`. 28890 * @example 28891 * 28892 * function isGreeting(value) { 28893 * return /^h(?:i|ello)$/.test(value); 28894 * } 28895 * 28896 * function customizer(objValue, srcValue) { 28897 * if (isGreeting(objValue) && isGreeting(srcValue)) { 28898 * return true; 28899 * } 28900 * } 28901 * 28902 * var object = { 'greeting': 'hello' }; 28903 * var source = { 'greeting': 'hi' }; 28904 * 28905 * _.isMatchWith(object, source, customizer); 28906 * // => true 28907 */ 28908 function isMatchWith(object, source, customizer) { 28909 customizer = typeof customizer == 'function' ? customizer : undefined; 28910 return baseIsMatch(object, source, getMatchData(source), customizer); 28911 } 28912 28913 /** 28914 * Checks if `value` is `NaN`. 28915 * 28916 * **Note:** This method is based on 28917 * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as 28918 * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for 28919 * `undefined` and other non-number values. 28920 * 28921 * @static 28922 * @memberOf _ 28923 * @since 0.1.0 28924 * @category Lang 28925 * @param {*} value The value to check. 28926 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. 28927 * @example 28928 * 28929 * _.isNaN(NaN); 28930 * // => true 28931 * 28932 * _.isNaN(new Number(NaN)); 28933 * // => true 28934 * 28935 * isNaN(undefined); 28936 * // => true 28937 * 28938 * _.isNaN(undefined); 28939 * // => false 28940 */ 28941 function isNaN(value) { 28942 // An `NaN` primitive is the only value that is not equal to itself. 28943 // Perform the `toStringTag` check first to avoid errors with some 28944 // ActiveX objects in IE. 28945 return isNumber(value) && value != +value; 28946 } 28947 28948 /** 28949 * Checks if `value` is a pristine native function. 28950 * 28951 * **Note:** This method can't reliably detect native functions in the presence 28952 * of the core-js package because core-js circumvents this kind of detection. 28953 * Despite multiple requests, the core-js maintainer has made it clear: any 28954 * attempt to fix the detection will be obstructed. As a result, we're left 28955 * with little choice but to throw an error. Unfortunately, this also affects 28956 * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), 28957 * which rely on core-js. 28958 * 28959 * @static 28960 * @memberOf _ 28961 * @since 3.0.0 28962 * @category Lang 28963 * @param {*} value The value to check. 28964 * @returns {boolean} Returns `true` if `value` is a native function, 28965 * else `false`. 28966 * @example 28967 * 28968 * _.isNative(Array.prototype.push); 28969 * // => true 28970 * 28971 * _.isNative(_); 28972 * // => false 28973 */ 28974 function isNative(value) { 28975 if (isMaskable(value)) { 28976 throw new Error(CORE_ERROR_TEXT); 28977 } 28978 return baseIsNative(value); 28979 } 28980 28981 /** 28982 * Checks if `value` is `null`. 28983 * 28984 * @static 28985 * @memberOf _ 28986 * @since 0.1.0 28987 * @category Lang 28988 * @param {*} value The value to check. 28989 * @returns {boolean} Returns `true` if `value` is `null`, else `false`. 28990 * @example 28991 * 28992 * _.isNull(null); 28993 * // => true 28994 * 28995 * _.isNull(void 0); 28996 * // => false 28997 */ 28998 function isNull(value) { 28999 return value === null; 29000 } 29001 29002 /** 29003 * Checks if `value` is `null` or `undefined`. 29004 * 29005 * @static 29006 * @memberOf _ 29007 * @since 4.0.0 29008 * @category Lang 29009 * @param {*} value The value to check. 29010 * @returns {boolean} Returns `true` if `value` is nullish, else `false`. 29011 * @example 29012 * 29013 * _.isNil(null); 29014 * // => true 29015 * 29016 * _.isNil(void 0); 29017 * // => true 29018 * 29019 * _.isNil(NaN); 29020 * // => false 29021 */ 29022 function isNil(value) { 29023 return value == null; 29024 } 29025 29026 /** 29027 * Checks if `value` is classified as a `Number` primitive or object. 29028 * 29029 * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are 29030 * classified as numbers, use the `_.isFinite` method. 29031 * 29032 * @static 29033 * @memberOf _ 29034 * @since 0.1.0 29035 * @category Lang 29036 * @param {*} value The value to check. 29037 * @returns {boolean} Returns `true` if `value` is a number, else `false`. 29038 * @example 29039 * 29040 * _.isNumber(3); 29041 * // => true 29042 * 29043 * _.isNumber(Number.MIN_VALUE); 29044 * // => true 29045 * 29046 * _.isNumber(Infinity); 29047 * // => true 29048 * 29049 * _.isNumber('3'); 29050 * // => false 29051 */ 29052 function isNumber(value) { 29053 return typeof value == 'number' || 29054 (isObjectLike(value) && baseGetTag(value) == numberTag); 29055 } 29056 29057 /** 29058 * Checks if `value` is a plain object, that is, an object created by the 29059 * `Object` constructor or one with a `[[Prototype]]` of `null`. 29060 * 29061 * @static 29062 * @memberOf _ 29063 * @since 0.8.0 29064 * @category Lang 29065 * @param {*} value The value to check. 29066 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. 29067 * @example 29068 * 29069 * function Foo() { 29070 * this.a = 1; 29071 * } 29072 * 29073 * _.isPlainObject(new Foo); 29074 * // => false 29075 * 29076 * _.isPlainObject([1, 2, 3]); 29077 * // => false 29078 * 29079 * _.isPlainObject({ 'x': 0, 'y': 0 }); 29080 * // => true 29081 * 29082 * _.isPlainObject(Object.create(null)); 29083 * // => true 29084 */ 29085 function isPlainObject(value) { 29086 if (!isObjectLike(value) || baseGetTag(value) != objectTag) { 29087 return false; 29088 } 29089 var proto = getPrototype(value); 29090 if (proto === null) { 29091 return true; 29092 } 29093 var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; 29094 return typeof Ctor == 'function' && Ctor instanceof Ctor && 29095 funcToString.call(Ctor) == objectCtorString; 29096 } 29097 29098 /** 29099 * Checks if `value` is classified as a `RegExp` object. 29100 * 29101 * @static 29102 * @memberOf _ 29103 * @since 0.1.0 29104 * @category Lang 29105 * @param {*} value The value to check. 29106 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. 29107 * @example 29108 * 29109 * _.isRegExp(/abc/); 29110 * // => true 29111 * 29112 * _.isRegExp('/abc/'); 29113 * // => false 29114 */ 29115 var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; 29116 29117 /** 29118 * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 29119 * double precision number which isn't the result of a rounded unsafe integer. 29120 * 29121 * **Note:** This method is based on 29122 * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). 29123 * 29124 * @static 29125 * @memberOf _ 29126 * @since 4.0.0 29127 * @category Lang 29128 * @param {*} value The value to check. 29129 * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. 29130 * @example 29131 * 29132 * _.isSafeInteger(3); 29133 * // => true 29134 * 29135 * _.isSafeInteger(Number.MIN_VALUE); 29136 * // => false 29137 * 29138 * _.isSafeInteger(Infinity); 29139 * // => false 29140 * 29141 * _.isSafeInteger('3'); 29142 * // => false 29143 */ 29144 function isSafeInteger(value) { 29145 return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; 29146 } 29147 29148 /** 29149 * Checks if `value` is classified as a `Set` object. 29150 * 29151 * @static 29152 * @memberOf _ 29153 * @since 4.3.0 29154 * @category Lang 29155 * @param {*} value The value to check. 29156 * @returns {boolean} Returns `true` if `value` is a set, else `false`. 29157 * @example 29158 * 29159 * _.isSet(new Set); 29160 * // => true 29161 * 29162 * _.isSet(new WeakSet); 29163 * // => false 29164 */ 29165 var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; 29166 29167 /** 29168 * Checks if `value` is classified as a `String` primitive or object. 29169 * 29170 * @static 29171 * @since 0.1.0 29172 * @memberOf _ 29173 * @category Lang 29174 * @param {*} value The value to check. 29175 * @returns {boolean} Returns `true` if `value` is a string, else `false`. 29176 * @example 29177 * 29178 * _.isString('abc'); 29179 * // => true 29180 * 29181 * _.isString(1); 29182 * // => false 29183 */ 29184 function isString(value) { 29185 return typeof value == 'string' || 29186 (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); 29187 } 29188 29189 /** 29190 * Checks if `value` is classified as a `Symbol` primitive or object. 29191 * 29192 * @static 29193 * @memberOf _ 29194 * @since 4.0.0 29195 * @category Lang 29196 * @param {*} value The value to check. 29197 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. 29198 * @example 29199 * 29200 * _.isSymbol(Symbol.iterator); 29201 * // => true 29202 * 29203 * _.isSymbol('abc'); 29204 * // => false 29205 */ 29206 function isSymbol(value) { 29207 return typeof value == 'symbol' || 29208 (isObjectLike(value) && baseGetTag(value) == symbolTag); 29209 } 29210 29211 /** 29212 * Checks if `value` is classified as a typed array. 29213 * 29214 * @static 29215 * @memberOf _ 29216 * @since 3.0.0 29217 * @category Lang 29218 * @param {*} value The value to check. 29219 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. 29220 * @example 29221 * 29222 * _.isTypedArray(new Uint8Array); 29223 * // => true 29224 * 29225 * _.isTypedArray([]); 29226 * // => false 29227 */ 29228 var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; 29229 29230 /** 29231 * Checks if `value` is `undefined`. 29232 * 29233 * @static 29234 * @since 0.1.0 29235 * @memberOf _ 29236 * @category Lang 29237 * @param {*} value The value to check. 29238 * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. 29239 * @example 29240 * 29241 * _.isUndefined(void 0); 29242 * // => true 29243 * 29244 * _.isUndefined(null); 29245 * // => false 29246 */ 29247 function isUndefined(value) { 29248 return value === undefined; 29249 } 29250 29251 /** 29252 * Checks if `value` is classified as a `WeakMap` object. 29253 * 29254 * @static 29255 * @memberOf _ 29256 * @since 4.3.0 29257 * @category Lang 29258 * @param {*} value The value to check. 29259 * @returns {boolean} Returns `true` if `value` is a weak map, else `false`. 29260 * @example 29261 * 29262 * _.isWeakMap(new WeakMap); 29263 * // => true 29264 * 29265 * _.isWeakMap(new Map); 29266 * // => false 29267 */ 29268 function isWeakMap(value) { 29269 return isObjectLike(value) && getTag(value) == weakMapTag; 29270 } 29271 29272 /** 29273 * Checks if `value` is classified as a `WeakSet` object. 29274 * 29275 * @static 29276 * @memberOf _ 29277 * @since 4.3.0 29278 * @category Lang 29279 * @param {*} value The value to check. 29280 * @returns {boolean} Returns `true` if `value` is a weak set, else `false`. 29281 * @example 29282 * 29283 * _.isWeakSet(new WeakSet); 29284 * // => true 29285 * 29286 * _.isWeakSet(new Set); 29287 * // => false 29288 */ 29289 function isWeakSet(value) { 29290 return isObjectLike(value) && baseGetTag(value) == weakSetTag; 29291 } 29292 29293 /** 29294 * Checks if `value` is less than `other`. 29295 * 29296 * @static 29297 * @memberOf _ 29298 * @since 3.9.0 29299 * @category Lang 29300 * @param {*} value The value to compare. 29301 * @param {*} other The other value to compare. 29302 * @returns {boolean} Returns `true` if `value` is less than `other`, 29303 * else `false`. 29304 * @see _.gt 29305 * @example 29306 * 29307 * _.lt(1, 3); 29308 * // => true 29309 * 29310 * _.lt(3, 3); 29311 * // => false 29312 * 29313 * _.lt(3, 1); 29314 * // => false 29315 */ 29316 var lt = createRelationalOperation(baseLt); 29317 29318 /** 29319 * Checks if `value` is less than or equal to `other`. 29320 * 29321 * @static 29322 * @memberOf _ 29323 * @since 3.9.0 29324 * @category Lang 29325 * @param {*} value The value to compare. 29326 * @param {*} other The other value to compare. 29327 * @returns {boolean} Returns `true` if `value` is less than or equal to 29328 * `other`, else `false`. 29329 * @see _.gte 29330 * @example 29331 * 29332 * _.lte(1, 3); 29333 * // => true 29334 * 29335 * _.lte(3, 3); 29336 * // => true 29337 * 29338 * _.lte(3, 1); 29339 * // => false 29340 */ 29341 var lte = createRelationalOperation(function(value, other) { 29342 return value <= other; 29343 }); 29344 29345 /** 29346 * Converts `value` to an array. 29347 * 29348 * @static 29349 * @since 0.1.0 29350 * @memberOf _ 29351 * @category Lang 29352 * @param {*} value The value to convert. 29353 * @returns {Array} Returns the converted array. 29354 * @example 29355 * 29356 * _.toArray({ 'a': 1, 'b': 2 }); 29357 * // => [1, 2] 29358 * 29359 * _.toArray('abc'); 29360 * // => ['a', 'b', 'c'] 29361 * 29362 * _.toArray(1); 29363 * // => [] 29364 * 29365 * _.toArray(null); 29366 * // => [] 29367 */ 29368 function toArray(value) { 29369 if (!value) { 29370 return []; 29371 } 29372 if (isArrayLike(value)) { 29373 return isString(value) ? stringToArray(value) : copyArray(value); 29374 } 29375 if (symIterator && value[symIterator]) { 29376 return iteratorToArray(value[symIterator]()); 29377 } 29378 var tag = getTag(value), 29379 func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); 29380 29381 return func(value); 29382 } 29383 29384 /** 29385 * Converts `value` to a finite number. 29386 * 29387 * @static 29388 * @memberOf _ 29389 * @since 4.12.0 29390 * @category Lang 29391 * @param {*} value The value to convert. 29392 * @returns {number} Returns the converted number. 29393 * @example 29394 * 29395 * _.toFinite(3.2); 29396 * // => 3.2 29397 * 29398 * _.toFinite(Number.MIN_VALUE); 29399 * // => 5e-324 29400 * 29401 * _.toFinite(Infinity); 29402 * // => 1.7976931348623157e+308 29403 * 29404 * _.toFinite('3.2'); 29405 * // => 3.2 29406 */ 29407 function toFinite(value) { 29408 if (!value) { 29409 return value === 0 ? value : 0; 29410 } 29411 value = toNumber(value); 29412 if (value === INFINITY || value === -INFINITY) { 29413 var sign = (value < 0 ? -1 : 1); 29414 return sign * MAX_INTEGER; 29415 } 29416 return value === value ? value : 0; 29417 } 29418 29419 /** 29420 * Converts `value` to an integer. 29421 * 29422 * **Note:** This method is loosely based on 29423 * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). 29424 * 29425 * @static 29426 * @memberOf _ 29427 * @since 4.0.0 29428 * @category Lang 29429 * @param {*} value The value to convert. 29430 * @returns {number} Returns the converted integer. 29431 * @example 29432 * 29433 * _.toInteger(3.2); 29434 * // => 3 29435 * 29436 * _.toInteger(Number.MIN_VALUE); 29437 * // => 0 29438 * 29439 * _.toInteger(Infinity); 29440 * // => 1.7976931348623157e+308 29441 * 29442 * _.toInteger('3.2'); 29443 * // => 3 29444 */ 29445 function toInteger(value) { 29446 var result = toFinite(value), 29447 remainder = result % 1; 29448 29449 return result === result ? (remainder ? result - remainder : result) : 0; 29450 } 29451 29452 /** 29453 * Converts `value` to an integer suitable for use as the length of an 29454 * array-like object. 29455 * 29456 * **Note:** This method is based on 29457 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). 29458 * 29459 * @static 29460 * @memberOf _ 29461 * @since 4.0.0 29462 * @category Lang 29463 * @param {*} value The value to convert. 29464 * @returns {number} Returns the converted integer. 29465 * @example 29466 * 29467 * _.toLength(3.2); 29468 * // => 3 29469 * 29470 * _.toLength(Number.MIN_VALUE); 29471 * // => 0 29472 * 29473 * _.toLength(Infinity); 29474 * // => 4294967295 29475 * 29476 * _.toLength('3.2'); 29477 * // => 3 29478 */ 29479 function toLength(value) { 29480 return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; 29481 } 29482 29483 /** 29484 * Converts `value` to a number. 29485 * 29486 * @static 29487 * @memberOf _ 29488 * @since 4.0.0 29489 * @category Lang 29490 * @param {*} value The value to process. 29491 * @returns {number} Returns the number. 29492 * @example 29493 * 29494 * _.toNumber(3.2); 29495 * // => 3.2 29496 * 29497 * _.toNumber(Number.MIN_VALUE); 29498 * // => 5e-324 29499 * 29500 * _.toNumber(Infinity); 29501 * // => Infinity 29502 * 29503 * _.toNumber('3.2'); 29504 * // => 3.2 29505 */ 29506 function toNumber(value) { 29507 if (typeof value == 'number') { 29508 return value; 29509 } 29510 if (isSymbol(value)) { 29511 return NAN; 29512 } 29513 if (isObject(value)) { 29514 var other = typeof value.valueOf == 'function' ? value.valueOf() : value; 29515 value = isObject(other) ? (other + '') : other; 29516 } 29517 if (typeof value != 'string') { 29518 return value === 0 ? value : +value; 29519 } 29520 value = value.replace(reTrim, ''); 29521 var isBinary = reIsBinary.test(value); 29522 return (isBinary || reIsOctal.test(value)) 29523 ? freeParseInt(value.slice(2), isBinary ? 2 : 8) 29524 : (reIsBadHex.test(value) ? NAN : +value); 29525 } 29526 29527 /** 29528 * Converts `value` to a plain object flattening inherited enumerable string 29529 * keyed properties of `value` to own properties of the plain object. 29530 * 29531 * @static 29532 * @memberOf _ 29533 * @since 3.0.0 29534 * @category Lang 29535 * @param {*} value The value to convert. 29536 * @returns {Object} Returns the converted plain object. 29537 * @example 29538 * 29539 * function Foo() { 29540 * this.b = 2; 29541 * } 29542 * 29543 * Foo.prototype.c = 3; 29544 * 29545 * _.assign({ 'a': 1 }, new Foo); 29546 * // => { 'a': 1, 'b': 2 } 29547 * 29548 * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); 29549 * // => { 'a': 1, 'b': 2, 'c': 3 } 29550 */ 29551 function toPlainObject(value) { 29552 return copyObject(value, keysIn(value)); 29553 } 29554 29555 /** 29556 * Converts `value` to a safe integer. A safe integer can be compared and 29557 * represented correctly. 29558 * 29559 * @static 29560 * @memberOf _ 29561 * @since 4.0.0 29562 * @category Lang 29563 * @param {*} value The value to convert. 29564 * @returns {number} Returns the converted integer. 29565 * @example 29566 * 29567 * _.toSafeInteger(3.2); 29568 * // => 3 29569 * 29570 * _.toSafeInteger(Number.MIN_VALUE); 29571 * // => 0 29572 * 29573 * _.toSafeInteger(Infinity); 29574 * // => 9007199254740991 29575 * 29576 * _.toSafeInteger('3.2'); 29577 * // => 3 29578 */ 29579 function toSafeInteger(value) { 29580 return value 29581 ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) 29582 : (value === 0 ? value : 0); 29583 } 29584 29585 /** 29586 * Converts `value` to a string. An empty string is returned for `null` 29587 * and `undefined` values. The sign of `-0` is preserved. 29588 * 29589 * @static 29590 * @memberOf _ 29591 * @since 4.0.0 29592 * @category Lang 29593 * @param {*} value The value to convert. 29594 * @returns {string} Returns the converted string. 29595 * @example 29596 * 29597 * _.toString(null); 29598 * // => '' 29599 * 29600 * _.toString(-0); 29601 * // => '-0' 29602 * 29603 * _.toString([1, 2, 3]); 29604 * // => '1,2,3' 29605 */ 29606 function toString(value) { 29607 return value == null ? '' : baseToString(value); 29608 } 29609 29610 /*------------------------------------------------------------------------*/ 29611 29612 /** 29613 * Assigns own enumerable string keyed properties of source objects to the 29614 * destination object. Source objects are applied from left to right. 29615 * Subsequent sources overwrite property assignments of previous sources. 29616 * 29617 * **Note:** This method mutates `object` and is loosely based on 29618 * [`Object.assign`](https://mdn.io/Object/assign). 29619 * 29620 * @static 29621 * @memberOf _ 29622 * @since 0.10.0 29623 * @category Object 29624 * @param {Object} object The destination object. 29625 * @param {...Object} [sources] The source objects. 29626 * @returns {Object} Returns `object`. 29627 * @see _.assignIn 29628 * @example 29629 * 29630 * function Foo() { 29631 * this.a = 1; 29632 * } 29633 * 29634 * function Bar() { 29635 * this.c = 3; 29636 * } 29637 * 29638 * Foo.prototype.b = 2; 29639 * Bar.prototype.d = 4; 29640 * 29641 * _.assign({ 'a': 0 }, new Foo, new Bar); 29642 * // => { 'a': 1, 'c': 3 } 29643 */ 29644 var assign = createAssigner(function(object, source) { 29645 if (isPrototype(source) || isArrayLike(source)) { 29646 copyObject(source, keys(source), object); 29647 return; 29648 } 29649 for (var key in source) { 29650 if (hasOwnProperty.call(source, key)) { 29651 assignValue(object, key, source[key]); 29652 } 29653 } 29654 }); 29655 29656 /** 29657 * This method is like `_.assign` except that it iterates over own and 29658 * inherited source properties. 29659 * 29660 * **Note:** This method mutates `object`. 29661 * 29662 * @static 29663 * @memberOf _ 29664 * @since 4.0.0 29665 * @alias extend 29666 * @category Object 29667 * @param {Object} object The destination object. 29668 * @param {...Object} [sources] The source objects. 29669 * @returns {Object} Returns `object`. 29670 * @see _.assign 29671 * @example 29672 * 29673 * function Foo() { 29674 * this.a = 1; 29675 * } 29676 * 29677 * function Bar() { 29678 * this.c = 3; 29679 * } 29680 * 29681 * Foo.prototype.b = 2; 29682 * Bar.prototype.d = 4; 29683 * 29684 * _.assignIn({ 'a': 0 }, new Foo, new Bar); 29685 * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } 29686 */ 29687 var assignIn = createAssigner(function(object, source) { 29688 copyObject(source, keysIn(source), object); 29689 }); 29690 29691 /** 29692 * This method is like `_.assignIn` except that it accepts `customizer` 29693 * which is invoked to produce the assigned values. If `customizer` returns 29694 * `undefined`, assignment is handled by the method instead. The `customizer` 29695 * is invoked with five arguments: (objValue, srcValue, key, object, source). 29696 * 29697 * **Note:** This method mutates `object`. 29698 * 29699 * @static 29700 * @memberOf _ 29701 * @since 4.0.0 29702 * @alias extendWith 29703 * @category Object 29704 * @param {Object} object The destination object. 29705 * @param {...Object} sources The source objects. 29706 * @param {Function} [customizer] The function to customize assigned values. 29707 * @returns {Object} Returns `object`. 29708 * @see _.assignWith 29709 * @example 29710 * 29711 * function customizer(objValue, srcValue) { 29712 * return _.isUndefined(objValue) ? srcValue : objValue; 29713 * } 29714 * 29715 * var defaults = _.partialRight(_.assignInWith, customizer); 29716 * 29717 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 29718 * // => { 'a': 1, 'b': 2 } 29719 */ 29720 var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { 29721 copyObject(source, keysIn(source), object, customizer); 29722 }); 29723 29724 /** 29725 * This method is like `_.assign` except that it accepts `customizer` 29726 * which is invoked to produce the assigned values. If `customizer` returns 29727 * `undefined`, assignment is handled by the method instead. The `customizer` 29728 * is invoked with five arguments: (objValue, srcValue, key, object, source). 29729 * 29730 * **Note:** This method mutates `object`. 29731 * 29732 * @static 29733 * @memberOf _ 29734 * @since 4.0.0 29735 * @category Object 29736 * @param {Object} object The destination object. 29737 * @param {...Object} sources The source objects. 29738 * @param {Function} [customizer] The function to customize assigned values. 29739 * @returns {Object} Returns `object`. 29740 * @see _.assignInWith 29741 * @example 29742 * 29743 * function customizer(objValue, srcValue) { 29744 * return _.isUndefined(objValue) ? srcValue : objValue; 29745 * } 29746 * 29747 * var defaults = _.partialRight(_.assignWith, customizer); 29748 * 29749 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 29750 * // => { 'a': 1, 'b': 2 } 29751 */ 29752 var assignWith = createAssigner(function(object, source, srcIndex, customizer) { 29753 copyObject(source, keys(source), object, customizer); 29754 }); 29755 29756 /** 29757 * Creates an array of values corresponding to `paths` of `object`. 29758 * 29759 * @static 29760 * @memberOf _ 29761 * @since 1.0.0 29762 * @category Object 29763 * @param {Object} object The object to iterate over. 29764 * @param {...(string|string[])} [paths] The property paths to pick. 29765 * @returns {Array} Returns the picked values. 29766 * @example 29767 * 29768 * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; 29769 * 29770 * _.at(object, ['a[0].b.c', 'a[1]']); 29771 * // => [3, 4] 29772 */ 29773 var at = flatRest(baseAt); 29774 29775 /** 29776 * Creates an object that inherits from the `prototype` object. If a 29777 * `properties` object is given, its own enumerable string keyed properties 29778 * are assigned to the created object. 29779 * 29780 * @static 29781 * @memberOf _ 29782 * @since 2.3.0 29783 * @category Object 29784 * @param {Object} prototype The object to inherit from. 29785 * @param {Object} [properties] The properties to assign to the object. 29786 * @returns {Object} Returns the new object. 29787 * @example 29788 * 29789 * function Shape() { 29790 * this.x = 0; 29791 * this.y = 0; 29792 * } 29793 * 29794 * function Circle() { 29795 * Shape.call(this); 29796 * } 29797 * 29798 * Circle.prototype = _.create(Shape.prototype, { 29799 * 'constructor': Circle 29800 * }); 29801 * 29802 * var circle = new Circle; 29803 * circle instanceof Circle; 29804 * // => true 29805 * 29806 * circle instanceof Shape; 29807 * // => true 29808 */ 29809 function create(prototype, properties) { 29810 var result = baseCreate(prototype); 29811 return properties == null ? result : baseAssign(result, properties); 29812 } 29813 29814 /** 29815 * Assigns own and inherited enumerable string keyed properties of source 29816 * objects to the destination object for all destination properties that 29817 * resolve to `undefined`. Source objects are applied from left to right. 29818 * Once a property is set, additional values of the same property are ignored. 29819 * 29820 * **Note:** This method mutates `object`. 29821 * 29822 * @static 29823 * @since 0.1.0 29824 * @memberOf _ 29825 * @category Object 29826 * @param {Object} object The destination object. 29827 * @param {...Object} [sources] The source objects. 29828 * @returns {Object} Returns `object`. 29829 * @see _.defaultsDeep 29830 * @example 29831 * 29832 * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 29833 * // => { 'a': 1, 'b': 2 } 29834 */ 29835 var defaults = baseRest(function(object, sources) { 29836 object = Object(object); 29837 29838 var index = -1; 29839 var length = sources.length; 29840 var guard = length > 2 ? sources[2] : undefined; 29841 29842 if (guard && isIterateeCall(sources[0], sources[1], guard)) { 29843 length = 1; 29844 } 29845 29846 while (++index < length) { 29847 var source = sources[index]; 29848 var props = keysIn(source); 29849 var propsIndex = -1; 29850 var propsLength = props.length; 29851 29852 while (++propsIndex < propsLength) { 29853 var key = props[propsIndex]; 29854 var value = object[key]; 29855 29856 if (value === undefined || 29857 (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { 29858 object[key] = source[key]; 29859 } 29860 } 29861 } 29862 29863 return object; 29864 }); 29865 29866 /** 29867 * This method is like `_.defaults` except that it recursively assigns 29868 * default properties. 29869 * 29870 * **Note:** This method mutates `object`. 29871 * 29872 * @static 29873 * @memberOf _ 29874 * @since 3.10.0 29875 * @category Object 29876 * @param {Object} object The destination object. 29877 * @param {...Object} [sources] The source objects. 29878 * @returns {Object} Returns `object`. 29879 * @see _.defaults 29880 * @example 29881 * 29882 * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); 29883 * // => { 'a': { 'b': 2, 'c': 3 } } 29884 */ 29885 var defaultsDeep = baseRest(function(args) { 29886 args.push(undefined, customDefaultsMerge); 29887 return apply(mergeWith, undefined, args); 29888 }); 29889 29890 /** 29891 * This method is like `_.find` except that it returns the key of the first 29892 * element `predicate` returns truthy for instead of the element itself. 29893 * 29894 * @static 29895 * @memberOf _ 29896 * @since 1.1.0 29897 * @category Object 29898 * @param {Object} object The object to inspect. 29899 * @param {Function} [predicate=_.identity] The function invoked per iteration. 29900 * @returns {string|undefined} Returns the key of the matched element, 29901 * else `undefined`. 29902 * @example 29903 * 29904 * var users = { 29905 * 'barney': { 'age': 36, 'active': true }, 29906 * 'fred': { 'age': 40, 'active': false }, 29907 * 'pebbles': { 'age': 1, 'active': true } 29908 * }; 29909 * 29910 * _.findKey(users, function(o) { return o.age < 40; }); 29911 * // => 'barney' (iteration order is not guaranteed) 29912 * 29913 * // The `_.matches` iteratee shorthand. 29914 * _.findKey(users, { 'age': 1, 'active': true }); 29915 * // => 'pebbles' 29916 * 29917 * // The `_.matchesProperty` iteratee shorthand. 29918 * _.findKey(users, ['active', false]); 29919 * // => 'fred' 29920 * 29921 * // The `_.property` iteratee shorthand. 29922 * _.findKey(users, 'active'); 29923 * // => 'barney' 29924 */ 29925 function findKey(object, predicate) { 29926 return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); 29927 } 29928 29929 /** 29930 * This method is like `_.findKey` except that it iterates over elements of 29931 * a collection in the opposite order. 29932 * 29933 * @static 29934 * @memberOf _ 29935 * @since 2.0.0 29936 * @category Object 29937 * @param {Object} object The object to inspect. 29938 * @param {Function} [predicate=_.identity] The function invoked per iteration. 29939 * @returns {string|undefined} Returns the key of the matched element, 29940 * else `undefined`. 29941 * @example 29942 * 29943 * var users = { 29944 * 'barney': { 'age': 36, 'active': true }, 29945 * 'fred': { 'age': 40, 'active': false }, 29946 * 'pebbles': { 'age': 1, 'active': true } 29947 * }; 29948 * 29949 * _.findLastKey(users, function(o) { return o.age < 40; }); 29950 * // => returns 'pebbles' assuming `_.findKey` returns 'barney' 29951 * 29952 * // The `_.matches` iteratee shorthand. 29953 * _.findLastKey(users, { 'age': 36, 'active': true }); 29954 * // => 'barney' 29955 * 29956 * // The `_.matchesProperty` iteratee shorthand. 29957 * _.findLastKey(users, ['active', false]); 29958 * // => 'fred' 29959 * 29960 * // The `_.property` iteratee shorthand. 29961 * _.findLastKey(users, 'active'); 29962 * // => 'pebbles' 29963 */ 29964 function findLastKey(object, predicate) { 29965 return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); 29966 } 29967 29968 /** 29969 * Iterates over own and inherited enumerable string keyed properties of an 29970 * object and invokes `iteratee` for each property. The iteratee is invoked 29971 * with three arguments: (value, key, object). Iteratee functions may exit 29972 * iteration early by explicitly returning `false`. 29973 * 29974 * @static 29975 * @memberOf _ 29976 * @since 0.3.0 29977 * @category Object 29978 * @param {Object} object The object to iterate over. 29979 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 29980 * @returns {Object} Returns `object`. 29981 * @see _.forInRight 29982 * @example 29983 * 29984 * function Foo() { 29985 * this.a = 1; 29986 * this.b = 2; 29987 * } 29988 * 29989 * Foo.prototype.c = 3; 29990 * 29991 * _.forIn(new Foo, function(value, key) { 29992 * console.log(key); 29993 * }); 29994 * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). 29995 */ 29996 function forIn(object, iteratee) { 29997 return object == null 29998 ? object 29999 : baseFor(object, getIteratee(iteratee, 3), keysIn); 30000 } 30001 30002 /** 30003 * This method is like `_.forIn` except that it iterates over properties of 30004 * `object` in the opposite order. 30005 * 30006 * @static 30007 * @memberOf _ 30008 * @since 2.0.0 30009 * @category Object 30010 * @param {Object} object The object to iterate over. 30011 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 30012 * @returns {Object} Returns `object`. 30013 * @see _.forIn 30014 * @example 30015 * 30016 * function Foo() { 30017 * this.a = 1; 30018 * this.b = 2; 30019 * } 30020 * 30021 * Foo.prototype.c = 3; 30022 * 30023 * _.forInRight(new Foo, function(value, key) { 30024 * console.log(key); 30025 * }); 30026 * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. 30027 */ 30028 function forInRight(object, iteratee) { 30029 return object == null 30030 ? object 30031 : baseForRight(object, getIteratee(iteratee, 3), keysIn); 30032 } 30033 30034 /** 30035 * Iterates over own enumerable string keyed properties of an object and 30036 * invokes `iteratee` for each property. The iteratee is invoked with three 30037 * arguments: (value, key, object). Iteratee functions may exit iteration 30038 * early by explicitly returning `false`. 30039 * 30040 * @static 30041 * @memberOf _ 30042 * @since 0.3.0 30043 * @category Object 30044 * @param {Object} object The object to iterate over. 30045 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 30046 * @returns {Object} Returns `object`. 30047 * @see _.forOwnRight 30048 * @example 30049 * 30050 * function Foo() { 30051 * this.a = 1; 30052 * this.b = 2; 30053 * } 30054 * 30055 * Foo.prototype.c = 3; 30056 * 30057 * _.forOwn(new Foo, function(value, key) { 30058 * console.log(key); 30059 * }); 30060 * // => Logs 'a' then 'b' (iteration order is not guaranteed). 30061 */ 30062 function forOwn(object, iteratee) { 30063 return object && baseForOwn(object, getIteratee(iteratee, 3)); 30064 } 30065 30066 /** 30067 * This method is like `_.forOwn` except that it iterates over properties of 30068 * `object` in the opposite order. 30069 * 30070 * @static 30071 * @memberOf _ 30072 * @since 2.0.0 30073 * @category Object 30074 * @param {Object} object The object to iterate over. 30075 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 30076 * @returns {Object} Returns `object`. 30077 * @see _.forOwn 30078 * @example 30079 * 30080 * function Foo() { 30081 * this.a = 1; 30082 * this.b = 2; 30083 * } 30084 * 30085 * Foo.prototype.c = 3; 30086 * 30087 * _.forOwnRight(new Foo, function(value, key) { 30088 * console.log(key); 30089 * }); 30090 * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. 30091 */ 30092 function forOwnRight(object, iteratee) { 30093 return object && baseForOwnRight(object, getIteratee(iteratee, 3)); 30094 } 30095 30096 /** 30097 * Creates an array of function property names from own enumerable properties 30098 * of `object`. 30099 * 30100 * @static 30101 * @since 0.1.0 30102 * @memberOf _ 30103 * @category Object 30104 * @param {Object} object The object to inspect. 30105 * @returns {Array} Returns the function names. 30106 * @see _.functionsIn 30107 * @example 30108 * 30109 * function Foo() { 30110 * this.a = _.constant('a'); 30111 * this.b = _.constant('b'); 30112 * } 30113 * 30114 * Foo.prototype.c = _.constant('c'); 30115 * 30116 * _.functions(new Foo); 30117 * // => ['a', 'b'] 30118 */ 30119 function functions(object) { 30120 return object == null ? [] : baseFunctions(object, keys(object)); 30121 } 30122 30123 /** 30124 * Creates an array of function property names from own and inherited 30125 * enumerable properties of `object`. 30126 * 30127 * @static 30128 * @memberOf _ 30129 * @since 4.0.0 30130 * @category Object 30131 * @param {Object} object The object to inspect. 30132 * @returns {Array} Returns the function names. 30133 * @see _.functions 30134 * @example 30135 * 30136 * function Foo() { 30137 * this.a = _.constant('a'); 30138 * this.b = _.constant('b'); 30139 * } 30140 * 30141 * Foo.prototype.c = _.constant('c'); 30142 * 30143 * _.functionsIn(new Foo); 30144 * // => ['a', 'b', 'c'] 30145 */ 30146 function functionsIn(object) { 30147 return object == null ? [] : baseFunctions(object, keysIn(object)); 30148 } 30149 30150 /** 30151 * Gets the value at `path` of `object`. If the resolved value is 30152 * `undefined`, the `defaultValue` is returned in its place. 30153 * 30154 * @static 30155 * @memberOf _ 30156 * @since 3.7.0 30157 * @category Object 30158 * @param {Object} object The object to query. 30159 * @param {Array|string} path The path of the property to get. 30160 * @param {*} [defaultValue] The value returned for `undefined` resolved values. 30161 * @returns {*} Returns the resolved value. 30162 * @example 30163 * 30164 * var object = { 'a': [{ 'b': { 'c': 3 } }] }; 30165 * 30166 * _.get(object, 'a[0].b.c'); 30167 * // => 3 30168 * 30169 * _.get(object, ['a', '0', 'b', 'c']); 30170 * // => 3 30171 * 30172 * _.get(object, 'a.b.c', 'default'); 30173 * // => 'default' 30174 */ 30175 function get(object, path, defaultValue) { 30176 var result = object == null ? undefined : baseGet(object, path); 30177 return result === undefined ? defaultValue : result; 30178 } 30179 30180 /** 30181 * Checks if `path` is a direct property of `object`. 30182 * 30183 * @static 30184 * @since 0.1.0 30185 * @memberOf _ 30186 * @category Object 30187 * @param {Object} object The object to query. 30188 * @param {Array|string} path The path to check. 30189 * @returns {boolean} Returns `true` if `path` exists, else `false`. 30190 * @example 30191 * 30192 * var object = { 'a': { 'b': 2 } }; 30193 * var other = _.create({ 'a': _.create({ 'b': 2 }) }); 30194 * 30195 * _.has(object, 'a'); 30196 * // => true 30197 * 30198 * _.has(object, 'a.b'); 30199 * // => true 30200 * 30201 * _.has(object, ['a', 'b']); 30202 * // => true 30203 * 30204 * _.has(other, 'a'); 30205 * // => false 30206 */ 30207 function has(object, path) { 30208 return object != null && hasPath(object, path, baseHas); 30209 } 30210 30211 /** 30212 * Checks if `path` is a direct or inherited property of `object`. 30213 * 30214 * @static 30215 * @memberOf _ 30216 * @since 4.0.0 30217 * @category Object 30218 * @param {Object} object The object to query. 30219 * @param {Array|string} path The path to check. 30220 * @returns {boolean} Returns `true` if `path` exists, else `false`. 30221 * @example 30222 * 30223 * var object = _.create({ 'a': _.create({ 'b': 2 }) }); 30224 * 30225 * _.hasIn(object, 'a'); 30226 * // => true 30227 * 30228 * _.hasIn(object, 'a.b'); 30229 * // => true 30230 * 30231 * _.hasIn(object, ['a', 'b']); 30232 * // => true 30233 * 30234 * _.hasIn(object, 'b'); 30235 * // => false 30236 */ 30237 function hasIn(object, path) { 30238 return object != null && hasPath(object, path, baseHasIn); 30239 } 30240 30241 /** 30242 * Creates an object composed of the inverted keys and values of `object`. 30243 * If `object` contains duplicate values, subsequent values overwrite 30244 * property assignments of previous values. 30245 * 30246 * @static 30247 * @memberOf _ 30248 * @since 0.7.0 30249 * @category Object 30250 * @param {Object} object The object to invert. 30251 * @returns {Object} Returns the new inverted object. 30252 * @example 30253 * 30254 * var object = { 'a': 1, 'b': 2, 'c': 1 }; 30255 * 30256 * _.invert(object); 30257 * // => { '1': 'c', '2': 'b' } 30258 */ 30259 var invert = createInverter(function(result, value, key) { 30260 if (value != null && 30261 typeof value.toString != 'function') { 30262 value = nativeObjectToString.call(value); 30263 } 30264 30265 result[value] = key; 30266 }, constant(identity)); 30267 30268 /** 30269 * This method is like `_.invert` except that the inverted object is generated 30270 * from the results of running each element of `object` thru `iteratee`. The 30271 * corresponding inverted value of each inverted key is an array of keys 30272 * responsible for generating the inverted value. The iteratee is invoked 30273 * with one argument: (value). 30274 * 30275 * @static 30276 * @memberOf _ 30277 * @since 4.1.0 30278 * @category Object 30279 * @param {Object} object The object to invert. 30280 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 30281 * @returns {Object} Returns the new inverted object. 30282 * @example 30283 * 30284 * var object = { 'a': 1, 'b': 2, 'c': 1 }; 30285 * 30286 * _.invertBy(object); 30287 * // => { '1': ['a', 'c'], '2': ['b'] } 30288 * 30289 * _.invertBy(object, function(value) { 30290 * return 'group' + value; 30291 * }); 30292 * // => { 'group1': ['a', 'c'], 'group2': ['b'] } 30293 */ 30294 var invertBy = createInverter(function(result, value, key) { 30295 if (value != null && 30296 typeof value.toString != 'function') { 30297 value = nativeObjectToString.call(value); 30298 } 30299 30300 if (hasOwnProperty.call(result, value)) { 30301 result[value].push(key); 30302 } else { 30303 result[value] = [key]; 30304 } 30305 }, getIteratee); 30306 30307 /** 30308 * Invokes the method at `path` of `object`. 30309 * 30310 * @static 30311 * @memberOf _ 30312 * @since 4.0.0 30313 * @category Object 30314 * @param {Object} object The object to query. 30315 * @param {Array|string} path The path of the method to invoke. 30316 * @param {...*} [args] The arguments to invoke the method with. 30317 * @returns {*} Returns the result of the invoked method. 30318 * @example 30319 * 30320 * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; 30321 * 30322 * _.invoke(object, 'a[0].b.c.slice', 1, 3); 30323 * // => [2, 3] 30324 */ 30325 var invoke = baseRest(baseInvoke); 30326 30327 /** 30328 * Creates an array of the own enumerable property names of `object`. 30329 * 30330 * **Note:** Non-object values are coerced to objects. See the 30331 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) 30332 * for more details. 30333 * 30334 * @static 30335 * @since 0.1.0 30336 * @memberOf _ 30337 * @category Object 30338 * @param {Object} object The object to query. 30339 * @returns {Array} Returns the array of property names. 30340 * @example 30341 * 30342 * function Foo() { 30343 * this.a = 1; 30344 * this.b = 2; 30345 * } 30346 * 30347 * Foo.prototype.c = 3; 30348 * 30349 * _.keys(new Foo); 30350 * // => ['a', 'b'] (iteration order is not guaranteed) 30351 * 30352 * _.keys('hi'); 30353 * // => ['0', '1'] 30354 */ 30355 function keys(object) { 30356 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); 30357 } 30358 30359 /** 30360 * Creates an array of the own and inherited enumerable property names of `object`. 30361 * 30362 * **Note:** Non-object values are coerced to objects. 30363 * 30364 * @static 30365 * @memberOf _ 30366 * @since 3.0.0 30367 * @category Object 30368 * @param {Object} object The object to query. 30369 * @returns {Array} Returns the array of property names. 30370 * @example 30371 * 30372 * function Foo() { 30373 * this.a = 1; 30374 * this.b = 2; 30375 * } 30376 * 30377 * Foo.prototype.c = 3; 30378 * 30379 * _.keysIn(new Foo); 30380 * // => ['a', 'b', 'c'] (iteration order is not guaranteed) 30381 */ 30382 function keysIn(object) { 30383 return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); 30384 } 30385 30386 /** 30387 * The opposite of `_.mapValues`; this method creates an object with the 30388 * same values as `object` and keys generated by running each own enumerable 30389 * string keyed property of `object` thru `iteratee`. The iteratee is invoked 30390 * with three arguments: (value, key, object). 30391 * 30392 * @static 30393 * @memberOf _ 30394 * @since 3.8.0 30395 * @category Object 30396 * @param {Object} object The object to iterate over. 30397 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 30398 * @returns {Object} Returns the new mapped object. 30399 * @see _.mapValues 30400 * @example 30401 * 30402 * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { 30403 * return key + value; 30404 * }); 30405 * // => { 'a1': 1, 'b2': 2 } 30406 */ 30407 function mapKeys(object, iteratee) { 30408 var result = {}; 30409 iteratee = getIteratee(iteratee, 3); 30410 30411 baseForOwn(object, function(value, key, object) { 30412 baseAssignValue(result, iteratee(value, key, object), value); 30413 }); 30414 return result; 30415 } 30416 30417 /** 30418 * Creates an object with the same keys as `object` and values generated 30419 * by running each own enumerable string keyed property of `object` thru 30420 * `iteratee`. The iteratee is invoked with three arguments: 30421 * (value, key, object). 30422 * 30423 * @static 30424 * @memberOf _ 30425 * @since 2.4.0 30426 * @category Object 30427 * @param {Object} object The object to iterate over. 30428 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 30429 * @returns {Object} Returns the new mapped object. 30430 * @see _.mapKeys 30431 * @example 30432 * 30433 * var users = { 30434 * 'fred': { 'user': 'fred', 'age': 40 }, 30435 * 'pebbles': { 'user': 'pebbles', 'age': 1 } 30436 * }; 30437 * 30438 * _.mapValues(users, function(o) { return o.age; }); 30439 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) 30440 * 30441 * // The `_.property` iteratee shorthand. 30442 * _.mapValues(users, 'age'); 30443 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) 30444 */ 30445 function mapValues(object, iteratee) { 30446 var result = {}; 30447 iteratee = getIteratee(iteratee, 3); 30448 30449 baseForOwn(object, function(value, key, object) { 30450 baseAssignValue(result, key, iteratee(value, key, object)); 30451 }); 30452 return result; 30453 } 30454 30455 /** 30456 * This method is like `_.assign` except that it recursively merges own and 30457 * inherited enumerable string keyed properties of source objects into the 30458 * destination object. Source properties that resolve to `undefined` are 30459 * skipped if a destination value exists. Array and plain object properties 30460 * are merged recursively. Other objects and value types are overridden by 30461 * assignment. Source objects are applied from left to right. Subsequent 30462 * sources overwrite property assignments of previous sources. 30463 * 30464 * **Note:** This method mutates `object`. 30465 * 30466 * @static 30467 * @memberOf _ 30468 * @since 0.5.0 30469 * @category Object 30470 * @param {Object} object The destination object. 30471 * @param {...Object} [sources] The source objects. 30472 * @returns {Object} Returns `object`. 30473 * @example 30474 * 30475 * var object = { 30476 * 'a': [{ 'b': 2 }, { 'd': 4 }] 30477 * }; 30478 * 30479 * var other = { 30480 * 'a': [{ 'c': 3 }, { 'e': 5 }] 30481 * }; 30482 * 30483 * _.merge(object, other); 30484 * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } 30485 */ 30486 var merge = createAssigner(function(object, source, srcIndex) { 30487 baseMerge(object, source, srcIndex); 30488 }); 30489 30490 /** 30491 * This method is like `_.merge` except that it accepts `customizer` which 30492 * is invoked to produce the merged values of the destination and source 30493 * properties. If `customizer` returns `undefined`, merging is handled by the 30494 * method instead. The `customizer` is invoked with six arguments: 30495 * (objValue, srcValue, key, object, source, stack). 30496 * 30497 * **Note:** This method mutates `object`. 30498 * 30499 * @static 30500 * @memberOf _ 30501 * @since 4.0.0 30502 * @category Object 30503 * @param {Object} object The destination object. 30504 * @param {...Object} sources The source objects. 30505 * @param {Function} customizer The function to customize assigned values. 30506 * @returns {Object} Returns `object`. 30507 * @example 30508 * 30509 * function customizer(objValue, srcValue) { 30510 * if (_.isArray(objValue)) { 30511 * return objValue.concat(srcValue); 30512 * } 30513 * } 30514 * 30515 * var object = { 'a': [1], 'b': [2] }; 30516 * var other = { 'a': [3], 'b': [4] }; 30517 * 30518 * _.mergeWith(object, other, customizer); 30519 * // => { 'a': [1, 3], 'b': [2, 4] } 30520 */ 30521 var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { 30522 baseMerge(object, source, srcIndex, customizer); 30523 }); 30524 30525 /** 30526 * The opposite of `_.pick`; this method creates an object composed of the 30527 * own and inherited enumerable property paths of `object` that are not omitted. 30528 * 30529 * **Note:** This method is considerably slower than `_.pick`. 30530 * 30531 * @static 30532 * @since 0.1.0 30533 * @memberOf _ 30534 * @category Object 30535 * @param {Object} object The source object. 30536 * @param {...(string|string[])} [paths] The property paths to omit. 30537 * @returns {Object} Returns the new object. 30538 * @example 30539 * 30540 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 30541 * 30542 * _.omit(object, ['a', 'c']); 30543 * // => { 'b': '2' } 30544 */ 30545 var omit = flatRest(function(object, paths) { 30546 var result = {}; 30547 if (object == null) { 30548 return result; 30549 } 30550 var isDeep = false; 30551 paths = arrayMap(paths, function(path) { 30552 path = castPath(path, object); 30553 isDeep || (isDeep = path.length > 1); 30554 return path; 30555 }); 30556 copyObject(object, getAllKeysIn(object), result); 30557 if (isDeep) { 30558 result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); 30559 } 30560 var length = paths.length; 30561 while (length--) { 30562 baseUnset(result, paths[length]); 30563 } 30564 return result; 30565 }); 30566 30567 /** 30568 * The opposite of `_.pickBy`; this method creates an object composed of 30569 * the own and inherited enumerable string keyed properties of `object` that 30570 * `predicate` doesn't return truthy for. The predicate is invoked with two 30571 * arguments: (value, key). 30572 * 30573 * @static 30574 * @memberOf _ 30575 * @since 4.0.0 30576 * @category Object 30577 * @param {Object} object The source object. 30578 * @param {Function} [predicate=_.identity] The function invoked per property. 30579 * @returns {Object} Returns the new object. 30580 * @example 30581 * 30582 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 30583 * 30584 * _.omitBy(object, _.isNumber); 30585 * // => { 'b': '2' } 30586 */ 30587 function omitBy(object, predicate) { 30588 return pickBy(object, negate(getIteratee(predicate))); 30589 } 30590 30591 /** 30592 * Creates an object composed of the picked `object` properties. 30593 * 30594 * @static 30595 * @since 0.1.0 30596 * @memberOf _ 30597 * @category Object 30598 * @param {Object} object The source object. 30599 * @param {...(string|string[])} [paths] The property paths to pick. 30600 * @returns {Object} Returns the new object. 30601 * @example 30602 * 30603 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 30604 * 30605 * _.pick(object, ['a', 'c']); 30606 * // => { 'a': 1, 'c': 3 } 30607 */ 30608 var pick = flatRest(function(object, paths) { 30609 return object == null ? {} : basePick(object, paths); 30610 }); 30611 30612 /** 30613 * Creates an object composed of the `object` properties `predicate` returns 30614 * truthy for. The predicate is invoked with two arguments: (value, key). 30615 * 30616 * @static 30617 * @memberOf _ 30618 * @since 4.0.0 30619 * @category Object 30620 * @param {Object} object The source object. 30621 * @param {Function} [predicate=_.identity] The function invoked per property. 30622 * @returns {Object} Returns the new object. 30623 * @example 30624 * 30625 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 30626 * 30627 * _.pickBy(object, _.isNumber); 30628 * // => { 'a': 1, 'c': 3 } 30629 */ 30630 function pickBy(object, predicate) { 30631 if (object == null) { 30632 return {}; 30633 } 30634 var props = arrayMap(getAllKeysIn(object), function(prop) { 30635 return [prop]; 30636 }); 30637 predicate = getIteratee(predicate); 30638 return basePickBy(object, props, function(value, path) { 30639 return predicate(value, path[0]); 30640 }); 30641 } 30642 30643 /** 30644 * This method is like `_.get` except that if the resolved value is a 30645 * function it's invoked with the `this` binding of its parent object and 30646 * its result is returned. 30647 * 30648 * @static 30649 * @since 0.1.0 30650 * @memberOf _ 30651 * @category Object 30652 * @param {Object} object The object to query. 30653 * @param {Array|string} path The path of the property to resolve. 30654 * @param {*} [defaultValue] The value returned for `undefined` resolved values. 30655 * @returns {*} Returns the resolved value. 30656 * @example 30657 * 30658 * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; 30659 * 30660 * _.result(object, 'a[0].b.c1'); 30661 * // => 3 30662 * 30663 * _.result(object, 'a[0].b.c2'); 30664 * // => 4 30665 * 30666 * _.result(object, 'a[0].b.c3', 'default'); 30667 * // => 'default' 30668 * 30669 * _.result(object, 'a[0].b.c3', _.constant('default')); 30670 * // => 'default' 30671 */ 30672 function result(object, path, defaultValue) { 30673 path = castPath(path, object); 30674 30675 var index = -1, 30676 length = path.length; 30677 30678 // Ensure the loop is entered when path is empty. 30679 if (!length) { 30680 length = 1; 30681 object = undefined; 30682 } 30683 while (++index < length) { 30684 var value = object == null ? undefined : object[toKey(path[index])]; 30685 if (value === undefined) { 30686 index = length; 30687 value = defaultValue; 30688 } 30689 object = isFunction(value) ? value.call(object) : value; 30690 } 30691 return object; 30692 } 30693 30694 /** 30695 * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, 30696 * it's created. Arrays are created for missing index properties while objects 30697 * are created for all other missing properties. Use `_.setWith` to customize 30698 * `path` creation. 30699 * 30700 * **Note:** This method mutates `object`. 30701 * 30702 * @static 30703 * @memberOf _ 30704 * @since 3.7.0 30705 * @category Object 30706 * @param {Object} object The object to modify. 30707 * @param {Array|string} path The path of the property to set. 30708 * @param {*} value The value to set. 30709 * @returns {Object} Returns `object`. 30710 * @example 30711 * 30712 * var object = { 'a': [{ 'b': { 'c': 3 } }] }; 30713 * 30714 * _.set(object, 'a[0].b.c', 4); 30715 * console.log(object.a[0].b.c); 30716 * // => 4 30717 * 30718 * _.set(object, ['x', '0', 'y', 'z'], 5); 30719 * console.log(object.x[0].y.z); 30720 * // => 5 30721 */ 30722 function set(object, path, value) { 30723 return object == null ? object : baseSet(object, path, value); 30724 } 30725 30726 /** 30727 * This method is like `_.set` except that it accepts `customizer` which is 30728 * invoked to produce the objects of `path`. If `customizer` returns `undefined` 30729 * path creation is handled by the method instead. The `customizer` is invoked 30730 * with three arguments: (nsValue, key, nsObject). 30731 * 30732 * **Note:** This method mutates `object`. 30733 * 30734 * @static 30735 * @memberOf _ 30736 * @since 4.0.0 30737 * @category Object 30738 * @param {Object} object The object to modify. 30739 * @param {Array|string} path The path of the property to set. 30740 * @param {*} value The value to set. 30741 * @param {Function} [customizer] The function to customize assigned values. 30742 * @returns {Object} Returns `object`. 30743 * @example 30744 * 30745 * var object = {}; 30746 * 30747 * _.setWith(object, '[0][1]', 'a', Object); 30748 * // => { '0': { '1': 'a' } } 30749 */ 30750 function setWith(object, path, value, customizer) { 30751 customizer = typeof customizer == 'function' ? customizer : undefined; 30752 return object == null ? object : baseSet(object, path, value, customizer); 30753 } 30754 30755 /** 30756 * Creates an array of own enumerable string keyed-value pairs for `object` 30757 * which can be consumed by `_.fromPairs`. If `object` is a map or set, its 30758 * entries are returned. 30759 * 30760 * @static 30761 * @memberOf _ 30762 * @since 4.0.0 30763 * @alias entries 30764 * @category Object 30765 * @param {Object} object The object to query. 30766 * @returns {Array} Returns the key-value pairs. 30767 * @example 30768 * 30769 * function Foo() { 30770 * this.a = 1; 30771 * this.b = 2; 30772 * } 30773 * 30774 * Foo.prototype.c = 3; 30775 * 30776 * _.toPairs(new Foo); 30777 * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) 30778 */ 30779 var toPairs = createToPairs(keys); 30780 30781 /** 30782 * Creates an array of own and inherited enumerable string keyed-value pairs 30783 * for `object` which can be consumed by `_.fromPairs`. If `object` is a map 30784 * or set, its entries are returned. 30785 * 30786 * @static 30787 * @memberOf _ 30788 * @since 4.0.0 30789 * @alias entriesIn 30790 * @category Object 30791 * @param {Object} object The object to query. 30792 * @returns {Array} Returns the key-value pairs. 30793 * @example 30794 * 30795 * function Foo() { 30796 * this.a = 1; 30797 * this.b = 2; 30798 * } 30799 * 30800 * Foo.prototype.c = 3; 30801 * 30802 * _.toPairsIn(new Foo); 30803 * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed) 30804 */ 30805 var toPairsIn = createToPairs(keysIn); 30806 30807 /** 30808 * An alternative to `_.reduce`; this method transforms `object` to a new 30809 * `accumulator` object which is the result of running each of its own 30810 * enumerable string keyed properties thru `iteratee`, with each invocation 30811 * potentially mutating the `accumulator` object. If `accumulator` is not 30812 * provided, a new object with the same `[[Prototype]]` will be used. The 30813 * iteratee is invoked with four arguments: (accumulator, value, key, object). 30814 * Iteratee functions may exit iteration early by explicitly returning `false`. 30815 * 30816 * @static 30817 * @memberOf _ 30818 * @since 1.3.0 30819 * @category Object 30820 * @param {Object} object The object to iterate over. 30821 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 30822 * @param {*} [accumulator] The custom accumulator value. 30823 * @returns {*} Returns the accumulated value. 30824 * @example 30825 * 30826 * _.transform([2, 3, 4], function(result, n) { 30827 * result.push(n *= n); 30828 * return n % 2 == 0; 30829 * }, []); 30830 * // => [4, 9] 30831 * 30832 * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { 30833 * (result[value] || (result[value] = [])).push(key); 30834 * }, {}); 30835 * // => { '1': ['a', 'c'], '2': ['b'] } 30836 */ 30837 function transform(object, iteratee, accumulator) { 30838 var isArr = isArray(object), 30839 isArrLike = isArr || isBuffer(object) || isTypedArray(object); 30840 30841 iteratee = getIteratee(iteratee, 4); 30842 if (accumulator == null) { 30843 var Ctor = object && object.constructor; 30844 if (isArrLike) { 30845 accumulator = isArr ? new Ctor : []; 30846 } 30847 else if (isObject(object)) { 30848 accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; 30849 } 30850 else { 30851 accumulator = {}; 30852 } 30853 } 30854 (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) { 30855 return iteratee(accumulator, value, index, object); 30856 }); 30857 return accumulator; 30858 } 30859 30860 /** 30861 * Removes the property at `path` of `object`. 30862 * 30863 * **Note:** This method mutates `object`. 30864 * 30865 * @static 30866 * @memberOf _ 30867 * @since 4.0.0 30868 * @category Object 30869 * @param {Object} object The object to modify. 30870 * @param {Array|string} path The path of the property to unset. 30871 * @returns {boolean} Returns `true` if the property is deleted, else `false`. 30872 * @example 30873 * 30874 * var object = { 'a': [{ 'b': { 'c': 7 } }] }; 30875 * _.unset(object, 'a[0].b.c'); 30876 * // => true 30877 * 30878 * console.log(object); 30879 * // => { 'a': [{ 'b': {} }] }; 30880 * 30881 * _.unset(object, ['a', '0', 'b', 'c']); 30882 * // => true 30883 * 30884 * console.log(object); 30885 * // => { 'a': [{ 'b': {} }] }; 30886 */ 30887 function unset(object, path) { 30888 return object == null ? true : baseUnset(object, path); 30889 } 30890 30891 /** 30892 * This method is like `_.set` except that accepts `updater` to produce the 30893 * value to set. Use `_.updateWith` to customize `path` creation. The `updater` 30894 * is invoked with one argument: (value). 30895 * 30896 * **Note:** This method mutates `object`. 30897 * 30898 * @static 30899 * @memberOf _ 30900 * @since 4.6.0 30901 * @category Object 30902 * @param {Object} object The object to modify. 30903 * @param {Array|string} path The path of the property to set. 30904 * @param {Function} updater The function to produce the updated value. 30905 * @returns {Object} Returns `object`. 30906 * @example 30907 * 30908 * var object = { 'a': [{ 'b': { 'c': 3 } }] }; 30909 * 30910 * _.update(object, 'a[0].b.c', function(n) { return n * n; }); 30911 * console.log(object.a[0].b.c); 30912 * // => 9 30913 * 30914 * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); 30915 * console.log(object.x[0].y.z); 30916 * // => 0 30917 */ 30918 function update(object, path, updater) { 30919 return object == null ? object : baseUpdate(object, path, castFunction(updater)); 30920 } 30921 30922 /** 30923 * This method is like `_.update` except that it accepts `customizer` which is 30924 * invoked to produce the objects of `path`. If `customizer` returns `undefined` 30925 * path creation is handled by the method instead. The `customizer` is invoked 30926 * with three arguments: (nsValue, key, nsObject). 30927 * 30928 * **Note:** This method mutates `object`. 30929 * 30930 * @static 30931 * @memberOf _ 30932 * @since 4.6.0 30933 * @category Object 30934 * @param {Object} object The object to modify. 30935 * @param {Array|string} path The path of the property to set. 30936 * @param {Function} updater The function to produce the updated value. 30937 * @param {Function} [customizer] The function to customize assigned values. 30938 * @returns {Object} Returns `object`. 30939 * @example 30940 * 30941 * var object = {}; 30942 * 30943 * _.updateWith(object, '[0][1]', _.constant('a'), Object); 30944 * // => { '0': { '1': 'a' } } 30945 */ 30946 function updateWith(object, path, updater, customizer) { 30947 customizer = typeof customizer == 'function' ? customizer : undefined; 30948 return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); 30949 } 30950 30951 /** 30952 * Creates an array of the own enumerable string keyed property values of `object`. 30953 * 30954 * **Note:** Non-object values are coerced to objects. 30955 * 30956 * @static 30957 * @since 0.1.0 30958 * @memberOf _ 30959 * @category Object 30960 * @param {Object} object The object to query. 30961 * @returns {Array} Returns the array of property values. 30962 * @example 30963 * 30964 * function Foo() { 30965 * this.a = 1; 30966 * this.b = 2; 30967 * } 30968 * 30969 * Foo.prototype.c = 3; 30970 * 30971 * _.values(new Foo); 30972 * // => [1, 2] (iteration order is not guaranteed) 30973 * 30974 * _.values('hi'); 30975 * // => ['h', 'i'] 30976 */ 30977 function values(object) { 30978 return object == null ? [] : baseValues(object, keys(object)); 30979 } 30980 30981 /** 30982 * Creates an array of the own and inherited enumerable string keyed property 30983 * values of `object`. 30984 * 30985 * **Note:** Non-object values are coerced to objects. 30986 * 30987 * @static 30988 * @memberOf _ 30989 * @since 3.0.0 30990 * @category Object 30991 * @param {Object} object The object to query. 30992 * @returns {Array} Returns the array of property values. 30993 * @example 30994 * 30995 * function Foo() { 30996 * this.a = 1; 30997 * this.b = 2; 30998 * } 30999 * 31000 * Foo.prototype.c = 3; 31001 * 31002 * _.valuesIn(new Foo); 31003 * // => [1, 2, 3] (iteration order is not guaranteed) 31004 */ 31005 function valuesIn(object) { 31006 return object == null ? [] : baseValues(object, keysIn(object)); 31007 } 31008 31009 /*------------------------------------------------------------------------*/ 31010 31011 /** 31012 * Clamps `number` within the inclusive `lower` and `upper` bounds. 31013 * 31014 * @static 31015 * @memberOf _ 31016 * @since 4.0.0 31017 * @category Number 31018 * @param {number} number The number to clamp. 31019 * @param {number} [lower] The lower bound. 31020 * @param {number} upper The upper bound. 31021 * @returns {number} Returns the clamped number. 31022 * @example 31023 * 31024 * _.clamp(-10, -5, 5); 31025 * // => -5 31026 * 31027 * _.clamp(10, -5, 5); 31028 * // => 5 31029 */ 31030 function clamp(number, lower, upper) { 31031 if (upper === undefined) { 31032 upper = lower; 31033 lower = undefined; 31034 } 31035 if (upper !== undefined) { 31036 upper = toNumber(upper); 31037 upper = upper === upper ? upper : 0; 31038 } 31039 if (lower !== undefined) { 31040 lower = toNumber(lower); 31041 lower = lower === lower ? lower : 0; 31042 } 31043 return baseClamp(toNumber(number), lower, upper); 31044 } 31045 31046 /** 31047 * Checks if `n` is between `start` and up to, but not including, `end`. If 31048 * `end` is not specified, it's set to `start` with `start` then set to `0`. 31049 * If `start` is greater than `end` the params are swapped to support 31050 * negative ranges. 31051 * 31052 * @static 31053 * @memberOf _ 31054 * @since 3.3.0 31055 * @category Number 31056 * @param {number} number The number to check. 31057 * @param {number} [start=0] The start of the range. 31058 * @param {number} end The end of the range. 31059 * @returns {boolean} Returns `true` if `number` is in the range, else `false`. 31060 * @see _.range, _.rangeRight 31061 * @example 31062 * 31063 * _.inRange(3, 2, 4); 31064 * // => true 31065 * 31066 * _.inRange(4, 8); 31067 * // => true 31068 * 31069 * _.inRange(4, 2); 31070 * // => false 31071 * 31072 * _.inRange(2, 2); 31073 * // => false 31074 * 31075 * _.inRange(1.2, 2); 31076 * // => true 31077 * 31078 * _.inRange(5.2, 4); 31079 * // => false 31080 * 31081 * _.inRange(-3, -2, -6); 31082 * // => true 31083 */ 31084 function inRange(number, start, end) { 31085 start = toFinite(start); 31086 if (end === undefined) { 31087 end = start; 31088 start = 0; 31089 } else { 31090 end = toFinite(end); 31091 } 31092 number = toNumber(number); 31093 return baseInRange(number, start, end); 31094 } 31095 31096 /** 31097 * Produces a random number between the inclusive `lower` and `upper` bounds. 31098 * If only one argument is provided a number between `0` and the given number 31099 * is returned. If `floating` is `true`, or either `lower` or `upper` are 31100 * floats, a floating-point number is returned instead of an integer. 31101 * 31102 * **Note:** JavaScript follows the IEEE-754 standard for resolving 31103 * floating-point values which can produce unexpected results. 31104 * 31105 * @static 31106 * @memberOf _ 31107 * @since 0.7.0 31108 * @category Number 31109 * @param {number} [lower=0] The lower bound. 31110 * @param {number} [upper=1] The upper bound. 31111 * @param {boolean} [floating] Specify returning a floating-point number. 31112 * @returns {number} Returns the random number. 31113 * @example 31114 * 31115 * _.random(0, 5); 31116 * // => an integer between 0 and 5 31117 * 31118 * _.random(5); 31119 * // => also an integer between 0 and 5 31120 * 31121 * _.random(5, true); 31122 * // => a floating-point number between 0 and 5 31123 * 31124 * _.random(1.2, 5.2); 31125 * // => a floating-point number between 1.2 and 5.2 31126 */ 31127 function random(lower, upper, floating) { 31128 if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { 31129 upper = floating = undefined; 31130 } 31131 if (floating === undefined) { 31132 if (typeof upper == 'boolean') { 31133 floating = upper; 31134 upper = undefined; 31135 } 31136 else if (typeof lower == 'boolean') { 31137 floating = lower; 31138 lower = undefined; 31139 } 31140 } 31141 if (lower === undefined && upper === undefined) { 31142 lower = 0; 31143 upper = 1; 31144 } 31145 else { 31146 lower = toFinite(lower); 31147 if (upper === undefined) { 31148 upper = lower; 31149 lower = 0; 31150 } else { 31151 upper = toFinite(upper); 31152 } 31153 } 31154 if (lower > upper) { 31155 var temp = lower; 31156 lower = upper; 31157 upper = temp; 31158 } 31159 if (floating || lower % 1 || upper % 1) { 31160 var rand = nativeRandom(); 31161 return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); 31162 } 31163 return baseRandom(lower, upper); 31164 } 31165 31166 /*------------------------------------------------------------------------*/ 31167 31168 /** 31169 * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). 31170 * 31171 * @static 31172 * @memberOf _ 31173 * @since 3.0.0 31174 * @category String 31175 * @param {string} [string=''] The string to convert. 31176 * @returns {string} Returns the camel cased string. 31177 * @example 31178 * 31179 * _.camelCase('Foo Bar'); 31180 * // => 'fooBar' 31181 * 31182 * _.camelCase('--foo-bar--'); 31183 * // => 'fooBar' 31184 * 31185 * _.camelCase('__FOO_BAR__'); 31186 * // => 'fooBar' 31187 */ 31188 var camelCase = createCompounder(function(result, word, index) { 31189 word = word.toLowerCase(); 31190 return result + (index ? capitalize(word) : word); 31191 }); 31192 31193 /** 31194 * Converts the first character of `string` to upper case and the remaining 31195 * to lower case. 31196 * 31197 * @static 31198 * @memberOf _ 31199 * @since 3.0.0 31200 * @category String 31201 * @param {string} [string=''] The string to capitalize. 31202 * @returns {string} Returns the capitalized string. 31203 * @example 31204 * 31205 * _.capitalize('FRED'); 31206 * // => 'Fred' 31207 */ 31208 function capitalize(string) { 31209 return upperFirst(toString(string).toLowerCase()); 31210 } 31211 31212 /** 31213 * Deburrs `string` by converting 31214 * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) 31215 * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) 31216 * letters to basic Latin letters and removing 31217 * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). 31218 * 31219 * @static 31220 * @memberOf _ 31221 * @since 3.0.0 31222 * @category String 31223 * @param {string} [string=''] The string to deburr. 31224 * @returns {string} Returns the deburred string. 31225 * @example 31226 * 31227 * _.deburr('déjàvu'); 31228 * // => 'deja vu' 31229 */ 31230 function deburr(string) { 31231 string = toString(string); 31232 return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); 31233 } 31234 31235 /** 31236 * Checks if `string` ends with the given target string. 31237 * 31238 * @static 31239 * @memberOf _ 31240 * @since 3.0.0 31241 * @category String 31242 * @param {string} [string=''] The string to inspect. 31243 * @param {string} [target] The string to search for. 31244 * @param {number} [position=string.length] The position to search up to. 31245 * @returns {boolean} Returns `true` if `string` ends with `target`, 31246 * else `false`. 31247 * @example 31248 * 31249 * _.endsWith('abc', 'c'); 31250 * // => true 31251 * 31252 * _.endsWith('abc', 'b'); 31253 * // => false 31254 * 31255 * _.endsWith('abc', 'b', 2); 31256 * // => true 31257 */ 31258 function endsWith(string, target, position) { 31259 string = toString(string); 31260 target = baseToString(target); 31261 31262 var length = string.length; 31263 position = position === undefined 31264 ? length 31265 : baseClamp(toInteger(position), 0, length); 31266 31267 var end = position; 31268 position -= target.length; 31269 return position >= 0 && string.slice(position, end) == target; 31270 } 31271 31272 /** 31273 * Converts the characters "&", "<", ">", '"', and "'" in `string` to their 31274 * corresponding HTML entities. 31275 * 31276 * **Note:** No other characters are escaped. To escape additional 31277 * characters use a third-party library like [_he_](https://mths.be/he). 31278 * 31279 * Though the ">" character is escaped for symmetry, characters like 31280 * ">" and "/" don't need escaping in HTML and have no special meaning 31281 * unless they're part of a tag or unquoted attribute value. See 31282 * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) 31283 * (under "semi-related fun fact") for more details. 31284 * 31285 * When working with HTML you should always 31286 * [quote attribute values](http://wonko.com/post/html-escaping) to reduce 31287 * XSS vectors. 31288 * 31289 * @static 31290 * @since 0.1.0 31291 * @memberOf _ 31292 * @category String 31293 * @param {string} [string=''] The string to escape. 31294 * @returns {string} Returns the escaped string. 31295 * @example 31296 * 31297 * _.escape('fred, barney, & pebbles'); 31298 * // => 'fred, barney, & pebbles' 31299 */ 31300 function escape(string) { 31301 string = toString(string); 31302 return (string && reHasUnescapedHtml.test(string)) 31303 ? string.replace(reUnescapedHtml, escapeHtmlChar) 31304 : string; 31305 } 31306 31307 /** 31308 * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", 31309 * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. 31310 * 31311 * @static 31312 * @memberOf _ 31313 * @since 3.0.0 31314 * @category String 31315 * @param {string} [string=''] The string to escape. 31316 * @returns {string} Returns the escaped string. 31317 * @example 31318 * 31319 * _.escapeRegExp('[lodash](https://lodash.com/)'); 31320 * // => '\[lodash\]\(https://lodash\.com/\)' 31321 */ 31322 function escapeRegExp(string) { 31323 string = toString(string); 31324 return (string && reHasRegExpChar.test(string)) 31325 ? string.replace(reRegExpChar, '\\$&') 31326 : string; 31327 } 31328 31329 /** 31330 * Converts `string` to 31331 * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). 31332 * 31333 * @static 31334 * @memberOf _ 31335 * @since 3.0.0 31336 * @category String 31337 * @param {string} [string=''] The string to convert. 31338 * @returns {string} Returns the kebab cased string. 31339 * @example 31340 * 31341 * _.kebabCase('Foo Bar'); 31342 * // => 'foo-bar' 31343 * 31344 * _.kebabCase('fooBar'); 31345 * // => 'foo-bar' 31346 * 31347 * _.kebabCase('__FOO_BAR__'); 31348 * // => 'foo-bar' 31349 */ 31350 var kebabCase = createCompounder(function(result, word, index) { 31351 return result + (index ? '-' : '') + word.toLowerCase(); 31352 }); 31353 31354 /** 31355 * Converts `string`, as space separated words, to lower case. 31356 * 31357 * @static 31358 * @memberOf _ 31359 * @since 4.0.0 31360 * @category String 31361 * @param {string} [string=''] The string to convert. 31362 * @returns {string} Returns the lower cased string. 31363 * @example 31364 * 31365 * _.lowerCase('--Foo-Bar--'); 31366 * // => 'foo bar' 31367 * 31368 * _.lowerCase('fooBar'); 31369 * // => 'foo bar' 31370 * 31371 * _.lowerCase('__FOO_BAR__'); 31372 * // => 'foo bar' 31373 */ 31374 var lowerCase = createCompounder(function(result, word, index) { 31375 return result + (index ? ' ' : '') + word.toLowerCase(); 31376 }); 31377 31378 /** 31379 * Converts the first character of `string` to lower case. 31380 * 31381 * @static 31382 * @memberOf _ 31383 * @since 4.0.0 31384 * @category String 31385 * @param {string} [string=''] The string to convert. 31386 * @returns {string} Returns the converted string. 31387 * @example 31388 * 31389 * _.lowerFirst('Fred'); 31390 * // => 'fred' 31391 * 31392 * _.lowerFirst('FRED'); 31393 * // => 'fRED' 31394 */ 31395 var lowerFirst = createCaseFirst('toLowerCase'); 31396 31397 /** 31398 * Pads `string` on the left and right sides if it's shorter than `length`. 31399 * Padding characters are truncated if they can't be evenly divided by `length`. 31400 * 31401 * @static 31402 * @memberOf _ 31403 * @since 3.0.0 31404 * @category String 31405 * @param {string} [string=''] The string to pad. 31406 * @param {number} [length=0] The padding length. 31407 * @param {string} [chars=' '] The string used as padding. 31408 * @returns {string} Returns the padded string. 31409 * @example 31410 * 31411 * _.pad('abc', 8); 31412 * // => ' abc ' 31413 * 31414 * _.pad('abc', 8, '_-'); 31415 * // => '_-abc_-_' 31416 * 31417 * _.pad('abc', 3); 31418 * // => 'abc' 31419 */ 31420 function pad(string, length, chars) { 31421 string = toString(string); 31422 length = toInteger(length); 31423 31424 var strLength = length ? stringSize(string) : 0; 31425 if (!length || strLength >= length) { 31426 return string; 31427 } 31428 var mid = (length - strLength) / 2; 31429 return ( 31430 createPadding(nativeFloor(mid), chars) + 31431 string + 31432 createPadding(nativeCeil(mid), chars) 31433 ); 31434 } 31435 31436 /** 31437 * Pads `string` on the right side if it's shorter than `length`. Padding 31438 * characters are truncated if they exceed `length`. 31439 * 31440 * @static 31441 * @memberOf _ 31442 * @since 4.0.0 31443 * @category String 31444 * @param {string} [string=''] The string to pad. 31445 * @param {number} [length=0] The padding length. 31446 * @param {string} [chars=' '] The string used as padding. 31447 * @returns {string} Returns the padded string. 31448 * @example 31449 * 31450 * _.padEnd('abc', 6); 31451 * // => 'abc ' 31452 * 31453 * _.padEnd('abc', 6, '_-'); 31454 * // => 'abc_-_' 31455 * 31456 * _.padEnd('abc', 3); 31457 * // => 'abc' 31458 */ 31459 function padEnd(string, length, chars) { 31460 string = toString(string); 31461 length = toInteger(length); 31462 31463 var strLength = length ? stringSize(string) : 0; 31464 return (length && strLength < length) 31465 ? (string + createPadding(length - strLength, chars)) 31466 : string; 31467 } 31468 31469 /** 31470 * Pads `string` on the left side if it's shorter than `length`. Padding 31471 * characters are truncated if they exceed `length`. 31472 * 31473 * @static 31474 * @memberOf _ 31475 * @since 4.0.0 31476 * @category String 31477 * @param {string} [string=''] The string to pad. 31478 * @param {number} [length=0] The padding length. 31479 * @param {string} [chars=' '] The string used as padding. 31480 * @returns {string} Returns the padded string. 31481 * @example 31482 * 31483 * _.padStart('abc', 6); 31484 * // => ' abc' 31485 * 31486 * _.padStart('abc', 6, '_-'); 31487 * // => '_-_abc' 31488 * 31489 * _.padStart('abc', 3); 31490 * // => 'abc' 31491 */ 31492 function padStart(string, length, chars) { 31493 string = toString(string); 31494 length = toInteger(length); 31495 31496 var strLength = length ? stringSize(string) : 0; 31497 return (length && strLength < length) 31498 ? (createPadding(length - strLength, chars) + string) 31499 : string; 31500 } 31501 31502 /** 31503 * Converts `string` to an integer of the specified radix. If `radix` is 31504 * `undefined` or `0`, a `radix` of `10` is used unless `value` is a 31505 * hexadecimal, in which case a `radix` of `16` is used. 31506 * 31507 * **Note:** This method aligns with the 31508 * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. 31509 * 31510 * @static 31511 * @memberOf _ 31512 * @since 1.1.0 31513 * @category String 31514 * @param {string} string The string to convert. 31515 * @param {number} [radix=10] The radix to interpret `value` by. 31516 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 31517 * @returns {number} Returns the converted integer. 31518 * @example 31519 * 31520 * _.parseInt('08'); 31521 * // => 8 31522 * 31523 * _.map(['6', '08', '10'], _.parseInt); 31524 * // => [6, 8, 10] 31525 */ 31526 function parseInt(string, radix, guard) { 31527 if (guard || radix == null) { 31528 radix = 0; 31529 } else if (radix) { 31530 radix = +radix; 31531 } 31532 return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0); 31533 } 31534 31535 /** 31536 * Repeats the given string `n` times. 31537 * 31538 * @static 31539 * @memberOf _ 31540 * @since 3.0.0 31541 * @category String 31542 * @param {string} [string=''] The string to repeat. 31543 * @param {number} [n=1] The number of times to repeat the string. 31544 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 31545 * @returns {string} Returns the repeated string. 31546 * @example 31547 * 31548 * _.repeat('*', 3); 31549 * // => '***' 31550 * 31551 * _.repeat('abc', 2); 31552 * // => 'abcabc' 31553 * 31554 * _.repeat('abc', 0); 31555 * // => '' 31556 */ 31557 function repeat(string, n, guard) { 31558 if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) { 31559 n = 1; 31560 } else { 31561 n = toInteger(n); 31562 } 31563 return baseRepeat(toString(string), n); 31564 } 31565 31566 /** 31567 * Replaces matches for `pattern` in `string` with `replacement`. 31568 * 31569 * **Note:** This method is based on 31570 * [`String#replace`](https://mdn.io/String/replace). 31571 * 31572 * @static 31573 * @memberOf _ 31574 * @since 4.0.0 31575 * @category String 31576 * @param {string} [string=''] The string to modify. 31577 * @param {RegExp|string} pattern The pattern to replace. 31578 * @param {Function|string} replacement The match replacement. 31579 * @returns {string} Returns the modified string. 31580 * @example 31581 * 31582 * _.replace('Hi Fred', 'Fred', 'Barney'); 31583 * // => 'Hi Barney' 31584 */ 31585 function replace() { 31586 var args = arguments, 31587 string = toString(args[0]); 31588 31589 return args.length < 3 ? string : string.replace(args[1], args[2]); 31590 } 31591 31592 /** 31593 * Converts `string` to 31594 * [snake case](https://en.wikipedia.org/wiki/Snake_case). 31595 * 31596 * @static 31597 * @memberOf _ 31598 * @since 3.0.0 31599 * @category String 31600 * @param {string} [string=''] The string to convert. 31601 * @returns {string} Returns the snake cased string. 31602 * @example 31603 * 31604 * _.snakeCase('Foo Bar'); 31605 * // => 'foo_bar' 31606 * 31607 * _.snakeCase('fooBar'); 31608 * // => 'foo_bar' 31609 * 31610 * _.snakeCase('--FOO-BAR--'); 31611 * // => 'foo_bar' 31612 */ 31613 var snakeCase = createCompounder(function(result, word, index) { 31614 return result + (index ? '_' : '') + word.toLowerCase(); 31615 }); 31616 31617 /** 31618 * Splits `string` by `separator`. 31619 * 31620 * **Note:** This method is based on 31621 * [`String#split`](https://mdn.io/String/split). 31622 * 31623 * @static 31624 * @memberOf _ 31625 * @since 4.0.0 31626 * @category String 31627 * @param {string} [string=''] The string to split. 31628 * @param {RegExp|string} separator The separator pattern to split by. 31629 * @param {number} [limit] The length to truncate results to. 31630 * @returns {Array} Returns the string segments. 31631 * @example 31632 * 31633 * _.split('a-b-c', '-', 2); 31634 * // => ['a', 'b'] 31635 */ 31636 function split(string, separator, limit) { 31637 if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) { 31638 separator = limit = undefined; 31639 } 31640 limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0; 31641 if (!limit) { 31642 return []; 31643 } 31644 string = toString(string); 31645 if (string && ( 31646 typeof separator == 'string' || 31647 (separator != null && !isRegExp(separator)) 31648 )) { 31649 separator = baseToString(separator); 31650 if (!separator && hasUnicode(string)) { 31651 return castSlice(stringToArray(string), 0, limit); 31652 } 31653 } 31654 return string.split(separator, limit); 31655 } 31656 31657 /** 31658 * Converts `string` to 31659 * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). 31660 * 31661 * @static 31662 * @memberOf _ 31663 * @since 3.1.0 31664 * @category String 31665 * @param {string} [string=''] The string to convert. 31666 * @returns {string} Returns the start cased string. 31667 * @example 31668 * 31669 * _.startCase('--foo-bar--'); 31670 * // => 'Foo Bar' 31671 * 31672 * _.startCase('fooBar'); 31673 * // => 'Foo Bar' 31674 * 31675 * _.startCase('__FOO_BAR__'); 31676 * // => 'FOO BAR' 31677 */ 31678 var startCase = createCompounder(function(result, word, index) { 31679 return result + (index ? ' ' : '') + upperFirst(word); 31680 }); 31681 31682 /** 31683 * Checks if `string` starts with the given target string. 31684 * 31685 * @static 31686 * @memberOf _ 31687 * @since 3.0.0 31688 * @category String 31689 * @param {string} [string=''] The string to inspect. 31690 * @param {string} [target] The string to search for. 31691 * @param {number} [position=0] The position to search from. 31692 * @returns {boolean} Returns `true` if `string` starts with `target`, 31693 * else `false`. 31694 * @example 31695 * 31696 * _.startsWith('abc', 'a'); 31697 * // => true 31698 * 31699 * _.startsWith('abc', 'b'); 31700 * // => false 31701 * 31702 * _.startsWith('abc', 'b', 1); 31703 * // => true 31704 */ 31705 function startsWith(string, target, position) { 31706 string = toString(string); 31707 position = position == null 31708 ? 0 31709 : baseClamp(toInteger(position), 0, string.length); 31710 31711 target = baseToString(target); 31712 return string.slice(position, position + target.length) == target; 31713 } 31714 31715 /** 31716 * Creates a compiled template function that can interpolate data properties 31717 * in "interpolate" delimiters, HTML-escape interpolated data properties in 31718 * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data 31719 * properties may be accessed as free variables in the template. If a setting 31720 * object is given, it takes precedence over `_.templateSettings` values. 31721 * 31722 * **Note:** In the development build `_.template` utilizes 31723 * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) 31724 * for easier debugging. 31725 * 31726 * For more information on precompiling templates see 31727 * [lodash's custom builds documentation](https://lodash.com/custom-builds). 31728 * 31729 * For more information on Chrome extension sandboxes see 31730 * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). 31731 * 31732 * @static 31733 * @since 0.1.0 31734 * @memberOf _ 31735 * @category String 31736 * @param {string} [string=''] The template string. 31737 * @param {Object} [options={}] The options object. 31738 * @param {RegExp} [options.escape=_.templateSettings.escape] 31739 * The HTML "escape" delimiter. 31740 * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] 31741 * The "evaluate" delimiter. 31742 * @param {Object} [options.imports=_.templateSettings.imports] 31743 * An object to import into the template as free variables. 31744 * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] 31745 * The "interpolate" delimiter. 31746 * @param {string} [options.sourceURL='lodash.templateSources[n]'] 31747 * The sourceURL of the compiled template. 31748 * @param {string} [options.variable='obj'] 31749 * The data object variable name. 31750 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 31751 * @returns {Function} Returns the compiled template function. 31752 * @example 31753 * 31754 * // Use the "interpolate" delimiter to create a compiled template. 31755 * var compiled = _.template('hello <%= user %>!'); 31756 * compiled({ 'user': 'fred' }); 31757 * // => 'hello fred!' 31758 * 31759 * // Use the HTML "escape" delimiter to escape data property values. 31760 * var compiled = _.template('<b><%- value %></b>'); 31761 * compiled({ 'value': '<script>' }); 31762 * // => '<b><script></b>' 31763 * 31764 * // Use the "evaluate" delimiter to execute JavaScript and generate HTML. 31765 * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>'); 31766 * compiled({ 'users': ['fred', 'barney'] }); 31767 * // => '<li>fred</li><li>barney</li>' 31768 * 31769 * // Use the internal `print` function in "evaluate" delimiters. 31770 * var compiled = _.template('<% print("hello " + user); %>!'); 31771 * compiled({ 'user': 'barney' }); 31772 * // => 'hello barney!' 31773 * 31774 * // Use the ES template literal delimiter as an "interpolate" delimiter. 31775 * // Disable support by replacing the "interpolate" delimiter. 31776 * var compiled = _.template('hello ${ user }!'); 31777 * compiled({ 'user': 'pebbles' }); 31778 * // => 'hello pebbles!' 31779 * 31780 * // Use backslashes to treat delimiters as plain text. 31781 * var compiled = _.template('<%= "\\<%- value %\\>" %>'); 31782 * compiled({ 'value': 'ignored' }); 31783 * // => '<%- value %>' 31784 * 31785 * // Use the `imports` option to import `jQuery` as `jq`. 31786 * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>'; 31787 * var compiled = _.template(text, { 'imports': { 'jq': jQuery } }); 31788 * compiled({ 'users': ['fred', 'barney'] }); 31789 * // => '<li>fred</li><li>barney</li>' 31790 * 31791 * // Use the `sourceURL` option to specify a custom sourceURL for the template. 31792 * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' }); 31793 * compiled(data); 31794 * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector. 31795 * 31796 * // Use the `variable` option to ensure a with-statement isn't used in the compiled template. 31797 * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' }); 31798 * compiled.source; 31799 * // => function(data) { 31800 * // var __t, __p = ''; 31801 * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!'; 31802 * // return __p; 31803 * // } 31804 * 31805 * // Use custom template delimiters. 31806 * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g; 31807 * var compiled = _.template('hello {{ user }}!'); 31808 * compiled({ 'user': 'mustache' }); 31809 * // => 'hello mustache!' 31810 * 31811 * // Use the `source` property to inline compiled templates for meaningful 31812 * // line numbers in error messages and stack traces. 31813 * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\ 31814 * var JST = {\ 31815 * "main": ' + _.template(mainText).source + '\ 31816 * };\ 31817 * '); 31818 */ 31819 function template(string, options, guard) { 31820 // Based on John Resig's `tmpl` implementation 31821 // (http://ejohn.org/blog/javascript-micro-templating/) 31822 // and Laura Doktorova's doT.js (https://github.com/olado/doT). 31823 var settings = lodash.templateSettings; 31824 31825 if (guard && isIterateeCall(string, options, guard)) { 31826 options = undefined; 31827 } 31828 string = toString(string); 31829 options = assignInWith({}, options, settings, customDefaultsAssignIn); 31830 31831 var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), 31832 importsKeys = keys(imports), 31833 importsValues = baseValues(imports, importsKeys); 31834 31835 var isEscaping, 31836 isEvaluating, 31837 index = 0, 31838 interpolate = options.interpolate || reNoMatch, 31839 source = "__p += '"; 31840 31841 // Compile the regexp to match each delimiter. 31842 var reDelimiters = RegExp( 31843 (options.escape || reNoMatch).source + '|' + 31844 interpolate.source + '|' + 31845 (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' + 31846 (options.evaluate || reNoMatch).source + '|$' 31847 , 'g'); 31848 31849 // Use a sourceURL for easier debugging. 31850 // The sourceURL gets injected into the source that's eval-ed, so be careful 31851 // with lookup (in case of e.g. prototype pollution), and strip newlines if any. 31852 // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection. 31853 var sourceURL = '//# sourceURL=' + 31854 (hasOwnProperty.call(options, 'sourceURL') 31855 ? (options.sourceURL + '').replace(/[\r\n]/g, ' ') 31856 : ('lodash.templateSources[' + (++templateCounter) + ']') 31857 ) + '\n'; 31858 31859 string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { 31860 interpolateValue || (interpolateValue = esTemplateValue); 31861 31862 // Escape characters that can't be included in string literals. 31863 source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar); 31864 31865 // Replace delimiters with snippets. 31866 if (escapeValue) { 31867 isEscaping = true; 31868 source += "' +\n__e(" + escapeValue + ") +\n'"; 31869 } 31870 if (evaluateValue) { 31871 isEvaluating = true; 31872 source += "';\n" + evaluateValue + ";\n__p += '"; 31873 } 31874 if (interpolateValue) { 31875 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; 31876 } 31877 index = offset + match.length; 31878 31879 // The JS engine embedded in Adobe products needs `match` returned in 31880 // order to produce the correct `offset` value. 31881 return match; 31882 }); 31883 31884 source += "';\n"; 31885 31886 // If `variable` is not specified wrap a with-statement around the generated 31887 // code to add the data object to the top of the scope chain. 31888 // Like with sourceURL, we take care to not check the option's prototype, 31889 // as this configuration is a code injection vector. 31890 var variable = hasOwnProperty.call(options, 'variable') && options.variable; 31891 if (!variable) { 31892 source = 'with (obj) {\n' + source + '\n}\n'; 31893 } 31894 // Cleanup code by stripping empty strings. 31895 source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source) 31896 .replace(reEmptyStringMiddle, '$1') 31897 .replace(reEmptyStringTrailing, '$1;'); 31898 31899 // Frame code as the function body. 31900 source = 'function(' + (variable || 'obj') + ') {\n' + 31901 (variable 31902 ? '' 31903 : 'obj || (obj = {});\n' 31904 ) + 31905 "var __t, __p = ''" + 31906 (isEscaping 31907 ? ', __e = _.escape' 31908 : '' 31909 ) + 31910 (isEvaluating 31911 ? ', __j = Array.prototype.join;\n' + 31912 "function print() { __p += __j.call(arguments, '') }\n" 31913 : ';\n' 31914 ) + 31915 source + 31916 'return __p\n}'; 31917 31918 var result = attempt(function() { 31919 return Function(importsKeys, sourceURL + 'return ' + source) 31920 .apply(undefined, importsValues); 31921 }); 31922 31923 // Provide the compiled function's source by its `toString` method or 31924 // the `source` property as a convenience for inlining compiled templates. 31925 result.source = source; 31926 if (isError(result)) { 31927 throw result; 31928 } 31929 return result; 31930 } 31931 31932 /** 31933 * Converts `string`, as a whole, to lower case just like 31934 * [String#toLowerCase](https://mdn.io/toLowerCase). 31935 * 31936 * @static 31937 * @memberOf _ 31938 * @since 4.0.0 31939 * @category String 31940 * @param {string} [string=''] The string to convert. 31941 * @returns {string} Returns the lower cased string. 31942 * @example 31943 * 31944 * _.toLower('--Foo-Bar--'); 31945 * // => '--foo-bar--' 31946 * 31947 * _.toLower('fooBar'); 31948 * // => 'foobar' 31949 * 31950 * _.toLower('__FOO_BAR__'); 31951 * // => '__foo_bar__' 31952 */ 31953 function toLower(value) { 31954 return toString(value).toLowerCase(); 31955 } 31956 31957 /** 31958 * Converts `string`, as a whole, to upper case just like 31959 * [String#toUpperCase](https://mdn.io/toUpperCase). 31960 * 31961 * @static 31962 * @memberOf _ 31963 * @since 4.0.0 31964 * @category String 31965 * @param {string} [string=''] The string to convert. 31966 * @returns {string} Returns the upper cased string. 31967 * @example 31968 * 31969 * _.toUpper('--foo-bar--'); 31970 * // => '--FOO-BAR--' 31971 * 31972 * _.toUpper('fooBar'); 31973 * // => 'FOOBAR' 31974 * 31975 * _.toUpper('__foo_bar__'); 31976 * // => '__FOO_BAR__' 31977 */ 31978 function toUpper(value) { 31979 return toString(value).toUpperCase(); 31980 } 31981 31982 /** 31983 * Removes leading and trailing whitespace or specified characters from `string`. 31984 * 31985 * @static 31986 * @memberOf _ 31987 * @since 3.0.0 31988 * @category String 31989 * @param {string} [string=''] The string to trim. 31990 * @param {string} [chars=whitespace] The characters to trim. 31991 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 31992 * @returns {string} Returns the trimmed string. 31993 * @example 31994 * 31995 * _.trim(' abc '); 31996 * // => 'abc' 31997 * 31998 * _.trim('-_-abc-_-', '_-'); 31999 * // => 'abc' 32000 * 32001 * _.map([' foo ', ' bar '], _.trim); 32002 * // => ['foo', 'bar'] 32003 */ 32004 function trim(string, chars, guard) { 32005 string = toString(string); 32006 if (string && (guard || chars === undefined)) { 32007 return string.replace(reTrim, ''); 32008 } 32009 if (!string || !(chars = baseToString(chars))) { 32010 return string; 32011 } 32012 var strSymbols = stringToArray(string), 32013 chrSymbols = stringToArray(chars), 32014 start = charsStartIndex(strSymbols, chrSymbols), 32015 end = charsEndIndex(strSymbols, chrSymbols) + 1; 32016 32017 return castSlice(strSymbols, start, end).join(''); 32018 } 32019 32020 /** 32021 * Removes trailing whitespace or specified characters from `string`. 32022 * 32023 * @static 32024 * @memberOf _ 32025 * @since 4.0.0 32026 * @category String 32027 * @param {string} [string=''] The string to trim. 32028 * @param {string} [chars=whitespace] The characters to trim. 32029 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 32030 * @returns {string} Returns the trimmed string. 32031 * @example 32032 * 32033 * _.trimEnd(' abc '); 32034 * // => ' abc' 32035 * 32036 * _.trimEnd('-_-abc-_-', '_-'); 32037 * // => '-_-abc' 32038 */ 32039 function trimEnd(string, chars, guard) { 32040 string = toString(string); 32041 if (string && (guard || chars === undefined)) { 32042 return string.replace(reTrimEnd, ''); 32043 } 32044 if (!string || !(chars = baseToString(chars))) { 32045 return string; 32046 } 32047 var strSymbols = stringToArray(string), 32048 end = charsEndIndex(strSymbols, stringToArray(chars)) + 1; 32049 32050 return castSlice(strSymbols, 0, end).join(''); 32051 } 32052 32053 /** 32054 * Removes leading whitespace or specified characters from `string`. 32055 * 32056 * @static 32057 * @memberOf _ 32058 * @since 4.0.0 32059 * @category String 32060 * @param {string} [string=''] The string to trim. 32061 * @param {string} [chars=whitespace] The characters to trim. 32062 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 32063 * @returns {string} Returns the trimmed string. 32064 * @example 32065 * 32066 * _.trimStart(' abc '); 32067 * // => 'abc ' 32068 * 32069 * _.trimStart('-_-abc-_-', '_-'); 32070 * // => 'abc-_-' 32071 */ 32072 function trimStart(string, chars, guard) { 32073 string = toString(string); 32074 if (string && (guard || chars === undefined)) { 32075 return string.replace(reTrimStart, ''); 32076 } 32077 if (!string || !(chars = baseToString(chars))) { 32078 return string; 32079 } 32080 var strSymbols = stringToArray(string), 32081 start = charsStartIndex(strSymbols, stringToArray(chars)); 32082 32083 return castSlice(strSymbols, start).join(''); 32084 } 32085 32086 /** 32087 * Truncates `string` if it's longer than the given maximum string length. 32088 * The last characters of the truncated string are replaced with the omission 32089 * string which defaults to "...". 32090 * 32091 * @static 32092 * @memberOf _ 32093 * @since 4.0.0 32094 * @category String 32095 * @param {string} [string=''] The string to truncate. 32096 * @param {Object} [options={}] The options object. 32097 * @param {number} [options.length=30] The maximum string length. 32098 * @param {string} [options.omission='...'] The string to indicate text is omitted. 32099 * @param {RegExp|string} [options.separator] The separator pattern to truncate to. 32100 * @returns {string} Returns the truncated string. 32101 * @example 32102 * 32103 * _.truncate('hi-diddly-ho there, neighborino'); 32104 * // => 'hi-diddly-ho there, neighbo...' 32105 * 32106 * _.truncate('hi-diddly-ho there, neighborino', { 32107 * 'length': 24, 32108 * 'separator': ' ' 32109 * }); 32110 * // => 'hi-diddly-ho there,...' 32111 * 32112 * _.truncate('hi-diddly-ho there, neighborino', { 32113 * 'length': 24, 32114 * 'separator': /,? +/ 32115 * }); 32116 * // => 'hi-diddly-ho there...' 32117 * 32118 * _.truncate('hi-diddly-ho there, neighborino', { 32119 * 'omission': ' [...]' 32120 * }); 32121 * // => 'hi-diddly-ho there, neig [...]' 32122 */ 32123 function truncate(string, options) { 32124 var length = DEFAULT_TRUNC_LENGTH, 32125 omission = DEFAULT_TRUNC_OMISSION; 32126 32127 if (isObject(options)) { 32128 var separator = 'separator' in options ? options.separator : separator; 32129 length = 'length' in options ? toInteger(options.length) : length; 32130 omission = 'omission' in options ? baseToString(options.omission) : omission; 32131 } 32132 string = toString(string); 32133 32134 var strLength = string.length; 32135 if (hasUnicode(string)) { 32136 var strSymbols = stringToArray(string); 32137 strLength = strSymbols.length; 32138 } 32139 if (length >= strLength) { 32140 return string; 32141 } 32142 var end = length - stringSize(omission); 32143 if (end < 1) { 32144 return omission; 32145 } 32146 var result = strSymbols 32147 ? castSlice(strSymbols, 0, end).join('') 32148 : string.slice(0, end); 32149 32150 if (separator === undefined) { 32151 return result + omission; 32152 } 32153 if (strSymbols) { 32154 end += (result.length - end); 32155 } 32156 if (isRegExp(separator)) { 32157 if (string.slice(end).search(separator)) { 32158 var match, 32159 substring = result; 32160 32161 if (!separator.global) { 32162 separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g'); 32163 } 32164 separator.lastIndex = 0; 32165 while ((match = separator.exec(substring))) { 32166 var newEnd = match.index; 32167 } 32168 result = result.slice(0, newEnd === undefined ? end : newEnd); 32169 } 32170 } else if (string.indexOf(baseToString(separator), end) != end) { 32171 var index = result.lastIndexOf(separator); 32172 if (index > -1) { 32173 result = result.slice(0, index); 32174 } 32175 } 32176 return result + omission; 32177 } 32178 32179 /** 32180 * The inverse of `_.escape`; this method converts the HTML entities 32181 * `&`, `<`, `>`, `"`, and `'` in `string` to 32182 * their corresponding characters. 32183 * 32184 * **Note:** No other HTML entities are unescaped. To unescape additional 32185 * HTML entities use a third-party library like [_he_](https://mths.be/he). 32186 * 32187 * @static 32188 * @memberOf _ 32189 * @since 0.6.0 32190 * @category String 32191 * @param {string} [string=''] The string to unescape. 32192 * @returns {string} Returns the unescaped string. 32193 * @example 32194 * 32195 * _.unescape('fred, barney, & pebbles'); 32196 * // => 'fred, barney, & pebbles' 32197 */ 32198 function unescape(string) { 32199 string = toString(string); 32200 return (string && reHasEscapedHtml.test(string)) 32201 ? string.replace(reEscapedHtml, unescapeHtmlChar) 32202 : string; 32203 } 32204 32205 /** 32206 * Converts `string`, as space separated words, to upper case. 32207 * 32208 * @static 32209 * @memberOf _ 32210 * @since 4.0.0 32211 * @category String 32212 * @param {string} [string=''] The string to convert. 32213 * @returns {string} Returns the upper cased string. 32214 * @example 32215 * 32216 * _.upperCase('--foo-bar'); 32217 * // => 'FOO BAR' 32218 * 32219 * _.upperCase('fooBar'); 32220 * // => 'FOO BAR' 32221 * 32222 * _.upperCase('__foo_bar__'); 32223 * // => 'FOO BAR' 32224 */ 32225 var upperCase = createCompounder(function(result, word, index) { 32226 return result + (index ? ' ' : '') + word.toUpperCase(); 32227 }); 32228 32229 /** 32230 * Converts the first character of `string` to upper case. 32231 * 32232 * @static 32233 * @memberOf _ 32234 * @since 4.0.0 32235 * @category String 32236 * @param {string} [string=''] The string to convert. 32237 * @returns {string} Returns the converted string. 32238 * @example 32239 * 32240 * _.upperFirst('fred'); 32241 * // => 'Fred' 32242 * 32243 * _.upperFirst('FRED'); 32244 * // => 'FRED' 32245 */ 32246 var upperFirst = createCaseFirst('toUpperCase'); 32247 32248 /** 32249 * Splits `string` into an array of its words. 32250 * 32251 * @static 32252 * @memberOf _ 32253 * @since 3.0.0 32254 * @category String 32255 * @param {string} [string=''] The string to inspect. 32256 * @param {RegExp|string} [pattern] The pattern to match words. 32257 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 32258 * @returns {Array} Returns the words of `string`. 32259 * @example 32260 * 32261 * _.words('fred, barney, & pebbles'); 32262 * // => ['fred', 'barney', 'pebbles'] 32263 * 32264 * _.words('fred, barney, & pebbles', /[^, ]+/g); 32265 * // => ['fred', 'barney', '&', 'pebbles'] 32266 */ 32267 function words(string, pattern, guard) { 32268 string = toString(string); 32269 pattern = guard ? undefined : pattern; 32270 32271 if (pattern === undefined) { 32272 return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); 32273 } 32274 return string.match(pattern) || []; 32275 } 32276 32277 /*------------------------------------------------------------------------*/ 32278 32279 /** 32280 * Attempts to invoke `func`, returning either the result or the caught error 32281 * object. Any additional arguments are provided to `func` when it's invoked. 32282 * 32283 * @static 32284 * @memberOf _ 32285 * @since 3.0.0 32286 * @category Util 32287 * @param {Function} func The function to attempt. 32288 * @param {...*} [args] The arguments to invoke `func` with. 32289 * @returns {*} Returns the `func` result or error object. 32290 * @example 32291 * 32292 * // Avoid throwing errors for invalid selectors. 32293 * var elements = _.attempt(function(selector) { 32294 * return document.querySelectorAll(selector); 32295 * }, '>_>'); 32296 * 32297 * if (_.isError(elements)) { 32298 * elements = []; 32299 * } 32300 */ 32301 var attempt = baseRest(function(func, args) { 32302 try { 32303 return apply(func, undefined, args); 32304 } catch (e) { 32305 return isError(e) ? e : new Error(e); 32306 } 32307 }); 32308 32309 /** 32310 * Binds methods of an object to the object itself, overwriting the existing 32311 * method. 32312 * 32313 * **Note:** This method doesn't set the "length" property of bound functions. 32314 * 32315 * @static 32316 * @since 0.1.0 32317 * @memberOf _ 32318 * @category Util 32319 * @param {Object} object The object to bind and assign the bound methods to. 32320 * @param {...(string|string[])} methodNames The object method names to bind. 32321 * @returns {Object} Returns `object`. 32322 * @example 32323 * 32324 * var view = { 32325 * 'label': 'docs', 32326 * 'click': function() { 32327 * console.log('clicked ' + this.label); 32328 * } 32329 * }; 32330 * 32331 * _.bindAll(view, ['click']); 32332 * jQuery(element).on('click', view.click); 32333 * // => Logs 'clicked docs' when clicked. 32334 */ 32335 var bindAll = flatRest(function(object, methodNames) { 32336 arrayEach(methodNames, function(key) { 32337 key = toKey(key); 32338 baseAssignValue(object, key, bind(object[key], object)); 32339 }); 32340 return object; 32341 }); 32342 32343 /** 32344 * Creates a function that iterates over `pairs` and invokes the corresponding 32345 * function of the first predicate to return truthy. The predicate-function 32346 * pairs are invoked with the `this` binding and arguments of the created 32347 * function. 32348 * 32349 * @static 32350 * @memberOf _ 32351 * @since 4.0.0 32352 * @category Util 32353 * @param {Array} pairs The predicate-function pairs. 32354 * @returns {Function} Returns the new composite function. 32355 * @example 32356 * 32357 * var func = _.cond([ 32358 * [_.matches({ 'a': 1 }), _.constant('matches A')], 32359 * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')], 32360 * [_.stubTrue, _.constant('no match')] 32361 * ]); 32362 * 32363 * func({ 'a': 1, 'b': 2 }); 32364 * // => 'matches A' 32365 * 32366 * func({ 'a': 0, 'b': 1 }); 32367 * // => 'matches B' 32368 * 32369 * func({ 'a': '1', 'b': '2' }); 32370 * // => 'no match' 32371 */ 32372 function cond(pairs) { 32373 var length = pairs == null ? 0 : pairs.length, 32374 toIteratee = getIteratee(); 32375 32376 pairs = !length ? [] : arrayMap(pairs, function(pair) { 32377 if (typeof pair[1] != 'function') { 32378 throw new TypeError(FUNC_ERROR_TEXT); 32379 } 32380 return [toIteratee(pair[0]), pair[1]]; 32381 }); 32382 32383 return baseRest(function(args) { 32384 var index = -1; 32385 while (++index < length) { 32386 var pair = pairs[index]; 32387 if (apply(pair[0], this, args)) { 32388 return apply(pair[1], this, args); 32389 } 32390 } 32391 }); 32392 } 32393 32394 /** 32395 * Creates a function that invokes the predicate properties of `source` with 32396 * the corresponding property values of a given object, returning `true` if 32397 * all predicates return truthy, else `false`. 32398 * 32399 * **Note:** The created function is equivalent to `_.conformsTo` with 32400 * `source` partially applied. 32401 * 32402 * @static 32403 * @memberOf _ 32404 * @since 4.0.0 32405 * @category Util 32406 * @param {Object} source The object of property predicates to conform to. 32407 * @returns {Function} Returns the new spec function. 32408 * @example 32409 * 32410 * var objects = [ 32411 * { 'a': 2, 'b': 1 }, 32412 * { 'a': 1, 'b': 2 } 32413 * ]; 32414 * 32415 * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } })); 32416 * // => [{ 'a': 1, 'b': 2 }] 32417 */ 32418 function conforms(source) { 32419 return baseConforms(baseClone(source, CLONE_DEEP_FLAG)); 32420 } 32421 32422 /** 32423 * Creates a function that returns `value`. 32424 * 32425 * @static 32426 * @memberOf _ 32427 * @since 2.4.0 32428 * @category Util 32429 * @param {*} value The value to return from the new function. 32430 * @returns {Function} Returns the new constant function. 32431 * @example 32432 * 32433 * var objects = _.times(2, _.constant({ 'a': 1 })); 32434 * 32435 * console.log(objects); 32436 * // => [{ 'a': 1 }, { 'a': 1 }] 32437 * 32438 * console.log(objects[0] === objects[1]); 32439 * // => true 32440 */ 32441 function constant(value) { 32442 return function() { 32443 return value; 32444 }; 32445 } 32446 32447 /** 32448 * Checks `value` to determine whether a default value should be returned in 32449 * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, 32450 * or `undefined`. 32451 * 32452 * @static 32453 * @memberOf _ 32454 * @since 4.14.0 32455 * @category Util 32456 * @param {*} value The value to check. 32457 * @param {*} defaultValue The default value. 32458 * @returns {*} Returns the resolved value. 32459 * @example 32460 * 32461 * _.defaultTo(1, 10); 32462 * // => 1 32463 * 32464 * _.defaultTo(undefined, 10); 32465 * // => 10 32466 */ 32467 function defaultTo(value, defaultValue) { 32468 return (value == null || value !== value) ? defaultValue : value; 32469 } 32470 32471 /** 32472 * Creates a function that returns the result of invoking the given functions 32473 * with the `this` binding of the created function, where each successive 32474 * invocation is supplied the return value of the previous. 32475 * 32476 * @static 32477 * @memberOf _ 32478 * @since 3.0.0 32479 * @category Util 32480 * @param {...(Function|Function[])} [funcs] The functions to invoke. 32481 * @returns {Function} Returns the new composite function. 32482 * @see _.flowRight 32483 * @example 32484 * 32485 * function square(n) { 32486 * return n * n; 32487 * } 32488 * 32489 * var addSquare = _.flow([_.add, square]); 32490 * addSquare(1, 2); 32491 * // => 9 32492 */ 32493 var flow = createFlow(); 32494 32495 /** 32496 * This method is like `_.flow` except that it creates a function that 32497 * invokes the given functions from right to left. 32498 * 32499 * @static 32500 * @since 3.0.0 32501 * @memberOf _ 32502 * @category Util 32503 * @param {...(Function|Function[])} [funcs] The functions to invoke. 32504 * @returns {Function} Returns the new composite function. 32505 * @see _.flow 32506 * @example 32507 * 32508 * function square(n) { 32509 * return n * n; 32510 * } 32511 * 32512 * var addSquare = _.flowRight([square, _.add]); 32513 * addSquare(1, 2); 32514 * // => 9 32515 */ 32516 var flowRight = createFlow(true); 32517 32518 /** 32519 * This method returns the first argument it receives. 32520 * 32521 * @static 32522 * @since 0.1.0 32523 * @memberOf _ 32524 * @category Util 32525 * @param {*} value Any value. 32526 * @returns {*} Returns `value`. 32527 * @example 32528 * 32529 * var object = { 'a': 1 }; 32530 * 32531 * console.log(_.identity(object) === object); 32532 * // => true 32533 */ 32534 function identity(value) { 32535 return value; 32536 } 32537 32538 /** 32539 * Creates a function that invokes `func` with the arguments of the created 32540 * function. If `func` is a property name, the created function returns the 32541 * property value for a given element. If `func` is an array or object, the 32542 * created function returns `true` for elements that contain the equivalent 32543 * source properties, otherwise it returns `false`. 32544 * 32545 * @static 32546 * @since 4.0.0 32547 * @memberOf _ 32548 * @category Util 32549 * @param {*} [func=_.identity] The value to convert to a callback. 32550 * @returns {Function} Returns the callback. 32551 * @example 32552 * 32553 * var users = [ 32554 * { 'user': 'barney', 'age': 36, 'active': true }, 32555 * { 'user': 'fred', 'age': 40, 'active': false } 32556 * ]; 32557 * 32558 * // The `_.matches` iteratee shorthand. 32559 * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true })); 32560 * // => [{ 'user': 'barney', 'age': 36, 'active': true }] 32561 * 32562 * // The `_.matchesProperty` iteratee shorthand. 32563 * _.filter(users, _.iteratee(['user', 'fred'])); 32564 * // => [{ 'user': 'fred', 'age': 40 }] 32565 * 32566 * // The `_.property` iteratee shorthand. 32567 * _.map(users, _.iteratee('user')); 32568 * // => ['barney', 'fred'] 32569 * 32570 * // Create custom iteratee shorthands. 32571 * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) { 32572 * return !_.isRegExp(func) ? iteratee(func) : function(string) { 32573 * return func.test(string); 32574 * }; 32575 * }); 32576 * 32577 * _.filter(['abc', 'def'], /ef/); 32578 * // => ['def'] 32579 */ 32580 function iteratee(func) { 32581 return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG)); 32582 } 32583 32584 /** 32585 * Creates a function that performs a partial deep comparison between a given 32586 * object and `source`, returning `true` if the given object has equivalent 32587 * property values, else `false`. 32588 * 32589 * **Note:** The created function is equivalent to `_.isMatch` with `source` 32590 * partially applied. 32591 * 32592 * Partial comparisons will match empty array and empty object `source` 32593 * values against any array or object value, respectively. See `_.isEqual` 32594 * for a list of supported value comparisons. 32595 * 32596 * @static 32597 * @memberOf _ 32598 * @since 3.0.0 32599 * @category Util 32600 * @param {Object} source The object of property values to match. 32601 * @returns {Function} Returns the new spec function. 32602 * @example 32603 * 32604 * var objects = [ 32605 * { 'a': 1, 'b': 2, 'c': 3 }, 32606 * { 'a': 4, 'b': 5, 'c': 6 } 32607 * ]; 32608 * 32609 * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); 32610 * // => [{ 'a': 4, 'b': 5, 'c': 6 }] 32611 */ 32612 function matches(source) { 32613 return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); 32614 } 32615 32616 /** 32617 * Creates a function that performs a partial deep comparison between the 32618 * value at `path` of a given object to `srcValue`, returning `true` if the 32619 * object value is equivalent, else `false`. 32620 * 32621 * **Note:** Partial comparisons will match empty array and empty object 32622 * `srcValue` values against any array or object value, respectively. See 32623 * `_.isEqual` for a list of supported value comparisons. 32624 * 32625 * @static 32626 * @memberOf _ 32627 * @since 3.2.0 32628 * @category Util 32629 * @param {Array|string} path The path of the property to get. 32630 * @param {*} srcValue The value to match. 32631 * @returns {Function} Returns the new spec function. 32632 * @example 32633 * 32634 * var objects = [ 32635 * { 'a': 1, 'b': 2, 'c': 3 }, 32636 * { 'a': 4, 'b': 5, 'c': 6 } 32637 * ]; 32638 * 32639 * _.find(objects, _.matchesProperty('a', 4)); 32640 * // => { 'a': 4, 'b': 5, 'c': 6 } 32641 */ 32642 function matchesProperty(path, srcValue) { 32643 return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); 32644 } 32645 32646 /** 32647 * Creates a function that invokes the method at `path` of a given object. 32648 * Any additional arguments are provided to the invoked method. 32649 * 32650 * @static 32651 * @memberOf _ 32652 * @since 3.7.0 32653 * @category Util 32654 * @param {Array|string} path The path of the method to invoke. 32655 * @param {...*} [args] The arguments to invoke the method with. 32656 * @returns {Function} Returns the new invoker function. 32657 * @example 32658 * 32659 * var objects = [ 32660 * { 'a': { 'b': _.constant(2) } }, 32661 * { 'a': { 'b': _.constant(1) } } 32662 * ]; 32663 * 32664 * _.map(objects, _.method('a.b')); 32665 * // => [2, 1] 32666 * 32667 * _.map(objects, _.method(['a', 'b'])); 32668 * // => [2, 1] 32669 */ 32670 var method = baseRest(function(path, args) { 32671 return function(object) { 32672 return baseInvoke(object, path, args); 32673 }; 32674 }); 32675 32676 /** 32677 * The opposite of `_.method`; this method creates a function that invokes 32678 * the method at a given path of `object`. Any additional arguments are 32679 * provided to the invoked method. 32680 * 32681 * @static 32682 * @memberOf _ 32683 * @since 3.7.0 32684 * @category Util 32685 * @param {Object} object The object to query. 32686 * @param {...*} [args] The arguments to invoke the method with. 32687 * @returns {Function} Returns the new invoker function. 32688 * @example 32689 * 32690 * var array = _.times(3, _.constant), 32691 * object = { 'a': array, 'b': array, 'c': array }; 32692 * 32693 * _.map(['a[2]', 'c[0]'], _.methodOf(object)); 32694 * // => [2, 0] 32695 * 32696 * _.map([['a', '2'], ['c', '0']], _.methodOf(object)); 32697 * // => [2, 0] 32698 */ 32699 var methodOf = baseRest(function(object, args) { 32700 return function(path) { 32701 return baseInvoke(object, path, args); 32702 }; 32703 }); 32704 32705 /** 32706 * Adds all own enumerable string keyed function properties of a source 32707 * object to the destination object. If `object` is a function, then methods 32708 * are added to its prototype as well. 32709 * 32710 * **Note:** Use `_.runInContext` to create a pristine `lodash` function to 32711 * avoid conflicts caused by modifying the original. 32712 * 32713 * @static 32714 * @since 0.1.0 32715 * @memberOf _ 32716 * @category Util 32717 * @param {Function|Object} [object=lodash] The destination object. 32718 * @param {Object} source The object of functions to add. 32719 * @param {Object} [options={}] The options object. 32720 * @param {boolean} [options.chain=true] Specify whether mixins are chainable. 32721 * @returns {Function|Object} Returns `object`. 32722 * @example 32723 * 32724 * function vowels(string) { 32725 * return _.filter(string, function(v) { 32726 * return /[aeiou]/i.test(v); 32727 * }); 32728 * } 32729 * 32730 * _.mixin({ 'vowels': vowels }); 32731 * _.vowels('fred'); 32732 * // => ['e'] 32733 * 32734 * _('fred').vowels().value(); 32735 * // => ['e'] 32736 * 32737 * _.mixin({ 'vowels': vowels }, { 'chain': false }); 32738 * _('fred').vowels(); 32739 * // => ['e'] 32740 */ 32741 function mixin(object, source, options) { 32742 var props = keys(source), 32743 methodNames = baseFunctions(source, props); 32744 32745 if (options == null && 32746 !(isObject(source) && (methodNames.length || !props.length))) { 32747 options = source; 32748 source = object; 32749 object = this; 32750 methodNames = baseFunctions(source, keys(source)); 32751 } 32752 var chain = !(isObject(options) && 'chain' in options) || !!options.chain, 32753 isFunc = isFunction(object); 32754 32755 arrayEach(methodNames, function(methodName) { 32756 var func = source[methodName]; 32757 object[methodName] = func; 32758 if (isFunc) { 32759 object.prototype[methodName] = function() { 32760 var chainAll = this.__chain__; 32761 if (chain || chainAll) { 32762 var result = object(this.__wrapped__), 32763 actions = result.__actions__ = copyArray(this.__actions__); 32764 32765 actions.push({ 'func': func, 'args': arguments, 'thisArg': object }); 32766 result.__chain__ = chainAll; 32767 return result; 32768 } 32769 return func.apply(object, arrayPush([this.value()], arguments)); 32770 }; 32771 } 32772 }); 32773 32774 return object; 32775 } 32776 32777 /** 32778 * Reverts the `_` variable to its previous value and returns a reference to 32779 * the `lodash` function. 32780 * 32781 * @static 32782 * @since 0.1.0 32783 * @memberOf _ 32784 * @category Util 32785 * @returns {Function} Returns the `lodash` function. 32786 * @example 32787 * 32788 * var lodash = _.noConflict(); 32789 */ 32790 function noConflict() { 32791 if (root._ === this) { 32792 root._ = oldDash; 32793 } 32794 return this; 32795 } 32796 32797 /** 32798 * This method returns `undefined`. 32799 * 32800 * @static 32801 * @memberOf _ 32802 * @since 2.3.0 32803 * @category Util 32804 * @example 32805 * 32806 * _.times(2, _.noop); 32807 * // => [undefined, undefined] 32808 */ 32809 function noop() { 32810 // No operation performed. 32811 } 32812 32813 /** 32814 * Creates a function that gets the argument at index `n`. If `n` is negative, 32815 * the nth argument from the end is returned. 32816 * 32817 * @static 32818 * @memberOf _ 32819 * @since 4.0.0 32820 * @category Util 32821 * @param {number} [n=0] The index of the argument to return. 32822 * @returns {Function} Returns the new pass-thru function. 32823 * @example 32824 * 32825 * var func = _.nthArg(1); 32826 * func('a', 'b', 'c', 'd'); 32827 * // => 'b' 32828 * 32829 * var func = _.nthArg(-2); 32830 * func('a', 'b', 'c', 'd'); 32831 * // => 'c' 32832 */ 32833 function nthArg(n) { 32834 n = toInteger(n); 32835 return baseRest(function(args) { 32836 return baseNth(args, n); 32837 }); 32838 } 32839 32840 /** 32841 * Creates a function that invokes `iteratees` with the arguments it receives 32842 * and returns their results. 32843 * 32844 * @static 32845 * @memberOf _ 32846 * @since 4.0.0 32847 * @category Util 32848 * @param {...(Function|Function[])} [iteratees=[_.identity]] 32849 * The iteratees to invoke. 32850 * @returns {Function} Returns the new function. 32851 * @example 32852 * 32853 * var func = _.over([Math.max, Math.min]); 32854 * 32855 * func(1, 2, 3, 4); 32856 * // => [4, 1] 32857 */ 32858 var over = createOver(arrayMap); 32859 32860 /** 32861 * Creates a function that checks if **all** of the `predicates` return 32862 * truthy when invoked with the arguments it receives. 32863 * 32864 * @static 32865 * @memberOf _ 32866 * @since 4.0.0 32867 * @category Util 32868 * @param {...(Function|Function[])} [predicates=[_.identity]] 32869 * The predicates to check. 32870 * @returns {Function} Returns the new function. 32871 * @example 32872 * 32873 * var func = _.overEvery([Boolean, isFinite]); 32874 * 32875 * func('1'); 32876 * // => true 32877 * 32878 * func(null); 32879 * // => false 32880 * 32881 * func(NaN); 32882 * // => false 32883 */ 32884 var overEvery = createOver(arrayEvery); 32885 32886 /** 32887 * Creates a function that checks if **any** of the `predicates` return 32888 * truthy when invoked with the arguments it receives. 32889 * 32890 * @static 32891 * @memberOf _ 32892 * @since 4.0.0 32893 * @category Util 32894 * @param {...(Function|Function[])} [predicates=[_.identity]] 32895 * The predicates to check. 32896 * @returns {Function} Returns the new function. 32897 * @example 32898 * 32899 * var func = _.overSome([Boolean, isFinite]); 32900 * 32901 * func('1'); 32902 * // => true 32903 * 32904 * func(null); 32905 * // => true 32906 * 32907 * func(NaN); 32908 * // => false 32909 */ 32910 var overSome = createOver(arraySome); 32911 32912 /** 32913 * Creates a function that returns the value at `path` of a given object. 32914 * 32915 * @static 32916 * @memberOf _ 32917 * @since 2.4.0 32918 * @category Util 32919 * @param {Array|string} path The path of the property to get. 32920 * @returns {Function} Returns the new accessor function. 32921 * @example 32922 * 32923 * var objects = [ 32924 * { 'a': { 'b': 2 } }, 32925 * { 'a': { 'b': 1 } } 32926 * ]; 32927 * 32928 * _.map(objects, _.property('a.b')); 32929 * // => [2, 1] 32930 * 32931 * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); 32932 * // => [1, 2] 32933 */ 32934 function property(path) { 32935 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); 32936 } 32937 32938 /** 32939 * The opposite of `_.property`; this method creates a function that returns 32940 * the value at a given path of `object`. 32941 * 32942 * @static 32943 * @memberOf _ 32944 * @since 3.0.0 32945 * @category Util 32946 * @param {Object} object The object to query. 32947 * @returns {Function} Returns the new accessor function. 32948 * @example 32949 * 32950 * var array = [0, 1, 2], 32951 * object = { 'a': array, 'b': array, 'c': array }; 32952 * 32953 * _.map(['a[2]', 'c[0]'], _.propertyOf(object)); 32954 * // => [2, 0] 32955 * 32956 * _.map([['a', '2'], ['c', '0']], _.propertyOf(object)); 32957 * // => [2, 0] 32958 */ 32959 function propertyOf(object) { 32960 return function(path) { 32961 return object == null ? undefined : baseGet(object, path); 32962 }; 32963 } 32964 32965 /** 32966 * Creates an array of numbers (positive and/or negative) progressing from 32967 * `start` up to, but not including, `end`. A step of `-1` is used if a negative 32968 * `start` is specified without an `end` or `step`. If `end` is not specified, 32969 * it's set to `start` with `start` then set to `0`. 32970 * 32971 * **Note:** JavaScript follows the IEEE-754 standard for resolving 32972 * floating-point values which can produce unexpected results. 32973 * 32974 * @static 32975 * @since 0.1.0 32976 * @memberOf _ 32977 * @category Util 32978 * @param {number} [start=0] The start of the range. 32979 * @param {number} end The end of the range. 32980 * @param {number} [step=1] The value to increment or decrement by. 32981 * @returns {Array} Returns the range of numbers. 32982 * @see _.inRange, _.rangeRight 32983 * @example 32984 * 32985 * _.range(4); 32986 * // => [0, 1, 2, 3] 32987 * 32988 * _.range(-4); 32989 * // => [0, -1, -2, -3] 32990 * 32991 * _.range(1, 5); 32992 * // => [1, 2, 3, 4] 32993 * 32994 * _.range(0, 20, 5); 32995 * // => [0, 5, 10, 15] 32996 * 32997 * _.range(0, -4, -1); 32998 * // => [0, -1, -2, -3] 32999 * 33000 * _.range(1, 4, 0); 33001 * // => [1, 1, 1] 33002 * 33003 * _.range(0); 33004 * // => [] 33005 */ 33006 var range = createRange(); 33007 33008 /** 33009 * This method is like `_.range` except that it populates values in 33010 * descending order. 33011 * 33012 * @static 33013 * @memberOf _ 33014 * @since 4.0.0 33015 * @category Util 33016 * @param {number} [start=0] The start of the range. 33017 * @param {number} end The end of the range. 33018 * @param {number} [step=1] The value to increment or decrement by. 33019 * @returns {Array} Returns the range of numbers. 33020 * @see _.inRange, _.range 33021 * @example 33022 * 33023 * _.rangeRight(4); 33024 * // => [3, 2, 1, 0] 33025 * 33026 * _.rangeRight(-4); 33027 * // => [-3, -2, -1, 0] 33028 * 33029 * _.rangeRight(1, 5); 33030 * // => [4, 3, 2, 1] 33031 * 33032 * _.rangeRight(0, 20, 5); 33033 * // => [15, 10, 5, 0] 33034 * 33035 * _.rangeRight(0, -4, -1); 33036 * // => [-3, -2, -1, 0] 33037 * 33038 * _.rangeRight(1, 4, 0); 33039 * // => [1, 1, 1] 33040 * 33041 * _.rangeRight(0); 33042 * // => [] 33043 */ 33044 var rangeRight = createRange(true); 33045 33046 /** 33047 * This method returns a new empty array. 33048 * 33049 * @static 33050 * @memberOf _ 33051 * @since 4.13.0 33052 * @category Util 33053 * @returns {Array} Returns the new empty array. 33054 * @example 33055 * 33056 * var arrays = _.times(2, _.stubArray); 33057 * 33058 * console.log(arrays); 33059 * // => [[], []] 33060 * 33061 * console.log(arrays[0] === arrays[1]); 33062 * // => false 33063 */ 33064 function stubArray() { 33065 return []; 33066 } 33067 33068 /** 33069 * This method returns `false`. 33070 * 33071 * @static 33072 * @memberOf _ 33073 * @since 4.13.0 33074 * @category Util 33075 * @returns {boolean} Returns `false`. 33076 * @example 33077 * 33078 * _.times(2, _.stubFalse); 33079 * // => [false, false] 33080 */ 33081 function stubFalse() { 33082 return false; 33083 } 33084 33085 /** 33086 * This method returns a new empty object. 33087 * 33088 * @static 33089 * @memberOf _ 33090 * @since 4.13.0 33091 * @category Util 33092 * @returns {Object} Returns the new empty object. 33093 * @example 33094 * 33095 * var objects = _.times(2, _.stubObject); 33096 * 33097 * console.log(objects); 33098 * // => [{}, {}] 33099 * 33100 * console.log(objects[0] === objects[1]); 33101 * // => false 33102 */ 33103 function stubObject() { 33104 return {}; 33105 } 33106 33107 /** 33108 * This method returns an empty string. 33109 * 33110 * @static 33111 * @memberOf _ 33112 * @since 4.13.0 33113 * @category Util 33114 * @returns {string} Returns the empty string. 33115 * @example 33116 * 33117 * _.times(2, _.stubString); 33118 * // => ['', ''] 33119 */ 33120 function stubString() { 33121 return ''; 33122 } 33123 33124 /** 33125 * This method returns `true`. 33126 * 33127 * @static 33128 * @memberOf _ 33129 * @since 4.13.0 33130 * @category Util 33131 * @returns {boolean} Returns `true`. 33132 * @example 33133 * 33134 * _.times(2, _.stubTrue); 33135 * // => [true, true] 33136 */ 33137 function stubTrue() { 33138 return true; 33139 } 33140 33141 /** 33142 * Invokes the iteratee `n` times, returning an array of the results of 33143 * each invocation. The iteratee is invoked with one argument; (index). 33144 * 33145 * @static 33146 * @since 0.1.0 33147 * @memberOf _ 33148 * @category Util 33149 * @param {number} n The number of times to invoke `iteratee`. 33150 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 33151 * @returns {Array} Returns the array of results. 33152 * @example 33153 * 33154 * _.times(3, String); 33155 * // => ['0', '1', '2'] 33156 * 33157 * _.times(4, _.constant(0)); 33158 * // => [0, 0, 0, 0] 33159 */ 33160 function times(n, iteratee) { 33161 n = toInteger(n); 33162 if (n < 1 || n > MAX_SAFE_INTEGER) { 33163 return []; 33164 } 33165 var index = MAX_ARRAY_LENGTH, 33166 length = nativeMin(n, MAX_ARRAY_LENGTH); 33167 33168 iteratee = getIteratee(iteratee); 33169 n -= MAX_ARRAY_LENGTH; 33170 33171 var result = baseTimes(length, iteratee); 33172 while (++index < n) { 33173 iteratee(index); 33174 } 33175 return result; 33176 } 33177 33178 /** 33179 * Converts `value` to a property path array. 33180 * 33181 * @static 33182 * @memberOf _ 33183 * @since 4.0.0 33184 * @category Util 33185 * @param {*} value The value to convert. 33186 * @returns {Array} Returns the new property path array. 33187 * @example 33188 * 33189 * _.toPath('a.b.c'); 33190 * // => ['a', 'b', 'c'] 33191 * 33192 * _.toPath('a[0].b.c'); 33193 * // => ['a', '0', 'b', 'c'] 33194 */ 33195 function toPath(value) { 33196 if (isArray(value)) { 33197 return arrayMap(value, toKey); 33198 } 33199 return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value))); 33200 } 33201 33202 /** 33203 * Generates a unique ID. If `prefix` is given, the ID is appended to it. 33204 * 33205 * @static 33206 * @since 0.1.0 33207 * @memberOf _ 33208 * @category Util 33209 * @param {string} [prefix=''] The value to prefix the ID with. 33210 * @returns {string} Returns the unique ID. 33211 * @example 33212 * 33213 * _.uniqueId('contact_'); 33214 * // => 'contact_104' 33215 * 33216 * _.uniqueId(); 33217 * // => '105' 33218 */ 33219 function uniqueId(prefix) { 33220 var id = ++idCounter; 33221 return toString(prefix) + id; 33222 } 33223 33224 /*------------------------------------------------------------------------*/ 33225 33226 /** 33227 * Adds two numbers. 33228 * 33229 * @static 33230 * @memberOf _ 33231 * @since 3.4.0 33232 * @category Math 33233 * @param {number} augend The first number in an addition. 33234 * @param {number} addend The second number in an addition. 33235 * @returns {number} Returns the total. 33236 * @example 33237 * 33238 * _.add(6, 4); 33239 * // => 10 33240 */ 33241 var add = createMathOperation(function(augend, addend) { 33242 return augend + addend; 33243 }, 0); 33244 33245 /** 33246 * Computes `number` rounded up to `precision`. 33247 * 33248 * @static 33249 * @memberOf _ 33250 * @since 3.10.0 33251 * @category Math 33252 * @param {number} number The number to round up. 33253 * @param {number} [precision=0] The precision to round up to. 33254 * @returns {number} Returns the rounded up number. 33255 * @example 33256 * 33257 * _.ceil(4.006); 33258 * // => 5 33259 * 33260 * _.ceil(6.004, 2); 33261 * // => 6.01 33262 * 33263 * _.ceil(6040, -2); 33264 * // => 6100 33265 */ 33266 var ceil = createRound('ceil'); 33267 33268 /** 33269 * Divide two numbers. 33270 * 33271 * @static 33272 * @memberOf _ 33273 * @since 4.7.0 33274 * @category Math 33275 * @param {number} dividend The first number in a division. 33276 * @param {number} divisor The second number in a division. 33277 * @returns {number} Returns the quotient. 33278 * @example 33279 * 33280 * _.divide(6, 4); 33281 * // => 1.5 33282 */ 33283 var divide = createMathOperation(function(dividend, divisor) { 33284 return dividend / divisor; 33285 }, 1); 33286 33287 /** 33288 * Computes `number` rounded down to `precision`. 33289 * 33290 * @static 33291 * @memberOf _ 33292 * @since 3.10.0 33293 * @category Math 33294 * @param {number} number The number to round down. 33295 * @param {number} [precision=0] The precision to round down to. 33296 * @returns {number} Returns the rounded down number. 33297 * @example 33298 * 33299 * _.floor(4.006); 33300 * // => 4 33301 * 33302 * _.floor(0.046, 2); 33303 * // => 0.04 33304 * 33305 * _.floor(4060, -2); 33306 * // => 4000 33307 */ 33308 var floor = createRound('floor'); 33309 33310 /** 33311 * Computes the maximum value of `array`. If `array` is empty or falsey, 33312 * `undefined` is returned. 33313 * 33314 * @static 33315 * @since 0.1.0 33316 * @memberOf _ 33317 * @category Math 33318 * @param {Array} array The array to iterate over. 33319 * @returns {*} Returns the maximum value. 33320 * @example 33321 * 33322 * _.max([4, 2, 8, 6]); 33323 * // => 8 33324 * 33325 * _.max([]); 33326 * // => undefined 33327 */ 33328 function max(array) { 33329 return (array && array.length) 33330 ? baseExtremum(array, identity, baseGt) 33331 : undefined; 33332 } 33333 33334 /** 33335 * This method is like `_.max` except that it accepts `iteratee` which is 33336 * invoked for each element in `array` to generate the criterion by which 33337 * the value is ranked. The iteratee is invoked with one argument: (value). 33338 * 33339 * @static 33340 * @memberOf _ 33341 * @since 4.0.0 33342 * @category Math 33343 * @param {Array} array The array to iterate over. 33344 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 33345 * @returns {*} Returns the maximum value. 33346 * @example 33347 * 33348 * var objects = [{ 'n': 1 }, { 'n': 2 }]; 33349 * 33350 * _.maxBy(objects, function(o) { return o.n; }); 33351 * // => { 'n': 2 } 33352 * 33353 * // The `_.property` iteratee shorthand. 33354 * _.maxBy(objects, 'n'); 33355 * // => { 'n': 2 } 33356 */ 33357 function maxBy(array, iteratee) { 33358 return (array && array.length) 33359 ? baseExtremum(array, getIteratee(iteratee, 2), baseGt) 33360 : undefined; 33361 } 33362 33363 /** 33364 * Computes the mean of the values in `array`. 33365 * 33366 * @static 33367 * @memberOf _ 33368 * @since 4.0.0 33369 * @category Math 33370 * @param {Array} array The array to iterate over. 33371 * @returns {number} Returns the mean. 33372 * @example 33373 * 33374 * _.mean([4, 2, 8, 6]); 33375 * // => 5 33376 */ 33377 function mean(array) { 33378 return baseMean(array, identity); 33379 } 33380 33381 /** 33382 * This method is like `_.mean` except that it accepts `iteratee` which is 33383 * invoked for each element in `array` to generate the value to be averaged. 33384 * The iteratee is invoked with one argument: (value). 33385 * 33386 * @static 33387 * @memberOf _ 33388 * @since 4.7.0 33389 * @category Math 33390 * @param {Array} array The array to iterate over. 33391 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 33392 * @returns {number} Returns the mean. 33393 * @example 33394 * 33395 * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; 33396 * 33397 * _.meanBy(objects, function(o) { return o.n; }); 33398 * // => 5 33399 * 33400 * // The `_.property` iteratee shorthand. 33401 * _.meanBy(objects, 'n'); 33402 * // => 5 33403 */ 33404 function meanBy(array, iteratee) { 33405 return baseMean(array, getIteratee(iteratee, 2)); 33406 } 33407 33408 /** 33409 * Computes the minimum value of `array`. If `array` is empty or falsey, 33410 * `undefined` is returned. 33411 * 33412 * @static 33413 * @since 0.1.0 33414 * @memberOf _ 33415 * @category Math 33416 * @param {Array} array The array to iterate over. 33417 * @returns {*} Returns the minimum value. 33418 * @example 33419 * 33420 * _.min([4, 2, 8, 6]); 33421 * // => 2 33422 * 33423 * _.min([]); 33424 * // => undefined 33425 */ 33426 function min(array) { 33427 return (array && array.length) 33428 ? baseExtremum(array, identity, baseLt) 33429 : undefined; 33430 } 33431 33432 /** 33433 * This method is like `_.min` except that it accepts `iteratee` which is 33434 * invoked for each element in `array` to generate the criterion by which 33435 * the value is ranked. The iteratee is invoked with one argument: (value). 33436 * 33437 * @static 33438 * @memberOf _ 33439 * @since 4.0.0 33440 * @category Math 33441 * @param {Array} array The array to iterate over. 33442 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 33443 * @returns {*} Returns the minimum value. 33444 * @example 33445 * 33446 * var objects = [{ 'n': 1 }, { 'n': 2 }]; 33447 * 33448 * _.minBy(objects, function(o) { return o.n; }); 33449 * // => { 'n': 1 } 33450 * 33451 * // The `_.property` iteratee shorthand. 33452 * _.minBy(objects, 'n'); 33453 * // => { 'n': 1 } 33454 */ 33455 function minBy(array, iteratee) { 33456 return (array && array.length) 33457 ? baseExtremum(array, getIteratee(iteratee, 2), baseLt) 33458 : undefined; 33459 } 33460 33461 /** 33462 * Multiply two numbers. 33463 * 33464 * @static 33465 * @memberOf _ 33466 * @since 4.7.0 33467 * @category Math 33468 * @param {number} multiplier The first number in a multiplication. 33469 * @param {number} multiplicand The second number in a multiplication. 33470 * @returns {number} Returns the product. 33471 * @example 33472 * 33473 * _.multiply(6, 4); 33474 * // => 24 33475 */ 33476 var multiply = createMathOperation(function(multiplier, multiplicand) { 33477 return multiplier * multiplicand; 33478 }, 1); 33479 33480 /** 33481 * Computes `number` rounded to `precision`. 33482 * 33483 * @static 33484 * @memberOf _ 33485 * @since 3.10.0 33486 * @category Math 33487 * @param {number} number The number to round. 33488 * @param {number} [precision=0] The precision to round to. 33489 * @returns {number} Returns the rounded number. 33490 * @example 33491 * 33492 * _.round(4.006); 33493 * // => 4 33494 * 33495 * _.round(4.006, 2); 33496 * // => 4.01 33497 * 33498 * _.round(4060, -2); 33499 * // => 4100 33500 */ 33501 var round = createRound('round'); 33502 33503 /** 33504 * Subtract two numbers. 33505 * 33506 * @static 33507 * @memberOf _ 33508 * @since 4.0.0 33509 * @category Math 33510 * @param {number} minuend The first number in a subtraction. 33511 * @param {number} subtrahend The second number in a subtraction. 33512 * @returns {number} Returns the difference. 33513 * @example 33514 * 33515 * _.subtract(6, 4); 33516 * // => 2 33517 */ 33518 var subtract = createMathOperation(function(minuend, subtrahend) { 33519 return minuend - subtrahend; 33520 }, 0); 33521 33522 /** 33523 * Computes the sum of the values in `array`. 33524 * 33525 * @static 33526 * @memberOf _ 33527 * @since 3.4.0 33528 * @category Math 33529 * @param {Array} array The array to iterate over. 33530 * @returns {number} Returns the sum. 33531 * @example 33532 * 33533 * _.sum([4, 2, 8, 6]); 33534 * // => 20 33535 */ 33536 function sum(array) { 33537 return (array && array.length) 33538 ? baseSum(array, identity) 33539 : 0; 33540 } 33541 33542 /** 33543 * This method is like `_.sum` except that it accepts `iteratee` which is 33544 * invoked for each element in `array` to generate the value to be summed. 33545 * The iteratee is invoked with one argument: (value). 33546 * 33547 * @static 33548 * @memberOf _ 33549 * @since 4.0.0 33550 * @category Math 33551 * @param {Array} array The array to iterate over. 33552 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 33553 * @returns {number} Returns the sum. 33554 * @example 33555 * 33556 * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; 33557 * 33558 * _.sumBy(objects, function(o) { return o.n; }); 33559 * // => 20 33560 * 33561 * // The `_.property` iteratee shorthand. 33562 * _.sumBy(objects, 'n'); 33563 * // => 20 33564 */ 33565 function sumBy(array, iteratee) { 33566 return (array && array.length) 33567 ? baseSum(array, getIteratee(iteratee, 2)) 33568 : 0; 33569 } 33570 33571 /*------------------------------------------------------------------------*/ 33572 33573 // Add methods that return wrapped values in chain sequences. 33574 lodash.after = after; 33575 lodash.ary = ary; 33576 lodash.assign = assign; 33577 lodash.assignIn = assignIn; 33578 lodash.assignInWith = assignInWith; 33579 lodash.assignWith = assignWith; 33580 lodash.at = at; 33581 lodash.before = before; 33582 lodash.bind = bind; 33583 lodash.bindAll = bindAll; 33584 lodash.bindKey = bindKey; 33585 lodash.castArray = castArray; 33586 lodash.chain = chain; 33587 lodash.chunk = chunk; 33588 lodash.compact = compact; 33589 lodash.concat = concat; 33590 lodash.cond = cond; 33591 lodash.conforms = conforms; 33592 lodash.constant = constant; 33593 lodash.countBy = countBy; 33594 lodash.create = create; 33595 lodash.curry = curry; 33596 lodash.curryRight = curryRight; 33597 lodash.debounce = debounce; 33598 lodash.defaults = defaults; 33599 lodash.defaultsDeep = defaultsDeep; 33600 lodash.defer = defer; 33601 lodash.delay = delay; 33602 lodash.difference = difference; 33603 lodash.differenceBy = differenceBy; 33604 lodash.differenceWith = differenceWith; 33605 lodash.drop = drop; 33606 lodash.dropRight = dropRight; 33607 lodash.dropRightWhile = dropRightWhile; 33608 lodash.dropWhile = dropWhile; 33609 lodash.fill = fill; 33610 lodash.filter = filter; 33611 lodash.flatMap = flatMap; 33612 lodash.flatMapDeep = flatMapDeep; 33613 lodash.flatMapDepth = flatMapDepth; 33614 lodash.flatten = flatten; 33615 lodash.flattenDeep = flattenDeep; 33616 lodash.flattenDepth = flattenDepth; 33617 lodash.flip = flip; 33618 lodash.flow = flow; 33619 lodash.flowRight = flowRight; 33620 lodash.fromPairs = fromPairs; 33621 lodash.functions = functions; 33622 lodash.functionsIn = functionsIn; 33623 lodash.groupBy = groupBy; 33624 lodash.initial = initial; 33625 lodash.intersection = intersection; 33626 lodash.intersectionBy = intersectionBy; 33627 lodash.intersectionWith = intersectionWith; 33628 lodash.invert = invert; 33629 lodash.invertBy = invertBy; 33630 lodash.invokeMap = invokeMap; 33631 lodash.iteratee = iteratee; 33632 lodash.keyBy = keyBy; 33633 lodash.keys = keys; 33634 lodash.keysIn = keysIn; 33635 lodash.map = map; 33636 lodash.mapKeys = mapKeys; 33637 lodash.mapValues = mapValues; 33638 lodash.matches = matches; 33639 lodash.matchesProperty = matchesProperty; 33640 lodash.memoize = memoize; 33641 lodash.merge = merge; 33642 lodash.mergeWith = mergeWith; 33643 lodash.method = method; 33644 lodash.methodOf = methodOf; 33645 lodash.mixin = mixin; 33646 lodash.negate = negate; 33647 lodash.nthArg = nthArg; 33648 lodash.omit = omit; 33649 lodash.omitBy = omitBy; 33650 lodash.once = once; 33651 lodash.orderBy = orderBy; 33652 lodash.over = over; 33653 lodash.overArgs = overArgs; 33654 lodash.overEvery = overEvery; 33655 lodash.overSome = overSome; 33656 lodash.partial = partial; 33657 lodash.partialRight = partialRight; 33658 lodash.partition = partition; 33659 lodash.pick = pick; 33660 lodash.pickBy = pickBy; 33661 lodash.property = property; 33662 lodash.propertyOf = propertyOf; 33663 lodash.pull = pull; 33664 lodash.pullAll = pullAll; 33665 lodash.pullAllBy = pullAllBy; 33666 lodash.pullAllWith = pullAllWith; 33667 lodash.pullAt = pullAt; 33668 lodash.range = range; 33669 lodash.rangeRight = rangeRight; 33670 lodash.rearg = rearg; 33671 lodash.reject = reject; 33672 lodash.remove = remove; 33673 lodash.rest = rest; 33674 lodash.reverse = reverse; 33675 lodash.sampleSize = sampleSize; 33676 lodash.set = set; 33677 lodash.setWith = setWith; 33678 lodash.shuffle = shuffle; 33679 lodash.slice = slice; 33680 lodash.sortBy = sortBy; 33681 lodash.sortedUniq = sortedUniq; 33682 lodash.sortedUniqBy = sortedUniqBy; 33683 lodash.split = split; 33684 lodash.spread = spread; 33685 lodash.tail = tail; 33686 lodash.take = take; 33687 lodash.takeRight = takeRight; 33688 lodash.takeRightWhile = takeRightWhile; 33689 lodash.takeWhile = takeWhile; 33690 lodash.tap = tap; 33691 lodash.throttle = throttle; 33692 lodash.thru = thru; 33693 lodash.toArray = toArray; 33694 lodash.toPairs = toPairs; 33695 lodash.toPairsIn = toPairsIn; 33696 lodash.toPath = toPath; 33697 lodash.toPlainObject = toPlainObject; 33698 lodash.transform = transform; 33699 lodash.unary = unary; 33700 lodash.union = union; 33701 lodash.unionBy = unionBy; 33702 lodash.unionWith = unionWith; 33703 lodash.uniq = uniq; 33704 lodash.uniqBy = uniqBy; 33705 lodash.uniqWith = uniqWith; 33706 lodash.unset = unset; 33707 lodash.unzip = unzip; 33708 lodash.unzipWith = unzipWith; 33709 lodash.update = update; 33710 lodash.updateWith = updateWith; 33711 lodash.values = values; 33712 lodash.valuesIn = valuesIn; 33713 lodash.without = without; 33714 lodash.words = words; 33715 lodash.wrap = wrap; 33716 lodash.xor = xor; 33717 lodash.xorBy = xorBy; 33718 lodash.xorWith = xorWith; 33719 lodash.zip = zip; 33720 lodash.zipObject = zipObject; 33721 lodash.zipObjectDeep = zipObjectDeep; 33722 lodash.zipWith = zipWith; 33723 33724 // Add aliases. 33725 lodash.entries = toPairs; 33726 lodash.entriesIn = toPairsIn; 33727 lodash.extend = assignIn; 33728 lodash.extendWith = assignInWith; 33729 33730 // Add methods to `lodash.prototype`. 33731 mixin(lodash, lodash); 33732 33733 /*------------------------------------------------------------------------*/ 33734 33735 // Add methods that return unwrapped values in chain sequences. 33736 lodash.add = add; 33737 lodash.attempt = attempt; 33738 lodash.camelCase = camelCase; 33739 lodash.capitalize = capitalize; 33740 lodash.ceil = ceil; 33741 lodash.clamp = clamp; 33742 lodash.clone = clone; 33743 lodash.cloneDeep = cloneDeep; 33744 lodash.cloneDeepWith = cloneDeepWith; 33745 lodash.cloneWith = cloneWith; 33746 lodash.conformsTo = conformsTo; 33747 lodash.deburr = deburr; 33748 lodash.defaultTo = defaultTo; 33749 lodash.divide = divide; 33750 lodash.endsWith = endsWith; 33751 lodash.eq = eq; 33752 lodash.escape = escape; 33753 lodash.escapeRegExp = escapeRegExp; 33754 lodash.every = every; 33755 lodash.find = find; 33756 lodash.findIndex = findIndex; 33757 lodash.findKey = findKey; 33758 lodash.findLast = findLast; 33759 lodash.findLastIndex = findLastIndex; 33760 lodash.findLastKey = findLastKey; 33761 lodash.floor = floor; 33762 lodash.forEach = forEach; 33763 lodash.forEachRight = forEachRight; 33764 lodash.forIn = forIn; 33765 lodash.forInRight = forInRight; 33766 lodash.forOwn = forOwn; 33767 lodash.forOwnRight = forOwnRight; 33768 lodash.get = get; 33769 lodash.gt = gt; 33770 lodash.gte = gte; 33771 lodash.has = has; 33772 lodash.hasIn = hasIn; 33773 lodash.head = head; 33774 lodash.identity = identity; 33775 lodash.includes = includes; 33776 lodash.indexOf = indexOf; 33777 lodash.inRange = inRange; 33778 lodash.invoke = invoke; 33779 lodash.isArguments = isArguments; 33780 lodash.isArray = isArray; 33781 lodash.isArrayBuffer = isArrayBuffer; 33782 lodash.isArrayLike = isArrayLike; 33783 lodash.isArrayLikeObject = isArrayLikeObject; 33784 lodash.isBoolean = isBoolean; 33785 lodash.isBuffer = isBuffer; 33786 lodash.isDate = isDate; 33787 lodash.isElement = isElement; 33788 lodash.isEmpty = isEmpty; 33789 lodash.isEqual = isEqual; 33790 lodash.isEqualWith = isEqualWith; 33791 lodash.isError = isError; 33792 lodash.isFinite = isFinite; 33793 lodash.isFunction = isFunction; 33794 lodash.isInteger = isInteger; 33795 lodash.isLength = isLength; 33796 lodash.isMap = isMap; 33797 lodash.isMatch = isMatch; 33798 lodash.isMatchWith = isMatchWith; 33799 lodash.isNaN = isNaN; 33800 lodash.isNative = isNative; 33801 lodash.isNil = isNil; 33802 lodash.isNull = isNull; 33803 lodash.isNumber = isNumber; 33804 lodash.isObject = isObject; 33805 lodash.isObjectLike = isObjectLike; 33806 lodash.isPlainObject = isPlainObject; 33807 lodash.isRegExp = isRegExp; 33808 lodash.isSafeInteger = isSafeInteger; 33809 lodash.isSet = isSet; 33810 lodash.isString = isString; 33811 lodash.isSymbol = isSymbol; 33812 lodash.isTypedArray = isTypedArray; 33813 lodash.isUndefined = isUndefined; 33814 lodash.isWeakMap = isWeakMap; 33815 lodash.isWeakSet = isWeakSet; 33816 lodash.join = join; 33817 lodash.kebabCase = kebabCase; 33818 lodash.last = last; 33819 lodash.lastIndexOf = lastIndexOf; 33820 lodash.lowerCase = lowerCase; 33821 lodash.lowerFirst = lowerFirst; 33822 lodash.lt = lt; 33823 lodash.lte = lte; 33824 lodash.max = max; 33825 lodash.maxBy = maxBy; 33826 lodash.mean = mean; 33827 lodash.meanBy = meanBy; 33828 lodash.min = min; 33829 lodash.minBy = minBy; 33830 lodash.stubArray = stubArray; 33831 lodash.stubFalse = stubFalse; 33832 lodash.stubObject = stubObject; 33833 lodash.stubString = stubString; 33834 lodash.stubTrue = stubTrue; 33835 lodash.multiply = multiply; 33836 lodash.nth = nth; 33837 lodash.noConflict = noConflict; 33838 lodash.noop = noop; 33839 lodash.now = now; 33840 lodash.pad = pad; 33841 lodash.padEnd = padEnd; 33842 lodash.padStart = padStart; 33843 lodash.parseInt = parseInt; 33844 lodash.random = random; 33845 lodash.reduce = reduce; 33846 lodash.reduceRight = reduceRight; 33847 lodash.repeat = repeat; 33848 lodash.replace = replace; 33849 lodash.result = result; 33850 lodash.round = round; 33851 lodash.runInContext = runInContext; 33852 lodash.sample = sample; 33853 lodash.size = size; 33854 lodash.snakeCase = snakeCase; 33855 lodash.some = some; 33856 lodash.sortedIndex = sortedIndex; 33857 lodash.sortedIndexBy = sortedIndexBy; 33858 lodash.sortedIndexOf = sortedIndexOf; 33859 lodash.sortedLastIndex = sortedLastIndex; 33860 lodash.sortedLastIndexBy = sortedLastIndexBy; 33861 lodash.sortedLastIndexOf = sortedLastIndexOf; 33862 lodash.startCase = startCase; 33863 lodash.startsWith = startsWith; 33864 lodash.subtract = subtract; 33865 lodash.sum = sum; 33866 lodash.sumBy = sumBy; 33867 lodash.template = template; 33868 lodash.times = times; 33869 lodash.toFinite = toFinite; 33870 lodash.toInteger = toInteger; 33871 lodash.toLength = toLength; 33872 lodash.toLower = toLower; 33873 lodash.toNumber = toNumber; 33874 lodash.toSafeInteger = toSafeInteger; 33875 lodash.toString = toString; 33876 lodash.toUpper = toUpper; 33877 lodash.trim = trim; 33878 lodash.trimEnd = trimEnd; 33879 lodash.trimStart = trimStart; 33880 lodash.truncate = truncate; 33881 lodash.unescape = unescape; 33882 lodash.uniqueId = uniqueId; 33883 lodash.upperCase = upperCase; 33884 lodash.upperFirst = upperFirst; 33885 33886 // Add aliases. 33887 lodash.each = forEach; 33888 lodash.eachRight = forEachRight; 33889 lodash.first = head; 33890 33891 mixin(lodash, (function() { 33892 var source = {}; 33893 baseForOwn(lodash, function(func, methodName) { 33894 if (!hasOwnProperty.call(lodash.prototype, methodName)) { 33895 source[methodName] = func; 33896 } 33897 }); 33898 return source; 33899 }()), { 'chain': false }); 33900 33901 /*------------------------------------------------------------------------*/ 33902 33903 /** 33904 * The semantic version number. 33905 * 33906 * @static 33907 * @memberOf _ 33908 * @type {string} 33909 */ 33910 lodash.VERSION = VERSION; 33911 33912 // Assign default placeholders. 33913 arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) { 33914 lodash[methodName].placeholder = lodash; 33915 }); 33916 33917 // Add `LazyWrapper` methods for `_.drop` and `_.take` variants. 33918 arrayEach(['drop', 'take'], function(methodName, index) { 33919 LazyWrapper.prototype[methodName] = function(n) { 33920 n = n === undefined ? 1 : nativeMax(toInteger(n), 0); 33921 33922 var result = (this.__filtered__ && !index) 33923 ? new LazyWrapper(this) 33924 : this.clone(); 33925 33926 if (result.__filtered__) { 33927 result.__takeCount__ = nativeMin(n, result.__takeCount__); 33928 } else { 33929 result.__views__.push({ 33930 'size': nativeMin(n, MAX_ARRAY_LENGTH), 33931 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') 33932 }); 33933 } 33934 return result; 33935 }; 33936 33937 LazyWrapper.prototype[methodName + 'Right'] = function(n) { 33938 return this.reverse()[methodName](n).reverse(); 33939 }; 33940 }); 33941 33942 // Add `LazyWrapper` methods that accept an `iteratee` value. 33943 arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) { 33944 var type = index + 1, 33945 isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; 33946 33947 LazyWrapper.prototype[methodName] = function(iteratee) { 33948 var result = this.clone(); 33949 result.__iteratees__.push({ 33950 'iteratee': getIteratee(iteratee, 3), 33951 'type': type 33952 }); 33953 result.__filtered__ = result.__filtered__ || isFilter; 33954 return result; 33955 }; 33956 }); 33957 33958 // Add `LazyWrapper` methods for `_.head` and `_.last`. 33959 arrayEach(['head', 'last'], function(methodName, index) { 33960 var takeName = 'take' + (index ? 'Right' : ''); 33961 33962 LazyWrapper.prototype[methodName] = function() { 33963 return this[takeName](1).value()[0]; 33964 }; 33965 }); 33966 33967 // Add `LazyWrapper` methods for `_.initial` and `_.tail`. 33968 arrayEach(['initial', 'tail'], function(methodName, index) { 33969 var dropName = 'drop' + (index ? '' : 'Right'); 33970 33971 LazyWrapper.prototype[methodName] = function() { 33972 return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); 33973 }; 33974 }); 33975 33976 LazyWrapper.prototype.compact = function() { 33977 return this.filter(identity); 33978 }; 33979 33980 LazyWrapper.prototype.find = function(predicate) { 33981 return this.filter(predicate).head(); 33982 }; 33983 33984 LazyWrapper.prototype.findLast = function(predicate) { 33985 return this.reverse().find(predicate); 33986 }; 33987 33988 LazyWrapper.prototype.invokeMap = baseRest(function(path, args) { 33989 if (typeof path == 'function') { 33990 return new LazyWrapper(this); 33991 } 33992 return this.map(function(value) { 33993 return baseInvoke(value, path, args); 33994 }); 33995 }); 33996 33997 LazyWrapper.prototype.reject = function(predicate) { 33998 return this.filter(negate(getIteratee(predicate))); 33999 }; 34000 34001 LazyWrapper.prototype.slice = function(start, end) { 34002 start = toInteger(start); 34003 34004 var result = this; 34005 if (result.__filtered__ && (start > 0 || end < 0)) { 34006 return new LazyWrapper(result); 34007 } 34008 if (start < 0) { 34009 result = result.takeRight(-start); 34010 } else if (start) { 34011 result = result.drop(start); 34012 } 34013 if (end !== undefined) { 34014 end = toInteger(end); 34015 result = end < 0 ? result.dropRight(-end) : result.take(end - start); 34016 } 34017 return result; 34018 }; 34019 34020 LazyWrapper.prototype.takeRightWhile = function(predicate) { 34021 return this.reverse().takeWhile(predicate).reverse(); 34022 }; 34023 34024 LazyWrapper.prototype.toArray = function() { 34025 return this.take(MAX_ARRAY_LENGTH); 34026 }; 34027 34028 // Add `LazyWrapper` methods to `lodash.prototype`. 34029 baseForOwn(LazyWrapper.prototype, function(func, methodName) { 34030 var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), 34031 isTaker = /^(?:head|last)$/.test(methodName), 34032 lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName], 34033 retUnwrapped = isTaker || /^find/.test(methodName); 34034 34035 if (!lodashFunc) { 34036 return; 34037 } 34038 lodash.prototype[methodName] = function() { 34039 var value = this.__wrapped__, 34040 args = isTaker ? [1] : arguments, 34041 isLazy = value instanceof LazyWrapper, 34042 iteratee = args[0], 34043 useLazy = isLazy || isArray(value); 34044 34045 var interceptor = function(value) { 34046 var result = lodashFunc.apply(lodash, arrayPush([value], args)); 34047 return (isTaker && chainAll) ? result[0] : result; 34048 }; 34049 34050 if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) { 34051 // Avoid lazy use if the iteratee has a "length" value other than `1`. 34052 isLazy = useLazy = false; 34053 } 34054 var chainAll = this.__chain__, 34055 isHybrid = !!this.__actions__.length, 34056 isUnwrapped = retUnwrapped && !chainAll, 34057 onlyLazy = isLazy && !isHybrid; 34058 34059 if (!retUnwrapped && useLazy) { 34060 value = onlyLazy ? value : new LazyWrapper(this); 34061 var result = func.apply(value, args); 34062 result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); 34063 return new LodashWrapper(result, chainAll); 34064 } 34065 if (isUnwrapped && onlyLazy) { 34066 return func.apply(this, args); 34067 } 34068 result = this.thru(interceptor); 34069 return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result; 34070 }; 34071 }); 34072 34073 // Add `Array` methods to `lodash.prototype`. 34074 arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { 34075 var func = arrayProto[methodName], 34076 chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', 34077 retUnwrapped = /^(?:pop|shift)$/.test(methodName); 34078 34079 lodash.prototype[methodName] = function() { 34080 var args = arguments; 34081 if (retUnwrapped && !this.__chain__) { 34082 var value = this.value(); 34083 return func.apply(isArray(value) ? value : [], args); 34084 } 34085 return this[chainName](function(value) { 34086 return func.apply(isArray(value) ? value : [], args); 34087 }); 34088 }; 34089 }); 34090 34091 // Map minified method names to their real names. 34092 baseForOwn(LazyWrapper.prototype, function(func, methodName) { 34093 var lodashFunc = lodash[methodName]; 34094 if (lodashFunc) { 34095 var key = lodashFunc.name + ''; 34096 if (!hasOwnProperty.call(realNames, key)) { 34097 realNames[key] = []; 34098 } 34099 realNames[key].push({ 'name': methodName, 'func': lodashFunc }); 34100 } 34101 }); 34102 34103 realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{ 34104 'name': 'wrapper', 34105 'func': undefined 34106 }]; 34107 34108 // Add methods to `LazyWrapper`. 34109 LazyWrapper.prototype.clone = lazyClone; 34110 LazyWrapper.prototype.reverse = lazyReverse; 34111 LazyWrapper.prototype.value = lazyValue; 34112 34113 // Add chain sequence methods to the `lodash` wrapper. 34114 lodash.prototype.at = wrapperAt; 34115 lodash.prototype.chain = wrapperChain; 34116 lodash.prototype.commit = wrapperCommit; 34117 lodash.prototype.next = wrapperNext; 34118 lodash.prototype.plant = wrapperPlant; 34119 lodash.prototype.reverse = wrapperReverse; 34120 lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue; 34121 34122 // Add lazy aliases. 34123 lodash.prototype.first = lodash.prototype.head; 34124 34125 if (symIterator) { 34126 lodash.prototype[symIterator] = wrapperToIterator; 34127 } 34128 return lodash; 34129 }); 34130 34131 /*--------------------------------------------------------------------------*/ 34132 34133 // Export lodash. 34134 var _ = runInContext(); 34135 34136 // Some AMD build optimizers, like r.js, check for condition patterns like: 34137 if (true) { 34138 // Expose Lodash on the global object to prevent errors when Lodash is 34139 // loaded by a script tag in the presence of an AMD loader. 34140 // See http://requirejs.org/docs/errors.html#mismatch for more details. 34141 // Use `_.noConflict` to remove Lodash from the global object. 34142 root._ = _; 34143 34144 // Define as an anonymous module so, through path mapping, it can be 34145 // referenced as the "underscore" module. 34146 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { 34147 return _; 34148 }).call(exports, __webpack_require__, exports, module), 34149 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 34150 } 34151 // Check for `exports` after `define` in case a build optimizer adds it. 34152 else {} 34153}.call(this)); 34154 34155/* 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))) 34156 34157/***/ }), 34158
vendor: 89,123 bytes, lines 34159-36788
34159/***/ "./node_modules/popper.js/dist/esm/popper.js": 34160/*!***************************************************!*\ 34161 !*** ./node_modules/popper.js/dist/esm/popper.js ***! 34162 \***************************************************/ 34163/*! exports provided: default */ 34164/***/ (function(module, __webpack_exports__, __webpack_require__) { 34165 34166"use strict"; 34167__webpack_require__.r(__webpack_exports__); 34168/* WEBPACK VAR INJECTION */(function(global) {/**! 34169 * @fileOverview Kickass library to create and place poppers near their reference elements. 34170 * @version 1.16.1 34171 * @license 34172 * Copyright (c) 2016 Federico Zivolo and contributors 34173 * 34174 * Permission is hereby granted, free of charge, to any person obtaining a copy 34175 * of this software and associated documentation files (the "Software"), to deal 34176 * in the Software without restriction, including without limitation the rights 34177 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 34178 * copies of the Software, and to permit persons to whom the Software is 34179 * furnished to do so, subject to the following conditions: 34180 * 34181 * The above copyright notice and this permission notice shall be included in all 34182 * copies or substantial portions of the Software. 34183 * 34184 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 34185 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 34186 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34187 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34188 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34189 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 34190 * SOFTWARE. 34191 */ 34192var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined'; 34193 34194var timeoutDuration = function () { 34195 var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox']; 34196 for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) { 34197 if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) { 34198 return 1; 34199 } 34200 } 34201 return 0; 34202}(); 34203 34204function microtaskDebounce(fn) { 34205 var called = false; 34206 return function () { 34207 if (called) { 34208 return; 34209 } 34210 called = true; 34211 window.Promise.resolve().then(function () { 34212 called = false; 34213 fn(); 34214 }); 34215 }; 34216} 34217 34218function taskDebounce(fn) { 34219 var scheduled = false; 34220 return function () { 34221 if (!scheduled) { 34222 scheduled = true; 34223 setTimeout(function () { 34224 scheduled = false; 34225 fn(); 34226 }, timeoutDuration); 34227 } 34228 }; 34229} 34230 34231var supportsMicroTasks = isBrowser && window.Promise; 34232 34233/** 34234* Create a debounced version of a method, that's asynchronously deferred 34235* but called in the minimum time possible. 34236* 34237* @method 34238* @memberof Popper.Utils 34239* @argument {Function} fn 34240* @returns {Function} 34241*/ 34242var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce; 34243 34244/** 34245 * Check if the given variable is a function 34246 * @method 34247 * @memberof Popper.Utils 34248 * @argument {Any} functionToCheck - variable to check 34249 * @returns {Boolean} answer to: is a function? 34250 */ 34251function isFunction(functionToCheck) { 34252 var getType = {}; 34253 return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; 34254} 34255 34256/** 34257 * Get CSS computed property of the given element 34258 * @method 34259 * @memberof Popper.Utils 34260 * @argument {Eement} element 34261 * @argument {String} property 34262 */ 34263function getStyleComputedProperty(element, property) { 34264 if (element.nodeType !== 1) { 34265 return []; 34266 } 34267 // NOTE: 1 DOM access here 34268 var window = element.ownerDocument.defaultView; 34269 var css = window.getComputedStyle(element, null); 34270 return property ? css[property] : css; 34271} 34272 34273/** 34274 * Returns the parentNode or the host of the element 34275 * @method 34276 * @memberof Popper.Utils 34277 * @argument {Element} element 34278 * @returns {Element} parent 34279 */ 34280function getParentNode(element) { 34281 if (element.nodeName === 'HTML') { 34282 return element; 34283 } 34284 return element.parentNode || element.host; 34285} 34286 34287/** 34288 * Returns the scrolling parent of the given element 34289 * @method 34290 * @memberof Popper.Utils 34291 * @argument {Element} element 34292 * @returns {Element} scroll parent 34293 */ 34294function getScrollParent(element) { 34295 // Return body, `getScroll` will take care to get the correct `scrollTop` from it 34296 if (!element) { 34297 return document.body; 34298 } 34299 34300 switch (element.nodeName) { 34301 case 'HTML': 34302 case 'BODY': 34303 return element.ownerDocument.body; 34304 case '#document': 34305 return element.body; 34306 } 34307 34308 // Firefox want us to check `-x` and `-y` variations as well 34309 34310 var _getStyleComputedProp = getStyleComputedProperty(element), 34311 overflow = _getStyleComputedProp.overflow, 34312 overflowX = _getStyleComputedProp.overflowX, 34313 overflowY = _getStyleComputedProp.overflowY; 34314 34315 if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) { 34316 return element; 34317 } 34318 34319 return getScrollParent(getParentNode(element)); 34320} 34321 34322/** 34323 * Returns the reference node of the reference object, or the reference object itself. 34324 * @method 34325 * @memberof Popper.Utils 34326 * @param {Element|Object} reference - the reference element (the popper will be relative to this) 34327 * @returns {Element} parent 34328 */ 34329function getReferenceNode(reference) { 34330 return reference && reference.referenceNode ? reference.referenceNode : reference; 34331} 34332 34333var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode); 34334var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent); 34335 34336/** 34337 * Determines if the browser is Internet Explorer 34338 * @method 34339 * @memberof Popper.Utils 34340 * @param {Number} version to check 34341 * @returns {Boolean} isIE 34342 */ 34343function isIE(version) { 34344 if (version === 11) { 34345 return isIE11; 34346 } 34347 if (version === 10) { 34348 return isIE10; 34349 } 34350 return isIE11 || isIE10; 34351} 34352 34353/** 34354 * Returns the offset parent of the given element 34355 * @method 34356 * @memberof Popper.Utils 34357 * @argument {Element} element 34358 * @returns {Element} offset parent 34359 */ 34360function getOffsetParent(element) { 34361 if (!element) { 34362 return document.documentElement; 34363 } 34364 34365 var noOffsetParent = isIE(10) ? document.body : null; 34366 34367 // NOTE: 1 DOM access here 34368 var offsetParent = element.offsetParent || null; 34369 // Skip hidden elements which don't have an offsetParent 34370 while (offsetParent === noOffsetParent && element.nextElementSibling) { 34371 offsetParent = (element = element.nextElementSibling).offsetParent; 34372 } 34373 34374 var nodeName = offsetParent && offsetParent.nodeName; 34375 34376 if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') { 34377 return element ? element.ownerDocument.documentElement : document.documentElement; 34378 } 34379 34380 // .offsetParent will return the closest TH, TD or TABLE in case 34381 // no offsetParent is present, I hate this job... 34382 if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') { 34383 return getOffsetParent(offsetParent); 34384 } 34385 34386 return offsetParent; 34387} 34388 34389function isOffsetContainer(element) { 34390 var nodeName = element.nodeName; 34391 34392 if (nodeName === 'BODY') { 34393 return false; 34394 } 34395 return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element; 34396} 34397 34398/** 34399 * Finds the root node (document, shadowDOM root) of the given element 34400 * @method 34401 * @memberof Popper.Utils 34402 * @argument {Element} node 34403 * @returns {Element} root node 34404 */ 34405function getRoot(node) { 34406 if (node.parentNode !== null) { 34407 return getRoot(node.parentNode); 34408 } 34409 34410 return node; 34411} 34412 34413/** 34414 * Finds the offset parent common to the two provided nodes 34415 * @method 34416 * @memberof Popper.Utils 34417 * @argument {Element} element1 34418 * @argument {Element} element2 34419 * @returns {Element} common offset parent 34420 */ 34421function findCommonOffsetParent(element1, element2) { 34422 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 34423 if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) { 34424 return document.documentElement; 34425 } 34426 34427 // Here we make sure to give as "start" the element that comes first in the DOM 34428 var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING; 34429 var start = order ? element1 : element2; 34430 var end = order ? element2 : element1; 34431 34432 // Get common ancestor container 34433 var range = document.createRange(); 34434 range.setStart(start, 0); 34435 range.setEnd(end, 0); 34436 var commonAncestorContainer = range.commonAncestorContainer; 34437 34438 // Both nodes are inside #document 34439 34440 if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) { 34441 if (isOffsetContainer(commonAncestorContainer)) { 34442 return commonAncestorContainer; 34443 } 34444 34445 return getOffsetParent(commonAncestorContainer); 34446 } 34447 34448 // one of the nodes is inside shadowDOM, find which one 34449 var element1root = getRoot(element1); 34450 if (element1root.host) { 34451 return findCommonOffsetParent(element1root.host, element2); 34452 } else { 34453 return findCommonOffsetParent(element1, getRoot(element2).host); 34454 } 34455} 34456 34457/** 34458 * Gets the scroll value of the given element in the given side (top and left) 34459 * @method 34460 * @memberof Popper.Utils 34461 * @argument {Element} element 34462 * @argument {String} side `top` or `left` 34463 * @returns {number} amount of scrolled pixels 34464 */ 34465function getScroll(element) { 34466 var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top'; 34467 34468 var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft'; 34469 var nodeName = element.nodeName; 34470 34471 if (nodeName === 'BODY' || nodeName === 'HTML') { 34472 var html = element.ownerDocument.documentElement; 34473 var scrollingElement = element.ownerDocument.scrollingElement || html; 34474 return scrollingElement[upperSide]; 34475 } 34476 34477 return element[upperSide]; 34478} 34479 34480/* 34481 * Sum or subtract the element scroll values (left and top) from a given rect object 34482 * @method 34483 * @memberof Popper.Utils 34484 * @param {Object} rect - Rect object you want to change 34485 * @param {HTMLElement} element - The element from the function reads the scroll values 34486 * @param {Boolean} subtract - set to true if you want to subtract the scroll values 34487 * @return {Object} rect - The modifier rect object 34488 */ 34489function includeScroll(rect, element) { 34490 var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 34491 34492 var scrollTop = getScroll(element, 'top'); 34493 var scrollLeft = getScroll(element, 'left'); 34494 var modifier = subtract ? -1 : 1; 34495 rect.top += scrollTop * modifier; 34496 rect.bottom += scrollTop * modifier; 34497 rect.left += scrollLeft * modifier; 34498 rect.right += scrollLeft * modifier; 34499 return rect; 34500} 34501 34502/* 34503 * Helper to detect borders of a given element 34504 * @method 34505 * @memberof Popper.Utils 34506 * @param {CSSStyleDeclaration} styles 34507 * Result of `getStyleComputedProperty` on the given element 34508 * @param {String} axis - `x` or `y` 34509 * @return {number} borders - The borders size of the given axis 34510 */ 34511 34512function getBordersSize(styles, axis) { 34513 var sideA = axis === 'x' ? 'Left' : 'Top'; 34514 var sideB = sideA === 'Left' ? 'Right' : 'Bottom'; 34515 34516 return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']); 34517} 34518 34519function getSize(axis, body, html, computedStyle) { 34520 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); 34521} 34522 34523function getWindowSizes(document) { 34524 var body = document.body; 34525 var html = document.documentElement; 34526 var computedStyle = isIE(10) && getComputedStyle(html); 34527 34528 return { 34529 height: getSize('Height', body, html, computedStyle), 34530 width: getSize('Width', body, html, computedStyle) 34531 }; 34532} 34533 34534var classCallCheck = function (instance, Constructor) { 34535 if (!(instance instanceof Constructor)) { 34536 throw new TypeError("Cannot call a class as a function"); 34537 } 34538}; 34539 34540var createClass = function () { 34541 function defineProperties(target, props) { 34542 for (var i = 0; i < props.length; i++) { 34543 var descriptor = props[i]; 34544 descriptor.enumerable = descriptor.enumerable || false; 34545 descriptor.configurable = true; 34546 if ("value" in descriptor) descriptor.writable = true; 34547 Object.defineProperty(target, descriptor.key, descriptor); 34548 } 34549 } 34550 34551 return function (Constructor, protoProps, staticProps) { 34552 if (protoProps) defineProperties(Constructor.prototype, protoProps); 34553 if (staticProps) defineProperties(Constructor, staticProps); 34554 return Constructor; 34555 }; 34556}(); 34557 34558 34559 34560 34561 34562var defineProperty = function (obj, key, value) { 34563 if (key in obj) { 34564 Object.defineProperty(obj, key, { 34565 value: value, 34566 enumerable: true, 34567 configurable: true, 34568 writable: true 34569 }); 34570 } else { 34571 obj[key] = value; 34572 } 34573 34574 return obj; 34575}; 34576 34577var _extends = Object.assign || function (target) { 34578 for (var i = 1; i < arguments.length; i++) { 34579 var source = arguments[i]; 34580 34581 for (var key in source) { 34582 if (Object.prototype.hasOwnProperty.call(source, key)) { 34583 target[key] = source[key]; 34584 } 34585 } 34586 } 34587 34588 return target; 34589}; 34590 34591/** 34592 * Given element offsets, generate an output similar to getBoundingClientRect 34593 * @method 34594 * @memberof Popper.Utils 34595 * @argument {Object} offsets 34596 * @returns {Object} ClientRect like output 34597 */ 34598function getClientRect(offsets) { 34599 return _extends({}, offsets, { 34600 right: offsets.left + offsets.width, 34601 bottom: offsets.top + offsets.height 34602 }); 34603} 34604 34605/** 34606 * Get bounding client rect of given element 34607 * @method 34608 * @memberof Popper.Utils 34609 * @param {HTMLElement} element 34610 * @return {Object} client rect 34611 */ 34612function getBoundingClientRect(element) { 34613 var rect = {}; 34614 34615 // IE10 10 FIX: Please, don't ask, the element isn't 34616 // considered in DOM in some circumstances... 34617 // This isn't reproducible in IE10 compatibility mode of IE11 34618 try { 34619 if (isIE(10)) { 34620 rect = element.getBoundingClientRect(); 34621 var scrollTop = getScroll(element, 'top'); 34622 var scrollLeft = getScroll(element, 'left'); 34623 rect.top += scrollTop; 34624 rect.left += scrollLeft; 34625 rect.bottom += scrollTop; 34626 rect.right += scrollLeft; 34627 } else { 34628 rect = element.getBoundingClientRect(); 34629 } 34630 } catch (e) {} 34631 34632 var result = { 34633 left: rect.left, 34634 top: rect.top, 34635 width: rect.right - rect.left, 34636 height: rect.bottom - rect.top 34637 }; 34638 34639 // subtract scrollbar size from sizes 34640 var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {}; 34641 var width = sizes.width || element.clientWidth || result.width; 34642 var height = sizes.height || element.clientHeight || result.height; 34643 34644 var horizScrollbar = element.offsetWidth - width; 34645 var vertScrollbar = element.offsetHeight - height; 34646 34647 // if an hypothetical scrollbar is detected, we must be sure it's not a `border` 34648 // we make this check conditional for performance reasons 34649 if (horizScrollbar || vertScrollbar) { 34650 var styles = getStyleComputedProperty(element); 34651 horizScrollbar -= getBordersSize(styles, 'x'); 34652 vertScrollbar -= getBordersSize(styles, 'y'); 34653 34654 result.width -= horizScrollbar; 34655 result.height -= vertScrollbar; 34656 } 34657 34658 return getClientRect(result); 34659} 34660 34661function getOffsetRectRelativeToArbitraryNode(children, parent) { 34662 var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 34663 34664 var isIE10 = isIE(10); 34665 var isHTML = parent.nodeName === 'HTML'; 34666 var childrenRect = getBoundingClientRect(children); 34667 var parentRect = getBoundingClientRect(parent); 34668 var scrollParent = getScrollParent(children); 34669 34670 var styles = getStyleComputedProperty(parent); 34671 var borderTopWidth = parseFloat(styles.borderTopWidth); 34672 var borderLeftWidth = parseFloat(styles.borderLeftWidth); 34673 34674 // In cases where the parent is fixed, we must ignore negative scroll in offset calc 34675 if (fixedPosition && isHTML) { 34676 parentRect.top = Math.max(parentRect.top, 0); 34677 parentRect.left = Math.max(parentRect.left, 0); 34678 } 34679 var offsets = getClientRect({ 34680 top: childrenRect.top - parentRect.top - borderTopWidth, 34681 left: childrenRect.left - parentRect.left - borderLeftWidth, 34682 width: childrenRect.width, 34683 height: childrenRect.height 34684 }); 34685 offsets.marginTop = 0; 34686 offsets.marginLeft = 0; 34687 34688 // Subtract margins of documentElement in case it's being used as parent 34689 // we do this only on HTML because it's the only element that behaves 34690 // differently when margins are applied to it. The margins are included in 34691 // the box of the documentElement, in the other cases not. 34692 if (!isIE10 && isHTML) { 34693 var marginTop = parseFloat(styles.marginTop); 34694 var marginLeft = parseFloat(styles.marginLeft); 34695 34696 offsets.top -= borderTopWidth - marginTop; 34697 offsets.bottom -= borderTopWidth - marginTop; 34698 offsets.left -= borderLeftWidth - marginLeft; 34699 offsets.right -= borderLeftWidth - marginLeft; 34700 34701 // Attach marginTop and marginLeft because in some circumstances we may need them 34702 offsets.marginTop = marginTop; 34703 offsets.marginLeft = marginLeft; 34704 } 34705 34706 if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') { 34707 offsets = includeScroll(offsets, parent); 34708 } 34709 34710 return offsets; 34711} 34712 34713function getViewportOffsetRectRelativeToArtbitraryNode(element) { 34714 var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 34715 34716 var html = element.ownerDocument.documentElement; 34717 var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html); 34718 var width = Math.max(html.clientWidth, window.innerWidth || 0); 34719 var height = Math.max(html.clientHeight, window.innerHeight || 0); 34720 34721 var scrollTop = !excludeScroll ? getScroll(html) : 0; 34722 var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0; 34723 34724 var offset = { 34725 top: scrollTop - relativeOffset.top + relativeOffset.marginTop, 34726 left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft, 34727 width: width, 34728 height: height 34729 }; 34730 34731 return getClientRect(offset); 34732} 34733 34734/** 34735 * Check if the given element is fixed or is inside a fixed parent 34736 * @method 34737 * @memberof Popper.Utils 34738 * @argument {Element} element 34739 * @argument {Element} customContainer 34740 * @returns {Boolean} answer to "isFixed?" 34741 */ 34742function isFixed(element) { 34743 var nodeName = element.nodeName; 34744 if (nodeName === 'BODY' || nodeName === 'HTML') { 34745 return false; 34746 } 34747 if (getStyleComputedProperty(element, 'position') === 'fixed') { 34748 return true; 34749 } 34750 var parentNode = getParentNode(element); 34751 if (!parentNode) { 34752 return false; 34753 } 34754 return isFixed(parentNode); 34755} 34756 34757/** 34758 * Finds the first parent of an element that has a transformed property defined 34759 * @method 34760 * @memberof Popper.Utils 34761 * @argument {Element} element 34762 * @returns {Element} first transformed parent or documentElement 34763 */ 34764 34765function getFixedPositionOffsetParent(element) { 34766 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 34767 if (!element || !element.parentElement || isIE()) { 34768 return document.documentElement; 34769 } 34770 var el = element.parentElement; 34771 while (el && getStyleComputedProperty(el, 'transform') === 'none') { 34772 el = el.parentElement; 34773 } 34774 return el || document.documentElement; 34775} 34776 34777/** 34778 * Computed the boundaries limits and return them 34779 * @method 34780 * @memberof Popper.Utils 34781 * @param {HTMLElement} popper 34782 * @param {HTMLElement} reference 34783 * @param {number} padding 34784 * @param {HTMLElement} boundariesElement - Element used to define the boundaries 34785 * @param {Boolean} fixedPosition - Is in fixed position mode 34786 * @returns {Object} Coordinates of the boundaries 34787 */ 34788function getBoundaries(popper, reference, padding, boundariesElement) { 34789 var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; 34790 34791 // NOTE: 1 DOM access here 34792 34793 var boundaries = { top: 0, left: 0 }; 34794 var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference)); 34795 34796 // Handle viewport case 34797 if (boundariesElement === 'viewport') { 34798 boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition); 34799 } else { 34800 // Handle other cases based on DOM element used as boundaries 34801 var boundariesNode = void 0; 34802 if (boundariesElement === 'scrollParent') { 34803 boundariesNode = getScrollParent(getParentNode(reference)); 34804 if (boundariesNode.nodeName === 'BODY') { 34805 boundariesNode = popper.ownerDocument.documentElement; 34806 } 34807 } else if (boundariesElement === 'window') { 34808 boundariesNode = popper.ownerDocument.documentElement; 34809 } else { 34810 boundariesNode = boundariesElement; 34811 } 34812 34813 var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition); 34814 34815 // In case of HTML, we need a different computation 34816 if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) { 34817 var _getWindowSizes = getWindowSizes(popper.ownerDocument), 34818 height = _getWindowSizes.height, 34819 width = _getWindowSizes.width; 34820 34821 boundaries.top += offsets.top - offsets.marginTop; 34822 boundaries.bottom = height + offsets.top; 34823 boundaries.left += offsets.left - offsets.marginLeft; 34824 boundaries.right = width + offsets.left; 34825 } else { 34826 // for all the other DOM elements, this one is good 34827 boundaries = offsets; 34828 } 34829 } 34830 34831 // Add paddings 34832 padding = padding || 0; 34833 var isPaddingNumber = typeof padding === 'number'; 34834 boundaries.left += isPaddingNumber ? padding : padding.left || 0; 34835 boundaries.top += isPaddingNumber ? padding : padding.top || 0; 34836 boundaries.right -= isPaddingNumber ? padding : padding.right || 0; 34837 boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0; 34838 34839 return boundaries; 34840} 34841 34842function getArea(_ref) { 34843 var width = _ref.width, 34844 height = _ref.height; 34845 34846 return width * height; 34847} 34848 34849/** 34850 * Utility used to transform the `auto` placement to the placement with more 34851 * available space. 34852 * @method 34853 * @memberof Popper.Utils 34854 * @argument {Object} data - The data object generated by update method 34855 * @argument {Object} options - Modifiers configuration and options 34856 * @returns {Object} The data object, properly modified 34857 */ 34858function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) { 34859 var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; 34860 34861 if (placement.indexOf('auto') === -1) { 34862 return placement; 34863 } 34864 34865 var boundaries = getBoundaries(popper, reference, padding, boundariesElement); 34866 34867 var rects = { 34868 top: { 34869 width: boundaries.width, 34870 height: refRect.top - boundaries.top 34871 }, 34872 right: { 34873 width: boundaries.right - refRect.right, 34874 height: boundaries.height 34875 }, 34876 bottom: { 34877 width: boundaries.width, 34878 height: boundaries.bottom - refRect.bottom 34879 }, 34880 left: { 34881 width: refRect.left - boundaries.left, 34882 height: boundaries.height 34883 } 34884 }; 34885 34886 var sortedAreas = Object.keys(rects).map(function (key) { 34887 return _extends({ 34888 key: key 34889 }, rects[key], { 34890 area: getArea(rects[key]) 34891 }); 34892 }).sort(function (a, b) { 34893 return b.area - a.area; 34894 }); 34895 34896 var filteredAreas = sortedAreas.filter(function (_ref2) { 34897 var width = _ref2.width, 34898 height = _ref2.height; 34899 return width >= popper.clientWidth && height >= popper.clientHeight; 34900 }); 34901 34902 var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key; 34903 34904 var variation = placement.split('-')[1]; 34905 34906 return computedPlacement + (variation ? '-' + variation : ''); 34907} 34908 34909/** 34910 * Get offsets to the reference element 34911 * @method 34912 * @memberof Popper.Utils 34913 * @param {Object} state 34914 * @param {Element} popper - the popper element 34915 * @param {Element} reference - the reference element (the popper will be relative to this) 34916 * @param {Element} fixedPosition - is in fixed position mode 34917 * @returns {Object} An object containing the offsets which will be applied to the popper 34918 */ 34919function getReferenceOffsets(state, popper, reference) { 34920 var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 34921 34922 var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference)); 34923 return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition); 34924} 34925 34926/** 34927 * Get the outer sizes of the given element (offset size + margins) 34928 * @method 34929 * @memberof Popper.Utils 34930 * @argument {Element} element 34931 * @returns {Object} object containing width and height properties 34932 */ 34933function getOuterSizes(element) { 34934 var window = element.ownerDocument.defaultView; 34935 var styles = window.getComputedStyle(element); 34936 var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0); 34937 var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0); 34938 var result = { 34939 width: element.offsetWidth + y, 34940 height: element.offsetHeight + x 34941 }; 34942 return result; 34943} 34944 34945/** 34946 * Get the opposite placement of the given one 34947 * @method 34948 * @memberof Popper.Utils 34949 * @argument {String} placement 34950 * @returns {String} flipped placement 34951 */ 34952function getOppositePlacement(placement) { 34953 var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; 34954 return placement.replace(/left|right|bottom|top/g, function (matched) { 34955 return hash[matched]; 34956 }); 34957} 34958 34959/** 34960 * Get offsets to the popper 34961 * @method 34962 * @memberof Popper.Utils 34963 * @param {Object} position - CSS position the Popper will get applied 34964 * @param {HTMLElement} popper - the popper element 34965 * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this) 34966 * @param {String} placement - one of the valid placement options 34967 * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper 34968 */ 34969function getPopperOffsets(popper, referenceOffsets, placement) { 34970 placement = placement.split('-')[0]; 34971 34972 // Get popper node sizes 34973 var popperRect = getOuterSizes(popper); 34974 34975 // Add position, width and height to our offsets object 34976 var popperOffsets = { 34977 width: popperRect.width, 34978 height: popperRect.height 34979 }; 34980 34981 // depending by the popper placement we have to compute its offsets slightly differently 34982 var isHoriz = ['right', 'left'].indexOf(placement) !== -1; 34983 var mainSide = isHoriz ? 'top' : 'left'; 34984 var secondarySide = isHoriz ? 'left' : 'top'; 34985 var measurement = isHoriz ? 'height' : 'width'; 34986 var secondaryMeasurement = !isHoriz ? 'height' : 'width'; 34987 34988 popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; 34989 if (placement === secondarySide) { 34990 popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; 34991 } else { 34992 popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)]; 34993 } 34994 34995 return popperOffsets; 34996} 34997 34998/** 34999 * Mimics the `find` method of Array 35000 * @method 35001 * @memberof Popper.Utils 35002 * @argument {Array} arr 35003 * @argument prop 35004 * @argument value 35005 * @returns index or -1 35006 */ 35007function find(arr, check) { 35008 // use native find if supported 35009 if (Array.prototype.find) { 35010 return arr.find(check); 35011 } 35012 35013 // use `filter` to obtain the same behavior of `find` 35014 return arr.filter(check)[0]; 35015} 35016 35017/** 35018 * Return the index of the matching object 35019 * @method 35020 * @memberof Popper.Utils 35021 * @argument {Array} arr 35022 * @argument prop 35023 * @argument value 35024 * @returns index or -1 35025 */ 35026function findIndex(arr, prop, value) { 35027 // use native findIndex if supported 35028 if (Array.prototype.findIndex) { 35029 return arr.findIndex(function (cur) { 35030 return cur[prop] === value; 35031 }); 35032 } 35033 35034 // use `find` + `indexOf` if `findIndex` isn't supported 35035 var match = find(arr, function (obj) { 35036 return obj[prop] === value; 35037 }); 35038 return arr.indexOf(match); 35039} 35040 35041/** 35042 * Loop trough the list of modifiers and run them in order, 35043 * each of them will then edit the data object. 35044 * @method 35045 * @memberof Popper.Utils 35046 * @param {dataObject} data 35047 * @param {Array} modifiers 35048 * @param {String} ends - Optional modifier name used as stopper 35049 * @returns {dataObject} 35050 */ 35051function runModifiers(modifiers, data, ends) { 35052 var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends)); 35053 35054 modifiersToRun.forEach(function (modifier) { 35055 if (modifier['function']) { 35056 // eslint-disable-line dot-notation 35057 console.warn('`modifier.function` is deprecated, use `modifier.fn`!'); 35058 } 35059 var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation 35060 if (modifier.enabled && isFunction(fn)) { 35061 // Add properties to offsets to make them a complete clientRect object 35062 // we do this before each modifier to make sure the previous one doesn't 35063 // mess with these values 35064 data.offsets.popper = getClientRect(data.offsets.popper); 35065 data.offsets.reference = getClientRect(data.offsets.reference); 35066 35067 data = fn(data, modifier); 35068 } 35069 }); 35070 35071 return data; 35072} 35073 35074/** 35075 * Updates the position of the popper, computing the new offsets and applying 35076 * the new style.<br /> 35077 * Prefer `scheduleUpdate` over `update` because of performance reasons. 35078 * @method 35079 * @memberof Popper 35080 */ 35081function update() { 35082 // if popper is destroyed, don't perform any further update 35083 if (this.state.isDestroyed) { 35084 return; 35085 } 35086 35087 var data = { 35088 instance: this, 35089 styles: {}, 35090 arrowStyles: {}, 35091 attributes: {}, 35092 flipped: false, 35093 offsets: {} 35094 }; 35095 35096 // compute reference element offsets 35097 data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed); 35098 35099 // compute auto placement, store placement inside the data object, 35100 // modifiers will be able to edit `placement` if needed 35101 // and refer to originalPlacement to know the original value 35102 data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); 35103 35104 // store the computed placement inside `originalPlacement` 35105 data.originalPlacement = data.placement; 35106 35107 data.positionFixed = this.options.positionFixed; 35108 35109 // compute the popper offsets 35110 data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); 35111 35112 data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute'; 35113 35114 // run the modifiers 35115 data = runModifiers(this.modifiers, data); 35116 35117 // the first `update` will call `onCreate` callback 35118 // the other ones will call `onUpdate` callback 35119 if (!this.state.isCreated) { 35120 this.state.isCreated = true; 35121 this.options.onCreate(data); 35122 } else { 35123 this.options.onUpdate(data); 35124 } 35125} 35126 35127/** 35128 * Helper used to know if the given modifier is enabled. 35129 * @method 35130 * @memberof Popper.Utils 35131 * @returns {Boolean} 35132 */ 35133function isModifierEnabled(modifiers, modifierName) { 35134 return modifiers.some(function (_ref) { 35135 var name = _ref.name, 35136 enabled = _ref.enabled; 35137 return enabled && name === modifierName; 35138 }); 35139} 35140 35141/** 35142 * Get the prefixed supported property name 35143 * @method 35144 * @memberof Popper.Utils 35145 * @argument {String} property (camelCase) 35146 * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) 35147 */ 35148function getSupportedPropertyName(property) { 35149 var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; 35150 var upperProp = property.charAt(0).toUpperCase() + property.slice(1); 35151 35152 for (var i = 0; i < prefixes.length; i++) { 35153 var prefix = prefixes[i]; 35154 var toCheck = prefix ? '' + prefix + upperProp : property; 35155 if (typeof document.body.style[toCheck] !== 'undefined') { 35156 return toCheck; 35157 } 35158 } 35159 return null; 35160} 35161 35162/** 35163 * Destroys the popper. 35164 * @method 35165 * @memberof Popper 35166 */ 35167function destroy() { 35168 this.state.isDestroyed = true; 35169 35170 // touch DOM only if `applyStyle` modifier is enabled 35171 if (isModifierEnabled(this.modifiers, 'applyStyle')) { 35172 this.popper.removeAttribute('x-placement'); 35173 this.popper.style.position = ''; 35174 this.popper.style.top = ''; 35175 this.popper.style.left = ''; 35176 this.popper.style.right = ''; 35177 this.popper.style.bottom = ''; 35178 this.popper.style.willChange = ''; 35179 this.popper.style[getSupportedPropertyName('transform')] = ''; 35180 } 35181 35182 this.disableEventListeners(); 35183 35184 // remove the popper if user explicitly asked for the deletion on destroy 35185 // do not use `remove` because IE11 doesn't support it 35186 if (this.options.removeOnDestroy) { 35187 this.popper.parentNode.removeChild(this.popper); 35188 } 35189 return this; 35190} 35191 35192/** 35193 * Get the window associated with the element 35194 * @argument {Element} element 35195 * @returns {Window} 35196 */ 35197function getWindow(element) { 35198 var ownerDocument = element.ownerDocument; 35199 return ownerDocument ? ownerDocument.defaultView : window; 35200} 35201 35202function attachToScrollParents(scrollParent, event, callback, scrollParents) { 35203 var isBody = scrollParent.nodeName === 'BODY'; 35204 var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent; 35205 target.addEventListener(event, callback, { passive: true }); 35206 35207 if (!isBody) { 35208 attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents); 35209 } 35210 scrollParents.push(target); 35211} 35212 35213/** 35214 * Setup needed event listeners used to update the popper position 35215 * @method 35216 * @memberof Popper.Utils 35217 * @private 35218 */ 35219function setupEventListeners(reference, options, state, updateBound) { 35220 // Resize event listener on window 35221 state.updateBound = updateBound; 35222 getWindow(reference).addEventListener('resize', state.updateBound, { passive: true }); 35223 35224 // Scroll event listener on scroll parents 35225 var scrollElement = getScrollParent(reference); 35226 attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents); 35227 state.scrollElement = scrollElement; 35228 state.eventsEnabled = true; 35229 35230 return state; 35231} 35232 35233/** 35234 * It will add resize/scroll events and start recalculating 35235 * position of the popper element when they are triggered. 35236 * @method 35237 * @memberof Popper 35238 */ 35239function enableEventListeners() { 35240 if (!this.state.eventsEnabled) { 35241 this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); 35242 } 35243} 35244 35245/** 35246 * Remove event listeners used to update the popper position 35247 * @method 35248 * @memberof Popper.Utils 35249 * @private 35250 */ 35251function removeEventListeners(reference, state) { 35252 // Remove resize event listener on window 35253 getWindow(reference).removeEventListener('resize', state.updateBound); 35254 35255 // Remove scroll event listener on scroll parents 35256 state.scrollParents.forEach(function (target) { 35257 target.removeEventListener('scroll', state.updateBound); 35258 }); 35259 35260 // Reset state 35261 state.updateBound = null; 35262 state.scrollParents = []; 35263 state.scrollElement = null; 35264 state.eventsEnabled = false; 35265 return state; 35266} 35267 35268/** 35269 * It will remove resize/scroll events and won't recalculate popper position 35270 * when they are triggered. It also won't trigger `onUpdate` callback anymore, 35271 * unless you call `update` method manually. 35272 * @method 35273 * @memberof Popper 35274 */ 35275function disableEventListeners() { 35276 if (this.state.eventsEnabled) { 35277 cancelAnimationFrame(this.scheduleUpdate); 35278 this.state = removeEventListeners(this.reference, this.state); 35279 } 35280} 35281 35282/** 35283 * Tells if a given input is a number 35284 * @method 35285 * @memberof Popper.Utils 35286 * @param {*} input to check 35287 * @return {Boolean} 35288 */ 35289function isNumeric(n) { 35290 return n !== '' && !isNaN(parseFloat(n)) && isFinite(n); 35291} 35292 35293/** 35294 * Set the style to the given popper 35295 * @method 35296 * @memberof Popper.Utils 35297 * @argument {Element} element - Element to apply the style to 35298 * @argument {Object} styles 35299 * Object with a list of properties and values which will be applied to the element 35300 */ 35301function setStyles(element, styles) { 35302 Object.keys(styles).forEach(function (prop) { 35303 var unit = ''; 35304 // add unit if the value is numeric and is one of the following 35305 if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) { 35306 unit = 'px'; 35307 } 35308 element.style[prop] = styles[prop] + unit; 35309 }); 35310} 35311 35312/** 35313 * Set the attributes to the given popper 35314 * @method 35315 * @memberof Popper.Utils 35316 * @argument {Element} element - Element to apply the attributes to 35317 * @argument {Object} styles 35318 * Object with a list of properties and values which will be applied to the element 35319 */ 35320function setAttributes(element, attributes) { 35321 Object.keys(attributes).forEach(function (prop) { 35322 var value = attributes[prop]; 35323 if (value !== false) { 35324 element.setAttribute(prop, attributes[prop]); 35325 } else { 35326 element.removeAttribute(prop); 35327 } 35328 }); 35329} 35330 35331/** 35332 * @function 35333 * @memberof Modifiers 35334 * @argument {Object} data - The data object generated by `update` method 35335 * @argument {Object} data.styles - List of style properties - values to apply to popper element 35336 * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element 35337 * @argument {Object} options - Modifiers configuration and options 35338 * @returns {Object} The same data object 35339 */ 35340function applyStyle(data) { 35341 // any property present in `data.styles` will be applied to the popper, 35342 // in this way we can make the 3rd party modifiers add custom styles to it 35343 // Be aware, modifiers could override the properties defined in the previous 35344 // lines of this modifier! 35345 setStyles(data.instance.popper, data.styles); 35346 35347 // any property present in `data.attributes` will be applied to the popper, 35348 // they will be set as HTML attributes of the element 35349 setAttributes(data.instance.popper, data.attributes); 35350 35351 // if arrowElement is defined and arrowStyles has some properties 35352 if (data.arrowElement && Object.keys(data.arrowStyles).length) { 35353 setStyles(data.arrowElement, data.arrowStyles); 35354 } 35355 35356 return data; 35357} 35358 35359/** 35360 * Set the x-placement attribute before everything else because it could be used 35361 * to add margins to the popper margins needs to be calculated to get the 35362 * correct popper offsets. 35363 * @method 35364 * @memberof Popper.modifiers 35365 * @param {HTMLElement} reference - The reference element used to position the popper 35366 * @param {HTMLElement} popper - The HTML element used as popper 35367 * @param {Object} options - Popper.js options 35368 */ 35369function applyStyleOnLoad(reference, popper, options, modifierOptions, state) { 35370 // compute reference element offsets 35371 var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed); 35372 35373 // compute auto placement, store placement inside the data object, 35374 // modifiers will be able to edit `placement` if needed 35375 // and refer to originalPlacement to know the original value 35376 var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding); 35377 35378 popper.setAttribute('x-placement', placement); 35379 35380 // Apply `position` to popper before anything else because 35381 // without the position applied we can't guarantee correct computations 35382 setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' }); 35383 35384 return options; 35385} 35386 35387/** 35388 * @function 35389 * @memberof Popper.Utils 35390 * @argument {Object} data - The data object generated by `update` method 35391 * @argument {Boolean} shouldRound - If the offsets should be rounded at all 35392 * @returns {Object} The popper's position offsets rounded 35393 * 35394 * The tale of pixel-perfect positioning. It's still not 100% perfect, but as 35395 * good as it can be within reason. 35396 * Discussion here: https://github.com/FezVrasta/popper.js/pull/715 35397 * 35398 * Low DPI screens cause a popper to be blurry if not using full pixels (Safari 35399 * as well on High DPI screens). 35400 * 35401 * Firefox prefers no rounding for positioning and does not have blurriness on 35402 * high DPI screens. 35403 * 35404 * Only horizontal placement and left/right values need to be considered. 35405 */ 35406function getRoundedOffsets(data, shouldRound) { 35407 var _data$offsets = data.offsets, 35408 popper = _data$offsets.popper, 35409 reference = _data$offsets.reference; 35410 var round = Math.round, 35411 floor = Math.floor; 35412 35413 var noRound = function noRound(v) { 35414 return v; 35415 }; 35416 35417 var referenceWidth = round(reference.width); 35418 var popperWidth = round(popper.width); 35419 35420 var isVertical = ['left', 'right'].indexOf(data.placement) !== -1; 35421 var isVariation = data.placement.indexOf('-') !== -1; 35422 var sameWidthParity = referenceWidth % 2 === popperWidth % 2; 35423 var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1; 35424 35425 var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor; 35426 var verticalToInteger = !shouldRound ? noRound : round; 35427 35428 return { 35429 left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left), 35430 top: verticalToInteger(popper.top), 35431 bottom: verticalToInteger(popper.bottom), 35432 right: horizontalToInteger(popper.right) 35433 }; 35434} 35435 35436var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent); 35437 35438/** 35439 * @function 35440 * @memberof Modifiers 35441 * @argument {Object} data - The data object generated by `update` method 35442 * @argument {Object} options - Modifiers configuration and options 35443 * @returns {Object} The data object, properly modified 35444 */ 35445function computeStyle(data, options) { 35446 var x = options.x, 35447 y = options.y; 35448 var popper = data.offsets.popper; 35449 35450 // Remove this legacy support in Popper.js v2 35451 35452 var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) { 35453 return modifier.name === 'applyStyle'; 35454 }).gpuAcceleration; 35455 if (legacyGpuAccelerationOption !== undefined) { 35456 console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!'); 35457 } 35458 var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration; 35459 35460 var offsetParent = getOffsetParent(data.instance.popper); 35461 var offsetParentRect = getBoundingClientRect(offsetParent); 35462 35463 // Styles 35464 var styles = { 35465 position: popper.position 35466 }; 35467 35468 var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox); 35469 35470 var sideA = x === 'bottom' ? 'top' : 'bottom'; 35471 var sideB = y === 'right' ? 'left' : 'right'; 35472 35473 // if gpuAcceleration is set to `true` and transform is supported, 35474 // we use `translate3d` to apply the position to the popper we 35475 // automatically use the supported prefixed version if needed 35476 var prefixedProperty = getSupportedPropertyName('transform'); 35477 35478 // now, let's make a step back and look at this code closely (wtf?) 35479 // If the content of the popper grows once it's been positioned, it 35480 // may happen that the popper gets misplaced because of the new content 35481 // overflowing its reference element 35482 // To avoid this problem, we provide two options (x and y), which allow 35483 // the consumer to define the offset origin. 35484 // If we position a popper on top of a reference element, we can set 35485 // `x` to `top` to make the popper grow towards its top instead of 35486 // its bottom. 35487 var left = void 0, 35488 top = void 0; 35489 if (sideA === 'bottom') { 35490 // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar) 35491 // and not the bottom of the html element 35492 if (offsetParent.nodeName === 'HTML') { 35493 top = -offsetParent.clientHeight + offsets.bottom; 35494 } else { 35495 top = -offsetParentRect.height + offsets.bottom; 35496 } 35497 } else { 35498 top = offsets.top; 35499 } 35500 if (sideB === 'right') { 35501 if (offsetParent.nodeName === 'HTML') { 35502 left = -offsetParent.clientWidth + offsets.right; 35503 } else { 35504 left = -offsetParentRect.width + offsets.right; 35505 } 35506 } else { 35507 left = offsets.left; 35508 } 35509 if (gpuAcceleration && prefixedProperty) { 35510 styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)'; 35511 styles[sideA] = 0; 35512 styles[sideB] = 0; 35513 styles.willChange = 'transform'; 35514 } else { 35515 // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties 35516 var invertTop = sideA === 'bottom' ? -1 : 1; 35517 var invertLeft = sideB === 'right' ? -1 : 1; 35518 styles[sideA] = top * invertTop; 35519 styles[sideB] = left * invertLeft; 35520 styles.willChange = sideA + ', ' + sideB; 35521 } 35522 35523 // Attributes 35524 var attributes = { 35525 'x-placement': data.placement 35526 }; 35527 35528 // Update `data` attributes, styles and arrowStyles 35529 data.attributes = _extends({}, attributes, data.attributes); 35530 data.styles = _extends({}, styles, data.styles); 35531 data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles); 35532 35533 return data; 35534} 35535 35536/** 35537 * Helper used to know if the given modifier depends from another one.<br /> 35538 * It checks if the needed modifier is listed and enabled. 35539 * @method 35540 * @memberof Popper.Utils 35541 * @param {Array} modifiers - list of modifiers 35542 * @param {String} requestingName - name of requesting modifier 35543 * @param {String} requestedName - name of requested modifier 35544 * @returns {Boolean} 35545 */ 35546function isModifierRequired(modifiers, requestingName, requestedName) { 35547 var requesting = find(modifiers, function (_ref) { 35548 var name = _ref.name; 35549 return name === requestingName; 35550 }); 35551 35552 var isRequired = !!requesting && modifiers.some(function (modifier) { 35553 return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; 35554 }); 35555 35556 if (!isRequired) { 35557 var _requesting = '`' + requestingName + '`'; 35558 var requested = '`' + requestedName + '`'; 35559 console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!'); 35560 } 35561 return isRequired; 35562} 35563 35564/** 35565 * @function 35566 * @memberof Modifiers 35567 * @argument {Object} data - The data object generated by update method 35568 * @argument {Object} options - Modifiers configuration and options 35569 * @returns {Object} The data object, properly modified 35570 */ 35571function arrow(data, options) { 35572 var _data$offsets$arrow; 35573 35574 // arrow depends on keepTogether in order to work 35575 if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) { 35576 return data; 35577 } 35578 35579 var arrowElement = options.element; 35580 35581 // if arrowElement is a string, suppose it's a CSS selector 35582 if (typeof arrowElement === 'string') { 35583 arrowElement = data.instance.popper.querySelector(arrowElement); 35584 35585 // if arrowElement is not found, don't run the modifier 35586 if (!arrowElement) { 35587 return data; 35588 } 35589 } else { 35590 // if the arrowElement isn't a query selector we must check that the 35591 // provided DOM node is child of its popper node 35592 if (!data.instance.popper.contains(arrowElement)) { 35593 console.warn('WARNING: `arrow.element` must be child of its popper element!'); 35594 return data; 35595 } 35596 } 35597 35598 var placement = data.placement.split('-')[0]; 35599 var _data$offsets = data.offsets, 35600 popper = _data$offsets.popper, 35601 reference = _data$offsets.reference; 35602 35603 var isVertical = ['left', 'right'].indexOf(placement) !== -1; 35604 35605 var len = isVertical ? 'height' : 'width'; 35606 var sideCapitalized = isVertical ? 'Top' : 'Left'; 35607 var side = sideCapitalized.toLowerCase(); 35608 var altSide = isVertical ? 'left' : 'top'; 35609 var opSide = isVertical ? 'bottom' : 'right'; 35610 var arrowElementSize = getOuterSizes(arrowElement)[len]; 35611 35612 // 35613 // extends keepTogether behavior making sure the popper and its 35614 // reference have enough pixels in conjunction 35615 // 35616 35617 // top/left side 35618 if (reference[opSide] - arrowElementSize < popper[side]) { 35619 data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize); 35620 } 35621 // bottom/right side 35622 if (reference[side] + arrowElementSize > popper[opSide]) { 35623 data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide]; 35624 } 35625 data.offsets.popper = getClientRect(data.offsets.popper); 35626 35627 // compute center of the popper 35628 var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; 35629 35630 // Compute the sideValue using the updated popper offsets 35631 // take popper margin in account because we don't have this info available 35632 var css = getStyleComputedProperty(data.instance.popper); 35633 var popperMarginSide = parseFloat(css['margin' + sideCapitalized]); 35634 var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']); 35635 var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide; 35636 35637 // prevent arrowElement from being placed not contiguously to its popper 35638 sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); 35639 35640 data.arrowElement = arrowElement; 35641 data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow); 35642 35643 return data; 35644} 35645 35646/** 35647 * Get the opposite placement variation of the given one 35648 * @method 35649 * @memberof Popper.Utils 35650 * @argument {String} placement variation 35651 * @returns {String} flipped placement variation 35652 */ 35653function getOppositeVariation(variation) { 35654 if (variation === 'end') { 35655 return 'start'; 35656 } else if (variation === 'start') { 35657 return 'end'; 35658 } 35659 return variation; 35660} 35661 35662/** 35663 * List of accepted placements to use as values of the `placement` option.<br /> 35664 * Valid placements are: 35665 * - `auto` 35666 * - `top` 35667 * - `right` 35668 * - `bottom` 35669 * - `left` 35670 * 35671 * Each placement can have a variation from this list: 35672 * - `-start` 35673 * - `-end` 35674 * 35675 * Variations are interpreted easily if you think of them as the left to right 35676 * written languages. Horizontally (`top` and `bottom`), `start` is left and `end` 35677 * is right.<br /> 35678 * Vertically (`left` and `right`), `start` is top and `end` is bottom. 35679 * 35680 * Some valid examples are: 35681 * - `top-end` (on top of reference, right aligned) 35682 * - `right-start` (on right of reference, top aligned) 35683 * - `bottom` (on bottom, centered) 35684 * - `auto-end` (on the side with more space available, alignment depends by placement) 35685 * 35686 * @static 35687 * @type {Array} 35688 * @enum {String} 35689 * @readonly 35690 * @method placements 35691 * @memberof Popper 35692 */ 35693var 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']; 35694 35695// Get rid of `auto` `auto-start` and `auto-end` 35696var validPlacements = placements.slice(3); 35697 35698/** 35699 * Given an initial placement, returns all the subsequent placements 35700 * clockwise (or counter-clockwise). 35701 * 35702 * @method 35703 * @memberof Popper.Utils 35704 * @argument {String} placement - A valid placement (it accepts variations) 35705 * @argument {Boolean} counter - Set to true to walk the placements counterclockwise 35706 * @returns {Array} placements including their variations 35707 */ 35708function clockwise(placement) { 35709 var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 35710 35711 var index = validPlacements.indexOf(placement); 35712 var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); 35713 return counter ? arr.reverse() : arr; 35714} 35715 35716var BEHAVIORS = { 35717 FLIP: 'flip', 35718 CLOCKWISE: 'clockwise', 35719 COUNTERCLOCKWISE: 'counterclockwise' 35720}; 35721 35722/** 35723 * @function 35724 * @memberof Modifiers 35725 * @argument {Object} data - The data object generated by update method 35726 * @argument {Object} options - Modifiers configuration and options 35727 * @returns {Object} The data object, properly modified 35728 */ 35729function flip(data, options) { 35730 // if `inner` modifier is enabled, we can't use the `flip` modifier 35731 if (isModifierEnabled(data.instance.modifiers, 'inner')) { 35732 return data; 35733 } 35734 35735 if (data.flipped && data.placement === data.originalPlacement) { 35736 // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides 35737 return data; 35738 } 35739 35740 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed); 35741 35742 var placement = data.placement.split('-')[0]; 35743 var placementOpposite = getOppositePlacement(placement); 35744 var variation = data.placement.split('-')[1] || ''; 35745 35746 var flipOrder = []; 35747 35748 switch (options.behavior) { 35749 case BEHAVIORS.FLIP: 35750 flipOrder = [placement, placementOpposite]; 35751 break; 35752 case BEHAVIORS.CLOCKWISE: 35753 flipOrder = clockwise(placement); 35754 break; 35755 case BEHAVIORS.COUNTERCLOCKWISE: 35756 flipOrder = clockwise(placement, true); 35757 break; 35758 default: 35759 flipOrder = options.behavior; 35760 } 35761 35762 flipOrder.forEach(function (step, index) { 35763 if (placement !== step || flipOrder.length === index + 1) { 35764 return data; 35765 } 35766 35767 placement = data.placement.split('-')[0]; 35768 placementOpposite = getOppositePlacement(placement); 35769 35770 var popperOffsets = data.offsets.popper; 35771 var refOffsets = data.offsets.reference; 35772 35773 // using floor because the reference offsets may contain decimals we are not going to consider here 35774 var floor = Math.floor; 35775 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); 35776 35777 var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left); 35778 var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right); 35779 var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top); 35780 var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom); 35781 35782 var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom; 35783 35784 // flip the variation if required 35785 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 35786 35787 // flips variation if reference element overflows boundaries 35788 var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom); 35789 35790 // flips variation if popper content overflows boundaries 35791 var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop); 35792 35793 var flippedVariation = flippedVariationByRef || flippedVariationByContent; 35794 35795 if (overlapsRef || overflowsBoundaries || flippedVariation) { 35796 // this boolean to detect any flip loop 35797 data.flipped = true; 35798 35799 if (overlapsRef || overflowsBoundaries) { 35800 placement = flipOrder[index + 1]; 35801 } 35802 35803 if (flippedVariation) { 35804 variation = getOppositeVariation(variation); 35805 } 35806 35807 data.placement = placement + (variation ? '-' + variation : ''); 35808 35809 // this object contains `position`, we want to preserve it along with 35810 // any additional property we may add in the future 35811 data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)); 35812 35813 data = runModifiers(data.instance.modifiers, data, 'flip'); 35814 } 35815 }); 35816 return data; 35817} 35818 35819/** 35820 * @function 35821 * @memberof Modifiers 35822 * @argument {Object} data - The data object generated by update method 35823 * @argument {Object} options - Modifiers configuration and options 35824 * @returns {Object} The data object, properly modified 35825 */ 35826function keepTogether(data) { 35827 var _data$offsets = data.offsets, 35828 popper = _data$offsets.popper, 35829 reference = _data$offsets.reference; 35830 35831 var placement = data.placement.split('-')[0]; 35832 var floor = Math.floor; 35833 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 35834 var side = isVertical ? 'right' : 'bottom'; 35835 var opSide = isVertical ? 'left' : 'top'; 35836 var measurement = isVertical ? 'width' : 'height'; 35837 35838 if (popper[side] < floor(reference[opSide])) { 35839 data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement]; 35840 } 35841 if (popper[opSide] > floor(reference[side])) { 35842 data.offsets.popper[opSide] = floor(reference[side]); 35843 } 35844 35845 return data; 35846} 35847 35848/** 35849 * Converts a string containing value + unit into a px value number 35850 * @function 35851 * @memberof {modifiers~offset} 35852 * @private 35853 * @argument {String} str - Value + unit string 35854 * @argument {String} measurement - `height` or `width` 35855 * @argument {Object} popperOffsets 35856 * @argument {Object} referenceOffsets 35857 * @returns {Number|String} 35858 * Value in pixels, or original string if no values were extracted 35859 */ 35860function toValue(str, measurement, popperOffsets, referenceOffsets) { 35861 // separate value from unit 35862 var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/); 35863 var value = +split[1]; 35864 var unit = split[2]; 35865 35866 // If it's not a number it's an operator, I guess 35867 if (!value) { 35868 return str; 35869 } 35870 35871 if (unit.indexOf('%') === 0) { 35872 var element = void 0; 35873 switch (unit) { 35874 case '%p': 35875 element = popperOffsets; 35876 break; 35877 case '%': 35878 case '%r': 35879 default: 35880 element = referenceOffsets; 35881 } 35882 35883 var rect = getClientRect(element); 35884 return rect[measurement] / 100 * value; 35885 } else if (unit === 'vh' || unit === 'vw') { 35886 // if is a vh or vw, we calculate the size based on the viewport 35887 var size = void 0; 35888 if (unit === 'vh') { 35889 size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); 35890 } else { 35891 size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 35892 } 35893 return size / 100 * value; 35894 } else { 35895 // if is an explicit pixel unit, we get rid of the unit and keep the value 35896 // if is an implicit unit, it's px, and we return just the value 35897 return value; 35898 } 35899} 35900 35901/** 35902 * Parse an `offset` string to extrapolate `x` and `y` numeric offsets. 35903 * @function 35904 * @memberof {modifiers~offset} 35905 * @private 35906 * @argument {String} offset 35907 * @argument {Object} popperOffsets 35908 * @argument {Object} referenceOffsets 35909 * @argument {String} basePlacement 35910 * @returns {Array} a two cells array with x and y offsets in numbers 35911 */ 35912function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) { 35913 var offsets = [0, 0]; 35914 35915 // Use height if placement is left or right and index is 0 otherwise use width 35916 // in this way the first offset will use an axis and the second one 35917 // will use the other one 35918 var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1; 35919 35920 // Split the offset string to obtain a list of values and operands 35921 // The regex addresses values with the plus or minus sign in front (+10, -20, etc) 35922 var fragments = offset.split(/(\+|\-)/).map(function (frag) { 35923 return frag.trim(); 35924 }); 35925 35926 // Detect if the offset string contains a pair of values or a single one 35927 // they could be separated by comma or space 35928 var divider = fragments.indexOf(find(fragments, function (frag) { 35929 return frag.search(/,|\s/) !== -1; 35930 })); 35931 35932 if (fragments[divider] && fragments[divider].indexOf(',') === -1) { 35933 console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.'); 35934 } 35935 35936 // If divider is found, we divide the list of values and operands to divide 35937 // them by ofset X and Y. 35938 var splitRegex = /\s*,\s*|\s+/; 35939 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]; 35940 35941 // Convert the values with units to absolute pixels to allow our computations 35942 ops = ops.map(function (op, index) { 35943 // Most of the units rely on the orientation of the popper 35944 var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width'; 35945 var mergeWithPrevious = false; 35946 return op 35947 // This aggregates any `+` or `-` sign that aren't considered operators 35948 // e.g.: 10 + +5 => [10, +, +5] 35949 .reduce(function (a, b) { 35950 if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) { 35951 a[a.length - 1] = b; 35952 mergeWithPrevious = true; 35953 return a; 35954 } else if (mergeWithPrevious) { 35955 a[a.length - 1] += b; 35956 mergeWithPrevious = false; 35957 return a; 35958 } else { 35959 return a.concat(b); 35960 } 35961 }, []) 35962 // Here we convert the string values into number values (in px) 35963 .map(function (str) { 35964 return toValue(str, measurement, popperOffsets, referenceOffsets); 35965 }); 35966 }); 35967 35968 // Loop trough the offsets arrays and execute the operations 35969 ops.forEach(function (op, index) { 35970 op.forEach(function (frag, index2) { 35971 if (isNumeric(frag)) { 35972 offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1); 35973 } 35974 }); 35975 }); 35976 return offsets; 35977} 35978 35979/** 35980 * @function 35981 * @memberof Modifiers 35982 * @argument {Object} data - The data object generated by update method 35983 * @argument {Object} options - Modifiers configuration and options 35984 * @argument {Number|String} options.offset=0 35985 * The offset value as described in the modifier description 35986 * @returns {Object} The data object, properly modified 35987 */ 35988function offset(data, _ref) { 35989 var offset = _ref.offset; 35990 var placement = data.placement, 35991 _data$offsets = data.offsets, 35992 popper = _data$offsets.popper, 35993 reference = _data$offsets.reference; 35994 35995 var basePlacement = placement.split('-')[0]; 35996 35997 var offsets = void 0; 35998 if (isNumeric(+offset)) { 35999 offsets = [+offset, 0]; 36000 } else { 36001 offsets = parseOffset(offset, popper, reference, basePlacement); 36002 } 36003 36004 if (basePlacement === 'left') { 36005 popper.top += offsets[0]; 36006 popper.left -= offsets[1]; 36007 } else if (basePlacement === 'right') { 36008 popper.top += offsets[0]; 36009 popper.left += offsets[1]; 36010 } else if (basePlacement === 'top') { 36011 popper.left += offsets[0]; 36012 popper.top -= offsets[1]; 36013 } else if (basePlacement === 'bottom') { 36014 popper.left += offsets[0]; 36015 popper.top += offsets[1]; 36016 } 36017 36018 data.popper = popper; 36019 return data; 36020} 36021 36022/** 36023 * @function 36024 * @memberof Modifiers 36025 * @argument {Object} data - The data object generated by `update` method 36026 * @argument {Object} options - Modifiers configuration and options 36027 * @returns {Object} The data object, properly modified 36028 */ 36029function preventOverflow(data, options) { 36030 var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper); 36031 36032 // If offsetParent is the reference element, we really want to 36033 // go one step up and use the next offsetParent as reference to 36034 // avoid to make this modifier completely useless and look like broken 36035 if (data.instance.reference === boundariesElement) { 36036 boundariesElement = getOffsetParent(boundariesElement); 36037 } 36038 36039 // NOTE: DOM access here 36040 // resets the popper's position so that the document size can be calculated excluding 36041 // the size of the popper element itself 36042 var transformProp = getSupportedPropertyName('transform'); 36043 var popperStyles = data.instance.popper.style; // assignment to help minification 36044 var top = popperStyles.top, 36045 left = popperStyles.left, 36046 transform = popperStyles[transformProp]; 36047 36048 popperStyles.top = ''; 36049 popperStyles.left = ''; 36050 popperStyles[transformProp] = ''; 36051 36052 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed); 36053 36054 // NOTE: DOM access here 36055 // restores the original style properties after the offsets have been computed 36056 popperStyles.top = top; 36057 popperStyles.left = left; 36058 popperStyles[transformProp] = transform; 36059 36060 options.boundaries = boundaries; 36061 36062 var order = options.priority; 36063 var popper = data.offsets.popper; 36064 36065 var check = { 36066 primary: function primary(placement) { 36067 var value = popper[placement]; 36068 if (popper[placement] < boundaries[placement] && !options.escapeWithReference) { 36069 value = Math.max(popper[placement], boundaries[placement]); 36070 } 36071 return defineProperty({}, placement, value); 36072 }, 36073 secondary: function secondary(placement) { 36074 var mainSide = placement === 'right' ? 'left' : 'top'; 36075 var value = popper[mainSide]; 36076 if (popper[placement] > boundaries[placement] && !options.escapeWithReference) { 36077 value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height)); 36078 } 36079 return defineProperty({}, mainSide, value); 36080 } 36081 }; 36082 36083 order.forEach(function (placement) { 36084 var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary'; 36085 popper = _extends({}, popper, check[side](placement)); 36086 }); 36087 36088 data.offsets.popper = popper; 36089 36090 return data; 36091} 36092 36093/** 36094 * @function 36095 * @memberof Modifiers 36096 * @argument {Object} data - The data object generated by `update` method 36097 * @argument {Object} options - Modifiers configuration and options 36098 * @returns {Object} The data object, properly modified 36099 */ 36100function shift(data) { 36101 var placement = data.placement; 36102 var basePlacement = placement.split('-')[0]; 36103 var shiftvariation = placement.split('-')[1]; 36104 36105 // if shift shiftvariation is specified, run the modifier 36106 if (shiftvariation) { 36107 var _data$offsets = data.offsets, 36108 reference = _data$offsets.reference, 36109 popper = _data$offsets.popper; 36110 36111 var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1; 36112 var side = isVertical ? 'left' : 'top'; 36113 var measurement = isVertical ? 'width' : 'height'; 36114 36115 var shiftOffsets = { 36116 start: defineProperty({}, side, reference[side]), 36117 end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement]) 36118 }; 36119 36120 data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]); 36121 } 36122 36123 return data; 36124} 36125 36126/** 36127 * @function 36128 * @memberof Modifiers 36129 * @argument {Object} data - The data object generated by update method 36130 * @argument {Object} options - Modifiers configuration and options 36131 * @returns {Object} The data object, properly modified 36132 */ 36133function hide(data) { 36134 if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) { 36135 return data; 36136 } 36137 36138 var refRect = data.offsets.reference; 36139 var bound = find(data.instance.modifiers, function (modifier) { 36140 return modifier.name === 'preventOverflow'; 36141 }).boundaries; 36142 36143 if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { 36144 // Avoid unnecessary DOM access if visibility hasn't changed 36145 if (data.hide === true) { 36146 return data; 36147 } 36148 36149 data.hide = true; 36150 data.attributes['x-out-of-boundaries'] = ''; 36151 } else { 36152 // Avoid unnecessary DOM access if visibility hasn't changed 36153 if (data.hide === false) { 36154 return data; 36155 } 36156 36157 data.hide = false; 36158 data.attributes['x-out-of-boundaries'] = false; 36159 } 36160 36161 return data; 36162} 36163 36164/** 36165 * @function 36166 * @memberof Modifiers 36167 * @argument {Object} data - The data object generated by `update` method 36168 * @argument {Object} options - Modifiers configuration and options 36169 * @returns {Object} The data object, properly modified 36170 */ 36171function inner(data) { 36172 var placement = data.placement; 36173 var basePlacement = placement.split('-')[0]; 36174 var _data$offsets = data.offsets, 36175 popper = _data$offsets.popper, 36176 reference = _data$offsets.reference; 36177 36178 var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1; 36179 36180 var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1; 36181 36182 popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); 36183 36184 data.placement = getOppositePlacement(placement); 36185 data.offsets.popper = getClientRect(popper); 36186 36187 return data; 36188} 36189 36190/** 36191 * Modifier function, each modifier can have a function of this type assigned 36192 * to its `fn` property.<br /> 36193 * These functions will be called on each update, this means that you must 36194 * make sure they are performant enough to avoid performance bottlenecks. 36195 * 36196 * @function ModifierFn 36197 * @argument {dataObject} data - The data object generated by `update` method 36198 * @argument {Object} options - Modifiers configuration and options 36199 * @returns {dataObject} The data object, properly modified 36200 */ 36201 36202/** 36203 * Modifiers are plugins used to alter the behavior of your poppers.<br /> 36204 * Popper.js uses a set of 9 modifiers to provide all the basic functionalities 36205 * needed by the library. 36206 * 36207 * Usually you don't want to override the `order`, `fn` and `onLoad` props. 36208 * All the other properties are configurations that could be tweaked. 36209 * @namespace modifiers 36210 */ 36211var modifiers = { 36212 /** 36213 * Modifier used to shift the popper on the start or end of its reference 36214 * element.<br /> 36215 * It will read the variation of the `placement` property.<br /> 36216 * It can be one either `-end` or `-start`. 36217 * @memberof modifiers 36218 * @inner 36219 */ 36220 shift: { 36221 /** @prop {number} order=100 - Index used to define the order of execution */ 36222 order: 100, 36223 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 36224 enabled: true, 36225 /** @prop {ModifierFn} */ 36226 fn: shift 36227 }, 36228 36229 /** 36230 * The `offset` modifier can shift your popper on both its axis. 36231 * 36232 * It accepts the following units: 36233 * - `px` or unit-less, interpreted as pixels 36234 * - `%` or `%r`, percentage relative to the length of the reference element 36235 * - `%p`, percentage relative to the length of the popper element 36236 * - `vw`, CSS viewport width unit 36237 * - `vh`, CSS viewport height unit 36238 * 36239 * For length is intended the main axis relative to the placement of the popper.<br /> 36240 * This means that if the placement is `top` or `bottom`, the length will be the 36241 * `width`. In case of `left` or `right`, it will be the `height`. 36242 * 36243 * You can provide a single value (as `Number` or `String`), or a pair of values 36244 * as `String` divided by a comma or one (or more) white spaces.<br /> 36245 * The latter is a deprecated method because it leads to confusion and will be 36246 * removed in v2.<br /> 36247 * Additionally, it accepts additions and subtractions between different units. 36248 * Note that multiplications and divisions aren't supported. 36249 * 36250 * Valid examples are: 36251 * ``` 36252 * 10 36253 * '10%' 36254 * '10, 10' 36255 * '10%, 10' 36256 * '10 + 10%' 36257 * '10 - 5vh + 3%' 36258 * '-10px + 5vh, 5px - 6%' 36259 * ``` 36260 * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap 36261 * > with their reference element, unfortunately, you will have to disable the `flip` modifier. 36262 * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373). 36263 * 36264 * @memberof modifiers 36265 * @inner 36266 */ 36267 offset: { 36268 /** @prop {number} order=200 - Index used to define the order of execution */ 36269 order: 200, 36270 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 36271 enabled: true, 36272 /** @prop {ModifierFn} */ 36273 fn: offset, 36274 /** @prop {Number|String} offset=0 36275 * The offset value as described in the modifier description 36276 */ 36277 offset: 0 36278 }, 36279 36280 /** 36281 * Modifier used to prevent the popper from being positioned outside the boundary. 36282 * 36283 * A scenario exists where the reference itself is not within the boundaries.<br /> 36284 * We can say it has "escaped the boundaries" — or just "escaped".<br /> 36285 * In this case we need to decide whether the popper should either: 36286 * 36287 * - detach from the reference and remain "trapped" in the boundaries, or 36288 * - if it should ignore the boundary and "escape with its reference" 36289 * 36290 * When `escapeWithReference` is set to`true` and reference is completely 36291 * outside its boundaries, the popper will overflow (or completely leave) 36292 * the boundaries in order to remain attached to the edge of the reference. 36293 * 36294 * @memberof modifiers 36295 * @inner 36296 */ 36297 preventOverflow: { 36298 /** @prop {number} order=300 - Index used to define the order of execution */ 36299 order: 300, 36300 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 36301 enabled: true, 36302 /** @prop {ModifierFn} */ 36303 fn: preventOverflow, 36304 /** 36305 * @prop {Array} [priority=['left','right','top','bottom']] 36306 * Popper will try to prevent overflow following these priorities by default, 36307 * then, it could overflow on the left and on top of the `boundariesElement` 36308 */ 36309 priority: ['left', 'right', 'top', 'bottom'], 36310 /** 36311 * @prop {number} padding=5 36312 * Amount of pixel used to define a minimum distance between the boundaries 36313 * and the popper. This makes sure the popper always has a little padding 36314 * between the edges of its container 36315 */ 36316 padding: 5, 36317 /** 36318 * @prop {String|HTMLElement} boundariesElement='scrollParent' 36319 * Boundaries used by the modifier. Can be `scrollParent`, `window`, 36320 * `viewport` or any DOM element. 36321 */ 36322 boundariesElement: 'scrollParent' 36323 }, 36324 36325 /** 36326 * Modifier used to make sure the reference and its popper stay near each other 36327 * without leaving any gap between the two. Especially useful when the arrow is 36328 * enabled and you want to ensure that it points to its reference element. 36329 * It cares only about the first axis. You can still have poppers with margin 36330 * between the popper and its reference element. 36331 * @memberof modifiers 36332 * @inner 36333 */ 36334 keepTogether: { 36335 /** @prop {number} order=400 - Index used to define the order of execution */ 36336 order: 400, 36337 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 36338 enabled: true, 36339 /** @prop {ModifierFn} */ 36340 fn: keepTogether 36341 }, 36342 36343 /** 36344 * This modifier is used to move the `arrowElement` of the popper to make 36345 * sure it is positioned between the reference element and its popper element. 36346 * It will read the outer size of the `arrowElement` node to detect how many 36347 * pixels of conjunction are needed. 36348 * 36349 * It has no effect if no `arrowElement` is provided. 36350 * @memberof modifiers 36351 * @inner 36352 */ 36353 arrow: { 36354 /** @prop {number} order=500 - Index used to define the order of execution */ 36355 order: 500, 36356 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 36357 enabled: true, 36358 /** @prop {ModifierFn} */ 36359 fn: arrow, 36360 /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */ 36361 element: '[x-arrow]' 36362 }, 36363 36364 /** 36365 * Modifier used to flip the popper's placement when it starts to overlap its 36366 * reference element. 36367 * 36368 * Requires the `preventOverflow` modifier before it in order to work. 36369 * 36370 * **NOTE:** this modifier will interrupt the current update cycle and will 36371 * restart it if it detects the need to flip the placement. 36372 * @memberof modifiers 36373 * @inner 36374 */ 36375 flip: { 36376 /** @prop {number} order=600 - Index used to define the order of execution */ 36377 order: 600, 36378 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 36379 enabled: true, 36380 /** @prop {ModifierFn} */ 36381 fn: flip, 36382 /** 36383 * @prop {String|Array} behavior='flip' 36384 * The behavior used to change the popper's placement. It can be one of 36385 * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid 36386 * placements (with optional variations) 36387 */ 36388 behavior: 'flip', 36389 /** 36390 * @prop {number} padding=5 36391 * The popper will flip if it hits the edges of the `boundariesElement` 36392 */ 36393 padding: 5, 36394 /** 36395 * @prop {String|HTMLElement} boundariesElement='viewport' 36396 * The element which will define the boundaries of the popper position. 36397 * The popper will never be placed outside of the defined boundaries 36398 * (except if `keepTogether` is enabled) 36399 */ 36400 boundariesElement: 'viewport', 36401 /** 36402 * @prop {Boolean} flipVariations=false 36403 * The popper will switch placement variation between `-start` and `-end` when 36404 * the reference element overlaps its boundaries. 36405 * 36406 * The original placement should have a set variation. 36407 */ 36408 flipVariations: false, 36409 /** 36410 * @prop {Boolean} flipVariationsByContent=false 36411 * The popper will switch placement variation between `-start` and `-end` when 36412 * the popper element overlaps its reference boundaries. 36413 * 36414 * The original placement should have a set variation. 36415 */ 36416 flipVariationsByContent: false 36417 }, 36418 36419 /** 36420 * Modifier used to make the popper flow toward the inner of the reference element. 36421 * By default, when this modifier is disabled, the popper will be placed outside 36422 * the reference element. 36423 * @memberof modifiers 36424 * @inner 36425 */ 36426 inner: { 36427 /** @prop {number} order=700 - Index used to define the order of execution */ 36428 order: 700, 36429 /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */ 36430 enabled: false, 36431 /** @prop {ModifierFn} */ 36432 fn: inner 36433 }, 36434 36435 /** 36436 * Modifier used to hide the popper when its reference element is outside of the 36437 * popper boundaries. It will set a `x-out-of-boundaries` attribute which can 36438 * be used to hide with a CSS selector the popper when its reference is 36439 * out of boundaries. 36440 * 36441 * Requires the `preventOverflow` modifier before it in order to work. 36442 * @memberof modifiers 36443 * @inner 36444 */ 36445 hide: { 36446 /** @prop {number} order=800 - Index used to define the order of execution */ 36447 order: 800, 36448 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 36449 enabled: true, 36450 /** @prop {ModifierFn} */ 36451 fn: hide 36452 }, 36453 36454 /** 36455 * Computes the style that will be applied to the popper element to gets 36456 * properly positioned. 36457 * 36458 * Note that this modifier will not touch the DOM, it just prepares the styles 36459 * so that `applyStyle` modifier can apply it. This separation is useful 36460 * in case you need to replace `applyStyle` with a custom implementation. 36461 * 36462 * This modifier has `850` as `order` value to maintain backward compatibility 36463 * with previous versions of Popper.js. Expect the modifiers ordering method 36464 * to change in future major versions of the library. 36465 * 36466 * @memberof modifiers 36467 * @inner 36468 */ 36469 computeStyle: { 36470 /** @prop {number} order=850 - Index used to define the order of execution */ 36471 order: 850, 36472 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 36473 enabled: true, 36474 /** @prop {ModifierFn} */ 36475 fn: computeStyle, 36476 /** 36477 * @prop {Boolean} gpuAcceleration=true 36478 * If true, it uses the CSS 3D transformation to position the popper. 36479 * Otherwise, it will use the `top` and `left` properties 36480 */ 36481 gpuAcceleration: true, 36482 /** 36483 * @prop {string} [x='bottom'] 36484 * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin. 36485 * Change this if your popper should grow in a direction different from `bottom` 36486 */ 36487 x: 'bottom', 36488 /** 36489 * @prop {string} [x='left'] 36490 * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin. 36491 * Change this if your popper should grow in a direction different from `right` 36492 */ 36493 y: 'right' 36494 }, 36495 36496 /** 36497 * Applies the computed styles to the popper element. 36498 * 36499 * All the DOM manipulations are limited to this modifier. This is useful in case 36500 * you want to integrate Popper.js inside a framework or view library and you 36501 * want to delegate all the DOM manipulations to it. 36502 * 36503 * Note that if you disable this modifier, you must make sure the popper element 36504 * has its position set to `absolute` before Popper.js can do its work! 36505 * 36506 * Just disable this modifier and define your own to achieve the desired effect. 36507 * 36508 * @memberof modifiers 36509 * @inner 36510 */ 36511 applyStyle: { 36512 /** @prop {number} order=900 - Index used to define the order of execution */ 36513 order: 900, 36514 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 36515 enabled: true, 36516 /** @prop {ModifierFn} */ 36517 fn: applyStyle, 36518 /** @prop {Function} */ 36519 onLoad: applyStyleOnLoad, 36520 /** 36521 * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier 36522 * @prop {Boolean} gpuAcceleration=true 36523 * If true, it uses the CSS 3D transformation to position the popper. 36524 * Otherwise, it will use the `top` and `left` properties 36525 */ 36526 gpuAcceleration: undefined 36527 } 36528}; 36529 36530/** 36531 * The `dataObject` is an object containing all the information used by Popper.js. 36532 * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks. 36533 * @name dataObject 36534 * @property {Object} data.instance The Popper.js instance 36535 * @property {String} data.placement Placement applied to popper 36536 * @property {String} data.originalPlacement Placement originally defined on init 36537 * @property {Boolean} data.flipped True if popper has been flipped by flip modifier 36538 * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper 36539 * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier 36540 * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`) 36541 * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`) 36542 * @property {Object} data.boundaries Offsets of the popper boundaries 36543 * @property {Object} data.offsets The measurements of popper, reference and arrow elements 36544 * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values 36545 * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values 36546 * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0 36547 */ 36548 36549/** 36550 * Default options provided to Popper.js constructor.<br /> 36551 * These can be overridden using the `options` argument of Popper.js.<br /> 36552 * To override an option, simply pass an object with the same 36553 * structure of the `options` object, as the 3rd argument. For example: 36554 * ``` 36555 * new Popper(ref, pop, { 36556 * modifiers: { 36557 * preventOverflow: { enabled: false } 36558 * } 36559 * }) 36560 * ``` 36561 * @type {Object} 36562 * @static 36563 * @memberof Popper 36564 */ 36565var Defaults = { 36566 /** 36567 * Popper's placement. 36568 * @prop {Popper.placements} placement='bottom' 36569 */ 36570 placement: 'bottom', 36571 36572 /** 36573 * Set this to true if you want popper to position it self in 'fixed' mode 36574 * @prop {Boolean} positionFixed=false 36575 */ 36576 positionFixed: false, 36577 36578 /** 36579 * Whether events (resize, scroll) are initially enabled. 36580 * @prop {Boolean} eventsEnabled=true 36581 */ 36582 eventsEnabled: true, 36583 36584 /** 36585 * Set to true if you want to automatically remove the popper when 36586 * you call the `destroy` method. 36587 * @prop {Boolean} removeOnDestroy=false 36588 */ 36589 removeOnDestroy: false, 36590 36591 /** 36592 * Callback called when the popper is created.<br /> 36593 * By default, it is set to no-op.<br /> 36594 * Access Popper.js instance with `data.instance`. 36595 * @prop {onCreate} 36596 */ 36597 onCreate: function onCreate() {}, 36598 36599 /** 36600 * Callback called when the popper is updated. This callback is not called 36601 * on the initialization/creation of the popper, but only on subsequent 36602 * updates.<br /> 36603 * By default, it is set to no-op.<br /> 36604 * Access Popper.js instance with `data.instance`. 36605 * @prop {onUpdate} 36606 */ 36607 onUpdate: function onUpdate() {}, 36608 36609 /** 36610 * List of modifiers used to modify the offsets before they are applied to the popper. 36611 * They provide most of the functionalities of Popper.js. 36612 * @prop {modifiers} 36613 */ 36614 modifiers: modifiers 36615}; 36616 36617/** 36618 * @callback onCreate 36619 * @param {dataObject} data 36620 */ 36621 36622/** 36623 * @callback onUpdate 36624 * @param {dataObject} data 36625 */ 36626 36627// Utils 36628// Methods 36629var Popper = function () { 36630 /** 36631 * Creates a new Popper.js instance. 36632 * @class Popper 36633 * @param {Element|referenceObject} reference - The reference element used to position the popper 36634 * @param {Element} popper - The HTML / XML element used as the popper 36635 * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults) 36636 * @return {Object} instance - The generated Popper.js instance 36637 */ 36638 function Popper(reference, popper) { 36639 var _this = this; 36640 36641 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 36642 classCallCheck(this, Popper); 36643 36644 this.scheduleUpdate = function () { 36645 return requestAnimationFrame(_this.update); 36646 }; 36647 36648 // make update() debounced, so that it only runs at most once-per-tick 36649 this.update = debounce(this.update.bind(this)); 36650 36651 // with {} we create a new object with the options inside it 36652 this.options = _extends({}, Popper.Defaults, options); 36653 36654 // init state 36655 this.state = { 36656 isDestroyed: false, 36657 isCreated: false, 36658 scrollParents: [] 36659 }; 36660 36661 // get reference and popper elements (allow jQuery wrappers) 36662 this.reference = reference && reference.jquery ? reference[0] : reference; 36663 this.popper = popper && popper.jquery ? popper[0] : popper; 36664 36665 // Deep merge modifiers options 36666 this.options.modifiers = {}; 36667 Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) { 36668 _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {}); 36669 }); 36670 36671 // Refactoring modifiers' list (Object => Array) 36672 this.modifiers = Object.keys(this.options.modifiers).map(function (name) { 36673 return _extends({ 36674 name: name 36675 }, _this.options.modifiers[name]); 36676 }) 36677 // sort the modifiers by order 36678 .sort(function (a, b) { 36679 return a.order - b.order; 36680 }); 36681 36682 // modifiers have the ability to execute arbitrary code when Popper.js get inited 36683 // such code is executed in the same order of its modifier 36684 // they could add new properties to their options configuration 36685 // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`! 36686 this.modifiers.forEach(function (modifierOptions) { 36687 if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) { 36688 modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state); 36689 } 36690 }); 36691 36692 // fire the first update to position the popper in the right place 36693 this.update(); 36694 36695 var eventsEnabled = this.options.eventsEnabled; 36696 if (eventsEnabled) { 36697 // setup event listeners, they will take care of update the position in specific situations 36698 this.enableEventListeners(); 36699 } 36700 36701 this.state.eventsEnabled = eventsEnabled; 36702 } 36703 36704 // We can't use class properties because they don't get listed in the 36705 // class prototype and break stuff like Sinon stubs 36706 36707 36708 createClass(Popper, [{ 36709 key: 'update', 36710 value: function update$$1() { 36711 return update.call(this); 36712 } 36713 }, { 36714 key: 'destroy', 36715 value: function destroy$$1() { 36716 return destroy.call(this); 36717 } 36718 }, { 36719 key: 'enableEventListeners', 36720 value: function enableEventListeners$$1() { 36721 return enableEventListeners.call(this); 36722 } 36723 }, { 36724 key: 'disableEventListeners', 36725 value: function disableEventListeners$$1() { 36726 return disableEventListeners.call(this); 36727 } 36728 36729 /** 36730 * Schedules an update. It will run on the next UI update available. 36731 * @method scheduleUpdate 36732 * @memberof Popper 36733 */ 36734 36735 36736 /** 36737 * Collection of utilities useful when writing custom modifiers. 36738 * Starting from version 1.7, this method is available only if you 36739 * include `popper-utils.js` before `popper.js`. 36740 * 36741 * **DEPRECATION**: This way to access PopperUtils is deprecated 36742 * and will be removed in v2! Use the PopperUtils module directly instead. 36743 * Due to the high instability of the methods contained in Utils, we can't 36744 * guarantee them to follow semver. Use them at your own risk! 36745 * @static 36746 * @private 36747 * @type {Object} 36748 * @deprecated since version 1.8 36749 * @member Utils 36750 * @memberof Popper 36751 */ 36752 36753 }]); 36754 return Popper; 36755}(); 36756 36757/** 36758 * The `referenceObject` is an object that provides an interface compatible with Popper.js 36759 * and lets you use it as replacement of a real DOM node.<br /> 36760 * You can use this method to position a popper relatively to a set of coordinates 36761 * in case you don't have a DOM node to use as reference. 36762 * 36763 * ``` 36764 * new Popper(referenceObject, popperNode); 36765 * ``` 36766 * 36767 * NB: This feature isn't supported in Internet Explorer 10. 36768 * @name referenceObject 36769 * @property {Function} data.getBoundingClientRect 36770 * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method. 36771 * @property {number} data.clientWidth 36772 * An ES6 getter that will return the width of the virtual reference element. 36773 * @property {number} data.clientHeight 36774 * An ES6 getter that will return the height of the virtual reference element. 36775 */ 36776 36777 36778Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils; 36779Popper.placements = placements; 36780Popper.Defaults = Defaults; 36781 36782/* harmony default export */ __webpack_exports__["default"] = (Popper); 36783//# sourceMappingURL=popper.js.map 36784 36785/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) 36786 36787/***/ }), 36788
vendor: 5,681 bytes, lines 36789-36983
36789/***/ "./node_modules/process/browser.js": 36790/*!*****************************************!*\ 36791 !*** ./node_modules/process/browser.js ***! 36792 \*****************************************/ 36793/*! no static exports found */ 36794/***/ (function(module, exports) { 36795 36796// shim for using process in browser 36797var process = module.exports = {}; 36798 36799// cached from whatever global is present so that test runners that stub it 36800// don't break things. But we need to wrap it in a try catch in case it is 36801// wrapped in strict mode code which doesn't define any globals. It's inside a 36802// function because try/catches deoptimize in certain engines. 36803 36804var cachedSetTimeout; 36805var cachedClearTimeout; 36806 36807function defaultSetTimout() { 36808 throw new Error('setTimeout has not been defined'); 36809} 36810function defaultClearTimeout () { 36811 throw new Error('clearTimeout has not been defined'); 36812} 36813(function () { 36814 try { 36815 if (typeof setTimeout === 'function') { 36816 cachedSetTimeout = setTimeout; 36817 } else { 36818 cachedSetTimeout = defaultSetTimout; 36819 } 36820 } catch (e) { 36821 cachedSetTimeout = defaultSetTimout; 36822 } 36823 try { 36824 if (typeof clearTimeout === 'function') { 36825 cachedClearTimeout = clearTimeout; 36826 } else { 36827 cachedClearTimeout = defaultClearTimeout; 36828 } 36829 } catch (e) { 36830 cachedClearTimeout = defaultClearTimeout; 36831 } 36832} ()) 36833function runTimeout(fun) { 36834 if (cachedSetTimeout === setTimeout) { 36835 //normal enviroments in sane situations 36836 return setTimeout(fun, 0); 36837 } 36838 // if setTimeout wasn't available but was latter defined 36839 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { 36840 cachedSetTimeout = setTimeout; 36841 return setTimeout(fun, 0); 36842 } 36843 try { 36844 // when when somebody has screwed with setTimeout but no I.E. maddness 36845 return cachedSetTimeout(fun, 0); 36846 } catch(e){ 36847 try { 36848 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 36849 return cachedSetTimeout.call(null, fun, 0); 36850 } catch(e){ 36851 // 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 36852 return cachedSetTimeout.call(this, fun, 0); 36853 } 36854 } 36855 36856 36857} 36858function runClearTimeout(marker) { 36859 if (cachedClearTimeout === clearTimeout) { 36860 //normal enviroments in sane situations 36861 return clearTimeout(marker); 36862 } 36863 // if clearTimeout wasn't available but was latter defined 36864 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { 36865 cachedClearTimeout = clearTimeout; 36866 return clearTimeout(marker); 36867 } 36868 try { 36869 // when when somebody has screwed with setTimeout but no I.E. maddness 36870 return cachedClearTimeout(marker); 36871 } catch (e){ 36872 try { 36873 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 36874 return cachedClearTimeout.call(null, marker); 36875 } catch (e){ 36876 // 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. 36877 // Some versions of I.E. have different rules for clearTimeout vs setTimeout 36878 return cachedClearTimeout.call(this, marker); 36879 } 36880 } 36881 36882 36883 36884} 36885var queue = []; 36886var draining = false; 36887var currentQueue; 36888var queueIndex = -1; 36889 36890function cleanUpNextTick() { 36891 if (!draining || !currentQueue) { 36892 return; 36893 } 36894 draining = false; 36895 if (currentQueue.length) { 36896 queue = currentQueue.concat(queue); 36897 } else { 36898 queueIndex = -1; 36899 } 36900 if (queue.length) { 36901 drainQueue(); 36902 } 36903} 36904 36905function drainQueue() { 36906 if (draining) { 36907 return; 36908 } 36909 var timeout = runTimeout(cleanUpNextTick); 36910 draining = true; 36911 36912 var len = queue.length; 36913 while(len) { 36914 currentQueue = queue; 36915 queue = []; 36916 while (++queueIndex < len) { 36917 if (currentQueue) { 36918 currentQueue[queueIndex].run(); 36919 } 36920 } 36921 queueIndex = -1; 36922 len = queue.length; 36923 } 36924 currentQueue = null; 36925 draining = false; 36926 runClearTimeout(timeout); 36927} 36928 36929process.nextTick = function (fun) { 36930 var args = new Array(arguments.length - 1); 36931 if (arguments.length > 1) { 36932 for (var i = 1; i < arguments.length; i++) { 36933 args[i - 1] = arguments[i]; 36934 } 36935 } 36936 queue.push(new Item(fun, args)); 36937 if (queue.length === 1 && !draining) { 36938 runTimeout(drainQueue); 36939 } 36940}; 36941 36942// v8 likes predictible objects 36943function Item(fun, array) { 36944 this.fun = fun; 36945 this.array = array; 36946} 36947Item.prototype.run = function () { 36948 this.fun.apply(null, this.array); 36949}; 36950process.title = 'browser'; 36951process.browser = true; 36952process.env = {}; 36953process.argv = []; 36954process.version = ''; // empty string to avoid regexp issues 36955process.versions = {}; 36956 36957function noop() {} 36958 36959process.on = noop; 36960process.addListener = noop; 36961process.once = noop; 36962process.off = noop; 36963process.removeListener = noop; 36964process.removeAllListeners = noop; 36965process.emit = noop; 36966process.prependListener = noop; 36967process.prependOnceListener = noop; 36968 36969process.listeners = function (name) { return [] } 36970 36971process.binding = function (name) { 36972 throw new Error('process.binding is not supported'); 36973}; 36974 36975process.cwd = function () { return '/' }; 36976process.chdir = function (dir) { 36977 throw new Error('process.chdir is not supported'); 36978}; 36979process.umask = function() { return 0; }; 36980 36981 36982/***/ }), 36983
vendor: 724 bytes, lines 36984-37014
36984/***/ "./node_modules/webpack/buildin/global.js": 36985/*!***********************************!*\ 36986 !*** (webpack)/buildin/global.js ***! 36987 \***********************************/ 36988/*! no static exports found */ 36989/***/ (function(module, exports) { 36990 36991var g; 36992 36993// This works in non-strict mode 36994g = (function() { 36995 return this; 36996})(); 36997 36998try { 36999 // This works if eval is allowed (see CSP) 37000 g = g || new Function("return this")(); 37001} catch (e) { 37002 // This works if the window reference is available 37003 if (typeof window === "object") g = window; 37004} 37005 37006// g can still be undefined, but nothing to do about it... 37007// We return undefined, instead of nothing here, so it's 37008// easier to handle this case. if(!global) { ...} 37009 37010module.exports = g; 37011 37012 37013/***/ }), 37014
vendor: 749 bytes, lines 37015-37047
37015/***/ "./node_modules/webpack/buildin/module.js": 37016/*!***********************************!*\ 37017 !*** (webpack)/buildin/module.js ***! 37018 \***********************************/ 37019/*! no static exports found */ 37020/***/ (function(module, exports) { 37021 37022module.exports = function(module) { 37023 if (!module.webpackPolyfill) { 37024 module.deprecate = function() {}; 37025 module.paths = []; 37026 // module.parent = undefined by default 37027 if (!module.children) module.children = []; 37028 Object.defineProperty(module, "loaded", { 37029 enumerable: true, 37030 get: function() { 37031 return module.l; 37032 } 37033 }); 37034 Object.defineProperty(module, "id", { 37035 enumerable: true, 37036 get: function() { 37037 return module.i; 37038 } 37039 }); 37040 module.webpackPolyfill = 1; 37041 } 37042 return module; 37043}; 37044 37045 37046/***/ }), 37047
37048/***/ "./resources/assets/js/app.js": 37049/*!************************************!*\ 37050 !*** ./resources/assets/js/app.js ***! 37051 \************************************/ 37052/*! no static exports found */ 37053/***/ (function(module, exports, __webpack_require__) { 37054 37055/** 37056 * First we will load all of this project's JavaScript dependencies which 37057 * includes Vue and other libraries. It is a great starting point when 37058 * building robust, powerful web applications using Vue and Laravel. 37059 */ 37060__webpack_require__(/*! ./bootstrap */ "./resources/assets/js/bootstrap.js"); 37061 37062/***/ }), 37063
37064/***/ "./resources/assets/js/bootstrap.js": 37065/*!******************************************!*\ 37066 !*** ./resources/assets/js/bootstrap.js ***! 37067 \******************************************/ 37068/*! no static exports found */ 37069/***/ (function(module, exports, __webpack_require__) { 37070 37071window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js"); 37072window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"]; 37073/** 37074 * We'll load jQuery and the Bootstrap jQuery plugin which provides support 37075 * for JavaScript based Bootstrap features such as modals and tabs. This 37076 * code may be modified to fit the specific needs of your application. 37077 */ 37078 37079try { 37080 window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); 37081 37082 __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js"); 37083} catch (e) {} 37084/** 37085 * We'll load the axios HTTP library which allows us to easily issue requests 37086 * to our Laravel back-end. This library automatically handles sending the 37087 * CSRF token as a header based on the value of the "XSRF" token cookie. 37088 */ 37089 37090 37091window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js"); 37092window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 37093/** 37094 * Next we will register the CSRF Token as a common header with Axios so that 37095 * all outgoing HTTP requests automatically have it attached. This is just 37096 * a simple convenience so we don't have to attach every token manually. 37097 */ 37098 37099var token = document.head.querySelector('meta[name="csrf-token"]'); 37100 37101if (token) { 37102 window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; 37103} else { 37104 console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'); 37105} 37106/** 37107 * Echo exposes an expressive API for subscribing to channels and listening 37108 * for events that are broadcast by Laravel. Echo and event broadcasting 37109 * allows your team to easily build robust real-time web applications. 37110 */ 37111// import Echo from 'laravel-echo' 37112// window.Pusher = require('pusher-js'); 37113// window.Echo = new Echo({ 37114// broadcaster: 'pusher', 37115// key: process.env.MIX_PUSHER_APP_KEY, 37116// cluster: process.env.MIX_PUSHER_APP_CLUSTER, 37117// encrypted: true 37118// }); 37119 37120/***/ }), 37121
37122/***/ "./resources/assets/sass/admin/common.scss": 37123/*!*************************************************!*\ 37124 !*** ./resources/assets/sass/admin/common.scss ***! 37125 \*************************************************/ 37126/*! no static exports found */ 37127/***/ (function(module, exports) { 37128 37129// removed by extract-text-webpack-plugin 37130 37131/***/ }), 37132
37133/***/ "./resources/assets/sass/category.scss": 37134/*!*********************************************!*\ 37135 !*** ./resources/assets/sass/category.scss ***! 37136 \*********************************************/ 37137/*! no static exports found */ 37138/***/ (function(module, exports) { 37139 37140// removed by extract-text-webpack-plugin 37141 37142/***/ }), 37143
37144/***/ "./resources/assets/sass/common.scss": 37145/*!*******************************************!*\ 37146 !*** ./resources/assets/sass/common.scss ***! 37147 \*******************************************/ 37148/*! no static exports found */ 37149/***/ (function(module, exports) { 37150 37151// removed by extract-text-webpack-plugin 37152 37153/***/ }), 37154
37155/***/ "./resources/assets/sass/details.scss": 37156/*!********************************************!*\ 37157 !*** ./resources/assets/sass/details.scss ***! 37158 \********************************************/ 37159/*! no static exports found */ 37160/***/ (function(module, exports) { 37161 37162// removed by extract-text-webpack-plugin 37163 37164/***/ }), 37165
37166/***/ "./resources/assets/sass/footer.scss": 37167/*!*******************************************!*\ 37168 !*** ./resources/assets/sass/footer.scss ***! 37169 \*******************************************/ 37170/*! no static exports found */ 37171/***/ (function(module, exports) { 37172 37173// removed by extract-text-webpack-plugin 37174 37175/***/ }), 37176
37177/***/ "./resources/assets/sass/header.scss": 37178/*!*******************************************!*\ 37179 !*** ./resources/assets/sass/header.scss ***! 37180 \*******************************************/ 37181/*! no static exports found */ 37182/***/ (function(module, exports) { 37183 37184// removed by extract-text-webpack-plugin 37185 37186/***/ }), 37187
37188/***/ "./resources/assets/sass/home.scss": 37189/*!*****************************************!*\ 37190 !*** ./resources/assets/sass/home.scss ***! 37191 \*****************************************/ 37192/*! no static exports found */ 37193/***/ (function(module, exports) { 37194 37195// removed by extract-text-webpack-plugin 37196 37197/***/ }), 37198
37199/***/ "./resources/assets/sass/login.scss": 37200/*!******************************************!*\ 37201 !*** ./resources/assets/sass/login.scss ***! 37202 \******************************************/ 37203/*! no static exports found */ 37204/***/ (function(module, exports) { 37205 37206// removed by extract-text-webpack-plugin 37207 37208/***/ }), 37209
37210/***/ "./resources/assets/sass/otherpages.scss": 37211/*!***********************************************!*\ 37212 !*** ./resources/assets/sass/otherpages.scss ***! 37213 \***********************************************/ 37214/*! no static exports found */ 37215/***/ (function(module, exports) { 37216 37217// removed by extract-text-webpack-plugin 37218 37219/***/ }), 37220
37221/***/ "./resources/assets/sass/register.scss": 37222/*!*********************************************!*\ 37223 !*** ./resources/assets/sass/register.scss ***! 37224 \*********************************************/ 37225/*! no static exports found */ 37226/***/ (function(module, exports) { 37227 37228// removed by extract-text-webpack-plugin 37229 37230/***/ })
37230, 37231 37232/***/ 0: 37233/*!******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\ 37234 !*** multi ./resources/assets/js/app.js ./resources/assets/sass/common.scss ./resources/assets/sass/home.scss ./resources/assets/sass/category.scss ./resources/assets/sass/details.scss ./resources/assets/sass/login.scss ./resources/assets/sass/register.scss ./resources/assets/sass/header.scss ./resources/assets/sass/footer.scss ./resources/assets/sass/otherpages.scss ./resources/assets/sass/admin/common.scss ***! 37235 \******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/ 37236/*! no static exports found */ 37237/***/ (function(module, exports, __webpack_require__) { 37238 37239__webpack_require__(/*! /opt/lampp/htdocs/product/goferdeliveryall/resources/assets/js/app.js */"./resources/assets/js/app.js"); 37240__webpack_require__(/*! /opt/lampp/htdocs/product/goferdeliveryall/resources/assets/sass/common.scss */"./resources/assets/sass/common.scss"); 37241__webpack_require__(/*! /opt/lampp/htdocs/product/goferdeliveryall/resources/assets/sass/home.scss */"./resources/assets/sass/home.scss"); 37242__webpack_require__(/*! /opt/lampp/htdocs/product/goferdeliveryall/resources/assets/sass/category.scss */"./resources/assets/sass/category.scss"); 37243__webpack_require__(/*! /opt/lampp/htdocs/product/goferdeliveryall/resources/assets/sass/details.scss */"./resources/assets/sass/details.scss"); 37244__webpack_require__(/*! /opt/lampp/htdocs/product/goferdeliveryall/resources/assets/sass/login.scss */"./resources/assets/sass/login.scss"); 37245__webpack_require__(/*! /opt/lampp/htdocs/product/goferdeliveryall/resources/assets/sass/register.scss */"./resources/assets/sass/register.scss"); 37246__webpack_require__(/*! /opt/lampp/htdocs/product/goferdeliveryall/resources/assets/sass/header.scss */"./resources/assets/sass/header.scss"); 37247__webpack_require__(/*! /opt/lampp/htdocs/product/goferdeliveryall/resources/assets/sass/footer.scss */"./resources/assets/sass/footer.scss"); 37248__webpack_require__(/*! /opt/lampp/htdocs/product/goferdeliveryall/resources/assets/sass/otherpages.scss */"./resources/assets/sass/otherpages.scss"); 37249module.exports = __webpack_require__(/*! /opt/lampp/htdocs/product/goferdeliveryall/resources/assets/sass/admin/common.scss */"./resources/assets/sass/admin/common.scss"); 37250 37251 37252/***/ }) 37253 37254/******/ });
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.