vendor: 87 bytes, lines 1-4
1/******/ (() => { // webpackBootstrap 2/******/ var __webpack_modules__ = ({ 3 4/***/ "./
4resources/assets/js/app.js": 5/*!************************************!*\ 6 !*** ./resources/assets/js/app.js ***! 7 \************************************/ 8/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 9 10"use strict"; 11__webpack_require__.r(__webpack_exports__); 12/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); 13/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 14/* harmony import */ var jquery_ui_ui_widgets_datepicker_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery-ui/ui/widgets/datepicker.js */ "./node_modules/jquery-ui/ui/widgets/datepicker.js"); 15/* harmony import */ var jquery_ui_ui_widgets_datepicker_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery_ui_ui_widgets_datepicker_js__WEBPACK_IMPORTED_MODULE_1__); 16/** 17 * First we will load all of this project's JavaScript dependencies which 18 * includes Vue and other libraries. It is a great starting point when 19 * building robust, powerful web applications using Vue and Laravel. 20 */ 21 22__webpack_require__(/*! ./bootstrap */ "./resources/assets/js/bootstrap.js"); 23window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.common.js"); 24 25/** 26 * Next, we will create a fresh Vue application instance and attach it to 27 * the page. Then, you may begin adding components to this application 28 * or customize the JavaScript scaffolding to fit your unique needs. 29 */ 30 31//Vue.component('booking-component', require('./components/BookingComponent.vue')); 32 33 34window.$ = window.jQuery = (jquery__WEBPACK_IMPORTED_MODULE_0___default()); 35__webpack_require__(/*! jquery-nice-select */ "./node_modules/jquery-nice-select/js/jquery.nice-select.min.js"); 36 37 38// import vSelect from 'vue-select' 39 40// Vue.component('v-select', vSelect); 41 42// new Vue({ 43// el: '#news-filter', 44// data: { 45// options: [] 46// } 47// }) 48 49jquery__WEBPACK_IMPORTED_MODULE_0___default()(function () { 50 var restaurant_slides = jquery__WEBPACK_IMPORTED_MODULE_0___default()('#restaurant-slides'); 51 restaurant_slides.owlCarousel({ 52 lazyLoad: true, 53 margin: 0, 54 nav: false, 55 loop: false, 56 autoplay: true, 57 // to enable 58 dots: true, 59 items: 1, 60 navText: ["<span class='arrow-left'></span>", "<span class='arrow-right'></span>"] 61 }); 62}); 63 64/***/ }), 65
66/***/ "./resources/assets/js/bootstrap.js": 67/*!******************************************!*\ 68 !*** ./resources/assets/js/bootstrap.js ***! 69 \******************************************/ 70/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { 71 72window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js"); 73window.Popper = (__webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"]); 74 75/** 76 * We'll load jQuery and the Bootstrap jQuery plugin which provides support 77 * for JavaScript based Bootstrap features such as modals and tabs. This 78 * code may be modified to fit the specific needs of your application. 79 */ 80 81try { 82 window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); 83 __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js"); 84} catch (e) {} 85 86/** 87 * We'll load the axios HTTP library which allows us to easily issue requests 88 * to our Laravel back-end. This library automatically handles sending the 89 * CSRF token as a header based on the value of the "XSRF" token cookie. 90 */ 91 92window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/dist/browser/axios.cjs"); 93window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 94 95/** 96 * Next we will register the CSRF Token as a common header with Axios so that 97 * all outgoing HTTP requests automatically have it attached. This is just 98 * a simple convenience so we don't have to attach every token manually. 99 */ 100 101var token = document.head.querySelector('meta[name="csrf-token"]'); 102if (token) { 103 window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; 104} else { 105 console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'); 106} 107 108/** 109 * Echo exposes an expressive API for subscribing to channels and listening 110 * for events that are broadcast by Laravel. Echo and event broadcasting 111 * allows your team to easily build robust real-time web applications. 112 */ 113 114// import Echo from 'laravel-echo' 115 116// window.Pusher = require('pusher-js'); 117 118// window.Echo = new Echo({ 119// broadcaster: 'pusher', 120// key: process.env.MIX_PUSHER_APP_KEY, 121// cluster: process.env.MIX_PUSHER_APP_CLUSTER, 122// encrypted: true 123// }); 124 125/***/ }), 126
vendor: 4,178 bytes, lines 127-287
127/***/ "./node_modules/base64-js/index.js": 128/*!*****************************************!*\ 129 !*** ./node_modules/base64-js/index.js ***! 130 \*****************************************/ 131/***/ ((__unused_webpack_module, exports) => { 132 133"use strict"; 134 135 136exports.byteLength = byteLength 137exports.toByteArray = toByteArray 138exports.fromByteArray = fromByteArray 139 140var lookup = [] 141var revLookup = [] 142var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array 143 144var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' 145for (var i = 0, len = code.length; i < len; ++i) { 146 lookup[i] = code[i] 147 revLookup[code.charCodeAt(i)] = i 148} 149 150// Support decoding URL-safe base64 strings, as Node.js does. 151// See: https://en.wikipedia.org/wiki/Base64#URL_applications 152revLookup['-'.charCodeAt(0)] = 62 153revLookup['_'.charCodeAt(0)] = 63 154 155function getLens (b64) { 156 var len = b64.length 157 158 if (len % 4 > 0) { 159 throw new Error('Invalid string. Length must be a multiple of 4') 160 } 161 162 // Trim off extra bytes after placeholder bytes are found 163 // See: https://github.com/beatgammit/base64-js/issues/42 164 var validLen = b64.indexOf('=') 165 if (validLen === -1) validLen = len 166 167 var placeHoldersLen = validLen === len 168 ? 0 169 : 4 - (validLen % 4) 170 171 return [validLen, placeHoldersLen] 172} 173 174// base64 is 4/3 + up to two characters of the original data 175function byteLength (b64) { 176 var lens = getLens(b64) 177 var validLen = lens[0] 178 var placeHoldersLen = lens[1] 179 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen 180} 181 182function _byteLength (b64, validLen, placeHoldersLen) { 183 return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen 184} 185 186function toByteArray (b64) { 187 var tmp 188 var lens = getLens(b64) 189 var validLen = lens[0] 190 var placeHoldersLen = lens[1] 191 192 var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) 193 194 var curByte = 0 195 196 // if there are placeholders, only get up to the last complete 4 chars 197 var len = placeHoldersLen > 0 198 ? validLen - 4 199 : validLen 200 201 var i 202 for (i = 0; i < len; i += 4) { 203 tmp = 204 (revLookup[b64.charCodeAt(i)] << 18) | 205 (revLookup[b64.charCodeAt(i + 1)] << 12) | 206 (revLookup[b64.charCodeAt(i + 2)] << 6) | 207 revLookup[b64.charCodeAt(i + 3)] 208 arr[curByte++] = (tmp >> 16) & 0xFF 209 arr[curByte++] = (tmp >> 8) & 0xFF 210 arr[curByte++] = tmp & 0xFF 211 } 212 213 if (placeHoldersLen === 2) { 214 tmp = 215 (revLookup[b64.charCodeAt(i)] << 2) | 216 (revLookup[b64.charCodeAt(i + 1)] >> 4) 217 arr[curByte++] = tmp & 0xFF 218 } 219 220 if (placeHoldersLen === 1) { 221 tmp = 222 (revLookup[b64.charCodeAt(i)] << 10) | 223 (revLookup[b64.charCodeAt(i + 1)] << 4) | 224 (revLookup[b64.charCodeAt(i + 2)] >> 2) 225 arr[curByte++] = (tmp >> 8) & 0xFF 226 arr[curByte++] = tmp & 0xFF 227 } 228 229 return arr 230} 231 232function tripletToBase64 (num) { 233 return lookup[num >> 18 & 0x3F] + 234 lookup[num >> 12 & 0x3F] + 235 lookup[num >> 6 & 0x3F] + 236 lookup[num & 0x3F] 237} 238 239function encodeChunk (uint8, start, end) { 240 var tmp 241 var output = [] 242 for (var i = start; i < end; i += 3) { 243 tmp = 244 ((uint8[i] << 16) & 0xFF0000) + 245 ((uint8[i + 1] << 8) & 0xFF00) + 246 (uint8[i + 2] & 0xFF) 247 output.push(tripletToBase64(tmp)) 248 } 249 return output.join('') 250} 251 252function fromByteArray (uint8) { 253 var tmp 254 var len = uint8.length 255 var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes 256 var parts = [] 257 var maxChunkLength = 16383 // must be multiple of 3 258 259 // go through the array every three bytes, we'll deal with trailing stuff later 260 for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { 261 parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) 262 } 263 264 // pad the end with zeros, but make sure to not forget the extra bytes 265 if (extraBytes === 1) { 266 tmp = uint8[len - 1] 267 parts.push( 268 lookup[tmp >> 2] + 269 lookup[(tmp << 4) & 0x3F] + 270 '==' 271 ) 272 } else if (extraBytes === 2) { 273 tmp = (uint8[len - 2] << 8) + uint8[len - 1] 274 parts.push( 275 lookup[tmp >> 10] + 276 lookup[(tmp >> 4) & 0x3F] + 277 lookup[(tmp << 2) & 0x3F] + 278 '=' 279 ) 280 } 281 282 return parts.join('') 283} 284 285 286/***/ }), 287
vendor: 137,860 bytes, lines 288-4652
288/***/ "./node_modules/bootstrap/dist/js/bootstrap.js": 289/*!*****************************************************!*\ 290 !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***! 291 \*****************************************************/ 292/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 293 294/*! 295 * Bootstrap v4.6.2 (https://getbootstrap.com/) 296 * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 297 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 298 */ 299(function (global, factory) { 300 true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) : 301 0; 302})(this, (function (exports, $, Popper) { 'use strict'; 303 304 function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } 305 306 var $__default = /*#__PURE__*/_interopDefaultLegacy($); 307 var Popper__default = /*#__PURE__*/_interopDefaultLegacy(Popper); 308 309 function _defineProperties(target, props) { 310 for (var i = 0; i < props.length; i++) { 311 var descriptor = props[i]; 312 descriptor.enumerable = descriptor.enumerable || false; 313 descriptor.configurable = true; 314 if ("value" in descriptor) descriptor.writable = true; 315 Object.defineProperty(target, descriptor.key, descriptor); 316 } 317 } 318 319 function _createClass(Constructor, protoProps, staticProps) { 320 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 321 if (staticProps) _defineProperties(Constructor, staticProps); 322 Object.defineProperty(Constructor, "prototype", { 323 writable: false 324 }); 325 return Constructor; 326 } 327 328 function _extends() { 329 _extends = Object.assign ? Object.assign.bind() : function (target) { 330 for (var i = 1; i < arguments.length; i++) { 331 var source = arguments[i]; 332 333 for (var key in source) { 334 if (Object.prototype.hasOwnProperty.call(source, key)) { 335 target[key] = source[key]; 336 } 337 } 338 } 339 340 return target; 341 }; 342 return _extends.apply(this, arguments); 343 } 344 345 function _inheritsLoose(subClass, superClass) { 346 subClass.prototype = Object.create(superClass.prototype); 347 subClass.prototype.constructor = subClass; 348 349 _setPrototypeOf(subClass, superClass); 350 } 351 352 function _setPrototypeOf(o, p) { 353 _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { 354 o.__proto__ = p; 355 return o; 356 }; 357 return _setPrototypeOf(o, p); 358 } 359 360 /** 361 * -------------------------------------------------------------------------- 362 * Bootstrap (v4.6.2): util.js 363 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 364 * -------------------------------------------------------------------------- 365 */ 366 /** 367 * Private TransitionEnd Helpers 368 */ 369 370 var TRANSITION_END = 'transitionend'; 371 var MAX_UID = 1000000; 372 var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp) 373 374 function toType(obj) { 375 if (obj === null || typeof obj === 'undefined') { 376 return "" + obj; 377 } 378 379 return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase(); 380 } 381 382 function getSpecialTransitionEndEvent() { 383 return { 384 bindType: TRANSITION_END, 385 delegateType: TRANSITION_END, 386 handle: function handle(event) { 387 if ($__default["default"](event.target).is(this)) { 388 return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params 389 } 390 391 return undefined; 392 } 393 }; 394 } 395 396 function transitionEndEmulator(duration) { 397 var _this = this; 398 399 var called = false; 400 $__default["default"](this).one(Util.TRANSITION_END, function () { 401 called = true; 402 }); 403 setTimeout(function () { 404 if (!called) { 405 Util.triggerTransitionEnd(_this); 406 } 407 }, duration); 408 return this; 409 } 410 411 function setTransitionEndSupport() { 412 $__default["default"].fn.emulateTransitionEnd = transitionEndEmulator; 413 $__default["default"].event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); 414 } 415 /** 416 * Public Util API 417 */ 418 419 420 var Util = { 421 TRANSITION_END: 'bsTransitionEnd', 422 getUID: function getUID(prefix) { 423 do { 424 // eslint-disable-next-line no-bitwise 425 prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here 426 } while (document.getElementById(prefix)); 427 428 return prefix; 429 }, 430 getSelectorFromElement: function getSelectorFromElement(element) { 431 var selector = element.getAttribute('data-target'); 432 433 if (!selector || selector === '#') { 434 var hrefAttr = element.getAttribute('href'); 435 selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : ''; 436 } 437 438 try { 439 return document.querySelector(selector) ? selector : null; 440 } catch (_) { 441 return null; 442 } 443 }, 444 getTransitionDurationFromElement: function getTransitionDurationFromElement(element) { 445 if (!element) { 446 return 0; 447 } // Get transition-duration of the element 448 449 450 var transitionDuration = $__default["default"](element).css('transition-duration'); 451 var transitionDelay = $__default["default"](element).css('transition-delay'); 452 var floatTransitionDuration = parseFloat(transitionDuration); 453 var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found 454 455 if (!floatTransitionDuration && !floatTransitionDelay) { 456 return 0; 457 } // If multiple durations are defined, take the first 458 459 460 transitionDuration = transitionDuration.split(',')[0]; 461 transitionDelay = transitionDelay.split(',')[0]; 462 return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; 463 }, 464 reflow: function reflow(element) { 465 return element.offsetHeight; 466 }, 467 triggerTransitionEnd: function triggerTransitionEnd(element) { 468 $__default["default"](element).trigger(TRANSITION_END); 469 }, 470 supportsTransitionEnd: function supportsTransitionEnd() { 471 return Boolean(TRANSITION_END); 472 }, 473 isElement: function isElement(obj) { 474 return (obj[0] || obj).nodeType; 475 }, 476 typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { 477 for (var property in configTypes) { 478 if (Object.prototype.hasOwnProperty.call(configTypes, property)) { 479 var expectedTypes = configTypes[property]; 480 var value = config[property]; 481 var valueType = value && Util.isElement(value) ? 'element' : toType(value); 482 483 if (!new RegExp(expectedTypes).test(valueType)) { 484 throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\".")); 485 } 486 } 487 } 488 }, 489 findShadowRoot: function findShadowRoot(element) { 490 if (!document.documentElement.attachShadow) { 491 return null; 492 } // Can find the shadow root otherwise it'll return the document 493 494 495 if (typeof element.getRootNode === 'function') { 496 var root = element.getRootNode(); 497 return root instanceof ShadowRoot ? root : null; 498 } 499 500 if (element instanceof ShadowRoot) { 501 return element; 502 } // when we don't find a shadow root 503 504 505 if (!element.parentNode) { 506 return null; 507 } 508 509 return Util.findShadowRoot(element.parentNode); 510 }, 511 jQueryDetection: function jQueryDetection() { 512 if (typeof $__default["default"] === 'undefined') { 513 throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.'); 514 } 515 516 var version = $__default["default"].fn.jquery.split(' ')[0].split('.'); 517 var minMajor = 1; 518 var ltMajor = 2; 519 var minMinor = 9; 520 var minPatch = 1; 521 var maxMajor = 4; 522 523 if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) { 524 throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0'); 525 } 526 } 527 }; 528 Util.jQueryDetection(); 529 setTransitionEndSupport(); 530 531 /** 532 * Constants 533 */ 534 535 var NAME$a = 'alert'; 536 var VERSION$a = '4.6.2'; 537 var DATA_KEY$a = 'bs.alert'; 538 var EVENT_KEY$a = "." + DATA_KEY$a; 539 var DATA_API_KEY$7 = '.data-api'; 540 var JQUERY_NO_CONFLICT$a = $__default["default"].fn[NAME$a]; 541 var CLASS_NAME_ALERT = 'alert'; 542 var CLASS_NAME_FADE$5 = 'fade'; 543 var CLASS_NAME_SHOW$7 = 'show'; 544 var EVENT_CLOSE = "close" + EVENT_KEY$a; 545 var EVENT_CLOSED = "closed" + EVENT_KEY$a; 546 var EVENT_CLICK_DATA_API$6 = "click" + EVENT_KEY$a + DATA_API_KEY$7; 547 var SELECTOR_DISMISS = '[data-dismiss="alert"]'; 548 /** 549 * Class definition 550 */ 551 552 var Alert = /*#__PURE__*/function () { 553 function Alert(element) { 554 this._element = element; 555 } // Getters 556 557 558 var _proto = Alert.prototype; 559 560 // Public 561 _proto.close = function close(element) { 562 var rootElement = this._element; 563 564 if (element) { 565 rootElement = this._getRootElement(element); 566 } 567 568 var customEvent = this._triggerCloseEvent(rootElement); 569 570 if (customEvent.isDefaultPrevented()) { 571 return; 572 } 573 574 this._removeElement(rootElement); 575 }; 576 577 _proto.dispose = function dispose() { 578 $__default["default"].removeData(this._element, DATA_KEY$a); 579 this._element = null; 580 } // Private 581 ; 582 583 _proto._getRootElement = function _getRootElement(element) { 584 var selector = Util.getSelectorFromElement(element); 585 var parent = false; 586 587 if (selector) { 588 parent = document.querySelector(selector); 589 } 590 591 if (!parent) { 592 parent = $__default["default"](element).closest("." + CLASS_NAME_ALERT)[0]; 593 } 594 595 return parent; 596 }; 597 598 _proto._triggerCloseEvent = function _triggerCloseEvent(element) { 599 var closeEvent = $__default["default"].Event(EVENT_CLOSE); 600 $__default["default"](element).trigger(closeEvent); 601 return closeEvent; 602 }; 603 604 _proto._removeElement = function _removeElement(element) { 605 var _this = this; 606 607 $__default["default"](element).removeClass(CLASS_NAME_SHOW$7); 608 609 if (!$__default["default"](element).hasClass(CLASS_NAME_FADE$5)) { 610 this._destroyElement(element); 611 612 return; 613 } 614 615 var transitionDuration = Util.getTransitionDurationFromElement(element); 616 $__default["default"](element).one(Util.TRANSITION_END, function (event) { 617 return _this._destroyElement(element, event); 618 }).emulateTransitionEnd(transitionDuration); 619 }; 620 621 _proto._destroyElement = function _destroyElement(element) { 622 $__default["default"](element).detach().trigger(EVENT_CLOSED).remove(); 623 } // Static 624 ; 625 626 Alert._jQueryInterface = function _jQueryInterface(config) { 627 return this.each(function () { 628 var $element = $__default["default"](this); 629 var data = $element.data(DATA_KEY$a); 630 631 if (!data) { 632 data = new Alert(this); 633 $element.data(DATA_KEY$a, data); 634 } 635 636 if (config === 'close') { 637 data[config](this); 638 } 639 }); 640 }; 641 642 Alert._handleDismiss = function _handleDismiss(alertInstance) { 643 return function (event) { 644 if (event) { 645 event.preventDefault(); 646 } 647 648 alertInstance.close(this); 649 }; 650 }; 651 652 _createClass(Alert, null, [{ 653 key: "VERSION", 654 get: function get() { 655 return VERSION$a; 656 } 657 }]); 658 659 return Alert; 660 }(); 661 /** 662 * Data API implementation 663 */ 664 665 666 $__default["default"](document).on(EVENT_CLICK_DATA_API$6, SELECTOR_DISMISS, Alert._handleDismiss(new Alert())); 667 /** 668 * jQuery 669 */ 670 671 $__default["default"].fn[NAME$a] = Alert._jQueryInterface; 672 $__default["default"].fn[NAME$a].Constructor = Alert; 673 674 $__default["default"].fn[NAME$a].noConflict = function () { 675 $__default["default"].fn[NAME$a] = JQUERY_NO_CONFLICT$a; 676 return Alert._jQueryInterface; 677 }; 678 679 /** 680 * Constants 681 */ 682 683 var NAME$9 = 'button'; 684 var VERSION$9 = '4.6.2'; 685 var DATA_KEY$9 = 'bs.button'; 686 var EVENT_KEY$9 = "." + DATA_KEY$9; 687 var DATA_API_KEY$6 = '.data-api'; 688 var JQUERY_NO_CONFLICT$9 = $__default["default"].fn[NAME$9]; 689 var CLASS_NAME_ACTIVE$3 = 'active'; 690 var CLASS_NAME_BUTTON = 'btn'; 691 var CLASS_NAME_FOCUS = 'focus'; 692 var EVENT_CLICK_DATA_API$5 = "click" + EVENT_KEY$9 + DATA_API_KEY$6; 693 var EVENT_FOCUS_BLUR_DATA_API = "focus" + EVENT_KEY$9 + DATA_API_KEY$6 + " " + ("blur" + EVENT_KEY$9 + DATA_API_KEY$6); 694 var EVENT_LOAD_DATA_API$2 = "load" + EVENT_KEY$9 + DATA_API_KEY$6; 695 var SELECTOR_DATA_TOGGLE_CARROT = '[data-toggle^="button"]'; 696 var SELECTOR_DATA_TOGGLES = '[data-toggle="buttons"]'; 697 var SELECTOR_DATA_TOGGLE$4 = '[data-toggle="button"]'; 698 var SELECTOR_DATA_TOGGLES_BUTTONS = '[data-toggle="buttons"] .btn'; 699 var SELECTOR_INPUT = 'input:not([type="hidden"])'; 700 var SELECTOR_ACTIVE$2 = '.active'; 701 var SELECTOR_BUTTON = '.btn'; 702 /** 703 * Class definition 704 */ 705 706 var Button = /*#__PURE__*/function () { 707 function Button(element) { 708 this._element = element; 709 this.shouldAvoidTriggerChange = false; 710 } // Getters 711 712 713 var _proto = Button.prototype; 714 715 // Public 716 _proto.toggle = function toggle() { 717 var triggerChangeEvent = true; 718 var addAriaPressed = true; 719 var rootElement = $__default["default"](this._element).closest(SELECTOR_DATA_TOGGLES)[0]; 720 721 if (rootElement) { 722 var input = this._element.querySelector(SELECTOR_INPUT); 723 724 if (input) { 725 if (input.type === 'radio') { 726 if (input.checked && this._element.classList.contains(CLASS_NAME_ACTIVE$3)) { 727 triggerChangeEvent = false; 728 } else { 729 var activeElement = rootElement.querySelector(SELECTOR_ACTIVE$2); 730 731 if (activeElement) { 732 $__default["default"](activeElement).removeClass(CLASS_NAME_ACTIVE$3); 733 } 734 } 735 } 736 737 if (triggerChangeEvent) { 738 // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input 739 if (input.type === 'checkbox' || input.type === 'radio') { 740 input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE$3); 741 } 742 743 if (!this.shouldAvoidTriggerChange) { 744 $__default["default"](input).trigger('change'); 745 } 746 } 747 748 input.focus(); 749 addAriaPressed = false; 750 } 751 } 752 753 if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) { 754 if (addAriaPressed) { 755 this._element.setAttribute('aria-pressed', !this._element.classList.contains(CLASS_NAME_ACTIVE$3)); 756 } 757 758 if (triggerChangeEvent) { 759 $__default["default"](this._element).toggleClass(CLASS_NAME_ACTIVE$3); 760 } 761 } 762 }; 763 764 _proto.dispose = function dispose() { 765 $__default["default"].removeData(this._element, DATA_KEY$9); 766 this._element = null; 767 } // Static 768 ; 769 770 Button._jQueryInterface = function _jQueryInterface(config, avoidTriggerChange) { 771 return this.each(function () { 772 var $element = $__default["default"](this); 773 var data = $element.data(DATA_KEY$9); 774 775 if (!data) { 776 data = new Button(this); 777 $element.data(DATA_KEY$9, data); 778 } 779 780 data.shouldAvoidTriggerChange = avoidTriggerChange; 781 782 if (config === 'toggle') { 783 data[config](); 784 } 785 }); 786 }; 787 788 _createClass(Button, null, [{ 789 key: "VERSION", 790 get: function get() { 791 return VERSION$9; 792 } 793 }]); 794 795 return Button; 796 }(); 797 /** 798 * Data API implementation 799 */ 800 801 802 $__default["default"](document).on(EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE_CARROT, function (event) { 803 var button = event.target; 804 var initialButton = button; 805 806 if (!$__default["default"](button).hasClass(CLASS_NAME_BUTTON)) { 807 button = $__default["default"](button).closest(SELECTOR_BUTTON)[0]; 808 } 809 810 if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) { 811 event.preventDefault(); // work around Firefox bug #1540995 812 } else { 813 var inputBtn = button.querySelector(SELECTOR_INPUT); 814 815 if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) { 816 event.preventDefault(); // work around Firefox bug #1540995 817 818 return; 819 } 820 821 if (initialButton.tagName === 'INPUT' || button.tagName !== 'LABEL') { 822 Button._jQueryInterface.call($__default["default"](button), 'toggle', initialButton.tagName === 'INPUT'); 823 } 824 } 825 }).on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) { 826 var button = $__default["default"](event.target).closest(SELECTOR_BUTTON)[0]; 827 $__default["default"](button).toggleClass(CLASS_NAME_FOCUS, /^focus(in)?$/.test(event.type)); 828 }); 829 $__default["default"](window).on(EVENT_LOAD_DATA_API$2, function () { 830 // ensure correct active class is set to match the controls' actual values/states 831 // find all checkboxes/readio buttons inside data-toggle groups 832 var buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLES_BUTTONS)); 833 834 for (var i = 0, len = buttons.length; i < len; i++) { 835 var button = buttons[i]; 836 var input = button.querySelector(SELECTOR_INPUT); 837 838 if (input.checked || input.hasAttribute('checked')) { 839 button.classList.add(CLASS_NAME_ACTIVE$3); 840 } else { 841 button.classList.remove(CLASS_NAME_ACTIVE$3); 842 } 843 } // find all button toggles 844 845 846 buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$4)); 847 848 for (var _i = 0, _len = buttons.length; _i < _len; _i++) { 849 var _button = buttons[_i]; 850 851 if (_button.getAttribute('aria-pressed') === 'true') { 852 _button.classList.add(CLASS_NAME_ACTIVE$3); 853 } else { 854 _button.classList.remove(CLASS_NAME_ACTIVE$3); 855 } 856 } 857 }); 858 /** 859 * jQuery 860 */ 861 862 $__default["default"].fn[NAME$9] = Button._jQueryInterface; 863 $__default["default"].fn[NAME$9].Constructor = Button; 864 865 $__default["default"].fn[NAME$9].noConflict = function () { 866 $__default["default"].fn[NAME$9] = JQUERY_NO_CONFLICT$9; 867 return Button._jQueryInterface; 868 }; 869 870 /** 871 * Constants 872 */ 873 874 var NAME$8 = 'carousel'; 875 var VERSION$8 = '4.6.2'; 876 var DATA_KEY$8 = 'bs.carousel'; 877 var EVENT_KEY$8 = "." + DATA_KEY$8; 878 var DATA_API_KEY$5 = '.data-api'; 879 var JQUERY_NO_CONFLICT$8 = $__default["default"].fn[NAME$8]; 880 var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key 881 882 var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key 883 884 var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch 885 886 var SWIPE_THRESHOLD = 40; 887 var CLASS_NAME_CAROUSEL = 'carousel'; 888 var CLASS_NAME_ACTIVE$2 = 'active'; 889 var CLASS_NAME_SLIDE = 'slide'; 890 var CLASS_NAME_RIGHT = 'carousel-item-right'; 891 var CLASS_NAME_LEFT = 'carousel-item-left'; 892 var CLASS_NAME_NEXT = 'carousel-item-next'; 893 var CLASS_NAME_PREV = 'carousel-item-prev'; 894 var CLASS_NAME_POINTER_EVENT = 'pointer-event'; 895 var DIRECTION_NEXT = 'next'; 896 var DIRECTION_PREV = 'prev'; 897 var DIRECTION_LEFT = 'left'; 898 var DIRECTION_RIGHT = 'right'; 899 var EVENT_SLIDE = "slide" + EVENT_KEY$8; 900 var EVENT_SLID = "slid" + EVENT_KEY$8; 901 var EVENT_KEYDOWN = "keydown" + EVENT_KEY$8; 902 var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY$8; 903 var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY$8; 904 var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY$8; 905 var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY$8; 906 var EVENT_TOUCHEND = "touchend" + EVENT_KEY$8; 907 var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY$8; 908 var EVENT_POINTERUP = "pointerup" + EVENT_KEY$8; 909 var EVENT_DRAG_START = "dragstart" + EVENT_KEY$8; 910 var EVENT_LOAD_DATA_API$1 = "load" + EVENT_KEY$8 + DATA_API_KEY$5; 911 var EVENT_CLICK_DATA_API$4 = "click" + EVENT_KEY$8 + DATA_API_KEY$5; 912 var SELECTOR_ACTIVE$1 = '.active'; 913 var SELECTOR_ACTIVE_ITEM = '.active.carousel-item'; 914 var SELECTOR_ITEM = '.carousel-item'; 915 var SELECTOR_ITEM_IMG = '.carousel-item img'; 916 var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev'; 917 var SELECTOR_INDICATORS = '.carousel-indicators'; 918 var SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]'; 919 var SELECTOR_DATA_RIDE = '[data-ride="carousel"]'; 920 var Default$7 = { 921 interval: 5000, 922 keyboard: true, 923 slide: false, 924 pause: 'hover', 925 wrap: true, 926 touch: true 927 }; 928 var DefaultType$7 = { 929 interval: '(number|boolean)', 930 keyboard: 'boolean', 931 slide: '(boolean|string)', 932 pause: '(string|boolean)', 933 wrap: 'boolean', 934 touch: 'boolean' 935 }; 936 var PointerType = { 937 TOUCH: 'touch', 938 PEN: 'pen' 939 }; 940 /** 941 * Class definition 942 */ 943 944 var Carousel = /*#__PURE__*/function () { 945 function Carousel(element, config) { 946 this._items = null; 947 this._interval = null; 948 this._activeElement = null; 949 this._isPaused = false; 950 this._isSliding = false; 951 this.touchTimeout = null; 952 this.touchStartX = 0; 953 this.touchDeltaX = 0; 954 this._config = this._getConfig(config); 955 this._element = element; 956 this._indicatorsElement = this._element.querySelector(SELECTOR_INDICATORS); 957 this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; 958 this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent); 959 960 this._addEventListeners(); 961 } // Getters 962 963 964 var _proto = Carousel.prototype; 965 966 // Public 967 _proto.next = function next() { 968 if (!this._isSliding) { 969 this._slide(DIRECTION_NEXT); 970 } 971 }; 972 973 _proto.nextWhenVisible = function nextWhenVisible() { 974 var $element = $__default["default"](this._element); // Don't call next when the page isn't visible 975 // or the carousel or its parent isn't visible 976 977 if (!document.hidden && $element.is(':visible') && $element.css('visibility') !== 'hidden') { 978 this.next(); 979 } 980 }; 981 982 _proto.prev = function prev() { 983 if (!this._isSliding) { 984 this._slide(DIRECTION_PREV); 985 } 986 }; 987 988 _proto.pause = function pause(event) { 989 if (!event) { 990 this._isPaused = true; 991 } 992 993 if (this._element.querySelector(SELECTOR_NEXT_PREV)) { 994 Util.triggerTransitionEnd(this._element); 995 this.cycle(true); 996 } 997 998 clearInterval(this._interval); 999 this._interval = null; 1000 }; 1001 1002 _proto.cycle = function cycle(event) { 1003 if (!event) { 1004 this._isPaused = false; 1005 } 1006 1007 if (this._interval) { 1008 clearInterval(this._interval); 1009 this._interval = null; 1010 } 1011 1012 if (this._config.interval && !this._isPaused) { 1013 this._updateInterval(); 1014 1015 this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval); 1016 } 1017 }; 1018 1019 _proto.to = function to(index) { 1020 var _this = this; 1021 1022 this._activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM); 1023 1024 var activeIndex = this._getItemIndex(this._activeElement); 1025 1026 if (index > this._items.length - 1 || index < 0) { 1027 return; 1028 } 1029 1030 if (this._isSliding) { 1031 $__default["default"](this._element).one(EVENT_SLID, function () { 1032 return _this.to(index); 1033 }); 1034 return; 1035 } 1036 1037 if (activeIndex === index) { 1038 this.pause(); 1039 this.cycle(); 1040 return; 1041 } 1042 1043 var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV; 1044 1045 this._slide(direction, this._items[index]); 1046 }; 1047 1048 _proto.dispose = function dispose() { 1049 $__default["default"](this._element).off(EVENT_KEY$8); 1050 $__default["default"].removeData(this._element, DATA_KEY$8); 1051 this._items = null; 1052 this._config = null; 1053 this._element = null; 1054 this._interval = null; 1055 this._isPaused = null; 1056 this._isSliding = null; 1057 this._activeElement = null; 1058 this._indicatorsElement = null; 1059 } // Private 1060 ; 1061 1062 _proto._getConfig = function _getConfig(config) { 1063 config = _extends({}, Default$7, config); 1064 Util.typeCheckConfig(NAME$8, config, DefaultType$7); 1065 return config; 1066 }; 1067 1068 _proto._handleSwipe = function _handleSwipe() { 1069 var absDeltax = Math.abs(this.touchDeltaX); 1070 1071 if (absDeltax <= SWIPE_THRESHOLD) { 1072 return; 1073 } 1074 1075 var direction = absDeltax / this.touchDeltaX; 1076 this.touchDeltaX = 0; // swipe left 1077 1078 if (direction > 0) { 1079 this.prev(); 1080 } // swipe right 1081 1082 1083 if (direction < 0) { 1084 this.next(); 1085 } 1086 }; 1087 1088 _proto._addEventListeners = function _addEventListeners() { 1089 var _this2 = this; 1090 1091 if (this._config.keyboard) { 1092 $__default["default"](this._element).on(EVENT_KEYDOWN, function (event) { 1093 return _this2._keydown(event); 1094 }); 1095 } 1096 1097 if (this._config.pause === 'hover') { 1098 $__default["default"](this._element).on(EVENT_MOUSEENTER, function (event) { 1099 return _this2.pause(event); 1100 }).on(EVENT_MOUSELEAVE, function (event) { 1101 return _this2.cycle(event); 1102 }); 1103 } 1104 1105 if (this._config.touch) { 1106 this._addTouchEventListeners(); 1107 } 1108 }; 1109 1110 _proto._addTouchEventListeners = function _addTouchEventListeners() { 1111 var _this3 = this; 1112 1113 if (!this._touchSupported) { 1114 return; 1115 } 1116 1117 var start = function start(event) { 1118 if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 1119 _this3.touchStartX = event.originalEvent.clientX; 1120 } else if (!_this3._pointerEvent) { 1121 _this3.touchStartX = event.originalEvent.touches[0].clientX; 1122 } 1123 }; 1124 1125 var move = function move(event) { 1126 // ensure swiping with one touch and not pinching 1127 _this3.touchDeltaX = event.originalEvent.touches && event.originalEvent.touches.length > 1 ? 0 : event.originalEvent.touches[0].clientX - _this3.touchStartX; 1128 }; 1129 1130 var end = function end(event) { 1131 if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 1132 _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX; 1133 } 1134 1135 _this3._handleSwipe(); 1136 1137 if (_this3._config.pause === 'hover') { 1138 // If it's a touch-enabled device, mouseenter/leave are fired as 1139 // part of the mouse compatibility events on first tap - the carousel 1140 // would stop cycling until user tapped out of it; 1141 // here, we listen for touchend, explicitly pause the carousel 1142 // (as if it's the second time we tap on it, mouseenter compat event 1143 // is NOT fired) and after a timeout (to allow for mouse compatibility 1144 // events to fire) we explicitly restart cycling 1145 _this3.pause(); 1146 1147 if (_this3.touchTimeout) { 1148 clearTimeout(_this3.touchTimeout); 1149 } 1150 1151 _this3.touchTimeout = setTimeout(function (event) { 1152 return _this3.cycle(event); 1153 }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval); 1154 } 1155 }; 1156 1157 $__default["default"](this._element.querySelectorAll(SELECTOR_ITEM_IMG)).on(EVENT_DRAG_START, function (e) { 1158 return e.preventDefault(); 1159 }); 1160 1161 if (this._pointerEvent) { 1162 $__default["default"](this._element).on(EVENT_POINTERDOWN, function (event) { 1163 return start(event); 1164 }); 1165 $__default["default"](this._element).on(EVENT_POINTERUP, function (event) { 1166 return end(event); 1167 }); 1168 1169 this._element.classList.add(CLASS_NAME_POINTER_EVENT); 1170 } else { 1171 $__default["default"](this._element).on(EVENT_TOUCHSTART, function (event) { 1172 return start(event); 1173 }); 1174 $__default["default"](this._element).on(EVENT_TOUCHMOVE, function (event) { 1175 return move(event); 1176 }); 1177 $__default["default"](this._element).on(EVENT_TOUCHEND, function (event) { 1178 return end(event); 1179 }); 1180 } 1181 }; 1182 1183 _proto._keydown = function _keydown(event) { 1184 if (/input|textarea/i.test(event.target.tagName)) { 1185 return; 1186 } 1187 1188 switch (event.which) { 1189 case ARROW_LEFT_KEYCODE: 1190 event.preventDefault(); 1191 this.prev(); 1192 break; 1193 1194 case ARROW_RIGHT_KEYCODE: 1195 event.preventDefault(); 1196 this.next(); 1197 break; 1198 } 1199 }; 1200 1201 _proto._getItemIndex = function _getItemIndex(element) { 1202 this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM)) : []; 1203 return this._items.indexOf(element); 1204 }; 1205 1206 _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) { 1207 var isNextDirection = direction === DIRECTION_NEXT; 1208 var isPrevDirection = direction === DIRECTION_PREV; 1209 1210 var activeIndex = this._getItemIndex(activeElement); 1211 1212 var lastItemIndex = this._items.length - 1; 1213 var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex; 1214 1215 if (isGoingToWrap && !this._config.wrap) { 1216 return activeElement; 1217 } 1218 1219 var delta = direction === DIRECTION_PREV ? -1 : 1; 1220 var itemIndex = (activeIndex + delta) % this._items.length; 1221 return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex]; 1222 }; 1223 1224 _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { 1225 var targetIndex = this._getItemIndex(relatedTarget); 1226 1227 var fromIndex = this._getItemIndex(this._element.querySelector(SELECTOR_ACTIVE_ITEM)); 1228 1229 var slideEvent = $__default["default"].Event(EVENT_SLIDE, { 1230 relatedTarget: relatedTarget, 1231 direction: eventDirectionName, 1232 from: fromIndex, 1233 to: targetIndex 1234 }); 1235 $__default["default"](this._element).trigger(slideEvent); 1236 return slideEvent; 1237 }; 1238 1239 _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { 1240 if (this._indicatorsElement) { 1241 var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE$1)); 1242 $__default["default"](indicators).removeClass(CLASS_NAME_ACTIVE$2); 1243 1244 var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; 1245 1246 if (nextIndicator) { 1247 $__default["default"](nextIndicator).addClass(CLASS_NAME_ACTIVE$2); 1248 } 1249 } 1250 }; 1251 1252 _proto._updateInterval = function _updateInterval() { 1253 var element = this._activeElement || this._element.querySelector(SELECTOR_ACTIVE_ITEM); 1254 1255 if (!element) { 1256 return; 1257 } 1258 1259 var elementInterval = parseInt(element.getAttribute('data-interval'), 10); 1260 1261 if (elementInterval) { 1262 this._config.defaultInterval = this._config.defaultInterval || this._config.interval; 1263 this._config.interval = elementInterval; 1264 } else { 1265 this._config.interval = this._config.defaultInterval || this._config.interval; 1266 } 1267 }; 1268 1269 _proto._slide = function _slide(direction, element) { 1270 var _this4 = this; 1271 1272 var activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM); 1273 1274 var activeElementIndex = this._getItemIndex(activeElement); 1275 1276 var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement); 1277 1278 var nextElementIndex = this._getItemIndex(nextElement); 1279 1280 var isCycling = Boolean(this._interval); 1281 var directionalClassName; 1282 var orderClassName; 1283 var eventDirectionName; 1284 1285 if (direction === DIRECTION_NEXT) { 1286 directionalClassName = CLASS_NAME_LEFT; 1287 orderClassName = CLASS_NAME_NEXT; 1288 eventDirectionName = DIRECTION_LEFT; 1289 } else { 1290 directionalClassName = CLASS_NAME_RIGHT; 1291 orderClassName = CLASS_NAME_PREV; 1292 eventDirectionName = DIRECTION_RIGHT; 1293 } 1294 1295 if (nextElement && $__default["default"](nextElement).hasClass(CLASS_NAME_ACTIVE$2)) { 1296 this._isSliding = false; 1297 return; 1298 } 1299 1300 var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); 1301 1302 if (slideEvent.isDefaultPrevented()) { 1303 return; 1304 } 1305 1306 if (!activeElement || !nextElement) { 1307 // Some weirdness is happening, so we bail 1308 return; 1309 } 1310 1311 this._isSliding = true; 1312 1313 if (isCycling) { 1314 this.pause(); 1315 } 1316 1317 this._setActiveIndicatorElement(nextElement); 1318 1319 this._activeElement = nextElement; 1320 var slidEvent = $__default["default"].Event(EVENT_SLID, { 1321 relatedTarget: nextElement, 1322 direction: eventDirectionName, 1323 from: activeElementIndex, 1324 to: nextElementIndex 1325 }); 1326 1327 if ($__default["default"](this._element).hasClass(CLASS_NAME_SLIDE)) { 1328 $__default["default"](nextElement).addClass(orderClassName); 1329 Util.reflow(nextElement); 1330 $__default["default"](activeElement).addClass(directionalClassName); 1331 $__default["default"](nextElement).addClass(directionalClassName); 1332 var transitionDuration = Util.getTransitionDurationFromElement(activeElement); 1333 $__default["default"](activeElement).one(Util.TRANSITION_END, function () { 1334 $__default["default"](nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(CLASS_NAME_ACTIVE$2); 1335 $__default["default"](activeElement).removeClass(CLASS_NAME_ACTIVE$2 + " " + orderClassName + " " + directionalClassName); 1336 _this4._isSliding = false; 1337 setTimeout(function () { 1338 return $__default["default"](_this4._element).trigger(slidEvent); 1339 }, 0); 1340 }).emulateTransitionEnd(transitionDuration); 1341 } else { 1342 $__default["default"](activeElement).removeClass(CLASS_NAME_ACTIVE$2); 1343 $__default["default"](nextElement).addClass(CLASS_NAME_ACTIVE$2); 1344 this._isSliding = false; 1345 $__default["default"](this._element).trigger(slidEvent); 1346 } 1347 1348 if (isCycling) { 1349 this.cycle(); 1350 } 1351 } // Static 1352 ; 1353 1354 Carousel._jQueryInterface = function _jQueryInterface(config) { 1355 return this.each(function () { 1356 var data = $__default["default"](this).data(DATA_KEY$8); 1357 1358 var _config = _extends({}, Default$7, $__default["default"](this).data()); 1359 1360 if (typeof config === 'object') { 1361 _config = _extends({}, _config, config); 1362 } 1363 1364 var action = typeof config === 'string' ? config : _config.slide; 1365 1366 if (!data) { 1367 data = new Carousel(this, _config); 1368 $__default["default"](this).data(DATA_KEY$8, data); 1369 } 1370 1371 if (typeof config === 'number') { 1372 data.to(config); 1373 } else if (typeof action === 'string') { 1374 if (typeof data[action] === 'undefined') { 1375 throw new TypeError("No method named \"" + action + "\""); 1376 } 1377 1378 data[action](); 1379 } else if (_config.interval && _config.ride) { 1380 data.pause(); 1381 data.cycle(); 1382 } 1383 }); 1384 }; 1385 1386 Carousel._dataApiClickHandler = function _dataApiClickHandler(event) { 1387 var selector = Util.getSelectorFromElement(this); 1388 1389 if (!selector) { 1390 return; 1391 } 1392 1393 var target = $__default["default"](selector)[0]; 1394 1395 if (!target || !$__default["default"](target).hasClass(CLASS_NAME_CAROUSEL)) { 1396 return; 1397 } 1398 1399 var config = _extends({}, $__default["default"](target).data(), $__default["default"](this).data()); 1400 1401 var slideIndex = this.getAttribute('data-slide-to'); 1402 1403 if (slideIndex) { 1404 config.interval = false; 1405 } 1406 1407 Carousel._jQueryInterface.call($__default["default"](target), config); 1408 1409 if (slideIndex) { 1410 $__default["default"](target).data(DATA_KEY$8).to(slideIndex); 1411 } 1412 1413 event.preventDefault(); 1414 }; 1415 1416 _createClass(Carousel, null, [{ 1417 key: "VERSION", 1418 get: function get() { 1419 return VERSION$8; 1420 } 1421 }, { 1422 key: "Default", 1423 get: function get() { 1424 return Default$7; 1425 } 1426 }]); 1427 1428 return Carousel; 1429 }(); 1430 /** 1431 * Data API implementation 1432 */ 1433 1434 1435 $__default["default"](document).on(EVENT_CLICK_DATA_API$4, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler); 1436 $__default["default"](window).on(EVENT_LOAD_DATA_API$1, function () { 1437 var carousels = [].slice.call(document.querySelectorAll(SELECTOR_DATA_RIDE)); 1438 1439 for (var i = 0, len = carousels.length; i < len; i++) { 1440 var $carousel = $__default["default"](carousels[i]); 1441 1442 Carousel._jQueryInterface.call($carousel, $carousel.data()); 1443 } 1444 }); 1445 /** 1446 * jQuery 1447 */ 1448 1449 $__default["default"].fn[NAME$8] = Carousel._jQueryInterface; 1450 $__default["default"].fn[NAME$8].Constructor = Carousel; 1451 1452 $__default["default"].fn[NAME$8].noConflict = function () { 1453 $__default["default"].fn[NAME$8] = JQUERY_NO_CONFLICT$8; 1454 return Carousel._jQueryInterface; 1455 }; 1456 1457 /** 1458 * Constants 1459 */ 1460 1461 var NAME$7 = 'collapse'; 1462 var VERSION$7 = '4.6.2'; 1463 var DATA_KEY$7 = 'bs.collapse'; 1464 var EVENT_KEY$7 = "." + DATA_KEY$7; 1465 var DATA_API_KEY$4 = '.data-api'; 1466 var JQUERY_NO_CONFLICT$7 = $__default["default"].fn[NAME$7]; 1467 var CLASS_NAME_SHOW$6 = 'show'; 1468 var CLASS_NAME_COLLAPSE = 'collapse'; 1469 var CLASS_NAME_COLLAPSING = 'collapsing'; 1470 var CLASS_NAME_COLLAPSED = 'collapsed'; 1471 var DIMENSION_WIDTH = 'width'; 1472 var DIMENSION_HEIGHT = 'height'; 1473 var EVENT_SHOW$4 = "show" + EVENT_KEY$7; 1474 var EVENT_SHOWN$4 = "shown" + EVENT_KEY$7; 1475 var EVENT_HIDE$4 = "hide" + EVENT_KEY$7; 1476 var EVENT_HIDDEN$4 = "hidden" + EVENT_KEY$7; 1477 var EVENT_CLICK_DATA_API$3 = "click" + EVENT_KEY$7 + DATA_API_KEY$4; 1478 var SELECTOR_ACTIVES = '.show, .collapsing'; 1479 var SELECTOR_DATA_TOGGLE$3 = '[data-toggle="collapse"]'; 1480 var Default$6 = { 1481 toggle: true, 1482 parent: '' 1483 }; 1484 var DefaultType$6 = { 1485 toggle: 'boolean', 1486 parent: '(string|element)' 1487 }; 1488 /** 1489 * Class definition 1490 */ 1491 1492 var Collapse = /*#__PURE__*/function () { 1493 function Collapse(element, config) { 1494 this._isTransitioning = false; 1495 this._element = element; 1496 this._config = this._getConfig(config); 1497 this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]"))); 1498 var toggleList = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$3)); 1499 1500 for (var i = 0, len = toggleList.length; i < len; i++) { 1501 var elem = toggleList[i]; 1502 var selector = Util.getSelectorFromElement(elem); 1503 var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) { 1504 return foundElem === element; 1505 }); 1506 1507 if (selector !== null && filterElement.length > 0) { 1508 this._selector = selector; 1509 1510 this._triggerArray.push(elem); 1511 } 1512 } 1513 1514 this._parent = this._config.parent ? this._getParent() : null; 1515 1516 if (!this._config.parent) { 1517 this._addAriaAndCollapsedClass(this._element, this._triggerArray); 1518 } 1519 1520 if (this._config.toggle) { 1521 this.toggle(); 1522 } 1523 } // Getters 1524 1525 1526 var _proto = Collapse.prototype; 1527 1528 // Public 1529 _proto.toggle = function toggle() { 1530 if ($__default["default"](this._element).hasClass(CLASS_NAME_SHOW$6)) { 1531 this.hide(); 1532 } else { 1533 this.show(); 1534 } 1535 }; 1536 1537 _proto.show = function show() { 1538 var _this = this; 1539 1540 if (this._isTransitioning || $__default["default"](this._element).hasClass(CLASS_NAME_SHOW$6)) { 1541 return; 1542 } 1543 1544 var actives; 1545 var activesData; 1546 1547 if (this._parent) { 1548 actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_ACTIVES)).filter(function (elem) { 1549 if (typeof _this._config.parent === 'string') { 1550 return elem.getAttribute('data-parent') === _this._config.parent; 1551 } 1552 1553 return elem.classList.contains(CLASS_NAME_COLLAPSE); 1554 }); 1555 1556 if (actives.length === 0) { 1557 actives = null; 1558 } 1559 } 1560 1561 if (actives) { 1562 activesData = $__default["default"](actives).not(this._selector).data(DATA_KEY$7); 1563 1564 if (activesData && activesData._isTransitioning) { 1565 return; 1566 } 1567 } 1568 1569 var startEvent = $__default["default"].Event(EVENT_SHOW$4); 1570 $__default["default"](this._element).trigger(startEvent); 1571 1572 if (startEvent.isDefaultPrevented()) { 1573 return; 1574 } 1575 1576 if (actives) { 1577 Collapse._jQueryInterface.call($__default["default"](actives).not(this._selector), 'hide'); 1578 1579 if (!activesData) { 1580 $__default["default"](actives).data(DATA_KEY$7, null); 1581 } 1582 } 1583 1584 var dimension = this._getDimension(); 1585 1586 $__default["default"](this._element).removeClass(CLASS_NAME_COLLAPSE).addClass(CLASS_NAME_COLLAPSING); 1587 this._element.style[dimension] = 0; 1588 1589 if (this._triggerArray.length) { 1590 $__default["default"](this._triggerArray).removeClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', true); 1591 } 1592 1593 this.setTransitioning(true); 1594 1595 var complete = function complete() { 1596 $__default["default"](_this._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$6); 1597 _this._element.style[dimension] = ''; 1598 1599 _this.setTransitioning(false); 1600 1601 $__default["default"](_this._element).trigger(EVENT_SHOWN$4); 1602 }; 1603 1604 var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); 1605 var scrollSize = "scroll" + capitalizedDimension; 1606 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 1607 $__default["default"](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 1608 this._element.style[dimension] = this._element[scrollSize] + "px"; 1609 }; 1610 1611 _proto.hide = function hide() { 1612 var _this2 = this; 1613 1614 if (this._isTransitioning || !$__default["default"](this._element).hasClass(CLASS_NAME_SHOW$6)) { 1615 return; 1616 } 1617 1618 var startEvent = $__default["default"].Event(EVENT_HIDE$4); 1619 $__default["default"](this._element).trigger(startEvent); 1620 1621 if (startEvent.isDefaultPrevented()) { 1622 return; 1623 } 1624 1625 var dimension = this._getDimension(); 1626 1627 this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px"; 1628 Util.reflow(this._element); 1629 $__default["default"](this._element).addClass(CLASS_NAME_COLLAPSING).removeClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$6); 1630 var triggerArrayLength = this._triggerArray.length; 1631 1632 if (triggerArrayLength > 0) { 1633 for (var i = 0; i < triggerArrayLength; i++) { 1634 var trigger = this._triggerArray[i]; 1635 var selector = Util.getSelectorFromElement(trigger); 1636 1637 if (selector !== null) { 1638 var $elem = $__default["default"]([].slice.call(document.querySelectorAll(selector))); 1639 1640 if (!$elem.hasClass(CLASS_NAME_SHOW$6)) { 1641 $__default["default"](trigger).addClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', false); 1642 } 1643 } 1644 } 1645 } 1646 1647 this.setTransitioning(true); 1648 1649 var complete = function complete() { 1650 _this2.setTransitioning(false); 1651 1652 $__default["default"](_this2._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE).trigger(EVENT_HIDDEN$4); 1653 }; 1654 1655 this._element.style[dimension] = ''; 1656 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 1657 $__default["default"](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 1658 }; 1659 1660 _proto.setTransitioning = function setTransitioning(isTransitioning) { 1661 this._isTransitioning = isTransitioning; 1662 }; 1663 1664 _proto.dispose = function dispose() { 1665 $__default["default"].removeData(this._element, DATA_KEY$7); 1666 this._config = null; 1667 this._parent = null; 1668 this._element = null; 1669 this._triggerArray = null; 1670 this._isTransitioning = null; 1671 } // Private 1672 ; 1673 1674 _proto._getConfig = function _getConfig(config) { 1675 config = _extends({}, Default$6, config); 1676 config.toggle = Boolean(config.toggle); // Coerce string values 1677 1678 Util.typeCheckConfig(NAME$7, config, DefaultType$6); 1679 return config; 1680 }; 1681 1682 _proto._getDimension = function _getDimension() { 1683 var hasWidth = $__default["default"](this._element).hasClass(DIMENSION_WIDTH); 1684 return hasWidth ? DIMENSION_WIDTH : DIMENSION_HEIGHT; 1685 }; 1686 1687 _proto._getParent = function _getParent() { 1688 var _this3 = this; 1689 1690 var parent; 1691 1692 if (Util.isElement(this._config.parent)) { 1693 parent = this._config.parent; // It's a jQuery object 1694 1695 if (typeof this._config.parent.jquery !== 'undefined') { 1696 parent = this._config.parent[0]; 1697 } 1698 } else { 1699 parent = document.querySelector(this._config.parent); 1700 } 1701 1702 var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]"; 1703 var children = [].slice.call(parent.querySelectorAll(selector)); 1704 $__default["default"](children).each(function (i, element) { 1705 _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); 1706 }); 1707 return parent; 1708 }; 1709 1710 _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) { 1711 var isOpen = $__default["default"](element).hasClass(CLASS_NAME_SHOW$6); 1712 1713 if (triggerArray.length) { 1714 $__default["default"](triggerArray).toggleClass(CLASS_NAME_COLLAPSED, !isOpen).attr('aria-expanded', isOpen); 1715 } 1716 } // Static 1717 ; 1718 1719 Collapse._getTargetFromElement = function _getTargetFromElement(element) { 1720 var selector = Util.getSelectorFromElement(element); 1721 return selector ? document.querySelector(selector) : null; 1722 }; 1723 1724 Collapse._jQueryInterface = function _jQueryInterface(config) { 1725 return this.each(function () { 1726 var $element = $__default["default"](this); 1727 var data = $element.data(DATA_KEY$7); 1728 1729 var _config = _extends({}, Default$6, $element.data(), typeof config === 'object' && config ? config : {}); 1730 1731 if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) { 1732 _config.toggle = false; 1733 } 1734 1735 if (!data) { 1736 data = new Collapse(this, _config); 1737 $element.data(DATA_KEY$7, data); 1738 } 1739 1740 if (typeof config === 'string') { 1741 if (typeof data[config] === 'undefined') { 1742 throw new TypeError("No method named \"" + config + "\""); 1743 } 1744 1745 data[config](); 1746 } 1747 }); 1748 }; 1749 1750 _createClass(Collapse, null, [{ 1751 key: "VERSION", 1752 get: function get() { 1753 return VERSION$7; 1754 } 1755 }, { 1756 key: "Default", 1757 get: function get() { 1758 return Default$6; 1759 } 1760 }]); 1761 1762 return Collapse; 1763 }(); 1764 /** 1765 * Data API implementation 1766 */ 1767 1768 1769 $__default["default"](document).on(EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) { 1770 // preventDefault only for <a> elements (which change the URL) not inside the collapsible element 1771 if (event.currentTarget.tagName === 'A') { 1772 event.preventDefault(); 1773 } 1774 1775 var $trigger = $__default["default"](this); 1776 var selector = Util.getSelectorFromElement(this); 1777 var selectors = [].slice.call(document.querySelectorAll(selector)); 1778 $__default["default"](selectors).each(function () { 1779 var $target = $__default["default"](this); 1780 var data = $target.data(DATA_KEY$7); 1781 var config = data ? 'toggle' : $trigger.data(); 1782 1783 Collapse._jQueryInterface.call($target, config); 1784 }); 1785 }); 1786 /** 1787 * jQuery 1788 */ 1789 1790 $__default["default"].fn[NAME$7] = Collapse._jQueryInterface; 1791 $__default["default"].fn[NAME$7].Constructor = Collapse; 1792 1793 $__default["default"].fn[NAME$7].noConflict = function () { 1794 $__default["default"].fn[NAME$7] = JQUERY_NO_CONFLICT$7; 1795 return Collapse._jQueryInterface; 1796 }; 1797 1798 /** 1799 * Constants 1800 */ 1801 1802 var NAME$6 = 'dropdown'; 1803 var VERSION$6 = '4.6.2'; 1804 var DATA_KEY$6 = 'bs.dropdown'; 1805 var EVENT_KEY$6 = "." + DATA_KEY$6; 1806 var DATA_API_KEY$3 = '.data-api'; 1807 var JQUERY_NO_CONFLICT$6 = $__default["default"].fn[NAME$6]; 1808 var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key 1809 1810 var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key 1811 1812 var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key 1813 1814 var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key 1815 1816 var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key 1817 1818 var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse) 1819 1820 var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE$1); 1821 var CLASS_NAME_DISABLED$1 = 'disabled'; 1822 var CLASS_NAME_SHOW$5 = 'show'; 1823 var CLASS_NAME_DROPUP = 'dropup'; 1824 var CLASS_NAME_DROPRIGHT = 'dropright'; 1825 var CLASS_NAME_DROPLEFT = 'dropleft'; 1826 var CLASS_NAME_MENURIGHT = 'dropdown-menu-right'; 1827 var CLASS_NAME_POSITION_STATIC = 'position-static'; 1828 var EVENT_HIDE$3 = "hide" + EVENT_KEY$6; 1829 var EVENT_HIDDEN$3 = "hidden" + EVENT_KEY$6; 1830 var EVENT_SHOW$3 = "show" + EVENT_KEY$6; 1831 var EVENT_SHOWN$3 = "shown" + EVENT_KEY$6; 1832 var EVENT_CLICK = "click" + EVENT_KEY$6; 1833 var EVENT_CLICK_DATA_API$2 = "click" + EVENT_KEY$6 + DATA_API_KEY$3; 1834 var EVENT_KEYDOWN_DATA_API = "keydown" + EVENT_KEY$6 + DATA_API_KEY$3; 1835 var EVENT_KEYUP_DATA_API = "keyup" + EVENT_KEY$6 + DATA_API_KEY$3; 1836 var SELECTOR_DATA_TOGGLE$2 = '[data-toggle="dropdown"]'; 1837 var SELECTOR_FORM_CHILD = '.dropdown form'; 1838 var SELECTOR_MENU = '.dropdown-menu'; 1839 var SELECTOR_NAVBAR_NAV = '.navbar-nav'; 1840 var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'; 1841 var PLACEMENT_TOP = 'top-start'; 1842 var PLACEMENT_TOPEND = 'top-end'; 1843 var PLACEMENT_BOTTOM = 'bottom-start'; 1844 var PLACEMENT_BOTTOMEND = 'bottom-end'; 1845 var PLACEMENT_RIGHT = 'right-start'; 1846 var PLACEMENT_LEFT = 'left-start'; 1847 var Default$5 = { 1848 offset: 0, 1849 flip: true, 1850 boundary: 'scrollParent', 1851 reference: 'toggle', 1852 display: 'dynamic', 1853 popperConfig: null 1854 }; 1855 var DefaultType$5 = { 1856 offset: '(number|string|function)', 1857 flip: 'boolean', 1858 boundary: '(string|element)', 1859 reference: '(string|element)', 1860 display: 'string', 1861 popperConfig: '(null|object)' 1862 }; 1863 /** 1864 * Class definition 1865 */ 1866 1867 var Dropdown = /*#__PURE__*/function () { 1868 function Dropdown(element, config) { 1869 this._element = element; 1870 this._popper = null; 1871 this._config = this._getConfig(config); 1872 this._menu = this._getMenuElement(); 1873 this._inNavbar = this._detectNavbar(); 1874 1875 this._addEventListeners(); 1876 } // Getters 1877 1878 1879 var _proto = Dropdown.prototype; 1880 1881 // Public 1882 _proto.toggle = function toggle() { 1883 if (this._element.disabled || $__default["default"](this._element).hasClass(CLASS_NAME_DISABLED$1)) { 1884 return; 1885 } 1886 1887 var isActive = $__default["default"](this._menu).hasClass(CLASS_NAME_SHOW$5); 1888 1889 Dropdown._clearMenus(); 1890 1891 if (isActive) { 1892 return; 1893 } 1894 1895 this.show(true); 1896 }; 1897 1898 _proto.show = function show(usePopper) { 1899 if (usePopper === void 0) { 1900 usePopper = false; 1901 } 1902 1903 if (this._element.disabled || $__default["default"](this._element).hasClass(CLASS_NAME_DISABLED$1) || $__default["default"](this._menu).hasClass(CLASS_NAME_SHOW$5)) { 1904 return; 1905 } 1906 1907 var relatedTarget = { 1908 relatedTarget: this._element 1909 }; 1910 var showEvent = $__default["default"].Event(EVENT_SHOW$3, relatedTarget); 1911 1912 var parent = Dropdown._getParentFromElement(this._element); 1913 1914 $__default["default"](parent).trigger(showEvent); 1915 1916 if (showEvent.isDefaultPrevented()) { 1917 return; 1918 } // Totally disable Popper for Dropdowns in Navbar 1919 1920 1921 if (!this._inNavbar && usePopper) { 1922 // Check for Popper dependency 1923 if (typeof Popper__default["default"] === 'undefined') { 1924 throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)'); 1925 } 1926 1927 var referenceElement = this._element; 1928 1929 if (this._config.reference === 'parent') { 1930 referenceElement = parent; 1931 } else if (Util.isElement(this._config.reference)) { 1932 referenceElement = this._config.reference; // Check if it's jQuery element 1933 1934 if (typeof this._config.reference.jquery !== 'undefined') { 1935 referenceElement = this._config.reference[0]; 1936 } 1937 } // If boundary is not `scrollParent`, then set position to `static` 1938 // to allow the menu to "escape" the scroll parent's boundaries 1939 // https://github.com/twbs/bootstrap/issues/24251 1940 1941 1942 if (this._config.boundary !== 'scrollParent') { 1943 $__default["default"](parent).addClass(CLASS_NAME_POSITION_STATIC); 1944 } 1945 1946 this._popper = new Popper__default["default"](referenceElement, this._menu, this._getPopperConfig()); 1947 } // If this is a touch-enabled device we add extra 1948 // empty mouseover listeners to the body's immediate children; 1949 // only needed because of broken event delegation on iOS 1950 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 1951 1952 1953 if ('ontouchstart' in document.documentElement && $__default["default"](parent).closest(SELECTOR_NAVBAR_NAV).length === 0) { 1954 $__default["default"](document.body).children().on('mouseover', null, $__default["default"].noop); 1955 } 1956 1957 this._element.focus(); 1958 1959 this._element.setAttribute('aria-expanded', true); 1960 1961 $__default["default"](this._menu).toggleClass(CLASS_NAME_SHOW$5); 1962 $__default["default"](parent).toggleClass(CLASS_NAME_SHOW$5).trigger($__default["default"].Event(EVENT_SHOWN$3, relatedTarget)); 1963 }; 1964 1965 _proto.hide = function hide() { 1966 if (this._element.disabled || $__default["default"](this._element).hasClass(CLASS_NAME_DISABLED$1) || !$__default["default"](this._menu).hasClass(CLASS_NAME_SHOW$5)) { 1967 return; 1968 } 1969 1970 var relatedTarget = { 1971 relatedTarget: this._element 1972 }; 1973 var hideEvent = $__default["default"].Event(EVENT_HIDE$3, relatedTarget); 1974 1975 var parent = Dropdown._getParentFromElement(this._element); 1976 1977 $__default["default"](parent).trigger(hideEvent); 1978 1979 if (hideEvent.isDefaultPrevented()) { 1980 return; 1981 } 1982 1983 if (this._popper) { 1984 this._popper.destroy(); 1985 } 1986 1987 $__default["default"](this._menu).toggleClass(CLASS_NAME_SHOW$5); 1988 $__default["default"](parent).toggleClass(CLASS_NAME_SHOW$5).trigger($__default["default"].Event(EVENT_HIDDEN$3, relatedTarget)); 1989 }; 1990 1991 _proto.dispose = function dispose() { 1992 $__default["default"].removeData(this._element, DATA_KEY$6); 1993 $__default["default"](this._element).off(EVENT_KEY$6); 1994 this._element = null; 1995 this._menu = null; 1996 1997 if (this._popper !== null) { 1998 this._popper.destroy(); 1999 2000 this._popper = null; 2001 } 2002 }; 2003 2004 _proto.update = function update() { 2005 this._inNavbar = this._detectNavbar(); 2006 2007 if (this._popper !== null) { 2008 this._popper.scheduleUpdate(); 2009 } 2010 } // Private 2011 ; 2012 2013 _proto._addEventListeners = function _addEventListeners() { 2014 var _this = this; 2015 2016 $__default["default"](this._element).on(EVENT_CLICK, function (event) { 2017 event.preventDefault(); 2018 event.stopPropagation(); 2019 2020 _this.toggle(); 2021 }); 2022 }; 2023 2024 _proto._getConfig = function _getConfig(config) { 2025 config = _extends({}, this.constructor.Default, $__default["default"](this._element).data(), config); 2026 Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType); 2027 return config; 2028 }; 2029 2030 _proto._getMenuElement = function _getMenuElement() { 2031 if (!this._menu) { 2032 var parent = Dropdown._getParentFromElement(this._element); 2033 2034 if (parent) { 2035 this._menu = parent.querySelector(SELECTOR_MENU); 2036 } 2037 } 2038 2039 return this._menu; 2040 }; 2041 2042 _proto._getPlacement = function _getPlacement() { 2043 var $parentDropdown = $__default["default"](this._element.parentNode); 2044 var placement = PLACEMENT_BOTTOM; // Handle dropup 2045 2046 if ($parentDropdown.hasClass(CLASS_NAME_DROPUP)) { 2047 placement = $__default["default"](this._menu).hasClass(CLASS_NAME_MENURIGHT) ? PLACEMENT_TOPEND : PLACEMENT_TOP; 2048 } else if ($parentDropdown.hasClass(CLASS_NAME_DROPRIGHT)) { 2049 placement = PLACEMENT_RIGHT; 2050 } else if ($parentDropdown.hasClass(CLASS_NAME_DROPLEFT)) { 2051 placement = PLACEMENT_LEFT; 2052 } else if ($__default["default"](this._menu).hasClass(CLASS_NAME_MENURIGHT)) { 2053 placement = PLACEMENT_BOTTOMEND; 2054 } 2055 2056 return placement; 2057 }; 2058 2059 _proto._detectNavbar = function _detectNavbar() { 2060 return $__default["default"](this._element).closest('.navbar').length > 0; 2061 }; 2062 2063 _proto._getOffset = function _getOffset() { 2064 var _this2 = this; 2065 2066 var offset = {}; 2067 2068 if (typeof this._config.offset === 'function') { 2069 offset.fn = function (data) { 2070 data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets, _this2._element)); 2071 return data; 2072 }; 2073 } else { 2074 offset.offset = this._config.offset; 2075 } 2076 2077 return offset; 2078 }; 2079 2080 _proto._getPopperConfig = function _getPopperConfig() { 2081 var popperConfig = { 2082 placement: this._getPlacement(), 2083 modifiers: { 2084 offset: this._getOffset(), 2085 flip: { 2086 enabled: this._config.flip 2087 }, 2088 preventOverflow: { 2089 boundariesElement: this._config.boundary 2090 } 2091 } 2092 }; // Disable Popper if we have a static display 2093 2094 if (this._config.display === 'static') { 2095 popperConfig.modifiers.applyStyle = { 2096 enabled: false 2097 }; 2098 } 2099 2100 return _extends({}, popperConfig, this._config.popperConfig); 2101 } // Static 2102 ; 2103 2104 Dropdown._jQueryInterface = function _jQueryInterface(config) { 2105 return this.each(function () { 2106 var data = $__default["default"](this).data(DATA_KEY$6); 2107 2108 var _config = typeof config === 'object' ? config : null; 2109 2110 if (!data) { 2111 data = new Dropdown(this, _config); 2112 $__default["default"](this).data(DATA_KEY$6, data); 2113 } 2114 2115 if (typeof config === 'string') { 2116 if (typeof data[config] === 'undefined') { 2117 throw new TypeError("No method named \"" + config + "\""); 2118 } 2119 2120 data[config](); 2121 } 2122 }); 2123 }; 2124 2125 Dropdown._clearMenus = function _clearMenus(event) { 2126 if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) { 2127 return; 2128 } 2129 2130 var toggles = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$2)); 2131 2132 for (var i = 0, len = toggles.length; i < len; i++) { 2133 var parent = Dropdown._getParentFromElement(toggles[i]); 2134 2135 var context = $__default["default"](toggles[i]).data(DATA_KEY$6); 2136 var relatedTarget = { 2137 relatedTarget: toggles[i] 2138 }; 2139 2140 if (event && event.type === 'click') { 2141 relatedTarget.clickEvent = event; 2142 } 2143 2144 if (!context) { 2145 continue; 2146 } 2147 2148 var dropdownMenu = context._menu; 2149 2150 if (!$__default["default"](parent).hasClass(CLASS_NAME_SHOW$5)) { 2151 continue; 2152 } 2153 2154 if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $__default["default"].contains(parent, event.target)) { 2155 continue; 2156 } 2157 2158 var hideEvent = $__default["default"].Event(EVENT_HIDE$3, relatedTarget); 2159 $__default["default"](parent).trigger(hideEvent); 2160 2161 if (hideEvent.isDefaultPrevented()) { 2162 continue; 2163 } // If this is a touch-enabled device we remove the extra 2164 // empty mouseover listeners we added for iOS support 2165 2166 2167 if ('ontouchstart' in document.documentElement) { 2168 $__default["default"](document.body).children().off('mouseover', null, $__default["default"].noop); 2169 } 2170 2171 toggles[i].setAttribute('aria-expanded', 'false'); 2172 2173 if (context._popper) { 2174 context._popper.destroy(); 2175 } 2176 2177 $__default["default"](dropdownMenu).removeClass(CLASS_NAME_SHOW$5); 2178 $__default["default"](parent).removeClass(CLASS_NAME_SHOW$5).trigger($__default["default"].Event(EVENT_HIDDEN$3, relatedTarget)); 2179 } 2180 }; 2181 2182 Dropdown._getParentFromElement = function _getParentFromElement(element) { 2183 var parent; 2184 var selector = Util.getSelectorFromElement(element); 2185 2186 if (selector) { 2187 parent = document.querySelector(selector); 2188 } 2189 2190 return parent || element.parentNode; 2191 } // eslint-disable-next-line complexity 2192 ; 2193 2194 Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) { 2195 // If not input/textarea: 2196 // - And not a key in REGEXP_KEYDOWN => not a dropdown command 2197 // If input/textarea: 2198 // - If space key => not a dropdown command 2199 // - If key is other than escape 2200 // - If key is not up or down => not a dropdown command 2201 // - If trigger inside the menu => not a dropdown command 2202 if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE$1 && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $__default["default"](event.target).closest(SELECTOR_MENU).length) : !REGEXP_KEYDOWN.test(event.which)) { 2203 return; 2204 } 2205 2206 if (this.disabled || $__default["default"](this).hasClass(CLASS_NAME_DISABLED$1)) { 2207 return; 2208 } 2209 2210 var parent = Dropdown._getParentFromElement(this); 2211 2212 var isActive = $__default["default"](parent).hasClass(CLASS_NAME_SHOW$5); 2213 2214 if (!isActive && event.which === ESCAPE_KEYCODE$1) { 2215 return; 2216 } 2217 2218 event.preventDefault(); 2219 event.stopPropagation(); 2220 2221 if (!isActive || event.which === ESCAPE_KEYCODE$1 || event.which === SPACE_KEYCODE) { 2222 if (event.which === ESCAPE_KEYCODE$1) { 2223 $__default["default"](parent.querySelector(SELECTOR_DATA_TOGGLE$2)).trigger('focus'); 2224 } 2225 2226 $__default["default"](this).trigger('click'); 2227 return; 2228 } 2229 2230 var items = [].slice.call(parent.querySelectorAll(SELECTOR_VISIBLE_ITEMS)).filter(function (item) { 2231 return $__default["default"](item).is(':visible'); 2232 }); 2233 2234 if (items.length === 0) { 2235 return; 2236 } 2237 2238 var index = items.indexOf(event.target); 2239 2240 if (event.which === ARROW_UP_KEYCODE && index > 0) { 2241 // Up 2242 index--; 2243 } 2244 2245 if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { 2246 // Down 2247 index++; 2248 } 2249 2250 if (index < 0) { 2251 index = 0; 2252 } 2253 2254 items[index].focus(); 2255 }; 2256 2257 _createClass(Dropdown, null, [{ 2258 key: "VERSION", 2259 get: function get() { 2260 return VERSION$6; 2261 } 2262 }, { 2263 key: "Default", 2264 get: function get() { 2265 return Default$5; 2266 } 2267 }, { 2268 key: "DefaultType", 2269 get: function get() { 2270 return DefaultType$5; 2271 } 2272 }]); 2273 2274 return Dropdown; 2275 }(); 2276 /** 2277 * Data API implementation 2278 */ 2279 2280 2281 $__default["default"](document).on(EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$2, Dropdown._dataApiKeydownHandler).on(EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown._dataApiKeydownHandler).on(EVENT_CLICK_DATA_API$2 + " " + EVENT_KEYUP_DATA_API, Dropdown._clearMenus).on(EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) { 2282 event.preventDefault(); 2283 event.stopPropagation(); 2284 2285 Dropdown._jQueryInterface.call($__default["default"](this), 'toggle'); 2286 }).on(EVENT_CLICK_DATA_API$2, SELECTOR_FORM_CHILD, function (e) { 2287 e.stopPropagation(); 2288 }); 2289 /** 2290 * jQuery 2291 */ 2292 2293 $__default["default"].fn[NAME$6] = Dropdown._jQueryInterface; 2294 $__default["default"].fn[NAME$6].Constructor = Dropdown; 2295 2296 $__default["default"].fn[NAME$6].noConflict = function () { 2297 $__default["default"].fn[NAME$6] = JQUERY_NO_CONFLICT$6; 2298 return Dropdown._jQueryInterface; 2299 }; 2300 2301 /** 2302 * Constants 2303 */ 2304 2305 var NAME$5 = 'modal'; 2306 var VERSION$5 = '4.6.2'; 2307 var DATA_KEY$5 = 'bs.modal'; 2308 var EVENT_KEY$5 = "." + DATA_KEY$5; 2309 var DATA_API_KEY$2 = '.data-api'; 2310 var JQUERY_NO_CONFLICT$5 = $__default["default"].fn[NAME$5]; 2311 var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key 2312 2313 var CLASS_NAME_SCROLLABLE = 'modal-dialog-scrollable'; 2314 var CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure'; 2315 var CLASS_NAME_BACKDROP = 'modal-backdrop'; 2316 var CLASS_NAME_OPEN = 'modal-open'; 2317 var CLASS_NAME_FADE$4 = 'fade'; 2318 var CLASS_NAME_SHOW$4 = 'show'; 2319 var CLASS_NAME_STATIC = 'modal-static'; 2320 var EVENT_HIDE$2 = "hide" + EVENT_KEY$5; 2321 var EVENT_HIDE_PREVENTED = "hidePrevented" + EVENT_KEY$5; 2322 var EVENT_HIDDEN$2 = "hidden" + EVENT_KEY$5; 2323 var EVENT_SHOW$2 = "show" + EVENT_KEY$5; 2324 var EVENT_SHOWN$2 = "shown" + EVENT_KEY$5; 2325 var EVENT_FOCUSIN = "focusin" + EVENT_KEY$5; 2326 var EVENT_RESIZE = "resize" + EVENT_KEY$5; 2327 var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$5; 2328 var EVENT_KEYDOWN_DISMISS = "keydown.dismiss" + EVENT_KEY$5; 2329 var EVENT_MOUSEUP_DISMISS = "mouseup.dismiss" + EVENT_KEY$5; 2330 var EVENT_MOUSEDOWN_DISMISS = "mousedown.dismiss" + EVENT_KEY$5; 2331 var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$5 + DATA_API_KEY$2; 2332 var SELECTOR_DIALOG = '.modal-dialog'; 2333 var SELECTOR_MODAL_BODY = '.modal-body'; 2334 var SELECTOR_DATA_TOGGLE$1 = '[data-toggle="modal"]'; 2335 var SELECTOR_DATA_DISMISS$1 = '[data-dismiss="modal"]'; 2336 var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'; 2337 var SELECTOR_STICKY_CONTENT = '.sticky-top'; 2338 var Default$4 = { 2339 backdrop: true, 2340 keyboard: true, 2341 focus: true, 2342 show: true 2343 }; 2344 var DefaultType$4 = { 2345 backdrop: '(boolean|string)', 2346 keyboard: 'boolean', 2347 focus: 'boolean', 2348 show: 'boolean' 2349 }; 2350 /** 2351 * Class definition 2352 */ 2353 2354 var Modal = /*#__PURE__*/function () { 2355 function Modal(element, config) { 2356 this._config = this._getConfig(config); 2357 this._element = element; 2358 this._dialog = element.querySelector(SELECTOR_DIALOG); 2359 this._backdrop = null; 2360 this._isShown = false; 2361 this._isBodyOverflowing = false; 2362 this._ignoreBackdropClick = false; 2363 this._isTransitioning = false; 2364 this._scrollbarWidth = 0; 2365 } // Getters 2366 2367 2368 var _proto = Modal.prototype; 2369 2370 // Public 2371 _proto.toggle = function toggle(relatedTarget) { 2372 return this._isShown ? this.hide() : this.show(relatedTarget); 2373 }; 2374 2375 _proto.show = function show(relatedTarget) { 2376 var _this = this; 2377 2378 if (this._isShown || this._isTransitioning) { 2379 return; 2380 } 2381 2382 var showEvent = $__default["default"].Event(EVENT_SHOW$2, { 2383 relatedTarget: relatedTarget 2384 }); 2385 $__default["default"](this._element).trigger(showEvent); 2386 2387 if (showEvent.isDefaultPrevented()) { 2388 return; 2389 } 2390 2391 this._isShown = true; 2392 2393 if ($__default["default"](this._element).hasClass(CLASS_NAME_FADE$4)) { 2394 this._isTransitioning = true; 2395 } 2396 2397 this._checkScrollbar(); 2398 2399 this._setScrollbar(); 2400 2401 this._adjustDialog(); 2402 2403 this._setEscapeEvent(); 2404 2405 this._setResizeEvent(); 2406 2407 $__default["default"](this._element).on(EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function (event) { 2408 return _this.hide(event); 2409 }); 2410 $__default["default"](this._dialog).on(EVENT_MOUSEDOWN_DISMISS, function () { 2411 $__default["default"](_this._element).one(EVENT_MOUSEUP_DISMISS, function (event) { 2412 if ($__default["default"](event.target).is(_this._element)) { 2413 _this._ignoreBackdropClick = true; 2414 } 2415 }); 2416 }); 2417 2418 this._showBackdrop(function () { 2419 return _this._showElement(relatedTarget); 2420 }); 2421 }; 2422 2423 _proto.hide = function hide(event) { 2424 var _this2 = this; 2425 2426 if (event) { 2427 event.preventDefault(); 2428 } 2429 2430 if (!this._isShown || this._isTransitioning) { 2431 return; 2432 } 2433 2434 var hideEvent = $__default["default"].Event(EVENT_HIDE$2); 2435 $__default["default"](this._element).trigger(hideEvent); 2436 2437 if (!this._isShown || hideEvent.isDefaultPrevented()) { 2438 return; 2439 } 2440 2441 this._isShown = false; 2442 var transition = $__default["default"](this._element).hasClass(CLASS_NAME_FADE$4); 2443 2444 if (transition) { 2445 this._isTransitioning = true; 2446 } 2447 2448 this._setEscapeEvent(); 2449 2450 this._setResizeEvent(); 2451 2452 $__default["default"](document).off(EVENT_FOCUSIN); 2453 $__default["default"](this._element).removeClass(CLASS_NAME_SHOW$4); 2454 $__default["default"](this._element).off(EVENT_CLICK_DISMISS$1); 2455 $__default["default"](this._dialog).off(EVENT_MOUSEDOWN_DISMISS); 2456 2457 if (transition) { 2458 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 2459 $__default["default"](this._element).one(Util.TRANSITION_END, function (event) { 2460 return _this2._hideModal(event); 2461 }).emulateTransitionEnd(transitionDuration); 2462 } else { 2463 this._hideModal(); 2464 } 2465 }; 2466 2467 _proto.dispose = function dispose() { 2468 [window, this._element, this._dialog].forEach(function (htmlElement) { 2469 return $__default["default"](htmlElement).off(EVENT_KEY$5); 2470 }); 2471 /** 2472 * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API` 2473 * Do not move `document` in `htmlElements` array 2474 * It will remove `EVENT_CLICK_DATA_API` event that should remain 2475 */ 2476 2477 $__default["default"](document).off(EVENT_FOCUSIN); 2478 $__default["default"].removeData(this._element, DATA_KEY$5); 2479 this._config = null; 2480 this._element = null; 2481 this._dialog = null; 2482 this._backdrop = null; 2483 this._isShown = null; 2484 this._isBodyOverflowing = null; 2485 this._ignoreBackdropClick = null; 2486 this._isTransitioning = null; 2487 this._scrollbarWidth = null; 2488 }; 2489 2490 _proto.handleUpdate = function handleUpdate() { 2491 this._adjustDialog(); 2492 } // Private 2493 ; 2494 2495 _proto._getConfig = function _getConfig(config) { 2496 config = _extends({}, Default$4, config); 2497 Util.typeCheckConfig(NAME$5, config, DefaultType$4); 2498 return config; 2499 }; 2500 2501 _proto._triggerBackdropTransition = function _triggerBackdropTransition() { 2502 var _this3 = this; 2503 2504 var hideEventPrevented = $__default["default"].Event(EVENT_HIDE_PREVENTED); 2505 $__default["default"](this._element).trigger(hideEventPrevented); 2506 2507 if (hideEventPrevented.isDefaultPrevented()) { 2508 return; 2509 } 2510 2511 var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 2512 2513 if (!isModalOverflowing) { 2514 this._element.style.overflowY = 'hidden'; 2515 } 2516 2517 this._element.classList.add(CLASS_NAME_STATIC); 2518 2519 var modalTransitionDuration = Util.getTransitionDurationFromElement(this._dialog); 2520 $__default["default"](this._element).off(Util.TRANSITION_END); 2521 $__default["default"](this._element).one(Util.TRANSITION_END, function () { 2522 _this3._element.classList.remove(CLASS_NAME_STATIC); 2523 2524 if (!isModalOverflowing) { 2525 $__default["default"](_this3._element).one(Util.TRANSITION_END, function () { 2526 _this3._element.style.overflowY = ''; 2527 }).emulateTransitionEnd(_this3._element, modalTransitionDuration); 2528 } 2529 }).emulateTransitionEnd(modalTransitionDuration); 2530 2531 this._element.focus(); 2532 }; 2533 2534 _proto._showElement = function _showElement(relatedTarget) { 2535 var _this4 = this; 2536 2537 var transition = $__default["default"](this._element).hasClass(CLASS_NAME_FADE$4); 2538 var modalBody = this._dialog ? this._dialog.querySelector(SELECTOR_MODAL_BODY) : null; 2539 2540 if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { 2541 // Don't move modal's DOM position 2542 document.body.appendChild(this._element); 2543 } 2544 2545 this._element.style.display = 'block'; 2546 2547 this._element.removeAttribute('aria-hidden'); 2548 2549 this._element.setAttribute('aria-modal', true); 2550 2551 this._element.setAttribute('role', 'dialog'); 2552 2553 if ($__default["default"](this._dialog).hasClass(CLASS_NAME_SCROLLABLE) && modalBody) { 2554 modalBody.scrollTop = 0; 2555 } else { 2556 this._element.scrollTop = 0; 2557 } 2558 2559 if (transition) { 2560 Util.reflow(this._element); 2561 } 2562 2563 $__default["default"](this._element).addClass(CLASS_NAME_SHOW$4); 2564 2565 if (this._config.focus) { 2566 this._enforceFocus(); 2567 } 2568 2569 var shownEvent = $__default["default"].Event(EVENT_SHOWN$2, { 2570 relatedTarget: relatedTarget 2571 }); 2572 2573 var transitionComplete = function transitionComplete() { 2574 if (_this4._config.focus) { 2575 _this4._element.focus(); 2576 } 2577 2578 _this4._isTransitioning = false; 2579 $__default["default"](_this4._element).trigger(shownEvent); 2580 }; 2581 2582 if (transition) { 2583 var transitionDuration = Util.getTransitionDurationFromElement(this._dialog); 2584 $__default["default"](this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration); 2585 } else { 2586 transitionComplete(); 2587 } 2588 }; 2589 2590 _proto._enforceFocus = function _enforceFocus() { 2591 var _this5 = this; 2592 2593 $__default["default"](document).off(EVENT_FOCUSIN) // Guard against infinite focus loop 2594 .on(EVENT_FOCUSIN, function (event) { 2595 if (document !== event.target && _this5._element !== event.target && $__default["default"](_this5._element).has(event.target).length === 0) { 2596 _this5._element.focus(); 2597 } 2598 }); 2599 }; 2600 2601 _proto._setEscapeEvent = function _setEscapeEvent() { 2602 var _this6 = this; 2603 2604 if (this._isShown) { 2605 $__default["default"](this._element).on(EVENT_KEYDOWN_DISMISS, function (event) { 2606 if (_this6._config.keyboard && event.which === ESCAPE_KEYCODE) { 2607 event.preventDefault(); 2608 2609 _this6.hide(); 2610 } else if (!_this6._config.keyboard && event.which === ESCAPE_KEYCODE) { 2611 _this6._triggerBackdropTransition(); 2612 } 2613 }); 2614 } else if (!this._isShown) { 2615 $__default["default"](this._element).off(EVENT_KEYDOWN_DISMISS); 2616 } 2617 }; 2618 2619 _proto._setResizeEvent = function _setResizeEvent() { 2620 var _this7 = this; 2621 2622 if (this._isShown) { 2623 $__default["default"](window).on(EVENT_RESIZE, function (event) { 2624 return _this7.handleUpdate(event); 2625 }); 2626 } else { 2627 $__default["default"](window).off(EVENT_RESIZE); 2628 } 2629 }; 2630 2631 _proto._hideModal = function _hideModal() { 2632 var _this8 = this; 2633 2634 this._element.style.display = 'none'; 2635 2636 this._element.setAttribute('aria-hidden', true); 2637 2638 this._element.removeAttribute('aria-modal'); 2639 2640 this._element.removeAttribute('role'); 2641 2642 this._isTransitioning = false; 2643 2644 this._showBackdrop(function () { 2645 $__default["default"](document.body).removeClass(CLASS_NAME_OPEN); 2646 2647 _this8._resetAdjustments(); 2648 2649 _this8._resetScrollbar(); 2650 2651 $__default["default"](_this8._element).trigger(EVENT_HIDDEN$2); 2652 }); 2653 }; 2654 2655 _proto._removeBackdrop = function _removeBackdrop() { 2656 if (this._backdrop) { 2657 $__default["default"](this._backdrop).remove(); 2658 this._backdrop = null; 2659 } 2660 }; 2661 2662 _proto._showBackdrop = function _showBackdrop(callback) { 2663 var _this9 = this; 2664 2665 var animate = $__default["default"](this._element).hasClass(CLASS_NAME_FADE$4) ? CLASS_NAME_FADE$4 : ''; 2666 2667 if (this._isShown && this._config.backdrop) { 2668 this._backdrop = document.createElement('div'); 2669 this._backdrop.className = CLASS_NAME_BACKDROP; 2670 2671 if (animate) { 2672 this._backdrop.classList.add(animate); 2673 } 2674 2675 $__default["default"](this._backdrop).appendTo(document.body); 2676 $__default["default"](this._element).on(EVENT_CLICK_DISMISS$1, function (event) { 2677 if (_this9._ignoreBackdropClick) { 2678 _this9._ignoreBackdropClick = false; 2679 return; 2680 } 2681 2682 if (event.target !== event.currentTarget) { 2683 return; 2684 } 2685 2686 if (_this9._config.backdrop === 'static') { 2687 _this9._triggerBackdropTransition(); 2688 } else { 2689 _this9.hide(); 2690 } 2691 }); 2692 2693 if (animate) { 2694 Util.reflow(this._backdrop); 2695 } 2696 2697 $__default["default"](this._backdrop).addClass(CLASS_NAME_SHOW$4); 2698 2699 if (!callback) { 2700 return; 2701 } 2702 2703 if (!animate) { 2704 callback(); 2705 return; 2706 } 2707 2708 var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 2709 $__default["default"](this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration); 2710 } else if (!this._isShown && this._backdrop) { 2711 $__default["default"](this._backdrop).removeClass(CLASS_NAME_SHOW$4); 2712 2713 var callbackRemove = function callbackRemove() { 2714 _this9._removeBackdrop(); 2715 2716 if (callback) { 2717 callback(); 2718 } 2719 }; 2720 2721 if ($__default["default"](this._element).hasClass(CLASS_NAME_FADE$4)) { 2722 var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 2723 2724 $__default["default"](this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration); 2725 } else { 2726 callbackRemove(); 2727 } 2728 } else if (callback) { 2729 callback(); 2730 } 2731 } // ---------------------------------------------------------------------- 2732 // the following methods are used to handle overflowing modals 2733 // todo (fat): these should probably be refactored out of modal.js 2734 // ---------------------------------------------------------------------- 2735 ; 2736 2737 _proto._adjustDialog = function _adjustDialog() { 2738 var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 2739 2740 if (!this._isBodyOverflowing && isModalOverflowing) { 2741 this._element.style.paddingLeft = this._scrollbarWidth + "px"; 2742 } 2743 2744 if (this._isBodyOverflowing && !isModalOverflowing) { 2745 this._element.style.paddingRight = this._scrollbarWidth + "px"; 2746 } 2747 }; 2748 2749 _proto._resetAdjustments = function _resetAdjustments() { 2750 this._element.style.paddingLeft = ''; 2751 this._element.style.paddingRight = ''; 2752 }; 2753 2754 _proto._checkScrollbar = function _checkScrollbar() { 2755 var rect = document.body.getBoundingClientRect(); 2756 this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth; 2757 this._scrollbarWidth = this._getScrollbarWidth(); 2758 }; 2759 2760 _proto._setScrollbar = function _setScrollbar() { 2761 var _this10 = this; 2762 2763 if (this._isBodyOverflowing) { 2764 // Note: DOMNode.style.paddingRight returns the actual value or '' if not set 2765 // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set 2766 var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT)); 2767 var stickyContent = [].slice.call(document.querySelectorAll(SELECTOR_STICKY_CONTENT)); // Adjust fixed content padding 2768 2769 $__default["default"](fixedContent).each(function (index, element) { 2770 var actualPadding = element.style.paddingRight; 2771 var calculatedPadding = $__default["default"](element).css('padding-right'); 2772 $__default["default"](element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px"); 2773 }); // Adjust sticky content margin 2774 2775 $__default["default"](stickyContent).each(function (index, element) { 2776 var actualMargin = element.style.marginRight; 2777 var calculatedMargin = $__default["default"](element).css('margin-right'); 2778 $__default["default"](element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px"); 2779 }); // Adjust body padding 2780 2781 var actualPadding = document.body.style.paddingRight; 2782 var calculatedPadding = $__default["default"](document.body).css('padding-right'); 2783 $__default["default"](document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px"); 2784 } 2785 2786 $__default["default"](document.body).addClass(CLASS_NAME_OPEN); 2787 }; 2788 2789 _proto._resetScrollbar = function _resetScrollbar() { 2790 // Restore fixed content padding 2791 var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT)); 2792 $__default["default"](fixedContent).each(function (index, element) { 2793 var padding = $__default["default"](element).data('padding-right'); 2794 $__default["default"](element).removeData('padding-right'); 2795 element.style.paddingRight = padding ? padding : ''; 2796 }); // Restore sticky content 2797 2798 var elements = [].slice.call(document.querySelectorAll("" + SELECTOR_STICKY_CONTENT)); 2799 $__default["default"](elements).each(function (index, element) { 2800 var margin = $__default["default"](element).data('margin-right'); 2801 2802 if (typeof margin !== 'undefined') { 2803 $__default["default"](element).css('margin-right', margin).removeData('margin-right'); 2804 } 2805 }); // Restore body padding 2806 2807 var padding = $__default["default"](document.body).data('padding-right'); 2808 $__default["default"](document.body).removeData('padding-right'); 2809 document.body.style.paddingRight = padding ? padding : ''; 2810 }; 2811 2812 _proto._getScrollbarWidth = function _getScrollbarWidth() { 2813 // thx d.walsh 2814 var scrollDiv = document.createElement('div'); 2815 scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER; 2816 document.body.appendChild(scrollDiv); 2817 var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; 2818 document.body.removeChild(scrollDiv); 2819 return scrollbarWidth; 2820 } // Static 2821 ; 2822 2823 Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) { 2824 return this.each(function () { 2825 var data = $__default["default"](this).data(DATA_KEY$5); 2826 2827 var _config = _extends({}, Default$4, $__default["default"](this).data(), typeof config === 'object' && config ? config : {}); 2828 2829 if (!data) { 2830 data = new Modal(this, _config); 2831 $__default["default"](this).data(DATA_KEY$5, data); 2832 } 2833 2834 if (typeof config === 'string') { 2835 if (typeof data[config] === 'undefined') { 2836 throw new TypeError("No method named \"" + config + "\""); 2837 } 2838 2839 data[config](relatedTarget); 2840 } else if (_config.show) { 2841 data.show(relatedTarget); 2842 } 2843 }); 2844 }; 2845 2846 _createClass(Modal, null, [{ 2847 key: "VERSION", 2848 get: function get() { 2849 return VERSION$5; 2850 } 2851 }, { 2852 key: "Default", 2853 get: function get() { 2854 return Default$4; 2855 } 2856 }]); 2857 2858 return Modal; 2859 }(); 2860 /** 2861 * Data API implementation 2862 */ 2863 2864 2865 $__default["default"](document).on(EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function (event) { 2866 var _this11 = this; 2867 2868 var target; 2869 var selector = Util.getSelectorFromElement(this); 2870 2871 if (selector) { 2872 target = document.querySelector(selector); 2873 } 2874 2875 var config = $__default["default"](target).data(DATA_KEY$5) ? 'toggle' : _extends({}, $__default["default"](target).data(), $__default["default"](this).data()); 2876 2877 if (this.tagName === 'A' || this.tagName === 'AREA') { 2878 event.preventDefault(); 2879 } 2880 2881 var $target = $__default["default"](target).one(EVENT_SHOW$2, function (showEvent) { 2882 if (showEvent.isDefaultPrevented()) { 2883 // Only register focus restorer if modal will actually get shown 2884 return; 2885 } 2886 2887 $target.one(EVENT_HIDDEN$2, function () { 2888 if ($__default["default"](_this11).is(':visible')) { 2889 _this11.focus(); 2890 } 2891 }); 2892 }); 2893 2894 Modal._jQueryInterface.call($__default["default"](target), config, this); 2895 }); 2896 /** 2897 * jQuery 2898 */ 2899 2900 $__default["default"].fn[NAME$5] = Modal._jQueryInterface; 2901 $__default["default"].fn[NAME$5].Constructor = Modal; 2902 2903 $__default["default"].fn[NAME$5].noConflict = function () { 2904 $__default["default"].fn[NAME$5] = JQUERY_NO_CONFLICT$5; 2905 return Modal._jQueryInterface; 2906 }; 2907 2908 /** 2909 * -------------------------------------------------------------------------- 2910 * Bootstrap (v4.6.2): tools/sanitizer.js 2911 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 2912 * -------------------------------------------------------------------------- 2913 */ 2914 var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']; 2915 var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; 2916 var DefaultWhitelist = { 2917 // Global attributes allowed on any supplied element below. 2918 '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], 2919 a: ['target', 'href', 'title', 'rel'], 2920 area: [], 2921 b: [], 2922 br: [], 2923 col: [], 2924 code: [], 2925 div: [], 2926 em: [], 2927 hr: [], 2928 h1: [], 2929 h2: [], 2930 h3: [], 2931 h4: [], 2932 h5: [], 2933 h6: [], 2934 i: [], 2935 img: ['src', 'srcset', 'alt', 'title', 'width', 'height'], 2936 li: [], 2937 ol: [], 2938 p: [], 2939 pre: [], 2940 s: [], 2941 small: [], 2942 span: [], 2943 sub: [], 2944 sup: [], 2945 strong: [], 2946 u: [], 2947 ul: [] 2948 }; 2949 /** 2950 * A pattern that recognizes a commonly useful subset of URLs that are safe. 2951 * 2952 * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts 2953 */ 2954 2955 var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i; 2956 /** 2957 * A pattern that matches safe data URLs. Only matches image, video and audio types. 2958 * 2959 * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts 2960 */ 2961 2962 var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i; 2963 2964 function allowedAttribute(attr, allowedAttributeList) { 2965 var attrName = attr.nodeName.toLowerCase(); 2966 2967 if (allowedAttributeList.indexOf(attrName) !== -1) { 2968 if (uriAttrs.indexOf(attrName) !== -1) { 2969 return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue)); 2970 } 2971 2972 return true; 2973 } 2974 2975 var regExp = allowedAttributeList.filter(function (attrRegex) { 2976 return attrRegex instanceof RegExp; 2977 }); // Check if a regular expression validates the attribute. 2978 2979 for (var i = 0, len = regExp.length; i < len; i++) { 2980 if (regExp[i].test(attrName)) { 2981 return true; 2982 } 2983 } 2984 2985 return false; 2986 } 2987 2988 function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) { 2989 if (unsafeHtml.length === 0) { 2990 return unsafeHtml; 2991 } 2992 2993 if (sanitizeFn && typeof sanitizeFn === 'function') { 2994 return sanitizeFn(unsafeHtml); 2995 } 2996 2997 var domParser = new window.DOMParser(); 2998 var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); 2999 var whitelistKeys = Object.keys(whiteList); 3000 var elements = [].slice.call(createdDocument.body.querySelectorAll('*')); 3001 3002 var _loop = function _loop(i, len) { 3003 var el = elements[i]; 3004 var elName = el.nodeName.toLowerCase(); 3005 3006 if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) { 3007 el.parentNode.removeChild(el); 3008 return "continue"; 3009 } 3010 3011 var attributeList = [].slice.call(el.attributes); // eslint-disable-next-line unicorn/prefer-spread 3012 3013 var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []); 3014 attributeList.forEach(function (attr) { 3015 if (!allowedAttribute(attr, whitelistedAttributes)) { 3016 el.removeAttribute(attr.nodeName); 3017 } 3018 }); 3019 }; 3020 3021 for (var i = 0, len = elements.length; i < len; i++) { 3022 var _ret = _loop(i); 3023 3024 if (_ret === "continue") continue; 3025 } 3026 3027 return createdDocument.body.innerHTML; 3028 } 3029 3030 /** 3031 * Constants 3032 */ 3033 3034 var NAME$4 = 'tooltip'; 3035 var VERSION$4 = '4.6.2'; 3036 var DATA_KEY$4 = 'bs.tooltip'; 3037 var EVENT_KEY$4 = "." + DATA_KEY$4; 3038 var JQUERY_NO_CONFLICT$4 = $__default["default"].fn[NAME$4]; 3039 var CLASS_PREFIX$1 = 'bs-tooltip'; 3040 var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g'); 3041 var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']; 3042 var CLASS_NAME_FADE$3 = 'fade'; 3043 var CLASS_NAME_SHOW$3 = 'show'; 3044 var HOVER_STATE_SHOW = 'show'; 3045 var HOVER_STATE_OUT = 'out'; 3046 var SELECTOR_TOOLTIP_INNER = '.tooltip-inner'; 3047 var SELECTOR_ARROW = '.arrow'; 3048 var TRIGGER_HOVER = 'hover'; 3049 var TRIGGER_FOCUS = 'focus'; 3050 var TRIGGER_CLICK = 'click'; 3051 var TRIGGER_MANUAL = 'manual'; 3052 var AttachmentMap = { 3053 AUTO: 'auto', 3054 TOP: 'top', 3055 RIGHT: 'right', 3056 BOTTOM: 'bottom', 3057 LEFT: 'left' 3058 }; 3059 var Default$3 = { 3060 animation: true, 3061 template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>', 3062 trigger: 'hover focus', 3063 title: '', 3064 delay: 0, 3065 html: false, 3066 selector: false, 3067 placement: 'top', 3068 offset: 0, 3069 container: false, 3070 fallbackPlacement: 'flip', 3071 boundary: 'scrollParent', 3072 customClass: '', 3073 sanitize: true, 3074 sanitizeFn: null, 3075 whiteList: DefaultWhitelist, 3076 popperConfig: null 3077 }; 3078 var DefaultType$3 = { 3079 animation: 'boolean', 3080 template: 'string', 3081 title: '(string|element|function)', 3082 trigger: 'string', 3083 delay: '(number|object)', 3084 html: 'boolean', 3085 selector: '(string|boolean)', 3086 placement: '(string|function)', 3087 offset: '(number|string|function)', 3088 container: '(string|element|boolean)', 3089 fallbackPlacement: '(string|array)', 3090 boundary: '(string|element)', 3091 customClass: '(string|function)', 3092 sanitize: 'boolean', 3093 sanitizeFn: '(null|function)', 3094 whiteList: 'object', 3095 popperConfig: '(null|object)' 3096 }; 3097 var Event$1 = { 3098 HIDE: "hide" + EVENT_KEY$4, 3099 HIDDEN: "hidden" + EVENT_KEY$4, 3100 SHOW: "show" + EVENT_KEY$4, 3101 SHOWN: "shown" + EVENT_KEY$4, 3102 INSERTED: "inserted" + EVENT_KEY$4, 3103 CLICK: "click" + EVENT_KEY$4, 3104 FOCUSIN: "focusin" + EVENT_KEY$4, 3105 FOCUSOUT: "focusout" + EVENT_KEY$4, 3106 MOUSEENTER: "mouseenter" + EVENT_KEY$4, 3107 MOUSELEAVE: "mouseleave" + EVENT_KEY$4 3108 }; 3109 /** 3110 * Class definition 3111 */ 3112 3113 var Tooltip = /*#__PURE__*/function () { 3114 function Tooltip(element, config) { 3115 if (typeof Popper__default["default"] === 'undefined') { 3116 throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)'); 3117 } // Private 3118 3119 3120 this._isEnabled = true; 3121 this._timeout = 0; 3122 this._hoverState = ''; 3123 this._activeTrigger = {}; 3124 this._popper = null; // Protected 3125 3126 this.element = element; 3127 this.config = this._getConfig(config); 3128 this.tip = null; 3129 3130 this._setListeners(); 3131 } // Getters 3132 3133 3134 var _proto = Tooltip.prototype; 3135 3136 // Public 3137 _proto.enable = function enable() { 3138 this._isEnabled = true; 3139 }; 3140 3141 _proto.disable = function disable() { 3142 this._isEnabled = false; 3143 }; 3144 3145 _proto.toggleEnabled = function toggleEnabled() { 3146 this._isEnabled = !this._isEnabled; 3147 }; 3148 3149 _proto.toggle = function toggle(event) { 3150 if (!this._isEnabled) { 3151 return; 3152 } 3153 3154 if (event) { 3155 var dataKey = this.constructor.DATA_KEY; 3156 var context = $__default["default"](event.currentTarget).data(dataKey); 3157 3158 if (!context) { 3159 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 3160 $__default["default"](event.currentTarget).data(dataKey, context); 3161 } 3162 3163 context._activeTrigger.click = !context._activeTrigger.click; 3164 3165 if (context._isWithActiveTrigger()) { 3166 context._enter(null, context); 3167 } else { 3168 context._leave(null, context); 3169 } 3170 } else { 3171 if ($__default["default"](this.getTipElement()).hasClass(CLASS_NAME_SHOW$3)) { 3172 this._leave(null, this); 3173 3174 return; 3175 } 3176 3177 this._enter(null, this); 3178 } 3179 }; 3180 3181 _proto.dispose = function dispose() { 3182 clearTimeout(this._timeout); 3183 $__default["default"].removeData(this.element, this.constructor.DATA_KEY); 3184 $__default["default"](this.element).off(this.constructor.EVENT_KEY); 3185 $__default["default"](this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler); 3186 3187 if (this.tip) { 3188 $__default["default"](this.tip).remove(); 3189 } 3190 3191 this._isEnabled = null; 3192 this._timeout = null; 3193 this._hoverState = null; 3194 this._activeTrigger = null; 3195 3196 if (this._popper) { 3197 this._popper.destroy(); 3198 } 3199 3200 this._popper = null; 3201 this.element = null; 3202 this.config = null; 3203 this.tip = null; 3204 }; 3205 3206 _proto.show = function show() { 3207 var _this = this; 3208 3209 if ($__default["default"](this.element).css('display') === 'none') { 3210 throw new Error('Please use show on visible elements'); 3211 } 3212 3213 var showEvent = $__default["default"].Event(this.constructor.Event.SHOW); 3214 3215 if (this.isWithContent() && this._isEnabled) { 3216 $__default["default"](this.element).trigger(showEvent); 3217 var shadowRoot = Util.findShadowRoot(this.element); 3218 var isInTheDom = $__default["default"].contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element); 3219 3220 if (showEvent.isDefaultPrevented() || !isInTheDom) { 3221 return; 3222 } 3223 3224 var tip = this.getTipElement(); 3225 var tipId = Util.getUID(this.constructor.NAME); 3226 tip.setAttribute('id', tipId); 3227 this.element.setAttribute('aria-describedby', tipId); 3228 this.setContent(); 3229 3230 if (this.config.animation) { 3231 $__default["default"](tip).addClass(CLASS_NAME_FADE$3); 3232 } 3233 3234 var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; 3235 3236 var attachment = this._getAttachment(placement); 3237 3238 this.addAttachmentClass(attachment); 3239 3240 var container = this._getContainer(); 3241 3242 $__default["default"](tip).data(this.constructor.DATA_KEY, this); 3243 3244 if (!$__default["default"].contains(this.element.ownerDocument.documentElement, this.tip)) { 3245 $__default["default"](tip).appendTo(container); 3246 } 3247 3248 $__default["default"](this.element).trigger(this.constructor.Event.INSERTED); 3249 this._popper = new Popper__default["default"](this.element, tip, this._getPopperConfig(attachment)); 3250 $__default["default"](tip).addClass(CLASS_NAME_SHOW$3); 3251 $__default["default"](tip).addClass(this.config.customClass); // If this is a touch-enabled device we add extra 3252 // empty mouseover listeners to the body's immediate children; 3253 // only needed because of broken event delegation on iOS 3254 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 3255 3256 if ('ontouchstart' in document.documentElement) { 3257 $__default["default"](document.body).children().on('mouseover', null, $__default["default"].noop); 3258 } 3259 3260 var complete = function complete() { 3261 if (_this.config.animation) { 3262 _this._fixTransition(); 3263 } 3264 3265 var prevHoverState = _this._hoverState; 3266 _this._hoverState = null; 3267 $__default["default"](_this.element).trigger(_this.constructor.Event.SHOWN); 3268 3269 if (prevHoverState === HOVER_STATE_OUT) { 3270 _this._leave(null, _this); 3271 } 3272 }; 3273 3274 if ($__default["default"](this.tip).hasClass(CLASS_NAME_FADE$3)) { 3275 var transitionDuration = Util.getTransitionDurationFromElement(this.tip); 3276 $__default["default"](this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 3277 } else { 3278 complete(); 3279 } 3280 } 3281 }; 3282 3283 _proto.hide = function hide(callback) { 3284 var _this2 = this; 3285 3286 var tip = this.getTipElement(); 3287 var hideEvent = $__default["default"].Event(this.constructor.Event.HIDE); 3288 3289 var complete = function complete() { 3290 if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) { 3291 tip.parentNode.removeChild(tip); 3292 } 3293 3294 _this2._cleanTipClass(); 3295 3296 _this2.element.removeAttribute('aria-describedby'); 3297 3298 $__default["default"](_this2.element).trigger(_this2.constructor.Event.HIDDEN); 3299 3300 if (_this2._popper !== null) { 3301 _this2._popper.destroy(); 3302 } 3303 3304 if (callback) { 3305 callback(); 3306 } 3307 }; 3308 3309 $__default["default"](this.element).trigger(hideEvent); 3310 3311 if (hideEvent.isDefaultPrevented()) { 3312 return; 3313 } 3314 3315 $__default["default"](tip).removeClass(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we remove the extra 3316 // empty mouseover listeners we added for iOS support 3317 3318 if ('ontouchstart' in document.documentElement) { 3319 $__default["default"](document.body).children().off('mouseover', null, $__default["default"].noop); 3320 } 3321 3322 this._activeTrigger[TRIGGER_CLICK] = false; 3323 this._activeTrigger[TRIGGER_FOCUS] = false; 3324 this._activeTrigger[TRIGGER_HOVER] = false; 3325 3326 if ($__default["default"](this.tip).hasClass(CLASS_NAME_FADE$3)) { 3327 var transitionDuration = Util.getTransitionDurationFromElement(tip); 3328 $__default["default"](tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 3329 } else { 3330 complete(); 3331 } 3332 3333 this._hoverState = ''; 3334 }; 3335 3336 _proto.update = function update() { 3337 if (this._popper !== null) { 3338 this._popper.scheduleUpdate(); 3339 } 3340 } // Protected 3341 ; 3342 3343 _proto.isWithContent = function isWithContent() { 3344 return Boolean(this.getTitle()); 3345 }; 3346 3347 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 3348 $__default["default"](this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment); 3349 }; 3350 3351 _proto.getTipElement = function getTipElement() { 3352 this.tip = this.tip || $__default["default"](this.config.template)[0]; 3353 return this.tip; 3354 }; 3355 3356 _proto.setContent = function setContent() { 3357 var tip = this.getTipElement(); 3358 this.setElementContent($__default["default"](tip.querySelectorAll(SELECTOR_TOOLTIP_INNER)), this.getTitle()); 3359 $__default["default"](tip).removeClass(CLASS_NAME_FADE$3 + " " + CLASS_NAME_SHOW$3); 3360 }; 3361 3362 _proto.setElementContent = function setElementContent($element, content) { 3363 if (typeof content === 'object' && (content.nodeType || content.jquery)) { 3364 // Content is a DOM node or a jQuery 3365 if (this.config.html) { 3366 if (!$__default["default"](content).parent().is($element)) { 3367 $element.empty().append(content); 3368 } 3369 } else { 3370 $element.text($__default["default"](content).text()); 3371 } 3372 3373 return; 3374 } 3375 3376 if (this.config.html) { 3377 if (this.config.sanitize) { 3378 content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn); 3379 } 3380 3381 $element.html(content); 3382 } else { 3383 $element.text(content); 3384 } 3385 }; 3386 3387 _proto.getTitle = function getTitle() { 3388 var title = this.element.getAttribute('data-original-title'); 3389 3390 if (!title) { 3391 title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title; 3392 } 3393 3394 return title; 3395 } // Private 3396 ; 3397 3398 _proto._getPopperConfig = function _getPopperConfig(attachment) { 3399 var _this3 = this; 3400 3401 var defaultBsConfig = { 3402 placement: attachment, 3403 modifiers: { 3404 offset: this._getOffset(), 3405 flip: { 3406 behavior: this.config.fallbackPlacement 3407 }, 3408 arrow: { 3409 element: SELECTOR_ARROW 3410 }, 3411 preventOverflow: { 3412 boundariesElement: this.config.boundary 3413 } 3414 }, 3415 onCreate: function onCreate(data) { 3416 if (data.originalPlacement !== data.placement) { 3417 _this3._handlePopperPlacementChange(data); 3418 } 3419 }, 3420 onUpdate: function onUpdate(data) { 3421 return _this3._handlePopperPlacementChange(data); 3422 } 3423 }; 3424 return _extends({}, defaultBsConfig, this.config.popperConfig); 3425 }; 3426 3427 _proto._getOffset = function _getOffset() { 3428 var _this4 = this; 3429 3430 var offset = {}; 3431 3432 if (typeof this.config.offset === 'function') { 3433 offset.fn = function (data) { 3434 data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element)); 3435 return data; 3436 }; 3437 } else { 3438 offset.offset = this.config.offset; 3439 } 3440 3441 return offset; 3442 }; 3443 3444 _proto._getContainer = function _getContainer() { 3445 if (this.config.container === false) { 3446 return document.body; 3447 } 3448 3449 if (Util.isElement(this.config.container)) { 3450 return $__default["default"](this.config.container); 3451 } 3452 3453 return $__default["default"](document).find(this.config.container); 3454 }; 3455 3456 _proto._getAttachment = function _getAttachment(placement) { 3457 return AttachmentMap[placement.toUpperCase()]; 3458 }; 3459 3460 _proto._setListeners = function _setListeners() { 3461 var _this5 = this; 3462 3463 var triggers = this.config.trigger.split(' '); 3464 triggers.forEach(function (trigger) { 3465 if (trigger === 'click') { 3466 $__default["default"](_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) { 3467 return _this5.toggle(event); 3468 }); 3469 } else if (trigger !== TRIGGER_MANUAL) { 3470 var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN; 3471 var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT; 3472 $__default["default"](_this5.element).on(eventIn, _this5.config.selector, function (event) { 3473 return _this5._enter(event); 3474 }).on(eventOut, _this5.config.selector, function (event) { 3475 return _this5._leave(event); 3476 }); 3477 } 3478 }); 3479 3480 this._hideModalHandler = function () { 3481 if (_this5.element) { 3482 _this5.hide(); 3483 } 3484 }; 3485 3486 $__default["default"](this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler); 3487 3488 if (this.config.selector) { 3489 this.config = _extends({}, this.config, { 3490 trigger: 'manual', 3491 selector: '' 3492 }); 3493 } else { 3494 this._fixTitle(); 3495 } 3496 }; 3497 3498 _proto._fixTitle = function _fixTitle() { 3499 var titleType = typeof this.element.getAttribute('data-original-title'); 3500 3501 if (this.element.getAttribute('title') || titleType !== 'string') { 3502 this.element.setAttribute('data-original-title', this.element.getAttribute('title') || ''); 3503 this.element.setAttribute('title', ''); 3504 } 3505 }; 3506 3507 _proto._enter = function _enter(event, context) { 3508 var dataKey = this.constructor.DATA_KEY; 3509 context = context || $__default["default"](event.currentTarget).data(dataKey); 3510 3511 if (!context) { 3512 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 3513 $__default["default"](event.currentTarget).data(dataKey, context); 3514 } 3515 3516 if (event) { 3517 context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true; 3518 } 3519 3520 if ($__default["default"](context.getTipElement()).hasClass(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) { 3521 context._hoverState = HOVER_STATE_SHOW; 3522 return; 3523 } 3524 3525 clearTimeout(context._timeout); 3526 context._hoverState = HOVER_STATE_SHOW; 3527 3528 if (!context.config.delay || !context.config.delay.show) { 3529 context.show(); 3530 return; 3531 } 3532 3533 context._timeout = setTimeout(function () { 3534 if (context._hoverState === HOVER_STATE_SHOW) { 3535 context.show(); 3536 } 3537 }, context.config.delay.show); 3538 }; 3539 3540 _proto._leave = function _leave(event, context) { 3541 var dataKey = this.constructor.DATA_KEY; 3542 context = context || $__default["default"](event.currentTarget).data(dataKey); 3543 3544 if (!context) { 3545 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 3546 $__default["default"](event.currentTarget).data(dataKey, context); 3547 } 3548 3549 if (event) { 3550 context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false; 3551 } 3552 3553 if (context._isWithActiveTrigger()) { 3554 return; 3555 } 3556 3557 clearTimeout(context._timeout); 3558 context._hoverState = HOVER_STATE_OUT; 3559 3560 if (!context.config.delay || !context.config.delay.hide) { 3561 context.hide(); 3562 return; 3563 } 3564 3565 context._timeout = setTimeout(function () { 3566 if (context._hoverState === HOVER_STATE_OUT) { 3567 context.hide(); 3568 } 3569 }, context.config.delay.hide); 3570 }; 3571 3572 _proto._isWithActiveTrigger = function _isWithActiveTrigger() { 3573 for (var trigger in this._activeTrigger) { 3574 if (this._activeTrigger[trigger]) { 3575 return true; 3576 } 3577 } 3578 3579 return false; 3580 }; 3581 3582 _proto._getConfig = function _getConfig(config) { 3583 var dataAttributes = $__default["default"](this.element).data(); 3584 Object.keys(dataAttributes).forEach(function (dataAttr) { 3585 if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) { 3586 delete dataAttributes[dataAttr]; 3587 } 3588 }); 3589 config = _extends({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {}); 3590 3591 if (typeof config.delay === 'number') { 3592 config.delay = { 3593 show: config.delay, 3594 hide: config.delay 3595 }; 3596 } 3597 3598 if (typeof config.title === 'number') { 3599 config.title = config.title.toString(); 3600 } 3601 3602 if (typeof config.content === 'number') { 3603 config.content = config.content.toString(); 3604 } 3605 3606 Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType); 3607 3608 if (config.sanitize) { 3609 config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn); 3610 } 3611 3612 return config; 3613 }; 3614 3615 _proto._getDelegateConfig = function _getDelegateConfig() { 3616 var config = {}; 3617 3618 if (this.config) { 3619 for (var key in this.config) { 3620 if (this.constructor.Default[key] !== this.config[key]) { 3621 config[key] = this.config[key]; 3622 } 3623 } 3624 } 3625 3626 return config; 3627 }; 3628 3629 _proto._cleanTipClass = function _cleanTipClass() { 3630 var $tip = $__default["default"](this.getTipElement()); 3631 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1); 3632 3633 if (tabClass !== null && tabClass.length) { 3634 $tip.removeClass(tabClass.join('')); 3635 } 3636 }; 3637 3638 _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) { 3639 this.tip = popperData.instance.popper; 3640 3641 this._cleanTipClass(); 3642 3643 this.addAttachmentClass(this._getAttachment(popperData.placement)); 3644 }; 3645 3646 _proto._fixTransition = function _fixTransition() { 3647 var tip = this.getTipElement(); 3648 var initConfigAnimation = this.config.animation; 3649 3650 if (tip.getAttribute('x-placement') !== null) { 3651 return; 3652 } 3653 3654 $__default["default"](tip).removeClass(CLASS_NAME_FADE$3); 3655 this.config.animation = false; 3656 this.hide(); 3657 this.show(); 3658 this.config.animation = initConfigAnimation; 3659 } // Static 3660 ; 3661 3662 Tooltip._jQueryInterface = function _jQueryInterface(config) { 3663 return this.each(function () { 3664 var $element = $__default["default"](this); 3665 var data = $element.data(DATA_KEY$4); 3666 3667 var _config = typeof config === 'object' && config; 3668 3669 if (!data && /dispose|hide/.test(config)) { 3670 return; 3671 } 3672 3673 if (!data) { 3674 data = new Tooltip(this, _config); 3675 $element.data(DATA_KEY$4, data); 3676 } 3677 3678 if (typeof config === 'string') { 3679 if (typeof data[config] === 'undefined') { 3680 throw new TypeError("No method named \"" + config + "\""); 3681 } 3682 3683 data[config](); 3684 } 3685 }); 3686 }; 3687 3688 _createClass(Tooltip, null, [{ 3689 key: "VERSION", 3690 get: function get() { 3691 return VERSION$4; 3692 } 3693 }, { 3694 key: "Default", 3695 get: function get() { 3696 return Default$3; 3697 } 3698 }, { 3699 key: "NAME", 3700 get: function get() { 3701 return NAME$4; 3702 } 3703 }, { 3704 key: "DATA_KEY", 3705 get: function get() { 3706 return DATA_KEY$4; 3707 } 3708 }, { 3709 key: "Event", 3710 get: function get() { 3711 return Event$1; 3712 } 3713 }, { 3714 key: "EVENT_KEY", 3715 get: function get() { 3716 return EVENT_KEY$4; 3717 } 3718 }, { 3719 key: "DefaultType", 3720 get: function get() { 3721 return DefaultType$3; 3722 } 3723 }]); 3724 3725 return Tooltip; 3726 }(); 3727 /** 3728 * jQuery 3729 */ 3730 3731 3732 $__default["default"].fn[NAME$4] = Tooltip._jQueryInterface; 3733 $__default["default"].fn[NAME$4].Constructor = Tooltip; 3734 3735 $__default["default"].fn[NAME$4].noConflict = function () { 3736 $__default["default"].fn[NAME$4] = JQUERY_NO_CONFLICT$4; 3737 return Tooltip._jQueryInterface; 3738 }; 3739 3740 /** 3741 * Constants 3742 */ 3743 3744 var NAME$3 = 'popover'; 3745 var VERSION$3 = '4.6.2'; 3746 var DATA_KEY$3 = 'bs.popover'; 3747 var EVENT_KEY$3 = "." + DATA_KEY$3; 3748 var JQUERY_NO_CONFLICT$3 = $__default["default"].fn[NAME$3]; 3749 var CLASS_PREFIX = 'bs-popover'; 3750 var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); 3751 var CLASS_NAME_FADE$2 = 'fade'; 3752 var CLASS_NAME_SHOW$2 = 'show'; 3753 var SELECTOR_TITLE = '.popover-header'; 3754 var SELECTOR_CONTENT = '.popover-body'; 3755 3756 var Default$2 = _extends({}, Tooltip.Default, { 3757 placement: 'right', 3758 trigger: 'click', 3759 content: '', 3760 template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>' 3761 }); 3762 3763 var DefaultType$2 = _extends({}, Tooltip.DefaultType, { 3764 content: '(string|element|function)' 3765 }); 3766 3767 var Event = { 3768 HIDE: "hide" + EVENT_KEY$3, 3769 HIDDEN: "hidden" + EVENT_KEY$3, 3770 SHOW: "show" + EVENT_KEY$3, 3771 SHOWN: "shown" + EVENT_KEY$3, 3772 INSERTED: "inserted" + EVENT_KEY$3, 3773 CLICK: "click" + EVENT_KEY$3, 3774 FOCUSIN: "focusin" + EVENT_KEY$3, 3775 FOCUSOUT: "focusout" + EVENT_KEY$3, 3776 MOUSEENTER: "mouseenter" + EVENT_KEY$3, 3777 MOUSELEAVE: "mouseleave" + EVENT_KEY$3 3778 }; 3779 /** 3780 * Class definition 3781 */ 3782 3783 var Popover = /*#__PURE__*/function (_Tooltip) { 3784 _inheritsLoose(Popover, _Tooltip); 3785 3786 function Popover() { 3787 return _Tooltip.apply(this, arguments) || this; 3788 } 3789 3790 var _proto = Popover.prototype; 3791 3792 // Overrides 3793 _proto.isWithContent = function isWithContent() { 3794 return this.getTitle() || this._getContent(); 3795 }; 3796 3797 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 3798 $__default["default"](this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); 3799 }; 3800 3801 _proto.getTipElement = function getTipElement() { 3802 this.tip = this.tip || $__default["default"](this.config.template)[0]; 3803 return this.tip; 3804 }; 3805 3806 _proto.setContent = function setContent() { 3807 var $tip = $__default["default"](this.getTipElement()); // We use append for html objects to maintain js events 3808 3809 this.setElementContent($tip.find(SELECTOR_TITLE), this.getTitle()); 3810 3811 var content = this._getContent(); 3812 3813 if (typeof content === 'function') { 3814 content = content.call(this.element); 3815 } 3816 3817 this.setElementContent($tip.find(SELECTOR_CONTENT), content); 3818 $tip.removeClass(CLASS_NAME_FADE$2 + " " + CLASS_NAME_SHOW$2); 3819 } // Private 3820 ; 3821 3822 _proto._getContent = function _getContent() { 3823 return this.element.getAttribute('data-content') || this.config.content; 3824 }; 3825 3826 _proto._cleanTipClass = function _cleanTipClass() { 3827 var $tip = $__default["default"](this.getTipElement()); 3828 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); 3829 3830 if (tabClass !== null && tabClass.length > 0) { 3831 $tip.removeClass(tabClass.join('')); 3832 } 3833 } // Static 3834 ; 3835 3836 Popover._jQueryInterface = function _jQueryInterface(config) { 3837 return this.each(function () { 3838 var data = $__default["default"](this).data(DATA_KEY$3); 3839 3840 var _config = typeof config === 'object' ? config : null; 3841 3842 if (!data && /dispose|hide/.test(config)) { 3843 return; 3844 } 3845 3846 if (!data) { 3847 data = new Popover(this, _config); 3848 $__default["default"](this).data(DATA_KEY$3, data); 3849 } 3850 3851 if (typeof config === 'string') { 3852 if (typeof data[config] === 'undefined') { 3853 throw new TypeError("No method named \"" + config + "\""); 3854 } 3855 3856 data[config](); 3857 } 3858 }); 3859 }; 3860 3861 _createClass(Popover, null, [{ 3862 key: "VERSION", 3863 get: // Getters 3864 function get() { 3865 return VERSION$3; 3866 } 3867 }, { 3868 key: "Default", 3869 get: function get() { 3870 return Default$2; 3871 } 3872 }, { 3873 key: "NAME", 3874 get: function get() { 3875 return NAME$3; 3876 } 3877 }, { 3878 key: "DATA_KEY", 3879 get: function get() { 3880 return DATA_KEY$3; 3881 } 3882 }, { 3883 key: "Event", 3884 get: function get() { 3885 return Event; 3886 } 3887 }, { 3888 key: "EVENT_KEY", 3889 get: function get() { 3890 return EVENT_KEY$3; 3891 } 3892 }, { 3893 key: "DefaultType", 3894 get: function get() { 3895 return DefaultType$2; 3896 } 3897 }]); 3898 3899 return Popover; 3900 }(Tooltip); 3901 /** 3902 * jQuery 3903 */ 3904 3905 3906 $__default["default"].fn[NAME$3] = Popover._jQueryInterface; 3907 $__default["default"].fn[NAME$3].Constructor = Popover; 3908 3909 $__default["default"].fn[NAME$3].noConflict = function () { 3910 $__default["default"].fn[NAME$3] = JQUERY_NO_CONFLICT$3; 3911 return Popover._jQueryInterface; 3912 }; 3913 3914 /** 3915 * Constants 3916 */ 3917 3918 var NAME$2 = 'scrollspy'; 3919 var VERSION$2 = '4.6.2'; 3920 var DATA_KEY$2 = 'bs.scrollspy'; 3921 var EVENT_KEY$2 = "." + DATA_KEY$2; 3922 var DATA_API_KEY$1 = '.data-api'; 3923 var JQUERY_NO_CONFLICT$2 = $__default["default"].fn[NAME$2]; 3924 var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'; 3925 var CLASS_NAME_ACTIVE$1 = 'active'; 3926 var EVENT_ACTIVATE = "activate" + EVENT_KEY$2; 3927 var EVENT_SCROLL = "scroll" + EVENT_KEY$2; 3928 var EVENT_LOAD_DATA_API = "load" + EVENT_KEY$2 + DATA_API_KEY$1; 3929 var METHOD_OFFSET = 'offset'; 3930 var METHOD_POSITION = 'position'; 3931 var SELECTOR_DATA_SPY = '[data-spy="scroll"]'; 3932 var SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group'; 3933 var SELECTOR_NAV_LINKS = '.nav-link'; 3934 var SELECTOR_NAV_ITEMS = '.nav-item'; 3935 var SELECTOR_LIST_ITEMS = '.list-group-item'; 3936 var SELECTOR_DROPDOWN$1 = '.dropdown'; 3937 var SELECTOR_DROPDOWN_ITEMS = '.dropdown-item'; 3938 var SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle'; 3939 var Default$1 = { 3940 offset: 10, 3941 method: 'auto', 3942 target: '' 3943 }; 3944 var DefaultType$1 = { 3945 offset: 'number', 3946 method: 'string', 3947 target: '(string|element)' 3948 }; 3949 /** 3950 * Class definition 3951 */ 3952 3953 var ScrollSpy = /*#__PURE__*/function () { 3954 function ScrollSpy(element, config) { 3955 var _this = this; 3956 3957 this._element = element; 3958 this._scrollElement = element.tagName === 'BODY' ? window : element; 3959 this._config = this._getConfig(config); 3960 this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " " + SELECTOR_DROPDOWN_ITEMS); 3961 this._offsets = []; 3962 this._targets = []; 3963 this._activeTarget = null; 3964 this._scrollHeight = 0; 3965 $__default["default"](this._scrollElement).on(EVENT_SCROLL, function (event) { 3966 return _this._process(event); 3967 }); 3968 this.refresh(); 3969 3970 this._process(); 3971 } // Getters 3972 3973 3974 var _proto = ScrollSpy.prototype; 3975 3976 // Public 3977 _proto.refresh = function refresh() { 3978 var _this2 = this; 3979 3980 var autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION; 3981 var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; 3982 var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0; 3983 this._offsets = []; 3984 this._targets = []; 3985 this._scrollHeight = this._getScrollHeight(); 3986 var targets = [].slice.call(document.querySelectorAll(this._selector)); 3987 targets.map(function (element) { 3988 var target; 3989 var targetSelector = Util.getSelectorFromElement(element); 3990 3991 if (targetSelector) { 3992 target = document.querySelector(targetSelector); 3993 } 3994 3995 if (target) { 3996 var targetBCR = target.getBoundingClientRect(); 3997 3998 if (targetBCR.width || targetBCR.height) { 3999 // TODO (fat): remove sketch reliance on jQuery position/offset 4000 return [$__default["default"](target)[offsetMethod]().top + offsetBase, targetSelector]; 4001 } 4002 } 4003 4004 return null; 4005 }).filter(Boolean).sort(function (a, b) { 4006 return a[0] - b[0]; 4007 }).forEach(function (item) { 4008 _this2._offsets.push(item[0]); 4009 4010 _this2._targets.push(item[1]); 4011 }); 4012 }; 4013 4014 _proto.dispose = function dispose() { 4015 $__default["default"].removeData(this._element, DATA_KEY$2); 4016 $__default["default"](this._scrollElement).off(EVENT_KEY$2); 4017 this._element = null; 4018 this._scrollElement = null; 4019 this._config = null; 4020 this._selector = null; 4021 this._offsets = null; 4022 this._targets = null; 4023 this._activeTarget = null; 4024 this._scrollHeight = null; 4025 } // Private 4026 ; 4027 4028 _proto._getConfig = function _getConfig(config) { 4029 config = _extends({}, Default$1, typeof config === 'object' && config ? config : {}); 4030 4031 if (typeof config.target !== 'string' && Util.isElement(config.target)) { 4032 var id = $__default["default"](config.target).attr('id'); 4033 4034 if (!id) { 4035 id = Util.getUID(NAME$2); 4036 $__default["default"](config.target).attr('id', id); 4037 } 4038 4039 config.target = "#" + id; 4040 } 4041 4042 Util.typeCheckConfig(NAME$2, config, DefaultType$1); 4043 return config; 4044 }; 4045 4046 _proto._getScrollTop = function _getScrollTop() { 4047 return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; 4048 }; 4049 4050 _proto._getScrollHeight = function _getScrollHeight() { 4051 return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); 4052 }; 4053 4054 _proto._getOffsetHeight = function _getOffsetHeight() { 4055 return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; 4056 }; 4057 4058 _proto._process = function _process() { 4059 var scrollTop = this._getScrollTop() + this._config.offset; 4060 4061 var scrollHeight = this._getScrollHeight(); 4062 4063 var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); 4064 4065 if (this._scrollHeight !== scrollHeight) { 4066 this.refresh(); 4067 } 4068 4069 if (scrollTop >= maxScroll) { 4070 var target = this._targets[this._targets.length - 1]; 4071 4072 if (this._activeTarget !== target) { 4073 this._activate(target); 4074 } 4075 4076 return; 4077 } 4078 4079 if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { 4080 this._activeTarget = null; 4081 4082 this._clear(); 4083 4084 return; 4085 } 4086 4087 for (var i = this._offsets.length; i--;) { 4088 var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); 4089 4090 if (isActiveTarget) { 4091 this._activate(this._targets[i]); 4092 } 4093 } 4094 }; 4095 4096 _proto._activate = function _activate(target) { 4097 this._activeTarget = target; 4098 4099 this._clear(); 4100 4101 var queries = this._selector.split(',').map(function (selector) { 4102 return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]"; 4103 }); 4104 4105 var $link = $__default["default"]([].slice.call(document.querySelectorAll(queries.join(',')))); 4106 4107 if ($link.hasClass(CLASS_NAME_DROPDOWN_ITEM)) { 4108 $link.closest(SELECTOR_DROPDOWN$1).find(SELECTOR_DROPDOWN_TOGGLE$1).addClass(CLASS_NAME_ACTIVE$1); 4109 $link.addClass(CLASS_NAME_ACTIVE$1); 4110 } else { 4111 // Set triggered link as active 4112 $link.addClass(CLASS_NAME_ACTIVE$1); // Set triggered links parents as active 4113 // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor 4114 4115 $link.parents(SELECTOR_NAV_LIST_GROUP$1).prev(SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).addClass(CLASS_NAME_ACTIVE$1); // Handle special case when .nav-link is inside .nav-item 4116 4117 $link.parents(SELECTOR_NAV_LIST_GROUP$1).prev(SELECTOR_NAV_ITEMS).children(SELECTOR_NAV_LINKS).addClass(CLASS_NAME_ACTIVE$1); 4118 } 4119 4120 $__default["default"](this._scrollElement).trigger(EVENT_ACTIVATE, { 4121 relatedTarget: target 4122 }); 4123 }; 4124 4125 _proto._clear = function _clear() { 4126 [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) { 4127 return node.classList.contains(CLASS_NAME_ACTIVE$1); 4128 }).forEach(function (node) { 4129 return node.classList.remove(CLASS_NAME_ACTIVE$1); 4130 }); 4131 } // Static 4132 ; 4133 4134 ScrollSpy._jQueryInterface = function _jQueryInterface(config) { 4135 return this.each(function () { 4136 var data = $__default["default"](this).data(DATA_KEY$2); 4137 4138 var _config = typeof config === 'object' && config; 4139 4140 if (!data) { 4141 data = new ScrollSpy(this, _config); 4142 $__default["default"](this).data(DATA_KEY$2, data); 4143 } 4144 4145 if (typeof config === 'string') { 4146 if (typeof data[config] === 'undefined') { 4147 throw new TypeError("No method named \"" + config + "\""); 4148 } 4149 4150 data[config](); 4151 } 4152 }); 4153 }; 4154 4155 _createClass(ScrollSpy, null, [{ 4156 key: "VERSION", 4157 get: function get() { 4158 return VERSION$2; 4159 } 4160 }, { 4161 key: "Default", 4162 get: function get() { 4163 return Default$1; 4164 } 4165 }]); 4166 4167 return ScrollSpy; 4168 }(); 4169 /** 4170 * Data API implementation 4171 */ 4172 4173 4174 $__default["default"](window).on(EVENT_LOAD_DATA_API, function () { 4175 var scrollSpys = [].slice.call(document.querySelectorAll(SELECTOR_DATA_SPY)); 4176 var scrollSpysLength = scrollSpys.length; 4177 4178 for (var i = scrollSpysLength; i--;) { 4179 var $spy = $__default["default"](scrollSpys[i]); 4180 4181 ScrollSpy._jQueryInterface.call($spy, $spy.data()); 4182 } 4183 }); 4184 /** 4185 * jQuery 4186 */ 4187 4188 $__default["default"].fn[NAME$2] = ScrollSpy._jQueryInterface; 4189 $__default["default"].fn[NAME$2].Constructor = ScrollSpy; 4190 4191 $__default["default"].fn[NAME$2].noConflict = function () { 4192 $__default["default"].fn[NAME$2] = JQUERY_NO_CONFLICT$2; 4193 return ScrollSpy._jQueryInterface; 4194 }; 4195 4196 /** 4197 * Constants 4198 */ 4199 4200 var NAME$1 = 'tab'; 4201 var VERSION$1 = '4.6.2'; 4202 var DATA_KEY$1 = 'bs.tab'; 4203 var EVENT_KEY$1 = "." + DATA_KEY$1; 4204 var DATA_API_KEY = '.data-api'; 4205 var JQUERY_NO_CONFLICT$1 = $__default["default"].fn[NAME$1]; 4206 var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu'; 4207 var CLASS_NAME_ACTIVE = 'active'; 4208 var CLASS_NAME_DISABLED = 'disabled'; 4209 var CLASS_NAME_FADE$1 = 'fade'; 4210 var CLASS_NAME_SHOW$1 = 'show'; 4211 var EVENT_HIDE$1 = "hide" + EVENT_KEY$1; 4212 var EVENT_HIDDEN$1 = "hidden" + EVENT_KEY$1; 4213 var EVENT_SHOW$1 = "show" + EVENT_KEY$1; 4214 var EVENT_SHOWN$1 = "shown" + EVENT_KEY$1; 4215 var EVENT_CLICK_DATA_API = "click" + EVENT_KEY$1 + DATA_API_KEY; 4216 var SELECTOR_DROPDOWN = '.dropdown'; 4217 var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'; 4218 var SELECTOR_ACTIVE = '.active'; 4219 var SELECTOR_ACTIVE_UL = '> li > .active'; 4220 var SELECTOR_DATA_TOGGLE = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]'; 4221 var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'; 4222 var SELECTOR_DROPDOWN_ACTIVE_CHILD = '> .dropdown-menu .active'; 4223 /** 4224 * Class definition 4225 */ 4226 4227 var Tab = /*#__PURE__*/function () { 4228 function Tab(element) { 4229 this._element = element; 4230 } // Getters 4231 4232 4233 var _proto = Tab.prototype; 4234 4235 // Public 4236 _proto.show = function show() { 4237 var _this = this; 4238 4239 if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $__default["default"](this._element).hasClass(CLASS_NAME_ACTIVE) || $__default["default"](this._element).hasClass(CLASS_NAME_DISABLED) || this._element.hasAttribute('disabled')) { 4240 return; 4241 } 4242 4243 var target; 4244 var previous; 4245 var listElement = $__default["default"](this._element).closest(SELECTOR_NAV_LIST_GROUP)[0]; 4246 var selector = Util.getSelectorFromElement(this._element); 4247 4248 if (listElement) { 4249 var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE; 4250 previous = $__default["default"].makeArray($__default["default"](listElement).find(itemSelector)); 4251 previous = previous[previous.length - 1]; 4252 } 4253 4254 var hideEvent = $__default["default"].Event(EVENT_HIDE$1, { 4255 relatedTarget: this._element 4256 }); 4257 var showEvent = $__default["default"].Event(EVENT_SHOW$1, { 4258 relatedTarget: previous 4259 }); 4260 4261 if (previous) { 4262 $__default["default"](previous).trigger(hideEvent); 4263 } 4264 4265 $__default["default"](this._element).trigger(showEvent); 4266 4267 if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) { 4268 return; 4269 } 4270 4271 if (selector) { 4272 target = document.querySelector(selector); 4273 } 4274 4275 this._activate(this._element, listElement); 4276 4277 var complete = function complete() { 4278 var hiddenEvent = $__default["default"].Event(EVENT_HIDDEN$1, { 4279 relatedTarget: _this._element 4280 }); 4281 var shownEvent = $__default["default"].Event(EVENT_SHOWN$1, { 4282 relatedTarget: previous 4283 }); 4284 $__default["default"](previous).trigger(hiddenEvent); 4285 $__default["default"](_this._element).trigger(shownEvent); 4286 }; 4287 4288 if (target) { 4289 this._activate(target, target.parentNode, complete); 4290 } else { 4291 complete(); 4292 } 4293 }; 4294 4295 _proto.dispose = function dispose() { 4296 $__default["default"].removeData(this._element, DATA_KEY$1); 4297 this._element = null; 4298 } // Private 4299 ; 4300 4301 _proto._activate = function _activate(element, container, callback) { 4302 var _this2 = this; 4303 4304 var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $__default["default"](container).find(SELECTOR_ACTIVE_UL) : $__default["default"](container).children(SELECTOR_ACTIVE); 4305 var active = activeElements[0]; 4306 var isTransitioning = callback && active && $__default["default"](active).hasClass(CLASS_NAME_FADE$1); 4307 4308 var complete = function complete() { 4309 return _this2._transitionComplete(element, active, callback); 4310 }; 4311 4312 if (active && isTransitioning) { 4313 var transitionDuration = Util.getTransitionDurationFromElement(active); 4314 $__default["default"](active).removeClass(CLASS_NAME_SHOW$1).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 4315 } else { 4316 complete(); 4317 } 4318 }; 4319 4320 _proto._transitionComplete = function _transitionComplete(element, active, callback) { 4321 if (active) { 4322 $__default["default"](active).removeClass(CLASS_NAME_ACTIVE); 4323 var dropdownChild = $__default["default"](active.parentNode).find(SELECTOR_DROPDOWN_ACTIVE_CHILD)[0]; 4324 4325 if (dropdownChild) { 4326 $__default["default"](dropdownChild).removeClass(CLASS_NAME_ACTIVE); 4327 } 4328 4329 if (active.getAttribute('role') === 'tab') { 4330 active.setAttribute('aria-selected', false); 4331 } 4332 } 4333 4334 $__default["default"](element).addClass(CLASS_NAME_ACTIVE); 4335 4336 if (element.getAttribute('role') === 'tab') { 4337 element.setAttribute('aria-selected', true); 4338 } 4339 4340 Util.reflow(element); 4341 4342 if (element.classList.contains(CLASS_NAME_FADE$1)) { 4343 element.classList.add(CLASS_NAME_SHOW$1); 4344 } 4345 4346 var parent = element.parentNode; 4347 4348 if (parent && parent.nodeName === 'LI') { 4349 parent = parent.parentNode; 4350 } 4351 4352 if (parent && $__default["default"](parent).hasClass(CLASS_NAME_DROPDOWN_MENU)) { 4353 var dropdownElement = $__default["default"](element).closest(SELECTOR_DROPDOWN)[0]; 4354 4355 if (dropdownElement) { 4356 var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(SELECTOR_DROPDOWN_TOGGLE)); 4357 $__default["default"](dropdownToggleList).addClass(CLASS_NAME_ACTIVE); 4358 } 4359 4360 element.setAttribute('aria-expanded', true); 4361 } 4362 4363 if (callback) { 4364 callback(); 4365 } 4366 } // Static 4367 ; 4368 4369 Tab._jQueryInterface = function _jQueryInterface(config) { 4370 return this.each(function () { 4371 var $this = $__default["default"](this); 4372 var data = $this.data(DATA_KEY$1); 4373 4374 if (!data) { 4375 data = new Tab(this); 4376 $this.data(DATA_KEY$1, data); 4377 } 4378 4379 if (typeof config === 'string') { 4380 if (typeof data[config] === 'undefined') { 4381 throw new TypeError("No method named \"" + config + "\""); 4382 } 4383 4384 data[config](); 4385 } 4386 }); 4387 }; 4388 4389 _createClass(Tab, null, [{ 4390 key: "VERSION", 4391 get: function get() { 4392 return VERSION$1; 4393 } 4394 }]); 4395 4396 return Tab; 4397 }(); 4398 /** 4399 * Data API implementation 4400 */ 4401 4402 4403 $__default["default"](document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { 4404 event.preventDefault(); 4405 4406 Tab._jQueryInterface.call($__default["default"](this), 'show'); 4407 }); 4408 /** 4409 * jQuery 4410 */ 4411 4412 $__default["default"].fn[NAME$1] = Tab._jQueryInterface; 4413 $__default["default"].fn[NAME$1].Constructor = Tab; 4414 4415 $__default["default"].fn[NAME$1].noConflict = function () { 4416 $__default["default"].fn[NAME$1] = JQUERY_NO_CONFLICT$1; 4417 return Tab._jQueryInterface; 4418 }; 4419 4420 /** 4421 * Constants 4422 */ 4423 4424 var NAME = 'toast'; 4425 var VERSION = '4.6.2'; 4426 var DATA_KEY = 'bs.toast'; 4427 var EVENT_KEY = "." + DATA_KEY; 4428 var JQUERY_NO_CONFLICT = $__default["default"].fn[NAME]; 4429 var CLASS_NAME_FADE = 'fade'; 4430 var CLASS_NAME_HIDE = 'hide'; 4431 var CLASS_NAME_SHOW = 'show'; 4432 var CLASS_NAME_SHOWING = 'showing'; 4433 var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY; 4434 var EVENT_HIDE = "hide" + EVENT_KEY; 4435 var EVENT_HIDDEN = "hidden" + EVENT_KEY; 4436 var EVENT_SHOW = "show" + EVENT_KEY; 4437 var EVENT_SHOWN = "shown" + EVENT_KEY; 4438 var SELECTOR_DATA_DISMISS = '[data-dismiss="toast"]'; 4439 var Default = { 4440 animation: true, 4441 autohide: true, 4442 delay: 500 4443 }; 4444 var DefaultType = { 4445 animation: 'boolean', 4446 autohide: 'boolean', 4447 delay: 'number' 4448 }; 4449 /** 4450 * Class definition 4451 */ 4452 4453 var Toast = /*#__PURE__*/function () { 4454 function Toast(element, config) { 4455 this._element = element; 4456 this._config = this._getConfig(config); 4457 this._timeout = null; 4458 4459 this._setListeners(); 4460 } // Getters 4461 4462 4463 var _proto = Toast.prototype; 4464 4465 // Public 4466 _proto.show = function show() { 4467 var _this = this; 4468 4469 var showEvent = $__default["default"].Event(EVENT_SHOW); 4470 $__default["default"](this._element).trigger(showEvent); 4471 4472 if (showEvent.isDefaultPrevented()) { 4473 return; 4474 } 4475 4476 this._clearTimeout(); 4477 4478 if (this._config.animation) { 4479 this._element.classList.add(CLASS_NAME_FADE); 4480 } 4481 4482 var complete = function complete() { 4483 _this._element.classList.remove(CLASS_NAME_SHOWING); 4484 4485 _this._element.classList.add(CLASS_NAME_SHOW); 4486 4487 $__default["default"](_this._element).trigger(EVENT_SHOWN); 4488 4489 if (_this._config.autohide) { 4490 _this._timeout = setTimeout(function () { 4491 _this.hide(); 4492 }, _this._config.delay); 4493 } 4494 }; 4495 4496 this._element.classList.remove(CLASS_NAME_HIDE); 4497 4498 Util.reflow(this._element); 4499 4500 this._element.classList.add(CLASS_NAME_SHOWING); 4501 4502 if (this._config.animation) { 4503 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 4504 $__default["default"](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 4505 } else { 4506 complete(); 4507 } 4508 }; 4509 4510 _proto.hide = function hide() { 4511 if (!this._element.classList.contains(CLASS_NAME_SHOW)) { 4512 return; 4513 } 4514 4515 var hideEvent = $__default["default"].Event(EVENT_HIDE); 4516 $__default["default"](this._element).trigger(hideEvent); 4517 4518 if (hideEvent.isDefaultPrevented()) { 4519 return; 4520 } 4521 4522 this._close(); 4523 }; 4524 4525 _proto.dispose = function dispose() { 4526 this._clearTimeout(); 4527 4528 if (this._element.classList.contains(CLASS_NAME_SHOW)) { 4529 this._element.classList.remove(CLASS_NAME_SHOW); 4530 } 4531 4532 $__default["default"](this._element).off(EVENT_CLICK_DISMISS); 4533 $__default["default"].removeData(this._element, DATA_KEY); 4534 this._element = null; 4535 this._config = null; 4536 } // Private 4537 ; 4538 4539 _proto._getConfig = function _getConfig(config) { 4540 config = _extends({}, Default, $__default["default"](this._element).data(), typeof config === 'object' && config ? config : {}); 4541 Util.typeCheckConfig(NAME, config, this.constructor.DefaultType); 4542 return config; 4543 }; 4544 4545 _proto._setListeners = function _setListeners() { 4546 var _this2 = this; 4547 4548 $__default["default"](this._element).on(EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function () { 4549 return _this2.hide(); 4550 }); 4551 }; 4552 4553 _proto._close = function _close() { 4554 var _this3 = this; 4555 4556 var complete = function complete() { 4557 _this3._element.classList.add(CLASS_NAME_HIDE); 4558 4559 $__default["default"](_this3._element).trigger(EVENT_HIDDEN); 4560 }; 4561 4562 this._element.classList.remove(CLASS_NAME_SHOW); 4563 4564 if (this._config.animation) { 4565 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 4566 $__default["default"](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 4567 } else { 4568 complete(); 4569 } 4570 }; 4571 4572 _proto._clearTimeout = function _clearTimeout() { 4573 clearTimeout(this._timeout); 4574 this._timeout = null; 4575 } // Static 4576 ; 4577 4578 Toast._jQueryInterface = function _jQueryInterface(config) { 4579 return this.each(function () { 4580 var $element = $__default["default"](this); 4581 var data = $element.data(DATA_KEY); 4582 4583 var _config = typeof config === 'object' && config; 4584 4585 if (!data) { 4586 data = new Toast(this, _config); 4587 $element.data(DATA_KEY, data); 4588 } 4589 4590 if (typeof config === 'string') { 4591 if (typeof data[config] === 'undefined') { 4592 throw new TypeError("No method named \"" + config + "\""); 4593 } 4594 4595 data[config](this); 4596 } 4597 }); 4598 }; 4599 4600 _createClass(Toast, null, [{ 4601 key: "VERSION", 4602 get: function get() { 4603 return VERSION; 4604 } 4605 }, { 4606 key: "DefaultType", 4607 get: function get() { 4608 return DefaultType; 4609 } 4610 }, { 4611 key: "Default", 4612 get: function get() { 4613 return Default; 4614 } 4615 }]); 4616 4617 return Toast; 4618 }(); 4619 /** 4620 * jQuery 4621 */ 4622 4623 4624 $__default["default"].fn[NAME] = Toast._jQueryInterface; 4625 $__default["default"].fn[NAME].Constructor = Toast; 4626 4627 $__default["default"].fn[NAME].noConflict = function () { 4628 $__default["default"].fn[NAME] = JQUERY_NO_CONFLICT; 4629 return Toast._jQueryInterface; 4630 }; 4631 4632 exports.Alert = Alert; 4633 exports.Button = Button; 4634 exports.Carousel = Carousel; 4635 exports.Collapse = Collapse; 4636 exports.Dropdown = Dropdown; 4637 exports.Modal = Modal; 4638 exports.Popover = Popover; 4639 exports.Scrollspy = ScrollSpy; 4640 exports.Tab = Tab; 4641 exports.Toast = Toast; 4642 exports.Tooltip = Tooltip; 4643 exports.Util = Util; 4644 4645 Object.defineProperty(exports, '__esModule', { value: true }); 4646 4647})); 4648//# sourceMappingURL=bootstrap.js.map 4649 4650 4651/***/ }), 4652
vendor: 49,030 bytes, lines 4653-6452
4653/***/ "./node_modules/buffer/index.js": 4654/*!**************************************!*\ 4655 !*** ./node_modules/buffer/index.js ***! 4656 \**************************************/ 4657/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 4658 4659"use strict"; 4660/*! 4661 * The buffer module from node.js, for the browser. 4662 * 4663 * @author Feross Aboukhadijeh <http://feross.org> 4664 * @license MIT 4665 */ 4666/* eslint-disable no-proto */ 4667 4668 4669 4670var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js") 4671var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js") 4672var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js") 4673 4674exports.Buffer = Buffer 4675exports.SlowBuffer = SlowBuffer 4676exports.INSPECT_MAX_BYTES = 50 4677 4678/** 4679 * If `Buffer.TYPED_ARRAY_SUPPORT`: 4680 * === true Use Uint8Array implementation (fastest) 4681 * === false Use Object implementation (most compatible, even IE6) 4682 * 4683 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, 4684 * Opera 11.6+, iOS 4.2+. 4685 * 4686 * Due to various browser bugs, sometimes the Object implementation will be used even 4687 * when the browser supports typed arrays. 4688 * 4689 * Note: 4690 * 4691 * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, 4692 * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. 4693 * 4694 * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. 4695 * 4696 * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of 4697 * incorrect length in some situations. 4698 4699 * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they 4700 * get the Object implementation, which is slower but behaves correctly. 4701 */ 4702Buffer.TYPED_ARRAY_SUPPORT = __webpack_require__.g.TYPED_ARRAY_SUPPORT !== undefined 4703 ? __webpack_require__.g.TYPED_ARRAY_SUPPORT 4704 : typedArraySupport() 4705 4706/* 4707 * Export kMaxLength after typed array support is determined. 4708 */ 4709exports.kMaxLength = kMaxLength() 4710 4711function typedArraySupport () { 4712 try { 4713 var arr = new Uint8Array(1) 4714 arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }} 4715 return arr.foo() === 42 && // typed array instances can be augmented 4716 typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` 4717 arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` 4718 } catch (e) { 4719 return false 4720 } 4721} 4722 4723function kMaxLength () { 4724 return Buffer.TYPED_ARRAY_SUPPORT 4725 ? 0x7fffffff 4726 : 0x3fffffff 4727} 4728 4729function createBuffer (that, length) { 4730 if (kMaxLength() < length) { 4731 throw new RangeError('Invalid typed array length') 4732 } 4733 if (Buffer.TYPED_ARRAY_SUPPORT) { 4734 // Return an augmented `Uint8Array` instance, for best performance 4735 that = new Uint8Array(length) 4736 that.__proto__ = Buffer.prototype 4737 } else { 4738 // Fallback: Return an object instance of the Buffer class 4739 if (that === null) { 4740 that = new Buffer(length) 4741 } 4742 that.length = length 4743 } 4744 4745 return that 4746} 4747 4748/** 4749 * The Buffer constructor returns instances of `Uint8Array` that have their 4750 * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of 4751 * `Uint8Array`, so the returned instances will have all the node `Buffer` methods 4752 * and the `Uint8Array` methods. Square bracket notation works as expected -- it 4753 * returns a single octet. 4754 * 4755 * The `Uint8Array` prototype remains unmodified. 4756 */ 4757 4758function Buffer (arg, encodingOrOffset, length) { 4759 if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { 4760 return new Buffer(arg, encodingOrOffset, length) 4761 } 4762 4763 // Common case. 4764 if (typeof arg === 'number') { 4765 if (typeof encodingOrOffset === 'string') { 4766 throw new Error( 4767 'If encoding is specified then the first argument must be a string' 4768 ) 4769 } 4770 return allocUnsafe(this, arg) 4771 } 4772 return from(this, arg, encodingOrOffset, length) 4773} 4774 4775Buffer.poolSize = 8192 // not used by this implementation 4776 4777// TODO: Legacy, not needed anymore. Remove in next major version. 4778Buffer._augment = function (arr) { 4779 arr.__proto__ = Buffer.prototype 4780 return arr 4781} 4782 4783function from (that, value, encodingOrOffset, length) { 4784 if (typeof value === 'number') { 4785 throw new TypeError('"value" argument must not be a number') 4786 } 4787 4788 if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { 4789 return fromArrayBuffer(that, value, encodingOrOffset, length) 4790 } 4791 4792 if (typeof value === 'string') { 4793 return fromString(that, value, encodingOrOffset) 4794 } 4795 4796 return fromObject(that, value) 4797} 4798 4799/** 4800 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError 4801 * if value is a number. 4802 * Buffer.from(str[, encoding]) 4803 * Buffer.from(array) 4804 * Buffer.from(buffer) 4805 * Buffer.from(arrayBuffer[, byteOffset[, length]]) 4806 **/ 4807Buffer.from = function (value, encodingOrOffset, length) { 4808 return from(null, value, encodingOrOffset, length) 4809} 4810 4811if (Buffer.TYPED_ARRAY_SUPPORT) { 4812 Buffer.prototype.__proto__ = Uint8Array.prototype 4813 Buffer.__proto__ = Uint8Array 4814 if (typeof Symbol !== 'undefined' && Symbol.species && 4815 Buffer[Symbol.species] === Buffer) { 4816 // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 4817 Object.defineProperty(Buffer, Symbol.species, { 4818 value: null, 4819 configurable: true 4820 }) 4821 } 4822} 4823 4824function assertSize (size) { 4825 if (typeof size !== 'number') { 4826 throw new TypeError('"size" argument must be a number') 4827 } else if (size < 0) { 4828 throw new RangeError('"size" argument must not be negative') 4829 } 4830} 4831 4832function alloc (that, size, fill, encoding) { 4833 assertSize(size) 4834 if (size <= 0) { 4835 return createBuffer(that, size) 4836 } 4837 if (fill !== undefined) { 4838 // Only pay attention to encoding if it's a string. This 4839 // prevents accidentally sending in a number that would 4840 // be interpretted as a start offset. 4841 return typeof encoding === 'string' 4842 ? createBuffer(that, size).fill(fill, encoding) 4843 : createBuffer(that, size).fill(fill) 4844 } 4845 return createBuffer(that, size) 4846} 4847 4848/** 4849 * Creates a new filled Buffer instance. 4850 * alloc(size[, fill[, encoding]]) 4851 **/ 4852Buffer.alloc = function (size, fill, encoding) { 4853 return alloc(null, size, fill, encoding) 4854} 4855 4856function allocUnsafe (that, size) { 4857 assertSize(size) 4858 that = createBuffer(that, size < 0 ? 0 : checked(size) | 0) 4859 if (!Buffer.TYPED_ARRAY_SUPPORT) { 4860 for (var i = 0; i < size; ++i) { 4861 that[i] = 0 4862 } 4863 } 4864 return that 4865} 4866 4867/** 4868 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. 4869 * */ 4870Buffer.allocUnsafe = function (size) { 4871 return allocUnsafe(null, size) 4872} 4873/** 4874 * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. 4875 */ 4876Buffer.allocUnsafeSlow = function (size) { 4877 return allocUnsafe(null, size) 4878} 4879 4880function fromString (that, string, encoding) { 4881 if (typeof encoding !== 'string' || encoding === '') { 4882 encoding = 'utf8' 4883 } 4884 4885 if (!Buffer.isEncoding(encoding)) { 4886 throw new TypeError('"encoding" must be a valid string encoding') 4887 } 4888 4889 var length = byteLength(string, encoding) | 0 4890 that = createBuffer(that, length) 4891 4892 var actual = that.write(string, encoding) 4893 4894 if (actual !== length) { 4895 // Writing a hex string, for example, that contains invalid characters will 4896 // cause everything after the first invalid character to be ignored. (e.g. 4897 // 'abxxcd' will be treated as 'ab') 4898 that = that.slice(0, actual) 4899 } 4900 4901 return that 4902} 4903 4904function fromArrayLike (that, array) { 4905 var length = array.length < 0 ? 0 : checked(array.length) | 0 4906 that = createBuffer(that, length) 4907 for (var i = 0; i < length; i += 1) { 4908 that[i] = array[i] & 255 4909 } 4910 return that 4911} 4912 4913function fromArrayBuffer (that, array, byteOffset, length) { 4914 array.byteLength // this throws if `array` is not a valid ArrayBuffer 4915 4916 if (byteOffset < 0 || array.byteLength < byteOffset) { 4917 throw new RangeError('\'offset\' is out of bounds') 4918 } 4919 4920 if (array.byteLength < byteOffset + (length || 0)) { 4921 throw new RangeError('\'length\' is out of bounds') 4922 } 4923 4924 if (byteOffset === undefined && length === undefined) { 4925 array = new Uint8Array(array) 4926 } else if (length === undefined) { 4927 array = new Uint8Array(array, byteOffset) 4928 } else { 4929 array = new Uint8Array(array, byteOffset, length) 4930 } 4931 4932 if (Buffer.TYPED_ARRAY_SUPPORT) { 4933 // Return an augmented `Uint8Array` instance, for best performance 4934 that = array 4935 that.__proto__ = Buffer.prototype 4936 } else { 4937 // Fallback: Return an object instance of the Buffer class 4938 that = fromArrayLike(that, array) 4939 } 4940 return that 4941} 4942 4943function fromObject (that, obj) { 4944 if (Buffer.isBuffer(obj)) { 4945 var len = checked(obj.length) | 0 4946 that = createBuffer(that, len) 4947 4948 if (that.length === 0) { 4949 return that 4950 } 4951 4952 obj.copy(that, 0, 0, len) 4953 return that 4954 } 4955 4956 if (obj) { 4957 if ((typeof ArrayBuffer !== 'undefined' && 4958 obj.buffer instanceof ArrayBuffer) || 'length' in obj) { 4959 if (typeof obj.length !== 'number' || isnan(obj.length)) { 4960 return createBuffer(that, 0) 4961 } 4962 return fromArrayLike(that, obj) 4963 } 4964 4965 if (obj.type === 'Buffer' && isArray(obj.data)) { 4966 return fromArrayLike(that, obj.data) 4967 } 4968 } 4969 4970 throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.') 4971} 4972 4973function checked (length) { 4974 // Note: cannot use `length < kMaxLength()` here because that fails when 4975 // length is NaN (which is otherwise coerced to zero.) 4976 if (length >= kMaxLength()) { 4977 throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 4978 'size: 0x' + kMaxLength().toString(16) + ' bytes') 4979 } 4980 return length | 0 4981} 4982 4983function SlowBuffer (length) { 4984 if (+length != length) { // eslint-disable-line eqeqeq 4985 length = 0 4986 } 4987 return Buffer.alloc(+length) 4988} 4989 4990Buffer.isBuffer = function isBuffer (b) { 4991 return !!(b != null && b._isBuffer) 4992} 4993 4994Buffer.compare = function compare (a, b) { 4995 if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { 4996 throw new TypeError('Arguments must be Buffers') 4997 } 4998 4999 if (a === b) return 0 5000 5001 var x = a.length 5002 var y = b.length 5003 5004 for (var i = 0, len = Math.min(x, y); i < len; ++i) { 5005 if (a[i] !== b[i]) { 5006 x = a[i] 5007 y = b[i] 5008 break 5009 } 5010 } 5011 5012 if (x < y) return -1 5013 if (y < x) return 1 5014 return 0 5015} 5016 5017Buffer.isEncoding = function isEncoding (encoding) { 5018 switch (String(encoding).toLowerCase()) { 5019 case 'hex': 5020 case 'utf8': 5021 case 'utf-8': 5022 case 'ascii': 5023 case 'latin1': 5024 case 'binary': 5025 case 'base64': 5026 case 'ucs2': 5027 case 'ucs-2': 5028 case 'utf16le': 5029 case 'utf-16le': 5030 return true 5031 default: 5032 return false 5033 } 5034} 5035 5036Buffer.concat = function concat (list, length) { 5037 if (!isArray(list)) { 5038 throw new TypeError('"list" argument must be an Array of Buffers') 5039 } 5040 5041 if (list.length === 0) { 5042 return Buffer.alloc(0) 5043 } 5044 5045 var i 5046 if (length === undefined) { 5047 length = 0 5048 for (i = 0; i < list.length; ++i) { 5049 length += list[i].length 5050 } 5051 } 5052 5053 var buffer = Buffer.allocUnsafe(length) 5054 var pos = 0 5055 for (i = 0; i < list.length; ++i) { 5056 var buf = list[i] 5057 if (!Buffer.isBuffer(buf)) { 5058 throw new TypeError('"list" argument must be an Array of Buffers') 5059 } 5060 buf.copy(buffer, pos) 5061 pos += buf.length 5062 } 5063 return buffer 5064} 5065 5066function byteLength (string, encoding) { 5067 if (Buffer.isBuffer(string)) { 5068 return string.length 5069 } 5070 if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && 5071 (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { 5072 return string.byteLength 5073 } 5074 if (typeof string !== 'string') { 5075 string = '' + string 5076 } 5077 5078 var len = string.length 5079 if (len === 0) return 0 5080 5081 // Use a for loop to avoid recursion 5082 var loweredCase = false 5083 for (;;) { 5084 switch (encoding) { 5085 case 'ascii': 5086 case 'latin1': 5087 case 'binary': 5088 return len 5089 case 'utf8': 5090 case 'utf-8': 5091 case undefined: 5092 return utf8ToBytes(string).length 5093 case 'ucs2': 5094 case 'ucs-2': 5095 case 'utf16le': 5096 case 'utf-16le': 5097 return len * 2 5098 case 'hex': 5099 return len >>> 1 5100 case 'base64': 5101 return base64ToBytes(string).length 5102 default: 5103 if (loweredCase) return utf8ToBytes(string).length // assume utf8 5104 encoding = ('' + encoding).toLowerCase() 5105 loweredCase = true 5106 } 5107 } 5108} 5109Buffer.byteLength = byteLength 5110 5111function slowToString (encoding, start, end) { 5112 var loweredCase = false 5113 5114 // No need to verify that "this.length <= MAX_UINT32" since it's a read-only 5115 // property of a typed array. 5116 5117 // This behaves neither like String nor Uint8Array in that we set start/end 5118 // to their upper/lower bounds if the value passed is out of range. 5119 // undefined is handled specially as per ECMA-262 6th Edition, 5120 // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. 5121 if (start === undefined || start < 0) { 5122 start = 0 5123 } 5124 // Return early if start > this.length. Done here to prevent potential uint32 5125 // coercion fail below. 5126 if (start > this.length) { 5127 return '' 5128 } 5129 5130 if (end === undefined || end > this.length) { 5131 end = this.length 5132 } 5133 5134 if (end <= 0) { 5135 return '' 5136 } 5137 5138 // Force coersion to uint32. This will also coerce falsey/NaN values to 0. 5139 end >>>= 0 5140 start >>>= 0 5141 5142 if (end <= start) { 5143 return '' 5144 } 5145 5146 if (!encoding) encoding = 'utf8' 5147 5148 while (true) { 5149 switch (encoding) { 5150 case 'hex': 5151 return hexSlice(this, start, end) 5152 5153 case 'utf8': 5154 case 'utf-8': 5155 return utf8Slice(this, start, end) 5156 5157 case 'ascii': 5158 return asciiSlice(this, start, end) 5159 5160 case 'latin1': 5161 case 'binary': 5162 return latin1Slice(this, start, end) 5163 5164 case 'base64': 5165 return base64Slice(this, start, end) 5166 5167 case 'ucs2': 5168 case 'ucs-2': 5169 case 'utf16le': 5170 case 'utf-16le': 5171 return utf16leSlice(this, start, end) 5172 5173 default: 5174 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) 5175 encoding = (encoding + '').toLowerCase() 5176 loweredCase = true 5177 } 5178 } 5179} 5180 5181// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect 5182// Buffer instances. 5183Buffer.prototype._isBuffer = true 5184 5185function swap (b, n, m) { 5186 var i = b[n] 5187 b[n] = b[m] 5188 b[m] = i 5189} 5190 5191Buffer.prototype.swap16 = function swap16 () { 5192 var len = this.length 5193 if (len % 2 !== 0) { 5194 throw new RangeError('Buffer size must be a multiple of 16-bits') 5195 } 5196 for (var i = 0; i < len; i += 2) { 5197 swap(this, i, i + 1) 5198 } 5199 return this 5200} 5201 5202Buffer.prototype.swap32 = function swap32 () { 5203 var len = this.length 5204 if (len % 4 !== 0) { 5205 throw new RangeError('Buffer size must be a multiple of 32-bits') 5206 } 5207 for (var i = 0; i < len; i += 4) { 5208 swap(this, i, i + 3) 5209 swap(this, i + 1, i + 2) 5210 } 5211 return this 5212} 5213 5214Buffer.prototype.swap64 = function swap64 () { 5215 var len = this.length 5216 if (len % 8 !== 0) { 5217 throw new RangeError('Buffer size must be a multiple of 64-bits') 5218 } 5219 for (var i = 0; i < len; i += 8) { 5220 swap(this, i, i + 7) 5221 swap(this, i + 1, i + 6) 5222 swap(this, i + 2, i + 5) 5223 swap(this, i + 3, i + 4) 5224 } 5225 return this 5226} 5227 5228Buffer.prototype.toString = function toString () { 5229 var length = this.length | 0 5230 if (length === 0) return '' 5231 if (arguments.length === 0) return utf8Slice(this, 0, length) 5232 return slowToString.apply(this, arguments) 5233} 5234 5235Buffer.prototype.equals = function equals (b) { 5236 if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') 5237 if (this === b) return true 5238 return Buffer.compare(this, b) === 0 5239} 5240 5241Buffer.prototype.inspect = function inspect () { 5242 var str = '' 5243 var max = exports.INSPECT_MAX_BYTES 5244 if (this.length > 0) { 5245 str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') 5246 if (this.length > max) str += ' ... ' 5247 } 5248 return '<Buffer ' + str + '>' 5249} 5250 5251Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { 5252 if (!Buffer.isBuffer(target)) { 5253 throw new TypeError('Argument must be a Buffer') 5254 } 5255 5256 if (start === undefined) { 5257 start = 0 5258 } 5259 if (end === undefined) { 5260 end = target ? target.length : 0 5261 } 5262 if (thisStart === undefined) { 5263 thisStart = 0 5264 } 5265 if (thisEnd === undefined) { 5266 thisEnd = this.length 5267 } 5268 5269 if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { 5270 throw new RangeError('out of range index') 5271 } 5272 5273 if (thisStart >= thisEnd && start >= end) { 5274 return 0 5275 } 5276 if (thisStart >= thisEnd) { 5277 return -1 5278 } 5279 if (start >= end) { 5280 return 1 5281 } 5282 5283 start >>>= 0 5284 end >>>= 0 5285 thisStart >>>= 0 5286 thisEnd >>>= 0 5287 5288 if (this === target) return 0 5289 5290 var x = thisEnd - thisStart 5291 var y = end - start 5292 var len = Math.min(x, y) 5293 5294 var thisCopy = this.slice(thisStart, thisEnd) 5295 var targetCopy = target.slice(start, end) 5296 5297 for (var i = 0; i < len; ++i) { 5298 if (thisCopy[i] !== targetCopy[i]) { 5299 x = thisCopy[i] 5300 y = targetCopy[i] 5301 break 5302 } 5303 } 5304 5305 if (x < y) return -1 5306 if (y < x) return 1 5307 return 0 5308} 5309 5310// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, 5311// OR the last index of `val` in `buffer` at offset <= `byteOffset`. 5312// 5313// Arguments: 5314// - buffer - a Buffer to search 5315// - val - a string, Buffer, or number 5316// - byteOffset - an index into `buffer`; will be clamped to an int32 5317// - encoding - an optional encoding, relevant is val is a string 5318// - dir - true for indexOf, false for lastIndexOf 5319function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { 5320 // Empty buffer means no match 5321 if (buffer.length === 0) return -1 5322 5323 // Normalize byteOffset 5324 if (typeof byteOffset === 'string') { 5325 encoding = byteOffset 5326 byteOffset = 0 5327 } else if (byteOffset > 0x7fffffff) { 5328 byteOffset = 0x7fffffff 5329 } else if (byteOffset < -0x80000000) { 5330 byteOffset = -0x80000000 5331 } 5332 byteOffset = +byteOffset // Coerce to Number. 5333 if (isNaN(byteOffset)) { 5334 // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer 5335 byteOffset = dir ? 0 : (buffer.length - 1) 5336 } 5337 5338 // Normalize byteOffset: negative offsets start from the end of the buffer 5339 if (byteOffset < 0) byteOffset = buffer.length + byteOffset 5340 if (byteOffset >= buffer.length) { 5341 if (dir) return -1 5342 else byteOffset = buffer.length - 1 5343 } else if (byteOffset < 0) { 5344 if (dir) byteOffset = 0 5345 else return -1 5346 } 5347 5348 // Normalize val 5349 if (typeof val === 'string') { 5350 val = Buffer.from(val, encoding) 5351 } 5352 5353 // Finally, search either indexOf (if dir is true) or lastIndexOf 5354 if (Buffer.isBuffer(val)) { 5355 // Special case: looking for empty string/buffer always fails 5356 if (val.length === 0) { 5357 return -1 5358 } 5359 return arrayIndexOf(buffer, val, byteOffset, encoding, dir) 5360 } else if (typeof val === 'number') { 5361 val = val & 0xFF // Search for a byte value [0-255] 5362 if (Buffer.TYPED_ARRAY_SUPPORT && 5363 typeof Uint8Array.prototype.indexOf === 'function') { 5364 if (dir) { 5365 return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) 5366 } else { 5367 return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) 5368 } 5369 } 5370 return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) 5371 } 5372 5373 throw new TypeError('val must be string, number or Buffer') 5374} 5375 5376function arrayIndexOf (arr, val, byteOffset, encoding, dir) { 5377 var indexSize = 1 5378 var arrLength = arr.length 5379 var valLength = val.length 5380 5381 if (encoding !== undefined) { 5382 encoding = String(encoding).toLowerCase() 5383 if (encoding === 'ucs2' || encoding === 'ucs-2' || 5384 encoding === 'utf16le' || encoding === 'utf-16le') { 5385 if (arr.length < 2 || val.length < 2) { 5386 return -1 5387 } 5388 indexSize = 2 5389 arrLength /= 2 5390 valLength /= 2 5391 byteOffset /= 2 5392 } 5393 } 5394 5395 function read (buf, i) { 5396 if (indexSize === 1) { 5397 return buf[i] 5398 } else { 5399 return buf.readUInt16BE(i * indexSize) 5400 } 5401 } 5402 5403 var i 5404 if (dir) { 5405 var foundIndex = -1 5406 for (i = byteOffset; i < arrLength; i++) { 5407 if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { 5408 if (foundIndex === -1) foundIndex = i 5409 if (i - foundIndex + 1 === valLength) return foundIndex * indexSize 5410 } else { 5411 if (foundIndex !== -1) i -= i - foundIndex 5412 foundIndex = -1 5413 } 5414 } 5415 } else { 5416 if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength 5417 for (i = byteOffset; i >= 0; i--) { 5418 var found = true 5419 for (var j = 0; j < valLength; j++) { 5420 if (read(arr, i + j) !== read(val, j)) { 5421 found = false 5422 break 5423 } 5424 } 5425 if (found) return i 5426 } 5427 } 5428 5429 return -1 5430} 5431 5432Buffer.prototype.includes = function includes (val, byteOffset, encoding) { 5433 return this.indexOf(val, byteOffset, encoding) !== -1 5434} 5435 5436Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { 5437 return bidirectionalIndexOf(this, val, byteOffset, encoding, true) 5438} 5439 5440Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { 5441 return bidirectionalIndexOf(this, val, byteOffset, encoding, false) 5442} 5443 5444function hexWrite (buf, string, offset, length) { 5445 offset = Number(offset) || 0 5446 var remaining = buf.length - offset 5447 if (!length) { 5448 length = remaining 5449 } else { 5450 length = Number(length) 5451 if (length > remaining) { 5452 length = remaining 5453 } 5454 } 5455 5456 // must be an even number of digits 5457 var strLen = string.length 5458 if (strLen % 2 !== 0) throw new TypeError('Invalid hex string') 5459 5460 if (length > strLen / 2) { 5461 length = strLen / 2 5462 } 5463 for (var i = 0; i < length; ++i) { 5464 var parsed = parseInt(string.substr(i * 2, 2), 16) 5465 if (isNaN(parsed)) return i 5466 buf[offset + i] = parsed 5467 } 5468 return i 5469} 5470 5471function utf8Write (buf, string, offset, length) { 5472 return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) 5473} 5474 5475function asciiWrite (buf, string, offset, length) { 5476 return blitBuffer(asciiToBytes(string), buf, offset, length) 5477} 5478 5479function latin1Write (buf, string, offset, length) { 5480 return asciiWrite(buf, string, offset, length) 5481} 5482 5483function base64Write (buf, string, offset, length) { 5484 return blitBuffer(base64ToBytes(string), buf, offset, length) 5485} 5486 5487function ucs2Write (buf, string, offset, length) { 5488 return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) 5489} 5490 5491Buffer.prototype.write = function write (string, offset, length, encoding) { 5492 // Buffer#write(string) 5493 if (offset === undefined) { 5494 encoding = 'utf8' 5495 length = this.length 5496 offset = 0 5497 // Buffer#write(string, encoding) 5498 } else if (length === undefined && typeof offset === 'string') { 5499 encoding = offset 5500 length = this.length 5501 offset = 0 5502 // Buffer#write(string, offset[, length][, encoding]) 5503 } else if (isFinite(offset)) { 5504 offset = offset | 0 5505 if (isFinite(length)) { 5506 length = length | 0 5507 if (encoding === undefined) encoding = 'utf8' 5508 } else { 5509 encoding = length 5510 length = undefined 5511 } 5512 // legacy write(string, encoding, offset, length) - remove in v0.13 5513 } else { 5514 throw new Error( 5515 'Buffer.write(string, encoding, offset[, length]) is no longer supported' 5516 ) 5517 } 5518 5519 var remaining = this.length - offset 5520 if (length === undefined || length > remaining) length = remaining 5521 5522 if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { 5523 throw new RangeError('Attempt to write outside buffer bounds') 5524 } 5525 5526 if (!encoding) encoding = 'utf8' 5527 5528 var loweredCase = false 5529 for (;;) { 5530 switch (encoding) { 5531 case 'hex': 5532 return hexWrite(this, string, offset, length) 5533 5534 case 'utf8': 5535 case 'utf-8': 5536 return utf8Write(this, string, offset, length) 5537 5538 case 'ascii': 5539 return asciiWrite(this, string, offset, length) 5540 5541 case 'latin1': 5542 case 'binary': 5543 return latin1Write(this, string, offset, length) 5544 5545 case 'base64': 5546 // Warning: maxLength not taken into account in base64Write 5547 return base64Write(this, string, offset, length) 5548 5549 case 'ucs2': 5550 case 'ucs-2': 5551 case 'utf16le': 5552 case 'utf-16le': 5553 return ucs2Write(this, string, offset, length) 5554 5555 default: 5556 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) 5557 encoding = ('' + encoding).toLowerCase() 5558 loweredCase = true 5559 } 5560 } 5561} 5562 5563Buffer.prototype.toJSON = function toJSON () { 5564 return { 5565 type: 'Buffer', 5566 data: Array.prototype.slice.call(this._arr || this, 0) 5567 } 5568} 5569 5570function base64Slice (buf, start, end) { 5571 if (start === 0 && end === buf.length) { 5572 return base64.fromByteArray(buf) 5573 } else { 5574 return base64.fromByteArray(buf.slice(start, end)) 5575 } 5576} 5577 5578function utf8Slice (buf, start, end) { 5579 end = Math.min(buf.length, end) 5580 var res = [] 5581 5582 var i = start 5583 while (i < end) { 5584 var firstByte = buf[i] 5585 var codePoint = null 5586 var bytesPerSequence = (firstByte > 0xEF) ? 4 5587 : (firstByte > 0xDF) ? 3 5588 : (firstByte > 0xBF) ? 2 5589 : 1 5590 5591 if (i + bytesPerSequence <= end) { 5592 var secondByte, thirdByte, fourthByte, tempCodePoint 5593 5594 switch (bytesPerSequence) { 5595 case 1: 5596 if (firstByte < 0x80) { 5597 codePoint = firstByte 5598 } 5599 break 5600 case 2: 5601 secondByte = buf[i + 1] 5602 if ((secondByte & 0xC0) === 0x80) { 5603 tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) 5604 if (tempCodePoint > 0x7F) { 5605 codePoint = tempCodePoint 5606 } 5607 } 5608 break 5609 case 3: 5610 secondByte = buf[i + 1] 5611 thirdByte = buf[i + 2] 5612 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { 5613 tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) 5614 if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { 5615 codePoint = tempCodePoint 5616 } 5617 } 5618 break 5619 case 4: 5620 secondByte = buf[i + 1] 5621 thirdByte = buf[i + 2] 5622 fourthByte = buf[i + 3] 5623 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { 5624 tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) 5625 if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { 5626 codePoint = tempCodePoint 5627 } 5628 } 5629 } 5630 } 5631 5632 if (codePoint === null) { 5633 // we did not generate a valid codePoint so insert a 5634 // replacement char (U+FFFD) and advance only 1 byte 5635 codePoint = 0xFFFD 5636 bytesPerSequence = 1 5637 } else if (codePoint > 0xFFFF) { 5638 // encode to utf16 (surrogate pair dance) 5639 codePoint -= 0x10000 5640 res.push(codePoint >>> 10 & 0x3FF | 0xD800) 5641 codePoint = 0xDC00 | codePoint & 0x3FF 5642 } 5643 5644 res.push(codePoint) 5645 i += bytesPerSequence 5646 } 5647 5648 return decodeCodePointsArray(res) 5649} 5650 5651// Based on http://stackoverflow.com/a/22747272/680742, the browser with 5652// the lowest limit is Chrome, with 0x10000 args. 5653// We go 1 magnitude less, for safety 5654var MAX_ARGUMENTS_LENGTH = 0x1000 5655 5656function decodeCodePointsArray (codePoints) { 5657 var len = codePoints.length 5658 if (len <= MAX_ARGUMENTS_LENGTH) { 5659 return String.fromCharCode.apply(String, codePoints) // avoid extra slice() 5660 } 5661 5662 // Decode in chunks to avoid "call stack size exceeded". 5663 var res = '' 5664 var i = 0 5665 while (i < len) { 5666 res += String.fromCharCode.apply( 5667 String, 5668 codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) 5669 ) 5670 } 5671 return res 5672} 5673 5674function asciiSlice (buf, start, end) { 5675 var ret = '' 5676 end = Math.min(buf.length, end) 5677 5678 for (var i = start; i < end; ++i) { 5679 ret += String.fromCharCode(buf[i] & 0x7F) 5680 } 5681 return ret 5682} 5683 5684function latin1Slice (buf, start, end) { 5685 var ret = '' 5686 end = Math.min(buf.length, end) 5687 5688 for (var i = start; i < end; ++i) { 5689 ret += String.fromCharCode(buf[i]) 5690 } 5691 return ret 5692} 5693 5694function hexSlice (buf, start, end) { 5695 var len = buf.length 5696 5697 if (!start || start < 0) start = 0 5698 if (!end || end < 0 || end > len) end = len 5699 5700 var out = '' 5701 for (var i = start; i < end; ++i) { 5702 out += toHex(buf[i]) 5703 } 5704 return out 5705} 5706 5707function utf16leSlice (buf, start, end) { 5708 var bytes = buf.slice(start, end) 5709 var res = '' 5710 for (var i = 0; i < bytes.length; i += 2) { 5711 res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) 5712 } 5713 return res 5714} 5715 5716Buffer.prototype.slice = function slice (start, end) { 5717 var len = this.length 5718 start = ~~start 5719 end = end === undefined ? len : ~~end 5720 5721 if (start < 0) { 5722 start += len 5723 if (start < 0) start = 0 5724 } else if (start > len) { 5725 start = len 5726 } 5727 5728 if (end < 0) { 5729 end += len 5730 if (end < 0) end = 0 5731 } else if (end > len) { 5732 end = len 5733 } 5734 5735 if (end < start) end = start 5736 5737 var newBuf 5738 if (Buffer.TYPED_ARRAY_SUPPORT) { 5739 newBuf = this.subarray(start, end) 5740 newBuf.__proto__ = Buffer.prototype 5741 } else { 5742 var sliceLen = end - start 5743 newBuf = new Buffer(sliceLen, undefined) 5744 for (var i = 0; i < sliceLen; ++i) { 5745 newBuf[i] = this[i + start] 5746 } 5747 } 5748 5749 return newBuf 5750} 5751 5752/* 5753 * Need to make sure that buffer isn't trying to write out of bounds. 5754 */ 5755function checkOffset (offset, ext, length) { 5756 if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') 5757 if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') 5758} 5759 5760Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { 5761 offset = offset | 0 5762 byteLength = byteLength | 0 5763 if (!noAssert) checkOffset(offset, byteLength, this.length) 5764 5765 var val = this[offset] 5766 var mul = 1 5767 var i = 0 5768 while (++i < byteLength && (mul *= 0x100)) { 5769 val += this[offset + i] * mul 5770 } 5771 5772 return val 5773} 5774 5775Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { 5776 offset = offset | 0 5777 byteLength = byteLength | 0 5778 if (!noAssert) { 5779 checkOffset(offset, byteLength, this.length) 5780 } 5781 5782 var val = this[offset + --byteLength] 5783 var mul = 1 5784 while (byteLength > 0 && (mul *= 0x100)) { 5785 val += this[offset + --byteLength] * mul 5786 } 5787 5788 return val 5789} 5790 5791Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { 5792 if (!noAssert) checkOffset(offset, 1, this.length) 5793 return this[offset] 5794} 5795 5796Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { 5797 if (!noAssert) checkOffset(offset, 2, this.length) 5798 return this[offset] | (this[offset + 1] << 8) 5799} 5800 5801Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { 5802 if (!noAssert) checkOffset(offset, 2, this.length) 5803 return (this[offset] << 8) | this[offset + 1] 5804} 5805 5806Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { 5807 if (!noAssert) checkOffset(offset, 4, this.length) 5808 5809 return ((this[offset]) | 5810 (this[offset + 1] << 8) | 5811 (this[offset + 2] << 16)) + 5812 (this[offset + 3] * 0x1000000) 5813} 5814 5815Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { 5816 if (!noAssert) checkOffset(offset, 4, this.length) 5817 5818 return (this[offset] * 0x1000000) + 5819 ((this[offset + 1] << 16) | 5820 (this[offset + 2] << 8) | 5821 this[offset + 3]) 5822} 5823 5824Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { 5825 offset = offset | 0 5826 byteLength = byteLength | 0 5827 if (!noAssert) checkOffset(offset, byteLength, this.length) 5828 5829 var val = this[offset] 5830 var mul = 1 5831 var i = 0 5832 while (++i < byteLength && (mul *= 0x100)) { 5833 val += this[offset + i] * mul 5834 } 5835 mul *= 0x80 5836 5837 if (val >= mul) val -= Math.pow(2, 8 * byteLength) 5838 5839 return val 5840} 5841 5842Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { 5843 offset = offset | 0 5844 byteLength = byteLength | 0 5845 if (!noAssert) checkOffset(offset, byteLength, this.length) 5846 5847 var i = byteLength 5848 var mul = 1 5849 var val = this[offset + --i] 5850 while (i > 0 && (mul *= 0x100)) { 5851 val += this[offset + --i] * mul 5852 } 5853 mul *= 0x80 5854 5855 if (val >= mul) val -= Math.pow(2, 8 * byteLength) 5856 5857 return val 5858} 5859 5860Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { 5861 if (!noAssert) checkOffset(offset, 1, this.length) 5862 if (!(this[offset] & 0x80)) return (this[offset]) 5863 return ((0xff - this[offset] + 1) * -1) 5864} 5865 5866Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { 5867 if (!noAssert) checkOffset(offset, 2, this.length) 5868 var val = this[offset] | (this[offset + 1] << 8) 5869 return (val & 0x8000) ? val | 0xFFFF0000 : val 5870} 5871 5872Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { 5873 if (!noAssert) checkOffset(offset, 2, this.length) 5874 var val = this[offset + 1] | (this[offset] << 8) 5875 return (val & 0x8000) ? val | 0xFFFF0000 : val 5876} 5877 5878Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { 5879 if (!noAssert) checkOffset(offset, 4, this.length) 5880 5881 return (this[offset]) | 5882 (this[offset + 1] << 8) | 5883 (this[offset + 2] << 16) | 5884 (this[offset + 3] << 24) 5885} 5886 5887Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { 5888 if (!noAssert) checkOffset(offset, 4, this.length) 5889 5890 return (this[offset] << 24) | 5891 (this[offset + 1] << 16) | 5892 (this[offset + 2] << 8) | 5893 (this[offset + 3]) 5894} 5895 5896Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { 5897 if (!noAssert) checkOffset(offset, 4, this.length) 5898 return ieee754.read(this, offset, true, 23, 4) 5899} 5900 5901Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { 5902 if (!noAssert) checkOffset(offset, 4, this.length) 5903 return ieee754.read(this, offset, false, 23, 4) 5904} 5905 5906Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { 5907 if (!noAssert) checkOffset(offset, 8, this.length) 5908 return ieee754.read(this, offset, true, 52, 8) 5909} 5910 5911Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { 5912 if (!noAssert) checkOffset(offset, 8, this.length) 5913 return ieee754.read(this, offset, false, 52, 8) 5914} 5915 5916function checkInt (buf, value, offset, ext, max, min) { 5917 if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') 5918 if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') 5919 if (offset + ext > buf.length) throw new RangeError('Index out of range') 5920} 5921 5922Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { 5923 value = +value 5924 offset = offset | 0 5925 byteLength = byteLength | 0 5926 if (!noAssert) { 5927 var maxBytes = Math.pow(2, 8 * byteLength) - 1 5928 checkInt(this, value, offset, byteLength, maxBytes, 0) 5929 } 5930 5931 var mul = 1 5932 var i = 0 5933 this[offset] = value & 0xFF 5934 while (++i < byteLength && (mul *= 0x100)) { 5935 this[offset + i] = (value / mul) & 0xFF 5936 } 5937 5938 return offset + byteLength 5939} 5940 5941Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { 5942 value = +value 5943 offset = offset | 0 5944 byteLength = byteLength | 0 5945 if (!noAssert) { 5946 var maxBytes = Math.pow(2, 8 * byteLength) - 1 5947 checkInt(this, value, offset, byteLength, maxBytes, 0) 5948 } 5949 5950 var i = byteLength - 1 5951 var mul = 1 5952 this[offset + i] = value & 0xFF 5953 while (--i >= 0 && (mul *= 0x100)) { 5954 this[offset + i] = (value / mul) & 0xFF 5955 } 5956 5957 return offset + byteLength 5958} 5959 5960Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { 5961 value = +value 5962 offset = offset | 0 5963 if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) 5964 if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) 5965 this[offset] = (value & 0xff) 5966 return offset + 1 5967} 5968 5969function objectWriteUInt16 (buf, value, offset, littleEndian) { 5970 if (value < 0) value = 0xffff + value + 1 5971 for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { 5972 buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> 5973 (littleEndian ? i : 1 - i) * 8 5974 } 5975} 5976 5977Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { 5978 value = +value 5979 offset = offset | 0 5980 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) 5981 if (Buffer.TYPED_ARRAY_SUPPORT) { 5982 this[offset] = (value & 0xff) 5983 this[offset + 1] = (value >>> 8) 5984 } else { 5985 objectWriteUInt16(this, value, offset, true) 5986 } 5987 return offset + 2 5988} 5989 5990Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { 5991 value = +value 5992 offset = offset | 0 5993 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) 5994 if (Buffer.TYPED_ARRAY_SUPPORT) { 5995 this[offset] = (value >>> 8) 5996 this[offset + 1] = (value & 0xff) 5997 } else { 5998 objectWriteUInt16(this, value, offset, false) 5999 } 6000 return offset + 2 6001} 6002 6003function objectWriteUInt32 (buf, value, offset, littleEndian) { 6004 if (value < 0) value = 0xffffffff + value + 1 6005 for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { 6006 buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff 6007 } 6008} 6009 6010Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { 6011 value = +value 6012 offset = offset | 0 6013 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) 6014 if (Buffer.TYPED_ARRAY_SUPPORT) { 6015 this[offset + 3] = (value >>> 24) 6016 this[offset + 2] = (value >>> 16) 6017 this[offset + 1] = (value >>> 8) 6018 this[offset] = (value & 0xff) 6019 } else { 6020 objectWriteUInt32(this, value, offset, true) 6021 } 6022 return offset + 4 6023} 6024 6025Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { 6026 value = +value 6027 offset = offset | 0 6028 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) 6029 if (Buffer.TYPED_ARRAY_SUPPORT) { 6030 this[offset] = (value >>> 24) 6031 this[offset + 1] = (value >>> 16) 6032 this[offset + 2] = (value >>> 8) 6033 this[offset + 3] = (value & 0xff) 6034 } else { 6035 objectWriteUInt32(this, value, offset, false) 6036 } 6037 return offset + 4 6038} 6039 6040Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { 6041 value = +value 6042 offset = offset | 0 6043 if (!noAssert) { 6044 var limit = Math.pow(2, 8 * byteLength - 1) 6045 6046 checkInt(this, value, offset, byteLength, limit - 1, -limit) 6047 } 6048 6049 var i = 0 6050 var mul = 1 6051 var sub = 0 6052 this[offset] = value & 0xFF 6053 while (++i < byteLength && (mul *= 0x100)) { 6054 if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { 6055 sub = 1 6056 } 6057 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF 6058 } 6059 6060 return offset + byteLength 6061} 6062 6063Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { 6064 value = +value 6065 offset = offset | 0 6066 if (!noAssert) { 6067 var limit = Math.pow(2, 8 * byteLength - 1) 6068 6069 checkInt(this, value, offset, byteLength, limit - 1, -limit) 6070 } 6071 6072 var i = byteLength - 1 6073 var mul = 1 6074 var sub = 0 6075 this[offset + i] = value & 0xFF 6076 while (--i >= 0 && (mul *= 0x100)) { 6077 if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { 6078 sub = 1 6079 } 6080 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF 6081 } 6082 6083 return offset + byteLength 6084} 6085 6086Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { 6087 value = +value 6088 offset = offset | 0 6089 if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) 6090 if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) 6091 if (value < 0) value = 0xff + value + 1 6092 this[offset] = (value & 0xff) 6093 return offset + 1 6094} 6095 6096Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { 6097 value = +value 6098 offset = offset | 0 6099 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) 6100 if (Buffer.TYPED_ARRAY_SUPPORT) { 6101 this[offset] = (value & 0xff) 6102 this[offset + 1] = (value >>> 8) 6103 } else { 6104 objectWriteUInt16(this, value, offset, true) 6105 } 6106 return offset + 2 6107} 6108 6109Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { 6110 value = +value 6111 offset = offset | 0 6112 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) 6113 if (Buffer.TYPED_ARRAY_SUPPORT) { 6114 this[offset] = (value >>> 8) 6115 this[offset + 1] = (value & 0xff) 6116 } else { 6117 objectWriteUInt16(this, value, offset, false) 6118 } 6119 return offset + 2 6120} 6121 6122Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { 6123 value = +value 6124 offset = offset | 0 6125 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) 6126 if (Buffer.TYPED_ARRAY_SUPPORT) { 6127 this[offset] = (value & 0xff) 6128 this[offset + 1] = (value >>> 8) 6129 this[offset + 2] = (value >>> 16) 6130 this[offset + 3] = (value >>> 24) 6131 } else { 6132 objectWriteUInt32(this, value, offset, true) 6133 } 6134 return offset + 4 6135} 6136 6137Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { 6138 value = +value 6139 offset = offset | 0 6140 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) 6141 if (value < 0) value = 0xffffffff + value + 1 6142 if (Buffer.TYPED_ARRAY_SUPPORT) { 6143 this[offset] = (value >>> 24) 6144 this[offset + 1] = (value >>> 16) 6145 this[offset + 2] = (value >>> 8) 6146 this[offset + 3] = (value & 0xff) 6147 } else { 6148 objectWriteUInt32(this, value, offset, false) 6149 } 6150 return offset + 4 6151} 6152 6153function checkIEEE754 (buf, value, offset, ext, max, min) { 6154 if (offset + ext > buf.length) throw new RangeError('Index out of range') 6155 if (offset < 0) throw new RangeError('Index out of range') 6156} 6157 6158function writeFloat (buf, value, offset, littleEndian, noAssert) { 6159 if (!noAssert) { 6160 checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) 6161 } 6162 ieee754.write(buf, value, offset, littleEndian, 23, 4) 6163 return offset + 4 6164} 6165 6166Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { 6167 return writeFloat(this, value, offset, true, noAssert) 6168} 6169 6170Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { 6171 return writeFloat(this, value, offset, false, noAssert) 6172} 6173 6174function writeDouble (buf, value, offset, littleEndian, noAssert) { 6175 if (!noAssert) { 6176 checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) 6177 } 6178 ieee754.write(buf, value, offset, littleEndian, 52, 8) 6179 return offset + 8 6180} 6181 6182Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { 6183 return writeDouble(this, value, offset, true, noAssert) 6184} 6185 6186Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { 6187 return writeDouble(this, value, offset, false, noAssert) 6188} 6189 6190// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) 6191Buffer.prototype.copy = function copy (target, targetStart, start, end) { 6192 if (!start) start = 0 6193 if (!end && end !== 0) end = this.length 6194 if (targetStart >= target.length) targetStart = target.length 6195 if (!targetStart) targetStart = 0 6196 if (end > 0 && end < start) end = start 6197 6198 // Copy 0 bytes; we're done 6199 if (end === start) return 0 6200 if (target.length === 0 || this.length === 0) return 0 6201 6202 // Fatal error conditions 6203 if (targetStart < 0) { 6204 throw new RangeError('targetStart out of bounds') 6205 } 6206 if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') 6207 if (end < 0) throw new RangeError('sourceEnd out of bounds') 6208 6209 // Are we oob? 6210 if (end > this.length) end = this.length 6211 if (target.length - targetStart < end - start) { 6212 end = target.length - targetStart + start 6213 } 6214 6215 var len = end - start 6216 var i 6217 6218 if (this === target && start < targetStart && targetStart < end) { 6219 // descending copy from end 6220 for (i = len - 1; i >= 0; --i) { 6221 target[i + targetStart] = this[i + start] 6222 } 6223 } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { 6224 // ascending copy from start 6225 for (i = 0; i < len; ++i) { 6226 target[i + targetStart] = this[i + start] 6227 } 6228 } else { 6229 Uint8Array.prototype.set.call( 6230 target, 6231 this.subarray(start, start + len), 6232 targetStart 6233 ) 6234 } 6235 6236 return len 6237} 6238 6239// Usage: 6240// buffer.fill(number[, offset[, end]]) 6241// buffer.fill(buffer[, offset[, end]]) 6242// buffer.fill(string[, offset[, end]][, encoding]) 6243Buffer.prototype.fill = function fill (val, start, end, encoding) { 6244 // Handle string cases: 6245 if (typeof val === 'string') { 6246 if (typeof start === 'string') { 6247 encoding = start 6248 start = 0 6249 end = this.length 6250 } else if (typeof end === 'string') { 6251 encoding = end 6252 end = this.length 6253 } 6254 if (val.length === 1) { 6255 var code = val.charCodeAt(0) 6256 if (code < 256) { 6257 val = code 6258 } 6259 } 6260 if (encoding !== undefined && typeof encoding !== 'string') { 6261 throw new TypeError('encoding must be a string') 6262 } 6263 if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { 6264 throw new TypeError('Unknown encoding: ' + encoding) 6265 } 6266 } else if (typeof val === 'number') { 6267 val = val & 255 6268 } 6269 6270 // Invalid ranges are not set to a default, so can range check early. 6271 if (start < 0 || this.length < start || this.length < end) { 6272 throw new RangeError('Out of range index') 6273 } 6274 6275 if (end <= start) { 6276 return this 6277 } 6278 6279 start = start >>> 0 6280 end = end === undefined ? this.length : end >>> 0 6281 6282 if (!val) val = 0 6283 6284 var i 6285 if (typeof val === 'number') { 6286 for (i = start; i < end; ++i) { 6287 this[i] = val 6288 } 6289 } else { 6290 var bytes = Buffer.isBuffer(val) 6291 ? val 6292 : utf8ToBytes(new Buffer(val, encoding).toString()) 6293 var len = bytes.length 6294 for (i = 0; i < end - start; ++i) { 6295 this[i + start] = bytes[i % len] 6296 } 6297 } 6298 6299 return this 6300} 6301 6302// HELPER FUNCTIONS 6303// ================ 6304 6305var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g 6306 6307function base64clean (str) { 6308 // Node strips out invalid characters like \n and \t from the string, base64-js does not 6309 str = stringtrim(str).replace(INVALID_BASE64_RE, '') 6310 // Node converts strings with length < 2 to '' 6311 if (str.length < 2) return '' 6312 // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not 6313 while (str.length % 4 !== 0) { 6314 str = str + '=' 6315 } 6316 return str 6317} 6318 6319function stringtrim (str) { 6320 if (str.trim) return str.trim() 6321 return str.replace(/^\s+|\s+$/g, '') 6322} 6323 6324function toHex (n) { 6325 if (n < 16) return '0' + n.toString(16) 6326 return n.toString(16) 6327} 6328 6329function utf8ToBytes (string, units) { 6330 units = units || Infinity 6331 var codePoint 6332 var length = string.length 6333 var leadSurrogate = null 6334 var bytes = [] 6335 6336 for (var i = 0; i < length; ++i) { 6337 codePoint = string.charCodeAt(i) 6338 6339 // is surrogate component 6340 if (codePoint > 0xD7FF && codePoint < 0xE000) { 6341 // last char was a lead 6342 if (!leadSurrogate) { 6343 // no lead yet 6344 if (codePoint > 0xDBFF) { 6345 // unexpected trail 6346 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) 6347 continue 6348 } else if (i + 1 === length) { 6349 // unpaired lead 6350 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) 6351 continue 6352 } 6353 6354 // valid lead 6355 leadSurrogate = codePoint 6356 6357 continue 6358 } 6359 6360 // 2 leads in a row 6361 if (codePoint < 0xDC00) { 6362 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) 6363 leadSurrogate = codePoint 6364 continue 6365 } 6366 6367 // valid surrogate pair 6368 codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 6369 } else if (leadSurrogate) { 6370 // valid bmp char, but last char was a lead 6371 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) 6372 } 6373 6374 leadSurrogate = null 6375 6376 // encode utf8 6377 if (codePoint < 0x80) { 6378 if ((units -= 1) < 0) break 6379 bytes.push(codePoint) 6380 } else if (codePoint < 0x800) { 6381 if ((units -= 2) < 0) break 6382 bytes.push( 6383 codePoint >> 0x6 | 0xC0, 6384 codePoint & 0x3F | 0x80 6385 ) 6386 } else if (codePoint < 0x10000) { 6387 if ((units -= 3) < 0) break 6388 bytes.push( 6389 codePoint >> 0xC | 0xE0, 6390 codePoint >> 0x6 & 0x3F | 0x80, 6391 codePoint & 0x3F | 0x80 6392 ) 6393 } else if (codePoint < 0x110000) { 6394 if ((units -= 4) < 0) break 6395 bytes.push( 6396 codePoint >> 0x12 | 0xF0, 6397 codePoint >> 0xC & 0x3F | 0x80, 6398 codePoint >> 0x6 & 0x3F | 0x80, 6399 codePoint & 0x3F | 0x80 6400 ) 6401 } else { 6402 throw new Error('Invalid code point') 6403 } 6404 } 6405 6406 return bytes 6407} 6408 6409function asciiToBytes (str) { 6410 var byteArray = [] 6411 for (var i = 0; i < str.length; ++i) { 6412 // Node's code seems to be doing this and not & 0x7F.. 6413 byteArray.push(str.charCodeAt(i) & 0xFF) 6414 } 6415 return byteArray 6416} 6417 6418function utf16leToBytes (str, units) { 6419 var c, hi, lo 6420 var byteArray = [] 6421 for (var i = 0; i < str.length; ++i) { 6422 if ((units -= 2) < 0) break 6423 6424 c = str.charCodeAt(i) 6425 hi = c >> 8 6426 lo = c % 256 6427 byteArray.push(lo) 6428 byteArray.push(hi) 6429 } 6430 6431 return byteArray 6432} 6433 6434function base64ToBytes (str) { 6435 return base64.toByteArray(base64clean(str)) 6436} 6437 6438function blitBuffer (src, dst, offset, length) { 6439 for (var i = 0; i < length; ++i) { 6440 if ((i + offset >= dst.length) || (i >= src.length)) break 6441 dst[i + offset] = src[i] 6442 } 6443 return i 6444} 6445 6446function isnan (val) { 6447 return val !== val // eslint-disable-line no-self-compare 6448} 6449 6450 6451/***/ }), 6452
vendor: 2,390 bytes, lines 6453-6547
6453/***/ "./node_modules/ieee754/index.js": 6454/*!***************************************!*\ 6455 !*** ./node_modules/ieee754/index.js ***! 6456 \***************************************/ 6457/***/ ((__unused_webpack_module, exports) => { 6458 6459/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ 6460exports.read = function (buffer, offset, isLE, mLen, nBytes) { 6461 var e, m 6462 var eLen = (nBytes * 8) - mLen - 1 6463 var eMax = (1 << eLen) - 1 6464 var eBias = eMax >> 1 6465 var nBits = -7 6466 var i = isLE ? (nBytes - 1) : 0 6467 var d = isLE ? -1 : 1 6468 var s = buffer[offset + i] 6469 6470 i += d 6471 6472 e = s & ((1 << (-nBits)) - 1) 6473 s >>= (-nBits) 6474 nBits += eLen 6475 for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} 6476 6477 m = e & ((1 << (-nBits)) - 1) 6478 e >>= (-nBits) 6479 nBits += mLen 6480 for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} 6481 6482 if (e === 0) { 6483 e = 1 - eBias 6484 } else if (e === eMax) { 6485 return m ? NaN : ((s ? -1 : 1) * Infinity) 6486 } else { 6487 m = m + Math.pow(2, mLen) 6488 e = e - eBias 6489 } 6490 return (s ? -1 : 1) * m * Math.pow(2, e - mLen) 6491} 6492 6493exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { 6494 var e, m, c 6495 var eLen = (nBytes * 8) - mLen - 1 6496 var eMax = (1 << eLen) - 1 6497 var eBias = eMax >> 1 6498 var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) 6499 var i = isLE ? 0 : (nBytes - 1) 6500 var d = isLE ? 1 : -1 6501 var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 6502 6503 value = Math.abs(value) 6504 6505 if (isNaN(value) || value === Infinity) { 6506 m = isNaN(value) ? 1 : 0 6507 e = eMax 6508 } else { 6509 e = Math.floor(Math.log(value) / Math.LN2) 6510 if (value * (c = Math.pow(2, -e)) < 1) { 6511 e-- 6512 c *= 2 6513 } 6514 if (e + eBias >= 1) { 6515 value += rt / c 6516 } else { 6517 value += rt * Math.pow(2, 1 - eBias) 6518 } 6519 if (value * c >= 2) { 6520 e++ 6521 c /= 2 6522 } 6523 6524 if (e + eBias >= eMax) { 6525 m = 0 6526 e = eMax 6527 } else if (e + eBias >= 1) { 6528 m = ((value * c) - 1) * Math.pow(2, mLen) 6529 e = e + eBias 6530 } else { 6531 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) 6532 e = 0 6533 } 6534 } 6535 6536 for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} 6537 6538 e = (e << mLen) | m 6539 eLen += mLen 6540 for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} 6541 6542 buffer[offset + i - d] |= s * 128 6543} 6544 6545 6546/***/ }), 6547
vendor: 342 bytes, lines 6548-6562
6548/***/ "./node_modules/isarray/index.js": 6549/*!***************************************!*\ 6550 !*** ./node_modules/isarray/index.js ***! 6551 \***************************************/ 6552/***/ ((module) => { 6553 6554var toString = {}.toString; 6555 6556module.exports = Array.isArray || function (arr) { 6557 return toString.call(arr) == '[object Array]'; 6558}; 6559 6560 6561/***/ }), 6562
vendor: 3,270 bytes, lines 6563-6575
6563/***/ "./node_modules/jquery-nice-select/js/jquery.nice-select.min.js": 6564/*!**********************************************************************!*\ 6565 !*** ./node_modules/jquery-nice-select/js/jquery.nice-select.min.js ***! 6566 \**********************************************************************/ 6567/***/ (() => { 6568 6569/* jQuery Nice Select - v1.0 6570 https://github.com/hernansartorio/jquery-nice-select 6571 Made by Hernán Sartorio */ 6572!function(e){e.fn.niceSelect=function(t){function s(t){t.after(e("<div></div>").addClass("nice-select").addClass(t.attr("class")||"").addClass(t.attr("disabled")?"disabled":"").attr("tabindex",t.attr("disabled")?null:"0").html('<span class="current"></span><ul class="list"></ul>'));var s=t.next(),n=t.find("option"),i=t.find("option:selected");s.find(".current").html(i.data("display")||i.text()),n.each(function(t){var n=e(this),i=n.data("display");s.find("ul").append(e("<li></li>").attr("data-value",n.val()).attr("data-display",i||null).addClass("option"+(n.is(":selected")?" selected":"")+(n.is(":disabled")?" disabled":"")).html(n.text()))})}if("string"==typeof t)return"update"==t?this.each(function(){var t=e(this),n=e(this).next(".nice-select"),i=n.hasClass("open");n.length&&(n.remove(),s(t),i&&t.next().trigger("click"))}):"destroy"==t?(this.each(function(){var t=e(this),s=e(this).next(".nice-select");s.length&&(s.remove(),t.css("display",""))}),0==e(".nice-select").length&&e(document).off(".nice_select")):console.log('Method "'+t+'" does not exist.'),this;this.hide(),this.each(function(){var t=e(this);t.next().hasClass("nice-select")||s(t)}),e(document).off(".nice_select"),e(document).on("click.nice_select",".nice-select",function(t){var s=e(this);e(".nice-select").not(s).removeClass("open"),s.toggleClass("open"),s.hasClass("open")?(s.find(".option"),s.find(".focus").removeClass("focus"),s.find(".selected").addClass("focus")):s.focus()}),e(document).on("click.nice_select",function(t){0===e(t.target).closest(".nice-select").length&&e(".nice-select").removeClass("open").find(".option")}),e(document).on("click.nice_select",".nice-select .option:not(.disabled)",function(t){var s=e(this),n=s.closest(".nice-select");n.find(".selected").removeClass("selected"),s.addClass("selected");var i=s.data("display")||s.text();n.find(".current").text(i),n.prev("select").val(s.data("value")).trigger("change")}),e(document).on("keydown.nice_select",".nice-select",function(t){var s=e(this),n=e(s.find(".focus")||s.find(".list .option.selected"));if(32==t.keyCode||13==t.keyCode)return s.hasClass("open")?n.trigger("click"):s.trigger("click"),!1;if(40==t.keyCode){if(s.hasClass("open")){var i=n.nextAll(".option:not(.disabled)").first();i.length>0&&(s.find(".focus").removeClass("focus"),i.addClass("focus"))}else s.trigger("click");return!1}if(38==t.keyCode){if(s.hasClass("open")){var l=n.prevAll(".option:not(.disabled)").first();l.length>0&&(s.find(".focus").removeClass("focus"),l.addClass("focus"))}else s.trigger("click");return!1}if(27==t.keyCode)s.hasClass("open")&&s.trigger("click");else if(9==t.keyCode&&s.hasClass("open"))return!1});var n=document.createElement("a").style;return n.cssText="pointer-events:auto","auto"!==n.pointerEvents&&e("html").addClass("no-csspointerevents"),this}}(jQuery); 6573 6574/***/ }), 6575
vendor: 1,599 bytes, lines 6576-6633
6576/***/ "./node_modules/jquery-ui/ui/keycode.js": 6577/*!**********************************************!*\ 6578 !*** ./node_modules/jquery-ui/ui/keycode.js ***! 6579 \**********************************************/ 6580/***/ ((module, exports, __webpack_require__) => { 6581 6582var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 6583 * jQuery UI Keycode 1.14.1 6584 * https://jqueryui.com 6585 * 6586 * Copyright OpenJS Foundation and other contributors 6587 * Released under the MIT license. 6588 * https://jquery.org/license 6589 */ 6590 6591//>>label: Keycode 6592//>>group: Core 6593//>>description: Provide keycodes as keynames 6594//>>docs: https://api.jqueryui.com/jQuery.ui.keyCode/ 6595 6596( function( factory ) { 6597 "use strict"; 6598 6599 if ( true ) { 6600 6601 // AMD. Register as an anonymous module. 6602 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! ./version */ "./node_modules/jquery-ui/ui/version.js") ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 6603 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 6604 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 6605 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 6606 } else {} 6607} )( function( $ ) { 6608"use strict"; 6609 6610return $.ui.keyCode = { 6611 BACKSPACE: 8, 6612 COMMA: 188, 6613 DELETE: 46, 6614 DOWN: 40, 6615 END: 35, 6616 ENTER: 13, 6617 ESCAPE: 27, 6618 HOME: 36, 6619 LEFT: 37, 6620 PAGE_DOWN: 34, 6621 PAGE_UP: 33, 6622 PERIOD: 190, 6623 RIGHT: 39, 6624 SPACE: 32, 6625 TAB: 9, 6626 UP: 38 6627}; 6628 6629} ); 6630 6631 6632/***/ }), 6633
vendor: 1,031 bytes, lines 6634-6662
6634/***/ "./node_modules/jquery-ui/ui/version.js": 6635/*!**********************************************!*\ 6636 !*** ./node_modules/jquery-ui/ui/version.js ***! 6637 \**********************************************/ 6638/***/ ((module, exports, __webpack_require__) => { 6639 6640var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;( function( factory ) { 6641 "use strict"; 6642 6643 if ( true ) { 6644 6645 // AMD. Register as an anonymous module. 6646 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js") ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 6647 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 6648 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 6649 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 6650 } else {} 6651} )( function( $ ) { 6652"use strict"; 6653 6654$.ui = $.ui || {}; 6655 6656return $.ui.version = "1.14.1"; 6657 6658} ); 6659 6660 6661/***/ }), 6662
vendor: 83,187 bytes, lines 6663-8908
6663/***/ "./node_modules/jquery-ui/ui/widgets/datepicker.js": 6664/*!*********************************************************!*\ 6665 !*** ./node_modules/jquery-ui/ui/widgets/datepicker.js ***! 6666 \*********************************************************/ 6667/***/ ((module, exports, __webpack_require__) => { 6668 6669var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable max-len, camelcase */ 6670/*! 6671 * jQuery UI Datepicker 1.14.1 6672 * https://jqueryui.com 6673 * 6674 * Copyright OpenJS Foundation and other contributors 6675 * Released under the MIT license. 6676 * https://jquery.org/license 6677 */ 6678 6679//>>label: Datepicker 6680//>>group: Widgets 6681//>>description: Displays a calendar from an input or inline for selecting dates. 6682//>>docs: https://api.jqueryui.com/datepicker/ 6683//>>demos: https://jqueryui.com/datepicker/ 6684//>>css.structure: ../../themes/base/core.css 6685//>>css.structure: ../../themes/base/datepicker.css 6686//>>css.theme: ../../themes/base/theme.css 6687 6688( function( factory ) { 6689 "use strict"; 6690 6691 if ( true ) { 6692 6693 // AMD. Register as an anonymous module. 6694 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [ 6695 __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), 6696 __webpack_require__(/*! ../version */ "./node_modules/jquery-ui/ui/version.js"), 6697 __webpack_require__(/*! ../keycode */ "./node_modules/jquery-ui/ui/keycode.js") 6698 ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 6699 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 6700 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 6701 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 6702 } else {} 6703} )( function( $ ) { 6704"use strict"; 6705 6706$.extend( $.ui, { datepicker: { version: "1.14.1" } } ); 6707 6708var datepicker_instActive; 6709 6710function datepicker_getZindex( elem ) { 6711 var position, value; 6712 while ( elem.length && elem[ 0 ] !== document ) { 6713 6714 // Ignore z-index if position is set to a value where z-index is ignored by the browser 6715 // This makes behavior of this function consistent across browsers 6716 // WebKit always returns auto if the element is positioned 6717 position = elem.css( "position" ); 6718 if ( position === "absolute" || position === "relative" || position === "fixed" ) { 6719 6720 // IE returns 0 when zIndex is not specified 6721 // other browsers return a string 6722 // we ignore the case of nested elements with an explicit value of 0 6723 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 6724 value = parseInt( elem.css( "zIndex" ), 10 ); 6725 if ( !isNaN( value ) && value !== 0 ) { 6726 return value; 6727 } 6728 } 6729 elem = elem.parent(); 6730 } 6731 6732 return 0; 6733} 6734 6735/* Date picker manager. 6736 Use the singleton instance of this class, $.datepicker, to interact with the date picker. 6737 Settings for (groups of) date pickers are maintained in an instance object, 6738 allowing multiple different settings on the same page. */ 6739 6740function Datepicker() { 6741 this._curInst = null; // The current instance in use 6742 this._keyEvent = false; // If the last event was a key event 6743 this._disabledInputs = []; // List of date picker inputs that have been disabled 6744 this._datepickerShowing = false; // True if the popup picker is showing , false if not 6745 this._inDialog = false; // True if showing within a "dialog", false if not 6746 this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division 6747 this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class 6748 this._appendClass = "ui-datepicker-append"; // The name of the append marker class 6749 this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class 6750 this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class 6751 this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class 6752 this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class 6753 this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class 6754 this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class 6755 this.regional = []; // Available regional settings, indexed by language code 6756 this.regional[ "" ] = { // Default regional settings 6757 closeText: "Done", // Display text for close link 6758 prevText: "Prev", // Display text for previous month link 6759 nextText: "Next", // Display text for next month link 6760 currentText: "Today", // Display text for current month link 6761 monthNames: [ "January", "February", "March", "April", "May", "June", 6762 "July", "August", "September", "October", "November", "December" ], // Names of months for drop-down and formatting 6763 monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting 6764 dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting 6765 dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting 6766 dayNamesMin: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ], // Column headings for days starting at Sunday 6767 weekHeader: "Wk", // Column header for week of the year 6768 dateFormat: "mm/dd/yy", // See format options on parseDate 6769 firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... 6770 isRTL: false, // True if right-to-left language, false if left-to-right 6771 showMonthAfterYear: false, // True if the year select precedes month, false for month then year 6772 yearSuffix: "", // Additional text to append to the year in the month headers, 6773 selectMonthLabel: "Select month", // Invisible label for month selector 6774 selectYearLabel: "Select year" // Invisible label for year selector 6775 }; 6776 this._defaults = { // Global defaults for all the date picker instances 6777 showOn: "focus", // "focus" for popup on focus, 6778 // "button" for trigger button, or "both" for either 6779 showAnim: "fadeIn", // Name of jQuery animation for popup 6780 showOptions: {}, // Options for enhanced animations 6781 defaultDate: null, // Used when field is blank: actual date, 6782 // +/-number for offset from today, null for today 6783 appendText: "", // Display text following the input box, e.g. showing the format 6784 buttonText: "...", // Text for trigger button 6785 buttonImage: "", // URL for trigger button image 6786 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button 6787 hideIfNoPrevNext: false, // True to hide next/previous month links 6788 // if not applicable, false to just disable them 6789 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links 6790 gotoCurrent: false, // True if today link goes back to current selection instead 6791 changeMonth: false, // True if month can be selected directly, false if only prev/next 6792 changeYear: false, // True if year can be selected directly, false if only prev/next 6793 yearRange: "c-10:c+10", // Range of years to display in drop-down, 6794 // either relative to today's year (-nn:+nn), relative to currently displayed year 6795 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) 6796 showOtherMonths: false, // True to show dates in other months, false to leave blank 6797 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable 6798 showWeek: false, // True to show week of the year, false to not show it 6799 calculateWeek: this.iso8601Week, // How to calculate the week of the year, 6800 // takes a Date and returns the number of the week for it 6801 shortYearCutoff: "+10", // Short year values < this are in the current century, 6802 // > this are in the previous century, 6803 // string value starting with "+" for current year + value 6804 minDate: null, // The earliest selectable date, or null for no limit 6805 maxDate: null, // The latest selectable date, or null for no limit 6806 duration: "fast", // Duration of display/closure 6807 beforeShowDay: null, // Function that takes a date and returns an array with 6808 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", 6809 // [2] = cell title (optional), e.g. $.datepicker.noWeekends 6810 beforeShow: null, // Function that takes an input field and 6811 // returns a set of custom settings for the date picker 6812 onSelect: null, // Define a callback function when a date is selected 6813 onChangeMonthYear: null, // Define a callback function when the month or year is changed 6814 onClose: null, // Define a callback function when the datepicker is closed 6815 onUpdateDatepicker: null, // Define a callback function when the datepicker is updated 6816 numberOfMonths: 1, // Number of months to show at a time 6817 showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) 6818 stepMonths: 1, // Number of months to step back/forward 6819 stepBigMonths: 12, // Number of months to step back/forward for the big links 6820 altField: "", // Selector for an alternate field to store selected dates into 6821 altFormat: "", // The date format to use for the alternate field 6822 constrainInput: true, // The input is constrained by the current date format 6823 showButtonPanel: false, // True to show button panel, false to not show it 6824 autoSize: false, // True to size the input for the date format, false to leave as is 6825 disabled: false // The initial disabled state 6826 }; 6827 $.extend( this._defaults, this.regional[ "" ] ); 6828 this.regional.en = $.extend( true, {}, this.regional[ "" ] ); 6829 this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en ); 6830 this.dpDiv = datepicker_bindHover( $( "<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ); 6831} 6832 6833$.extend( Datepicker.prototype, { 6834 6835 /* Class name added to elements to indicate already configured with a date picker. */ 6836 markerClassName: "hasDatepicker", 6837 6838 //Keep track of the maximum number of rows displayed (see #7043) 6839 maxRows: 4, 6840 6841 // TODO rename to "widget" when switching to widget factory 6842 _widgetDatepicker: function() { 6843 return this.dpDiv; 6844 }, 6845 6846 /* Override the default settings for all instances of the date picker. 6847 * @param settings object - the new settings to use as defaults (anonymous object) 6848 * @return the manager object 6849 */ 6850 setDefaults: function( settings ) { 6851 datepicker_extendRemove( this._defaults, settings || {} ); 6852 return this; 6853 }, 6854 6855 /* Attach the date picker to a jQuery selection. 6856 * @param target element - the target input field or division or span 6857 * @param settings object - the new settings to use for this date picker instance (anonymous) 6858 */ 6859 _attachDatepicker: function( target, settings ) { 6860 var nodeName, inline, inst; 6861 nodeName = target.nodeName.toLowerCase(); 6862 inline = ( nodeName === "div" || nodeName === "span" ); 6863 if ( !target.id ) { 6864 this.uuid += 1; 6865 target.id = "dp" + this.uuid; 6866 } 6867 inst = this._newInst( $( target ), inline ); 6868 inst.settings = $.extend( {}, settings || {} ); 6869 if ( nodeName === "input" ) { 6870 this._connectDatepicker( target, inst ); 6871 } else if ( inline ) { 6872 this._inlineDatepicker( target, inst ); 6873 } 6874 }, 6875 6876 /* Create a new instance object. */ 6877 _newInst: function( target, inline ) { 6878 var id = target[ 0 ].id.replace( /([^A-Za-z0-9_\-])/g, "\\\\$1" ); // escape jQuery meta chars 6879 return { id: id, input: target, // associated target 6880 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection 6881 drawMonth: 0, drawYear: 0, // month being drawn 6882 inline: inline, // is datepicker inline or not 6883 dpDiv: ( !inline ? this.dpDiv : // presentation div 6884 datepicker_bindHover( $( "<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ) ) }; 6885 }, 6886 6887 /* Attach the date picker to an input field. */ 6888 _connectDatepicker: function( target, inst ) { 6889 var input = $( target ); 6890 inst.append = $( [] ); 6891 inst.trigger = $( [] ); 6892 if ( input.hasClass( this.markerClassName ) ) { 6893 return; 6894 } 6895 this._attachments( input, inst ); 6896 input.addClass( this.markerClassName ).on( "keydown", this._doKeyDown ). 6897 on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp ); 6898 this._autoSize( inst ); 6899 $.data( target, "datepicker", inst ); 6900 6901 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) 6902 if ( inst.settings.disabled ) { 6903 this._disableDatepicker( target ); 6904 } 6905 }, 6906 6907 /* Make attachments based on settings. */ 6908 _attachments: function( input, inst ) { 6909 var showOn, buttonText, buttonImage, 6910 appendText = this._get( inst, "appendText" ), 6911 isRTL = this._get( inst, "isRTL" ); 6912 6913 if ( inst.append ) { 6914 inst.append.remove(); 6915 } 6916 if ( appendText ) { 6917 inst.append = $( "<span>" ) 6918 .addClass( this._appendClass ) 6919 .text( appendText ); 6920 input[ isRTL ? "before" : "after" ]( inst.append ); 6921 } 6922 6923 input.off( "focus", this._showDatepicker ); 6924 6925 if ( inst.trigger ) { 6926 inst.trigger.remove(); 6927 } 6928 6929 showOn = this._get( inst, "showOn" ); 6930 if ( showOn === "focus" || showOn === "both" ) { // pop-up date picker when in the marked field 6931 input.on( "focus", this._showDatepicker ); 6932 } 6933 if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked 6934 buttonText = this._get( inst, "buttonText" ); 6935 buttonImage = this._get( inst, "buttonImage" ); 6936 6937 if ( this._get( inst, "buttonImageOnly" ) ) { 6938 inst.trigger = $( "<img>" ) 6939 .addClass( this._triggerClass ) 6940 .attr( { 6941 src: buttonImage, 6942 alt: buttonText, 6943 title: buttonText 6944 } ); 6945 } else { 6946 inst.trigger = $( "<button type='button'>" ) 6947 .addClass( this._triggerClass ); 6948 if ( buttonImage ) { 6949 inst.trigger.html( 6950 $( "<img>" ) 6951 .attr( { 6952 src: buttonImage, 6953 alt: buttonText, 6954 title: buttonText 6955 } ) 6956 ); 6957 } else { 6958 inst.trigger.text( buttonText ); 6959 } 6960 } 6961 6962 input[ isRTL ? "before" : "after" ]( inst.trigger ); 6963 inst.trigger.on( "click", function() { 6964 if ( $.datepicker._datepickerShowing && $.datepicker._lastInput === input[ 0 ] ) { 6965 $.datepicker._hideDatepicker(); 6966 } else if ( $.datepicker._datepickerShowing && $.datepicker._lastInput !== input[ 0 ] ) { 6967 $.datepicker._hideDatepicker(); 6968 $.datepicker._showDatepicker( input[ 0 ] ); 6969 } else { 6970 $.datepicker._showDatepicker( input[ 0 ] ); 6971 } 6972 return false; 6973 } ); 6974 } 6975 }, 6976 6977 /* Apply the maximum length for the date format. */ 6978 _autoSize: function( inst ) { 6979 if ( this._get( inst, "autoSize" ) && !inst.inline ) { 6980 var findMax, max, maxI, i, 6981 date = new Date( 2009, 12 - 1, 20 ), // Ensure double digits 6982 dateFormat = this._get( inst, "dateFormat" ); 6983 6984 if ( dateFormat.match( /[DM]/ ) ) { 6985 findMax = function( names ) { 6986 max = 0; 6987 maxI = 0; 6988 for ( i = 0; i < names.length; i++ ) { 6989 if ( names[ i ].length > max ) { 6990 max = names[ i ].length; 6991 maxI = i; 6992 } 6993 } 6994 return maxI; 6995 }; 6996 date.setMonth( findMax( this._get( inst, ( dateFormat.match( /MM/ ) ? 6997 "monthNames" : "monthNamesShort" ) ) ) ); 6998 date.setDate( findMax( this._get( inst, ( dateFormat.match( /DD/ ) ? 6999 "dayNames" : "dayNamesShort" ) ) ) + 20 - date.getDay() ); 7000 } 7001 inst.input.attr( "size", this._formatDate( inst, date ).length ); 7002 } 7003 }, 7004 7005 /* Attach an inline date picker to a div. */ 7006 _inlineDatepicker: function( target, inst ) { 7007 var divSpan = $( target ); 7008 if ( divSpan.hasClass( this.markerClassName ) ) { 7009 return; 7010 } 7011 divSpan.addClass( this.markerClassName ).append( inst.dpDiv ); 7012 $.data( target, "datepicker", inst ); 7013 this._setDate( inst, this._getDefaultDate( inst ), true ); 7014 this._updateDatepicker( inst ); 7015 this._updateAlternate( inst ); 7016 7017 //If disabled option is true, disable the datepicker before showing it (see ticket #5665) 7018 if ( inst.settings.disabled ) { 7019 this._disableDatepicker( target ); 7020 } 7021 7022 // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements 7023 // https://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height 7024 inst.dpDiv.css( "display", "block" ); 7025 }, 7026 7027 /* Pop-up the date picker in a "dialog" box. 7028 * @param input element - ignored 7029 * @param date string or Date - the initial date to display 7030 * @param onSelect function - the function to call when a date is selected 7031 * @param settings object - update the dialog date picker instance's settings (anonymous object) 7032 * @param pos int[2] - coordinates for the dialog's position within the screen or 7033 * event - with x/y coordinates or 7034 * leave empty for default (screen centre) 7035 * @return the manager object 7036 */ 7037 _dialogDatepicker: function( input, date, onSelect, settings, pos ) { 7038 var id, browserWidth, browserHeight, scrollX, scrollY, 7039 inst = this._dialogInst; // internal instance 7040 7041 if ( !inst ) { 7042 this.uuid += 1; 7043 id = "dp" + this.uuid; 7044 this._dialogInput = $( "<input type='text' id='" + id + 7045 "' style='position: absolute; top: -100px; width: 0px;'/>" ); 7046 this._dialogInput.on( "keydown", this._doKeyDown ); 7047 $( "body" ).append( this._dialogInput ); 7048 inst = this._dialogInst = this._newInst( this._dialogInput, false ); 7049 inst.settings = {}; 7050 $.data( this._dialogInput[ 0 ], "datepicker", inst ); 7051 } 7052 datepicker_extendRemove( inst.settings, settings || {} ); 7053 date = ( date && date.constructor === Date ? this._formatDate( inst, date ) : date ); 7054 this._dialogInput.val( date ); 7055 7056 this._pos = ( pos ? ( pos.length ? pos : [ pos.pageX, pos.pageY ] ) : null ); 7057 if ( !this._pos ) { 7058 browserWidth = document.documentElement.clientWidth; 7059 browserHeight = document.documentElement.clientHeight; 7060 scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; 7061 scrollY = document.documentElement.scrollTop || document.body.scrollTop; 7062 this._pos = // should use actual width/height below 7063 [ ( browserWidth / 2 ) - 100 + scrollX, ( browserHeight / 2 ) - 150 + scrollY ]; 7064 } 7065 7066 // Move input on screen for focus, but hidden behind dialog 7067 this._dialogInput.css( "left", ( this._pos[ 0 ] + 20 ) + "px" ).css( "top", this._pos[ 1 ] + "px" ); 7068 inst.settings.onSelect = onSelect; 7069 this._inDialog = true; 7070 this.dpDiv.addClass( this._dialogClass ); 7071 this._showDatepicker( this._dialogInput[ 0 ] ); 7072 if ( $.blockUI ) { 7073 $.blockUI( this.dpDiv ); 7074 } 7075 $.data( this._dialogInput[ 0 ], "datepicker", inst ); 7076 return this; 7077 }, 7078 7079 /* Detach a datepicker from its control. 7080 * @param target element - the target input field or division or span 7081 */ 7082 _destroyDatepicker: function( target ) { 7083 var nodeName, 7084 $target = $( target ), 7085 inst = $.data( target, "datepicker" ); 7086 7087 if ( !$target.hasClass( this.markerClassName ) ) { 7088 return; 7089 } 7090 7091 nodeName = target.nodeName.toLowerCase(); 7092 $.removeData( target, "datepicker" ); 7093 if ( nodeName === "input" ) { 7094 inst.append.remove(); 7095 inst.trigger.remove(); 7096 $target.removeClass( this.markerClassName ). 7097 off( "focus", this._showDatepicker ). 7098 off( "keydown", this._doKeyDown ). 7099 off( "keypress", this._doKeyPress ). 7100 off( "keyup", this._doKeyUp ); 7101 } else if ( nodeName === "div" || nodeName === "span" ) { 7102 $target.removeClass( this.markerClassName ).empty(); 7103 } 7104 7105 $.datepicker._hideDatepicker(); 7106 if ( datepicker_instActive === inst ) { 7107 datepicker_instActive = null; 7108 this._curInst = null; 7109 } 7110 }, 7111 7112 /* Enable the date picker to a jQuery selection. 7113 * @param target element - the target input field or division or span 7114 */ 7115 _enableDatepicker: function( target ) { 7116 var nodeName, inline, 7117 $target = $( target ), 7118 inst = $.data( target, "datepicker" ); 7119 7120 if ( !$target.hasClass( this.markerClassName ) ) { 7121 return; 7122 } 7123 7124 nodeName = target.nodeName.toLowerCase(); 7125 if ( nodeName === "input" ) { 7126 target.disabled = false; 7127 inst.trigger.filter( "button" ). 7128 each( function() { 7129 this.disabled = false; 7130 } ).end(). 7131 filter( "img" ).css( { opacity: "1.0", cursor: "" } ); 7132 } else if ( nodeName === "div" || nodeName === "span" ) { 7133 inline = $target.children( "." + this._inlineClass ); 7134 inline.children().removeClass( "ui-state-disabled" ); 7135 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). 7136 prop( "disabled", false ); 7137 } 7138 this._disabledInputs = $.map( this._disabledInputs, 7139 7140 // Delete entry 7141 function( value ) { 7142 return ( value === target ? null : value ); 7143 } ); 7144 }, 7145 7146 /* Disable the date picker to a jQuery selection. 7147 * @param target element - the target input field or division or span 7148 */ 7149 _disableDatepicker: function( target ) { 7150 var nodeName, inline, 7151 $target = $( target ), 7152 inst = $.data( target, "datepicker" ); 7153 7154 if ( !$target.hasClass( this.markerClassName ) ) { 7155 return; 7156 } 7157 7158 nodeName = target.nodeName.toLowerCase(); 7159 if ( nodeName === "input" ) { 7160 target.disabled = true; 7161 inst.trigger.filter( "button" ). 7162 each( function() { 7163 this.disabled = true; 7164 } ).end(). 7165 filter( "img" ).css( { opacity: "0.5", cursor: "default" } ); 7166 } else if ( nodeName === "div" || nodeName === "span" ) { 7167 inline = $target.children( "." + this._inlineClass ); 7168 inline.children().addClass( "ui-state-disabled" ); 7169 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). 7170 prop( "disabled", true ); 7171 } 7172 this._disabledInputs = $.map( this._disabledInputs, 7173 7174 // Delete entry 7175 function( value ) { 7176 return ( value === target ? null : value ); 7177 } ); 7178 this._disabledInputs[ this._disabledInputs.length ] = target; 7179 }, 7180 7181 /* Is the first field in a jQuery collection disabled as a datepicker? 7182 * @param target element - the target input field or division or span 7183 * @return boolean - true if disabled, false if enabled 7184 */ 7185 _isDisabledDatepicker: function( target ) { 7186 if ( !target ) { 7187 return false; 7188 } 7189 for ( var i = 0; i < this._disabledInputs.length; i++ ) { 7190 if ( this._disabledInputs[ i ] === target ) { 7191 return true; 7192 } 7193 } 7194 return false; 7195 }, 7196 7197 /* Retrieve the instance data for the target control. 7198 * @param target element - the target input field or division or span 7199 * @return object - the associated instance data 7200 * @throws error if a jQuery problem getting data 7201 */ 7202 _getInst: function( target ) { 7203 try { 7204 return $.data( target, "datepicker" ); 7205 } catch ( err ) { 7206 throw "Missing instance data for this datepicker"; 7207 } 7208 }, 7209 7210 /* Update or retrieve the settings for a date picker attached to an input field or division. 7211 * @param target element - the target input field or division or span 7212 * @param name object - the new settings to update or 7213 * string - the name of the setting to change or retrieve, 7214 * when retrieving also "all" for all instance settings or 7215 * "defaults" for all global defaults 7216 * @param value any - the new value for the setting 7217 * (omit if above is an object or to retrieve a value) 7218 */ 7219 _optionDatepicker: function( target, name, value ) { 7220 var settings, date, minDate, maxDate, 7221 inst = this._getInst( target ); 7222 7223 if ( arguments.length === 2 && typeof name === "string" ) { 7224 return ( name === "defaults" ? $.extend( {}, $.datepicker._defaults ) : 7225 ( inst ? ( name === "all" ? $.extend( {}, inst.settings ) : 7226 this._get( inst, name ) ) : null ) ); 7227 } 7228 7229 settings = name || {}; 7230 if ( typeof name === "string" ) { 7231 settings = {}; 7232 settings[ name ] = value; 7233 } 7234 7235 if ( inst ) { 7236 if ( this._curInst === inst ) { 7237 this._hideDatepicker(); 7238 } 7239 7240 date = this._getDateDatepicker( target, true ); 7241 minDate = this._getMinMaxDate( inst, "min" ); 7242 maxDate = this._getMinMaxDate( inst, "max" ); 7243 datepicker_extendRemove( inst.settings, settings ); 7244 7245 // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided 7246 if ( minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined ) { 7247 inst.settings.minDate = this._formatDate( inst, minDate ); 7248 } 7249 if ( maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined ) { 7250 inst.settings.maxDate = this._formatDate( inst, maxDate ); 7251 } 7252 if ( "disabled" in settings ) { 7253 if ( settings.disabled ) { 7254 this._disableDatepicker( target ); 7255 } else { 7256 this._enableDatepicker( target ); 7257 } 7258 } 7259 this._attachments( $( target ), inst ); 7260 this._autoSize( inst ); 7261 this._setDate( inst, date ); 7262 this._updateAlternate( inst ); 7263 this._updateDatepicker( inst ); 7264 } 7265 }, 7266 7267 // Change method deprecated 7268 _changeDatepicker: function( target, name, value ) { 7269 this._optionDatepicker( target, name, value ); 7270 }, 7271 7272 /* Redraw the date picker attached to an input field or division. 7273 * @param target element - the target input field or division or span 7274 */ 7275 _refreshDatepicker: function( target ) { 7276 var inst = this._getInst( target ); 7277 if ( inst ) { 7278 this._updateDatepicker( inst ); 7279 } 7280 }, 7281 7282 /* Set the dates for a jQuery selection. 7283 * @param target element - the target input field or division or span 7284 * @param date Date - the new date 7285 */ 7286 _setDateDatepicker: function( target, date ) { 7287 var inst = this._getInst( target ); 7288 if ( inst ) { 7289 this._setDate( inst, date ); 7290 this._updateDatepicker( inst ); 7291 this._updateAlternate( inst ); 7292 } 7293 }, 7294 7295 /* Get the date(s) for the first entry in a jQuery selection. 7296 * @param target element - the target input field or division or span 7297 * @param noDefault boolean - true if no default date is to be used 7298 * @return Date - the current date 7299 */ 7300 _getDateDatepicker: function( target, noDefault ) { 7301 var inst = this._getInst( target ); 7302 if ( inst && !inst.inline ) { 7303 this._setDateFromField( inst, noDefault ); 7304 } 7305 return ( inst ? this._getDate( inst ) : null ); 7306 }, 7307 7308 /* Handle keystrokes. */ 7309 _doKeyDown: function( event ) { 7310 var onSelect, dateStr, sel, 7311 inst = $.datepicker._getInst( event.target ), 7312 handled = true, 7313 isRTL = inst.dpDiv.is( ".ui-datepicker-rtl" ); 7314 7315 inst._keyEvent = true; 7316 if ( $.datepicker._datepickerShowing ) { 7317 switch ( event.keyCode ) { 7318 case 9: $.datepicker._hideDatepicker(); 7319 handled = false; 7320 break; // hide on tab out 7321 case 13: sel = $( "td." + $.datepicker._dayOverClass + ":not(." + 7322 $.datepicker._currentClass + ")", inst.dpDiv ); 7323 if ( sel[ 0 ] ) { 7324 $.datepicker._selectDay( event.target, inst.selectedMonth, inst.selectedYear, sel[ 0 ] ); 7325 } 7326 7327 onSelect = $.datepicker._get( inst, "onSelect" ); 7328 if ( onSelect ) { 7329 dateStr = $.datepicker._formatDate( inst ); 7330 7331 // Trigger custom callback 7332 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); 7333 } else { 7334 $.datepicker._hideDatepicker(); 7335 } 7336 7337 return false; // don't submit the form 7338 case 27: $.datepicker._hideDatepicker(); 7339 break; // hide on escape 7340 case 33: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 7341 -$.datepicker._get( inst, "stepBigMonths" ) : 7342 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); 7343 break; // previous month/year on page up/+ ctrl 7344 case 34: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 7345 +$.datepicker._get( inst, "stepBigMonths" ) : 7346 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); 7347 break; // next month/year on page down/+ ctrl 7348 case 35: if ( event.ctrlKey || event.metaKey ) { 7349 $.datepicker._clearDate( event.target ); 7350 } 7351 handled = event.ctrlKey || event.metaKey; 7352 break; // clear on ctrl or command +end 7353 case 36: if ( event.ctrlKey || event.metaKey ) { 7354 $.datepicker._gotoToday( event.target ); 7355 } 7356 handled = event.ctrlKey || event.metaKey; 7357 break; // current on ctrl or command +home 7358 case 37: if ( event.ctrlKey || event.metaKey ) { 7359 $.datepicker._adjustDate( event.target, ( isRTL ? +1 : -1 ), "D" ); 7360 } 7361 handled = event.ctrlKey || event.metaKey; 7362 7363 // -1 day on ctrl or command +left 7364 if ( event.originalEvent.altKey ) { 7365 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 7366 -$.datepicker._get( inst, "stepBigMonths" ) : 7367 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); 7368 } 7369 7370 // next month/year on alt +left on Mac 7371 break; 7372 case 38: if ( event.ctrlKey || event.metaKey ) { 7373 $.datepicker._adjustDate( event.target, -7, "D" ); 7374 } 7375 handled = event.ctrlKey || event.metaKey; 7376 break; // -1 week on ctrl or command +up 7377 case 39: if ( event.ctrlKey || event.metaKey ) { 7378 $.datepicker._adjustDate( event.target, ( isRTL ? -1 : +1 ), "D" ); 7379 } 7380 handled = event.ctrlKey || event.metaKey; 7381 7382 // +1 day on ctrl or command +right 7383 if ( event.originalEvent.altKey ) { 7384 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 7385 +$.datepicker._get( inst, "stepBigMonths" ) : 7386 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); 7387 } 7388 7389 // next month/year on alt +right 7390 break; 7391 case 40: if ( event.ctrlKey || event.metaKey ) { 7392 $.datepicker._adjustDate( event.target, +7, "D" ); 7393 } 7394 handled = event.ctrlKey || event.metaKey; 7395 break; // +1 week on ctrl or command +down 7396 default: handled = false; 7397 } 7398 } else if ( event.keyCode === 36 && event.ctrlKey ) { // display the date picker on ctrl+home 7399 $.datepicker._showDatepicker( this ); 7400 } else { 7401 handled = false; 7402 } 7403 7404 if ( handled ) { 7405 event.preventDefault(); 7406 event.stopPropagation(); 7407 } 7408 }, 7409 7410 /* Filter entered characters - based on date format. */ 7411 _doKeyPress: function( event ) { 7412 var chars, chr, 7413 inst = $.datepicker._getInst( event.target ); 7414 7415 if ( $.datepicker._get( inst, "constrainInput" ) ) { 7416 chars = $.datepicker._possibleChars( $.datepicker._get( inst, "dateFormat" ) ); 7417 chr = String.fromCharCode( event.charCode == null ? event.keyCode : event.charCode ); 7418 return event.ctrlKey || event.metaKey || ( chr < " " || !chars || chars.indexOf( chr ) > -1 ); 7419 } 7420 }, 7421 7422 /* Synchronise manual entry and field/alternate field. */ 7423 _doKeyUp: function( event ) { 7424 var date, 7425 inst = $.datepicker._getInst( event.target ); 7426 7427 if ( inst.input.val() !== inst.lastVal ) { 7428 try { 7429 date = $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ), 7430 ( inst.input ? inst.input.val() : null ), 7431 $.datepicker._getFormatConfig( inst ) ); 7432 7433 if ( date ) { // only if valid 7434 $.datepicker._setDateFromField( inst ); 7435 $.datepicker._updateAlternate( inst ); 7436 $.datepicker._updateDatepicker( inst ); 7437 } 7438 } catch ( err ) { 7439 } 7440 } 7441 return true; 7442 }, 7443 7444 /* Pop-up the date picker for a given input field. 7445 * If false returned from beforeShow event handler do not show. 7446 * @param input element - the input field attached to the date picker or 7447 * event - if triggered by focus 7448 */ 7449 _showDatepicker: function( input ) { 7450 input = input.target || input; 7451 if ( input.nodeName.toLowerCase() !== "input" ) { // find from button/image trigger 7452 input = $( "input", input.parentNode )[ 0 ]; 7453 } 7454 7455 if ( $.datepicker._isDisabledDatepicker( input ) || $.datepicker._lastInput === input ) { // already here 7456 return; 7457 } 7458 7459 var inst, beforeShow, beforeShowSettings, isFixed, 7460 offset, showAnim, duration; 7461 7462 inst = $.datepicker._getInst( input ); 7463 if ( $.datepicker._curInst && $.datepicker._curInst !== inst ) { 7464 $.datepicker._curInst.dpDiv.stop( true, true ); 7465 if ( inst && $.datepicker._datepickerShowing ) { 7466 $.datepicker._hideDatepicker( $.datepicker._curInst.input[ 0 ] ); 7467 } 7468 } 7469 7470 beforeShow = $.datepicker._get( inst, "beforeShow" ); 7471 beforeShowSettings = beforeShow ? beforeShow.apply( input, [ input, inst ] ) : {}; 7472 if ( beforeShowSettings === false ) { 7473 return; 7474 } 7475 datepicker_extendRemove( inst.settings, beforeShowSettings ); 7476 7477 inst.lastVal = null; 7478 $.datepicker._lastInput = input; 7479 $.datepicker._setDateFromField( inst ); 7480 7481 if ( $.datepicker._inDialog ) { // hide cursor 7482 input.value = ""; 7483 } 7484 if ( !$.datepicker._pos ) { // position below input 7485 $.datepicker._pos = $.datepicker._findPos( input ); 7486 $.datepicker._pos[ 1 ] += input.offsetHeight; // add the height 7487 } 7488 7489 isFixed = false; 7490 $( input ).parents().each( function() { 7491 isFixed |= $( this ).css( "position" ) === "fixed"; 7492 return !isFixed; 7493 } ); 7494 7495 offset = { left: $.datepicker._pos[ 0 ], top: $.datepicker._pos[ 1 ] }; 7496 $.datepicker._pos = null; 7497 7498 //to avoid flashes on Firefox 7499 inst.dpDiv.empty(); 7500 7501 // determine sizing offscreen 7502 inst.dpDiv.css( { position: "absolute", display: "block", top: "-1000px" } ); 7503 $.datepicker._updateDatepicker( inst ); 7504 7505 // fix width for dynamic number of date pickers 7506 // and adjust position before showing 7507 offset = $.datepicker._checkOffset( inst, offset, isFixed ); 7508 inst.dpDiv.css( { position: ( $.datepicker._inDialog && $.blockUI ? 7509 "static" : ( isFixed ? "fixed" : "absolute" ) ), display: "none", 7510 left: offset.left + "px", top: offset.top + "px" } ); 7511 7512 if ( !inst.inline ) { 7513 showAnim = $.datepicker._get( inst, "showAnim" ); 7514 duration = $.datepicker._get( inst, "duration" ); 7515 inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 ); 7516 $.datepicker._datepickerShowing = true; 7517 7518 if ( $.effects && $.effects.effect[ showAnim ] ) { 7519 inst.dpDiv.show( showAnim, $.datepicker._get( inst, "showOptions" ), duration ); 7520 } else { 7521 inst.dpDiv[ showAnim || "show" ]( showAnim ? duration : null ); 7522 } 7523 7524 if ( $.datepicker._shouldFocusInput( inst ) ) { 7525 inst.input.trigger( "focus" ); 7526 } 7527 7528 $.datepicker._curInst = inst; 7529 } 7530 }, 7531 7532 /* Generate the date picker content. */ 7533 _updateDatepicker: function( inst ) { 7534 this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) 7535 datepicker_instActive = inst; // for delegate hover events 7536 inst.dpDiv.empty().append( this._generateHTML( inst ) ); 7537 this._attachHandlers( inst ); 7538 7539 var origyearshtml, 7540 numMonths = this._getNumberOfMonths( inst ), 7541 cols = numMonths[ 1 ], 7542 width = 17, 7543 activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" ), 7544 onUpdateDatepicker = $.datepicker._get( inst, "onUpdateDatepicker" ); 7545 7546 if ( activeCell.length > 0 ) { 7547 datepicker_handleMouseover.apply( activeCell.get( 0 ) ); 7548 } 7549 7550 inst.dpDiv.removeClass( "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" ).width( "" ); 7551 if ( cols > 1 ) { 7552 inst.dpDiv.addClass( "ui-datepicker-multi-" + cols ).css( "width", ( width * cols ) + "em" ); 7553 } 7554 inst.dpDiv[ ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ? "add" : "remove" ) + 7555 "Class" ]( "ui-datepicker-multi" ); 7556 inst.dpDiv[ ( this._get( inst, "isRTL" ) ? "add" : "remove" ) + 7557 "Class" ]( "ui-datepicker-rtl" ); 7558 7559 if ( inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) { 7560 inst.input.trigger( "focus" ); 7561 } 7562 7563 // Deffered render of the years select (to avoid flashes on Firefox) 7564 if ( inst.yearshtml ) { 7565 origyearshtml = inst.yearshtml; 7566 setTimeout( function() { 7567 7568 //assure that inst.yearshtml didn't change. 7569 if ( origyearshtml === inst.yearshtml && inst.yearshtml ) { 7570 inst.dpDiv.find( "select.ui-datepicker-year" ).first().replaceWith( inst.yearshtml ); 7571 } 7572 origyearshtml = inst.yearshtml = null; 7573 }, 0 ); 7574 } 7575 7576 if ( onUpdateDatepicker ) { 7577 onUpdateDatepicker.apply( ( inst.input ? inst.input[ 0 ] : null ), [ inst ] ); 7578 } 7579 }, 7580 7581 _shouldFocusInput: function( inst ) { 7582 return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ); 7583 }, 7584 7585 /* Check positioning to remain on screen. */ 7586 _checkOffset: function( inst, offset, isFixed ) { 7587 var dpWidth = inst.dpDiv.outerWidth(), 7588 dpHeight = inst.dpDiv.outerHeight(), 7589 inputWidth = inst.input ? inst.input.outerWidth() : 0, 7590 inputHeight = inst.input ? inst.input.outerHeight() : 0, 7591 viewWidth = document.documentElement.clientWidth + ( isFixed ? 0 : $( document ).scrollLeft() ), 7592 viewHeight = document.documentElement.clientHeight + ( isFixed ? 0 : $( document ).scrollTop() ); 7593 7594 offset.left -= ( this._get( inst, "isRTL" ) ? ( dpWidth - inputWidth ) : 0 ); 7595 offset.left -= ( isFixed && offset.left === inst.input.offset().left ) ? $( document ).scrollLeft() : 0; 7596 offset.top -= ( isFixed && offset.top === ( inst.input.offset().top + inputHeight ) ) ? $( document ).scrollTop() : 0; 7597 7598 // Now check if datepicker is showing outside window viewport - move to a better place if so. 7599 offset.left -= Math.min( offset.left, ( offset.left + dpWidth > viewWidth && viewWidth > dpWidth ) ? 7600 Math.abs( offset.left + dpWidth - viewWidth ) : 0 ); 7601 offset.top -= Math.min( offset.top, ( offset.top + dpHeight > viewHeight && viewHeight > dpHeight ) ? 7602 Math.abs( dpHeight + inputHeight ) : 0 ); 7603 7604 return offset; 7605 }, 7606 7607 /* Find an object's position on the screen. */ 7608 _findPos: function( obj ) { 7609 var position, 7610 inst = this._getInst( obj ), 7611 isRTL = this._get( inst, "isRTL" ); 7612 7613 while ( obj && ( obj.type === "hidden" || obj.nodeType !== 1 || $.expr.pseudos.hidden( obj ) ) ) { 7614 obj = obj[ isRTL ? "previousSibling" : "nextSibling" ]; 7615 } 7616 7617 position = $( obj ).offset(); 7618 return [ position.left, position.top ]; 7619 }, 7620 7621 /* Hide the date picker from view. 7622 * @param input element - the input field attached to the date picker 7623 */ 7624 _hideDatepicker: function( input ) { 7625 var showAnim, duration, postProcess, onClose, 7626 inst = this._curInst; 7627 7628 if ( !inst || ( input && inst !== $.data( input, "datepicker" ) ) ) { 7629 return; 7630 } 7631 7632 if ( this._datepickerShowing ) { 7633 showAnim = this._get( inst, "showAnim" ); 7634 duration = this._get( inst, "duration" ); 7635 postProcess = function() { 7636 $.datepicker._tidyDialog( inst ); 7637 }; 7638 7639 if ( $.effects && ( $.effects.effect[ showAnim ] ) ) { 7640 inst.dpDiv.hide( showAnim, $.datepicker._get( inst, "showOptions" ), duration, postProcess ); 7641 } else { 7642 inst.dpDiv[ ( showAnim === "slideDown" ? "slideUp" : 7643 ( showAnim === "fadeIn" ? "fadeOut" : "hide" ) ) ]( ( showAnim ? duration : null ), postProcess ); 7644 } 7645 7646 if ( !showAnim ) { 7647 postProcess(); 7648 } 7649 this._datepickerShowing = false; 7650 7651 onClose = this._get( inst, "onClose" ); 7652 if ( onClose ) { 7653 onClose.apply( ( inst.input ? inst.input[ 0 ] : null ), [ ( inst.input ? inst.input.val() : "" ), inst ] ); 7654 } 7655 7656 this._lastInput = null; 7657 if ( this._inDialog ) { 7658 this._dialogInput.css( { position: "absolute", left: "0", top: "-100px" } ); 7659 if ( $.blockUI ) { 7660 $.unblockUI(); 7661 $( "body" ).append( this.dpDiv ); 7662 } 7663 } 7664 this._inDialog = false; 7665 } 7666 }, 7667 7668 /* Tidy up after a dialog display. */ 7669 _tidyDialog: function( inst ) { 7670 inst.dpDiv.removeClass( this._dialogClass ).off( ".ui-datepicker-calendar" ); 7671 }, 7672 7673 /* Close date picker if clicked elsewhere. */ 7674 _checkExternalClick: function( event ) { 7675 if ( !$.datepicker._curInst ) { 7676 return; 7677 } 7678 7679 var $target = $( event.target ), 7680 inst = $.datepicker._getInst( $target[ 0 ] ); 7681 7682 if ( ( ( $target[ 0 ].id !== $.datepicker._mainDivId && 7683 $target.parents( "#" + $.datepicker._mainDivId ).length === 0 && 7684 !$target.hasClass( $.datepicker.markerClassName ) && 7685 !$target.closest( "." + $.datepicker._triggerClass ).length && 7686 $.datepicker._datepickerShowing && !( $.datepicker._inDialog && $.blockUI ) ) ) || 7687 ( $target.hasClass( $.datepicker.markerClassName ) && $.datepicker._curInst !== inst ) ) { 7688 $.datepicker._hideDatepicker(); 7689 } 7690 }, 7691 7692 /* Adjust one of the date sub-fields. */ 7693 _adjustDate: function( id, offset, period ) { 7694 var target = $( id ), 7695 inst = this._getInst( target[ 0 ] ); 7696 7697 if ( this._isDisabledDatepicker( target[ 0 ] ) ) { 7698 return; 7699 } 7700 this._adjustInstDate( inst, offset, period ); 7701 this._updateDatepicker( inst ); 7702 }, 7703 7704 /* Action for current link. */ 7705 _gotoToday: function( id ) { 7706 var date, 7707 target = $( id ), 7708 inst = this._getInst( target[ 0 ] ); 7709 7710 if ( this._get( inst, "gotoCurrent" ) && inst.currentDay ) { 7711 inst.selectedDay = inst.currentDay; 7712 inst.drawMonth = inst.selectedMonth = inst.currentMonth; 7713 inst.drawYear = inst.selectedYear = inst.currentYear; 7714 } else { 7715 date = new Date(); 7716 inst.selectedDay = date.getDate(); 7717 inst.drawMonth = inst.selectedMonth = date.getMonth(); 7718 inst.drawYear = inst.selectedYear = date.getFullYear(); 7719 } 7720 this._notifyChange( inst ); 7721 this._adjustDate( target ); 7722 }, 7723 7724 /* Action for selecting a new month/year. */ 7725 _selectMonthYear: function( id, select, period ) { 7726 var target = $( id ), 7727 inst = this._getInst( target[ 0 ] ); 7728 7729 inst[ "selected" + ( period === "M" ? "Month" : "Year" ) ] = 7730 inst[ "draw" + ( period === "M" ? "Month" : "Year" ) ] = 7731 parseInt( select.options[ select.selectedIndex ].value, 10 ); 7732 7733 this._notifyChange( inst ); 7734 this._adjustDate( target ); 7735 }, 7736 7737 /* Action for selecting a day. */ 7738 _selectDay: function( id, month, year, td ) { 7739 var inst, 7740 target = $( id ); 7741 7742 if ( $( td ).hasClass( this._unselectableClass ) || this._isDisabledDatepicker( target[ 0 ] ) ) { 7743 return; 7744 } 7745 7746 inst = this._getInst( target[ 0 ] ); 7747 inst.selectedDay = inst.currentDay = parseInt( $( "a", td ).attr( "data-date" ) ); 7748 inst.selectedMonth = inst.currentMonth = month; 7749 inst.selectedYear = inst.currentYear = year; 7750 this._selectDate( id, this._formatDate( inst, 7751 inst.currentDay, inst.currentMonth, inst.currentYear ) ); 7752 }, 7753 7754 /* Erase the input field and hide the date picker. */ 7755 _clearDate: function( id ) { 7756 var target = $( id ); 7757 this._selectDate( target, "" ); 7758 }, 7759 7760 /* Update the input field with the selected date. */ 7761 _selectDate: function( id, dateStr ) { 7762 var onSelect, 7763 target = $( id ), 7764 inst = this._getInst( target[ 0 ] ); 7765 7766 dateStr = ( dateStr != null ? dateStr : this._formatDate( inst ) ); 7767 if ( inst.input ) { 7768 inst.input.val( dateStr ); 7769 } 7770 this._updateAlternate( inst ); 7771 7772 onSelect = this._get( inst, "onSelect" ); 7773 if ( onSelect ) { 7774 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); // trigger custom callback 7775 } else if ( inst.input ) { 7776 inst.input.trigger( "change" ); // fire the change event 7777 } 7778 7779 if ( inst.inline ) { 7780 this._updateDatepicker( inst ); 7781 } else { 7782 this._hideDatepicker(); 7783 this._lastInput = inst.input[ 0 ]; 7784 if ( typeof( inst.input[ 0 ] ) !== "object" ) { 7785 inst.input.trigger( "focus" ); // restore focus 7786 } 7787 this._lastInput = null; 7788 } 7789 }, 7790 7791 /* Update any alternate field to synchronise with the main field. */ 7792 _updateAlternate: function( inst ) { 7793 var altFormat, date, dateStr, 7794 altField = this._get( inst, "altField" ); 7795 7796 if ( altField ) { // update alternate field too 7797 altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" ); 7798 date = this._getDate( inst ); 7799 dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) ); 7800 $( document ).find( altField ).val( dateStr ); 7801 } 7802 }, 7803 7804 /* Set as beforeShowDay function to prevent selection of weekends. 7805 * @param date Date - the date to customise 7806 * @return [boolean, string] - is this date selectable?, what is its CSS class? 7807 */ 7808 noWeekends: function( date ) { 7809 var day = date.getDay(); 7810 return [ ( day > 0 && day < 6 ), "" ]; 7811 }, 7812 7813 /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. 7814 * @param date Date - the date to get the week for 7815 * @return number - the number of the week within the year that contains this date 7816 */ 7817 iso8601Week: function( date ) { 7818 var time, 7819 checkDate = new Date( date.getTime() ); 7820 7821 // Find Thursday of this week starting on Monday 7822 checkDate.setDate( checkDate.getDate() + 4 - ( checkDate.getDay() || 7 ) ); 7823 7824 time = checkDate.getTime(); 7825 checkDate.setMonth( 0 ); // Compare with Jan 1 7826 checkDate.setDate( 1 ); 7827 return Math.floor( Math.round( ( time - checkDate ) / 86400000 ) / 7 ) + 1; 7828 }, 7829 7830 /* Parse a string value into a date object. 7831 * See formatDate below for the possible formats. 7832 * 7833 * @param format string - the expected format of the date 7834 * @param value string - the date in the above format 7835 * @param settings Object - attributes include: 7836 * shortYearCutoff number - the cutoff year for determining the century (optional) 7837 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 7838 * dayNames string[7] - names of the days from Sunday (optional) 7839 * monthNamesShort string[12] - abbreviated names of the months (optional) 7840 * monthNames string[12] - names of the months (optional) 7841 * @return Date - the extracted date value or null if value is blank 7842 */ 7843 parseDate: function( format, value, settings ) { 7844 if ( format == null || value == null ) { 7845 throw "Invalid arguments"; 7846 } 7847 7848 value = ( typeof value === "object" ? value.toString() : value + "" ); 7849 if ( value === "" ) { 7850 return null; 7851 } 7852 7853 var iFormat, dim, extra, 7854 iValue = 0, 7855 shortYearCutoffTemp = ( settings ? settings.shortYearCutoff : null ) || this._defaults.shortYearCutoff, 7856 shortYearCutoff = ( typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp : 7857 new Date().getFullYear() % 100 + parseInt( shortYearCutoffTemp, 10 ) ), 7858 dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort, 7859 dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames, 7860 monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort, 7861 monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames, 7862 year = -1, 7863 month = -1, 7864 day = -1, 7865 doy = -1, 7866 literal = false, 7867 date, 7868 7869 // Check whether a format character is doubled 7870 lookAhead = function( match ) { 7871 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 7872 if ( matches ) { 7873 iFormat++; 7874 } 7875 return matches; 7876 }, 7877 7878 // Extract a number from the string value 7879 getNumber = function( match ) { 7880 var isDoubled = lookAhead( match ), 7881 size = ( match === "@" ? 14 : ( match === "!" ? 20 : 7882 ( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ), 7883 minSize = ( match === "y" ? size : 1 ), 7884 digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ), 7885 num = value.substring( iValue ).match( digits ); 7886 if ( !num ) { 7887 throw "Missing number at position " + iValue; 7888 } 7889 iValue += num[ 0 ].length; 7890 return parseInt( num[ 0 ], 10 ); 7891 }, 7892 7893 // Extract a name from the string value and convert to an index 7894 getName = function( match, shortNames, longNames ) { 7895 var index = -1, 7896 names = $.map( lookAhead( match ) ? longNames : shortNames, function( v, k ) { 7897 return [ [ k, v ] ]; 7898 } ).sort( function( a, b ) { 7899 return -( a[ 1 ].length - b[ 1 ].length ); 7900 } ); 7901 7902 $.each( names, function( i, pair ) { 7903 var name = pair[ 1 ]; 7904 if ( value.substr( iValue, name.length ).toLowerCase() === name.toLowerCase() ) { 7905 index = pair[ 0 ]; 7906 iValue += name.length; 7907 return false; 7908 } 7909 } ); 7910 if ( index !== -1 ) { 7911 return index + 1; 7912 } else { 7913 throw "Unknown name at position " + iValue; 7914 } 7915 }, 7916 7917 // Confirm that a literal character matches the string value 7918 checkLiteral = function() { 7919 if ( value.charAt( iValue ) !== format.charAt( iFormat ) ) { 7920 throw "Unexpected literal at position " + iValue; 7921 } 7922 iValue++; 7923 }; 7924 7925 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 7926 if ( literal ) { 7927 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 7928 literal = false; 7929 } else { 7930 checkLiteral(); 7931 } 7932 } else { 7933 switch ( format.charAt( iFormat ) ) { 7934 case "d": 7935 day = getNumber( "d" ); 7936 break; 7937 case "D": 7938 getName( "D", dayNamesShort, dayNames ); 7939 break; 7940 case "o": 7941 doy = getNumber( "o" ); 7942 break; 7943 case "m": 7944 month = getNumber( "m" ); 7945 break; 7946 case "M": 7947 month = getName( "M", monthNamesShort, monthNames ); 7948 break; 7949 case "y": 7950 year = getNumber( "y" ); 7951 break; 7952 case "@": 7953 date = new Date( getNumber( "@" ) ); 7954 year = date.getFullYear(); 7955 month = date.getMonth() + 1; 7956 day = date.getDate(); 7957 break; 7958 case "!": 7959 date = new Date( ( getNumber( "!" ) - this._ticksTo1970 ) / 10000 ); 7960 year = date.getFullYear(); 7961 month = date.getMonth() + 1; 7962 day = date.getDate(); 7963 break; 7964 case "'": 7965 if ( lookAhead( "'" ) ) { 7966 checkLiteral(); 7967 } else { 7968 literal = true; 7969 } 7970 break; 7971 default: 7972 checkLiteral(); 7973 } 7974 } 7975 } 7976 7977 if ( iValue < value.length ) { 7978 extra = value.substr( iValue ); 7979 if ( !/^\s+/.test( extra ) ) { 7980 throw "Extra/unparsed characters found in date: " + extra; 7981 } 7982 } 7983 7984 if ( year === -1 ) { 7985 year = new Date().getFullYear(); 7986 } else if ( year < 100 ) { 7987 year += new Date().getFullYear() - new Date().getFullYear() % 100 + 7988 ( year <= shortYearCutoff ? 0 : -100 ); 7989 } 7990 7991 if ( doy > -1 ) { 7992 month = 1; 7993 day = doy; 7994 do { 7995 dim = this._getDaysInMonth( year, month - 1 ); 7996 if ( day <= dim ) { 7997 break; 7998 } 7999 month++; 8000 day -= dim; 8001 } while ( true ); 8002 } 8003 8004 date = this._daylightSavingAdjust( new Date( year, month - 1, day ) ); 8005 if ( date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day ) { 8006 throw "Invalid date"; // E.g. 31/02/00 8007 } 8008 return date; 8009 }, 8010 8011 /* Standard date formats. */ 8012 ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) 8013 COOKIE: "D, dd M yy", 8014 ISO_8601: "yy-mm-dd", 8015 RFC_822: "D, d M y", 8016 RFC_850: "DD, dd-M-y", 8017 RFC_1036: "D, d M y", 8018 RFC_1123: "D, d M yy", 8019 RFC_2822: "D, d M yy", 8020 RSS: "D, d M y", // RFC 822 8021 TICKS: "!", 8022 TIMESTAMP: "@", 8023 W3C: "yy-mm-dd", // ISO 8601 8024 8025 _ticksTo1970: ( ( ( 1970 - 1 ) * 365 + Math.floor( 1970 / 4 ) - Math.floor( 1970 / 100 ) + 8026 Math.floor( 1970 / 400 ) ) * 24 * 60 * 60 * 10000000 ), 8027 8028 /* Format a date object into a string value. 8029 * The format can be combinations of the following: 8030 * d - day of month (no leading zero) 8031 * dd - day of month (two digit) 8032 * o - day of year (no leading zeros) 8033 * oo - day of year (three digit) 8034 * D - day name short 8035 * DD - day name long 8036 * m - month of year (no leading zero) 8037 * mm - month of year (two digit) 8038 * M - month name short 8039 * MM - month name long 8040 * y - year (two digit) 8041 * yy - year (four digit) 8042 * @ - Unix timestamp (ms since 01/01/1970) 8043 * ! - Windows ticks (100ns since 01/01/0001) 8044 * "..." - literal text 8045 * '' - single quote 8046 * 8047 * @param format string - the desired format of the date 8048 * @param date Date - the date value to format 8049 * @param settings Object - attributes include: 8050 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 8051 * dayNames string[7] - names of the days from Sunday (optional) 8052 * monthNamesShort string[12] - abbreviated names of the months (optional) 8053 * monthNames string[12] - names of the months (optional) 8054 * @return string - the date in the above format 8055 */ 8056 formatDate: function( format, date, settings ) { 8057 if ( !date ) { 8058 return ""; 8059 } 8060 8061 var iFormat, 8062 dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort, 8063 dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames, 8064 monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort, 8065 monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames, 8066 8067 // Check whether a format character is doubled 8068 lookAhead = function( match ) { 8069 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 8070 if ( matches ) { 8071 iFormat++; 8072 } 8073 return matches; 8074 }, 8075 8076 // Format a number, with leading zero if necessary 8077 formatNumber = function( match, value, len ) { 8078 var num = "" + value; 8079 if ( lookAhead( match ) ) { 8080 while ( num.length < len ) { 8081 num = "0" + num; 8082 } 8083 } 8084 return num; 8085 }, 8086 8087 // Format a name, short or long as requested 8088 formatName = function( match, value, shortNames, longNames ) { 8089 return ( lookAhead( match ) ? longNames[ value ] : shortNames[ value ] ); 8090 }, 8091 output = "", 8092 literal = false; 8093 8094 if ( date ) { 8095 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 8096 if ( literal ) { 8097 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 8098 literal = false; 8099 } else { 8100 output += format.charAt( iFormat ); 8101 } 8102 } else { 8103 switch ( format.charAt( iFormat ) ) { 8104 case "d": 8105 output += formatNumber( "d", date.getDate(), 2 ); 8106 break; 8107 case "D": 8108 output += formatName( "D", date.getDay(), dayNamesShort, dayNames ); 8109 break; 8110 case "o": 8111 output += formatNumber( "o", 8112 Math.round( ( new Date( date.getFullYear(), date.getMonth(), date.getDate() ).getTime() - new Date( date.getFullYear(), 0, 0 ).getTime() ) / 86400000 ), 3 ); 8113 break; 8114 case "m": 8115 output += formatNumber( "m", date.getMonth() + 1, 2 ); 8116 break; 8117 case "M": 8118 output += formatName( "M", date.getMonth(), monthNamesShort, monthNames ); 8119 break; 8120 case "y": 8121 output += ( lookAhead( "y" ) ? date.getFullYear() : 8122 ( date.getFullYear() % 100 < 10 ? "0" : "" ) + date.getFullYear() % 100 ); 8123 break; 8124 case "@": 8125 output += date.getTime(); 8126 break; 8127 case "!": 8128 output += date.getTime() * 10000 + this._ticksTo1970; 8129 break; 8130 case "'": 8131 if ( lookAhead( "'" ) ) { 8132 output += "'"; 8133 } else { 8134 literal = true; 8135 } 8136 break; 8137 default: 8138 output += format.charAt( iFormat ); 8139 } 8140 } 8141 } 8142 } 8143 return output; 8144 }, 8145 8146 /* Extract all possible characters from the date format. */ 8147 _possibleChars: function( format ) { 8148 var iFormat, 8149 chars = "", 8150 literal = false, 8151 8152 // Check whether a format character is doubled 8153 lookAhead = function( match ) { 8154 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 8155 if ( matches ) { 8156 iFormat++; 8157 } 8158 return matches; 8159 }; 8160 8161 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 8162 if ( literal ) { 8163 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 8164 literal = false; 8165 } else { 8166 chars += format.charAt( iFormat ); 8167 } 8168 } else { 8169 switch ( format.charAt( iFormat ) ) { 8170 case "d": case "m": case "y": case "@": 8171 chars += "0123456789"; 8172 break; 8173 case "D": case "M": 8174 return null; // Accept anything 8175 case "'": 8176 if ( lookAhead( "'" ) ) { 8177 chars += "'"; 8178 } else { 8179 literal = true; 8180 } 8181 break; 8182 default: 8183 chars += format.charAt( iFormat ); 8184 } 8185 } 8186 } 8187 return chars; 8188 }, 8189 8190 /* Get a setting value, defaulting if necessary. */ 8191 _get: function( inst, name ) { 8192 return inst.settings[ name ] !== undefined ? 8193 inst.settings[ name ] : this._defaults[ name ]; 8194 }, 8195 8196 /* Parse existing date and initialise date picker. */ 8197 _setDateFromField: function( inst, noDefault ) { 8198 if ( inst.input.val() === inst.lastVal ) { 8199 return; 8200 } 8201 8202 var dateFormat = this._get( inst, "dateFormat" ), 8203 dates = inst.lastVal = inst.input ? inst.input.val() : null, 8204 defaultDate = this._getDefaultDate( inst ), 8205 date = defaultDate, 8206 settings = this._getFormatConfig( inst ); 8207 8208 try { 8209 date = this.parseDate( dateFormat, dates, settings ) || defaultDate; 8210 } catch ( event ) { 8211 dates = ( noDefault ? "" : dates ); 8212 } 8213 inst.selectedDay = date.getDate(); 8214 inst.drawMonth = inst.selectedMonth = date.getMonth(); 8215 inst.drawYear = inst.selectedYear = date.getFullYear(); 8216 inst.currentDay = ( dates ? date.getDate() : 0 ); 8217 inst.currentMonth = ( dates ? date.getMonth() : 0 ); 8218 inst.currentYear = ( dates ? date.getFullYear() : 0 ); 8219 this._adjustInstDate( inst ); 8220 }, 8221 8222 /* Retrieve the default date shown on opening. */ 8223 _getDefaultDate: function( inst ) { 8224 return this._restrictMinMax( inst, 8225 this._determineDate( inst, this._get( inst, "defaultDate" ), new Date() ) ); 8226 }, 8227 8228 /* A date may be specified as an exact value or a relative one. */ 8229 _determineDate: function( inst, date, defaultDate ) { 8230 var offsetNumeric = function( offset ) { 8231 var date = new Date(); 8232 date.setDate( date.getDate() + offset ); 8233 return date; 8234 }, 8235 offsetString = function( offset ) { 8236 try { 8237 return $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ), 8238 offset, $.datepicker._getFormatConfig( inst ) ); 8239 } catch ( e ) { 8240 8241 // Ignore 8242 } 8243 8244 var date = ( offset.toLowerCase().match( /^c/ ) ? 8245 $.datepicker._getDate( inst ) : null ) || new Date(), 8246 year = date.getFullYear(), 8247 month = date.getMonth(), 8248 day = date.getDate(), 8249 pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, 8250 matches = pattern.exec( offset ); 8251 8252 while ( matches ) { 8253 switch ( matches[ 2 ] || "d" ) { 8254 case "d" : case "D" : 8255 day += parseInt( matches[ 1 ], 10 ); break; 8256 case "w" : case "W" : 8257 day += parseInt( matches[ 1 ], 10 ) * 7; break; 8258 case "m" : case "M" : 8259 month += parseInt( matches[ 1 ], 10 ); 8260 day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) ); 8261 break; 8262 case "y": case "Y" : 8263 year += parseInt( matches[ 1 ], 10 ); 8264 day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) ); 8265 break; 8266 } 8267 matches = pattern.exec( offset ); 8268 } 8269 return new Date( year, month, day ); 8270 }, 8271 newDate = ( date == null || date === "" ? defaultDate : ( typeof date === "string" ? offsetString( date ) : 8272 ( typeof date === "number" ? ( isNaN( date ) ? defaultDate : offsetNumeric( date ) ) : new Date( date.getTime() ) ) ) ); 8273 8274 newDate = ( newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate ); 8275 if ( newDate ) { 8276 newDate.setHours( 0 ); 8277 newDate.setMinutes( 0 ); 8278 newDate.setSeconds( 0 ); 8279 newDate.setMilliseconds( 0 ); 8280 } 8281 return this._daylightSavingAdjust( newDate ); 8282 }, 8283 8284 /* Handle switch to/from daylight saving. 8285 * Hours may be non-zero on daylight saving cut-over: 8286 * > 12 when midnight changeover, but then cannot generate 8287 * midnight datetime, so jump to 1AM, otherwise reset. 8288 * @param date (Date) the date to check 8289 * @return (Date) the corrected date 8290 */ 8291 _daylightSavingAdjust: function( date ) { 8292 if ( !date ) { 8293 return null; 8294 } 8295 date.setHours( date.getHours() > 12 ? date.getHours() + 2 : 0 ); 8296 return date; 8297 }, 8298 8299 /* Set the date(s) directly. */ 8300 _setDate: function( inst, date, noChange ) { 8301 var clear = !date, 8302 origMonth = inst.selectedMonth, 8303 origYear = inst.selectedYear, 8304 newDate = this._restrictMinMax( inst, this._determineDate( inst, date, new Date() ) ); 8305 8306 inst.selectedDay = inst.currentDay = newDate.getDate(); 8307 inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); 8308 inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); 8309 if ( ( origMonth !== inst.selectedMonth || origYear !== inst.selectedYear ) && !noChange ) { 8310 this._notifyChange( inst ); 8311 } 8312 this._adjustInstDate( inst ); 8313 if ( inst.input ) { 8314 inst.input.val( clear ? "" : this._formatDate( inst ) ); 8315 } 8316 }, 8317 8318 /* Retrieve the date(s) directly. */ 8319 _getDate: function( inst ) { 8320 var startDate = ( !inst.currentYear || ( inst.input && inst.input.val() === "" ) ? null : 8321 this._daylightSavingAdjust( new Date( 8322 inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); 8323 return startDate; 8324 }, 8325 8326 /* Attach the onxxx handlers. These are declared statically so 8327 * they work with static code transformers like Caja. 8328 */ 8329 _attachHandlers: function( inst ) { 8330 var stepMonths = this._get( inst, "stepMonths" ), 8331 id = "#" + inst.id.replace( /\\\\/g, "\\" ); 8332 inst.dpDiv.find( "[data-handler]" ).map( function() { 8333 var handler = { 8334 prev: function() { 8335 $.datepicker._adjustDate( id, -stepMonths, "M" ); 8336 }, 8337 next: function() { 8338 $.datepicker._adjustDate( id, +stepMonths, "M" ); 8339 }, 8340 hide: function() { 8341 $.datepicker._hideDatepicker(); 8342 }, 8343 today: function() { 8344 $.datepicker._gotoToday( id ); 8345 }, 8346 selectDay: function() { 8347 $.datepicker._selectDay( id, +this.getAttribute( "data-month" ), +this.getAttribute( "data-year" ), this ); 8348 return false; 8349 }, 8350 selectMonth: function() { 8351 $.datepicker._selectMonthYear( id, this, "M" ); 8352 return false; 8353 }, 8354 selectYear: function() { 8355 $.datepicker._selectMonthYear( id, this, "Y" ); 8356 return false; 8357 } 8358 }; 8359 $( this ).on( this.getAttribute( "data-event" ), handler[ this.getAttribute( "data-handler" ) ] ); 8360 } ); 8361 }, 8362 8363 /* Generate the HTML for the current state of the date picker. */ 8364 _generateHTML: function( inst ) { 8365 var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, 8366 controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin, 8367 monthNames, monthNamesShort, beforeShowDay, showOtherMonths, 8368 selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, 8369 cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows, 8370 printDate, dRow, tbody, daySettings, otherMonth, unselectable, 8371 tempDate = new Date(), 8372 today = this._daylightSavingAdjust( 8373 new Date( tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate() ) ), // clear time 8374 isRTL = this._get( inst, "isRTL" ), 8375 showButtonPanel = this._get( inst, "showButtonPanel" ), 8376 hideIfNoPrevNext = this._get( inst, "hideIfNoPrevNext" ), 8377 navigationAsDateFormat = this._get( inst, "navigationAsDateFormat" ), 8378 numMonths = this._getNumberOfMonths( inst ), 8379 showCurrentAtPos = this._get( inst, "showCurrentAtPos" ), 8380 stepMonths = this._get( inst, "stepMonths" ), 8381 isMultiMonth = ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ), 8382 currentDate = this._daylightSavingAdjust( ( !inst.currentDay ? new Date( 9999, 9, 9 ) : 8383 new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ), 8384 minDate = this._getMinMaxDate( inst, "min" ), 8385 maxDate = this._getMinMaxDate( inst, "max" ), 8386 drawMonth = inst.drawMonth - showCurrentAtPos, 8387 drawYear = inst.drawYear; 8388 8389 if ( drawMonth < 0 ) { 8390 drawMonth += 12; 8391 drawYear--; 8392 } 8393 if ( maxDate ) { 8394 maxDraw = this._daylightSavingAdjust( new Date( maxDate.getFullYear(), 8395 maxDate.getMonth() - ( numMonths[ 0 ] * numMonths[ 1 ] ) + 1, maxDate.getDate() ) ); 8396 maxDraw = ( minDate && maxDraw < minDate ? minDate : maxDraw ); 8397 while ( this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 ) ) > maxDraw ) { 8398 drawMonth--; 8399 if ( drawMonth < 0 ) { 8400 drawMonth = 11; 8401 drawYear--; 8402 } 8403 } 8404 } 8405 inst.drawMonth = drawMonth; 8406 inst.drawYear = drawYear; 8407 8408 prevText = this._get( inst, "prevText" ); 8409 prevText = ( !navigationAsDateFormat ? prevText : this.formatDate( prevText, 8410 this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ), 8411 this._getFormatConfig( inst ) ) ); 8412 8413 if ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ) { 8414 prev = $( "<a>" ) 8415 .attr( { 8416 "class": "ui-datepicker-prev ui-corner-all", 8417 "data-handler": "prev", 8418 "data-event": "click", 8419 title: prevText 8420 } ) 8421 .append( 8422 $( "<span>" ) 8423 .addClass( "ui-icon ui-icon-circle-triangle-" + 8424 ( isRTL ? "e" : "w" ) ) 8425 .text( prevText ) 8426 )[ 0 ].outerHTML; 8427 } else if ( hideIfNoPrevNext ) { 8428 prev = ""; 8429 } else { 8430 prev = $( "<a>" ) 8431 .attr( { 8432 "class": "ui-datepicker-prev ui-corner-all ui-state-disabled", 8433 title: prevText 8434 } ) 8435 .append( 8436 $( "<span>" ) 8437 .addClass( "ui-icon ui-icon-circle-triangle-" + 8438 ( isRTL ? "e" : "w" ) ) 8439 .text( prevText ) 8440 )[ 0 ].outerHTML; 8441 } 8442 8443 nextText = this._get( inst, "nextText" ); 8444 nextText = ( !navigationAsDateFormat ? nextText : this.formatDate( nextText, 8445 this._daylightSavingAdjust( new Date( drawYear, drawMonth + stepMonths, 1 ) ), 8446 this._getFormatConfig( inst ) ) ); 8447 8448 if ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ) { 8449 next = $( "<a>" ) 8450 .attr( { 8451 "class": "ui-datepicker-next ui-corner-all", 8452 "data-handler": "next", 8453 "data-event": "click", 8454 title: nextText 8455 } ) 8456 .append( 8457 $( "<span>" ) 8458 .addClass( "ui-icon ui-icon-circle-triangle-" + 8459 ( isRTL ? "w" : "e" ) ) 8460 .text( nextText ) 8461 )[ 0 ].outerHTML; 8462 } else if ( hideIfNoPrevNext ) { 8463 next = ""; 8464 } else { 8465 next = $( "<a>" ) 8466 .attr( { 8467 "class": "ui-datepicker-next ui-corner-all ui-state-disabled", 8468 title: nextText 8469 } ) 8470 .append( 8471 $( "<span>" ) 8472 .attr( "class", "ui-icon ui-icon-circle-triangle-" + 8473 ( isRTL ? "w" : "e" ) ) 8474 .text( nextText ) 8475 )[ 0 ].outerHTML; 8476 } 8477 8478 currentText = this._get( inst, "currentText" ); 8479 gotoDate = ( this._get( inst, "gotoCurrent" ) && inst.currentDay ? currentDate : today ); 8480 currentText = ( !navigationAsDateFormat ? currentText : 8481 this.formatDate( currentText, gotoDate, this._getFormatConfig( inst ) ) ); 8482 8483 controls = ""; 8484 if ( !inst.inline ) { 8485 controls = $( "<button>" ) 8486 .attr( { 8487 type: "button", 8488 "class": "ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all", 8489 "data-handler": "hide", 8490 "data-event": "click" 8491 } ) 8492 .text( this._get( inst, "closeText" ) )[ 0 ].outerHTML; 8493 } 8494 8495 buttonPanel = ""; 8496 if ( showButtonPanel ) { 8497 buttonPanel = $( "<div class='ui-datepicker-buttonpane ui-widget-content'>" ) 8498 .append( isRTL ? controls : "" ) 8499 .append( this._isInRange( inst, gotoDate ) ? 8500 $( "<button>" ) 8501 .attr( { 8502 type: "button", 8503 "class": "ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all", 8504 "data-handler": "today", 8505 "data-event": "click" 8506 } ) 8507 .text( currentText ) : 8508 "" ) 8509 .append( isRTL ? "" : controls )[ 0 ].outerHTML; 8510 } 8511 8512 firstDay = parseInt( this._get( inst, "firstDay" ), 10 ); 8513 firstDay = ( isNaN( firstDay ) ? 0 : firstDay ); 8514 8515 showWeek = this._get( inst, "showWeek" ); 8516 dayNames = this._get( inst, "dayNames" ); 8517 dayNamesMin = this._get( inst, "dayNamesMin" ); 8518 monthNames = this._get( inst, "monthNames" ); 8519 monthNamesShort = this._get( inst, "monthNamesShort" ); 8520 beforeShowDay = this._get( inst, "beforeShowDay" ); 8521 showOtherMonths = this._get( inst, "showOtherMonths" ); 8522 selectOtherMonths = this._get( inst, "selectOtherMonths" ); 8523 defaultDate = this._getDefaultDate( inst ); 8524 html = ""; 8525 8526 for ( row = 0; row < numMonths[ 0 ]; row++ ) { 8527 group = ""; 8528 this.maxRows = 4; 8529 for ( col = 0; col < numMonths[ 1 ]; col++ ) { 8530 selectedDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, inst.selectedDay ) ); 8531 cornerClass = " ui-corner-all"; 8532 calender = ""; 8533 if ( isMultiMonth ) { 8534 calender += "<div class='ui-datepicker-group"; 8535 if ( numMonths[ 1 ] > 1 ) { 8536 switch ( col ) { 8537 case 0: calender += " ui-datepicker-group-first"; 8538 cornerClass = " ui-corner-" + ( isRTL ? "right" : "left" ); break; 8539 case numMonths[ 1 ] - 1: calender += " ui-datepicker-group-last"; 8540 cornerClass = " ui-corner-" + ( isRTL ? "left" : "right" ); break; 8541 default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break; 8542 } 8543 } 8544 calender += "'>"; 8545 } 8546 calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + 8547 ( /all|left/.test( cornerClass ) && row === 0 ? ( isRTL ? next : prev ) : "" ) + 8548 ( /all|right/.test( cornerClass ) && row === 0 ? ( isRTL ? prev : next ) : "" ) + 8549 this._generateMonthYearHeader( inst, drawMonth, drawYear, minDate, maxDate, 8550 row > 0 || col > 0, monthNames, monthNamesShort ) + // draw month headers 8551 "</div><table class='ui-datepicker-calendar'><thead>" + 8552 "<tr>"; 8553 thead = ( showWeek ? "<th class='ui-datepicker-week-col'>" + this._get( inst, "weekHeader" ) + "</th>" : "" ); 8554 for ( dow = 0; dow < 7; dow++ ) { // days of the week 8555 day = ( dow + firstDay ) % 7; 8556 thead += "<th scope='col'" + ( ( dow + firstDay + 6 ) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "" ) + ">" + 8557 "<span title='" + dayNames[ day ] + "'>" + dayNamesMin[ day ] + "</span></th>"; 8558 } 8559 calender += thead + "</tr></thead><tbody>"; 8560 daysInMonth = this._getDaysInMonth( drawYear, drawMonth ); 8561 if ( drawYear === inst.selectedYear && drawMonth === inst.selectedMonth ) { 8562 inst.selectedDay = Math.min( inst.selectedDay, daysInMonth ); 8563 } 8564 leadDays = ( this._getFirstDayOfMonth( drawYear, drawMonth ) - firstDay + 7 ) % 7; 8565 curRows = Math.ceil( ( leadDays + daysInMonth ) / 7 ); // calculate the number of rows to generate 8566 numRows = ( isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows ); //If multiple months, use the higher number of rows (see #7043) 8567 this.maxRows = numRows; 8568 printDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 - leadDays ) ); 8569 for ( dRow = 0; dRow < numRows; dRow++ ) { // create date picker rows 8570 calender += "<tr>"; 8571 tbody = ( !showWeek ? "" : "<td class='ui-datepicker-week-col'>" + 8572 this._get( inst, "calculateWeek" )( printDate ) + "</td>" ); 8573 for ( dow = 0; dow < 7; dow++ ) { // create date picker days 8574 daySettings = ( beforeShowDay ? 8575 beforeShowDay.apply( ( inst.input ? inst.input[ 0 ] : null ), [ printDate ] ) : [ true, "" ] ); 8576 otherMonth = ( printDate.getMonth() !== drawMonth ); 8577 unselectable = ( otherMonth && !selectOtherMonths ) || !daySettings[ 0 ] || 8578 ( minDate && printDate < minDate ) || ( maxDate && printDate > maxDate ); 8579 tbody += "<td class='" + 8580 ( ( dow + firstDay + 6 ) % 7 >= 5 ? " ui-datepicker-week-end" : "" ) + // highlight weekends 8581 ( otherMonth ? " ui-datepicker-other-month" : "" ) + // highlight days from other months 8582 ( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key 8583 ( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ? 8584 8585 // or defaultDate is current printedDate and defaultDate is selectedDate 8586 " " + this._dayOverClass : "" ) + // highlight selected day 8587 ( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) + // highlight unselectable days 8588 ( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates 8589 ( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day 8590 ( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different) 8591 ( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "'" ) + "'" : "" ) + // cell title 8592 ( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions 8593 ( otherMonth && !showOtherMonths ? " " : // display for other months 8594 ( unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + 8595 ( printDate.getTime() === today.getTime() ? " ui-state-highlight" : "" ) + 8596 ( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day 8597 ( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months 8598 "' href='#' aria-current='" + ( printDate.getTime() === currentDate.getTime() ? "true" : "false" ) + // mark date as selected for screen reader 8599 "' data-date='" + printDate.getDate() + // store date as data 8600 "'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date 8601 printDate.setDate( printDate.getDate() + 1 ); 8602 printDate = this._daylightSavingAdjust( printDate ); 8603 } 8604 calender += tbody + "</tr>"; 8605 } 8606 drawMonth++; 8607 if ( drawMonth > 11 ) { 8608 drawMonth = 0; 8609 drawYear++; 8610 } 8611 calender += "</tbody></table>" + ( isMultiMonth ? "</div>" + 8612 ( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "<div class='ui-datepicker-row-break'></div>" : "" ) : "" ); 8613 group += calender; 8614 } 8615 html += group; 8616 } 8617 html += buttonPanel; 8618 inst._keyEvent = false; 8619 return html; 8620 }, 8621 8622 /* Generate the month and year header. */ 8623 _generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate, 8624 secondary, monthNames, monthNamesShort ) { 8625 8626 var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, 8627 changeMonth = this._get( inst, "changeMonth" ), 8628 changeYear = this._get( inst, "changeYear" ), 8629 showMonthAfterYear = this._get( inst, "showMonthAfterYear" ), 8630 selectMonthLabel = this._get( inst, "selectMonthLabel" ), 8631 selectYearLabel = this._get( inst, "selectYearLabel" ), 8632 html = "<div class='ui-datepicker-title'>", 8633 monthHtml = ""; 8634 8635 // Month selection 8636 if ( secondary || !changeMonth ) { 8637 monthHtml += "<span class='ui-datepicker-month'>" + monthNames[ drawMonth ] + "</span>"; 8638 } else { 8639 inMinYear = ( minDate && minDate.getFullYear() === drawYear ); 8640 inMaxYear = ( maxDate && maxDate.getFullYear() === drawYear ); 8641 monthHtml += "<select class='ui-datepicker-month' aria-label='" + selectMonthLabel + "' data-handler='selectMonth' data-event='change'>"; 8642 for ( month = 0; month < 12; month++ ) { 8643 if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) { 8644 monthHtml += "<option value='" + month + "'" + 8645 ( month === drawMonth ? " selected='selected'" : "" ) + 8646 ">" + monthNamesShort[ month ] + "</option>"; 8647 } 8648 } 8649 monthHtml += "</select>"; 8650 } 8651 8652 if ( !showMonthAfterYear ) { 8653 html += monthHtml + ( secondary || !( changeMonth && changeYear ) ? " " : "" ); 8654 } 8655 8656 // Year selection 8657 if ( !inst.yearshtml ) { 8658 inst.yearshtml = ""; 8659 if ( secondary || !changeYear ) { 8660 html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; 8661 } else { 8662 8663 // determine range of years to display 8664 years = this._get( inst, "yearRange" ).split( ":" ); 8665 thisYear = new Date().getFullYear(); 8666 determineYear = function( value ) { 8667 var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) : 8668 ( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) : 8669 parseInt( value, 10 ) ) ); 8670 return ( isNaN( year ) ? thisYear : year ); 8671 }; 8672 year = determineYear( years[ 0 ] ); 8673 endYear = Math.max( year, determineYear( years[ 1 ] || "" ) ); 8674 year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year ); 8675 endYear = ( maxDate ? Math.min( endYear, maxDate.getFullYear() ) : endYear ); 8676 inst.yearshtml += "<select class='ui-datepicker-year' aria-label='" + selectYearLabel + "' data-handler='selectYear' data-event='change'>"; 8677 for ( ; year <= endYear; year++ ) { 8678 inst.yearshtml += "<option value='" + year + "'" + 8679 ( year === drawYear ? " selected='selected'" : "" ) + 8680 ">" + year + "</option>"; 8681 } 8682 inst.yearshtml += "</select>"; 8683 8684 html += inst.yearshtml; 8685 inst.yearshtml = null; 8686 } 8687 } 8688 8689 html += this._get( inst, "yearSuffix" ); 8690 if ( showMonthAfterYear ) { 8691 html += ( secondary || !( changeMonth && changeYear ) ? " " : "" ) + monthHtml; 8692 } 8693 html += "</div>"; // Close datepicker_header 8694 return html; 8695 }, 8696 8697 /* Adjust one of the date sub-fields. */ 8698 _adjustInstDate: function( inst, offset, period ) { 8699 var year = inst.selectedYear + ( period === "Y" ? offset : 0 ), 8700 month = inst.selectedMonth + ( period === "M" ? offset : 0 ), 8701 day = Math.min( inst.selectedDay, this._getDaysInMonth( year, month ) ) + ( period === "D" ? offset : 0 ), 8702 date = this._restrictMinMax( inst, this._daylightSavingAdjust( new Date( year, month, day ) ) ); 8703 8704 inst.selectedDay = date.getDate(); 8705 inst.drawMonth = inst.selectedMonth = date.getMonth(); 8706 inst.drawYear = inst.selectedYear = date.getFullYear(); 8707 if ( period === "M" || period === "Y" ) { 8708 this._notifyChange( inst ); 8709 } 8710 }, 8711 8712 /* Ensure a date is within any min/max bounds. */ 8713 _restrictMinMax: function( inst, date ) { 8714 var minDate = this._getMinMaxDate( inst, "min" ), 8715 maxDate = this._getMinMaxDate( inst, "max" ), 8716 newDate = ( minDate && date < minDate ? minDate : date ); 8717 return ( maxDate && newDate > maxDate ? maxDate : newDate ); 8718 }, 8719 8720 /* Notify change of month/year. */ 8721 _notifyChange: function( inst ) { 8722 var onChange = this._get( inst, "onChangeMonthYear" ); 8723 if ( onChange ) { 8724 onChange.apply( ( inst.input ? inst.input[ 0 ] : null ), 8725 [ inst.selectedYear, inst.selectedMonth + 1, inst ] ); 8726 } 8727 }, 8728 8729 /* Determine the number of months to show. */ 8730 _getNumberOfMonths: function( inst ) { 8731 var numMonths = this._get( inst, "numberOfMonths" ); 8732 return ( numMonths == null ? [ 1, 1 ] : ( typeof numMonths === "number" ? [ 1, numMonths ] : numMonths ) ); 8733 }, 8734 8735 /* Determine the current maximum date - ensure no time components are set. */ 8736 _getMinMaxDate: function( inst, minMax ) { 8737 return this._determineDate( inst, this._get( inst, minMax + "Date" ), null ); 8738 }, 8739 8740 /* Find the number of days in a given month. */ 8741 _getDaysInMonth: function( year, month ) { 8742 return 32 - this._daylightSavingAdjust( new Date( year, month, 32 ) ).getDate(); 8743 }, 8744 8745 /* Find the day of the week of the first of a month. */ 8746 _getFirstDayOfMonth: function( year, month ) { 8747 return new Date( year, month, 1 ).getDay(); 8748 }, 8749 8750 /* Determines if we should allow a "next/prev" month display change. */ 8751 _canAdjustMonth: function( inst, offset, curYear, curMonth ) { 8752 var numMonths = this._getNumberOfMonths( inst ), 8753 date = this._daylightSavingAdjust( new Date( curYear, 8754 curMonth + ( offset < 0 ? offset : numMonths[ 0 ] * numMonths[ 1 ] ), 1 ) ); 8755 8756 if ( offset < 0 ) { 8757 date.setDate( this._getDaysInMonth( date.getFullYear(), date.getMonth() ) ); 8758 } 8759 return this._isInRange( inst, date ); 8760 }, 8761 8762 /* Is the given date in the accepted range? */ 8763 _isInRange: function( inst, date ) { 8764 var yearSplit, currentYear, 8765 minDate = this._getMinMaxDate( inst, "min" ), 8766 maxDate = this._getMinMaxDate( inst, "max" ), 8767 minYear = null, 8768 maxYear = null, 8769 years = this._get( inst, "yearRange" ); 8770 if ( years ) { 8771 yearSplit = years.split( ":" ); 8772 currentYear = new Date().getFullYear(); 8773 minYear = parseInt( yearSplit[ 0 ], 10 ); 8774 maxYear = parseInt( yearSplit[ 1 ], 10 ); 8775 if ( yearSplit[ 0 ].match( /[+\-].*/ ) ) { 8776 minYear += currentYear; 8777 } 8778 if ( yearSplit[ 1 ].match( /[+\-].*/ ) ) { 8779 maxYear += currentYear; 8780 } 8781 } 8782 8783 return ( ( !minDate || date.getTime() >= minDate.getTime() ) && 8784 ( !maxDate || date.getTime() <= maxDate.getTime() ) && 8785 ( !minYear || date.getFullYear() >= minYear ) && 8786 ( !maxYear || date.getFullYear() <= maxYear ) ); 8787 }, 8788 8789 /* Provide the configuration settings for formatting/parsing. */ 8790 _getFormatConfig: function( inst ) { 8791 var shortYearCutoff = this._get( inst, "shortYearCutoff" ); 8792 shortYearCutoff = ( typeof shortYearCutoff !== "string" ? shortYearCutoff : 8793 new Date().getFullYear() % 100 + parseInt( shortYearCutoff, 10 ) ); 8794 return { shortYearCutoff: shortYearCutoff, 8795 dayNamesShort: this._get( inst, "dayNamesShort" ), dayNames: this._get( inst, "dayNames" ), 8796 monthNamesShort: this._get( inst, "monthNamesShort" ), monthNames: this._get( inst, "monthNames" ) }; 8797 }, 8798 8799 /* Format the given date for display. */ 8800 _formatDate: function( inst, day, month, year ) { 8801 if ( !day ) { 8802 inst.currentDay = inst.selectedDay; 8803 inst.currentMonth = inst.selectedMonth; 8804 inst.currentYear = inst.selectedYear; 8805 } 8806 var date = ( day ? ( typeof day === "object" ? day : 8807 this._daylightSavingAdjust( new Date( year, month, day ) ) ) : 8808 this._daylightSavingAdjust( new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); 8809 return this.formatDate( this._get( inst, "dateFormat" ), date, this._getFormatConfig( inst ) ); 8810 } 8811} ); 8812 8813/* 8814 * Bind hover events for datepicker elements. 8815 * Done via delegate so the binding only occurs once in the lifetime of the parent div. 8816 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. 8817 */ 8818function datepicker_bindHover( dpDiv ) { 8819 var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; 8820 return dpDiv.on( "mouseout", selector, function() { 8821 $( this ).removeClass( "ui-state-hover" ); 8822 if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { 8823 $( this ).removeClass( "ui-datepicker-prev-hover" ); 8824 } 8825 if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { 8826 $( this ).removeClass( "ui-datepicker-next-hover" ); 8827 } 8828 } ) 8829 .on( "mouseover", selector, datepicker_handleMouseover ); 8830} 8831 8832function datepicker_handleMouseover() { 8833 if ( !$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ] : datepicker_instActive.input[ 0 ] ) ) { 8834 $( this ).parents( ".ui-datepicker-calendar" ).find( "a" ).removeClass( "ui-state-hover" ); 8835 $( this ).addClass( "ui-state-hover" ); 8836 if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { 8837 $( this ).addClass( "ui-datepicker-prev-hover" ); 8838 } 8839 if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { 8840 $( this ).addClass( "ui-datepicker-next-hover" ); 8841 } 8842 } 8843} 8844 8845/* jQuery extend now ignores nulls! */ 8846function datepicker_extendRemove( target, props ) { 8847 $.extend( target, props ); 8848 for ( var name in props ) { 8849 if ( props[ name ] == null ) { 8850 target[ name ] = props[ name ]; 8851 } 8852 } 8853 return target; 8854} 8855 8856/* Invoke the datepicker functionality. 8857 @param options string - a command, optionally followed by additional parameters or 8858 Object - settings for attaching new datepicker functionality 8859 @return jQuery object */ 8860$.fn.datepicker = function( options ) { 8861 8862 /* Verify an empty collection wasn't passed - Fixes #6976 */ 8863 if ( !this.length ) { 8864 return this; 8865 } 8866 8867 /* Initialise the date picker. */ 8868 if ( !$.datepicker.initialized ) { 8869 $( document ).on( "mousedown", $.datepicker._checkExternalClick ); 8870 $.datepicker.initialized = true; 8871 } 8872 8873 /* Append datepicker main container to body if not exist. */ 8874 if ( $( "#" + $.datepicker._mainDivId ).length === 0 ) { 8875 $( "body" ).append( $.datepicker.dpDiv ); 8876 } 8877 8878 var otherArgs = Array.prototype.slice.call( arguments, 1 ); 8879 if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) { 8880 return $.datepicker[ "_" + options + "Datepicker" ]. 8881 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); 8882 } 8883 if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) { 8884 return $.datepicker[ "_" + options + "Datepicker" ]. 8885 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); 8886 } 8887 return this.each( function() { 8888 if ( typeof options === "string" ) { 8889 $.datepicker[ "_" + options + "Datepicker" ] 8890 .apply( $.datepicker, [ this ].concat( otherArgs ) ); 8891 } else { 8892 $.datepicker._attachDatepicker( this, options ); 8893 } 8894 } ); 8895}; 8896 8897$.datepicker = new Datepicker(); // singleton instance 8898$.datepicker.initialized = false; 8899$.datepicker.uuid = new Date().getTime(); 8900$.datepicker.version = "1.14.1"; 8901 8902return $.datepicker; 8903 8904} ); 8905 8906 8907/***/ }), 8908
vendor: 285,755 bytes, lines 8909-19635
8909/***/ "./node_modules/jquery/dist/jquery.js": 8910/*!********************************************!*\ 8911 !*** ./node_modules/jquery/dist/jquery.js ***! 8912 \********************************************/ 8913/***/ (function(module, exports) { 8914 8915var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 8916 * jQuery JavaScript Library v3.7.1 8917 * https://jquery.com/ 8918 * 8919 * Copyright OpenJS Foundation and other contributors 8920 * Released under the MIT license 8921 * https://jquery.org/license 8922 * 8923 * Date: 2023-08-28T13:37Z 8924 */ 8925( function( global, factory ) { 8926 8927 "use strict"; 8928 8929 if ( true && typeof module.exports === "object" ) { 8930 8931 // For CommonJS and CommonJS-like environments where a proper `window` 8932 // is present, execute the factory and get jQuery. 8933 // For environments that do not have a `window` with a `document` 8934 // (such as Node.js), expose a factory as module.exports. 8935 // This accentuates the need for the creation of a real `window`. 8936 // e.g. var jQuery = require("jquery")(window); 8937 // See ticket trac-14549 for more info. 8938 module.exports = global.document ? 8939 factory( global, true ) : 8940 function( w ) { 8941 if ( !w.document ) { 8942 throw new Error( "jQuery requires a window with a document" ); 8943 } 8944 return factory( w ); 8945 }; 8946 } else { 8947 factory( global ); 8948 } 8949 8950// Pass this if window is not defined yet 8951} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 8952 8953// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 8954// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 8955// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common 8956// enough that all such attempts are guarded in a try block. 8957"use strict"; 8958 8959var arr = []; 8960 8961var getProto = Object.getPrototypeOf; 8962 8963var slice = arr.slice; 8964 8965var flat = arr.flat ? function( array ) { 8966 return arr.flat.call( array ); 8967} : function( array ) { 8968 return arr.concat.apply( [], array ); 8969}; 8970 8971 8972var push = arr.push; 8973 8974var indexOf = arr.indexOf; 8975 8976var class2type = {}; 8977 8978var toString = class2type.toString; 8979 8980var hasOwn = class2type.hasOwnProperty; 8981 8982var fnToString = hasOwn.toString; 8983 8984var ObjectFunctionString = fnToString.call( Object ); 8985 8986var support = {}; 8987 8988var isFunction = function isFunction( obj ) { 8989 8990 // Support: Chrome <=57, Firefox <=52 8991 // In some browsers, typeof returns "function" for HTML <object> elements 8992 // (i.e., `typeof document.createElement( "object" ) === "function"`). 8993 // We don't want to classify *any* DOM node as a function. 8994 // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 8995 // Plus for old WebKit, typeof returns "function" for HTML collections 8996 // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) 8997 return typeof obj === "function" && typeof obj.nodeType !== "number" && 8998 typeof obj.item !== "function"; 8999 }; 9000 9001 9002var isWindow = function isWindow( obj ) { 9003 return obj != null && obj === obj.window; 9004 }; 9005 9006 9007var document = window.document; 9008 9009 9010 9011 var preservedScriptAttributes = { 9012 type: true, 9013 src: true, 9014 nonce: true, 9015 noModule: true 9016 }; 9017 9018 function DOMEval( code, node, doc ) { 9019 doc = doc || document; 9020 9021 var i, val, 9022 script = doc.createElement( "script" ); 9023 9024 script.text = code; 9025 if ( node ) { 9026 for ( i in preservedScriptAttributes ) { 9027 9028 // Support: Firefox 64+, Edge 18+ 9029 // Some browsers don't support the "nonce" property on scripts. 9030 // On the other hand, just using `getAttribute` is not enough as 9031 // the `nonce` attribute is reset to an empty string whenever it 9032 // becomes browsing-context connected. 9033 // See https://github.com/whatwg/html/issues/2369 9034 // See https://html.spec.whatwg.org/#nonce-attributes 9035 // The `node.getAttribute` check was added for the sake of 9036 // `jQuery.globalEval` so that it can fake a nonce-containing node 9037 // via an object. 9038 val = node[ i ] || node.getAttribute && node.getAttribute( i ); 9039 if ( val ) { 9040 script.setAttribute( i, val ); 9041 } 9042 } 9043 } 9044 doc.head.appendChild( script ).parentNode.removeChild( script ); 9045 } 9046 9047 9048function toType( obj ) { 9049 if ( obj == null ) { 9050 return obj + ""; 9051 } 9052 9053 // Support: Android <=2.3 only (functionish RegExp) 9054 return typeof obj === "object" || typeof obj === "function" ? 9055 class2type[ toString.call( obj ) ] || "object" : 9056 typeof obj; 9057} 9058/* global Symbol */ 9059// Defining this global in .eslintrc.json would create a danger of using the global 9060// unguarded in another place, it seems safer to define global only for this module 9061 9062 9063 9064var version = "3.7.1", 9065 9066 rhtmlSuffix = /HTML$/i, 9067 9068 // Define a local copy of jQuery 9069 jQuery = function( selector, context ) { 9070 9071 // The jQuery object is actually just the init constructor 'enhanced' 9072 // Need init if jQuery is called (just allow error to be thrown if not included) 9073 return new jQuery.fn.init( selector, context ); 9074 }; 9075 9076jQuery.fn = jQuery.prototype = { 9077 9078 // The current version of jQuery being used 9079 jquery: version, 9080 9081 constructor: jQuery, 9082 9083 // The default length of a jQuery object is 0 9084 length: 0, 9085 9086 toArray: function() { 9087 return slice.call( this ); 9088 }, 9089 9090 // Get the Nth element in the matched element set OR 9091 // Get the whole matched element set as a clean array 9092 get: function( num ) { 9093 9094 // Return all the elements in a clean array 9095 if ( num == null ) { 9096 return slice.call( this ); 9097 } 9098 9099 // Return just the one element from the set 9100 return num < 0 ? this[ num + this.length ] : this[ num ]; 9101 }, 9102 9103 // Take an array of elements and push it onto the stack 9104 // (returning the new matched element set) 9105 pushStack: function( elems ) { 9106 9107 // Build a new jQuery matched element set 9108 var ret = jQuery.merge( this.constructor(), elems ); 9109 9110 // Add the old object onto the stack (as a reference) 9111 ret.prevObject = this; 9112 9113 // Return the newly-formed element set 9114 return ret; 9115 }, 9116 9117 // Execute a callback for every element in the matched set. 9118 each: function( callback ) { 9119 return jQuery.each( this, callback ); 9120 }, 9121 9122 map: function( callback ) { 9123 return this.pushStack( jQuery.map( this, function( elem, i ) { 9124 return callback.call( elem, i, elem ); 9125 } ) ); 9126 }, 9127 9128 slice: function() { 9129 return this.pushStack( slice.apply( this, arguments ) ); 9130 }, 9131 9132 first: function() { 9133 return this.eq( 0 ); 9134 }, 9135 9136 last: function() { 9137 return this.eq( -1 ); 9138 }, 9139 9140 even: function() { 9141 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 9142 return ( i + 1 ) % 2; 9143 } ) ); 9144 }, 9145 9146 odd: function() { 9147 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 9148 return i % 2; 9149 } ) ); 9150 }, 9151 9152 eq: function( i ) { 9153 var len = this.length, 9154 j = +i + ( i < 0 ? len : 0 ); 9155 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 9156 }, 9157 9158 end: function() { 9159 return this.prevObject || this.constructor(); 9160 }, 9161 9162 // For internal use only. 9163 // Behaves like an Array's method, not like a jQuery method. 9164 push: push, 9165 sort: arr.sort, 9166 splice: arr.splice 9167}; 9168 9169jQuery.extend = jQuery.fn.extend = function() { 9170 var options, name, src, copy, copyIsArray, clone, 9171 target = arguments[ 0 ] || {}, 9172 i = 1, 9173 length = arguments.length, 9174 deep = false; 9175 9176 // Handle a deep copy situation 9177 if ( typeof target === "boolean" ) { 9178 deep = target; 9179 9180 // Skip the boolean and the target 9181 target = arguments[ i ] || {}; 9182 i++; 9183 } 9184 9185 // Handle case when target is a string or something (possible in deep copy) 9186 if ( typeof target !== "object" && !isFunction( target ) ) { 9187 target = {}; 9188 } 9189 9190 // Extend jQuery itself if only one argument is passed 9191 if ( i === length ) { 9192 target = this; 9193 i--; 9194 } 9195 9196 for ( ; i < length; i++ ) { 9197 9198 // Only deal with non-null/undefined values 9199 if ( ( options = arguments[ i ] ) != null ) { 9200 9201 // Extend the base object 9202 for ( name in options ) { 9203 copy = options[ name ]; 9204 9205 // Prevent Object.prototype pollution 9206 // Prevent never-ending loop 9207 if ( name === "__proto__" || target === copy ) { 9208 continue; 9209 } 9210 9211 // Recurse if we're merging plain objects or arrays 9212 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 9213 ( copyIsArray = Array.isArray( copy ) ) ) ) { 9214 src = target[ name ]; 9215 9216 // Ensure proper type for the source value 9217 if ( copyIsArray && !Array.isArray( src ) ) { 9218 clone = []; 9219 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { 9220 clone = {}; 9221 } else { 9222 clone = src; 9223 } 9224 copyIsArray = false; 9225 9226 // Never move original objects, clone them 9227 target[ name ] = jQuery.extend( deep, clone, copy ); 9228 9229 // Don't bring in undefined values 9230 } else if ( copy !== undefined ) { 9231 target[ name ] = copy; 9232 } 9233 } 9234 } 9235 } 9236 9237 // Return the modified object 9238 return target; 9239}; 9240 9241jQuery.extend( { 9242 9243 // Unique for each copy of jQuery on the page 9244 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 9245 9246 // Assume jQuery is ready without the ready module 9247 isReady: true, 9248 9249 error: function( msg ) { 9250 throw new Error( msg ); 9251 }, 9252 9253 noop: function() {}, 9254 9255 isPlainObject: function( obj ) { 9256 var proto, Ctor; 9257 9258 // Detect obvious negatives 9259 // Use toString instead of jQuery.type to catch host objects 9260 if ( !obj || toString.call( obj ) !== "[object Object]" ) { 9261 return false; 9262 } 9263 9264 proto = getProto( obj ); 9265 9266 // Objects with no prototype (e.g., `Object.create( null )`) are plain 9267 if ( !proto ) { 9268 return true; 9269 } 9270 9271 // Objects with prototype are plain iff they were constructed by a global Object function 9272 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; 9273 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; 9274 }, 9275 9276 isEmptyObject: function( obj ) { 9277 var name; 9278 9279 for ( name in obj ) { 9280 return false; 9281 } 9282 return true; 9283 }, 9284 9285 // Evaluates a script in a provided context; falls back to the global one 9286 // if not specified. 9287 globalEval: function( code, options, doc ) { 9288 DOMEval( code, { nonce: options && options.nonce }, doc ); 9289 }, 9290 9291 each: function( obj, callback ) { 9292 var length, i = 0; 9293 9294 if ( isArrayLike( obj ) ) { 9295 length = obj.length; 9296 for ( ; i < length; i++ ) { 9297 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 9298 break; 9299 } 9300 } 9301 } else { 9302 for ( i in obj ) { 9303 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 9304 break; 9305 } 9306 } 9307 } 9308 9309 return obj; 9310 }, 9311 9312 9313 // Retrieve the text value of an array of DOM nodes 9314 text: function( elem ) { 9315 var node, 9316 ret = "", 9317 i = 0, 9318 nodeType = elem.nodeType; 9319 9320 if ( !nodeType ) { 9321 9322 // If no nodeType, this is expected to be an array 9323 while ( ( node = elem[ i++ ] ) ) { 9324 9325 // Do not traverse comment nodes 9326 ret += jQuery.text( node ); 9327 } 9328 } 9329 if ( nodeType === 1 || nodeType === 11 ) { 9330 return elem.textContent; 9331 } 9332 if ( nodeType === 9 ) { 9333 return elem.documentElement.textContent; 9334 } 9335 if ( nodeType === 3 || nodeType === 4 ) { 9336 return elem.nodeValue; 9337 } 9338 9339 // Do not include comment or processing instruction nodes 9340 9341 return ret; 9342 }, 9343 9344 // results is for internal usage only 9345 makeArray: function( arr, results ) { 9346 var ret = results || []; 9347 9348 if ( arr != null ) { 9349 if ( isArrayLike( Object( arr ) ) ) { 9350 jQuery.merge( ret, 9351 typeof arr === "string" ? 9352 [ arr ] : arr 9353 ); 9354 } else { 9355 push.call( ret, arr ); 9356 } 9357 } 9358 9359 return ret; 9360 }, 9361 9362 inArray: function( elem, arr, i ) { 9363 return arr == null ? -1 : indexOf.call( arr, elem, i ); 9364 }, 9365 9366 isXMLDoc: function( elem ) { 9367 var namespace = elem && elem.namespaceURI, 9368 docElem = elem && ( elem.ownerDocument || elem ).documentElement; 9369 9370 // Assume HTML when documentElement doesn't yet exist, such as inside 9371 // document fragments. 9372 return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" ); 9373 }, 9374 9375 // Support: Android <=4.0 only, PhantomJS 1 only 9376 // push.apply(_, arraylike) throws on ancient WebKit 9377 merge: function( first, second ) { 9378 var len = +second.length, 9379 j = 0, 9380 i = first.length; 9381 9382 for ( ; j < len; j++ ) { 9383 first[ i++ ] = second[ j ]; 9384 } 9385 9386 first.length = i; 9387 9388 return first; 9389 }, 9390 9391 grep: function( elems, callback, invert ) { 9392 var callbackInverse, 9393 matches = [], 9394 i = 0, 9395 length = elems.length, 9396 callbackExpect = !invert; 9397 9398 // Go through the array, only saving the items 9399 // that pass the validator function 9400 for ( ; i < length; i++ ) { 9401 callbackInverse = !callback( elems[ i ], i ); 9402 if ( callbackInverse !== callbackExpect ) { 9403 matches.push( elems[ i ] ); 9404 } 9405 } 9406 9407 return matches; 9408 }, 9409 9410 // arg is for internal usage only 9411 map: function( elems, callback, arg ) { 9412 var length, value, 9413 i = 0, 9414 ret = []; 9415 9416 // Go through the array, translating each of the items to their new values 9417 if ( isArrayLike( elems ) ) { 9418 length = elems.length; 9419 for ( ; i < length; i++ ) { 9420 value = callback( elems[ i ], i, arg ); 9421 9422 if ( value != null ) { 9423 ret.push( value ); 9424 } 9425 } 9426 9427 // Go through every key on the object, 9428 } else { 9429 for ( i in elems ) { 9430 value = callback( elems[ i ], i, arg ); 9431 9432 if ( value != null ) { 9433 ret.push( value ); 9434 } 9435 } 9436 } 9437 9438 // Flatten any nested arrays 9439 return flat( ret ); 9440 }, 9441 9442 // A global GUID counter for objects 9443 guid: 1, 9444 9445 // jQuery.support is not used in Core but other projects attach their 9446 // properties to it so it needs to exist. 9447 support: support 9448} ); 9449 9450if ( typeof Symbol === "function" ) { 9451 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 9452} 9453 9454// Populate the class2type map 9455jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 9456 function( _i, name ) { 9457 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 9458 } ); 9459 9460function isArrayLike( obj ) { 9461 9462 // Support: real iOS 8.2 only (not reproducible in simulator) 9463 // `in` check used to prevent JIT error (gh-2145) 9464 // hasOwn isn't used here due to false negatives 9465 // regarding Nodelist length in IE 9466 var length = !!obj && "length" in obj && obj.length, 9467 type = toType( obj ); 9468 9469 if ( isFunction( obj ) || isWindow( obj ) ) { 9470 return false; 9471 } 9472 9473 return type === "array" || length === 0 || 9474 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 9475} 9476 9477 9478function nodeName( elem, name ) { 9479 9480 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 9481 9482} 9483var pop = arr.pop; 9484 9485 9486var sort = arr.sort; 9487 9488 9489var splice = arr.splice; 9490 9491 9492var whitespace = "[\\x20\\t\\r\\n\\f]"; 9493 9494 9495var rtrimCSS = new RegExp( 9496 "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", 9497 "g" 9498); 9499 9500 9501 9502 9503// Note: an element does not contain itself 9504jQuery.contains = function( a, b ) { 9505 var bup = b && b.parentNode; 9506 9507 return a === bup || !!( bup && bup.nodeType === 1 && ( 9508 9509 // Support: IE 9 - 11+ 9510 // IE doesn't have `contains` on SVG. 9511 a.contains ? 9512 a.contains( bup ) : 9513 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 9514 ) ); 9515}; 9516 9517 9518 9519 9520// CSS string/identifier serialization 9521// https://drafts.csswg.org/cssom/#common-serializing-idioms 9522var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; 9523 9524function fcssescape( ch, asCodePoint ) { 9525 if ( asCodePoint ) { 9526 9527 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 9528 if ( ch === "\0" ) { 9529 return "\uFFFD"; 9530 } 9531 9532 // Control characters and (dependent upon position) numbers get escaped as code points 9533 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 9534 } 9535 9536 // Other potentially-special ASCII characters get backslash-escaped 9537 return "\\" + ch; 9538} 9539 9540jQuery.escapeSelector = function( sel ) { 9541 return ( sel + "" ).replace( rcssescape, fcssescape ); 9542}; 9543 9544 9545 9546 9547var preferredDoc = document, 9548 pushNative = push; 9549 9550( function() { 9551 9552var i, 9553 Expr, 9554 outermostContext, 9555 sortInput, 9556 hasDuplicate, 9557 push = pushNative, 9558 9559 // Local document vars 9560 document, 9561 documentElement, 9562 documentIsHTML, 9563 rbuggyQSA, 9564 matches, 9565 9566 // Instance-specific data 9567 expando = jQuery.expando, 9568 dirruns = 0, 9569 done = 0, 9570 classCache = createCache(), 9571 tokenCache = createCache(), 9572 compilerCache = createCache(), 9573 nonnativeSelectorCache = createCache(), 9574 sortOrder = function( a, b ) { 9575 if ( a === b ) { 9576 hasDuplicate = true; 9577 } 9578 return 0; 9579 }, 9580 9581 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" + 9582 "loop|multiple|open|readonly|required|scoped", 9583 9584 // Regular expressions 9585 9586 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram 9587 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + 9588 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", 9589 9590 // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors 9591 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 9592 9593 // Operator (capture 2) 9594 "*([*^$|!~]?=)" + whitespace + 9595 9596 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 9597 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + 9598 whitespace + "*\\]", 9599 9600 pseudos = ":(" + identifier + ")(?:\\((" + 9601 9602 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 9603 // 1. quoted (capture 3; capture 4 or capture 5) 9604 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 9605 9606 // 2. simple (capture 6) 9607 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 9608 9609 // 3. anything else (capture 2) 9610 ".*" + 9611 ")\\)|)", 9612 9613 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 9614 rwhitespace = new RegExp( whitespace + "+", "g" ), 9615 9616 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 9617 rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + 9618 whitespace + "*" ), 9619 rdescend = new RegExp( whitespace + "|>" ), 9620 9621 rpseudo = new RegExp( pseudos ), 9622 ridentifier = new RegExp( "^" + identifier + "$" ), 9623 9624 matchExpr = { 9625 ID: new RegExp( "^#(" + identifier + ")" ), 9626 CLASS: new RegExp( "^\\.(" + identifier + ")" ), 9627 TAG: new RegExp( "^(" + identifier + "|[*])" ), 9628 ATTR: new RegExp( "^" + attributes ), 9629 PSEUDO: new RegExp( "^" + pseudos ), 9630 CHILD: new RegExp( 9631 "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + 9632 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + 9633 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 9634 bool: new RegExp( "^(?:" + booleans + ")$", "i" ), 9635 9636 // For use in libraries implementing .is() 9637 // We use this for POS matching in `select` 9638 needsContext: new RegExp( "^" + whitespace + 9639 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + 9640 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 9641 }, 9642 9643 rinputs = /^(?:input|select|textarea|button)$/i, 9644 rheader = /^h\d$/i, 9645 9646 // Easily-parseable/retrievable ID or TAG or CLASS selectors 9647 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 9648 9649 rsibling = /[+~]/, 9650 9651 // CSS escapes 9652 // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters 9653 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + 9654 "?|\\\\([^\\r\\n\\f])", "g" ), 9655 funescape = function( escape, nonHex ) { 9656 var high = "0x" + escape.slice( 1 ) - 0x10000; 9657 9658 if ( nonHex ) { 9659 9660 // Strip the backslash prefix from a non-hex escape sequence 9661 return nonHex; 9662 } 9663 9664 // Replace a hexadecimal escape sequence with the encoded Unicode code point 9665 // Support: IE <=11+ 9666 // For values outside the Basic Multilingual Plane (BMP), manually construct a 9667 // surrogate pair 9668 return high < 0 ? 9669 String.fromCharCode( high + 0x10000 ) : 9670 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 9671 }, 9672 9673 // Used for iframes; see `setDocument`. 9674 // Support: IE 9 - 11+, Edge 12 - 18+ 9675 // Removing the function wrapper causes a "Permission Denied" 9676 // error in IE/Edge. 9677 unloadHandler = function() { 9678 setDocument(); 9679 }, 9680 9681 inDisabledFieldset = addCombinator( 9682 function( elem ) { 9683 return elem.disabled === true && nodeName( elem, "fieldset" ); 9684 }, 9685 { dir: "parentNode", next: "legend" } 9686 ); 9687 9688// Support: IE <=9 only 9689// Accessing document.activeElement can throw unexpectedly 9690// https://bugs.jquery.com/ticket/13393 9691function safeActiveElement() { 9692 try { 9693 return document.activeElement; 9694 } catch ( err ) { } 9695} 9696 9697// Optimize for push.apply( _, NodeList ) 9698try { 9699 push.apply( 9700 ( arr = slice.call( preferredDoc.childNodes ) ), 9701 preferredDoc.childNodes 9702 ); 9703 9704 // Support: Android <=4.0 9705 // Detect silently failing push.apply 9706 // eslint-disable-next-line no-unused-expressions 9707 arr[ preferredDoc.childNodes.length ].nodeType; 9708} catch ( e ) { 9709 push = { 9710 apply: function( target, els ) { 9711 pushNative.apply( target, slice.call( els ) ); 9712 }, 9713 call: function( target ) { 9714 pushNative.apply( target, slice.call( arguments, 1 ) ); 9715 } 9716 }; 9717} 9718 9719function find( selector, context, results, seed ) { 9720 var m, i, elem, nid, match, groups, newSelector, 9721 newContext = context && context.ownerDocument, 9722 9723 // nodeType defaults to 9, since context defaults to document 9724 nodeType = context ? context.nodeType : 9; 9725 9726 results = results || []; 9727 9728 // Return early from calls with invalid selector or context 9729 if ( typeof selector !== "string" || !selector || 9730 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 9731 9732 return results; 9733 } 9734 9735 // Try to shortcut find operations (as opposed to filters) in HTML documents 9736 if ( !seed ) { 9737 setDocument( context ); 9738 context = context || document; 9739 9740 if ( documentIsHTML ) { 9741 9742 // If the selector is sufficiently simple, try using a "get*By*" DOM method 9743 // (excepting DocumentFragment context, where the methods don't exist) 9744 if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { 9745 9746 // ID selector 9747 if ( ( m = match[ 1 ] ) ) { 9748 9749 // Document context 9750 if ( nodeType === 9 ) { 9751 if ( ( elem = context.getElementById( m ) ) ) { 9752 9753 // Support: IE 9 only 9754 // getElementById can match elements by name instead of ID 9755 if ( elem.id === m ) { 9756 push.call( results, elem ); 9757 return results; 9758 } 9759 } else { 9760 return results; 9761 } 9762 9763 // Element context 9764 } else { 9765 9766 // Support: IE 9 only 9767 // getElementById can match elements by name instead of ID 9768 if ( newContext && ( elem = newContext.getElementById( m ) ) && 9769 find.contains( context, elem ) && 9770 elem.id === m ) { 9771 9772 push.call( results, elem ); 9773 return results; 9774 } 9775 } 9776 9777 // Type selector 9778 } else if ( match[ 2 ] ) { 9779 push.apply( results, context.getElementsByTagName( selector ) ); 9780 return results; 9781 9782 // Class selector 9783 } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) { 9784 push.apply( results, context.getElementsByClassName( m ) ); 9785 return results; 9786 } 9787 } 9788 9789 // Take advantage of querySelectorAll 9790 if ( !nonnativeSelectorCache[ selector + " " ] && 9791 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) { 9792 9793 newSelector = selector; 9794 newContext = context; 9795 9796 // qSA considers elements outside a scoping root when evaluating child or 9797 // descendant combinators, which is not what we want. 9798 // In such cases, we work around the behavior by prefixing every selector in the 9799 // list with an ID selector referencing the scope context. 9800 // The technique has to be used as well when a leading combinator is used 9801 // as such selectors are not recognized by querySelectorAll. 9802 // Thanks to Andrew Dupont for this technique. 9803 if ( nodeType === 1 && 9804 ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) { 9805 9806 // Expand context for sibling selectors 9807 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 9808 context; 9809 9810 // We can use :scope instead of the ID hack if the browser 9811 // supports it & if we're not changing the context. 9812 // Support: IE 11+, Edge 17 - 18+ 9813 // IE/Edge sometimes throw a "Permission denied" error when 9814 // strict-comparing two documents; shallow comparisons work. 9815 // eslint-disable-next-line eqeqeq 9816 if ( newContext != context || !support.scope ) { 9817 9818 // Capture the context ID, setting it first if necessary 9819 if ( ( nid = context.getAttribute( "id" ) ) ) { 9820 nid = jQuery.escapeSelector( nid ); 9821 } else { 9822 context.setAttribute( "id", ( nid = expando ) ); 9823 } 9824 } 9825 9826 // Prefix every selector in the list 9827 groups = tokenize( selector ); 9828 i = groups.length; 9829 while ( i-- ) { 9830 groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + 9831 toSelector( groups[ i ] ); 9832 } 9833 newSelector = groups.join( "," ); 9834 } 9835 9836 try { 9837 push.apply( results, 9838 newContext.querySelectorAll( newSelector ) 9839 ); 9840 return results; 9841 } catch ( qsaError ) { 9842 nonnativeSelectorCache( selector, true ); 9843 } finally { 9844 if ( nid === expando ) { 9845 context.removeAttribute( "id" ); 9846 } 9847 } 9848 } 9849 } 9850 } 9851 9852 // All others 9853 return select( selector.replace( rtrimCSS, "$1" ), context, results, seed ); 9854} 9855 9856/** 9857 * Create key-value caches of limited size 9858 * @returns {function(string, object)} Returns the Object data after storing it on itself with 9859 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 9860 * deleting the oldest entry 9861 */ 9862function createCache() { 9863 var keys = []; 9864 9865 function cache( key, value ) { 9866 9867 // Use (key + " ") to avoid collision with native prototype properties 9868 // (see https://github.com/jquery/sizzle/issues/157) 9869 if ( keys.push( key + " " ) > Expr.cacheLength ) { 9870 9871 // Only keep the most recent entries 9872 delete cache[ keys.shift() ]; 9873 } 9874 return ( cache[ key + " " ] = value ); 9875 } 9876 return cache; 9877} 9878 9879/** 9880 * Mark a function for special use by jQuery selector module 9881 * @param {Function} fn The function to mark 9882 */ 9883function markFunction( fn ) { 9884 fn[ expando ] = true; 9885 return fn; 9886} 9887 9888/** 9889 * Support testing using an element 9890 * @param {Function} fn Passed the created element and returns a boolean result 9891 */ 9892function assert( fn ) { 9893 var el = document.createElement( "fieldset" ); 9894 9895 try { 9896 return !!fn( el ); 9897 } catch ( e ) { 9898 return false; 9899 } finally { 9900 9901 // Remove from its parent by default 9902 if ( el.parentNode ) { 9903 el.parentNode.removeChild( el ); 9904 } 9905 9906 // release memory in IE 9907 el = null; 9908 } 9909} 9910 9911/** 9912 * Returns a function to use in pseudos for input types 9913 * @param {String} type 9914 */ 9915function createInputPseudo( type ) { 9916 return function( elem ) { 9917 return nodeName( elem, "input" ) && elem.type === type; 9918 }; 9919} 9920 9921/** 9922 * Returns a function to use in pseudos for buttons 9923 * @param {String} type 9924 */ 9925function createButtonPseudo( type ) { 9926 return function( elem ) { 9927 return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) && 9928 elem.type === type; 9929 }; 9930} 9931 9932/** 9933 * Returns a function to use in pseudos for :enabled/:disabled 9934 * @param {Boolean} disabled true for :disabled; false for :enabled 9935 */ 9936function createDisabledPseudo( disabled ) { 9937 9938 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 9939 return function( elem ) { 9940 9941 // Only certain elements can match :enabled or :disabled 9942 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 9943 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 9944 if ( "form" in elem ) { 9945 9946 // Check for inherited disabledness on relevant non-disabled elements: 9947 // * listed form-associated elements in a disabled fieldset 9948 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 9949 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 9950 // * option elements in a disabled optgroup 9951 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 9952 // All such elements have a "form" property. 9953 if ( elem.parentNode && elem.disabled === false ) { 9954 9955 // Option elements defer to a parent optgroup if present 9956 if ( "label" in elem ) { 9957 if ( "label" in elem.parentNode ) { 9958 return elem.parentNode.disabled === disabled; 9959 } else { 9960 return elem.disabled === disabled; 9961 } 9962 } 9963 9964 // Support: IE 6 - 11+ 9965 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 9966 return elem.isDisabled === disabled || 9967 9968 // Where there is no isDisabled, check manually 9969 elem.isDisabled !== !disabled && 9970 inDisabledFieldset( elem ) === disabled; 9971 } 9972 9973 return elem.disabled === disabled; 9974 9975 // Try to winnow out elements that can't be disabled before trusting the disabled property. 9976 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 9977 // even exist on them, let alone have a boolean value. 9978 } else if ( "label" in elem ) { 9979 return elem.disabled === disabled; 9980 } 9981 9982 // Remaining elements are neither :enabled nor :disabled 9983 return false; 9984 }; 9985} 9986 9987/** 9988 * Returns a function to use in pseudos for positionals 9989 * @param {Function} fn 9990 */ 9991function createPositionalPseudo( fn ) { 9992 return markFunction( function( argument ) { 9993 argument = +argument; 9994 return markFunction( function( seed, matches ) { 9995 var j, 9996 matchIndexes = fn( [], seed.length, argument ), 9997 i = matchIndexes.length; 9998 9999 // Match elements found at the specified indexes 10000 while ( i-- ) { 10001 if ( seed[ ( j = matchIndexes[ i ] ) ] ) { 10002 seed[ j ] = !( matches[ j ] = seed[ j ] ); 10003 } 10004 } 10005 } ); 10006 } ); 10007} 10008 10009/** 10010 * Checks a node for validity as a jQuery selector context 10011 * @param {Element|Object=} context 10012 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 10013 */ 10014function testContext( context ) { 10015 return context && typeof context.getElementsByTagName !== "undefined" && context; 10016} 10017 10018/** 10019 * Sets document-related variables once based on the current document 10020 * @param {Element|Object} [node] An element or document object to use to set the document 10021 * @returns {Object} Returns the current document 10022 */ 10023function setDocument( node ) { 10024 var subWindow, 10025 doc = node ? node.ownerDocument || node : preferredDoc; 10026 10027 // Return early if doc is invalid or already selected 10028 // Support: IE 11+, Edge 17 - 18+ 10029 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 10030 // two documents; shallow comparisons work. 10031 // eslint-disable-next-line eqeqeq 10032 if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { 10033 return document; 10034 } 10035 10036 // Update global variables 10037 document = doc; 10038 documentElement = document.documentElement; 10039 documentIsHTML = !jQuery.isXMLDoc( document ); 10040 10041 // Support: iOS 7 only, IE 9 - 11+ 10042 // Older browsers didn't support unprefixed `matches`. 10043 matches = documentElement.matches || 10044 documentElement.webkitMatchesSelector || 10045 documentElement.msMatchesSelector; 10046 10047 // Support: IE 9 - 11+, Edge 12 - 18+ 10048 // Accessing iframe documents after unload throws "permission denied" errors 10049 // (see trac-13936). 10050 // Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`, 10051 // all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well. 10052 if ( documentElement.msMatchesSelector && 10053 10054 // Support: IE 11+, Edge 17 - 18+ 10055 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 10056 // two documents; shallow comparisons work. 10057 // eslint-disable-next-line eqeqeq 10058 preferredDoc != document && 10059 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { 10060 10061 // Support: IE 9 - 11+, Edge 12 - 18+ 10062 subWindow.addEventListener( "unload", unloadHandler ); 10063 } 10064 10065 // Support: IE <10 10066 // Check if getElementById returns elements by name 10067 // The broken getElementById methods don't pick up programmatically-set names, 10068 // so use a roundabout getElementsByName test 10069 support.getById = assert( function( el ) { 10070 documentElement.appendChild( el ).id = jQuery.expando; 10071 return !document.getElementsByName || 10072 !document.getElementsByName( jQuery.expando ).length; 10073 } ); 10074 10075 // Support: IE 9 only 10076 // Check to see if it's possible to do matchesSelector 10077 // on a disconnected node. 10078 support.disconnectedMatch = assert( function( el ) { 10079 return matches.call( el, "*" ); 10080 } ); 10081 10082 // Support: IE 9 - 11+, Edge 12 - 18+ 10083 // IE/Edge don't support the :scope pseudo-class. 10084 support.scope = assert( function() { 10085 return document.querySelectorAll( ":scope" ); 10086 } ); 10087 10088 // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only 10089 // Make sure the `:has()` argument is parsed unforgivingly. 10090 // We include `*` in the test to detect buggy implementations that are 10091 // _selectively_ forgiving (specifically when the list includes at least 10092 // one valid selector). 10093 // Note that we treat complete lack of support for `:has()` as if it were 10094 // spec-compliant support, which is fine because use of `:has()` in such 10095 // environments will fail in the qSA path and fall back to jQuery traversal 10096 // anyway. 10097 support.cssHas = assert( function() { 10098 try { 10099 document.querySelector( ":has(*,:jqfake)" ); 10100 return false; 10101 } catch ( e ) { 10102 return true; 10103 } 10104 } ); 10105 10106 // ID filter and find 10107 if ( support.getById ) { 10108 Expr.filter.ID = function( id ) { 10109 var attrId = id.replace( runescape, funescape ); 10110 return function( elem ) { 10111 return elem.getAttribute( "id" ) === attrId; 10112 }; 10113 }; 10114 Expr.find.ID = function( id, context ) { 10115 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 10116 var elem = context.getElementById( id ); 10117 return elem ? [ elem ] : []; 10118 } 10119 }; 10120 } else { 10121 Expr.filter.ID = function( id ) { 10122 var attrId = id.replace( runescape, funescape ); 10123 return function( elem ) { 10124 var node = typeof elem.getAttributeNode !== "undefined" && 10125 elem.getAttributeNode( "id" ); 10126 return node && node.value === attrId; 10127 }; 10128 }; 10129 10130 // Support: IE 6 - 7 only 10131 // getElementById is not reliable as a find shortcut 10132 Expr.find.ID = function( id, context ) { 10133 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 10134 var node, i, elems, 10135 elem = context.getElementById( id ); 10136 10137 if ( elem ) { 10138 10139 // Verify the id attribute 10140 node = elem.getAttributeNode( "id" ); 10141 if ( node && node.value === id ) { 10142 return [ elem ]; 10143 } 10144 10145 // Fall back on getElementsByName 10146 elems = context.getElementsByName( id ); 10147 i = 0; 10148 while ( ( elem = elems[ i++ ] ) ) { 10149 node = elem.getAttributeNode( "id" ); 10150 if ( node && node.value === id ) { 10151 return [ elem ]; 10152 } 10153 } 10154 } 10155 10156 return []; 10157 } 10158 }; 10159 } 10160 10161 // Tag 10162 Expr.find.TAG = function( tag, context ) { 10163 if ( typeof context.getElementsByTagName !== "undefined" ) { 10164 return context.getElementsByTagName( tag ); 10165 10166 // DocumentFragment nodes don't have gEBTN 10167 } else { 10168 return context.querySelectorAll( tag ); 10169 } 10170 }; 10171 10172 // Class 10173 Expr.find.CLASS = function( className, context ) { 10174 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 10175 return context.getElementsByClassName( className ); 10176 } 10177 }; 10178 10179 /* QSA/matchesSelector 10180 ---------------------------------------------------------------------- */ 10181 10182 // QSA and matchesSelector support 10183 10184 rbuggyQSA = []; 10185 10186 // Build QSA regex 10187 // Regex strategy adopted from Diego Perini 10188 assert( function( el ) { 10189 10190 var input; 10191 10192 documentElement.appendChild( el ).innerHTML = 10193 "<a id='" + expando + "' href='' disabled='disabled'></a>" + 10194 "<select id='" + expando + "-\r\\' disabled='disabled'>" + 10195 "<option selected=''></option></select>"; 10196 10197 // Support: iOS <=7 - 8 only 10198 // Boolean attributes and "value" are not treated correctly in some XML documents 10199 if ( !el.querySelectorAll( "[selected]" ).length ) { 10200 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 10201 } 10202 10203 // Support: iOS <=7 - 8 only 10204 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 10205 rbuggyQSA.push( "~=" ); 10206 } 10207 10208 // Support: iOS 8 only 10209 // https://bugs.webkit.org/show_bug.cgi?id=136851 10210 // In-page `selector#id sibling-combinator selector` fails 10211 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 10212 rbuggyQSA.push( ".#.+[+~]" ); 10213 } 10214 10215 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ 10216 // In some of the document kinds, these selectors wouldn't work natively. 10217 // This is probably OK but for backwards compatibility we want to maintain 10218 // handling them through jQuery traversal in jQuery 3.x. 10219 if ( !el.querySelectorAll( ":checked" ).length ) { 10220 rbuggyQSA.push( ":checked" ); 10221 } 10222 10223 // Support: Windows 8 Native Apps 10224 // The type and name attributes are restricted during .innerHTML assignment 10225 input = document.createElement( "input" ); 10226 input.setAttribute( "type", "hidden" ); 10227 el.appendChild( input ).setAttribute( "name", "D" ); 10228 10229 // Support: IE 9 - 11+ 10230 // IE's :disabled selector does not pick up the children of disabled fieldsets 10231 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ 10232 // In some of the document kinds, these selectors wouldn't work natively. 10233 // This is probably OK but for backwards compatibility we want to maintain 10234 // handling them through jQuery traversal in jQuery 3.x. 10235 documentElement.appendChild( el ).disabled = true; 10236 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { 10237 rbuggyQSA.push( ":enabled", ":disabled" ); 10238 } 10239 10240 // Support: IE 11+, Edge 15 - 18+ 10241 // IE 11/Edge don't find elements on a `[name='']` query in some cases. 10242 // Adding a temporary attribute to the document before the selection works 10243 // around the issue. 10244 // Interestingly, IE 10 & older don't seem to have the issue. 10245 input = document.createElement( "input" ); 10246 input.setAttribute( "name", "" ); 10247 el.appendChild( input ); 10248 if ( !el.querySelectorAll( "[name='']" ).length ) { 10249 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + 10250 whitespace + "*(?:''|\"\")" ); 10251 } 10252 } ); 10253 10254 if ( !support.cssHas ) { 10255 10256 // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ 10257 // Our regular `try-catch` mechanism fails to detect natively-unsupported 10258 // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`) 10259 // in browsers that parse the `:has()` argument as a forgiving selector list. 10260 // https://drafts.csswg.org/selectors/#relational now requires the argument 10261 // to be parsed unforgivingly, but browsers have not yet fully adjusted. 10262 rbuggyQSA.push( ":has" ); 10263 } 10264 10265 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); 10266 10267 /* Sorting 10268 ---------------------------------------------------------------------- */ 10269 10270 // Document order sorting 10271 sortOrder = function( a, b ) { 10272 10273 // Flag for duplicate removal 10274 if ( a === b ) { 10275 hasDuplicate = true; 10276 return 0; 10277 } 10278 10279 // Sort on method existence if only one input has compareDocumentPosition 10280 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 10281 if ( compare ) { 10282 return compare; 10283 } 10284 10285 // Calculate position if both inputs belong to the same document 10286 // Support: IE 11+, Edge 17 - 18+ 10287 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 10288 // two documents; shallow comparisons work. 10289 // eslint-disable-next-line eqeqeq 10290 compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? 10291 a.compareDocumentPosition( b ) : 10292 10293 // Otherwise we know they are disconnected 10294 1; 10295 10296 // Disconnected nodes 10297 if ( compare & 1 || 10298 ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { 10299 10300 // Choose the first element that is related to our preferred document 10301 // Support: IE 11+, Edge 17 - 18+ 10302 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 10303 // two documents; shallow comparisons work. 10304 // eslint-disable-next-line eqeqeq 10305 if ( a === document || a.ownerDocument == preferredDoc && 10306 find.contains( preferredDoc, a ) ) { 10307 return -1; 10308 } 10309 10310 // Support: IE 11+, Edge 17 - 18+ 10311 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 10312 // two documents; shallow comparisons work. 10313 // eslint-disable-next-line eqeqeq 10314 if ( b === document || b.ownerDocument == preferredDoc && 10315 find.contains( preferredDoc, b ) ) { 10316 return 1; 10317 } 10318 10319 // Maintain original order 10320 return sortInput ? 10321 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : 10322 0; 10323 } 10324 10325 return compare & 4 ? -1 : 1; 10326 }; 10327 10328 return document; 10329} 10330 10331find.matches = function( expr, elements ) { 10332 return find( expr, null, null, elements ); 10333}; 10334 10335find.matchesSelector = function( elem, expr ) { 10336 setDocument( elem ); 10337 10338 if ( documentIsHTML && 10339 !nonnativeSelectorCache[ expr + " " ] && 10340 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 10341 10342 try { 10343 var ret = matches.call( elem, expr ); 10344 10345 // IE 9's matchesSelector returns false on disconnected nodes 10346 if ( ret || support.disconnectedMatch || 10347 10348 // As well, disconnected nodes are said to be in a document 10349 // fragment in IE 9 10350 elem.document && elem.document.nodeType !== 11 ) { 10351 return ret; 10352 } 10353 } catch ( e ) { 10354 nonnativeSelectorCache( expr, true ); 10355 } 10356 } 10357 10358 return find( expr, document, null, [ elem ] ).length > 0; 10359}; 10360 10361find.contains = function( context, elem ) { 10362 10363 // Set document vars if needed 10364 // Support: IE 11+, Edge 17 - 18+ 10365 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 10366 // two documents; shallow comparisons work. 10367 // eslint-disable-next-line eqeqeq 10368 if ( ( context.ownerDocument || context ) != document ) { 10369 setDocument( context ); 10370 } 10371 return jQuery.contains( context, elem ); 10372}; 10373 10374 10375find.attr = function( elem, name ) { 10376 10377 // Set document vars if needed 10378 // Support: IE 11+, Edge 17 - 18+ 10379 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 10380 // two documents; shallow comparisons work. 10381 // eslint-disable-next-line eqeqeq 10382 if ( ( elem.ownerDocument || elem ) != document ) { 10383 setDocument( elem ); 10384 } 10385 10386 var fn = Expr.attrHandle[ name.toLowerCase() ], 10387 10388 // Don't get fooled by Object.prototype properties (see trac-13807) 10389 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 10390 fn( elem, name, !documentIsHTML ) : 10391 undefined; 10392 10393 if ( val !== undefined ) { 10394 return val; 10395 } 10396 10397 return elem.getAttribute( name ); 10398}; 10399 10400find.error = function( msg ) { 10401 throw new Error( "Syntax error, unrecognized expression: " + msg ); 10402}; 10403 10404/** 10405 * Document sorting and removing duplicates 10406 * @param {ArrayLike} results 10407 */ 10408jQuery.uniqueSort = function( results ) { 10409 var elem, 10410 duplicates = [], 10411 j = 0, 10412 i = 0; 10413 10414 // Unless we *know* we can detect duplicates, assume their presence 10415 // 10416 // Support: Android <=4.0+ 10417 // Testing for detecting duplicates is unpredictable so instead assume we can't 10418 // depend on duplicate detection in all browsers without a stable sort. 10419 hasDuplicate = !support.sortStable; 10420 sortInput = !support.sortStable && slice.call( results, 0 ); 10421 sort.call( results, sortOrder ); 10422 10423 if ( hasDuplicate ) { 10424 while ( ( elem = results[ i++ ] ) ) { 10425 if ( elem === results[ i ] ) { 10426 j = duplicates.push( i ); 10427 } 10428 } 10429 while ( j-- ) { 10430 splice.call( results, duplicates[ j ], 1 ); 10431 } 10432 } 10433 10434 // Clear input after sorting to release objects 10435 // See https://github.com/jquery/sizzle/pull/225 10436 sortInput = null; 10437 10438 return results; 10439}; 10440 10441jQuery.fn.uniqueSort = function() { 10442 return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) ); 10443}; 10444 10445Expr = jQuery.expr = { 10446 10447 // Can be adjusted by the user 10448 cacheLength: 50, 10449 10450 createPseudo: markFunction, 10451 10452 match: matchExpr, 10453 10454 attrHandle: {}, 10455 10456 find: {}, 10457 10458 relative: { 10459 ">": { dir: "parentNode", first: true }, 10460 " ": { dir: "parentNode" }, 10461 "+": { dir: "previousSibling", first: true }, 10462 "~": { dir: "previousSibling" } 10463 }, 10464 10465 preFilter: { 10466 ATTR: function( match ) { 10467 match[ 1 ] = match[ 1 ].replace( runescape, funescape ); 10468 10469 // Move the given value to match[3] whether quoted or unquoted 10470 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" ) 10471 .replace( runescape, funescape ); 10472 10473 if ( match[ 2 ] === "~=" ) { 10474 match[ 3 ] = " " + match[ 3 ] + " "; 10475 } 10476 10477 return match.slice( 0, 4 ); 10478 }, 10479 10480 CHILD: function( match ) { 10481 10482 /* matches from matchExpr["CHILD"] 10483 1 type (only|nth|...) 10484 2 what (child|of-type) 10485 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 10486 4 xn-component of xn+y argument ([+-]?\d*n|) 10487 5 sign of xn-component 10488 6 x of xn-component 10489 7 sign of y-component 10490 8 y of y-component 10491 */ 10492 match[ 1 ] = match[ 1 ].toLowerCase(); 10493 10494 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { 10495 10496 // nth-* requires argument 10497 if ( !match[ 3 ] ) { 10498 find.error( match[ 0 ] ); 10499 } 10500 10501 // numeric x and y parameters for Expr.filter.CHILD 10502 // remember that false/true cast respectively to 0/1 10503 match[ 4 ] = +( match[ 4 ] ? 10504 match[ 5 ] + ( match[ 6 ] || 1 ) : 10505 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) 10506 ); 10507 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); 10508 10509 // other types prohibit arguments 10510 } else if ( match[ 3 ] ) { 10511 find.error( match[ 0 ] ); 10512 } 10513 10514 return match; 10515 }, 10516 10517 PSEUDO: function( match ) { 10518 var excess, 10519 unquoted = !match[ 6 ] && match[ 2 ]; 10520 10521 if ( matchExpr.CHILD.test( match[ 0 ] ) ) { 10522 return null; 10523 } 10524 10525 // Accept quoted arguments as-is 10526 if ( match[ 3 ] ) { 10527 match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; 10528 10529 // Strip excess characters from unquoted arguments 10530 } else if ( unquoted && rpseudo.test( unquoted ) && 10531 10532 // Get excess from tokenize (recursively) 10533 ( excess = tokenize( unquoted, true ) ) && 10534 10535 // advance to the next closing parenthesis 10536 ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { 10537 10538 // excess is a negative index 10539 match[ 0 ] = match[ 0 ].slice( 0, excess ); 10540 match[ 2 ] = unquoted.slice( 0, excess ); 10541 } 10542 10543 // Return only captures needed by the pseudo filter method (type and argument) 10544 return match.slice( 0, 3 ); 10545 } 10546 }, 10547 10548 filter: { 10549 10550 TAG: function( nodeNameSelector ) { 10551 var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 10552 return nodeNameSelector === "*" ? 10553 function() { 10554 return true; 10555 } : 10556 function( elem ) { 10557 return nodeName( elem, expectedNodeName ); 10558 }; 10559 }, 10560 10561 CLASS: function( className ) { 10562 var pattern = classCache[ className + " " ]; 10563 10564 return pattern || 10565 ( pattern = new RegExp( "(^|" + whitespace + ")" + className + 10566 "(" + whitespace + "|$)" ) ) && 10567 classCache( className, function( elem ) { 10568 return pattern.test( 10569 typeof elem.className === "string" && elem.className || 10570 typeof elem.getAttribute !== "undefined" && 10571 elem.getAttribute( "class" ) || 10572 "" 10573 ); 10574 } ); 10575 }, 10576 10577 ATTR: function( name, operator, check ) { 10578 return function( elem ) { 10579 var result = find.attr( elem, name ); 10580 10581 if ( result == null ) { 10582 return operator === "!="; 10583 } 10584 if ( !operator ) { 10585 return true; 10586 } 10587 10588 result += ""; 10589 10590 if ( operator === "=" ) { 10591 return result === check; 10592 } 10593 if ( operator === "!=" ) { 10594 return result !== check; 10595 } 10596 if ( operator === "^=" ) { 10597 return check && result.indexOf( check ) === 0; 10598 } 10599 if ( operator === "*=" ) { 10600 return check && result.indexOf( check ) > -1; 10601 } 10602 if ( operator === "$=" ) { 10603 return check && result.slice( -check.length ) === check; 10604 } 10605 if ( operator === "~=" ) { 10606 return ( " " + result.replace( rwhitespace, " " ) + " " ) 10607 .indexOf( check ) > -1; 10608 } 10609 if ( operator === "|=" ) { 10610 return result === check || result.slice( 0, check.length + 1 ) === check + "-"; 10611 } 10612 10613 return false; 10614 }; 10615 }, 10616 10617 CHILD: function( type, what, _argument, first, last ) { 10618 var simple = type.slice( 0, 3 ) !== "nth", 10619 forward = type.slice( -4 ) !== "last", 10620 ofType = what === "of-type"; 10621 10622 return first === 1 && last === 0 ? 10623 10624 // Shortcut for :nth-*(n) 10625 function( elem ) { 10626 return !!elem.parentNode; 10627 } : 10628 10629 function( elem, _context, xml ) { 10630 var cache, outerCache, node, nodeIndex, start, 10631 dir = simple !== forward ? "nextSibling" : "previousSibling", 10632 parent = elem.parentNode, 10633 name = ofType && elem.nodeName.toLowerCase(), 10634 useCache = !xml && !ofType, 10635 diff = false; 10636 10637 if ( parent ) { 10638 10639 // :(first|last|only)-(child|of-type) 10640 if ( simple ) { 10641 while ( dir ) { 10642 node = elem; 10643 while ( ( node = node[ dir ] ) ) { 10644 if ( ofType ? 10645 nodeName( node, name ) : 10646 node.nodeType === 1 ) { 10647 10648 return false; 10649 } 10650 } 10651 10652 // Reverse direction for :only-* (if we haven't yet done so) 10653 start = dir = type === "only" && !start && "nextSibling"; 10654 } 10655 return true; 10656 } 10657 10658 start = [ forward ? parent.firstChild : parent.lastChild ]; 10659 10660 // non-xml :nth-child(...) stores cache data on `parent` 10661 if ( forward && useCache ) { 10662 10663 // Seek `elem` from a previously-cached index 10664 outerCache = parent[ expando ] || ( parent[ expando ] = {} ); 10665 cache = outerCache[ type ] || []; 10666 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 10667 diff = nodeIndex && cache[ 2 ]; 10668 node = nodeIndex && parent.childNodes[ nodeIndex ]; 10669 10670 while ( ( node = ++nodeIndex && node && node[ dir ] || 10671 10672 // Fallback to seeking `elem` from the start 10673 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 10674 10675 // When found, cache indexes on `parent` and break 10676 if ( node.nodeType === 1 && ++diff && node === elem ) { 10677 outerCache[ type ] = [ dirruns, nodeIndex, diff ]; 10678 break; 10679 } 10680 } 10681 10682 } else { 10683 10684 // Use previously-cached element index if available 10685 if ( useCache ) { 10686 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 10687 cache = outerCache[ type ] || []; 10688 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 10689 diff = nodeIndex; 10690 } 10691 10692 // xml :nth-child(...) 10693 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 10694 if ( diff === false ) { 10695 10696 // Use the same loop as above to seek `elem` from the start 10697 while ( ( node = ++nodeIndex && node && node[ dir ] || 10698 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 10699 10700 if ( ( ofType ? 10701 nodeName( node, name ) : 10702 node.nodeType === 1 ) && 10703 ++diff ) { 10704 10705 // Cache the index of each encountered element 10706 if ( useCache ) { 10707 outerCache = node[ expando ] || 10708 ( node[ expando ] = {} ); 10709 outerCache[ type ] = [ dirruns, diff ]; 10710 } 10711 10712 if ( node === elem ) { 10713 break; 10714 } 10715 } 10716 } 10717 } 10718 } 10719 10720 // Incorporate the offset, then check against cycle size 10721 diff -= last; 10722 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 10723 } 10724 }; 10725 }, 10726 10727 PSEUDO: function( pseudo, argument ) { 10728 10729 // pseudo-class names are case-insensitive 10730 // https://www.w3.org/TR/selectors/#pseudo-classes 10731 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 10732 // Remember that setFilters inherits from pseudos 10733 var args, 10734 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 10735 find.error( "unsupported pseudo: " + pseudo ); 10736 10737 // The user may use createPseudo to indicate that 10738 // arguments are needed to create the filter function 10739 // just as jQuery does 10740 if ( fn[ expando ] ) { 10741 return fn( argument ); 10742 } 10743 10744 // But maintain support for old signatures 10745 if ( fn.length > 1 ) { 10746 args = [ pseudo, pseudo, "", argument ]; 10747 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 10748 markFunction( function( seed, matches ) { 10749 var idx, 10750 matched = fn( seed, argument ), 10751 i = matched.length; 10752 while ( i-- ) { 10753 idx = indexOf.call( seed, matched[ i ] ); 10754 seed[ idx ] = !( matches[ idx ] = matched[ i ] ); 10755 } 10756 } ) : 10757 function( elem ) { 10758 return fn( elem, 0, args ); 10759 }; 10760 } 10761 10762 return fn; 10763 } 10764 }, 10765 10766 pseudos: { 10767 10768 // Potentially complex pseudos 10769 not: markFunction( function( selector ) { 10770 10771 // Trim the selector passed to compile 10772 // to avoid treating leading and trailing 10773 // spaces as combinators 10774 var input = [], 10775 results = [], 10776 matcher = compile( selector.replace( rtrimCSS, "$1" ) ); 10777 10778 return matcher[ expando ] ? 10779 markFunction( function( seed, matches, _context, xml ) { 10780 var elem, 10781 unmatched = matcher( seed, null, xml, [] ), 10782 i = seed.length; 10783 10784 // Match elements unmatched by `matcher` 10785 while ( i-- ) { 10786 if ( ( elem = unmatched[ i ] ) ) { 10787 seed[ i ] = !( matches[ i ] = elem ); 10788 } 10789 } 10790 } ) : 10791 function( elem, _context, xml ) { 10792 input[ 0 ] = elem; 10793 matcher( input, null, xml, results ); 10794 10795 // Don't keep the element 10796 // (see https://github.com/jquery/sizzle/issues/299) 10797 input[ 0 ] = null; 10798 return !results.pop(); 10799 }; 10800 } ), 10801 10802 has: markFunction( function( selector ) { 10803 return function( elem ) { 10804 return find( selector, elem ).length > 0; 10805 }; 10806 } ), 10807 10808 contains: markFunction( function( text ) { 10809 text = text.replace( runescape, funescape ); 10810 return function( elem ) { 10811 return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1; 10812 }; 10813 } ), 10814 10815 // "Whether an element is represented by a :lang() selector 10816 // is based solely on the element's language value 10817 // being equal to the identifier C, 10818 // or beginning with the identifier C immediately followed by "-". 10819 // The matching of C against the element's language value is performed case-insensitively. 10820 // The identifier C does not have to be a valid language name." 10821 // https://www.w3.org/TR/selectors/#lang-pseudo 10822 lang: markFunction( function( lang ) { 10823 10824 // lang value must be a valid identifier 10825 if ( !ridentifier.test( lang || "" ) ) { 10826 find.error( "unsupported lang: " + lang ); 10827 } 10828 lang = lang.replace( runescape, funescape ).toLowerCase(); 10829 return function( elem ) { 10830 var elemLang; 10831 do { 10832 if ( ( elemLang = documentIsHTML ? 10833 elem.lang : 10834 elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { 10835 10836 elemLang = elemLang.toLowerCase(); 10837 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 10838 } 10839 } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); 10840 return false; 10841 }; 10842 } ), 10843 10844 // Miscellaneous 10845 target: function( elem ) { 10846 var hash = window.location && window.location.hash; 10847 return hash && hash.slice( 1 ) === elem.id; 10848 }, 10849 10850 root: function( elem ) { 10851 return elem === documentElement; 10852 }, 10853 10854 focus: function( elem ) { 10855 return elem === safeActiveElement() && 10856 document.hasFocus() && 10857 !!( elem.type || elem.href || ~elem.tabIndex ); 10858 }, 10859 10860 // Boolean properties 10861 enabled: createDisabledPseudo( false ), 10862 disabled: createDisabledPseudo( true ), 10863 10864 checked: function( elem ) { 10865 10866 // In CSS3, :checked should return both checked and selected elements 10867 // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 10868 return ( nodeName( elem, "input" ) && !!elem.checked ) || 10869 ( nodeName( elem, "option" ) && !!elem.selected ); 10870 }, 10871 10872 selected: function( elem ) { 10873 10874 // Support: IE <=11+ 10875 // Accessing the selectedIndex property 10876 // forces the browser to treat the default option as 10877 // selected when in an optgroup. 10878 if ( elem.parentNode ) { 10879 // eslint-disable-next-line no-unused-expressions 10880 elem.parentNode.selectedIndex; 10881 } 10882 10883 return elem.selected === true; 10884 }, 10885 10886 // Contents 10887 empty: function( elem ) { 10888 10889 // https://www.w3.org/TR/selectors/#empty-pseudo 10890 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 10891 // but not by others (comment: 8; processing instruction: 7; etc.) 10892 // nodeType < 6 works because attributes (2) do not appear as children 10893 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 10894 if ( elem.nodeType < 6 ) { 10895 return false; 10896 } 10897 } 10898 return true; 10899 }, 10900 10901 parent: function( elem ) { 10902 return !Expr.pseudos.empty( elem ); 10903 }, 10904 10905 // Element/input types 10906 header: function( elem ) { 10907 return rheader.test( elem.nodeName ); 10908 }, 10909 10910 input: function( elem ) { 10911 return rinputs.test( elem.nodeName ); 10912 }, 10913 10914 button: function( elem ) { 10915 return nodeName( elem, "input" ) && elem.type === "button" || 10916 nodeName( elem, "button" ); 10917 }, 10918 10919 text: function( elem ) { 10920 var attr; 10921 return nodeName( elem, "input" ) && elem.type === "text" && 10922 10923 // Support: IE <10 only 10924 // New HTML5 attribute values (e.g., "search") appear 10925 // with elem.type === "text" 10926 ( ( attr = elem.getAttribute( "type" ) ) == null || 10927 attr.toLowerCase() === "text" ); 10928 }, 10929 10930 // Position-in-collection 10931 first: createPositionalPseudo( function() { 10932 return [ 0 ]; 10933 } ), 10934 10935 last: createPositionalPseudo( function( _matchIndexes, length ) { 10936 return [ length - 1 ]; 10937 } ), 10938 10939 eq: createPositionalPseudo( function( _matchIndexes, length, argument ) { 10940 return [ argument < 0 ? argument + length : argument ]; 10941 } ), 10942 10943 even: createPositionalPseudo( function( matchIndexes, length ) { 10944 var i = 0; 10945 for ( ; i < length; i += 2 ) { 10946 matchIndexes.push( i ); 10947 } 10948 return matchIndexes; 10949 } ), 10950 10951 odd: createPositionalPseudo( function( matchIndexes, length ) { 10952 var i = 1; 10953 for ( ; i < length; i += 2 ) { 10954 matchIndexes.push( i ); 10955 } 10956 return matchIndexes; 10957 } ), 10958 10959 lt: createPositionalPseudo( function( matchIndexes, length, argument ) { 10960 var i; 10961 10962 if ( argument < 0 ) { 10963 i = argument + length; 10964 } else if ( argument > length ) { 10965 i = length; 10966 } else { 10967 i = argument; 10968 } 10969 10970 for ( ; --i >= 0; ) { 10971 matchIndexes.push( i ); 10972 } 10973 return matchIndexes; 10974 } ), 10975 10976 gt: createPositionalPseudo( function( matchIndexes, length, argument ) { 10977 var i = argument < 0 ? argument + length : argument; 10978 for ( ; ++i < length; ) { 10979 matchIndexes.push( i ); 10980 } 10981 return matchIndexes; 10982 } ) 10983 } 10984}; 10985 10986Expr.pseudos.nth = Expr.pseudos.eq; 10987 10988// Add button/input type pseudos 10989for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 10990 Expr.pseudos[ i ] = createInputPseudo( i ); 10991} 10992for ( i in { submit: true, reset: true } ) { 10993 Expr.pseudos[ i ] = createButtonPseudo( i ); 10994} 10995 10996// Easy API for creating new setFilters 10997function setFilters() {} 10998setFilters.prototype = Expr.filters = Expr.pseudos; 10999Expr.setFilters = new setFilters(); 11000 11001function tokenize( selector, parseOnly ) { 11002 var matched, match, tokens, type, 11003 soFar, groups, preFilters, 11004 cached = tokenCache[ selector + " " ]; 11005 11006 if ( cached ) { 11007 return parseOnly ? 0 : cached.slice( 0 ); 11008 } 11009 11010 soFar = selector; 11011 groups = []; 11012 preFilters = Expr.preFilter; 11013 11014 while ( soFar ) { 11015 11016 // Comma and first run 11017 if ( !matched || ( match = rcomma.exec( soFar ) ) ) { 11018 if ( match ) { 11019 11020 // Don't consume trailing commas as valid 11021 soFar = soFar.slice( match[ 0 ].length ) || soFar; 11022 } 11023 groups.push( ( tokens = [] ) ); 11024 } 11025 11026 matched = false; 11027 11028 // Combinators 11029 if ( ( match = rleadingCombinator.exec( soFar ) ) ) { 11030 matched = match.shift(); 11031 tokens.push( { 11032 value: matched, 11033 11034 // Cast descendant combinators to space 11035 type: match[ 0 ].replace( rtrimCSS, " " ) 11036 } ); 11037 soFar = soFar.slice( matched.length ); 11038 } 11039 11040 // Filters 11041 for ( type in Expr.filter ) { 11042 if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || 11043 ( match = preFilters[ type ]( match ) ) ) ) { 11044 matched = match.shift(); 11045 tokens.push( { 11046 value: matched, 11047 type: type, 11048 matches: match 11049 } ); 11050 soFar = soFar.slice( matched.length ); 11051 } 11052 } 11053 11054 if ( !matched ) { 11055 break; 11056 } 11057 } 11058 11059 // Return the length of the invalid excess 11060 // if we're just parsing 11061 // Otherwise, throw an error or return tokens 11062 if ( parseOnly ) { 11063 return soFar.length; 11064 } 11065 11066 return soFar ? 11067 find.error( selector ) : 11068 11069 // Cache the tokens 11070 tokenCache( selector, groups ).slice( 0 ); 11071} 11072 11073function toSelector( tokens ) { 11074 var i = 0, 11075 len = tokens.length, 11076 selector = ""; 11077 for ( ; i < len; i++ ) { 11078 selector += tokens[ i ].value; 11079 } 11080 return selector; 11081} 11082 11083function addCombinator( matcher, combinator, base ) { 11084 var dir = combinator.dir, 11085 skip = combinator.next, 11086 key = skip || dir, 11087 checkNonElements = base && key === "parentNode", 11088 doneName = done++; 11089 11090 return combinator.first ? 11091 11092 // Check against closest ancestor/preceding element 11093 function( elem, context, xml ) { 11094 while ( ( elem = elem[ dir ] ) ) { 11095 if ( elem.nodeType === 1 || checkNonElements ) { 11096 return matcher( elem, context, xml ); 11097 } 11098 } 11099 return false; 11100 } : 11101 11102 // Check against all ancestor/preceding elements 11103 function( elem, context, xml ) { 11104 var oldCache, outerCache, 11105 newCache = [ dirruns, doneName ]; 11106 11107 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 11108 if ( xml ) { 11109 while ( ( elem = elem[ dir ] ) ) { 11110 if ( elem.nodeType === 1 || checkNonElements ) { 11111 if ( matcher( elem, context, xml ) ) { 11112 return true; 11113 } 11114 } 11115 } 11116 } else { 11117 while ( ( elem = elem[ dir ] ) ) { 11118 if ( elem.nodeType === 1 || checkNonElements ) { 11119 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 11120 11121 if ( skip && nodeName( elem, skip ) ) { 11122 elem = elem[ dir ] || elem; 11123 } else if ( ( oldCache = outerCache[ key ] ) && 11124 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 11125 11126 // Assign to newCache so results back-propagate to previous elements 11127 return ( newCache[ 2 ] = oldCache[ 2 ] ); 11128 } else { 11129 11130 // Reuse newcache so results back-propagate to previous elements 11131 outerCache[ key ] = newCache; 11132 11133 // A match means we're done; a fail means we have to keep checking 11134 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { 11135 return true; 11136 } 11137 } 11138 } 11139 } 11140 } 11141 return false; 11142 }; 11143} 11144 11145function elementMatcher( matchers ) { 11146 return matchers.length > 1 ? 11147 function( elem, context, xml ) { 11148 var i = matchers.length; 11149 while ( i-- ) { 11150 if ( !matchers[ i ]( elem, context, xml ) ) { 11151 return false; 11152 } 11153 } 11154 return true; 11155 } : 11156 matchers[ 0 ]; 11157} 11158 11159function multipleContexts( selector, contexts, results ) { 11160 var i = 0, 11161 len = contexts.length; 11162 for ( ; i < len; i++ ) { 11163 find( selector, contexts[ i ], results ); 11164 } 11165 return results; 11166} 11167 11168function condense( unmatched, map, filter, context, xml ) { 11169 var elem, 11170 newUnmatched = [], 11171 i = 0, 11172 len = unmatched.length, 11173 mapped = map != null; 11174 11175 for ( ; i < len; i++ ) { 11176 if ( ( elem = unmatched[ i ] ) ) { 11177 if ( !filter || filter( elem, context, xml ) ) { 11178 newUnmatched.push( elem ); 11179 if ( mapped ) { 11180 map.push( i ); 11181 } 11182 } 11183 } 11184 } 11185 11186 return newUnmatched; 11187} 11188 11189function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 11190 if ( postFilter && !postFilter[ expando ] ) { 11191 postFilter = setMatcher( postFilter ); 11192 } 11193 if ( postFinder && !postFinder[ expando ] ) { 11194 postFinder = setMatcher( postFinder, postSelector ); 11195 } 11196 return markFunction( function( seed, results, context, xml ) { 11197 var temp, i, elem, matcherOut, 11198 preMap = [], 11199 postMap = [], 11200 preexisting = results.length, 11201 11202 // Get initial elements from seed or context 11203 elems = seed || 11204 multipleContexts( selector || "*", 11205 context.nodeType ? [ context ] : context, [] ), 11206 11207 // Prefilter to get matcher input, preserving a map for seed-results synchronization 11208 matcherIn = preFilter && ( seed || !selector ) ? 11209 condense( elems, preMap, preFilter, context, xml ) : 11210 elems; 11211 11212 if ( matcher ) { 11213 11214 // If we have a postFinder, or filtered seed, or non-seed postFilter 11215 // or preexisting results, 11216 matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 11217 11218 // ...intermediate processing is necessary 11219 [] : 11220 11221 // ...otherwise use results directly 11222 results; 11223 11224 // Find primary matches 11225 matcher( matcherIn, matcherOut, context, xml ); 11226 } else { 11227 matcherOut = matcherIn; 11228 } 11229 11230 // Apply postFilter 11231 if ( postFilter ) { 11232 temp = condense( matcherOut, postMap ); 11233 postFilter( temp, [], context, xml ); 11234 11235 // Un-match failing elements by moving them back to matcherIn 11236 i = temp.length; 11237 while ( i-- ) { 11238 if ( ( elem = temp[ i ] ) ) { 11239 matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); 11240 } 11241 } 11242 } 11243 11244 if ( seed ) { 11245 if ( postFinder || preFilter ) { 11246 if ( postFinder ) { 11247 11248 // Get the final matcherOut by condensing this intermediate into postFinder contexts 11249 temp = []; 11250 i = matcherOut.length; 11251 while ( i-- ) { 11252 if ( ( elem = matcherOut[ i ] ) ) { 11253 11254 // Restore matcherIn since elem is not yet a final match 11255 temp.push( ( matcherIn[ i ] = elem ) ); 11256 } 11257 } 11258 postFinder( null, ( matcherOut = [] ), temp, xml ); 11259 } 11260 11261 // Move matched elements from seed to results to keep them synchronized 11262 i = matcherOut.length; 11263 while ( i-- ) { 11264 if ( ( elem = matcherOut[ i ] ) && 11265 ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) { 11266 11267 seed[ temp ] = !( results[ temp ] = elem ); 11268 } 11269 } 11270 } 11271 11272 // Add elements to results, through postFinder if defined 11273 } else { 11274 matcherOut = condense( 11275 matcherOut === results ? 11276 matcherOut.splice( preexisting, matcherOut.length ) : 11277 matcherOut 11278 ); 11279 if ( postFinder ) { 11280 postFinder( null, results, matcherOut, xml ); 11281 } else { 11282 push.apply( results, matcherOut ); 11283 } 11284 } 11285 } ); 11286} 11287 11288function matcherFromTokens( tokens ) { 11289 var checkContext, matcher, j, 11290 len = tokens.length, 11291 leadingRelative = Expr.relative[ tokens[ 0 ].type ], 11292 implicitRelative = leadingRelative || Expr.relative[ " " ], 11293 i = leadingRelative ? 1 : 0, 11294 11295 // The foundational matcher ensures that elements are reachable from top-level context(s) 11296 matchContext = addCombinator( function( elem ) { 11297 return elem === checkContext; 11298 }, implicitRelative, true ), 11299 matchAnyContext = addCombinator( function( elem ) { 11300 return indexOf.call( checkContext, elem ) > -1; 11301 }, implicitRelative, true ), 11302 matchers = [ function( elem, context, xml ) { 11303 11304 // Support: IE 11+, Edge 17 - 18+ 11305 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 11306 // two documents; shallow comparisons work. 11307 // eslint-disable-next-line eqeqeq 11308 var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || ( 11309 ( checkContext = context ).nodeType ? 11310 matchContext( elem, context, xml ) : 11311 matchAnyContext( elem, context, xml ) ); 11312 11313 // Avoid hanging onto element 11314 // (see https://github.com/jquery/sizzle/issues/299) 11315 checkContext = null; 11316 return ret; 11317 } ]; 11318 11319 for ( ; i < len; i++ ) { 11320 if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { 11321 matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; 11322 } else { 11323 matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); 11324 11325 // Return special upon seeing a positional matcher 11326 if ( matcher[ expando ] ) { 11327 11328 // Find the next relative operator (if any) for proper handling 11329 j = ++i; 11330 for ( ; j < len; j++ ) { 11331 if ( Expr.relative[ tokens[ j ].type ] ) { 11332 break; 11333 } 11334 } 11335 return setMatcher( 11336 i > 1 && elementMatcher( matchers ), 11337 i > 1 && toSelector( 11338 11339 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 11340 tokens.slice( 0, i - 1 ) 11341 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) 11342 ).replace( rtrimCSS, "$1" ), 11343 matcher, 11344 i < j && matcherFromTokens( tokens.slice( i, j ) ), 11345 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), 11346 j < len && toSelector( tokens ) 11347 ); 11348 } 11349 matchers.push( matcher ); 11350 } 11351 } 11352 11353 return elementMatcher( matchers ); 11354} 11355 11356function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 11357 var bySet = setMatchers.length > 0, 11358 byElement = elementMatchers.length > 0, 11359 superMatcher = function( seed, context, xml, results, outermost ) { 11360 var elem, j, matcher, 11361 matchedCount = 0, 11362 i = "0", 11363 unmatched = seed && [], 11364 setMatched = [], 11365 contextBackup = outermostContext, 11366 11367 // We must always have either seed elements or outermost context 11368 elems = seed || byElement && Expr.find.TAG( "*", outermost ), 11369 11370 // Use integer dirruns iff this is the outermost matcher 11371 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), 11372 len = elems.length; 11373 11374 if ( outermost ) { 11375 11376 // Support: IE 11+, Edge 17 - 18+ 11377 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 11378 // two documents; shallow comparisons work. 11379 // eslint-disable-next-line eqeqeq 11380 outermostContext = context == document || context || outermost; 11381 } 11382 11383 // Add elements passing elementMatchers directly to results 11384 // Support: iOS <=7 - 9 only 11385 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching 11386 // elements by id. (see trac-14142) 11387 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { 11388 if ( byElement && elem ) { 11389 j = 0; 11390 11391 // Support: IE 11+, Edge 17 - 18+ 11392 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 11393 // two documents; shallow comparisons work. 11394 // eslint-disable-next-line eqeqeq 11395 if ( !context && elem.ownerDocument != document ) { 11396 setDocument( elem ); 11397 xml = !documentIsHTML; 11398 } 11399 while ( ( matcher = elementMatchers[ j++ ] ) ) { 11400 if ( matcher( elem, context || document, xml ) ) { 11401 push.call( results, elem ); 11402 break; 11403 } 11404 } 11405 if ( outermost ) { 11406 dirruns = dirrunsUnique; 11407 } 11408 } 11409 11410 // Track unmatched elements for set filters 11411 if ( bySet ) { 11412 11413 // They will have gone through all possible matchers 11414 if ( ( elem = !matcher && elem ) ) { 11415 matchedCount--; 11416 } 11417 11418 // Lengthen the array for every element, matched or not 11419 if ( seed ) { 11420 unmatched.push( elem ); 11421 } 11422 } 11423 } 11424 11425 // `i` is now the count of elements visited above, and adding it to `matchedCount` 11426 // makes the latter nonnegative. 11427 matchedCount += i; 11428 11429 // Apply set filters to unmatched elements 11430 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 11431 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 11432 // no element matchers and no seed. 11433 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 11434 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 11435 // numerically zero. 11436 if ( bySet && i !== matchedCount ) { 11437 j = 0; 11438 while ( ( matcher = setMatchers[ j++ ] ) ) { 11439 matcher( unmatched, setMatched, context, xml ); 11440 } 11441 11442 if ( seed ) { 11443 11444 // Reintegrate element matches to eliminate the need for sorting 11445 if ( matchedCount > 0 ) { 11446 while ( i-- ) { 11447 if ( !( unmatched[ i ] || setMatched[ i ] ) ) { 11448 setMatched[ i ] = pop.call( results ); 11449 } 11450 } 11451 } 11452 11453 // Discard index placeholder values to get only actual matches 11454 setMatched = condense( setMatched ); 11455 } 11456 11457 // Add matches to results 11458 push.apply( results, setMatched ); 11459 11460 // Seedless set matches succeeding multiple successful matchers stipulate sorting 11461 if ( outermost && !seed && setMatched.length > 0 && 11462 ( matchedCount + setMatchers.length ) > 1 ) { 11463 11464 jQuery.uniqueSort( results ); 11465 } 11466 } 11467 11468 // Override manipulation of globals by nested matchers 11469 if ( outermost ) { 11470 dirruns = dirrunsUnique; 11471 outermostContext = contextBackup; 11472 } 11473 11474 return unmatched; 11475 }; 11476 11477 return bySet ? 11478 markFunction( superMatcher ) : 11479 superMatcher; 11480} 11481 11482function compile( selector, match /* Internal Use Only */ ) { 11483 var i, 11484 setMatchers = [], 11485 elementMatchers = [], 11486 cached = compilerCache[ selector + " " ]; 11487 11488 if ( !cached ) { 11489 11490 // Generate a function of recursive functions that can be used to check each element 11491 if ( !match ) { 11492 match = tokenize( selector ); 11493 } 11494 i = match.length; 11495 while ( i-- ) { 11496 cached = matcherFromTokens( match[ i ] ); 11497 if ( cached[ expando ] ) { 11498 setMatchers.push( cached ); 11499 } else { 11500 elementMatchers.push( cached ); 11501 } 11502 } 11503 11504 // Cache the compiled function 11505 cached = compilerCache( selector, 11506 matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 11507 11508 // Save selector and tokenization 11509 cached.selector = selector; 11510 } 11511 return cached; 11512} 11513 11514/** 11515 * A low-level selection function that works with jQuery's compiled 11516 * selector functions 11517 * @param {String|Function} selector A selector or a pre-compiled 11518 * selector function built with jQuery selector compile 11519 * @param {Element} context 11520 * @param {Array} [results] 11521 * @param {Array} [seed] A set of elements to match against 11522 */ 11523function select( selector, context, results, seed ) { 11524 var i, tokens, token, type, find, 11525 compiled = typeof selector === "function" && selector, 11526 match = !seed && tokenize( ( selector = compiled.selector || selector ) ); 11527 11528 results = results || []; 11529 11530 // Try to minimize operations if there is only one selector in the list and no seed 11531 // (the latter of which guarantees us context) 11532 if ( match.length === 1 ) { 11533 11534 // Reduce context if the leading compound selector is an ID 11535 tokens = match[ 0 ] = match[ 0 ].slice( 0 ); 11536 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && 11537 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { 11538 11539 context = ( Expr.find.ID( 11540 token.matches[ 0 ].replace( runescape, funescape ), 11541 context 11542 ) || [] )[ 0 ]; 11543 if ( !context ) { 11544 return results; 11545 11546 // Precompiled matchers will still verify ancestry, so step up a level 11547 } else if ( compiled ) { 11548 context = context.parentNode; 11549 } 11550 11551 selector = selector.slice( tokens.shift().value.length ); 11552 } 11553 11554 // Fetch a seed set for right-to-left matching 11555 i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length; 11556 while ( i-- ) { 11557 token = tokens[ i ]; 11558 11559 // Abort if we hit a combinator 11560 if ( Expr.relative[ ( type = token.type ) ] ) { 11561 break; 11562 } 11563 if ( ( find = Expr.find[ type ] ) ) { 11564 11565 // Search, expanding context for leading sibling combinators 11566 if ( ( seed = find( 11567 token.matches[ 0 ].replace( runescape, funescape ), 11568 rsibling.test( tokens[ 0 ].type ) && 11569 testContext( context.parentNode ) || context 11570 ) ) ) { 11571 11572 // If seed is empty or no tokens remain, we can return early 11573 tokens.splice( i, 1 ); 11574 selector = seed.length && toSelector( tokens ); 11575 if ( !selector ) { 11576 push.apply( results, seed ); 11577 return results; 11578 } 11579 11580 break; 11581 } 11582 } 11583 } 11584 } 11585 11586 // Compile and execute a filtering function if one is not provided 11587 // Provide `match` to avoid retokenization if we modified the selector above 11588 ( compiled || compile( selector, match ) )( 11589 seed, 11590 context, 11591 !documentIsHTML, 11592 results, 11593 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 11594 ); 11595 return results; 11596} 11597 11598// One-time assignments 11599 11600// Support: Android <=4.0 - 4.1+ 11601// Sort stability 11602support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; 11603 11604// Initialize against the default document 11605setDocument(); 11606 11607// Support: Android <=4.0 - 4.1+ 11608// Detached nodes confoundingly follow *each other* 11609support.sortDetached = assert( function( el ) { 11610 11611 // Should return 1, but returns 4 (following) 11612 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; 11613} ); 11614 11615jQuery.find = find; 11616 11617// Deprecated 11618jQuery.expr[ ":" ] = jQuery.expr.pseudos; 11619jQuery.unique = jQuery.uniqueSort; 11620 11621// These have always been private, but they used to be documented as part of 11622// Sizzle so let's maintain them for now for backwards compatibility purposes. 11623find.compile = compile; 11624find.select = select; 11625find.setDocument = setDocument; 11626find.tokenize = tokenize; 11627 11628find.escape = jQuery.escapeSelector; 11629find.getText = jQuery.text; 11630find.isXML = jQuery.isXMLDoc; 11631find.selectors = jQuery.expr; 11632find.support = jQuery.support; 11633find.uniqueSort = jQuery.uniqueSort; 11634 11635 /* eslint-enable */ 11636 11637} )(); 11638 11639 11640var dir = function( elem, dir, until ) { 11641 var matched = [], 11642 truncate = until !== undefined; 11643 11644 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 11645 if ( elem.nodeType === 1 ) { 11646 if ( truncate && jQuery( elem ).is( until ) ) { 11647 break; 11648 } 11649 matched.push( elem ); 11650 } 11651 } 11652 return matched; 11653}; 11654 11655 11656var siblings = function( n, elem ) { 11657 var matched = []; 11658 11659 for ( ; n; n = n.nextSibling ) { 11660 if ( n.nodeType === 1 && n !== elem ) { 11661 matched.push( n ); 11662 } 11663 } 11664 11665 return matched; 11666}; 11667 11668 11669var rneedsContext = jQuery.expr.match.needsContext; 11670 11671var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); 11672 11673 11674 11675// Implement the identical functionality for filter and not 11676function winnow( elements, qualifier, not ) { 11677 if ( isFunction( qualifier ) ) { 11678 return jQuery.grep( elements, function( elem, i ) { 11679 return !!qualifier.call( elem, i, elem ) !== not; 11680 } ); 11681 } 11682 11683 // Single element 11684 if ( qualifier.nodeType ) { 11685 return jQuery.grep( elements, function( elem ) { 11686 return ( elem === qualifier ) !== not; 11687 } ); 11688 } 11689 11690 // Arraylike of elements (jQuery, arguments, Array) 11691 if ( typeof qualifier !== "string" ) { 11692 return jQuery.grep( elements, function( elem ) { 11693 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 11694 } ); 11695 } 11696 11697 // Filtered directly for both simple and complex selectors 11698 return jQuery.filter( qualifier, elements, not ); 11699} 11700 11701jQuery.filter = function( expr, elems, not ) { 11702 var elem = elems[ 0 ]; 11703 11704 if ( not ) { 11705 expr = ":not(" + expr + ")"; 11706 } 11707 11708 if ( elems.length === 1 && elem.nodeType === 1 ) { 11709 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; 11710 } 11711 11712 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 11713 return elem.nodeType === 1; 11714 } ) ); 11715}; 11716 11717jQuery.fn.extend( { 11718 find: function( selector ) { 11719 var i, ret, 11720 len = this.length, 11721 self = this; 11722 11723 if ( typeof selector !== "string" ) { 11724 return this.pushStack( jQuery( selector ).filter( function() { 11725 for ( i = 0; i < len; i++ ) { 11726 if ( jQuery.contains( self[ i ], this ) ) { 11727 return true; 11728 } 11729 } 11730 } ) ); 11731 } 11732 11733 ret = this.pushStack( [] ); 11734 11735 for ( i = 0; i < len; i++ ) { 11736 jQuery.find( selector, self[ i ], ret ); 11737 } 11738 11739 return len > 1 ? jQuery.uniqueSort( ret ) : ret; 11740 }, 11741 filter: function( selector ) { 11742 return this.pushStack( winnow( this, selector || [], false ) ); 11743 }, 11744 not: function( selector ) { 11745 return this.pushStack( winnow( this, selector || [], true ) ); 11746 }, 11747 is: function( selector ) { 11748 return !!winnow( 11749 this, 11750 11751 // If this is a positional/relative selector, check membership in the returned set 11752 // so $("p:first").is("p:last") won't return true for a doc with two "p". 11753 typeof selector === "string" && rneedsContext.test( selector ) ? 11754 jQuery( selector ) : 11755 selector || [], 11756 false 11757 ).length; 11758 } 11759} ); 11760 11761 11762// Initialize a jQuery object 11763 11764 11765// A central reference to the root jQuery(document) 11766var rootjQuery, 11767 11768 // A simple way to check for HTML strings 11769 // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521) 11770 // Strict HTML recognition (trac-11290: must start with <) 11771 // Shortcut simple #id case for speed 11772 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 11773 11774 init = jQuery.fn.init = function( selector, context, root ) { 11775 var match, elem; 11776 11777 // HANDLE: $(""), $(null), $(undefined), $(false) 11778 if ( !selector ) { 11779 return this; 11780 } 11781 11782 // Method init() accepts an alternate rootjQuery 11783 // so migrate can support jQuery.sub (gh-2101) 11784 root = root || rootjQuery; 11785 11786 // Handle HTML strings 11787 if ( typeof selector === "string" ) { 11788 if ( selector[ 0 ] === "<" && 11789 selector[ selector.length - 1 ] === ">" && 11790 selector.length >= 3 ) { 11791 11792 // Assume that strings that start and end with <> are HTML and skip the regex check 11793 match = [ null, selector, null ]; 11794 11795 } else { 11796 match = rquickExpr.exec( selector ); 11797 } 11798 11799 // Match html or make sure no context is specified for #id 11800 if ( match && ( match[ 1 ] || !context ) ) { 11801 11802 // HANDLE: $(html) -> $(array) 11803 if ( match[ 1 ] ) { 11804 context = context instanceof jQuery ? context[ 0 ] : context; 11805 11806 // Option to run scripts is true for back-compat 11807 // Intentionally let the error be thrown if parseHTML is not present 11808 jQuery.merge( this, jQuery.parseHTML( 11809 match[ 1 ], 11810 context && context.nodeType ? context.ownerDocument || context : document, 11811 true 11812 ) ); 11813 11814 // HANDLE: $(html, props) 11815 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 11816 for ( match in context ) { 11817 11818 // Properties of context are called as methods if possible 11819 if ( isFunction( this[ match ] ) ) { 11820 this[ match ]( context[ match ] ); 11821 11822 // ...and otherwise set as attributes 11823 } else { 11824 this.attr( match, context[ match ] ); 11825 } 11826 } 11827 } 11828 11829 return this; 11830 11831 // HANDLE: $(#id) 11832 } else { 11833 elem = document.getElementById( match[ 2 ] ); 11834 11835 if ( elem ) { 11836 11837 // Inject the element directly into the jQuery object 11838 this[ 0 ] = elem; 11839 this.length = 1; 11840 } 11841 return this; 11842 } 11843 11844 // HANDLE: $(expr, $(...)) 11845 } else if ( !context || context.jquery ) { 11846 return ( context || root ).find( selector ); 11847 11848 // HANDLE: $(expr, context) 11849 // (which is just equivalent to: $(context).find(expr) 11850 } else { 11851 return this.constructor( context ).find( selector ); 11852 } 11853 11854 // HANDLE: $(DOMElement) 11855 } else if ( selector.nodeType ) { 11856 this[ 0 ] = selector; 11857 this.length = 1; 11858 return this; 11859 11860 // HANDLE: $(function) 11861 // Shortcut for document ready 11862 } else if ( isFunction( selector ) ) { 11863 return root.ready !== undefined ? 11864 root.ready( selector ) : 11865 11866 // Execute immediately if ready is not present 11867 selector( jQuery ); 11868 } 11869 11870 return jQuery.makeArray( selector, this ); 11871 }; 11872 11873// Give the init function the jQuery prototype for later instantiation 11874init.prototype = jQuery.fn; 11875 11876// Initialize central reference 11877rootjQuery = jQuery( document ); 11878 11879 11880var rparentsprev = /^(?:parents|prev(?:Until|All))/, 11881 11882 // Methods guaranteed to produce a unique set when starting from a unique set 11883 guaranteedUnique = { 11884 children: true, 11885 contents: true, 11886 next: true, 11887 prev: true 11888 }; 11889 11890jQuery.fn.extend( { 11891 has: function( target ) { 11892 var targets = jQuery( target, this ), 11893 l = targets.length; 11894 11895 return this.filter( function() { 11896 var i = 0; 11897 for ( ; i < l; i++ ) { 11898 if ( jQuery.contains( this, targets[ i ] ) ) { 11899 return true; 11900 } 11901 } 11902 } ); 11903 }, 11904 11905 closest: function( selectors, context ) { 11906 var cur, 11907 i = 0, 11908 l = this.length, 11909 matched = [], 11910 targets = typeof selectors !== "string" && jQuery( selectors ); 11911 11912 // Positional selectors never match, since there's no _selection_ context 11913 if ( !rneedsContext.test( selectors ) ) { 11914 for ( ; i < l; i++ ) { 11915 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 11916 11917 // Always skip document fragments 11918 if ( cur.nodeType < 11 && ( targets ? 11919 targets.index( cur ) > -1 : 11920 11921 // Don't pass non-elements to jQuery#find 11922 cur.nodeType === 1 && 11923 jQuery.find.matchesSelector( cur, selectors ) ) ) { 11924 11925 matched.push( cur ); 11926 break; 11927 } 11928 } 11929 } 11930 } 11931 11932 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 11933 }, 11934 11935 // Determine the position of an element within the set 11936 index: function( elem ) { 11937 11938 // No argument, return index in parent 11939 if ( !elem ) { 11940 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 11941 } 11942 11943 // Index in selector 11944 if ( typeof elem === "string" ) { 11945 return indexOf.call( jQuery( elem ), this[ 0 ] ); 11946 } 11947 11948 // Locate the position of the desired element 11949 return indexOf.call( this, 11950 11951 // If it receives a jQuery object, the first element is used 11952 elem.jquery ? elem[ 0 ] : elem 11953 ); 11954 }, 11955 11956 add: function( selector, context ) { 11957 return this.pushStack( 11958 jQuery.uniqueSort( 11959 jQuery.merge( this.get(), jQuery( selector, context ) ) 11960 ) 11961 ); 11962 }, 11963 11964 addBack: function( selector ) { 11965 return this.add( selector == null ? 11966 this.prevObject : this.prevObject.filter( selector ) 11967 ); 11968 } 11969} ); 11970 11971function sibling( cur, dir ) { 11972 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 11973 return cur; 11974} 11975 11976jQuery.each( { 11977 parent: function( elem ) { 11978 var parent = elem.parentNode; 11979 return parent && parent.nodeType !== 11 ? parent : null; 11980 }, 11981 parents: function( elem ) { 11982 return dir( elem, "parentNode" ); 11983 }, 11984 parentsUntil: function( elem, _i, until ) { 11985 return dir( elem, "parentNode", until ); 11986 }, 11987 next: function( elem ) { 11988 return sibling( elem, "nextSibling" ); 11989 }, 11990 prev: function( elem ) { 11991 return sibling( elem, "previousSibling" ); 11992 }, 11993 nextAll: function( elem ) { 11994 return dir( elem, "nextSibling" ); 11995 }, 11996 prevAll: function( elem ) { 11997 return dir( elem, "previousSibling" ); 11998 }, 11999 nextUntil: function( elem, _i, until ) { 12000 return dir( elem, "nextSibling", until ); 12001 }, 12002 prevUntil: function( elem, _i, until ) { 12003 return dir( elem, "previousSibling", until ); 12004 }, 12005 siblings: function( elem ) { 12006 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 12007 }, 12008 children: function( elem ) { 12009 return siblings( elem.firstChild ); 12010 }, 12011 contents: function( elem ) { 12012 if ( elem.contentDocument != null && 12013 12014 // Support: IE 11+ 12015 // <object> elements with no `data` attribute has an object 12016 // `contentDocument` with a `null` prototype. 12017 getProto( elem.contentDocument ) ) { 12018 12019 return elem.contentDocument; 12020 } 12021 12022 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 12023 // Treat the template element as a regular one in browsers that 12024 // don't support it. 12025 if ( nodeName( elem, "template" ) ) { 12026 elem = elem.content || elem; 12027 } 12028 12029 return jQuery.merge( [], elem.childNodes ); 12030 } 12031}, function( name, fn ) { 12032 jQuery.fn[ name ] = function( until, selector ) { 12033 var matched = jQuery.map( this, fn, until ); 12034 12035 if ( name.slice( -5 ) !== "Until" ) { 12036 selector = until; 12037 } 12038 12039 if ( selector && typeof selector === "string" ) { 12040 matched = jQuery.filter( selector, matched ); 12041 } 12042 12043 if ( this.length > 1 ) { 12044 12045 // Remove duplicates 12046 if ( !guaranteedUnique[ name ] ) { 12047 jQuery.uniqueSort( matched ); 12048 } 12049 12050 // Reverse order for parents* and prev-derivatives 12051 if ( rparentsprev.test( name ) ) { 12052 matched.reverse(); 12053 } 12054 } 12055 12056 return this.pushStack( matched ); 12057 }; 12058} ); 12059var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); 12060 12061 12062 12063// Convert String-formatted options into Object-formatted ones 12064function createOptions( options ) { 12065 var object = {}; 12066 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { 12067 object[ flag ] = true; 12068 } ); 12069 return object; 12070} 12071 12072/* 12073 * Create a callback list using the following parameters: 12074 * 12075 * options: an optional list of space-separated options that will change how 12076 * the callback list behaves or a more traditional option object 12077 * 12078 * By default a callback list will act like an event callback list and can be 12079 * "fired" multiple times. 12080 * 12081 * Possible options: 12082 * 12083 * once: will ensure the callback list can only be fired once (like a Deferred) 12084 * 12085 * memory: will keep track of previous values and will call any callback added 12086 * after the list has been fired right away with the latest "memorized" 12087 * values (like a Deferred) 12088 * 12089 * unique: will ensure a callback can only be added once (no duplicate in the list) 12090 * 12091 * stopOnFalse: interrupt callings when a callback returns false 12092 * 12093 */ 12094jQuery.Callbacks = function( options ) { 12095 12096 // Convert options from String-formatted to Object-formatted if needed 12097 // (we check in cache first) 12098 options = typeof options === "string" ? 12099 createOptions( options ) : 12100 jQuery.extend( {}, options ); 12101 12102 var // Flag to know if list is currently firing 12103 firing, 12104 12105 // Last fire value for non-forgettable lists 12106 memory, 12107 12108 // Flag to know if list was already fired 12109 fired, 12110 12111 // Flag to prevent firing 12112 locked, 12113 12114 // Actual callback list 12115 list = [], 12116 12117 // Queue of execution data for repeatable lists 12118 queue = [], 12119 12120 // Index of currently firing callback (modified by add/remove as needed) 12121 firingIndex = -1, 12122 12123 // Fire callbacks 12124 fire = function() { 12125 12126 // Enforce single-firing 12127 locked = locked || options.once; 12128 12129 // Execute callbacks for all pending executions, 12130 // respecting firingIndex overrides and runtime changes 12131 fired = firing = true; 12132 for ( ; queue.length; firingIndex = -1 ) { 12133 memory = queue.shift(); 12134 while ( ++firingIndex < list.length ) { 12135 12136 // Run callback and check for early termination 12137 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 12138 options.stopOnFalse ) { 12139 12140 // Jump to end and forget the data so .add doesn't re-fire 12141 firingIndex = list.length; 12142 memory = false; 12143 } 12144 } 12145 } 12146 12147 // Forget the data if we're done with it 12148 if ( !options.memory ) { 12149 memory = false; 12150 } 12151 12152 firing = false; 12153 12154 // Clean up if we're done firing for good 12155 if ( locked ) { 12156 12157 // Keep an empty list if we have data for future add calls 12158 if ( memory ) { 12159 list = []; 12160 12161 // Otherwise, this object is spent 12162 } else { 12163 list = ""; 12164 } 12165 } 12166 }, 12167 12168 // Actual Callbacks object 12169 self = { 12170 12171 // Add a callback or a collection of callbacks to the list 12172 add: function() { 12173 if ( list ) { 12174 12175 // If we have memory from a past run, we should fire after adding 12176 if ( memory && !firing ) { 12177 firingIndex = list.length - 1; 12178 queue.push( memory ); 12179 } 12180 12181 ( function add( args ) { 12182 jQuery.each( args, function( _, arg ) { 12183 if ( isFunction( arg ) ) { 12184 if ( !options.unique || !self.has( arg ) ) { 12185 list.push( arg ); 12186 } 12187 } else if ( arg && arg.length && toType( arg ) !== "string" ) { 12188 12189 // Inspect recursively 12190 add( arg ); 12191 } 12192 } ); 12193 } )( arguments ); 12194 12195 if ( memory && !firing ) { 12196 fire(); 12197 } 12198 } 12199 return this; 12200 }, 12201 12202 // Remove a callback from the list 12203 remove: function() { 12204 jQuery.each( arguments, function( _, arg ) { 12205 var index; 12206 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 12207 list.splice( index, 1 ); 12208 12209 // Handle firing indexes 12210 if ( index <= firingIndex ) { 12211 firingIndex--; 12212 } 12213 } 12214 } ); 12215 return this; 12216 }, 12217 12218 // Check if a given callback is in the list. 12219 // If no argument is given, return whether or not list has callbacks attached. 12220 has: function( fn ) { 12221 return fn ? 12222 jQuery.inArray( fn, list ) > -1 : 12223 list.length > 0; 12224 }, 12225 12226 // Remove all callbacks from the list 12227 empty: function() { 12228 if ( list ) { 12229 list = []; 12230 } 12231 return this; 12232 }, 12233 12234 // Disable .fire and .add 12235 // Abort any current/pending executions 12236 // Clear all callbacks and values 12237 disable: function() { 12238 locked = queue = []; 12239 list = memory = ""; 12240 return this; 12241 }, 12242 disabled: function() { 12243 return !list; 12244 }, 12245 12246 // Disable .fire 12247 // Also disable .add unless we have memory (since it would have no effect) 12248 // Abort any pending executions 12249 lock: function() { 12250 locked = queue = []; 12251 if ( !memory && !firing ) { 12252 list = memory = ""; 12253 } 12254 return this; 12255 }, 12256 locked: function() { 12257 return !!locked; 12258 }, 12259 12260 // Call all callbacks with the given context and arguments 12261 fireWith: function( context, args ) { 12262 if ( !locked ) { 12263 args = args || []; 12264 args = [ context, args.slice ? args.slice() : args ]; 12265 queue.push( args ); 12266 if ( !firing ) { 12267 fire(); 12268 } 12269 } 12270 return this; 12271 }, 12272 12273 // Call all the callbacks with the given arguments 12274 fire: function() { 12275 self.fireWith( this, arguments ); 12276 return this; 12277 }, 12278 12279 // To know if the callbacks have already been called at least once 12280 fired: function() { 12281 return !!fired; 12282 } 12283 }; 12284 12285 return self; 12286}; 12287 12288 12289function Identity( v ) { 12290 return v; 12291} 12292function Thrower( ex ) { 12293 throw ex; 12294} 12295 12296function adoptValue( value, resolve, reject, noValue ) { 12297 var method; 12298 12299 try { 12300 12301 // Check for promise aspect first to privilege synchronous behavior 12302 if ( value && isFunction( ( method = value.promise ) ) ) { 12303 method.call( value ).done( resolve ).fail( reject ); 12304 12305 // Other thenables 12306 } else if ( value && isFunction( ( method = value.then ) ) ) { 12307 method.call( value, resolve, reject ); 12308 12309 // Other non-thenables 12310 } else { 12311 12312 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 12313 // * false: [ value ].slice( 0 ) => resolve( value ) 12314 // * true: [ value ].slice( 1 ) => resolve() 12315 resolve.apply( undefined, [ value ].slice( noValue ) ); 12316 } 12317 12318 // For Promises/A+, convert exceptions into rejections 12319 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 12320 // Deferred#then to conditionally suppress rejection. 12321 } catch ( value ) { 12322 12323 // Support: Android 4.0 only 12324 // Strict mode functions invoked without .call/.apply get global-object context 12325 reject.apply( undefined, [ value ] ); 12326 } 12327} 12328 12329jQuery.extend( { 12330 12331 Deferred: function( func ) { 12332 var tuples = [ 12333 12334 // action, add listener, callbacks, 12335 // ... .then handlers, argument index, [final state] 12336 [ "notify", "progress", jQuery.Callbacks( "memory" ), 12337 jQuery.Callbacks( "memory" ), 2 ], 12338 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 12339 jQuery.Callbacks( "once memory" ), 0, "resolved" ], 12340 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 12341 jQuery.Callbacks( "once memory" ), 1, "rejected" ] 12342 ], 12343 state = "pending", 12344 promise = { 12345 state: function() { 12346 return state; 12347 }, 12348 always: function() { 12349 deferred.done( arguments ).fail( arguments ); 12350 return this; 12351 }, 12352 "catch": function( fn ) { 12353 return promise.then( null, fn ); 12354 }, 12355 12356 // Keep pipe for back-compat 12357 pipe: function( /* fnDone, fnFail, fnProgress */ ) { 12358 var fns = arguments; 12359 12360 return jQuery.Deferred( function( newDefer ) { 12361 jQuery.each( tuples, function( _i, tuple ) { 12362 12363 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 12364 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; 12365 12366 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 12367 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 12368 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 12369 deferred[ tuple[ 1 ] ]( function() { 12370 var returned = fn && fn.apply( this, arguments ); 12371 if ( returned && isFunction( returned.promise ) ) { 12372 returned.promise() 12373 .progress( newDefer.notify ) 12374 .done( newDefer.resolve ) 12375 .fail( newDefer.reject ); 12376 } else { 12377 newDefer[ tuple[ 0 ] + "With" ]( 12378 this, 12379 fn ? [ returned ] : arguments 12380 ); 12381 } 12382 } ); 12383 } ); 12384 fns = null; 12385 } ).promise(); 12386 }, 12387 then: function( onFulfilled, onRejected, onProgress ) { 12388 var maxDepth = 0; 12389 function resolve( depth, deferred, handler, special ) { 12390 return function() { 12391 var that = this, 12392 args = arguments, 12393 mightThrow = function() { 12394 var returned, then; 12395 12396 // Support: Promises/A+ section 2.3.3.3.3 12397 // https://promisesaplus.com/#point-59 12398 // Ignore double-resolution attempts 12399 if ( depth < maxDepth ) { 12400 return; 12401 } 12402 12403 returned = handler.apply( that, args ); 12404 12405 // Support: Promises/A+ section 2.3.1 12406 // https://promisesaplus.com/#point-48 12407 if ( returned === deferred.promise() ) { 12408 throw new TypeError( "Thenable self-resolution" ); 12409 } 12410 12411 // Support: Promises/A+ sections 2.3.3.1, 3.5 12412 // https://promisesaplus.com/#point-54 12413 // https://promisesaplus.com/#point-75 12414 // Retrieve `then` only once 12415 then = returned && 12416 12417 // Support: Promises/A+ section 2.3.4 12418 // https://promisesaplus.com/#point-64 12419 // Only check objects and functions for thenability 12420 ( typeof returned === "object" || 12421 typeof returned === "function" ) && 12422 returned.then; 12423 12424 // Handle a returned thenable 12425 if ( isFunction( then ) ) { 12426 12427 // Special processors (notify) just wait for resolution 12428 if ( special ) { 12429 then.call( 12430 returned, 12431 resolve( maxDepth, deferred, Identity, special ), 12432 resolve( maxDepth, deferred, Thrower, special ) 12433 ); 12434 12435 // Normal processors (resolve) also hook into progress 12436 } else { 12437 12438 // ...and disregard older resolution values 12439 maxDepth++; 12440 12441 then.call( 12442 returned, 12443 resolve( maxDepth, deferred, Identity, special ), 12444 resolve( maxDepth, deferred, Thrower, special ), 12445 resolve( maxDepth, deferred, Identity, 12446 deferred.notifyWith ) 12447 ); 12448 } 12449 12450 // Handle all other returned values 12451 } else { 12452 12453 // Only substitute handlers pass on context 12454 // and multiple values (non-spec behavior) 12455 if ( handler !== Identity ) { 12456 that = undefined; 12457 args = [ returned ]; 12458 } 12459 12460 // Process the value(s) 12461 // Default process is resolve 12462 ( special || deferred.resolveWith )( that, args ); 12463 } 12464 }, 12465 12466 // Only normal processors (resolve) catch and reject exceptions 12467 process = special ? 12468 mightThrow : 12469 function() { 12470 try { 12471 mightThrow(); 12472 } catch ( e ) { 12473 12474 if ( jQuery.Deferred.exceptionHook ) { 12475 jQuery.Deferred.exceptionHook( e, 12476 process.error ); 12477 } 12478 12479 // Support: Promises/A+ section 2.3.3.3.4.1 12480 // https://promisesaplus.com/#point-61 12481 // Ignore post-resolution exceptions 12482 if ( depth + 1 >= maxDepth ) { 12483 12484 // Only substitute handlers pass on context 12485 // and multiple values (non-spec behavior) 12486 if ( handler !== Thrower ) { 12487 that = undefined; 12488 args = [ e ]; 12489 } 12490 12491 deferred.rejectWith( that, args ); 12492 } 12493 } 12494 }; 12495 12496 // Support: Promises/A+ section 2.3.3.3.1 12497 // https://promisesaplus.com/#point-57 12498 // Re-resolve promises immediately to dodge false rejection from 12499 // subsequent errors 12500 if ( depth ) { 12501 process(); 12502 } else { 12503 12504 // Call an optional hook to record the error, in case of exception 12505 // since it's otherwise lost when execution goes async 12506 if ( jQuery.Deferred.getErrorHook ) { 12507 process.error = jQuery.Deferred.getErrorHook(); 12508 12509 // The deprecated alias of the above. While the name suggests 12510 // returning the stack, not an error instance, jQuery just passes 12511 // it directly to `console.warn` so both will work; an instance 12512 // just better cooperates with source maps. 12513 } else if ( jQuery.Deferred.getStackHook ) { 12514 process.error = jQuery.Deferred.getStackHook(); 12515 } 12516 window.setTimeout( process ); 12517 } 12518 }; 12519 } 12520 12521 return jQuery.Deferred( function( newDefer ) { 12522 12523 // progress_handlers.add( ... ) 12524 tuples[ 0 ][ 3 ].add( 12525 resolve( 12526 0, 12527 newDefer, 12528 isFunction( onProgress ) ? 12529 onProgress : 12530 Identity, 12531 newDefer.notifyWith 12532 ) 12533 ); 12534 12535 // fulfilled_handlers.add( ... ) 12536 tuples[ 1 ][ 3 ].add( 12537 resolve( 12538 0, 12539 newDefer, 12540 isFunction( onFulfilled ) ? 12541 onFulfilled : 12542 Identity 12543 ) 12544 ); 12545 12546 // rejected_handlers.add( ... ) 12547 tuples[ 2 ][ 3 ].add( 12548 resolve( 12549 0, 12550 newDefer, 12551 isFunction( onRejected ) ? 12552 onRejected : 12553 Thrower 12554 ) 12555 ); 12556 } ).promise(); 12557 }, 12558 12559 // Get a promise for this deferred 12560 // If obj is provided, the promise aspect is added to the object 12561 promise: function( obj ) { 12562 return obj != null ? jQuery.extend( obj, promise ) : promise; 12563 } 12564 }, 12565 deferred = {}; 12566 12567 // Add list-specific methods 12568 jQuery.each( tuples, function( i, tuple ) { 12569 var list = tuple[ 2 ], 12570 stateString = tuple[ 5 ]; 12571 12572 // promise.progress = list.add 12573 // promise.done = list.add 12574 // promise.fail = list.add 12575 promise[ tuple[ 1 ] ] = list.add; 12576 12577 // Handle state 12578 if ( stateString ) { 12579 list.add( 12580 function() { 12581 12582 // state = "resolved" (i.e., fulfilled) 12583 // state = "rejected" 12584 state = stateString; 12585 }, 12586 12587 // rejected_callbacks.disable 12588 // fulfilled_callbacks.disable 12589 tuples[ 3 - i ][ 2 ].disable, 12590 12591 // rejected_handlers.disable 12592 // fulfilled_handlers.disable 12593 tuples[ 3 - i ][ 3 ].disable, 12594 12595 // progress_callbacks.lock 12596 tuples[ 0 ][ 2 ].lock, 12597 12598 // progress_handlers.lock 12599 tuples[ 0 ][ 3 ].lock 12600 ); 12601 } 12602 12603 // progress_handlers.fire 12604 // fulfilled_handlers.fire 12605 // rejected_handlers.fire 12606 list.add( tuple[ 3 ].fire ); 12607 12608 // deferred.notify = function() { deferred.notifyWith(...) } 12609 // deferred.resolve = function() { deferred.resolveWith(...) } 12610 // deferred.reject = function() { deferred.rejectWith(...) } 12611 deferred[ tuple[ 0 ] ] = function() { 12612 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); 12613 return this; 12614 }; 12615 12616 // deferred.notifyWith = list.fireWith 12617 // deferred.resolveWith = list.fireWith 12618 // deferred.rejectWith = list.fireWith 12619 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 12620 } ); 12621 12622 // Make the deferred a promise 12623 promise.promise( deferred ); 12624 12625 // Call given func if any 12626 if ( func ) { 12627 func.call( deferred, deferred ); 12628 } 12629 12630 // All done! 12631 return deferred; 12632 }, 12633 12634 // Deferred helper 12635 when: function( singleValue ) { 12636 var 12637 12638 // count of uncompleted subordinates 12639 remaining = arguments.length, 12640 12641 // count of unprocessed arguments 12642 i = remaining, 12643 12644 // subordinate fulfillment data 12645 resolveContexts = Array( i ), 12646 resolveValues = slice.call( arguments ), 12647 12648 // the primary Deferred 12649 primary = jQuery.Deferred(), 12650 12651 // subordinate callback factory 12652 updateFunc = function( i ) { 12653 return function( value ) { 12654 resolveContexts[ i ] = this; 12655 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 12656 if ( !( --remaining ) ) { 12657 primary.resolveWith( resolveContexts, resolveValues ); 12658 } 12659 }; 12660 }; 12661 12662 // Single- and empty arguments are adopted like Promise.resolve 12663 if ( remaining <= 1 ) { 12664 adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, 12665 !remaining ); 12666 12667 // Use .then() to unwrap secondary thenables (cf. gh-3000) 12668 if ( primary.state() === "pending" || 12669 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { 12670 12671 return primary.then(); 12672 } 12673 } 12674 12675 // Multiple arguments are aggregated like Promise.all array elements 12676 while ( i-- ) { 12677 adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); 12678 } 12679 12680 return primary.promise(); 12681 } 12682} ); 12683 12684 12685// These usually indicate a programmer mistake during development, 12686// warn about them ASAP rather than swallowing them by default. 12687var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 12688 12689// If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error 12690// captured before the async barrier to get the original error cause 12691// which may otherwise be hidden. 12692jQuery.Deferred.exceptionHook = function( error, asyncError ) { 12693 12694 // Support: IE 8 - 9 only 12695 // Console exists when dev tools are open, which can happen at any time 12696 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 12697 window.console.warn( "jQuery.Deferred exception: " + error.message, 12698 error.stack, asyncError ); 12699 } 12700}; 12701 12702 12703 12704 12705jQuery.readyException = function( error ) { 12706 window.setTimeout( function() { 12707 throw error; 12708 } ); 12709}; 12710 12711 12712 12713 12714// The deferred used on DOM ready 12715var readyList = jQuery.Deferred(); 12716 12717jQuery.fn.ready = function( fn ) { 12718 12719 readyList 12720 .then( fn ) 12721 12722 // Wrap jQuery.readyException in a function so that the lookup 12723 // happens at the time of error handling instead of callback 12724 // registration. 12725 .catch( function( error ) { 12726 jQuery.readyException( error ); 12727 } ); 12728 12729 return this; 12730}; 12731 12732jQuery.extend( { 12733 12734 // Is the DOM ready to be used? Set to true once it occurs. 12735 isReady: false, 12736 12737 // A counter to track how many items to wait for before 12738 // the ready event fires. See trac-6781 12739 readyWait: 1, 12740 12741 // Handle when the DOM is ready 12742 ready: function( wait ) { 12743 12744 // Abort if there are pending holds or we're already ready 12745 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 12746 return; 12747 } 12748 12749 // Remember that the DOM is ready 12750 jQuery.isReady = true; 12751 12752 // If a normal DOM Ready event fired, decrement, and wait if need be 12753 if ( wait !== true && --jQuery.readyWait > 0 ) { 12754 return; 12755 } 12756 12757 // If there are functions bound, to execute 12758 readyList.resolveWith( document, [ jQuery ] ); 12759 } 12760} ); 12761 12762jQuery.ready.then = readyList.then; 12763 12764// The ready event handler and self cleanup method 12765function completed() { 12766 document.removeEventListener( "DOMContentLoaded", completed ); 12767 window.removeEventListener( "load", completed ); 12768 jQuery.ready(); 12769} 12770 12771// Catch cases where $(document).ready() is called 12772// after the browser event has already occurred. 12773// Support: IE <=9 - 10 only 12774// Older IE sometimes signals "interactive" too soon 12775if ( document.readyState === "complete" || 12776 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 12777 12778 // Handle it asynchronously to allow scripts the opportunity to delay ready 12779 window.setTimeout( jQuery.ready ); 12780 12781} else { 12782 12783 // Use the handy event callback 12784 document.addEventListener( "DOMContentLoaded", completed ); 12785 12786 // A fallback to window.onload, that will always work 12787 window.addEventListener( "load", completed ); 12788} 12789 12790 12791 12792 12793// Multifunctional method to get and set values of a collection 12794// The value/s can optionally be executed if it's a function 12795var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 12796 var i = 0, 12797 len = elems.length, 12798 bulk = key == null; 12799 12800 // Sets many values 12801 if ( toType( key ) === "object" ) { 12802 chainable = true; 12803 for ( i in key ) { 12804 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 12805 } 12806 12807 // Sets one value 12808 } else if ( value !== undefined ) { 12809 chainable = true; 12810 12811 if ( !isFunction( value ) ) { 12812 raw = true; 12813 } 12814 12815 if ( bulk ) { 12816 12817 // Bulk operations run against the entire set 12818 if ( raw ) { 12819 fn.call( elems, value ); 12820 fn = null; 12821 12822 // ...except when executing function values 12823 } else { 12824 bulk = fn; 12825 fn = function( elem, _key, value ) { 12826 return bulk.call( jQuery( elem ), value ); 12827 }; 12828 } 12829 } 12830 12831 if ( fn ) { 12832 for ( ; i < len; i++ ) { 12833 fn( 12834 elems[ i ], key, raw ? 12835 value : 12836 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 12837 ); 12838 } 12839 } 12840 } 12841 12842 if ( chainable ) { 12843 return elems; 12844 } 12845 12846 // Gets 12847 if ( bulk ) { 12848 return fn.call( elems ); 12849 } 12850 12851 return len ? fn( elems[ 0 ], key ) : emptyGet; 12852}; 12853 12854 12855// Matches dashed string for camelizing 12856var rmsPrefix = /^-ms-/, 12857 rdashAlpha = /-([a-z])/g; 12858 12859// Used by camelCase as callback to replace() 12860function fcamelCase( _all, letter ) { 12861 return letter.toUpperCase(); 12862} 12863 12864// Convert dashed to camelCase; used by the css and data modules 12865// Support: IE <=9 - 11, Edge 12 - 15 12866// Microsoft forgot to hump their vendor prefix (trac-9572) 12867function camelCase( string ) { 12868 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 12869} 12870var acceptData = function( owner ) { 12871 12872 // Accepts only: 12873 // - Node 12874 // - Node.ELEMENT_NODE 12875 // - Node.DOCUMENT_NODE 12876 // - Object 12877 // - Any 12878 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 12879}; 12880 12881 12882 12883 12884function Data() { 12885 this.expando = jQuery.expando + Data.uid++; 12886} 12887 12888Data.uid = 1; 12889 12890Data.prototype = { 12891 12892 cache: function( owner ) { 12893 12894 // Check if the owner object already has a cache 12895 var value = owner[ this.expando ]; 12896 12897 // If not, create one 12898 if ( !value ) { 12899 value = {}; 12900 12901 // We can accept data for non-element nodes in modern browsers, 12902 // but we should not, see trac-8335. 12903 // Always return an empty object. 12904 if ( acceptData( owner ) ) { 12905 12906 // If it is a node unlikely to be stringify-ed or looped over 12907 // use plain assignment 12908 if ( owner.nodeType ) { 12909 owner[ this.expando ] = value; 12910 12911 // Otherwise secure it in a non-enumerable property 12912 // configurable must be true to allow the property to be 12913 // deleted when data is removed 12914 } else { 12915 Object.defineProperty( owner, this.expando, { 12916 value: value, 12917 configurable: true 12918 } ); 12919 } 12920 } 12921 } 12922 12923 return value; 12924 }, 12925 set: function( owner, data, value ) { 12926 var prop, 12927 cache = this.cache( owner ); 12928 12929 // Handle: [ owner, key, value ] args 12930 // Always use camelCase key (gh-2257) 12931 if ( typeof data === "string" ) { 12932 cache[ camelCase( data ) ] = value; 12933 12934 // Handle: [ owner, { properties } ] args 12935 } else { 12936 12937 // Copy the properties one-by-one to the cache object 12938 for ( prop in data ) { 12939 cache[ camelCase( prop ) ] = data[ prop ]; 12940 } 12941 } 12942 return cache; 12943 }, 12944 get: function( owner, key ) { 12945 return key === undefined ? 12946 this.cache( owner ) : 12947 12948 // Always use camelCase key (gh-2257) 12949 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; 12950 }, 12951 access: function( owner, key, value ) { 12952 12953 // In cases where either: 12954 // 12955 // 1. No key was specified 12956 // 2. A string key was specified, but no value provided 12957 // 12958 // Take the "read" path and allow the get method to determine 12959 // which value to return, respectively either: 12960 // 12961 // 1. The entire cache object 12962 // 2. The data stored at the key 12963 // 12964 if ( key === undefined || 12965 ( ( key && typeof key === "string" ) && value === undefined ) ) { 12966 12967 return this.get( owner, key ); 12968 } 12969 12970 // When the key is not a string, or both a key and value 12971 // are specified, set or extend (existing objects) with either: 12972 // 12973 // 1. An object of properties 12974 // 2. A key and value 12975 // 12976 this.set( owner, key, value ); 12977 12978 // Since the "set" path can have two possible entry points 12979 // return the expected data based on which path was taken[*] 12980 return value !== undefined ? value : key; 12981 }, 12982 remove: function( owner, key ) { 12983 var i, 12984 cache = owner[ this.expando ]; 12985 12986 if ( cache === undefined ) { 12987 return; 12988 } 12989 12990 if ( key !== undefined ) { 12991 12992 // Support array or space separated string of keys 12993 if ( Array.isArray( key ) ) { 12994 12995 // If key is an array of keys... 12996 // We always set camelCase keys, so remove that. 12997 key = key.map( camelCase ); 12998 } else { 12999 key = camelCase( key ); 13000 13001 // If a key with the spaces exists, use it. 13002 // Otherwise, create an array by matching non-whitespace 13003 key = key in cache ? 13004 [ key ] : 13005 ( key.match( rnothtmlwhite ) || [] ); 13006 } 13007 13008 i = key.length; 13009 13010 while ( i-- ) { 13011 delete cache[ key[ i ] ]; 13012 } 13013 } 13014 13015 // Remove the expando if there's no more data 13016 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 13017 13018 // Support: Chrome <=35 - 45 13019 // Webkit & Blink performance suffers when deleting properties 13020 // from DOM nodes, so set to undefined instead 13021 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 13022 if ( owner.nodeType ) { 13023 owner[ this.expando ] = undefined; 13024 } else { 13025 delete owner[ this.expando ]; 13026 } 13027 } 13028 }, 13029 hasData: function( owner ) { 13030 var cache = owner[ this.expando ]; 13031 return cache !== undefined && !jQuery.isEmptyObject( cache ); 13032 } 13033}; 13034var dataPriv = new Data(); 13035 13036var dataUser = new Data(); 13037 13038 13039 13040// Implementation Summary 13041// 13042// 1. Enforce API surface and semantic compatibility with 1.9.x branch 13043// 2. Improve the module's maintainability by reducing the storage 13044// paths to a single mechanism. 13045// 3. Use the same single mechanism to support "private" and "user" data. 13046// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 13047// 5. Avoid exposing implementation details on user objects (eg. expando properties) 13048// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 13049 13050var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 13051 rmultiDash = /[A-Z]/g; 13052 13053function getData( data ) { 13054 if ( data === "true" ) { 13055 return true; 13056 } 13057 13058 if ( data === "false" ) { 13059 return false; 13060 } 13061 13062 if ( data === "null" ) { 13063 return null; 13064 } 13065 13066 // Only convert to a number if it doesn't change the string 13067 if ( data === +data + "" ) { 13068 return +data; 13069 } 13070 13071 if ( rbrace.test( data ) ) { 13072 return JSON.parse( data ); 13073 } 13074 13075 return data; 13076} 13077 13078function dataAttr( elem, key, data ) { 13079 var name; 13080 13081 // If nothing was found internally, try to fetch any 13082 // data from the HTML5 data-* attribute 13083 if ( data === undefined && elem.nodeType === 1 ) { 13084 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 13085 data = elem.getAttribute( name ); 13086 13087 if ( typeof data === "string" ) { 13088 try { 13089 data = getData( data ); 13090 } catch ( e ) {} 13091 13092 // Make sure we set the data so it isn't changed later 13093 dataUser.set( elem, key, data ); 13094 } else { 13095 data = undefined; 13096 } 13097 } 13098 return data; 13099} 13100 13101jQuery.extend( { 13102 hasData: function( elem ) { 13103 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 13104 }, 13105 13106 data: function( elem, name, data ) { 13107 return dataUser.access( elem, name, data ); 13108 }, 13109 13110 removeData: function( elem, name ) { 13111 dataUser.remove( elem, name ); 13112 }, 13113 13114 // TODO: Now that all calls to _data and _removeData have been replaced 13115 // with direct calls to dataPriv methods, these can be deprecated. 13116 _data: function( elem, name, data ) { 13117 return dataPriv.access( elem, name, data ); 13118 }, 13119 13120 _removeData: function( elem, name ) { 13121 dataPriv.remove( elem, name ); 13122 } 13123} ); 13124 13125jQuery.fn.extend( { 13126 data: function( key, value ) { 13127 var i, name, data, 13128 elem = this[ 0 ], 13129 attrs = elem && elem.attributes; 13130 13131 // Gets all values 13132 if ( key === undefined ) { 13133 if ( this.length ) { 13134 data = dataUser.get( elem ); 13135 13136 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 13137 i = attrs.length; 13138 while ( i-- ) { 13139 13140 // Support: IE 11 only 13141 // The attrs elements can be null (trac-14894) 13142 if ( attrs[ i ] ) { 13143 name = attrs[ i ].name; 13144 if ( name.indexOf( "data-" ) === 0 ) { 13145 name = camelCase( name.slice( 5 ) ); 13146 dataAttr( elem, name, data[ name ] ); 13147 } 13148 } 13149 } 13150 dataPriv.set( elem, "hasDataAttrs", true ); 13151 } 13152 } 13153 13154 return data; 13155 } 13156 13157 // Sets multiple values 13158 if ( typeof key === "object" ) { 13159 return this.each( function() { 13160 dataUser.set( this, key ); 13161 } ); 13162 } 13163 13164 return access( this, function( value ) { 13165 var data; 13166 13167 // The calling jQuery object (element matches) is not empty 13168 // (and therefore has an element appears at this[ 0 ]) and the 13169 // `value` parameter was not undefined. An empty jQuery object 13170 // will result in `undefined` for elem = this[ 0 ] which will 13171 // throw an exception if an attempt to read a data cache is made. 13172 if ( elem && value === undefined ) { 13173 13174 // Attempt to get data from the cache 13175 // The key will always be camelCased in Data 13176 data = dataUser.get( elem, key ); 13177 if ( data !== undefined ) { 13178 return data; 13179 } 13180 13181 // Attempt to "discover" the data in 13182 // HTML5 custom data-* attrs 13183 data = dataAttr( elem, key ); 13184 if ( data !== undefined ) { 13185 return data; 13186 } 13187 13188 // We tried really hard, but the data doesn't exist. 13189 return; 13190 } 13191 13192 // Set the data... 13193 this.each( function() { 13194 13195 // We always store the camelCased key 13196 dataUser.set( this, key, value ); 13197 } ); 13198 }, null, value, arguments.length > 1, null, true ); 13199 }, 13200 13201 removeData: function( key ) { 13202 return this.each( function() { 13203 dataUser.remove( this, key ); 13204 } ); 13205 } 13206} ); 13207 13208 13209jQuery.extend( { 13210 queue: function( elem, type, data ) { 13211 var queue; 13212 13213 if ( elem ) { 13214 type = ( type || "fx" ) + "queue"; 13215 queue = dataPriv.get( elem, type ); 13216 13217 // Speed up dequeue by getting out quickly if this is just a lookup 13218 if ( data ) { 13219 if ( !queue || Array.isArray( data ) ) { 13220 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 13221 } else { 13222 queue.push( data ); 13223 } 13224 } 13225 return queue || []; 13226 } 13227 }, 13228 13229 dequeue: function( elem, type ) { 13230 type = type || "fx"; 13231 13232 var queue = jQuery.queue( elem, type ), 13233 startLength = queue.length, 13234 fn = queue.shift(), 13235 hooks = jQuery._queueHooks( elem, type ), 13236 next = function() { 13237 jQuery.dequeue( elem, type ); 13238 }; 13239 13240 // If the fx queue is dequeued, always remove the progress sentinel 13241 if ( fn === "inprogress" ) { 13242 fn = queue.shift(); 13243 startLength--; 13244 } 13245 13246 if ( fn ) { 13247 13248 // Add a progress sentinel to prevent the fx queue from being 13249 // automatically dequeued 13250 if ( type === "fx" ) { 13251 queue.unshift( "inprogress" ); 13252 } 13253 13254 // Clear up the last queue stop function 13255 delete hooks.stop; 13256 fn.call( elem, next, hooks ); 13257 } 13258 13259 if ( !startLength && hooks ) { 13260 hooks.empty.fire(); 13261 } 13262 }, 13263 13264 // Not public - generate a queueHooks object, or return the current one 13265 _queueHooks: function( elem, type ) { 13266 var key = type + "queueHooks"; 13267 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 13268 empty: jQuery.Callbacks( "once memory" ).add( function() { 13269 dataPriv.remove( elem, [ type + "queue", key ] ); 13270 } ) 13271 } ); 13272 } 13273} ); 13274 13275jQuery.fn.extend( { 13276 queue: function( type, data ) { 13277 var setter = 2; 13278 13279 if ( typeof type !== "string" ) { 13280 data = type; 13281 type = "fx"; 13282 setter--; 13283 } 13284 13285 if ( arguments.length < setter ) { 13286 return jQuery.queue( this[ 0 ], type ); 13287 } 13288 13289 return data === undefined ? 13290 this : 13291 this.each( function() { 13292 var queue = jQuery.queue( this, type, data ); 13293 13294 // Ensure a hooks for this queue 13295 jQuery._queueHooks( this, type ); 13296 13297 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 13298 jQuery.dequeue( this, type ); 13299 } 13300 } ); 13301 }, 13302 dequeue: function( type ) { 13303 return this.each( function() { 13304 jQuery.dequeue( this, type ); 13305 } ); 13306 }, 13307 clearQueue: function( type ) { 13308 return this.queue( type || "fx", [] ); 13309 }, 13310 13311 // Get a promise resolved when queues of a certain type 13312 // are emptied (fx is the type by default) 13313 promise: function( type, obj ) { 13314 var tmp, 13315 count = 1, 13316 defer = jQuery.Deferred(), 13317 elements = this, 13318 i = this.length, 13319 resolve = function() { 13320 if ( !( --count ) ) { 13321 defer.resolveWith( elements, [ elements ] ); 13322 } 13323 }; 13324 13325 if ( typeof type !== "string" ) { 13326 obj = type; 13327 type = undefined; 13328 } 13329 type = type || "fx"; 13330 13331 while ( i-- ) { 13332 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 13333 if ( tmp && tmp.empty ) { 13334 count++; 13335 tmp.empty.add( resolve ); 13336 } 13337 } 13338 resolve(); 13339 return defer.promise( obj ); 13340 } 13341} ); 13342var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 13343 13344var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 13345 13346 13347var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 13348 13349var documentElement = document.documentElement; 13350 13351 13352 13353 var isAttached = function( elem ) { 13354 return jQuery.contains( elem.ownerDocument, elem ); 13355 }, 13356 composed = { composed: true }; 13357 13358 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only 13359 // Check attachment across shadow DOM boundaries when possible (gh-3504) 13360 // Support: iOS 10.0-10.2 only 13361 // Early iOS 10 versions support `attachShadow` but not `getRootNode`, 13362 // leading to errors. We need to check for `getRootNode`. 13363 if ( documentElement.getRootNode ) { 13364 isAttached = function( elem ) { 13365 return jQuery.contains( elem.ownerDocument, elem ) || 13366 elem.getRootNode( composed ) === elem.ownerDocument; 13367 }; 13368 } 13369var isHiddenWithinTree = function( elem, el ) { 13370 13371 // isHiddenWithinTree might be called from jQuery#filter function; 13372 // in that case, element will be second argument 13373 elem = el || elem; 13374 13375 // Inline style trumps all 13376 return elem.style.display === "none" || 13377 elem.style.display === "" && 13378 13379 // Otherwise, check computed style 13380 // Support: Firefox <=43 - 45 13381 // Disconnected elements can have computed display: none, so first confirm that elem is 13382 // in the document. 13383 isAttached( elem ) && 13384 13385 jQuery.css( elem, "display" ) === "none"; 13386 }; 13387 13388 13389 13390function adjustCSS( elem, prop, valueParts, tween ) { 13391 var adjusted, scale, 13392 maxIterations = 20, 13393 currentValue = tween ? 13394 function() { 13395 return tween.cur(); 13396 } : 13397 function() { 13398 return jQuery.css( elem, prop, "" ); 13399 }, 13400 initial = currentValue(), 13401 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 13402 13403 // Starting value computation is required for potential unit mismatches 13404 initialInUnit = elem.nodeType && 13405 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 13406 rcssNum.exec( jQuery.css( elem, prop ) ); 13407 13408 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 13409 13410 // Support: Firefox <=54 13411 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 13412 initial = initial / 2; 13413 13414 // Trust units reported by jQuery.css 13415 unit = unit || initialInUnit[ 3 ]; 13416 13417 // Iteratively approximate from a nonzero starting point 13418 initialInUnit = +initial || 1; 13419 13420 while ( maxIterations-- ) { 13421 13422 // Evaluate and update our best guess (doubling guesses that zero out). 13423 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 13424 jQuery.style( elem, prop, initialInUnit + unit ); 13425 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { 13426 maxIterations = 0; 13427 } 13428 initialInUnit = initialInUnit / scale; 13429 13430 } 13431 13432 initialInUnit = initialInUnit * 2; 13433 jQuery.style( elem, prop, initialInUnit + unit ); 13434 13435 // Make sure we update the tween properties later on 13436 valueParts = valueParts || []; 13437 } 13438 13439 if ( valueParts ) { 13440 initialInUnit = +initialInUnit || +initial || 0; 13441 13442 // Apply relative offset (+=/-=) if specified 13443 adjusted = valueParts[ 1 ] ? 13444 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 13445 +valueParts[ 2 ]; 13446 if ( tween ) { 13447 tween.unit = unit; 13448 tween.start = initialInUnit; 13449 tween.end = adjusted; 13450 } 13451 } 13452 return adjusted; 13453} 13454 13455 13456var defaultDisplayMap = {}; 13457 13458function getDefaultDisplay( elem ) { 13459 var temp, 13460 doc = elem.ownerDocument, 13461 nodeName = elem.nodeName, 13462 display = defaultDisplayMap[ nodeName ]; 13463 13464 if ( display ) { 13465 return display; 13466 } 13467 13468 temp = doc.body.appendChild( doc.createElement( nodeName ) ); 13469 display = jQuery.css( temp, "display" ); 13470 13471 temp.parentNode.removeChild( temp ); 13472 13473 if ( display === "none" ) { 13474 display = "block"; 13475 } 13476 defaultDisplayMap[ nodeName ] = display; 13477 13478 return display; 13479} 13480 13481function showHide( elements, show ) { 13482 var display, elem, 13483 values = [], 13484 index = 0, 13485 length = elements.length; 13486 13487 // Determine new display value for elements that need to change 13488 for ( ; index < length; index++ ) { 13489 elem = elements[ index ]; 13490 if ( !elem.style ) { 13491 continue; 13492 } 13493 13494 display = elem.style.display; 13495 if ( show ) { 13496 13497 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 13498 // check is required in this first loop unless we have a nonempty display value (either 13499 // inline or about-to-be-restored) 13500 if ( display === "none" ) { 13501 values[ index ] = dataPriv.get( elem, "display" ) || null; 13502 if ( !values[ index ] ) { 13503 elem.style.display = ""; 13504 } 13505 } 13506 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { 13507 values[ index ] = getDefaultDisplay( elem ); 13508 } 13509 } else { 13510 if ( display !== "none" ) { 13511 values[ index ] = "none"; 13512 13513 // Remember what we're overwriting 13514 dataPriv.set( elem, "display", display ); 13515 } 13516 } 13517 } 13518 13519 // Set the display of the elements in a second loop to avoid constant reflow 13520 for ( index = 0; index < length; index++ ) { 13521 if ( values[ index ] != null ) { 13522 elements[ index ].style.display = values[ index ]; 13523 } 13524 } 13525 13526 return elements; 13527} 13528 13529jQuery.fn.extend( { 13530 show: function() { 13531 return showHide( this, true ); 13532 }, 13533 hide: function() { 13534 return showHide( this ); 13535 }, 13536 toggle: function( state ) { 13537 if ( typeof state === "boolean" ) { 13538 return state ? this.show() : this.hide(); 13539 } 13540 13541 return this.each( function() { 13542 if ( isHiddenWithinTree( this ) ) { 13543 jQuery( this ).show(); 13544 } else { 13545 jQuery( this ).hide(); 13546 } 13547 } ); 13548 } 13549} ); 13550var rcheckableType = ( /^(?:checkbox|radio)$/i ); 13551 13552var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); 13553 13554var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); 13555 13556 13557 13558( function() { 13559 var fragment = document.createDocumentFragment(), 13560 div = fragment.appendChild( document.createElement( "div" ) ), 13561 input = document.createElement( "input" ); 13562 13563 // Support: Android 4.0 - 4.3 only 13564 // Check state lost if the name is set (trac-11217) 13565 // Support: Windows Web Apps (WWA) 13566 // `name` and `type` must use .setAttribute for WWA (trac-14901) 13567 input.setAttribute( "type", "radio" ); 13568 input.setAttribute( "checked", "checked" ); 13569 input.setAttribute( "name", "t" ); 13570 13571 div.appendChild( input ); 13572 13573 // Support: Android <=4.1 only 13574 // Older WebKit doesn't clone checked state correctly in fragments 13575 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 13576 13577 // Support: IE <=11 only 13578 // Make sure textarea (and checkbox) defaultValue is properly cloned 13579 div.innerHTML = "<textarea>x</textarea>"; 13580 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 13581 13582 // Support: IE <=9 only 13583 // IE <=9 replaces <option> tags with their contents when inserted outside of 13584 // the select element. 13585 div.innerHTML = "<option></option>"; 13586 support.option = !!div.lastChild; 13587} )(); 13588 13589 13590// We have to close these tags to support XHTML (trac-13200) 13591var wrapMap = { 13592 13593 // XHTML parsers do not magically insert elements in the 13594 // same way that tag soup parsers do. So we cannot shorten 13595 // this by omitting <tbody> or other required elements. 13596 thead: [ 1, "<table>", "</table>" ], 13597 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 13598 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 13599 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 13600 13601 _default: [ 0, "", "" ] 13602}; 13603 13604wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 13605wrapMap.th = wrapMap.td; 13606 13607// Support: IE <=9 only 13608if ( !support.option ) { 13609 wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ]; 13610} 13611 13612 13613function getAll( context, tag ) { 13614 13615 // Support: IE <=9 - 11 only 13616 // Use typeof to avoid zero-argument method invocation on host objects (trac-15151) 13617 var ret; 13618 13619 if ( typeof context.getElementsByTagName !== "undefined" ) { 13620 ret = context.getElementsByTagName( tag || "*" ); 13621 13622 } else if ( typeof context.querySelectorAll !== "undefined" ) { 13623 ret = context.querySelectorAll( tag || "*" ); 13624 13625 } else { 13626 ret = []; 13627 } 13628 13629 if ( tag === undefined || tag && nodeName( context, tag ) ) { 13630 return jQuery.merge( [ context ], ret ); 13631 } 13632 13633 return ret; 13634} 13635 13636 13637// Mark scripts as having already been evaluated 13638function setGlobalEval( elems, refElements ) { 13639 var i = 0, 13640 l = elems.length; 13641 13642 for ( ; i < l; i++ ) { 13643 dataPriv.set( 13644 elems[ i ], 13645 "globalEval", 13646 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 13647 ); 13648 } 13649} 13650 13651 13652var rhtml = /<|&#?\w+;/; 13653 13654function buildFragment( elems, context, scripts, selection, ignored ) { 13655 var elem, tmp, tag, wrap, attached, j, 13656 fragment = context.createDocumentFragment(), 13657 nodes = [], 13658 i = 0, 13659 l = elems.length; 13660 13661 for ( ; i < l; i++ ) { 13662 elem = elems[ i ]; 13663 13664 if ( elem || elem === 0 ) { 13665 13666 // Add nodes directly 13667 if ( toType( elem ) === "object" ) { 13668 13669 // Support: Android <=4.0 only, PhantomJS 1 only 13670 // push.apply(_, arraylike) throws on ancient WebKit 13671 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 13672 13673 // Convert non-html into a text node 13674 } else if ( !rhtml.test( elem ) ) { 13675 nodes.push( context.createTextNode( elem ) ); 13676 13677 // Convert html into DOM nodes 13678 } else { 13679 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 13680 13681 // Deserialize a standard representation 13682 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 13683 wrap = wrapMap[ tag ] || wrapMap._default; 13684 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 13685 13686 // Descend through wrappers to the right content 13687 j = wrap[ 0 ]; 13688 while ( j-- ) { 13689 tmp = tmp.lastChild; 13690 } 13691 13692 // Support: Android <=4.0 only, PhantomJS 1 only 13693 // push.apply(_, arraylike) throws on ancient WebKit 13694 jQuery.merge( nodes, tmp.childNodes ); 13695 13696 // Remember the top-level container 13697 tmp = fragment.firstChild; 13698 13699 // Ensure the created nodes are orphaned (trac-12392) 13700 tmp.textContent = ""; 13701 } 13702 } 13703 } 13704 13705 // Remove wrapper from fragment 13706 fragment.textContent = ""; 13707 13708 i = 0; 13709 while ( ( elem = nodes[ i++ ] ) ) { 13710 13711 // Skip elements already in the context collection (trac-4087) 13712 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 13713 if ( ignored ) { 13714 ignored.push( elem ); 13715 } 13716 continue; 13717 } 13718 13719 attached = isAttached( elem ); 13720 13721 // Append to fragment 13722 tmp = getAll( fragment.appendChild( elem ), "script" ); 13723 13724 // Preserve script evaluation history 13725 if ( attached ) { 13726 setGlobalEval( tmp ); 13727 } 13728 13729 // Capture executables 13730 if ( scripts ) { 13731 j = 0; 13732 while ( ( elem = tmp[ j++ ] ) ) { 13733 if ( rscriptType.test( elem.type || "" ) ) { 13734 scripts.push( elem ); 13735 } 13736 } 13737 } 13738 } 13739 13740 return fragment; 13741} 13742 13743 13744var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 13745 13746function returnTrue() { 13747 return true; 13748} 13749 13750function returnFalse() { 13751 return false; 13752} 13753 13754function on( elem, types, selector, data, fn, one ) { 13755 var origFn, type; 13756 13757 // Types can be a map of types/handlers 13758 if ( typeof types === "object" ) { 13759 13760 // ( types-Object, selector, data ) 13761 if ( typeof selector !== "string" ) { 13762 13763 // ( types-Object, data ) 13764 data = data || selector; 13765 selector = undefined; 13766 } 13767 for ( type in types ) { 13768 on( elem, type, selector, data, types[ type ], one ); 13769 } 13770 return elem; 13771 } 13772 13773 if ( data == null && fn == null ) { 13774 13775 // ( types, fn ) 13776 fn = selector; 13777 data = selector = undefined; 13778 } else if ( fn == null ) { 13779 if ( typeof selector === "string" ) { 13780 13781 // ( types, selector, fn ) 13782 fn = data; 13783 data = undefined; 13784 } else { 13785 13786 // ( types, data, fn ) 13787 fn = data; 13788 data = selector; 13789 selector = undefined; 13790 } 13791 } 13792 if ( fn === false ) { 13793 fn = returnFalse; 13794 } else if ( !fn ) { 13795 return elem; 13796 } 13797 13798 if ( one === 1 ) { 13799 origFn = fn; 13800 fn = function( event ) { 13801 13802 // Can use an empty set, since event contains the info 13803 jQuery().off( event ); 13804 return origFn.apply( this, arguments ); 13805 }; 13806 13807 // Use same guid so caller can remove using origFn 13808 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 13809 } 13810 return elem.each( function() { 13811 jQuery.event.add( this, types, fn, data, selector ); 13812 } ); 13813} 13814 13815/* 13816 * Helper functions for managing events -- not part of the public interface. 13817 * Props to Dean Edwards' addEvent library for many of the ideas. 13818 */ 13819jQuery.event = { 13820 13821 global: {}, 13822 13823 add: function( elem, types, handler, data, selector ) { 13824 13825 var handleObjIn, eventHandle, tmp, 13826 events, t, handleObj, 13827 special, handlers, type, namespaces, origType, 13828 elemData = dataPriv.get( elem ); 13829 13830 // Only attach events to objects that accept data 13831 if ( !acceptData( elem ) ) { 13832 return; 13833 } 13834 13835 // Caller can pass in an object of custom data in lieu of the handler 13836 if ( handler.handler ) { 13837 handleObjIn = handler; 13838 handler = handleObjIn.handler; 13839 selector = handleObjIn.selector; 13840 } 13841 13842 // Ensure that invalid selectors throw exceptions at attach time 13843 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 13844 if ( selector ) { 13845 jQuery.find.matchesSelector( documentElement, selector ); 13846 } 13847 13848 // Make sure that the handler has a unique ID, used to find/remove it later 13849 if ( !handler.guid ) { 13850 handler.guid = jQuery.guid++; 13851 } 13852 13853 // Init the element's event structure and main handler, if this is the first 13854 if ( !( events = elemData.events ) ) { 13855 events = elemData.events = Object.create( null ); 13856 } 13857 if ( !( eventHandle = elemData.handle ) ) { 13858 eventHandle = elemData.handle = function( e ) { 13859 13860 // Discard the second event of a jQuery.event.trigger() and 13861 // when an event is called after a page has unloaded 13862 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 13863 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 13864 }; 13865 } 13866 13867 // Handle multiple events separated by a space 13868 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 13869 t = types.length; 13870 while ( t-- ) { 13871 tmp = rtypenamespace.exec( types[ t ] ) || []; 13872 type = origType = tmp[ 1 ]; 13873 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 13874 13875 // There *must* be a type, no attaching namespace-only handlers 13876 if ( !type ) { 13877 continue; 13878 } 13879 13880 // If event changes its type, use the special event handlers for the changed type 13881 special = jQuery.event.special[ type ] || {}; 13882 13883 // If selector defined, determine special event api type, otherwise given type 13884 type = ( selector ? special.delegateType : special.bindType ) || type; 13885 13886 // Update special based on newly reset type 13887 special = jQuery.event.special[ type ] || {}; 13888 13889 // handleObj is passed to all event handlers 13890 handleObj = jQuery.extend( { 13891 type: type, 13892 origType: origType, 13893 data: data, 13894 handler: handler, 13895 guid: handler.guid, 13896 selector: selector, 13897 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 13898 namespace: namespaces.join( "." ) 13899 }, handleObjIn ); 13900 13901 // Init the event handler queue if we're the first 13902 if ( !( handlers = events[ type ] ) ) { 13903 handlers = events[ type ] = []; 13904 handlers.delegateCount = 0; 13905 13906 // Only use addEventListener if the special events handler returns false 13907 if ( !special.setup || 13908 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 13909 13910 if ( elem.addEventListener ) { 13911 elem.addEventListener( type, eventHandle ); 13912 } 13913 } 13914 } 13915 13916 if ( special.add ) { 13917 special.add.call( elem, handleObj ); 13918 13919 if ( !handleObj.handler.guid ) { 13920 handleObj.handler.guid = handler.guid; 13921 } 13922 } 13923 13924 // Add to the element's handler list, delegates in front 13925 if ( selector ) { 13926 handlers.splice( handlers.delegateCount++, 0, handleObj ); 13927 } else { 13928 handlers.push( handleObj ); 13929 } 13930 13931 // Keep track of which events have ever been used, for event optimization 13932 jQuery.event.global[ type ] = true; 13933 } 13934 13935 }, 13936 13937 // Detach an event or set of events from an element 13938 remove: function( elem, types, handler, selector, mappedTypes ) { 13939 13940 var j, origCount, tmp, 13941 events, t, handleObj, 13942 special, handlers, type, namespaces, origType, 13943 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 13944 13945 if ( !elemData || !( events = elemData.events ) ) { 13946 return; 13947 } 13948 13949 // Once for each type.namespace in types; type may be omitted 13950 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 13951 t = types.length; 13952 while ( t-- ) { 13953 tmp = rtypenamespace.exec( types[ t ] ) || []; 13954 type = origType = tmp[ 1 ]; 13955 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 13956 13957 // Unbind all events (on this namespace, if provided) for the element 13958 if ( !type ) { 13959 for ( type in events ) { 13960 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 13961 } 13962 continue; 13963 } 13964 13965 special = jQuery.event.special[ type ] || {}; 13966 type = ( selector ? special.delegateType : special.bindType ) || type; 13967 handlers = events[ type ] || []; 13968 tmp = tmp[ 2 ] && 13969 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 13970 13971 // Remove matching events 13972 origCount = j = handlers.length; 13973 while ( j-- ) { 13974 handleObj = handlers[ j ]; 13975 13976 if ( ( mappedTypes || origType === handleObj.origType ) && 13977 ( !handler || handler.guid === handleObj.guid ) && 13978 ( !tmp || tmp.test( handleObj.namespace ) ) && 13979 ( !selector || selector === handleObj.selector || 13980 selector === "**" && handleObj.selector ) ) { 13981 handlers.splice( j, 1 ); 13982 13983 if ( handleObj.selector ) { 13984 handlers.delegateCount--; 13985 } 13986 if ( special.remove ) { 13987 special.remove.call( elem, handleObj ); 13988 } 13989 } 13990 } 13991 13992 // Remove generic event handler if we removed something and no more handlers exist 13993 // (avoids potential for endless recursion during removal of special event handlers) 13994 if ( origCount && !handlers.length ) { 13995 if ( !special.teardown || 13996 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 13997 13998 jQuery.removeEvent( elem, type, elemData.handle ); 13999 } 14000 14001 delete events[ type ]; 14002 } 14003 } 14004 14005 // Remove data and the expando if it's no longer used 14006 if ( jQuery.isEmptyObject( events ) ) { 14007 dataPriv.remove( elem, "handle events" ); 14008 } 14009 }, 14010 14011 dispatch: function( nativeEvent ) { 14012 14013 var i, j, ret, matched, handleObj, handlerQueue, 14014 args = new Array( arguments.length ), 14015 14016 // Make a writable jQuery.Event from the native event object 14017 event = jQuery.event.fix( nativeEvent ), 14018 14019 handlers = ( 14020 dataPriv.get( this, "events" ) || Object.create( null ) 14021 )[ event.type ] || [], 14022 special = jQuery.event.special[ event.type ] || {}; 14023 14024 // Use the fix-ed jQuery.Event rather than the (read-only) native event 14025 args[ 0 ] = event; 14026 14027 for ( i = 1; i < arguments.length; i++ ) { 14028 args[ i ] = arguments[ i ]; 14029 } 14030 14031 event.delegateTarget = this; 14032 14033 // Call the preDispatch hook for the mapped type, and let it bail if desired 14034 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 14035 return; 14036 } 14037 14038 // Determine handlers 14039 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 14040 14041 // Run delegates first; they may want to stop propagation beneath us 14042 i = 0; 14043 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 14044 event.currentTarget = matched.elem; 14045 14046 j = 0; 14047 while ( ( handleObj = matched.handlers[ j++ ] ) && 14048 !event.isImmediatePropagationStopped() ) { 14049 14050 // If the event is namespaced, then each handler is only invoked if it is 14051 // specially universal or its namespaces are a superset of the event's. 14052 if ( !event.rnamespace || handleObj.namespace === false || 14053 event.rnamespace.test( handleObj.namespace ) ) { 14054 14055 event.handleObj = handleObj; 14056 event.data = handleObj.data; 14057 14058 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 14059 handleObj.handler ).apply( matched.elem, args ); 14060 14061 if ( ret !== undefined ) { 14062 if ( ( event.result = ret ) === false ) { 14063 event.preventDefault(); 14064 event.stopPropagation(); 14065 } 14066 } 14067 } 14068 } 14069 } 14070 14071 // Call the postDispatch hook for the mapped type 14072 if ( special.postDispatch ) { 14073 special.postDispatch.call( this, event ); 14074 } 14075 14076 return event.result; 14077 }, 14078 14079 handlers: function( event, handlers ) { 14080 var i, handleObj, sel, matchedHandlers, matchedSelectors, 14081 handlerQueue = [], 14082 delegateCount = handlers.delegateCount, 14083 cur = event.target; 14084 14085 // Find delegate handlers 14086 if ( delegateCount && 14087 14088 // Support: IE <=9 14089 // Black-hole SVG <use> instance trees (trac-13180) 14090 cur.nodeType && 14091 14092 // Support: Firefox <=42 14093 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 14094 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 14095 // Support: IE 11 only 14096 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 14097 !( event.type === "click" && event.button >= 1 ) ) { 14098 14099 for ( ; cur !== this; cur = cur.parentNode || this ) { 14100 14101 // Don't check non-elements (trac-13208) 14102 // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764) 14103 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { 14104 matchedHandlers = []; 14105 matchedSelectors = {}; 14106 for ( i = 0; i < delegateCount; i++ ) { 14107 handleObj = handlers[ i ]; 14108 14109 // Don't conflict with Object.prototype properties (trac-13203) 14110 sel = handleObj.selector + " "; 14111 14112 if ( matchedSelectors[ sel ] === undefined ) { 14113 matchedSelectors[ sel ] = handleObj.needsContext ? 14114 jQuery( sel, this ).index( cur ) > -1 : 14115 jQuery.find( sel, this, null, [ cur ] ).length; 14116 } 14117 if ( matchedSelectors[ sel ] ) { 14118 matchedHandlers.push( handleObj ); 14119 } 14120 } 14121 if ( matchedHandlers.length ) { 14122 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); 14123 } 14124 } 14125 } 14126 } 14127 14128 // Add the remaining (directly-bound) handlers 14129 cur = this; 14130 if ( delegateCount < handlers.length ) { 14131 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); 14132 } 14133 14134 return handlerQueue; 14135 }, 14136 14137 addProp: function( name, hook ) { 14138 Object.defineProperty( jQuery.Event.prototype, name, { 14139 enumerable: true, 14140 configurable: true, 14141 14142 get: isFunction( hook ) ? 14143 function() { 14144 if ( this.originalEvent ) { 14145 return hook( this.originalEvent ); 14146 } 14147 } : 14148 function() { 14149 if ( this.originalEvent ) { 14150 return this.originalEvent[ name ]; 14151 } 14152 }, 14153 14154 set: function( value ) { 14155 Object.defineProperty( this, name, { 14156 enumerable: true, 14157 configurable: true, 14158 writable: true, 14159 value: value 14160 } ); 14161 } 14162 } ); 14163 }, 14164 14165 fix: function( originalEvent ) { 14166 return originalEvent[ jQuery.expando ] ? 14167 originalEvent : 14168 new jQuery.Event( originalEvent ); 14169 }, 14170 14171 special: { 14172 load: { 14173 14174 // Prevent triggered image.load events from bubbling to window.load 14175 noBubble: true 14176 }, 14177 click: { 14178 14179 // Utilize native event to ensure correct state for checkable inputs 14180 setup: function( data ) { 14181 14182 // For mutual compressibility with _default, replace `this` access with a local var. 14183 // `|| data` is dead code meant only to preserve the variable through minification. 14184 var el = this || data; 14185 14186 // Claim the first handler 14187 if ( rcheckableType.test( el.type ) && 14188 el.click && nodeName( el, "input" ) ) { 14189 14190 // dataPriv.set( el, "click", ... ) 14191 leverageNative( el, "click", true ); 14192 } 14193 14194 // Return false to allow normal processing in the caller 14195 return false; 14196 }, 14197 trigger: function( data ) { 14198 14199 // For mutual compressibility with _default, replace `this` access with a local var. 14200 // `|| data` is dead code meant only to preserve the variable through minification. 14201 var el = this || data; 14202 14203 // Force setup before triggering a click 14204 if ( rcheckableType.test( el.type ) && 14205 el.click && nodeName( el, "input" ) ) { 14206 14207 leverageNative( el, "click" ); 14208 } 14209 14210 // Return non-false to allow normal event-path propagation 14211 return true; 14212 }, 14213 14214 // For cross-browser consistency, suppress native .click() on links 14215 // Also prevent it if we're currently inside a leveraged native-event stack 14216 _default: function( event ) { 14217 var target = event.target; 14218 return rcheckableType.test( target.type ) && 14219 target.click && nodeName( target, "input" ) && 14220 dataPriv.get( target, "click" ) || 14221 nodeName( target, "a" ); 14222 } 14223 }, 14224 14225 beforeunload: { 14226 postDispatch: function( event ) { 14227 14228 // Support: Firefox 20+ 14229 // Firefox doesn't alert if the returnValue field is not set. 14230 if ( event.result !== undefined && event.originalEvent ) { 14231 event.originalEvent.returnValue = event.result; 14232 } 14233 } 14234 } 14235 } 14236}; 14237 14238// Ensure the presence of an event listener that handles manually-triggered 14239// synthetic events by interrupting progress until reinvoked in response to 14240// *native* events that it fires directly, ensuring that state changes have 14241// already occurred before other listeners are invoked. 14242function leverageNative( el, type, isSetup ) { 14243 14244 // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add 14245 if ( !isSetup ) { 14246 if ( dataPriv.get( el, type ) === undefined ) { 14247 jQuery.event.add( el, type, returnTrue ); 14248 } 14249 return; 14250 } 14251 14252 // Register the controller as a special universal handler for all event namespaces 14253 dataPriv.set( el, type, false ); 14254 jQuery.event.add( el, type, { 14255 namespace: false, 14256 handler: function( event ) { 14257 var result, 14258 saved = dataPriv.get( this, type ); 14259 14260 if ( ( event.isTrigger & 1 ) && this[ type ] ) { 14261 14262 // Interrupt processing of the outer synthetic .trigger()ed event 14263 if ( !saved ) { 14264 14265 // Store arguments for use when handling the inner native event 14266 // There will always be at least one argument (an event object), so this array 14267 // will not be confused with a leftover capture object. 14268 saved = slice.call( arguments ); 14269 dataPriv.set( this, type, saved ); 14270 14271 // Trigger the native event and capture its result 14272 this[ type ](); 14273 result = dataPriv.get( this, type ); 14274 dataPriv.set( this, type, false ); 14275 14276 if ( saved !== result ) { 14277 14278 // Cancel the outer synthetic event 14279 event.stopImmediatePropagation(); 14280 event.preventDefault(); 14281 14282 return result; 14283 } 14284 14285 // If this is an inner synthetic event for an event with a bubbling surrogate 14286 // (focus or blur), assume that the surrogate already propagated from triggering 14287 // the native event and prevent that from happening again here. 14288 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the 14289 // bubbling surrogate propagates *after* the non-bubbling base), but that seems 14290 // less bad than duplication. 14291 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { 14292 event.stopPropagation(); 14293 } 14294 14295 // If this is a native event triggered above, everything is now in order 14296 // Fire an inner synthetic event with the original arguments 14297 } else if ( saved ) { 14298 14299 // ...and capture the result 14300 dataPriv.set( this, type, jQuery.event.trigger( 14301 saved[ 0 ], 14302 saved.slice( 1 ), 14303 this 14304 ) ); 14305 14306 // Abort handling of the native event by all jQuery handlers while allowing 14307 // native handlers on the same element to run. On target, this is achieved 14308 // by stopping immediate propagation just on the jQuery event. However, 14309 // the native event is re-wrapped by a jQuery one on each level of the 14310 // propagation so the only way to stop it for jQuery is to stop it for 14311 // everyone via native `stopPropagation()`. This is not a problem for 14312 // focus/blur which don't bubble, but it does also stop click on checkboxes 14313 // and radios. We accept this limitation. 14314 event.stopPropagation(); 14315 event.isImmediatePropagationStopped = returnTrue; 14316 } 14317 } 14318 } ); 14319} 14320 14321jQuery.removeEvent = function( elem, type, handle ) { 14322 14323 // This "if" is needed for plain objects 14324 if ( elem.removeEventListener ) { 14325 elem.removeEventListener( type, handle ); 14326 } 14327}; 14328 14329jQuery.Event = function( src, props ) { 14330 14331 // Allow instantiation without the 'new' keyword 14332 if ( !( this instanceof jQuery.Event ) ) { 14333 return new jQuery.Event( src, props ); 14334 } 14335 14336 // Event object 14337 if ( src && src.type ) { 14338 this.originalEvent = src; 14339 this.type = src.type; 14340 14341 // Events bubbling up the document may have been marked as prevented 14342 // by a handler lower down the tree; reflect the correct value. 14343 this.isDefaultPrevented = src.defaultPrevented || 14344 src.defaultPrevented === undefined && 14345 14346 // Support: Android <=2.3 only 14347 src.returnValue === false ? 14348 returnTrue : 14349 returnFalse; 14350 14351 // Create target properties 14352 // Support: Safari <=6 - 7 only 14353 // Target should not be a text node (trac-504, trac-13143) 14354 this.target = ( src.target && src.target.nodeType === 3 ) ? 14355 src.target.parentNode : 14356 src.target; 14357 14358 this.currentTarget = src.currentTarget; 14359 this.relatedTarget = src.relatedTarget; 14360 14361 // Event type 14362 } else { 14363 this.type = src; 14364 } 14365 14366 // Put explicitly provided properties onto the event object 14367 if ( props ) { 14368 jQuery.extend( this, props ); 14369 } 14370 14371 // Create a timestamp if incoming event doesn't have one 14372 this.timeStamp = src && src.timeStamp || Date.now(); 14373 14374 // Mark it as fixed 14375 this[ jQuery.expando ] = true; 14376}; 14377 14378// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 14379// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 14380jQuery.Event.prototype = { 14381 constructor: jQuery.Event, 14382 isDefaultPrevented: returnFalse, 14383 isPropagationStopped: returnFalse, 14384 isImmediatePropagationStopped: returnFalse, 14385 isSimulated: false, 14386 14387 preventDefault: function() { 14388 var e = this.originalEvent; 14389 14390 this.isDefaultPrevented = returnTrue; 14391 14392 if ( e && !this.isSimulated ) { 14393 e.preventDefault(); 14394 } 14395 }, 14396 stopPropagation: function() { 14397 var e = this.originalEvent; 14398 14399 this.isPropagationStopped = returnTrue; 14400 14401 if ( e && !this.isSimulated ) { 14402 e.stopPropagation(); 14403 } 14404 }, 14405 stopImmediatePropagation: function() { 14406 var e = this.originalEvent; 14407 14408 this.isImmediatePropagationStopped = returnTrue; 14409 14410 if ( e && !this.isSimulated ) { 14411 e.stopImmediatePropagation(); 14412 } 14413 14414 this.stopPropagation(); 14415 } 14416}; 14417 14418// Includes all common event props including KeyEvent and MouseEvent specific props 14419jQuery.each( { 14420 altKey: true, 14421 bubbles: true, 14422 cancelable: true, 14423 changedTouches: true, 14424 ctrlKey: true, 14425 detail: true, 14426 eventPhase: true, 14427 metaKey: true, 14428 pageX: true, 14429 pageY: true, 14430 shiftKey: true, 14431 view: true, 14432 "char": true, 14433 code: true, 14434 charCode: true, 14435 key: true, 14436 keyCode: true, 14437 button: true, 14438 buttons: true, 14439 clientX: true, 14440 clientY: true, 14441 offsetX: true, 14442 offsetY: true, 14443 pointerId: true, 14444 pointerType: true, 14445 screenX: true, 14446 screenY: true, 14447 targetTouches: true, 14448 toElement: true, 14449 touches: true, 14450 which: true 14451}, jQuery.event.addProp ); 14452 14453jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { 14454 14455 function focusMappedHandler( nativeEvent ) { 14456 if ( document.documentMode ) { 14457 14458 // Support: IE 11+ 14459 // Attach a single focusin/focusout handler on the document while someone wants 14460 // focus/blur. This is because the former are synchronous in IE while the latter 14461 // are async. In other browsers, all those handlers are invoked synchronously. 14462 14463 // `handle` from private data would already wrap the event, but we need 14464 // to change the `type` here. 14465 var handle = dataPriv.get( this, "handle" ), 14466 event = jQuery.event.fix( nativeEvent ); 14467 event.type = nativeEvent.type === "focusin" ? "focus" : "blur"; 14468 event.isSimulated = true; 14469 14470 // First, handle focusin/focusout 14471 handle( nativeEvent ); 14472 14473 // ...then, handle focus/blur 14474 // 14475 // focus/blur don't bubble while focusin/focusout do; simulate the former by only 14476 // invoking the handler at the lower level. 14477 if ( event.target === event.currentTarget ) { 14478 14479 // The setup part calls `leverageNative`, which, in turn, calls 14480 // `jQuery.event.add`, so event handle will already have been set 14481 // by this point. 14482 handle( event ); 14483 } 14484 } else { 14485 14486 // For non-IE browsers, attach a single capturing handler on the document 14487 // while someone wants focusin/focusout. 14488 jQuery.event.simulate( delegateType, nativeEvent.target, 14489 jQuery.event.fix( nativeEvent ) ); 14490 } 14491 } 14492 14493 jQuery.event.special[ type ] = { 14494 14495 // Utilize native event if possible so blur/focus sequence is correct 14496 setup: function() { 14497 14498 var attaches; 14499 14500 // Claim the first handler 14501 // dataPriv.set( this, "focus", ... ) 14502 // dataPriv.set( this, "blur", ... ) 14503 leverageNative( this, type, true ); 14504 14505 if ( document.documentMode ) { 14506 14507 // Support: IE 9 - 11+ 14508 // We use the same native handler for focusin & focus (and focusout & blur) 14509 // so we need to coordinate setup & teardown parts between those events. 14510 // Use `delegateType` as the key as `type` is already used by `leverageNative`. 14511 attaches = dataPriv.get( this, delegateType ); 14512 if ( !attaches ) { 14513 this.addEventListener( delegateType, focusMappedHandler ); 14514 } 14515 dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 ); 14516 } else { 14517 14518 // Return false to allow normal processing in the caller 14519 return false; 14520 } 14521 }, 14522 trigger: function() { 14523 14524 // Force setup before trigger 14525 leverageNative( this, type ); 14526 14527 // Return non-false to allow normal event-path propagation 14528 return true; 14529 }, 14530 14531 teardown: function() { 14532 var attaches; 14533 14534 if ( document.documentMode ) { 14535 attaches = dataPriv.get( this, delegateType ) - 1; 14536 if ( !attaches ) { 14537 this.removeEventListener( delegateType, focusMappedHandler ); 14538 dataPriv.remove( this, delegateType ); 14539 } else { 14540 dataPriv.set( this, delegateType, attaches ); 14541 } 14542 } else { 14543 14544 // Return false to indicate standard teardown should be applied 14545 return false; 14546 } 14547 }, 14548 14549 // Suppress native focus or blur if we're currently inside 14550 // a leveraged native-event stack 14551 _default: function( event ) { 14552 return dataPriv.get( event.target, type ); 14553 }, 14554 14555 delegateType: delegateType 14556 }; 14557 14558 // Support: Firefox <=44 14559 // Firefox doesn't have focus(in | out) events 14560 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 14561 // 14562 // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 14563 // focus(in | out) events fire after focus & blur events, 14564 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 14565 // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 14566 // 14567 // Support: IE 9 - 11+ 14568 // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch, 14569 // attach a single handler for both events in IE. 14570 jQuery.event.special[ delegateType ] = { 14571 setup: function() { 14572 14573 // Handle: regular nodes (via `this.ownerDocument`), window 14574 // (via `this.document`) & document (via `this`). 14575 var doc = this.ownerDocument || this.document || this, 14576 dataHolder = document.documentMode ? this : doc, 14577 attaches = dataPriv.get( dataHolder, delegateType ); 14578 14579 // Support: IE 9 - 11+ 14580 // We use the same native handler for focusin & focus (and focusout & blur) 14581 // so we need to coordinate setup & teardown parts between those events. 14582 // Use `delegateType` as the key as `type` is already used by `leverageNative`. 14583 if ( !attaches ) { 14584 if ( document.documentMode ) { 14585 this.addEventListener( delegateType, focusMappedHandler ); 14586 } else { 14587 doc.addEventListener( type, focusMappedHandler, true ); 14588 } 14589 } 14590 dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 ); 14591 }, 14592 teardown: function() { 14593 var doc = this.ownerDocument || this.document || this, 14594 dataHolder = document.documentMode ? this : doc, 14595 attaches = dataPriv.get( dataHolder, delegateType ) - 1; 14596 14597 if ( !attaches ) { 14598 if ( document.documentMode ) { 14599 this.removeEventListener( delegateType, focusMappedHandler ); 14600 } else { 14601 doc.removeEventListener( type, focusMappedHandler, true ); 14602 } 14603 dataPriv.remove( dataHolder, delegateType ); 14604 } else { 14605 dataPriv.set( dataHolder, delegateType, attaches ); 14606 } 14607 } 14608 }; 14609} ); 14610 14611// Create mouseenter/leave events using mouseover/out and event-time checks 14612// so that event delegation works in jQuery. 14613// Do the same for pointerenter/pointerleave and pointerover/pointerout 14614// 14615// Support: Safari 7 only 14616// Safari sends mouseenter too often; see: 14617// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 14618// for the description of the bug (it existed in older Chrome versions as well). 14619jQuery.each( { 14620 mouseenter: "mouseover", 14621 mouseleave: "mouseout", 14622 pointerenter: "pointerover", 14623 pointerleave: "pointerout" 14624}, function( orig, fix ) { 14625 jQuery.event.special[ orig ] = { 14626 delegateType: fix, 14627 bindType: fix, 14628 14629 handle: function( event ) { 14630 var ret, 14631 target = this, 14632 related = event.relatedTarget, 14633 handleObj = event.handleObj; 14634 14635 // For mouseenter/leave call the handler if related is outside the target. 14636 // NB: No relatedTarget if the mouse left/entered the browser window 14637 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 14638 event.type = handleObj.origType; 14639 ret = handleObj.handler.apply( this, arguments ); 14640 event.type = fix; 14641 } 14642 return ret; 14643 } 14644 }; 14645} ); 14646 14647jQuery.fn.extend( { 14648 14649 on: function( types, selector, data, fn ) { 14650 return on( this, types, selector, data, fn ); 14651 }, 14652 one: function( types, selector, data, fn ) { 14653 return on( this, types, selector, data, fn, 1 ); 14654 }, 14655 off: function( types, selector, fn ) { 14656 var handleObj, type; 14657 if ( types && types.preventDefault && types.handleObj ) { 14658 14659 // ( event ) dispatched jQuery.Event 14660 handleObj = types.handleObj; 14661 jQuery( types.delegateTarget ).off( 14662 handleObj.namespace ? 14663 handleObj.origType + "." + handleObj.namespace : 14664 handleObj.origType, 14665 handleObj.selector, 14666 handleObj.handler 14667 ); 14668 return this; 14669 } 14670 if ( typeof types === "object" ) { 14671 14672 // ( types-object [, selector] ) 14673 for ( type in types ) { 14674 this.off( type, selector, types[ type ] ); 14675 } 14676 return this; 14677 } 14678 if ( selector === false || typeof selector === "function" ) { 14679 14680 // ( types [, fn] ) 14681 fn = selector; 14682 selector = undefined; 14683 } 14684 if ( fn === false ) { 14685 fn = returnFalse; 14686 } 14687 return this.each( function() { 14688 jQuery.event.remove( this, types, fn, selector ); 14689 } ); 14690 } 14691} ); 14692 14693 14694var 14695 14696 // Support: IE <=10 - 11, Edge 12 - 13 only 14697 // In IE/Edge using regex groups here causes severe slowdowns. 14698 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 14699 rnoInnerhtml = /<script|<style|<link/i, 14700 14701 // checked="checked" or checked 14702 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 14703 14704 rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g; 14705 14706// Prefer a tbody over its parent table for containing new rows 14707function manipulationTarget( elem, content ) { 14708 if ( nodeName( elem, "table" ) && 14709 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { 14710 14711 return jQuery( elem ).children( "tbody" )[ 0 ] || elem; 14712 } 14713 14714 return elem; 14715} 14716 14717// Replace/restore the type attribute of script elements for safe DOM manipulation 14718function disableScript( elem ) { 14719 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 14720 return elem; 14721} 14722function restoreScript( elem ) { 14723 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { 14724 elem.type = elem.type.slice( 5 ); 14725 } else { 14726 elem.removeAttribute( "type" ); 14727 } 14728 14729 return elem; 14730} 14731 14732function cloneCopyEvent( src, dest ) { 14733 var i, l, type, pdataOld, udataOld, udataCur, events; 14734 14735 if ( dest.nodeType !== 1 ) { 14736 return; 14737 } 14738 14739 // 1. Copy private data: events, handlers, etc. 14740 if ( dataPriv.hasData( src ) ) { 14741 pdataOld = dataPriv.get( src ); 14742 events = pdataOld.events; 14743 14744 if ( events ) { 14745 dataPriv.remove( dest, "handle events" ); 14746 14747 for ( type in events ) { 14748 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 14749 jQuery.event.add( dest, type, events[ type ][ i ] ); 14750 } 14751 } 14752 } 14753 } 14754 14755 // 2. Copy user data 14756 if ( dataUser.hasData( src ) ) { 14757 udataOld = dataUser.access( src ); 14758 udataCur = jQuery.extend( {}, udataOld ); 14759 14760 dataUser.set( dest, udataCur ); 14761 } 14762} 14763 14764// Fix IE bugs, see support tests 14765function fixInput( src, dest ) { 14766 var nodeName = dest.nodeName.toLowerCase(); 14767 14768 // Fails to persist the checked state of a cloned checkbox or radio button. 14769 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 14770 dest.checked = src.checked; 14771 14772 // Fails to return the selected option to the default selected state when cloning options 14773 } else if ( nodeName === "input" || nodeName === "textarea" ) { 14774 dest.defaultValue = src.defaultValue; 14775 } 14776} 14777 14778function domManip( collection, args, callback, ignored ) { 14779 14780 // Flatten any nested arrays 14781 args = flat( args ); 14782 14783 var fragment, first, scripts, hasScripts, node, doc, 14784 i = 0, 14785 l = collection.length, 14786 iNoClone = l - 1, 14787 value = args[ 0 ], 14788 valueIsFunction = isFunction( value ); 14789 14790 // We can't cloneNode fragments that contain checked, in WebKit 14791 if ( valueIsFunction || 14792 ( l > 1 && typeof value === "string" && 14793 !support.checkClone && rchecked.test( value ) ) ) { 14794 return collection.each( function( index ) { 14795 var self = collection.eq( index ); 14796 if ( valueIsFunction ) { 14797 args[ 0 ] = value.call( this, index, self.html() ); 14798 } 14799 domManip( self, args, callback, ignored ); 14800 } ); 14801 } 14802 14803 if ( l ) { 14804 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 14805 first = fragment.firstChild; 14806 14807 if ( fragment.childNodes.length === 1 ) { 14808 fragment = first; 14809 } 14810 14811 // Require either new content or an interest in ignored elements to invoke the callback 14812 if ( first || ignored ) { 14813 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 14814 hasScripts = scripts.length; 14815 14816 // Use the original fragment for the last item 14817 // instead of the first because it can end up 14818 // being emptied incorrectly in certain situations (trac-8070). 14819 for ( ; i < l; i++ ) { 14820 node = fragment; 14821 14822 if ( i !== iNoClone ) { 14823 node = jQuery.clone( node, true, true ); 14824 14825 // Keep references to cloned scripts for later restoration 14826 if ( hasScripts ) { 14827 14828 // Support: Android <=4.0 only, PhantomJS 1 only 14829 // push.apply(_, arraylike) throws on ancient WebKit 14830 jQuery.merge( scripts, getAll( node, "script" ) ); 14831 } 14832 } 14833 14834 callback.call( collection[ i ], node, i ); 14835 } 14836 14837 if ( hasScripts ) { 14838 doc = scripts[ scripts.length - 1 ].ownerDocument; 14839 14840 // Re-enable scripts 14841 jQuery.map( scripts, restoreScript ); 14842 14843 // Evaluate executable scripts on first document insertion 14844 for ( i = 0; i < hasScripts; i++ ) { 14845 node = scripts[ i ]; 14846 if ( rscriptType.test( node.type || "" ) && 14847 !dataPriv.access( node, "globalEval" ) && 14848 jQuery.contains( doc, node ) ) { 14849 14850 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { 14851 14852 // Optional AJAX dependency, but won't run scripts if not present 14853 if ( jQuery._evalUrl && !node.noModule ) { 14854 jQuery._evalUrl( node.src, { 14855 nonce: node.nonce || node.getAttribute( "nonce" ) 14856 }, doc ); 14857 } 14858 } else { 14859 14860 // Unwrap a CDATA section containing script contents. This shouldn't be 14861 // needed as in XML documents they're already not visible when 14862 // inspecting element contents and in HTML documents they have no 14863 // meaning but we're preserving that logic for backwards compatibility. 14864 // This will be removed completely in 4.0. See gh-4904. 14865 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); 14866 } 14867 } 14868 } 14869 } 14870 } 14871 } 14872 14873 return collection; 14874} 14875 14876function remove( elem, selector, keepData ) { 14877 var node, 14878 nodes = selector ? jQuery.filter( selector, elem ) : elem, 14879 i = 0; 14880 14881 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 14882 if ( !keepData && node.nodeType === 1 ) { 14883 jQuery.cleanData( getAll( node ) ); 14884 } 14885 14886 if ( node.parentNode ) { 14887 if ( keepData && isAttached( node ) ) { 14888 setGlobalEval( getAll( node, "script" ) ); 14889 } 14890 node.parentNode.removeChild( node ); 14891 } 14892 } 14893 14894 return elem; 14895} 14896 14897jQuery.extend( { 14898 htmlPrefilter: function( html ) { 14899 return html; 14900 }, 14901 14902 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 14903 var i, l, srcElements, destElements, 14904 clone = elem.cloneNode( true ), 14905 inPage = isAttached( elem ); 14906 14907 // Fix IE cloning issues 14908 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 14909 !jQuery.isXMLDoc( elem ) ) { 14910 14911 // We eschew jQuery#find here for performance reasons: 14912 // https://jsperf.com/getall-vs-sizzle/2 14913 destElements = getAll( clone ); 14914 srcElements = getAll( elem ); 14915 14916 for ( i = 0, l = srcElements.length; i < l; i++ ) { 14917 fixInput( srcElements[ i ], destElements[ i ] ); 14918 } 14919 } 14920 14921 // Copy the events from the original to the clone 14922 if ( dataAndEvents ) { 14923 if ( deepDataAndEvents ) { 14924 srcElements = srcElements || getAll( elem ); 14925 destElements = destElements || getAll( clone ); 14926 14927 for ( i = 0, l = srcElements.length; i < l; i++ ) { 14928 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 14929 } 14930 } else { 14931 cloneCopyEvent( elem, clone ); 14932 } 14933 } 14934 14935 // Preserve script evaluation history 14936 destElements = getAll( clone, "script" ); 14937 if ( destElements.length > 0 ) { 14938 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 14939 } 14940 14941 // Return the cloned set 14942 return clone; 14943 }, 14944 14945 cleanData: function( elems ) { 14946 var data, elem, type, 14947 special = jQuery.event.special, 14948 i = 0; 14949 14950 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 14951 if ( acceptData( elem ) ) { 14952 if ( ( data = elem[ dataPriv.expando ] ) ) { 14953 if ( data.events ) { 14954 for ( type in data.events ) { 14955 if ( special[ type ] ) { 14956 jQuery.event.remove( elem, type ); 14957 14958 // This is a shortcut to avoid jQuery.event.remove's overhead 14959 } else { 14960 jQuery.removeEvent( elem, type, data.handle ); 14961 } 14962 } 14963 } 14964 14965 // Support: Chrome <=35 - 45+ 14966 // Assign undefined instead of using delete, see Data#remove 14967 elem[ dataPriv.expando ] = undefined; 14968 } 14969 if ( elem[ dataUser.expando ] ) { 14970 14971 // Support: Chrome <=35 - 45+ 14972 // Assign undefined instead of using delete, see Data#remove 14973 elem[ dataUser.expando ] = undefined; 14974 } 14975 } 14976 } 14977 } 14978} ); 14979 14980jQuery.fn.extend( { 14981 detach: function( selector ) { 14982 return remove( this, selector, true ); 14983 }, 14984 14985 remove: function( selector ) { 14986 return remove( this, selector ); 14987 }, 14988 14989 text: function( value ) { 14990 return access( this, function( value ) { 14991 return value === undefined ? 14992 jQuery.text( this ) : 14993 this.empty().each( function() { 14994 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 14995 this.textContent = value; 14996 } 14997 } ); 14998 }, null, value, arguments.length ); 14999 }, 15000 15001 append: function() { 15002 return domManip( this, arguments, function( elem ) { 15003 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 15004 var target = manipulationTarget( this, elem ); 15005 target.appendChild( elem ); 15006 } 15007 } ); 15008 }, 15009 15010 prepend: function() { 15011 return domManip( this, arguments, function( elem ) { 15012 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 15013 var target = manipulationTarget( this, elem ); 15014 target.insertBefore( elem, target.firstChild ); 15015 } 15016 } ); 15017 }, 15018 15019 before: function() { 15020 return domManip( this, arguments, function( elem ) { 15021 if ( this.parentNode ) { 15022 this.parentNode.insertBefore( elem, this ); 15023 } 15024 } ); 15025 }, 15026 15027 after: function() { 15028 return domManip( this, arguments, function( elem ) { 15029 if ( this.parentNode ) { 15030 this.parentNode.insertBefore( elem, this.nextSibling ); 15031 } 15032 } ); 15033 }, 15034 15035 empty: function() { 15036 var elem, 15037 i = 0; 15038 15039 for ( ; ( elem = this[ i ] ) != null; i++ ) { 15040 if ( elem.nodeType === 1 ) { 15041 15042 // Prevent memory leaks 15043 jQuery.cleanData( getAll( elem, false ) ); 15044 15045 // Remove any remaining nodes 15046 elem.textContent = ""; 15047 } 15048 } 15049 15050 return this; 15051 }, 15052 15053 clone: function( dataAndEvents, deepDataAndEvents ) { 15054 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 15055 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 15056 15057 return this.map( function() { 15058 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 15059 } ); 15060 }, 15061 15062 html: function( value ) { 15063 return access( this, function( value ) { 15064 var elem = this[ 0 ] || {}, 15065 i = 0, 15066 l = this.length; 15067 15068 if ( value === undefined && elem.nodeType === 1 ) { 15069 return elem.innerHTML; 15070 } 15071 15072 // See if we can take a shortcut and just use innerHTML 15073 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 15074 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 15075 15076 value = jQuery.htmlPrefilter( value ); 15077 15078 try { 15079 for ( ; i < l; i++ ) { 15080 elem = this[ i ] || {}; 15081 15082 // Remove element nodes and prevent memory leaks 15083 if ( elem.nodeType === 1 ) { 15084 jQuery.cleanData( getAll( elem, false ) ); 15085 elem.innerHTML = value; 15086 } 15087 } 15088 15089 elem = 0; 15090 15091 // If using innerHTML throws an exception, use the fallback method 15092 } catch ( e ) {} 15093 } 15094 15095 if ( elem ) { 15096 this.empty().append( value ); 15097 } 15098 }, null, value, arguments.length ); 15099 }, 15100 15101 replaceWith: function() { 15102 var ignored = []; 15103 15104 // Make the changes, replacing each non-ignored context element with the new content 15105 return domManip( this, arguments, function( elem ) { 15106 var parent = this.parentNode; 15107 15108 if ( jQuery.inArray( this, ignored ) < 0 ) { 15109 jQuery.cleanData( getAll( this ) ); 15110 if ( parent ) { 15111 parent.replaceChild( elem, this ); 15112 } 15113 } 15114 15115 // Force callback invocation 15116 }, ignored ); 15117 } 15118} ); 15119 15120jQuery.each( { 15121 appendTo: "append", 15122 prependTo: "prepend", 15123 insertBefore: "before", 15124 insertAfter: "after", 15125 replaceAll: "replaceWith" 15126}, function( name, original ) { 15127 jQuery.fn[ name ] = function( selector ) { 15128 var elems, 15129 ret = [], 15130 insert = jQuery( selector ), 15131 last = insert.length - 1, 15132 i = 0; 15133 15134 for ( ; i <= last; i++ ) { 15135 elems = i === last ? this : this.clone( true ); 15136 jQuery( insert[ i ] )[ original ]( elems ); 15137 15138 // Support: Android <=4.0 only, PhantomJS 1 only 15139 // .get() because push.apply(_, arraylike) throws on ancient WebKit 15140 push.apply( ret, elems.get() ); 15141 } 15142 15143 return this.pushStack( ret ); 15144 }; 15145} ); 15146var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 15147 15148var rcustomProp = /^--/; 15149 15150 15151var getStyles = function( elem ) { 15152 15153 // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150) 15154 // IE throws on elements created in popups 15155 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 15156 var view = elem.ownerDocument.defaultView; 15157 15158 if ( !view || !view.opener ) { 15159 view = window; 15160 } 15161 15162 return view.getComputedStyle( elem ); 15163 }; 15164 15165var swap = function( elem, options, callback ) { 15166 var ret, name, 15167 old = {}; 15168 15169 // Remember the old values, and insert the new ones 15170 for ( name in options ) { 15171 old[ name ] = elem.style[ name ]; 15172 elem.style[ name ] = options[ name ]; 15173 } 15174 15175 ret = callback.call( elem ); 15176 15177 // Revert the old values 15178 for ( name in options ) { 15179 elem.style[ name ] = old[ name ]; 15180 } 15181 15182 return ret; 15183}; 15184 15185 15186var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); 15187 15188 15189 15190( function() { 15191 15192 // Executing both pixelPosition & boxSizingReliable tests require only one layout 15193 // so they're executed at the same time to save the second computation. 15194 function computeStyleTests() { 15195 15196 // This is a singleton, we need to execute it only once 15197 if ( !div ) { 15198 return; 15199 } 15200 15201 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + 15202 "margin-top:1px;padding:0;border:0"; 15203 div.style.cssText = 15204 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 15205 "margin:auto;border:1px;padding:1px;" + 15206 "width:60%;top:1%"; 15207 documentElement.appendChild( container ).appendChild( div ); 15208 15209 var divStyle = window.getComputedStyle( div ); 15210 pixelPositionVal = divStyle.top !== "1%"; 15211 15212 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 15213 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; 15214 15215 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 15216 // Some styles come back with percentage values, even though they shouldn't 15217 div.style.right = "60%"; 15218 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; 15219 15220 // Support: IE 9 - 11 only 15221 // Detect misreporting of content dimensions for box-sizing:border-box elements 15222 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; 15223 15224 // Support: IE 9 only 15225 // Detect overflow:scroll screwiness (gh-3699) 15226 // Support: Chrome <=64 15227 // Don't get tricked when zoom affects offsetWidth (gh-4029) 15228 div.style.position = "absolute"; 15229 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; 15230 15231 documentElement.removeChild( container ); 15232 15233 // Nullify the div so it wouldn't be stored in the memory and 15234 // it will also be a sign that checks already performed 15235 div = null; 15236 } 15237 15238 function roundPixelMeasures( measure ) { 15239 return Math.round( parseFloat( measure ) ); 15240 } 15241 15242 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 15243 reliableTrDimensionsVal, reliableMarginLeftVal, 15244 container = document.createElement( "div" ), 15245 div = document.createElement( "div" ); 15246 15247 // Finish early in limited (non-browser) environments 15248 if ( !div.style ) { 15249 return; 15250 } 15251 15252 // Support: IE <=9 - 11 only 15253 // Style of cloned element affects source element cloned (trac-8908) 15254 div.style.backgroundClip = "content-box"; 15255 div.cloneNode( true ).style.backgroundClip = ""; 15256 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 15257 15258 jQuery.extend( support, { 15259 boxSizingReliable: function() { 15260 computeStyleTests(); 15261 return boxSizingReliableVal; 15262 }, 15263 pixelBoxStyles: function() { 15264 computeStyleTests(); 15265 return pixelBoxStylesVal; 15266 }, 15267 pixelPosition: function() { 15268 computeStyleTests(); 15269 return pixelPositionVal; 15270 }, 15271 reliableMarginLeft: function() { 15272 computeStyleTests(); 15273 return reliableMarginLeftVal; 15274 }, 15275 scrollboxSize: function() { 15276 computeStyleTests(); 15277 return scrollboxSizeVal; 15278 }, 15279 15280 // Support: IE 9 - 11+, Edge 15 - 18+ 15281 // IE/Edge misreport `getComputedStyle` of table rows with width/height 15282 // set in CSS while `offset*` properties report correct values. 15283 // Behavior in IE 9 is more subtle than in newer versions & it passes 15284 // some versions of this test; make sure not to make it pass there! 15285 // 15286 // Support: Firefox 70+ 15287 // Only Firefox includes border widths 15288 // in computed dimensions. (gh-4529) 15289 reliableTrDimensions: function() { 15290 var table, tr, trChild, trStyle; 15291 if ( reliableTrDimensionsVal == null ) { 15292 table = document.createElement( "table" ); 15293 tr = document.createElement( "tr" ); 15294 trChild = document.createElement( "div" ); 15295 15296 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; 15297 tr.style.cssText = "box-sizing:content-box;border:1px solid"; 15298 15299 // Support: Chrome 86+ 15300 // Height set through cssText does not get applied. 15301 // Computed height then comes back as 0. 15302 tr.style.height = "1px"; 15303 trChild.style.height = "9px"; 15304 15305 // Support: Android 8 Chrome 86+ 15306 // In our bodyBackground.html iframe, 15307 // display for all div elements is set to "inline", 15308 // which causes a problem only in Android 8 Chrome 86. 15309 // Ensuring the div is `display: block` 15310 // gets around this issue. 15311 trChild.style.display = "block"; 15312 15313 documentElement 15314 .appendChild( table ) 15315 .appendChild( tr ) 15316 .appendChild( trChild ); 15317 15318 trStyle = window.getComputedStyle( tr ); 15319 reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + 15320 parseInt( trStyle.borderTopWidth, 10 ) + 15321 parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; 15322 15323 documentElement.removeChild( table ); 15324 } 15325 return reliableTrDimensionsVal; 15326 } 15327 } ); 15328} )(); 15329 15330 15331function curCSS( elem, name, computed ) { 15332 var width, minWidth, maxWidth, ret, 15333 isCustomProp = rcustomProp.test( name ), 15334 15335 // Support: Firefox 51+ 15336 // Retrieving style before computed somehow 15337 // fixes an issue with getting wrong values 15338 // on detached elements 15339 style = elem.style; 15340 15341 computed = computed || getStyles( elem ); 15342 15343 // getPropertyValue is needed for: 15344 // .css('filter') (IE 9 only, trac-12537) 15345 // .css('--customProperty) (gh-3144) 15346 if ( computed ) { 15347 15348 // Support: IE <=9 - 11+ 15349 // IE only supports `"float"` in `getPropertyValue`; in computed styles 15350 // it's only available as `"cssFloat"`. We no longer modify properties 15351 // sent to `.css()` apart from camelCasing, so we need to check both. 15352 // Normally, this would create difference in behavior: if 15353 // `getPropertyValue` returns an empty string, the value returned 15354 // by `.css()` would be `undefined`. This is usually the case for 15355 // disconnected elements. However, in IE even disconnected elements 15356 // with no styles return `"none"` for `getPropertyValue( "float" )` 15357 ret = computed.getPropertyValue( name ) || computed[ name ]; 15358 15359 if ( isCustomProp && ret ) { 15360 15361 // Support: Firefox 105+, Chrome <=105+ 15362 // Spec requires trimming whitespace for custom properties (gh-4926). 15363 // Firefox only trims leading whitespace. Chrome just collapses 15364 // both leading & trailing whitespace to a single space. 15365 // 15366 // Fall back to `undefined` if empty string returned. 15367 // This collapses a missing definition with property defined 15368 // and set to an empty string but there's no standard API 15369 // allowing us to differentiate them without a performance penalty 15370 // and returning `undefined` aligns with older jQuery. 15371 // 15372 // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED 15373 // as whitespace while CSS does not, but this is not a problem 15374 // because CSS preprocessing replaces them with U+000A LINE FEED 15375 // (which *is* CSS whitespace) 15376 // https://www.w3.org/TR/css-syntax-3/#input-preprocessing 15377 ret = ret.replace( rtrimCSS, "$1" ) || undefined; 15378 } 15379 15380 if ( ret === "" && !isAttached( elem ) ) { 15381 ret = jQuery.style( elem, name ); 15382 } 15383 15384 // A tribute to the "awesome hack by Dean Edwards" 15385 // Android Browser returns percentage for some values, 15386 // but width seems to be reliably pixels. 15387 // This is against the CSSOM draft spec: 15388 // https://drafts.csswg.org/cssom/#resolved-values 15389 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { 15390 15391 // Remember the original values 15392 width = style.width; 15393 minWidth = style.minWidth; 15394 maxWidth = style.maxWidth; 15395 15396 // Put in the new values to get a computed value out 15397 style.minWidth = style.maxWidth = style.width = ret; 15398 ret = computed.width; 15399 15400 // Revert the changed values 15401 style.width = width; 15402 style.minWidth = minWidth; 15403 style.maxWidth = maxWidth; 15404 } 15405 } 15406 15407 return ret !== undefined ? 15408 15409 // Support: IE <=9 - 11 only 15410 // IE returns zIndex value as an integer. 15411 ret + "" : 15412 ret; 15413} 15414 15415 15416function addGetHookIf( conditionFn, hookFn ) { 15417 15418 // Define the hook, we'll check on the first run if it's really needed. 15419 return { 15420 get: function() { 15421 if ( conditionFn() ) { 15422 15423 // Hook not needed (or it's not possible to use it due 15424 // to missing dependency), remove it. 15425 delete this.get; 15426 return; 15427 } 15428 15429 // Hook needed; redefine it so that the support test is not executed again. 15430 return ( this.get = hookFn ).apply( this, arguments ); 15431 } 15432 }; 15433} 15434 15435 15436var cssPrefixes = [ "Webkit", "Moz", "ms" ], 15437 emptyStyle = document.createElement( "div" ).style, 15438 vendorProps = {}; 15439 15440// Return a vendor-prefixed property or undefined 15441function vendorPropName( name ) { 15442 15443 // Check for vendor prefixed names 15444 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 15445 i = cssPrefixes.length; 15446 15447 while ( i-- ) { 15448 name = cssPrefixes[ i ] + capName; 15449 if ( name in emptyStyle ) { 15450 return name; 15451 } 15452 } 15453} 15454 15455// Return a potentially-mapped jQuery.cssProps or vendor prefixed property 15456function finalPropName( name ) { 15457 var final = jQuery.cssProps[ name ] || vendorProps[ name ]; 15458 15459 if ( final ) { 15460 return final; 15461 } 15462 if ( name in emptyStyle ) { 15463 return name; 15464 } 15465 return vendorProps[ name ] = vendorPropName( name ) || name; 15466} 15467 15468 15469var 15470 15471 // Swappable if display is none or starts with table 15472 // except "table", "table-cell", or "table-caption" 15473 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 15474 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 15475 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 15476 cssNormalTransform = { 15477 letterSpacing: "0", 15478 fontWeight: "400" 15479 }; 15480 15481function setPositiveNumber( _elem, value, subtract ) { 15482 15483 // Any relative (+/-) values have already been 15484 // normalized at this point 15485 var matches = rcssNum.exec( value ); 15486 return matches ? 15487 15488 // Guard against undefined "subtract", e.g., when used as in cssHooks 15489 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 15490 value; 15491} 15492 15493function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { 15494 var i = dimension === "width" ? 1 : 0, 15495 extra = 0, 15496 delta = 0, 15497 marginDelta = 0; 15498 15499 // Adjustment may not be necessary 15500 if ( box === ( isBorderBox ? "border" : "content" ) ) { 15501 return 0; 15502 } 15503 15504 for ( ; i < 4; i += 2 ) { 15505 15506 // Both box models exclude margin 15507 // Count margin delta separately to only add it after scroll gutter adjustment. 15508 // This is needed to make negative margins work with `outerHeight( true )` (gh-3982). 15509 if ( box === "margin" ) { 15510 marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); 15511 } 15512 15513 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 15514 if ( !isBorderBox ) { 15515 15516 // Add padding 15517 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 15518 15519 // For "border" or "margin", add border 15520 if ( box !== "padding" ) { 15521 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 15522 15523 // But still keep track of it otherwise 15524 } else { 15525 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 15526 } 15527 15528 // If we get here with a border-box (content + padding + border), we're seeking "content" or 15529 // "padding" or "margin" 15530 } else { 15531 15532 // For "content", subtract padding 15533 if ( box === "content" ) { 15534 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 15535 } 15536 15537 // For "content" or "padding", subtract border 15538 if ( box !== "margin" ) { 15539 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 15540 } 15541 } 15542 } 15543 15544 // Account for positive content-box scroll gutter when requested by providing computedVal 15545 if ( !isBorderBox && computedVal >= 0 ) { 15546 15547 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 15548 // Assuming integer scroll gutter, subtract the rest and round down 15549 delta += Math.max( 0, Math.ceil( 15550 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 15551 computedVal - 15552 delta - 15553 extra - 15554 0.5 15555 15556 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 15557 // Use an explicit zero to avoid NaN (gh-3964) 15558 ) ) || 0; 15559 } 15560 15561 return delta + marginDelta; 15562} 15563 15564function getWidthOrHeight( elem, dimension, extra ) { 15565 15566 // Start with computed style 15567 var styles = getStyles( elem ), 15568 15569 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). 15570 // Fake content-box until we know it's needed to know the true value. 15571 boxSizingNeeded = !support.boxSizingReliable() || extra, 15572 isBorderBox = boxSizingNeeded && 15573 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 15574 valueIsBorderBox = isBorderBox, 15575 15576 val = curCSS( elem, dimension, styles ), 15577 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); 15578 15579 // Support: Firefox <=54 15580 // Return a confounding non-pixel value or feign ignorance, as appropriate. 15581 if ( rnumnonpx.test( val ) ) { 15582 if ( !extra ) { 15583 return val; 15584 } 15585 val = "auto"; 15586 } 15587 15588 15589 // Support: IE 9 - 11 only 15590 // Use offsetWidth/offsetHeight for when box sizing is unreliable. 15591 // In those cases, the computed value can be trusted to be border-box. 15592 if ( ( !support.boxSizingReliable() && isBorderBox || 15593 15594 // Support: IE 10 - 11+, Edge 15 - 18+ 15595 // IE/Edge misreport `getComputedStyle` of table rows with width/height 15596 // set in CSS while `offset*` properties report correct values. 15597 // Interestingly, in some cases IE 9 doesn't suffer from this issue. 15598 !support.reliableTrDimensions() && nodeName( elem, "tr" ) || 15599 15600 // Fall back to offsetWidth/offsetHeight when value is "auto" 15601 // This happens for inline elements with no explicit setting (gh-3571) 15602 val === "auto" || 15603 15604 // Support: Android <=4.1 - 4.3 only 15605 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 15606 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && 15607 15608 // Make sure the element is visible & connected 15609 elem.getClientRects().length ) { 15610 15611 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 15612 15613 // Where available, offsetWidth/offsetHeight approximate border box dimensions. 15614 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the 15615 // retrieved value as a content box dimension. 15616 valueIsBorderBox = offsetProp in elem; 15617 if ( valueIsBorderBox ) { 15618 val = elem[ offsetProp ]; 15619 } 15620 } 15621 15622 // Normalize "" and auto 15623 val = parseFloat( val ) || 0; 15624 15625 // Adjust for the element's box model 15626 return ( val + 15627 boxModelAdjustment( 15628 elem, 15629 dimension, 15630 extra || ( isBorderBox ? "border" : "content" ), 15631 valueIsBorderBox, 15632 styles, 15633 15634 // Provide the current computed size to request scroll gutter calculation (gh-3589) 15635 val 15636 ) 15637 ) + "px"; 15638} 15639 15640jQuery.extend( { 15641 15642 // Add in style property hooks for overriding the default 15643 // behavior of getting and setting a style property 15644 cssHooks: { 15645 opacity: { 15646 get: function( elem, computed ) { 15647 if ( computed ) { 15648 15649 // We should always get a number back from opacity 15650 var ret = curCSS( elem, "opacity" ); 15651 return ret === "" ? "1" : ret; 15652 } 15653 } 15654 } 15655 }, 15656 15657 // Don't automatically add "px" to these possibly-unitless properties 15658 cssNumber: { 15659 animationIterationCount: true, 15660 aspectRatio: true, 15661 borderImageSlice: true, 15662 columnCount: true, 15663 flexGrow: true, 15664 flexShrink: true, 15665 fontWeight: true, 15666 gridArea: true, 15667 gridColumn: true, 15668 gridColumnEnd: true, 15669 gridColumnStart: true, 15670 gridRow: true, 15671 gridRowEnd: true, 15672 gridRowStart: true, 15673 lineHeight: true, 15674 opacity: true, 15675 order: true, 15676 orphans: true, 15677 scale: true, 15678 widows: true, 15679 zIndex: true, 15680 zoom: true, 15681 15682 // SVG-related 15683 fillOpacity: true, 15684 floodOpacity: true, 15685 stopOpacity: true, 15686 strokeMiterlimit: true, 15687 strokeOpacity: true 15688 }, 15689 15690 // Add in properties whose names you wish to fix before 15691 // setting or getting the value 15692 cssProps: {}, 15693 15694 // Get and set the style property on a DOM Node 15695 style: function( elem, name, value, extra ) { 15696 15697 // Don't set styles on text and comment nodes 15698 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 15699 return; 15700 } 15701 15702 // Make sure that we're working with the right name 15703 var ret, type, hooks, 15704 origName = camelCase( name ), 15705 isCustomProp = rcustomProp.test( name ), 15706 style = elem.style; 15707 15708 // Make sure that we're working with the right name. We don't 15709 // want to query the value if it is a CSS custom property 15710 // since they are user-defined. 15711 if ( !isCustomProp ) { 15712 name = finalPropName( origName ); 15713 } 15714 15715 // Gets hook for the prefixed version, then unprefixed version 15716 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 15717 15718 // Check if we're setting a value 15719 if ( value !== undefined ) { 15720 type = typeof value; 15721 15722 // Convert "+=" or "-=" to relative numbers (trac-7345) 15723 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 15724 value = adjustCSS( elem, name, ret ); 15725 15726 // Fixes bug trac-9237 15727 type = "number"; 15728 } 15729 15730 // Make sure that null and NaN values aren't set (trac-7116) 15731 if ( value == null || value !== value ) { 15732 return; 15733 } 15734 15735 // If a number was passed in, add the unit (except for certain CSS properties) 15736 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append 15737 // "px" to a few hardcoded values. 15738 if ( type === "number" && !isCustomProp ) { 15739 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 15740 } 15741 15742 // background-* props affect original clone's values 15743 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 15744 style[ name ] = "inherit"; 15745 } 15746 15747 // If a hook was provided, use that value, otherwise just set the specified value 15748 if ( !hooks || !( "set" in hooks ) || 15749 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 15750 15751 if ( isCustomProp ) { 15752 style.setProperty( name, value ); 15753 } else { 15754 style[ name ] = value; 15755 } 15756 } 15757 15758 } else { 15759 15760 // If a hook was provided get the non-computed value from there 15761 if ( hooks && "get" in hooks && 15762 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 15763 15764 return ret; 15765 } 15766 15767 // Otherwise just get the value from the style object 15768 return style[ name ]; 15769 } 15770 }, 15771 15772 css: function( elem, name, extra, styles ) { 15773 var val, num, hooks, 15774 origName = camelCase( name ), 15775 isCustomProp = rcustomProp.test( name ); 15776 15777 // Make sure that we're working with the right name. We don't 15778 // want to modify the value if it is a CSS custom property 15779 // since they are user-defined. 15780 if ( !isCustomProp ) { 15781 name = finalPropName( origName ); 15782 } 15783 15784 // Try prefixed name followed by the unprefixed name 15785 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 15786 15787 // If a hook was provided get the computed value from there 15788 if ( hooks && "get" in hooks ) { 15789 val = hooks.get( elem, true, extra ); 15790 } 15791 15792 // Otherwise, if a way to get the computed value exists, use that 15793 if ( val === undefined ) { 15794 val = curCSS( elem, name, styles ); 15795 } 15796 15797 // Convert "normal" to computed value 15798 if ( val === "normal" && name in cssNormalTransform ) { 15799 val = cssNormalTransform[ name ]; 15800 } 15801 15802 // Make numeric if forced or a qualifier was provided and val looks numeric 15803 if ( extra === "" || extra ) { 15804 num = parseFloat( val ); 15805 return extra === true || isFinite( num ) ? num || 0 : val; 15806 } 15807 15808 return val; 15809 } 15810} ); 15811 15812jQuery.each( [ "height", "width" ], function( _i, dimension ) { 15813 jQuery.cssHooks[ dimension ] = { 15814 get: function( elem, computed, extra ) { 15815 if ( computed ) { 15816 15817 // Certain elements can have dimension info if we invisibly show them 15818 // but it must have a current display style that would benefit 15819 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 15820 15821 // Support: Safari 8+ 15822 // Table columns in Safari have non-zero offsetWidth & zero 15823 // getBoundingClientRect().width unless display is changed. 15824 // Support: IE <=11 only 15825 // Running getBoundingClientRect on a disconnected node 15826 // in IE throws an error. 15827 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? 15828 swap( elem, cssShow, function() { 15829 return getWidthOrHeight( elem, dimension, extra ); 15830 } ) : 15831 getWidthOrHeight( elem, dimension, extra ); 15832 } 15833 }, 15834 15835 set: function( elem, value, extra ) { 15836 var matches, 15837 styles = getStyles( elem ), 15838 15839 // Only read styles.position if the test has a chance to fail 15840 // to avoid forcing a reflow. 15841 scrollboxSizeBuggy = !support.scrollboxSize() && 15842 styles.position === "absolute", 15843 15844 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) 15845 boxSizingNeeded = scrollboxSizeBuggy || extra, 15846 isBorderBox = boxSizingNeeded && 15847 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 15848 subtract = extra ? 15849 boxModelAdjustment( 15850 elem, 15851 dimension, 15852 extra, 15853 isBorderBox, 15854 styles 15855 ) : 15856 0; 15857 15858 // Account for unreliable border-box dimensions by comparing offset* to computed and 15859 // faking a content-box to get border and padding (gh-3699) 15860 if ( isBorderBox && scrollboxSizeBuggy ) { 15861 subtract -= Math.ceil( 15862 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 15863 parseFloat( styles[ dimension ] ) - 15864 boxModelAdjustment( elem, dimension, "border", false, styles ) - 15865 0.5 15866 ); 15867 } 15868 15869 // Convert to pixels if value adjustment is needed 15870 if ( subtract && ( matches = rcssNum.exec( value ) ) && 15871 ( matches[ 3 ] || "px" ) !== "px" ) { 15872 15873 elem.style[ dimension ] = value; 15874 value = jQuery.css( elem, dimension ); 15875 } 15876 15877 return setPositiveNumber( elem, value, subtract ); 15878 } 15879 }; 15880} ); 15881 15882jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 15883 function( elem, computed ) { 15884 if ( computed ) { 15885 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 15886 elem.getBoundingClientRect().left - 15887 swap( elem, { marginLeft: 0 }, function() { 15888 return elem.getBoundingClientRect().left; 15889 } ) 15890 ) + "px"; 15891 } 15892 } 15893); 15894 15895// These hooks are used by animate to expand properties 15896jQuery.each( { 15897 margin: "", 15898 padding: "", 15899 border: "Width" 15900}, function( prefix, suffix ) { 15901 jQuery.cssHooks[ prefix + suffix ] = { 15902 expand: function( value ) { 15903 var i = 0, 15904 expanded = {}, 15905 15906 // Assumes a single number if not a string 15907 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 15908 15909 for ( ; i < 4; i++ ) { 15910 expanded[ prefix + cssExpand[ i ] + suffix ] = 15911 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 15912 } 15913 15914 return expanded; 15915 } 15916 }; 15917 15918 if ( prefix !== "margin" ) { 15919 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 15920 } 15921} ); 15922 15923jQuery.fn.extend( { 15924 css: function( name, value ) { 15925 return access( this, function( elem, name, value ) { 15926 var styles, len, 15927 map = {}, 15928 i = 0; 15929 15930 if ( Array.isArray( name ) ) { 15931 styles = getStyles( elem ); 15932 len = name.length; 15933 15934 for ( ; i < len; i++ ) { 15935 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 15936 } 15937 15938 return map; 15939 } 15940 15941 return value !== undefined ? 15942 jQuery.style( elem, name, value ) : 15943 jQuery.css( elem, name ); 15944 }, name, value, arguments.length > 1 ); 15945 } 15946} ); 15947 15948 15949function Tween( elem, options, prop, end, easing ) { 15950 return new Tween.prototype.init( elem, options, prop, end, easing ); 15951} 15952jQuery.Tween = Tween; 15953 15954Tween.prototype = { 15955 constructor: Tween, 15956 init: function( elem, options, prop, end, easing, unit ) { 15957 this.elem = elem; 15958 this.prop = prop; 15959 this.easing = easing || jQuery.easing._default; 15960 this.options = options; 15961 this.start = this.now = this.cur(); 15962 this.end = end; 15963 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 15964 }, 15965 cur: function() { 15966 var hooks = Tween.propHooks[ this.prop ]; 15967 15968 return hooks && hooks.get ? 15969 hooks.get( this ) : 15970 Tween.propHooks._default.get( this ); 15971 }, 15972 run: function( percent ) { 15973 var eased, 15974 hooks = Tween.propHooks[ this.prop ]; 15975 15976 if ( this.options.duration ) { 15977 this.pos = eased = jQuery.easing[ this.easing ]( 15978 percent, this.options.duration * percent, 0, 1, this.options.duration 15979 ); 15980 } else { 15981 this.pos = eased = percent; 15982 } 15983 this.now = ( this.end - this.start ) * eased + this.start; 15984 15985 if ( this.options.step ) { 15986 this.options.step.call( this.elem, this.now, this ); 15987 } 15988 15989 if ( hooks && hooks.set ) { 15990 hooks.set( this ); 15991 } else { 15992 Tween.propHooks._default.set( this ); 15993 } 15994 return this; 15995 } 15996}; 15997 15998Tween.prototype.init.prototype = Tween.prototype; 15999 16000Tween.propHooks = { 16001 _default: { 16002 get: function( tween ) { 16003 var result; 16004 16005 // Use a property on the element directly when it is not a DOM element, 16006 // or when there is no matching style property that exists. 16007 if ( tween.elem.nodeType !== 1 || 16008 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 16009 return tween.elem[ tween.prop ]; 16010 } 16011 16012 // Passing an empty string as a 3rd parameter to .css will automatically 16013 // attempt a parseFloat and fallback to a string if the parse fails. 16014 // Simple values such as "10px" are parsed to Float; 16015 // complex values such as "rotate(1rad)" are returned as-is. 16016 result = jQuery.css( tween.elem, tween.prop, "" ); 16017 16018 // Empty strings, null, undefined and "auto" are converted to 0. 16019 return !result || result === "auto" ? 0 : result; 16020 }, 16021 set: function( tween ) { 16022 16023 // Use step hook for back compat. 16024 // Use cssHook if its there. 16025 // Use .style if available and use plain properties where available. 16026 if ( jQuery.fx.step[ tween.prop ] ) { 16027 jQuery.fx.step[ tween.prop ]( tween ); 16028 } else if ( tween.elem.nodeType === 1 && ( 16029 jQuery.cssHooks[ tween.prop ] || 16030 tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { 16031 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 16032 } else { 16033 tween.elem[ tween.prop ] = tween.now; 16034 } 16035 } 16036 } 16037}; 16038 16039// Support: IE <=9 only 16040// Panic based approach to setting things on disconnected nodes 16041Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 16042 set: function( tween ) { 16043 if ( tween.elem.nodeType && tween.elem.parentNode ) { 16044 tween.elem[ tween.prop ] = tween.now; 16045 } 16046 } 16047}; 16048 16049jQuery.easing = { 16050 linear: function( p ) { 16051 return p; 16052 }, 16053 swing: function( p ) { 16054 return 0.5 - Math.cos( p * Math.PI ) / 2; 16055 }, 16056 _default: "swing" 16057}; 16058 16059jQuery.fx = Tween.prototype.init; 16060 16061// Back compat <1.8 extension point 16062jQuery.fx.step = {}; 16063 16064 16065 16066 16067var 16068 fxNow, inProgress, 16069 rfxtypes = /^(?:toggle|show|hide)$/, 16070 rrun = /queueHooks$/; 16071 16072function schedule() { 16073 if ( inProgress ) { 16074 if ( document.hidden === false && window.requestAnimationFrame ) { 16075 window.requestAnimationFrame( schedule ); 16076 } else { 16077 window.setTimeout( schedule, jQuery.fx.interval ); 16078 } 16079 16080 jQuery.fx.tick(); 16081 } 16082} 16083 16084// Animations created synchronously will run synchronously 16085function createFxNow() { 16086 window.setTimeout( function() { 16087 fxNow = undefined; 16088 } ); 16089 return ( fxNow = Date.now() ); 16090} 16091 16092// Generate parameters to create a standard animation 16093function genFx( type, includeWidth ) { 16094 var which, 16095 i = 0, 16096 attrs = { height: type }; 16097 16098 // If we include width, step value is 1 to do all cssExpand values, 16099 // otherwise step value is 2 to skip over Left and Right 16100 includeWidth = includeWidth ? 1 : 0; 16101 for ( ; i < 4; i += 2 - includeWidth ) { 16102 which = cssExpand[ i ]; 16103 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 16104 } 16105 16106 if ( includeWidth ) { 16107 attrs.opacity = attrs.width = type; 16108 } 16109 16110 return attrs; 16111} 16112 16113function createTween( value, prop, animation ) { 16114 var tween, 16115 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 16116 index = 0, 16117 length = collection.length; 16118 for ( ; index < length; index++ ) { 16119 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 16120 16121 // We're done with this property 16122 return tween; 16123 } 16124 } 16125} 16126 16127function defaultPrefilter( elem, props, opts ) { 16128 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 16129 isBox = "width" in props || "height" in props, 16130 anim = this, 16131 orig = {}, 16132 style = elem.style, 16133 hidden = elem.nodeType && isHiddenWithinTree( elem ), 16134 dataShow = dataPriv.get( elem, "fxshow" ); 16135 16136 // Queue-skipping animations hijack the fx hooks 16137 if ( !opts.queue ) { 16138 hooks = jQuery._queueHooks( elem, "fx" ); 16139 if ( hooks.unqueued == null ) { 16140 hooks.unqueued = 0; 16141 oldfire = hooks.empty.fire; 16142 hooks.empty.fire = function() { 16143 if ( !hooks.unqueued ) { 16144 oldfire(); 16145 } 16146 }; 16147 } 16148 hooks.unqueued++; 16149 16150 anim.always( function() { 16151 16152 // Ensure the complete handler is called before this completes 16153 anim.always( function() { 16154 hooks.unqueued--; 16155 if ( !jQuery.queue( elem, "fx" ).length ) { 16156 hooks.empty.fire(); 16157 } 16158 } ); 16159 } ); 16160 } 16161 16162 // Detect show/hide animations 16163 for ( prop in props ) { 16164 value = props[ prop ]; 16165 if ( rfxtypes.test( value ) ) { 16166 delete props[ prop ]; 16167 toggle = toggle || value === "toggle"; 16168 if ( value === ( hidden ? "hide" : "show" ) ) { 16169 16170 // Pretend to be hidden if this is a "show" and 16171 // there is still data from a stopped show/hide 16172 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 16173 hidden = true; 16174 16175 // Ignore all other no-op show/hide data 16176 } else { 16177 continue; 16178 } 16179 } 16180 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 16181 } 16182 } 16183 16184 // Bail out if this is a no-op like .hide().hide() 16185 propTween = !jQuery.isEmptyObject( props ); 16186 if ( !propTween && jQuery.isEmptyObject( orig ) ) { 16187 return; 16188 } 16189 16190 // Restrict "overflow" and "display" styles during box animations 16191 if ( isBox && elem.nodeType === 1 ) { 16192 16193 // Support: IE <=9 - 11, Edge 12 - 15 16194 // Record all 3 overflow attributes because IE does not infer the shorthand 16195 // from identically-valued overflowX and overflowY and Edge just mirrors 16196 // the overflowX value there. 16197 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 16198 16199 // Identify a display type, preferring old show/hide data over the CSS cascade 16200 restoreDisplay = dataShow && dataShow.display; 16201 if ( restoreDisplay == null ) { 16202 restoreDisplay = dataPriv.get( elem, "display" ); 16203 } 16204 display = jQuery.css( elem, "display" ); 16205 if ( display === "none" ) { 16206 if ( restoreDisplay ) { 16207 display = restoreDisplay; 16208 } else { 16209 16210 // Get nonempty value(s) by temporarily forcing visibility 16211 showHide( [ elem ], true ); 16212 restoreDisplay = elem.style.display || restoreDisplay; 16213 display = jQuery.css( elem, "display" ); 16214 showHide( [ elem ] ); 16215 } 16216 } 16217 16218 // Animate inline elements as inline-block 16219 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { 16220 if ( jQuery.css( elem, "float" ) === "none" ) { 16221 16222 // Restore the original display value at the end of pure show/hide animations 16223 if ( !propTween ) { 16224 anim.done( function() { 16225 style.display = restoreDisplay; 16226 } ); 16227 if ( restoreDisplay == null ) { 16228 display = style.display; 16229 restoreDisplay = display === "none" ? "" : display; 16230 } 16231 } 16232 style.display = "inline-block"; 16233 } 16234 } 16235 } 16236 16237 if ( opts.overflow ) { 16238 style.overflow = "hidden"; 16239 anim.always( function() { 16240 style.overflow = opts.overflow[ 0 ]; 16241 style.overflowX = opts.overflow[ 1 ]; 16242 style.overflowY = opts.overflow[ 2 ]; 16243 } ); 16244 } 16245 16246 // Implement show/hide animations 16247 propTween = false; 16248 for ( prop in orig ) { 16249 16250 // General show/hide setup for this element animation 16251 if ( !propTween ) { 16252 if ( dataShow ) { 16253 if ( "hidden" in dataShow ) { 16254 hidden = dataShow.hidden; 16255 } 16256 } else { 16257 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); 16258 } 16259 16260 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 16261 if ( toggle ) { 16262 dataShow.hidden = !hidden; 16263 } 16264 16265 // Show elements before animating them 16266 if ( hidden ) { 16267 showHide( [ elem ], true ); 16268 } 16269 16270 /* eslint-disable no-loop-func */ 16271 16272 anim.done( function() { 16273 16274 /* eslint-enable no-loop-func */ 16275 16276 // The final step of a "hide" animation is actually hiding the element 16277 if ( !hidden ) { 16278 showHide( [ elem ] ); 16279 } 16280 dataPriv.remove( elem, "fxshow" ); 16281 for ( prop in orig ) { 16282 jQuery.style( elem, prop, orig[ prop ] ); 16283 } 16284 } ); 16285 } 16286 16287 // Per-property setup 16288 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 16289 if ( !( prop in dataShow ) ) { 16290 dataShow[ prop ] = propTween.start; 16291 if ( hidden ) { 16292 propTween.end = propTween.start; 16293 propTween.start = 0; 16294 } 16295 } 16296 } 16297} 16298 16299function propFilter( props, specialEasing ) { 16300 var index, name, easing, value, hooks; 16301 16302 // camelCase, specialEasing and expand cssHook pass 16303 for ( index in props ) { 16304 name = camelCase( index ); 16305 easing = specialEasing[ name ]; 16306 value = props[ index ]; 16307 if ( Array.isArray( value ) ) { 16308 easing = value[ 1 ]; 16309 value = props[ index ] = value[ 0 ]; 16310 } 16311 16312 if ( index !== name ) { 16313 props[ name ] = value; 16314 delete props[ index ]; 16315 } 16316 16317 hooks = jQuery.cssHooks[ name ]; 16318 if ( hooks && "expand" in hooks ) { 16319 value = hooks.expand( value ); 16320 delete props[ name ]; 16321 16322 // Not quite $.extend, this won't overwrite existing keys. 16323 // Reusing 'index' because we have the correct "name" 16324 for ( index in value ) { 16325 if ( !( index in props ) ) { 16326 props[ index ] = value[ index ]; 16327 specialEasing[ index ] = easing; 16328 } 16329 } 16330 } else { 16331 specialEasing[ name ] = easing; 16332 } 16333 } 16334} 16335 16336function Animation( elem, properties, options ) { 16337 var result, 16338 stopped, 16339 index = 0, 16340 length = Animation.prefilters.length, 16341 deferred = jQuery.Deferred().always( function() { 16342 16343 // Don't match elem in the :animated selector 16344 delete tick.elem; 16345 } ), 16346 tick = function() { 16347 if ( stopped ) { 16348 return false; 16349 } 16350 var currentTime = fxNow || createFxNow(), 16351 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 16352 16353 // Support: Android 2.3 only 16354 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497) 16355 temp = remaining / animation.duration || 0, 16356 percent = 1 - temp, 16357 index = 0, 16358 length = animation.tweens.length; 16359 16360 for ( ; index < length; index++ ) { 16361 animation.tweens[ index ].run( percent ); 16362 } 16363 16364 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 16365 16366 // If there's more to do, yield 16367 if ( percent < 1 && length ) { 16368 return remaining; 16369 } 16370 16371 // If this was an empty animation, synthesize a final progress notification 16372 if ( !length ) { 16373 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 16374 } 16375 16376 // Resolve the animation and report its conclusion 16377 deferred.resolveWith( elem, [ animation ] ); 16378 return false; 16379 }, 16380 animation = deferred.promise( { 16381 elem: elem, 16382 props: jQuery.extend( {}, properties ), 16383 opts: jQuery.extend( true, { 16384 specialEasing: {}, 16385 easing: jQuery.easing._default 16386 }, options ), 16387 originalProperties: properties, 16388 originalOptions: options, 16389 startTime: fxNow || createFxNow(), 16390 duration: options.duration, 16391 tweens: [], 16392 createTween: function( prop, end ) { 16393 var tween = jQuery.Tween( elem, animation.opts, prop, end, 16394 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 16395 animation.tweens.push( tween ); 16396 return tween; 16397 }, 16398 stop: function( gotoEnd ) { 16399 var index = 0, 16400 16401 // If we are going to the end, we want to run all the tweens 16402 // otherwise we skip this part 16403 length = gotoEnd ? animation.tweens.length : 0; 16404 if ( stopped ) { 16405 return this; 16406 } 16407 stopped = true; 16408 for ( ; index < length; index++ ) { 16409 animation.tweens[ index ].run( 1 ); 16410 } 16411 16412 // Resolve when we played the last frame; otherwise, reject 16413 if ( gotoEnd ) { 16414 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 16415 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 16416 } else { 16417 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 16418 } 16419 return this; 16420 } 16421 } ), 16422 props = animation.props; 16423 16424 propFilter( props, animation.opts.specialEasing ); 16425 16426 for ( ; index < length; index++ ) { 16427 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 16428 if ( result ) { 16429 if ( isFunction( result.stop ) ) { 16430 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 16431 result.stop.bind( result ); 16432 } 16433 return result; 16434 } 16435 } 16436 16437 jQuery.map( props, createTween, animation ); 16438 16439 if ( isFunction( animation.opts.start ) ) { 16440 animation.opts.start.call( elem, animation ); 16441 } 16442 16443 // Attach callbacks from options 16444 animation 16445 .progress( animation.opts.progress ) 16446 .done( animation.opts.done, animation.opts.complete ) 16447 .fail( animation.opts.fail ) 16448 .always( animation.opts.always ); 16449 16450 jQuery.fx.timer( 16451 jQuery.extend( tick, { 16452 elem: elem, 16453 anim: animation, 16454 queue: animation.opts.queue 16455 } ) 16456 ); 16457 16458 return animation; 16459} 16460 16461jQuery.Animation = jQuery.extend( Animation, { 16462 16463 tweeners: { 16464 "*": [ function( prop, value ) { 16465 var tween = this.createTween( prop, value ); 16466 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 16467 return tween; 16468 } ] 16469 }, 16470 16471 tweener: function( props, callback ) { 16472 if ( isFunction( props ) ) { 16473 callback = props; 16474 props = [ "*" ]; 16475 } else { 16476 props = props.match( rnothtmlwhite ); 16477 } 16478 16479 var prop, 16480 index = 0, 16481 length = props.length; 16482 16483 for ( ; index < length; index++ ) { 16484 prop = props[ index ]; 16485 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 16486 Animation.tweeners[ prop ].unshift( callback ); 16487 } 16488 }, 16489 16490 prefilters: [ defaultPrefilter ], 16491 16492 prefilter: function( callback, prepend ) { 16493 if ( prepend ) { 16494 Animation.prefilters.unshift( callback ); 16495 } else { 16496 Animation.prefilters.push( callback ); 16497 } 16498 } 16499} ); 16500 16501jQuery.speed = function( speed, easing, fn ) { 16502 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 16503 complete: fn || !fn && easing || 16504 isFunction( speed ) && speed, 16505 duration: speed, 16506 easing: fn && easing || easing && !isFunction( easing ) && easing 16507 }; 16508 16509 // Go to the end state if fx are off 16510 if ( jQuery.fx.off ) { 16511 opt.duration = 0; 16512 16513 } else { 16514 if ( typeof opt.duration !== "number" ) { 16515 if ( opt.duration in jQuery.fx.speeds ) { 16516 opt.duration = jQuery.fx.speeds[ opt.duration ]; 16517 16518 } else { 16519 opt.duration = jQuery.fx.speeds._default; 16520 } 16521 } 16522 } 16523 16524 // Normalize opt.queue - true/undefined/null -> "fx" 16525 if ( opt.queue == null || opt.queue === true ) { 16526 opt.queue = "fx"; 16527 } 16528 16529 // Queueing 16530 opt.old = opt.complete; 16531 16532 opt.complete = function() { 16533 if ( isFunction( opt.old ) ) { 16534 opt.old.call( this ); 16535 } 16536 16537 if ( opt.queue ) { 16538 jQuery.dequeue( this, opt.queue ); 16539 } 16540 }; 16541 16542 return opt; 16543}; 16544 16545jQuery.fn.extend( { 16546 fadeTo: function( speed, to, easing, callback ) { 16547 16548 // Show any hidden elements after setting opacity to 0 16549 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() 16550 16551 // Animate to the value specified 16552 .end().animate( { opacity: to }, speed, easing, callback ); 16553 }, 16554 animate: function( prop, speed, easing, callback ) { 16555 var empty = jQuery.isEmptyObject( prop ), 16556 optall = jQuery.speed( speed, easing, callback ), 16557 doAnimation = function() { 16558 16559 // Operate on a copy of prop so per-property easing won't be lost 16560 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 16561 16562 // Empty animations, or finishing resolves immediately 16563 if ( empty || dataPriv.get( this, "finish" ) ) { 16564 anim.stop( true ); 16565 } 16566 }; 16567 16568 doAnimation.finish = doAnimation; 16569 16570 return empty || optall.queue === false ? 16571 this.each( doAnimation ) : 16572 this.queue( optall.queue, doAnimation ); 16573 }, 16574 stop: function( type, clearQueue, gotoEnd ) { 16575 var stopQueue = function( hooks ) { 16576 var stop = hooks.stop; 16577 delete hooks.stop; 16578 stop( gotoEnd ); 16579 }; 16580 16581 if ( typeof type !== "string" ) { 16582 gotoEnd = clearQueue; 16583 clearQueue = type; 16584 type = undefined; 16585 } 16586 if ( clearQueue ) { 16587 this.queue( type || "fx", [] ); 16588 } 16589 16590 return this.each( function() { 16591 var dequeue = true, 16592 index = type != null && type + "queueHooks", 16593 timers = jQuery.timers, 16594 data = dataPriv.get( this ); 16595 16596 if ( index ) { 16597 if ( data[ index ] && data[ index ].stop ) { 16598 stopQueue( data[ index ] ); 16599 } 16600 } else { 16601 for ( index in data ) { 16602 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 16603 stopQueue( data[ index ] ); 16604 } 16605 } 16606 } 16607 16608 for ( index = timers.length; index--; ) { 16609 if ( timers[ index ].elem === this && 16610 ( type == null || timers[ index ].queue === type ) ) { 16611 16612 timers[ index ].anim.stop( gotoEnd ); 16613 dequeue = false; 16614 timers.splice( index, 1 ); 16615 } 16616 } 16617 16618 // Start the next in the queue if the last step wasn't forced. 16619 // Timers currently will call their complete callbacks, which 16620 // will dequeue but only if they were gotoEnd. 16621 if ( dequeue || !gotoEnd ) { 16622 jQuery.dequeue( this, type ); 16623 } 16624 } ); 16625 }, 16626 finish: function( type ) { 16627 if ( type !== false ) { 16628 type = type || "fx"; 16629 } 16630 return this.each( function() { 16631 var index, 16632 data = dataPriv.get( this ), 16633 queue = data[ type + "queue" ], 16634 hooks = data[ type + "queueHooks" ], 16635 timers = jQuery.timers, 16636 length = queue ? queue.length : 0; 16637 16638 // Enable finishing flag on private data 16639 data.finish = true; 16640 16641 // Empty the queue first 16642 jQuery.queue( this, type, [] ); 16643 16644 if ( hooks && hooks.stop ) { 16645 hooks.stop.call( this, true ); 16646 } 16647 16648 // Look for any active animations, and finish them 16649 for ( index = timers.length; index--; ) { 16650 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 16651 timers[ index ].anim.stop( true ); 16652 timers.splice( index, 1 ); 16653 } 16654 } 16655 16656 // Look for any animations in the old queue and finish them 16657 for ( index = 0; index < length; index++ ) { 16658 if ( queue[ index ] && queue[ index ].finish ) { 16659 queue[ index ].finish.call( this ); 16660 } 16661 } 16662 16663 // Turn off finishing flag 16664 delete data.finish; 16665 } ); 16666 } 16667} ); 16668 16669jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { 16670 var cssFn = jQuery.fn[ name ]; 16671 jQuery.fn[ name ] = function( speed, easing, callback ) { 16672 return speed == null || typeof speed === "boolean" ? 16673 cssFn.apply( this, arguments ) : 16674 this.animate( genFx( name, true ), speed, easing, callback ); 16675 }; 16676} ); 16677 16678// Generate shortcuts for custom animations 16679jQuery.each( { 16680 slideDown: genFx( "show" ), 16681 slideUp: genFx( "hide" ), 16682 slideToggle: genFx( "toggle" ), 16683 fadeIn: { opacity: "show" }, 16684 fadeOut: { opacity: "hide" }, 16685 fadeToggle: { opacity: "toggle" } 16686}, function( name, props ) { 16687 jQuery.fn[ name ] = function( speed, easing, callback ) { 16688 return this.animate( props, speed, easing, callback ); 16689 }; 16690} ); 16691 16692jQuery.timers = []; 16693jQuery.fx.tick = function() { 16694 var timer, 16695 i = 0, 16696 timers = jQuery.timers; 16697 16698 fxNow = Date.now(); 16699 16700 for ( ; i < timers.length; i++ ) { 16701 timer = timers[ i ]; 16702 16703 // Run the timer and safely remove it when done (allowing for external removal) 16704 if ( !timer() && timers[ i ] === timer ) { 16705 timers.splice( i--, 1 ); 16706 } 16707 } 16708 16709 if ( !timers.length ) { 16710 jQuery.fx.stop(); 16711 } 16712 fxNow = undefined; 16713}; 16714 16715jQuery.fx.timer = function( timer ) { 16716 jQuery.timers.push( timer ); 16717 jQuery.fx.start(); 16718}; 16719 16720jQuery.fx.interval = 13; 16721jQuery.fx.start = function() { 16722 if ( inProgress ) { 16723 return; 16724 } 16725 16726 inProgress = true; 16727 schedule(); 16728}; 16729 16730jQuery.fx.stop = function() { 16731 inProgress = null; 16732}; 16733 16734jQuery.fx.speeds = { 16735 slow: 600, 16736 fast: 200, 16737 16738 // Default speed 16739 _default: 400 16740}; 16741 16742 16743// Based off of the plugin by Clint Helfers, with permission. 16744jQuery.fn.delay = function( time, type ) { 16745 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 16746 type = type || "fx"; 16747 16748 return this.queue( type, function( next, hooks ) { 16749 var timeout = window.setTimeout( next, time ); 16750 hooks.stop = function() { 16751 window.clearTimeout( timeout ); 16752 }; 16753 } ); 16754}; 16755 16756 16757( function() { 16758 var input = document.createElement( "input" ), 16759 select = document.createElement( "select" ), 16760 opt = select.appendChild( document.createElement( "option" ) ); 16761 16762 input.type = "checkbox"; 16763 16764 // Support: Android <=4.3 only 16765 // Default value for a checkbox should be "on" 16766 support.checkOn = input.value !== ""; 16767 16768 // Support: IE <=11 only 16769 // Must access selectedIndex to make default options select 16770 support.optSelected = opt.selected; 16771 16772 // Support: IE <=11 only 16773 // An input loses its value after becoming a radio 16774 input = document.createElement( "input" ); 16775 input.value = "t"; 16776 input.type = "radio"; 16777 support.radioValue = input.value === "t"; 16778} )(); 16779 16780 16781var boolHook, 16782 attrHandle = jQuery.expr.attrHandle; 16783 16784jQuery.fn.extend( { 16785 attr: function( name, value ) { 16786 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 16787 }, 16788 16789 removeAttr: function( name ) { 16790 return this.each( function() { 16791 jQuery.removeAttr( this, name ); 16792 } ); 16793 } 16794} ); 16795 16796jQuery.extend( { 16797 attr: function( elem, name, value ) { 16798 var ret, hooks, 16799 nType = elem.nodeType; 16800 16801 // Don't get/set attributes on text, comment and attribute nodes 16802 if ( nType === 3 || nType === 8 || nType === 2 ) { 16803 return; 16804 } 16805 16806 // Fallback to prop when attributes are not supported 16807 if ( typeof elem.getAttribute === "undefined" ) { 16808 return jQuery.prop( elem, name, value ); 16809 } 16810 16811 // Attribute hooks are determined by the lowercase version 16812 // Grab necessary hook if one is defined 16813 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 16814 hooks = jQuery.attrHooks[ name.toLowerCase() ] || 16815 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 16816 } 16817 16818 if ( value !== undefined ) { 16819 if ( value === null ) { 16820 jQuery.removeAttr( elem, name ); 16821 return; 16822 } 16823 16824 if ( hooks && "set" in hooks && 16825 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 16826 return ret; 16827 } 16828 16829 elem.setAttribute( name, value + "" ); 16830 return value; 16831 } 16832 16833 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 16834 return ret; 16835 } 16836 16837 ret = jQuery.find.attr( elem, name ); 16838 16839 // Non-existent attributes return null, we normalize to undefined 16840 return ret == null ? undefined : ret; 16841 }, 16842 16843 attrHooks: { 16844 type: { 16845 set: function( elem, value ) { 16846 if ( !support.radioValue && value === "radio" && 16847 nodeName( elem, "input" ) ) { 16848 var val = elem.value; 16849 elem.setAttribute( "type", value ); 16850 if ( val ) { 16851 elem.value = val; 16852 } 16853 return value; 16854 } 16855 } 16856 } 16857 }, 16858 16859 removeAttr: function( elem, value ) { 16860 var name, 16861 i = 0, 16862 16863 // Attribute names can contain non-HTML whitespace characters 16864 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 16865 attrNames = value && value.match( rnothtmlwhite ); 16866 16867 if ( attrNames && elem.nodeType === 1 ) { 16868 while ( ( name = attrNames[ i++ ] ) ) { 16869 elem.removeAttribute( name ); 16870 } 16871 } 16872 } 16873} ); 16874 16875// Hooks for boolean attributes 16876boolHook = { 16877 set: function( elem, value, name ) { 16878 if ( value === false ) { 16879 16880 // Remove boolean attributes when set to false 16881 jQuery.removeAttr( elem, name ); 16882 } else { 16883 elem.setAttribute( name, name ); 16884 } 16885 return name; 16886 } 16887}; 16888 16889jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { 16890 var getter = attrHandle[ name ] || jQuery.find.attr; 16891 16892 attrHandle[ name ] = function( elem, name, isXML ) { 16893 var ret, handle, 16894 lowercaseName = name.toLowerCase(); 16895 16896 if ( !isXML ) { 16897 16898 // Avoid an infinite loop by temporarily removing this function from the getter 16899 handle = attrHandle[ lowercaseName ]; 16900 attrHandle[ lowercaseName ] = ret; 16901 ret = getter( elem, name, isXML ) != null ? 16902 lowercaseName : 16903 null; 16904 attrHandle[ lowercaseName ] = handle; 16905 } 16906 return ret; 16907 }; 16908} ); 16909 16910 16911 16912 16913var rfocusable = /^(?:input|select|textarea|button)$/i, 16914 rclickable = /^(?:a|area)$/i; 16915 16916jQuery.fn.extend( { 16917 prop: function( name, value ) { 16918 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 16919 }, 16920 16921 removeProp: function( name ) { 16922 return this.each( function() { 16923 delete this[ jQuery.propFix[ name ] || name ]; 16924 } ); 16925 } 16926} ); 16927 16928jQuery.extend( { 16929 prop: function( elem, name, value ) { 16930 var ret, hooks, 16931 nType = elem.nodeType; 16932 16933 // Don't get/set properties on text, comment and attribute nodes 16934 if ( nType === 3 || nType === 8 || nType === 2 ) { 16935 return; 16936 } 16937 16938 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 16939 16940 // Fix name and attach hooks 16941 name = jQuery.propFix[ name ] || name; 16942 hooks = jQuery.propHooks[ name ]; 16943 } 16944 16945 if ( value !== undefined ) { 16946 if ( hooks && "set" in hooks && 16947 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 16948 return ret; 16949 } 16950 16951 return ( elem[ name ] = value ); 16952 } 16953 16954 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 16955 return ret; 16956 } 16957 16958 return elem[ name ]; 16959 }, 16960 16961 propHooks: { 16962 tabIndex: { 16963 get: function( elem ) { 16964 16965 // Support: IE <=9 - 11 only 16966 // elem.tabIndex doesn't always return the 16967 // correct value when it hasn't been explicitly set 16968 // Use proper attribute retrieval (trac-12072) 16969 var tabindex = jQuery.find.attr( elem, "tabindex" ); 16970 16971 if ( tabindex ) { 16972 return parseInt( tabindex, 10 ); 16973 } 16974 16975 if ( 16976 rfocusable.test( elem.nodeName ) || 16977 rclickable.test( elem.nodeName ) && 16978 elem.href 16979 ) { 16980 return 0; 16981 } 16982 16983 return -1; 16984 } 16985 } 16986 }, 16987 16988 propFix: { 16989 "for": "htmlFor", 16990 "class": "className" 16991 } 16992} ); 16993 16994// Support: IE <=11 only 16995// Accessing the selectedIndex property 16996// forces the browser to respect setting selected 16997// on the option 16998// The getter ensures a default option is selected 16999// when in an optgroup 17000// eslint rule "no-unused-expressions" is disabled for this code 17001// since it considers such accessions noop 17002if ( !support.optSelected ) { 17003 jQuery.propHooks.selected = { 17004 get: function( elem ) { 17005 17006 /* eslint no-unused-expressions: "off" */ 17007 17008 var parent = elem.parentNode; 17009 if ( parent && parent.parentNode ) { 17010 parent.parentNode.selectedIndex; 17011 } 17012 return null; 17013 }, 17014 set: function( elem ) { 17015 17016 /* eslint no-unused-expressions: "off" */ 17017 17018 var parent = elem.parentNode; 17019 if ( parent ) { 17020 parent.selectedIndex; 17021 17022 if ( parent.parentNode ) { 17023 parent.parentNode.selectedIndex; 17024 } 17025 } 17026 } 17027 }; 17028} 17029 17030jQuery.each( [ 17031 "tabIndex", 17032 "readOnly", 17033 "maxLength", 17034 "cellSpacing", 17035 "cellPadding", 17036 "rowSpan", 17037 "colSpan", 17038 "useMap", 17039 "frameBorder", 17040 "contentEditable" 17041], function() { 17042 jQuery.propFix[ this.toLowerCase() ] = this; 17043} ); 17044 17045 17046 17047 17048 // Strip and collapse whitespace according to HTML spec 17049 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 17050 function stripAndCollapse( value ) { 17051 var tokens = value.match( rnothtmlwhite ) || []; 17052 return tokens.join( " " ); 17053 } 17054 17055 17056function getClass( elem ) { 17057 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 17058} 17059 17060function classesToArray( value ) { 17061 if ( Array.isArray( value ) ) { 17062 return value; 17063 } 17064 if ( typeof value === "string" ) { 17065 return value.match( rnothtmlwhite ) || []; 17066 } 17067 return []; 17068} 17069 17070jQuery.fn.extend( { 17071 addClass: function( value ) { 17072 var classNames, cur, curValue, className, i, finalValue; 17073 17074 if ( isFunction( value ) ) { 17075 return this.each( function( j ) { 17076 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 17077 } ); 17078 } 17079 17080 classNames = classesToArray( value ); 17081 17082 if ( classNames.length ) { 17083 return this.each( function() { 17084 curValue = getClass( this ); 17085 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 17086 17087 if ( cur ) { 17088 for ( i = 0; i < classNames.length; i++ ) { 17089 className = classNames[ i ]; 17090 if ( cur.indexOf( " " + className + " " ) < 0 ) { 17091 cur += className + " "; 17092 } 17093 } 17094 17095 // Only assign if different to avoid unneeded rendering. 17096 finalValue = stripAndCollapse( cur ); 17097 if ( curValue !== finalValue ) { 17098 this.setAttribute( "class", finalValue ); 17099 } 17100 } 17101 } ); 17102 } 17103 17104 return this; 17105 }, 17106 17107 removeClass: function( value ) { 17108 var classNames, cur, curValue, className, i, finalValue; 17109 17110 if ( isFunction( value ) ) { 17111 return this.each( function( j ) { 17112 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 17113 } ); 17114 } 17115 17116 if ( !arguments.length ) { 17117 return this.attr( "class", "" ); 17118 } 17119 17120 classNames = classesToArray( value ); 17121 17122 if ( classNames.length ) { 17123 return this.each( function() { 17124 curValue = getClass( this ); 17125 17126 // This expression is here for better compressibility (see addClass) 17127 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 17128 17129 if ( cur ) { 17130 for ( i = 0; i < classNames.length; i++ ) { 17131 className = classNames[ i ]; 17132 17133 // Remove *all* instances 17134 while ( cur.indexOf( " " + className + " " ) > -1 ) { 17135 cur = cur.replace( " " + className + " ", " " ); 17136 } 17137 } 17138 17139 // Only assign if different to avoid unneeded rendering. 17140 finalValue = stripAndCollapse( cur ); 17141 if ( curValue !== finalValue ) { 17142 this.setAttribute( "class", finalValue ); 17143 } 17144 } 17145 } ); 17146 } 17147 17148 return this; 17149 }, 17150 17151 toggleClass: function( value, stateVal ) { 17152 var classNames, className, i, self, 17153 type = typeof value, 17154 isValidValue = type === "string" || Array.isArray( value ); 17155 17156 if ( isFunction( value ) ) { 17157 return this.each( function( i ) { 17158 jQuery( this ).toggleClass( 17159 value.call( this, i, getClass( this ), stateVal ), 17160 stateVal 17161 ); 17162 } ); 17163 } 17164 17165 if ( typeof stateVal === "boolean" && isValidValue ) { 17166 return stateVal ? this.addClass( value ) : this.removeClass( value ); 17167 } 17168 17169 classNames = classesToArray( value ); 17170 17171 return this.each( function() { 17172 if ( isValidValue ) { 17173 17174 // Toggle individual class names 17175 self = jQuery( this ); 17176 17177 for ( i = 0; i < classNames.length; i++ ) { 17178 className = classNames[ i ]; 17179 17180 // Check each className given, space separated list 17181 if ( self.hasClass( className ) ) { 17182 self.removeClass( className ); 17183 } else { 17184 self.addClass( className ); 17185 } 17186 } 17187 17188 // Toggle whole class name 17189 } else if ( value === undefined || type === "boolean" ) { 17190 className = getClass( this ); 17191 if ( className ) { 17192 17193 // Store className if set 17194 dataPriv.set( this, "__className__", className ); 17195 } 17196 17197 // If the element has a class name or if we're passed `false`, 17198 // then remove the whole classname (if there was one, the above saved it). 17199 // Otherwise bring back whatever was previously saved (if anything), 17200 // falling back to the empty string if nothing was stored. 17201 if ( this.setAttribute ) { 17202 this.setAttribute( "class", 17203 className || value === false ? 17204 "" : 17205 dataPriv.get( this, "__className__" ) || "" 17206 ); 17207 } 17208 } 17209 } ); 17210 }, 17211 17212 hasClass: function( selector ) { 17213 var className, elem, 17214 i = 0; 17215 17216 className = " " + selector + " "; 17217 while ( ( elem = this[ i++ ] ) ) { 17218 if ( elem.nodeType === 1 && 17219 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { 17220 return true; 17221 } 17222 } 17223 17224 return false; 17225 } 17226} ); 17227 17228 17229 17230 17231var rreturn = /\r/g; 17232 17233jQuery.fn.extend( { 17234 val: function( value ) { 17235 var hooks, ret, valueIsFunction, 17236 elem = this[ 0 ]; 17237 17238 if ( !arguments.length ) { 17239 if ( elem ) { 17240 hooks = jQuery.valHooks[ elem.type ] || 17241 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 17242 17243 if ( hooks && 17244 "get" in hooks && 17245 ( ret = hooks.get( elem, "value" ) ) !== undefined 17246 ) { 17247 return ret; 17248 } 17249 17250 ret = elem.value; 17251 17252 // Handle most common string cases 17253 if ( typeof ret === "string" ) { 17254 return ret.replace( rreturn, "" ); 17255 } 17256 17257 // Handle cases where value is null/undef or number 17258 return ret == null ? "" : ret; 17259 } 17260 17261 return; 17262 } 17263 17264 valueIsFunction = isFunction( value ); 17265 17266 return this.each( function( i ) { 17267 var val; 17268 17269 if ( this.nodeType !== 1 ) { 17270 return; 17271 } 17272 17273 if ( valueIsFunction ) { 17274 val = value.call( this, i, jQuery( this ).val() ); 17275 } else { 17276 val = value; 17277 } 17278 17279 // Treat null/undefined as ""; convert numbers to string 17280 if ( val == null ) { 17281 val = ""; 17282 17283 } else if ( typeof val === "number" ) { 17284 val += ""; 17285 17286 } else if ( Array.isArray( val ) ) { 17287 val = jQuery.map( val, function( value ) { 17288 return value == null ? "" : value + ""; 17289 } ); 17290 } 17291 17292 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 17293 17294 // If set returns undefined, fall back to normal setting 17295 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 17296 this.value = val; 17297 } 17298 } ); 17299 } 17300} ); 17301 17302jQuery.extend( { 17303 valHooks: { 17304 option: { 17305 get: function( elem ) { 17306 17307 var val = jQuery.find.attr( elem, "value" ); 17308 return val != null ? 17309 val : 17310 17311 // Support: IE <=10 - 11 only 17312 // option.text throws exceptions (trac-14686, trac-14858) 17313 // Strip and collapse whitespace 17314 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 17315 stripAndCollapse( jQuery.text( elem ) ); 17316 } 17317 }, 17318 select: { 17319 get: function( elem ) { 17320 var value, option, i, 17321 options = elem.options, 17322 index = elem.selectedIndex, 17323 one = elem.type === "select-one", 17324 values = one ? null : [], 17325 max = one ? index + 1 : options.length; 17326 17327 if ( index < 0 ) { 17328 i = max; 17329 17330 } else { 17331 i = one ? index : 0; 17332 } 17333 17334 // Loop through all the selected options 17335 for ( ; i < max; i++ ) { 17336 option = options[ i ]; 17337 17338 // Support: IE <=9 only 17339 // IE8-9 doesn't update selected after form reset (trac-2551) 17340 if ( ( option.selected || i === index ) && 17341 17342 // Don't return options that are disabled or in a disabled optgroup 17343 !option.disabled && 17344 ( !option.parentNode.disabled || 17345 !nodeName( option.parentNode, "optgroup" ) ) ) { 17346 17347 // Get the specific value for the option 17348 value = jQuery( option ).val(); 17349 17350 // We don't need an array for one selects 17351 if ( one ) { 17352 return value; 17353 } 17354 17355 // Multi-Selects return an array 17356 values.push( value ); 17357 } 17358 } 17359 17360 return values; 17361 }, 17362 17363 set: function( elem, value ) { 17364 var optionSet, option, 17365 options = elem.options, 17366 values = jQuery.makeArray( value ), 17367 i = options.length; 17368 17369 while ( i-- ) { 17370 option = options[ i ]; 17371 17372 /* eslint-disable no-cond-assign */ 17373 17374 if ( option.selected = 17375 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 17376 ) { 17377 optionSet = true; 17378 } 17379 17380 /* eslint-enable no-cond-assign */ 17381 } 17382 17383 // Force browsers to behave consistently when non-matching value is set 17384 if ( !optionSet ) { 17385 elem.selectedIndex = -1; 17386 } 17387 return values; 17388 } 17389 } 17390 } 17391} ); 17392 17393// Radios and checkboxes getter/setter 17394jQuery.each( [ "radio", "checkbox" ], function() { 17395 jQuery.valHooks[ this ] = { 17396 set: function( elem, value ) { 17397 if ( Array.isArray( value ) ) { 17398 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 17399 } 17400 } 17401 }; 17402 if ( !support.checkOn ) { 17403 jQuery.valHooks[ this ].get = function( elem ) { 17404 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 17405 }; 17406 } 17407} ); 17408 17409 17410 17411 17412// Return jQuery for attributes-only inclusion 17413var location = window.location; 17414 17415var nonce = { guid: Date.now() }; 17416 17417var rquery = ( /\?/ ); 17418 17419 17420 17421// Cross-browser xml parsing 17422jQuery.parseXML = function( data ) { 17423 var xml, parserErrorElem; 17424 if ( !data || typeof data !== "string" ) { 17425 return null; 17426 } 17427 17428 // Support: IE 9 - 11 only 17429 // IE throws on parseFromString with invalid input. 17430 try { 17431 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 17432 } catch ( e ) {} 17433 17434 parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; 17435 if ( !xml || parserErrorElem ) { 17436 jQuery.error( "Invalid XML: " + ( 17437 parserErrorElem ? 17438 jQuery.map( parserErrorElem.childNodes, function( el ) { 17439 return el.textContent; 17440 } ).join( "\n" ) : 17441 data 17442 ) ); 17443 } 17444 return xml; 17445}; 17446 17447 17448var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 17449 stopPropagationCallback = function( e ) { 17450 e.stopPropagation(); 17451 }; 17452 17453jQuery.extend( jQuery.event, { 17454 17455 trigger: function( event, data, elem, onlyHandlers ) { 17456 17457 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 17458 eventPath = [ elem || document ], 17459 type = hasOwn.call( event, "type" ) ? event.type : event, 17460 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 17461 17462 cur = lastElement = tmp = elem = elem || document; 17463 17464 // Don't do events on text and comment nodes 17465 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 17466 return; 17467 } 17468 17469 // focus/blur morphs to focusin/out; ensure we're not firing them right now 17470 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 17471 return; 17472 } 17473 17474 if ( type.indexOf( "." ) > -1 ) { 17475 17476 // Namespaced trigger; create a regexp to match event type in handle() 17477 namespaces = type.split( "." ); 17478 type = namespaces.shift(); 17479 namespaces.sort(); 17480 } 17481 ontype = type.indexOf( ":" ) < 0 && "on" + type; 17482 17483 // Caller can pass in a jQuery.Event object, Object, or just an event type string 17484 event = event[ jQuery.expando ] ? 17485 event : 17486 new jQuery.Event( type, typeof event === "object" && event ); 17487 17488 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 17489 event.isTrigger = onlyHandlers ? 2 : 3; 17490 event.namespace = namespaces.join( "." ); 17491 event.rnamespace = event.namespace ? 17492 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 17493 null; 17494 17495 // Clean up the event in case it is being reused 17496 event.result = undefined; 17497 if ( !event.target ) { 17498 event.target = elem; 17499 } 17500 17501 // Clone any incoming data and prepend the event, creating the handler arg list 17502 data = data == null ? 17503 [ event ] : 17504 jQuery.makeArray( data, [ event ] ); 17505 17506 // Allow special events to draw outside the lines 17507 special = jQuery.event.special[ type ] || {}; 17508 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 17509 return; 17510 } 17511 17512 // Determine event propagation path in advance, per W3C events spec (trac-9951) 17513 // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724) 17514 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { 17515 17516 bubbleType = special.delegateType || type; 17517 if ( !rfocusMorph.test( bubbleType + type ) ) { 17518 cur = cur.parentNode; 17519 } 17520 for ( ; cur; cur = cur.parentNode ) { 17521 eventPath.push( cur ); 17522 tmp = cur; 17523 } 17524 17525 // Only add window if we got to document (e.g., not plain obj or detached DOM) 17526 if ( tmp === ( elem.ownerDocument || document ) ) { 17527 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 17528 } 17529 } 17530 17531 // Fire handlers on the event path 17532 i = 0; 17533 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 17534 lastElement = cur; 17535 event.type = i > 1 ? 17536 bubbleType : 17537 special.bindType || type; 17538 17539 // jQuery handler 17540 handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && 17541 dataPriv.get( cur, "handle" ); 17542 if ( handle ) { 17543 handle.apply( cur, data ); 17544 } 17545 17546 // Native handler 17547 handle = ontype && cur[ ontype ]; 17548 if ( handle && handle.apply && acceptData( cur ) ) { 17549 event.result = handle.apply( cur, data ); 17550 if ( event.result === false ) { 17551 event.preventDefault(); 17552 } 17553 } 17554 } 17555 event.type = type; 17556 17557 // If nobody prevented the default action, do it now 17558 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 17559 17560 if ( ( !special._default || 17561 special._default.apply( eventPath.pop(), data ) === false ) && 17562 acceptData( elem ) ) { 17563 17564 // Call a native DOM method on the target with the same name as the event. 17565 // Don't do default actions on window, that's where global variables be (trac-6170) 17566 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { 17567 17568 // Don't re-trigger an onFOO event when we call its FOO() method 17569 tmp = elem[ ontype ]; 17570 17571 if ( tmp ) { 17572 elem[ ontype ] = null; 17573 } 17574 17575 // Prevent re-triggering of the same event, since we already bubbled it above 17576 jQuery.event.triggered = type; 17577 17578 if ( event.isPropagationStopped() ) { 17579 lastElement.addEventListener( type, stopPropagationCallback ); 17580 } 17581 17582 elem[ type ](); 17583 17584 if ( event.isPropagationStopped() ) { 17585 lastElement.removeEventListener( type, stopPropagationCallback ); 17586 } 17587 17588 jQuery.event.triggered = undefined; 17589 17590 if ( tmp ) { 17591 elem[ ontype ] = tmp; 17592 } 17593 } 17594 } 17595 } 17596 17597 return event.result; 17598 }, 17599 17600 // Piggyback on a donor event to simulate a different one 17601 // Used only for `focus(in | out)` events 17602 simulate: function( type, elem, event ) { 17603 var e = jQuery.extend( 17604 new jQuery.Event(), 17605 event, 17606 { 17607 type: type, 17608 isSimulated: true 17609 } 17610 ); 17611 17612 jQuery.event.trigger( e, null, elem ); 17613 } 17614 17615} ); 17616 17617jQuery.fn.extend( { 17618 17619 trigger: function( type, data ) { 17620 return this.each( function() { 17621 jQuery.event.trigger( type, data, this ); 17622 } ); 17623 }, 17624 triggerHandler: function( type, data ) { 17625 var elem = this[ 0 ]; 17626 if ( elem ) { 17627 return jQuery.event.trigger( type, data, elem, true ); 17628 } 17629 } 17630} ); 17631 17632 17633var 17634 rbracket = /\[\]$/, 17635 rCRLF = /\r?\n/g, 17636 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 17637 rsubmittable = /^(?:input|select|textarea|keygen)/i; 17638 17639function buildParams( prefix, obj, traditional, add ) { 17640 var name; 17641 17642 if ( Array.isArray( obj ) ) { 17643 17644 // Serialize array item. 17645 jQuery.each( obj, function( i, v ) { 17646 if ( traditional || rbracket.test( prefix ) ) { 17647 17648 // Treat each array item as a scalar. 17649 add( prefix, v ); 17650 17651 } else { 17652 17653 // Item is non-scalar (array or object), encode its numeric index. 17654 buildParams( 17655 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 17656 v, 17657 traditional, 17658 add 17659 ); 17660 } 17661 } ); 17662 17663 } else if ( !traditional && toType( obj ) === "object" ) { 17664 17665 // Serialize object item. 17666 for ( name in obj ) { 17667 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 17668 } 17669 17670 } else { 17671 17672 // Serialize scalar item. 17673 add( prefix, obj ); 17674 } 17675} 17676 17677// Serialize an array of form elements or a set of 17678// key/values into a query string 17679jQuery.param = function( a, traditional ) { 17680 var prefix, 17681 s = [], 17682 add = function( key, valueOrFunction ) { 17683 17684 // If value is a function, invoke it and use its return value 17685 var value = isFunction( valueOrFunction ) ? 17686 valueOrFunction() : 17687 valueOrFunction; 17688 17689 s[ s.length ] = encodeURIComponent( key ) + "=" + 17690 encodeURIComponent( value == null ? "" : value ); 17691 }; 17692 17693 if ( a == null ) { 17694 return ""; 17695 } 17696 17697 // If an array was passed in, assume that it is an array of form elements. 17698 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 17699 17700 // Serialize the form elements 17701 jQuery.each( a, function() { 17702 add( this.name, this.value ); 17703 } ); 17704 17705 } else { 17706 17707 // If traditional, encode the "old" way (the way 1.3.2 or older 17708 // did it), otherwise encode params recursively. 17709 for ( prefix in a ) { 17710 buildParams( prefix, a[ prefix ], traditional, add ); 17711 } 17712 } 17713 17714 // Return the resulting serialization 17715 return s.join( "&" ); 17716}; 17717 17718jQuery.fn.extend( { 17719 serialize: function() { 17720 return jQuery.param( this.serializeArray() ); 17721 }, 17722 serializeArray: function() { 17723 return this.map( function() { 17724 17725 // Can add propHook for "elements" to filter or add form elements 17726 var elements = jQuery.prop( this, "elements" ); 17727 return elements ? jQuery.makeArray( elements ) : this; 17728 } ).filter( function() { 17729 var type = this.type; 17730 17731 // Use .is( ":disabled" ) so that fieldset[disabled] works 17732 return this.name && !jQuery( this ).is( ":disabled" ) && 17733 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 17734 ( this.checked || !rcheckableType.test( type ) ); 17735 } ).map( function( _i, elem ) { 17736 var val = jQuery( this ).val(); 17737 17738 if ( val == null ) { 17739 return null; 17740 } 17741 17742 if ( Array.isArray( val ) ) { 17743 return jQuery.map( val, function( val ) { 17744 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 17745 } ); 17746 } 17747 17748 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 17749 } ).get(); 17750 } 17751} ); 17752 17753 17754var 17755 r20 = /%20/g, 17756 rhash = /#.*$/, 17757 rantiCache = /([?&])_=[^&]*/, 17758 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 17759 17760 // trac-7653, trac-8125, trac-8152: local protocol detection 17761 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 17762 rnoContent = /^(?:GET|HEAD)$/, 17763 rprotocol = /^\/\//, 17764 17765 /* Prefilters 17766 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 17767 * 2) These are called: 17768 * - BEFORE asking for a transport 17769 * - AFTER param serialization (s.data is a string if s.processData is true) 17770 * 3) key is the dataType 17771 * 4) the catchall symbol "*" can be used 17772 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 17773 */ 17774 prefilters = {}, 17775 17776 /* Transports bindings 17777 * 1) key is the dataType 17778 * 2) the catchall symbol "*" can be used 17779 * 3) selection will start with transport dataType and THEN go to "*" if needed 17780 */ 17781 transports = {}, 17782 17783 // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression 17784 allTypes = "*/".concat( "*" ), 17785 17786 // Anchor tag for parsing the document origin 17787 originAnchor = document.createElement( "a" ); 17788 17789originAnchor.href = location.href; 17790 17791// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 17792function addToPrefiltersOrTransports( structure ) { 17793 17794 // dataTypeExpression is optional and defaults to "*" 17795 return function( dataTypeExpression, func ) { 17796 17797 if ( typeof dataTypeExpression !== "string" ) { 17798 func = dataTypeExpression; 17799 dataTypeExpression = "*"; 17800 } 17801 17802 var dataType, 17803 i = 0, 17804 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; 17805 17806 if ( isFunction( func ) ) { 17807 17808 // For each dataType in the dataTypeExpression 17809 while ( ( dataType = dataTypes[ i++ ] ) ) { 17810 17811 // Prepend if requested 17812 if ( dataType[ 0 ] === "+" ) { 17813 dataType = dataType.slice( 1 ) || "*"; 17814 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 17815 17816 // Otherwise append 17817 } else { 17818 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 17819 } 17820 } 17821 } 17822 }; 17823} 17824 17825// Base inspection function for prefilters and transports 17826function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 17827 17828 var inspected = {}, 17829 seekingTransport = ( structure === transports ); 17830 17831 function inspect( dataType ) { 17832 var selected; 17833 inspected[ dataType ] = true; 17834 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 17835 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 17836 if ( typeof dataTypeOrTransport === "string" && 17837 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 17838 17839 options.dataTypes.unshift( dataTypeOrTransport ); 17840 inspect( dataTypeOrTransport ); 17841 return false; 17842 } else if ( seekingTransport ) { 17843 return !( selected = dataTypeOrTransport ); 17844 } 17845 } ); 17846 return selected; 17847 } 17848 17849 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 17850} 17851 17852// A special extend for ajax options 17853// that takes "flat" options (not to be deep extended) 17854// Fixes trac-9887 17855function ajaxExtend( target, src ) { 17856 var key, deep, 17857 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 17858 17859 for ( key in src ) { 17860 if ( src[ key ] !== undefined ) { 17861 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 17862 } 17863 } 17864 if ( deep ) { 17865 jQuery.extend( true, target, deep ); 17866 } 17867 17868 return target; 17869} 17870 17871/* Handles responses to an ajax request: 17872 * - finds the right dataType (mediates between content-type and expected dataType) 17873 * - returns the corresponding response 17874 */ 17875function ajaxHandleResponses( s, jqXHR, responses ) { 17876 17877 var ct, type, finalDataType, firstDataType, 17878 contents = s.contents, 17879 dataTypes = s.dataTypes; 17880 17881 // Remove auto dataType and get content-type in the process 17882 while ( dataTypes[ 0 ] === "*" ) { 17883 dataTypes.shift(); 17884 if ( ct === undefined ) { 17885 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 17886 } 17887 } 17888 17889 // Check if we're dealing with a known content-type 17890 if ( ct ) { 17891 for ( type in contents ) { 17892 if ( contents[ type ] && contents[ type ].test( ct ) ) { 17893 dataTypes.unshift( type ); 17894 break; 17895 } 17896 } 17897 } 17898 17899 // Check to see if we have a response for the expected dataType 17900 if ( dataTypes[ 0 ] in responses ) { 17901 finalDataType = dataTypes[ 0 ]; 17902 } else { 17903 17904 // Try convertible dataTypes 17905 for ( type in responses ) { 17906 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 17907 finalDataType = type; 17908 break; 17909 } 17910 if ( !firstDataType ) { 17911 firstDataType = type; 17912 } 17913 } 17914 17915 // Or just use first one 17916 finalDataType = finalDataType || firstDataType; 17917 } 17918 17919 // If we found a dataType 17920 // We add the dataType to the list if needed 17921 // and return the corresponding response 17922 if ( finalDataType ) { 17923 if ( finalDataType !== dataTypes[ 0 ] ) { 17924 dataTypes.unshift( finalDataType ); 17925 } 17926 return responses[ finalDataType ]; 17927 } 17928} 17929 17930/* Chain conversions given the request and the original response 17931 * Also sets the responseXXX fields on the jqXHR instance 17932 */ 17933function ajaxConvert( s, response, jqXHR, isSuccess ) { 17934 var conv2, current, conv, tmp, prev, 17935 converters = {}, 17936 17937 // Work with a copy of dataTypes in case we need to modify it for conversion 17938 dataTypes = s.dataTypes.slice(); 17939 17940 // Create converters map with lowercased keys 17941 if ( dataTypes[ 1 ] ) { 17942 for ( conv in s.converters ) { 17943 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 17944 } 17945 } 17946 17947 current = dataTypes.shift(); 17948 17949 // Convert to each sequential dataType 17950 while ( current ) { 17951 17952 if ( s.responseFields[ current ] ) { 17953 jqXHR[ s.responseFields[ current ] ] = response; 17954 } 17955 17956 // Apply the dataFilter if provided 17957 if ( !prev && isSuccess && s.dataFilter ) { 17958 response = s.dataFilter( response, s.dataType ); 17959 } 17960 17961 prev = current; 17962 current = dataTypes.shift(); 17963 17964 if ( current ) { 17965 17966 // There's only work to do if current dataType is non-auto 17967 if ( current === "*" ) { 17968 17969 current = prev; 17970 17971 // Convert response if prev dataType is non-auto and differs from current 17972 } else if ( prev !== "*" && prev !== current ) { 17973 17974 // Seek a direct converter 17975 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 17976 17977 // If none found, seek a pair 17978 if ( !conv ) { 17979 for ( conv2 in converters ) { 17980 17981 // If conv2 outputs current 17982 tmp = conv2.split( " " ); 17983 if ( tmp[ 1 ] === current ) { 17984 17985 // If prev can be converted to accepted input 17986 conv = converters[ prev + " " + tmp[ 0 ] ] || 17987 converters[ "* " + tmp[ 0 ] ]; 17988 if ( conv ) { 17989 17990 // Condense equivalence converters 17991 if ( conv === true ) { 17992 conv = converters[ conv2 ]; 17993 17994 // Otherwise, insert the intermediate dataType 17995 } else if ( converters[ conv2 ] !== true ) { 17996 current = tmp[ 0 ]; 17997 dataTypes.unshift( tmp[ 1 ] ); 17998 } 17999 break; 18000 } 18001 } 18002 } 18003 } 18004 18005 // Apply converter (if not an equivalence) 18006 if ( conv !== true ) { 18007 18008 // Unless errors are allowed to bubble, catch and return them 18009 if ( conv && s.throws ) { 18010 response = conv( response ); 18011 } else { 18012 try { 18013 response = conv( response ); 18014 } catch ( e ) { 18015 return { 18016 state: "parsererror", 18017 error: conv ? e : "No conversion from " + prev + " to " + current 18018 }; 18019 } 18020 } 18021 } 18022 } 18023 } 18024 } 18025 18026 return { state: "success", data: response }; 18027} 18028 18029jQuery.extend( { 18030 18031 // Counter for holding the number of active queries 18032 active: 0, 18033 18034 // Last-Modified header cache for next request 18035 lastModified: {}, 18036 etag: {}, 18037 18038 ajaxSettings: { 18039 url: location.href, 18040 type: "GET", 18041 isLocal: rlocalProtocol.test( location.protocol ), 18042 global: true, 18043 processData: true, 18044 async: true, 18045 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 18046 18047 /* 18048 timeout: 0, 18049 data: null, 18050 dataType: null, 18051 username: null, 18052 password: null, 18053 cache: null, 18054 throws: false, 18055 traditional: false, 18056 headers: {}, 18057 */ 18058 18059 accepts: { 18060 "*": allTypes, 18061 text: "text/plain", 18062 html: "text/html", 18063 xml: "application/xml, text/xml", 18064 json: "application/json, text/javascript" 18065 }, 18066 18067 contents: { 18068 xml: /\bxml\b/, 18069 html: /\bhtml/, 18070 json: /\bjson\b/ 18071 }, 18072 18073 responseFields: { 18074 xml: "responseXML", 18075 text: "responseText", 18076 json: "responseJSON" 18077 }, 18078 18079 // Data converters 18080 // Keys separate source (or catchall "*") and destination types with a single space 18081 converters: { 18082 18083 // Convert anything to text 18084 "* text": String, 18085 18086 // Text to html (true = no transformation) 18087 "text html": true, 18088 18089 // Evaluate text as a json expression 18090 "text json": JSON.parse, 18091 18092 // Parse text as xml 18093 "text xml": jQuery.parseXML 18094 }, 18095 18096 // For options that shouldn't be deep extended: 18097 // you can add your own custom options here if 18098 // and when you create one that shouldn't be 18099 // deep extended (see ajaxExtend) 18100 flatOptions: { 18101 url: true, 18102 context: true 18103 } 18104 }, 18105 18106 // Creates a full fledged settings object into target 18107 // with both ajaxSettings and settings fields. 18108 // If target is omitted, writes into ajaxSettings. 18109 ajaxSetup: function( target, settings ) { 18110 return settings ? 18111 18112 // Building a settings object 18113 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 18114 18115 // Extending ajaxSettings 18116 ajaxExtend( jQuery.ajaxSettings, target ); 18117 }, 18118 18119 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 18120 ajaxTransport: addToPrefiltersOrTransports( transports ), 18121 18122 // Main method 18123 ajax: function( url, options ) { 18124 18125 // If url is an object, simulate pre-1.5 signature 18126 if ( typeof url === "object" ) { 18127 options = url; 18128 url = undefined; 18129 } 18130 18131 // Force options to be an object 18132 options = options || {}; 18133 18134 var transport, 18135 18136 // URL without anti-cache param 18137 cacheURL, 18138 18139 // Response headers 18140 responseHeadersString, 18141 responseHeaders, 18142 18143 // timeout handle 18144 timeoutTimer, 18145 18146 // Url cleanup var 18147 urlAnchor, 18148 18149 // Request state (becomes false upon send and true upon completion) 18150 completed, 18151 18152 // To know if global events are to be dispatched 18153 fireGlobals, 18154 18155 // Loop variable 18156 i, 18157 18158 // uncached part of the url 18159 uncached, 18160 18161 // Create the final options object 18162 s = jQuery.ajaxSetup( {}, options ), 18163 18164 // Callbacks context 18165 callbackContext = s.context || s, 18166 18167 // Context for global events is callbackContext if it is a DOM node or jQuery collection 18168 globalEventContext = s.context && 18169 ( callbackContext.nodeType || callbackContext.jquery ) ? 18170 jQuery( callbackContext ) : 18171 jQuery.event, 18172 18173 // Deferreds 18174 deferred = jQuery.Deferred(), 18175 completeDeferred = jQuery.Callbacks( "once memory" ), 18176 18177 // Status-dependent callbacks 18178 statusCode = s.statusCode || {}, 18179 18180 // Headers (they are sent all at once) 18181 requestHeaders = {}, 18182 requestHeadersNames = {}, 18183 18184 // Default abort message 18185 strAbort = "canceled", 18186 18187 // Fake xhr 18188 jqXHR = { 18189 readyState: 0, 18190 18191 // Builds headers hashtable if needed 18192 getResponseHeader: function( key ) { 18193 var match; 18194 if ( completed ) { 18195 if ( !responseHeaders ) { 18196 responseHeaders = {}; 18197 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 18198 responseHeaders[ match[ 1 ].toLowerCase() + " " ] = 18199 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) 18200 .concat( match[ 2 ] ); 18201 } 18202 } 18203 match = responseHeaders[ key.toLowerCase() + " " ]; 18204 } 18205 return match == null ? null : match.join( ", " ); 18206 }, 18207 18208 // Raw string 18209 getAllResponseHeaders: function() { 18210 return completed ? responseHeadersString : null; 18211 }, 18212 18213 // Caches the header 18214 setRequestHeader: function( name, value ) { 18215 if ( completed == null ) { 18216 name = requestHeadersNames[ name.toLowerCase() ] = 18217 requestHeadersNames[ name.toLowerCase() ] || name; 18218 requestHeaders[ name ] = value; 18219 } 18220 return this; 18221 }, 18222 18223 // Overrides response content-type header 18224 overrideMimeType: function( type ) { 18225 if ( completed == null ) { 18226 s.mimeType = type; 18227 } 18228 return this; 18229 }, 18230 18231 // Status-dependent callbacks 18232 statusCode: function( map ) { 18233 var code; 18234 if ( map ) { 18235 if ( completed ) { 18236 18237 // Execute the appropriate callbacks 18238 jqXHR.always( map[ jqXHR.status ] ); 18239 } else { 18240 18241 // Lazy-add the new callbacks in a way that preserves old ones 18242 for ( code in map ) { 18243 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 18244 } 18245 } 18246 } 18247 return this; 18248 }, 18249 18250 // Cancel the request 18251 abort: function( statusText ) { 18252 var finalText = statusText || strAbort; 18253 if ( transport ) { 18254 transport.abort( finalText ); 18255 } 18256 done( 0, finalText ); 18257 return this; 18258 } 18259 }; 18260 18261 // Attach deferreds 18262 deferred.promise( jqXHR ); 18263 18264 // Add protocol if not provided (prefilters might expect it) 18265 // Handle falsy url in the settings object (trac-10093: consistency with old signature) 18266 // We also use the url parameter if available 18267 s.url = ( ( url || s.url || location.href ) + "" ) 18268 .replace( rprotocol, location.protocol + "//" ); 18269 18270 // Alias method option to type as per ticket trac-12004 18271 s.type = options.method || options.type || s.method || s.type; 18272 18273 // Extract dataTypes list 18274 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; 18275 18276 // A cross-domain request is in order when the origin doesn't match the current origin. 18277 if ( s.crossDomain == null ) { 18278 urlAnchor = document.createElement( "a" ); 18279 18280 // Support: IE <=8 - 11, Edge 12 - 15 18281 // IE throws exception on accessing the href property if url is malformed, 18282 // e.g. http://example.com:80x/ 18283 try { 18284 urlAnchor.href = s.url; 18285 18286 // Support: IE <=8 - 11 only 18287 // Anchor's host property isn't correctly set when s.url is relative 18288 urlAnchor.href = urlAnchor.href; 18289 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 18290 urlAnchor.protocol + "//" + urlAnchor.host; 18291 } catch ( e ) { 18292 18293 // If there is an error parsing the URL, assume it is crossDomain, 18294 // it can be rejected by the transport if it is invalid 18295 s.crossDomain = true; 18296 } 18297 } 18298 18299 // Convert data if not already a string 18300 if ( s.data && s.processData && typeof s.data !== "string" ) { 18301 s.data = jQuery.param( s.data, s.traditional ); 18302 } 18303 18304 // Apply prefilters 18305 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 18306 18307 // If request was aborted inside a prefilter, stop there 18308 if ( completed ) { 18309 return jqXHR; 18310 } 18311 18312 // We can fire global events as of now if asked to 18313 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118) 18314 fireGlobals = jQuery.event && s.global; 18315 18316 // Watch for a new set of requests 18317 if ( fireGlobals && jQuery.active++ === 0 ) { 18318 jQuery.event.trigger( "ajaxStart" ); 18319 } 18320 18321 // Uppercase the type 18322 s.type = s.type.toUpperCase(); 18323 18324 // Determine if request has content 18325 s.hasContent = !rnoContent.test( s.type ); 18326 18327 // Save the URL in case we're toying with the If-Modified-Since 18328 // and/or If-None-Match header later on 18329 // Remove hash to simplify url manipulation 18330 cacheURL = s.url.replace( rhash, "" ); 18331 18332 // More options handling for requests with no content 18333 if ( !s.hasContent ) { 18334 18335 // Remember the hash so we can put it back 18336 uncached = s.url.slice( cacheURL.length ); 18337 18338 // If data is available and should be processed, append data to url 18339 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { 18340 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; 18341 18342 // trac-9682: remove data so that it's not used in an eventual retry 18343 delete s.data; 18344 } 18345 18346 // Add or update anti-cache param if needed 18347 if ( s.cache === false ) { 18348 cacheURL = cacheURL.replace( rantiCache, "$1" ); 18349 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + 18350 uncached; 18351 } 18352 18353 // Put hash and anti-cache on the URL that will be requested (gh-1732) 18354 s.url = cacheURL + uncached; 18355 18356 // Change '%20' to '+' if this is encoded form body content (gh-2658) 18357 } else if ( s.data && s.processData && 18358 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { 18359 s.data = s.data.replace( r20, "+" ); 18360 } 18361 18362 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 18363 if ( s.ifModified ) { 18364 if ( jQuery.lastModified[ cacheURL ] ) { 18365 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 18366 } 18367 if ( jQuery.etag[ cacheURL ] ) { 18368 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 18369 } 18370 } 18371 18372 // Set the correct header, if data is being sent 18373 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 18374 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 18375 } 18376 18377 // Set the Accepts header for the server, depending on the dataType 18378 jqXHR.setRequestHeader( 18379 "Accept", 18380 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 18381 s.accepts[ s.dataTypes[ 0 ] ] + 18382 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 18383 s.accepts[ "*" ] 18384 ); 18385 18386 // Check for headers option 18387 for ( i in s.headers ) { 18388 jqXHR.setRequestHeader( i, s.headers[ i ] ); 18389 } 18390 18391 // Allow custom headers/mimetypes and early abort 18392 if ( s.beforeSend && 18393 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { 18394 18395 // Abort if not done already and return 18396 return jqXHR.abort(); 18397 } 18398 18399 // Aborting is no longer a cancellation 18400 strAbort = "abort"; 18401 18402 // Install callbacks on deferreds 18403 completeDeferred.add( s.complete ); 18404 jqXHR.done( s.success ); 18405 jqXHR.fail( s.error ); 18406 18407 // Get transport 18408 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 18409 18410 // If no transport, we auto-abort 18411 if ( !transport ) { 18412 done( -1, "No Transport" ); 18413 } else { 18414 jqXHR.readyState = 1; 18415 18416 // Send global event 18417 if ( fireGlobals ) { 18418 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 18419 } 18420 18421 // If request was aborted inside ajaxSend, stop there 18422 if ( completed ) { 18423 return jqXHR; 18424 } 18425 18426 // Timeout 18427 if ( s.async && s.timeout > 0 ) { 18428 timeoutTimer = window.setTimeout( function() { 18429 jqXHR.abort( "timeout" ); 18430 }, s.timeout ); 18431 } 18432 18433 try { 18434 completed = false; 18435 transport.send( requestHeaders, done ); 18436 } catch ( e ) { 18437 18438 // Rethrow post-completion exceptions 18439 if ( completed ) { 18440 throw e; 18441 } 18442 18443 // Propagate others as results 18444 done( -1, e ); 18445 } 18446 } 18447 18448 // Callback for when everything is done 18449 function done( status, nativeStatusText, responses, headers ) { 18450 var isSuccess, success, error, response, modified, 18451 statusText = nativeStatusText; 18452 18453 // Ignore repeat invocations 18454 if ( completed ) { 18455 return; 18456 } 18457 18458 completed = true; 18459 18460 // Clear timeout if it exists 18461 if ( timeoutTimer ) { 18462 window.clearTimeout( timeoutTimer ); 18463 } 18464 18465 // Dereference transport for early garbage collection 18466 // (no matter how long the jqXHR object will be used) 18467 transport = undefined; 18468 18469 // Cache response headers 18470 responseHeadersString = headers || ""; 18471 18472 // Set readyState 18473 jqXHR.readyState = status > 0 ? 4 : 0; 18474 18475 // Determine if successful 18476 isSuccess = status >= 200 && status < 300 || status === 304; 18477 18478 // Get response data 18479 if ( responses ) { 18480 response = ajaxHandleResponses( s, jqXHR, responses ); 18481 } 18482 18483 // Use a noop converter for missing script but not if jsonp 18484 if ( !isSuccess && 18485 jQuery.inArray( "script", s.dataTypes ) > -1 && 18486 jQuery.inArray( "json", s.dataTypes ) < 0 ) { 18487 s.converters[ "text script" ] = function() {}; 18488 } 18489 18490 // Convert no matter what (that way responseXXX fields are always set) 18491 response = ajaxConvert( s, response, jqXHR, isSuccess ); 18492 18493 // If successful, handle type chaining 18494 if ( isSuccess ) { 18495 18496 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 18497 if ( s.ifModified ) { 18498 modified = jqXHR.getResponseHeader( "Last-Modified" ); 18499 if ( modified ) { 18500 jQuery.lastModified[ cacheURL ] = modified; 18501 } 18502 modified = jqXHR.getResponseHeader( "etag" ); 18503 if ( modified ) { 18504 jQuery.etag[ cacheURL ] = modified; 18505 } 18506 } 18507 18508 // if no content 18509 if ( status === 204 || s.type === "HEAD" ) { 18510 statusText = "nocontent"; 18511 18512 // if not modified 18513 } else if ( status === 304 ) { 18514 statusText = "notmodified"; 18515 18516 // If we have data, let's convert it 18517 } else { 18518 statusText = response.state; 18519 success = response.data; 18520 error = response.error; 18521 isSuccess = !error; 18522 } 18523 } else { 18524 18525 // Extract error from statusText and normalize for non-aborts 18526 error = statusText; 18527 if ( status || !statusText ) { 18528 statusText = "error"; 18529 if ( status < 0 ) { 18530 status = 0; 18531 } 18532 } 18533 } 18534 18535 // Set data for the fake xhr object 18536 jqXHR.status = status; 18537 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 18538 18539 // Success/Error 18540 if ( isSuccess ) { 18541 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 18542 } else { 18543 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 18544 } 18545 18546 // Status-dependent callbacks 18547 jqXHR.statusCode( statusCode ); 18548 statusCode = undefined; 18549 18550 if ( fireGlobals ) { 18551 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 18552 [ jqXHR, s, isSuccess ? success : error ] ); 18553 } 18554 18555 // Complete 18556 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 18557 18558 if ( fireGlobals ) { 18559 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 18560 18561 // Handle the global AJAX counter 18562 if ( !( --jQuery.active ) ) { 18563 jQuery.event.trigger( "ajaxStop" ); 18564 } 18565 } 18566 } 18567 18568 return jqXHR; 18569 }, 18570 18571 getJSON: function( url, data, callback ) { 18572 return jQuery.get( url, data, callback, "json" ); 18573 }, 18574 18575 getScript: function( url, callback ) { 18576 return jQuery.get( url, undefined, callback, "script" ); 18577 } 18578} ); 18579 18580jQuery.each( [ "get", "post" ], function( _i, method ) { 18581 jQuery[ method ] = function( url, data, callback, type ) { 18582 18583 // Shift arguments if data argument was omitted 18584 if ( isFunction( data ) ) { 18585 type = type || callback; 18586 callback = data; 18587 data = undefined; 18588 } 18589 18590 // The url can be an options object (which then must have .url) 18591 return jQuery.ajax( jQuery.extend( { 18592 url: url, 18593 type: method, 18594 dataType: type, 18595 data: data, 18596 success: callback 18597 }, jQuery.isPlainObject( url ) && url ) ); 18598 }; 18599} ); 18600 18601jQuery.ajaxPrefilter( function( s ) { 18602 var i; 18603 for ( i in s.headers ) { 18604 if ( i.toLowerCase() === "content-type" ) { 18605 s.contentType = s.headers[ i ] || ""; 18606 } 18607 } 18608} ); 18609 18610 18611jQuery._evalUrl = function( url, options, doc ) { 18612 return jQuery.ajax( { 18613 url: url, 18614 18615 // Make this explicit, since user can override this through ajaxSetup (trac-11264) 18616 type: "GET", 18617 dataType: "script", 18618 cache: true, 18619 async: false, 18620 global: false, 18621 18622 // Only evaluate the response if it is successful (gh-4126) 18623 // dataFilter is not invoked for failure responses, so using it instead 18624 // of the default converter is kludgy but it works. 18625 converters: { 18626 "text script": function() {} 18627 }, 18628 dataFilter: function( response ) { 18629 jQuery.globalEval( response, options, doc ); 18630 } 18631 } ); 18632}; 18633 18634 18635jQuery.fn.extend( { 18636 wrapAll: function( html ) { 18637 var wrap; 18638 18639 if ( this[ 0 ] ) { 18640 if ( isFunction( html ) ) { 18641 html = html.call( this[ 0 ] ); 18642 } 18643 18644 // The elements to wrap the target around 18645 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 18646 18647 if ( this[ 0 ].parentNode ) { 18648 wrap.insertBefore( this[ 0 ] ); 18649 } 18650 18651 wrap.map( function() { 18652 var elem = this; 18653 18654 while ( elem.firstElementChild ) { 18655 elem = elem.firstElementChild; 18656 } 18657 18658 return elem; 18659 } ).append( this ); 18660 } 18661 18662 return this; 18663 }, 18664 18665 wrapInner: function( html ) { 18666 if ( isFunction( html ) ) { 18667 return this.each( function( i ) { 18668 jQuery( this ).wrapInner( html.call( this, i ) ); 18669 } ); 18670 } 18671 18672 return this.each( function() { 18673 var self = jQuery( this ), 18674 contents = self.contents(); 18675 18676 if ( contents.length ) { 18677 contents.wrapAll( html ); 18678 18679 } else { 18680 self.append( html ); 18681 } 18682 } ); 18683 }, 18684 18685 wrap: function( html ) { 18686 var htmlIsFunction = isFunction( html ); 18687 18688 return this.each( function( i ) { 18689 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); 18690 } ); 18691 }, 18692 18693 unwrap: function( selector ) { 18694 this.parent( selector ).not( "body" ).each( function() { 18695 jQuery( this ).replaceWith( this.childNodes ); 18696 } ); 18697 return this; 18698 } 18699} ); 18700 18701 18702jQuery.expr.pseudos.hidden = function( elem ) { 18703 return !jQuery.expr.pseudos.visible( elem ); 18704}; 18705jQuery.expr.pseudos.visible = function( elem ) { 18706 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); 18707}; 18708 18709 18710 18711 18712jQuery.ajaxSettings.xhr = function() { 18713 try { 18714 return new window.XMLHttpRequest(); 18715 } catch ( e ) {} 18716}; 18717 18718var xhrSuccessStatus = { 18719 18720 // File protocol always yields status code 0, assume 200 18721 0: 200, 18722 18723 // Support: IE <=9 only 18724 // trac-1450: sometimes IE returns 1223 when it should be 204 18725 1223: 204 18726 }, 18727 xhrSupported = jQuery.ajaxSettings.xhr(); 18728 18729support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 18730support.ajax = xhrSupported = !!xhrSupported; 18731 18732jQuery.ajaxTransport( function( options ) { 18733 var callback, errorCallback; 18734 18735 // Cross domain only allowed if supported through XMLHttpRequest 18736 if ( support.cors || xhrSupported && !options.crossDomain ) { 18737 return { 18738 send: function( headers, complete ) { 18739 var i, 18740 xhr = options.xhr(); 18741 18742 xhr.open( 18743 options.type, 18744 options.url, 18745 options.async, 18746 options.username, 18747 options.password 18748 ); 18749 18750 // Apply custom fields if provided 18751 if ( options.xhrFields ) { 18752 for ( i in options.xhrFields ) { 18753 xhr[ i ] = options.xhrFields[ i ]; 18754 } 18755 } 18756 18757 // Override mime type if needed 18758 if ( options.mimeType && xhr.overrideMimeType ) { 18759 xhr.overrideMimeType( options.mimeType ); 18760 } 18761 18762 // X-Requested-With header 18763 // For cross-domain requests, seeing as conditions for a preflight are 18764 // akin to a jigsaw puzzle, we simply never set it to be sure. 18765 // (it can always be set on a per-request basis or even using ajaxSetup) 18766 // For same-domain requests, won't change header if already provided. 18767 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 18768 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 18769 } 18770 18771 // Set headers 18772 for ( i in headers ) { 18773 xhr.setRequestHeader( i, headers[ i ] ); 18774 } 18775 18776 // Callback 18777 callback = function( type ) { 18778 return function() { 18779 if ( callback ) { 18780 callback = errorCallback = xhr.onload = 18781 xhr.onerror = xhr.onabort = xhr.ontimeout = 18782 xhr.onreadystatechange = null; 18783 18784 if ( type === "abort" ) { 18785 xhr.abort(); 18786 } else if ( type === "error" ) { 18787 18788 // Support: IE <=9 only 18789 // On a manual native abort, IE9 throws 18790 // errors on any property access that is not readyState 18791 if ( typeof xhr.status !== "number" ) { 18792 complete( 0, "error" ); 18793 } else { 18794 complete( 18795 18796 // File: protocol always yields status 0; see trac-8605, trac-14207 18797 xhr.status, 18798 xhr.statusText 18799 ); 18800 } 18801 } else { 18802 complete( 18803 xhrSuccessStatus[ xhr.status ] || xhr.status, 18804 xhr.statusText, 18805 18806 // Support: IE <=9 only 18807 // IE9 has no XHR2 but throws on binary (trac-11426) 18808 // For XHR2 non-text, let the caller handle it (gh-2498) 18809 ( xhr.responseType || "text" ) !== "text" || 18810 typeof xhr.responseText !== "string" ? 18811 { binary: xhr.response } : 18812 { text: xhr.responseText }, 18813 xhr.getAllResponseHeaders() 18814 ); 18815 } 18816 } 18817 }; 18818 }; 18819 18820 // Listen to events 18821 xhr.onload = callback(); 18822 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); 18823 18824 // Support: IE 9 only 18825 // Use onreadystatechange to replace onabort 18826 // to handle uncaught aborts 18827 if ( xhr.onabort !== undefined ) { 18828 xhr.onabort = errorCallback; 18829 } else { 18830 xhr.onreadystatechange = function() { 18831 18832 // Check readyState before timeout as it changes 18833 if ( xhr.readyState === 4 ) { 18834 18835 // Allow onerror to be called first, 18836 // but that will not handle a native abort 18837 // Also, save errorCallback to a variable 18838 // as xhr.onerror cannot be accessed 18839 window.setTimeout( function() { 18840 if ( callback ) { 18841 errorCallback(); 18842 } 18843 } ); 18844 } 18845 }; 18846 } 18847 18848 // Create the abort callback 18849 callback = callback( "abort" ); 18850 18851 try { 18852 18853 // Do send the request (this may raise an exception) 18854 xhr.send( options.hasContent && options.data || null ); 18855 } catch ( e ) { 18856 18857 // trac-14683: Only rethrow if this hasn't been notified as an error yet 18858 if ( callback ) { 18859 throw e; 18860 } 18861 } 18862 }, 18863 18864 abort: function() { 18865 if ( callback ) { 18866 callback(); 18867 } 18868 } 18869 }; 18870 } 18871} ); 18872 18873 18874 18875 18876// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 18877jQuery.ajaxPrefilter( function( s ) { 18878 if ( s.crossDomain ) { 18879 s.contents.script = false; 18880 } 18881} ); 18882 18883// Install script dataType 18884jQuery.ajaxSetup( { 18885 accepts: { 18886 script: "text/javascript, application/javascript, " + 18887 "application/ecmascript, application/x-ecmascript" 18888 }, 18889 contents: { 18890 script: /\b(?:java|ecma)script\b/ 18891 }, 18892 converters: { 18893 "text script": function( text ) { 18894 jQuery.globalEval( text ); 18895 return text; 18896 } 18897 } 18898} ); 18899 18900// Handle cache's special case and crossDomain 18901jQuery.ajaxPrefilter( "script", function( s ) { 18902 if ( s.cache === undefined ) { 18903 s.cache = false; 18904 } 18905 if ( s.crossDomain ) { 18906 s.type = "GET"; 18907 } 18908} ); 18909 18910// Bind script tag hack transport 18911jQuery.ajaxTransport( "script", function( s ) { 18912 18913 // This transport only deals with cross domain or forced-by-attrs requests 18914 if ( s.crossDomain || s.scriptAttrs ) { 18915 var script, callback; 18916 return { 18917 send: function( _, complete ) { 18918 script = jQuery( "<script>" ) 18919 .attr( s.scriptAttrs || {} ) 18920 .prop( { charset: s.scriptCharset, src: s.url } ) 18921 .on( "load error", callback = function( evt ) { 18922 script.remove(); 18923 callback = null; 18924 if ( evt ) { 18925 complete( evt.type === "error" ? 404 : 200, evt.type ); 18926 } 18927 } ); 18928 18929 // Use native DOM manipulation to avoid our domManip AJAX trickery 18930 document.head.appendChild( script[ 0 ] ); 18931 }, 18932 abort: function() { 18933 if ( callback ) { 18934 callback(); 18935 } 18936 } 18937 }; 18938 } 18939} ); 18940 18941 18942 18943 18944var oldCallbacks = [], 18945 rjsonp = /(=)\?(?=&|$)|\?\?/; 18946 18947// Default jsonp settings 18948jQuery.ajaxSetup( { 18949 jsonp: "callback", 18950 jsonpCallback: function() { 18951 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) ); 18952 this[ callback ] = true; 18953 return callback; 18954 } 18955} ); 18956 18957// Detect, normalize options and install callbacks for jsonp requests 18958jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 18959 18960 var callbackName, overwritten, responseContainer, 18961 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 18962 "url" : 18963 typeof s.data === "string" && 18964 ( s.contentType || "" ) 18965 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 18966 rjsonp.test( s.data ) && "data" 18967 ); 18968 18969 // Handle iff the expected data type is "jsonp" or we have a parameter to set 18970 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 18971 18972 // Get callback name, remembering preexisting value associated with it 18973 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? 18974 s.jsonpCallback() : 18975 s.jsonpCallback; 18976 18977 // Insert callback into url or form data 18978 if ( jsonProp ) { 18979 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 18980 } else if ( s.jsonp !== false ) { 18981 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 18982 } 18983 18984 // Use data converter to retrieve json after script execution 18985 s.converters[ "script json" ] = function() { 18986 if ( !responseContainer ) { 18987 jQuery.error( callbackName + " was not called" ); 18988 } 18989 return responseContainer[ 0 ]; 18990 }; 18991 18992 // Force json dataType 18993 s.dataTypes[ 0 ] = "json"; 18994 18995 // Install callback 18996 overwritten = window[ callbackName ]; 18997 window[ callbackName ] = function() { 18998 responseContainer = arguments; 18999 }; 19000 19001 // Clean-up function (fires after converters) 19002 jqXHR.always( function() { 19003 19004 // If previous value didn't exist - remove it 19005 if ( overwritten === undefined ) { 19006 jQuery( window ).removeProp( callbackName ); 19007 19008 // Otherwise restore preexisting value 19009 } else { 19010 window[ callbackName ] = overwritten; 19011 } 19012 19013 // Save back as free 19014 if ( s[ callbackName ] ) { 19015 19016 // Make sure that re-using the options doesn't screw things around 19017 s.jsonpCallback = originalSettings.jsonpCallback; 19018 19019 // Save the callback name for future use 19020 oldCallbacks.push( callbackName ); 19021 } 19022 19023 // Call if it was a function and we have a response 19024 if ( responseContainer && isFunction( overwritten ) ) { 19025 overwritten( responseContainer[ 0 ] ); 19026 } 19027 19028 responseContainer = overwritten = undefined; 19029 } ); 19030 19031 // Delegate to script 19032 return "script"; 19033 } 19034} ); 19035 19036 19037 19038 19039// Support: Safari 8 only 19040// In Safari 8 documents created via document.implementation.createHTMLDocument 19041// collapse sibling forms: the second one becomes a child of the first one. 19042// Because of that, this security measure has to be disabled in Safari 8. 19043// https://bugs.webkit.org/show_bug.cgi?id=137337 19044support.createHTMLDocument = ( function() { 19045 var body = document.implementation.createHTMLDocument( "" ).body; 19046 body.innerHTML = "<form></form><form></form>"; 19047 return body.childNodes.length === 2; 19048} )(); 19049 19050 19051// Argument "data" should be string of html 19052// context (optional): If specified, the fragment will be created in this context, 19053// defaults to document 19054// keepScripts (optional): If true, will include scripts passed in the html string 19055jQuery.parseHTML = function( data, context, keepScripts ) { 19056 if ( typeof data !== "string" ) { 19057 return []; 19058 } 19059 if ( typeof context === "boolean" ) { 19060 keepScripts = context; 19061 context = false; 19062 } 19063 19064 var base, parsed, scripts; 19065 19066 if ( !context ) { 19067 19068 // Stop scripts or inline event handlers from being executed immediately 19069 // by using document.implementation 19070 if ( support.createHTMLDocument ) { 19071 context = document.implementation.createHTMLDocument( "" ); 19072 19073 // Set the base href for the created document 19074 // so any parsed elements with URLs 19075 // are based on the document's URL (gh-2965) 19076 base = context.createElement( "base" ); 19077 base.href = document.location.href; 19078 context.head.appendChild( base ); 19079 } else { 19080 context = document; 19081 } 19082 } 19083 19084 parsed = rsingleTag.exec( data ); 19085 scripts = !keepScripts && []; 19086 19087 // Single tag 19088 if ( parsed ) { 19089 return [ context.createElement( parsed[ 1 ] ) ]; 19090 } 19091 19092 parsed = buildFragment( [ data ], context, scripts ); 19093 19094 if ( scripts && scripts.length ) { 19095 jQuery( scripts ).remove(); 19096 } 19097 19098 return jQuery.merge( [], parsed.childNodes ); 19099}; 19100 19101 19102/** 19103 * Load a url into a page 19104 */ 19105jQuery.fn.load = function( url, params, callback ) { 19106 var selector, type, response, 19107 self = this, 19108 off = url.indexOf( " " ); 19109 19110 if ( off > -1 ) { 19111 selector = stripAndCollapse( url.slice( off ) ); 19112 url = url.slice( 0, off ); 19113 } 19114 19115 // If it's a function 19116 if ( isFunction( params ) ) { 19117 19118 // We assume that it's the callback 19119 callback = params; 19120 params = undefined; 19121 19122 // Otherwise, build a param string 19123 } else if ( params && typeof params === "object" ) { 19124 type = "POST"; 19125 } 19126 19127 // If we have elements to modify, make the request 19128 if ( self.length > 0 ) { 19129 jQuery.ajax( { 19130 url: url, 19131 19132 // If "type" variable is undefined, then "GET" method will be used. 19133 // Make value of this field explicit since 19134 // user can override it through ajaxSetup method 19135 type: type || "GET", 19136 dataType: "html", 19137 data: params 19138 } ).done( function( responseText ) { 19139 19140 // Save response for use in complete callback 19141 response = arguments; 19142 19143 self.html( selector ? 19144 19145 // If a selector was specified, locate the right elements in a dummy div 19146 // Exclude scripts to avoid IE 'Permission Denied' errors 19147 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 19148 19149 // Otherwise use the full result 19150 responseText ); 19151 19152 // If the request succeeds, this function gets "data", "status", "jqXHR" 19153 // but they are ignored because response was set above. 19154 // If it fails, this function gets "jqXHR", "status", "error" 19155 } ).always( callback && function( jqXHR, status ) { 19156 self.each( function() { 19157 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 19158 } ); 19159 } ); 19160 } 19161 19162 return this; 19163}; 19164 19165 19166 19167 19168jQuery.expr.pseudos.animated = function( elem ) { 19169 return jQuery.grep( jQuery.timers, function( fn ) { 19170 return elem === fn.elem; 19171 } ).length; 19172}; 19173 19174 19175 19176 19177jQuery.offset = { 19178 setOffset: function( elem, options, i ) { 19179 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 19180 position = jQuery.css( elem, "position" ), 19181 curElem = jQuery( elem ), 19182 props = {}; 19183 19184 // Set position first, in-case top/left are set even on static elem 19185 if ( position === "static" ) { 19186 elem.style.position = "relative"; 19187 } 19188 19189 curOffset = curElem.offset(); 19190 curCSSTop = jQuery.css( elem, "top" ); 19191 curCSSLeft = jQuery.css( elem, "left" ); 19192 calculatePosition = ( position === "absolute" || position === "fixed" ) && 19193 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 19194 19195 // Need to be able to calculate position if either 19196 // top or left is auto and position is either absolute or fixed 19197 if ( calculatePosition ) { 19198 curPosition = curElem.position(); 19199 curTop = curPosition.top; 19200 curLeft = curPosition.left; 19201 19202 } else { 19203 curTop = parseFloat( curCSSTop ) || 0; 19204 curLeft = parseFloat( curCSSLeft ) || 0; 19205 } 19206 19207 if ( isFunction( options ) ) { 19208 19209 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 19210 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 19211 } 19212 19213 if ( options.top != null ) { 19214 props.top = ( options.top - curOffset.top ) + curTop; 19215 } 19216 if ( options.left != null ) { 19217 props.left = ( options.left - curOffset.left ) + curLeft; 19218 } 19219 19220 if ( "using" in options ) { 19221 options.using.call( elem, props ); 19222 19223 } else { 19224 curElem.css( props ); 19225 } 19226 } 19227}; 19228 19229jQuery.fn.extend( { 19230 19231 // offset() relates an element's border box to the document origin 19232 offset: function( options ) { 19233 19234 // Preserve chaining for setter 19235 if ( arguments.length ) { 19236 return options === undefined ? 19237 this : 19238 this.each( function( i ) { 19239 jQuery.offset.setOffset( this, options, i ); 19240 } ); 19241 } 19242 19243 var rect, win, 19244 elem = this[ 0 ]; 19245 19246 if ( !elem ) { 19247 return; 19248 } 19249 19250 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 19251 // Support: IE <=11 only 19252 // Running getBoundingClientRect on a 19253 // disconnected node in IE throws an error 19254 if ( !elem.getClientRects().length ) { 19255 return { top: 0, left: 0 }; 19256 } 19257 19258 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 19259 rect = elem.getBoundingClientRect(); 19260 win = elem.ownerDocument.defaultView; 19261 return { 19262 top: rect.top + win.pageYOffset, 19263 left: rect.left + win.pageXOffset 19264 }; 19265 }, 19266 19267 // position() relates an element's margin box to its offset parent's padding box 19268 // This corresponds to the behavior of CSS absolute positioning 19269 position: function() { 19270 if ( !this[ 0 ] ) { 19271 return; 19272 } 19273 19274 var offsetParent, offset, doc, 19275 elem = this[ 0 ], 19276 parentOffset = { top: 0, left: 0 }; 19277 19278 // position:fixed elements are offset from the viewport, which itself always has zero offset 19279 if ( jQuery.css( elem, "position" ) === "fixed" ) { 19280 19281 // Assume position:fixed implies availability of getBoundingClientRect 19282 offset = elem.getBoundingClientRect(); 19283 19284 } else { 19285 offset = this.offset(); 19286 19287 // Account for the *real* offset parent, which can be the document or its root element 19288 // when a statically positioned element is identified 19289 doc = elem.ownerDocument; 19290 offsetParent = elem.offsetParent || doc.documentElement; 19291 while ( offsetParent && 19292 ( offsetParent === doc.body || offsetParent === doc.documentElement ) && 19293 jQuery.css( offsetParent, "position" ) === "static" ) { 19294 19295 offsetParent = offsetParent.parentNode; 19296 } 19297 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { 19298 19299 // Incorporate borders into its offset, since they are outside its content origin 19300 parentOffset = jQuery( offsetParent ).offset(); 19301 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); 19302 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); 19303 } 19304 } 19305 19306 // Subtract parent offsets and element margins 19307 return { 19308 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 19309 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 19310 }; 19311 }, 19312 19313 // This method will return documentElement in the following cases: 19314 // 1) For the element inside the iframe without offsetParent, this method will return 19315 // documentElement of the parent window 19316 // 2) For the hidden or detached element 19317 // 3) For body or html element, i.e. in case of the html node - it will return itself 19318 // 19319 // but those exceptions were never presented as a real life use-cases 19320 // and might be considered as more preferable results. 19321 // 19322 // This logic, however, is not guaranteed and can change at any point in the future 19323 offsetParent: function() { 19324 return this.map( function() { 19325 var offsetParent = this.offsetParent; 19326 19327 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 19328 offsetParent = offsetParent.offsetParent; 19329 } 19330 19331 return offsetParent || documentElement; 19332 } ); 19333 } 19334} ); 19335 19336// Create scrollLeft and scrollTop methods 19337jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 19338 var top = "pageYOffset" === prop; 19339 19340 jQuery.fn[ method ] = function( val ) { 19341 return access( this, function( elem, method, val ) { 19342 19343 // Coalesce documents and windows 19344 var win; 19345 if ( isWindow( elem ) ) { 19346 win = elem; 19347 } else if ( elem.nodeType === 9 ) { 19348 win = elem.defaultView; 19349 } 19350 19351 if ( val === undefined ) { 19352 return win ? win[ prop ] : elem[ method ]; 19353 } 19354 19355 if ( win ) { 19356 win.scrollTo( 19357 !top ? val : win.pageXOffset, 19358 top ? val : win.pageYOffset 19359 ); 19360 19361 } else { 19362 elem[ method ] = val; 19363 } 19364 }, method, val, arguments.length ); 19365 }; 19366} ); 19367 19368// Support: Safari <=7 - 9.1, Chrome <=37 - 49 19369// Add the top/left cssHooks using jQuery.fn.position 19370// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 19371// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 19372// getComputedStyle returns percent when specified for top/left/bottom/right; 19373// rather than make the css module depend on the offset module, just check for it here 19374jQuery.each( [ "top", "left" ], function( _i, prop ) { 19375 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 19376 function( elem, computed ) { 19377 if ( computed ) { 19378 computed = curCSS( elem, prop ); 19379 19380 // If curCSS returns percentage, fallback to offset 19381 return rnumnonpx.test( computed ) ? 19382 jQuery( elem ).position()[ prop ] + "px" : 19383 computed; 19384 } 19385 } 19386 ); 19387} ); 19388 19389 19390// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 19391jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 19392 jQuery.each( { 19393 padding: "inner" + name, 19394 content: type, 19395 "": "outer" + name 19396 }, function( defaultExtra, funcName ) { 19397 19398 // Margin is only for outerHeight, outerWidth 19399 jQuery.fn[ funcName ] = function( margin, value ) { 19400 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 19401 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 19402 19403 return access( this, function( elem, type, value ) { 19404 var doc; 19405 19406 if ( isWindow( elem ) ) { 19407 19408 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 19409 return funcName.indexOf( "outer" ) === 0 ? 19410 elem[ "inner" + name ] : 19411 elem.document.documentElement[ "client" + name ]; 19412 } 19413 19414 // Get document width or height 19415 if ( elem.nodeType === 9 ) { 19416 doc = elem.documentElement; 19417 19418 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 19419 // whichever is greatest 19420 return Math.max( 19421 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 19422 elem.body[ "offset" + name ], doc[ "offset" + name ], 19423 doc[ "client" + name ] 19424 ); 19425 } 19426 19427 return value === undefined ? 19428 19429 // Get width or height on the element, requesting but not forcing parseFloat 19430 jQuery.css( elem, type, extra ) : 19431 19432 // Set width or height on the element 19433 jQuery.style( elem, type, value, extra ); 19434 }, type, chainable ? margin : undefined, chainable ); 19435 }; 19436 } ); 19437} ); 19438 19439 19440jQuery.each( [ 19441 "ajaxStart", 19442 "ajaxStop", 19443 "ajaxComplete", 19444 "ajaxError", 19445 "ajaxSuccess", 19446 "ajaxSend" 19447], function( _i, type ) { 19448 jQuery.fn[ type ] = function( fn ) { 19449 return this.on( type, fn ); 19450 }; 19451} ); 19452 19453 19454 19455 19456jQuery.fn.extend( { 19457 19458 bind: function( types, data, fn ) { 19459 return this.on( types, null, data, fn ); 19460 }, 19461 unbind: function( types, fn ) { 19462 return this.off( types, null, fn ); 19463 }, 19464 19465 delegate: function( selector, types, data, fn ) { 19466 return this.on( types, selector, data, fn ); 19467 }, 19468 undelegate: function( selector, types, fn ) { 19469 19470 // ( namespace ) or ( selector, types [, fn] ) 19471 return arguments.length === 1 ? 19472 this.off( selector, "**" ) : 19473 this.off( types, selector || "**", fn ); 19474 }, 19475 19476 hover: function( fnOver, fnOut ) { 19477 return this 19478 .on( "mouseenter", fnOver ) 19479 .on( "mouseleave", fnOut || fnOver ); 19480 } 19481} ); 19482 19483jQuery.each( 19484 ( "blur focus focusin focusout resize scroll click dblclick " + 19485 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 19486 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 19487 function( _i, name ) { 19488 19489 // Handle event binding 19490 jQuery.fn[ name ] = function( data, fn ) { 19491 return arguments.length > 0 ? 19492 this.on( name, null, data, fn ) : 19493 this.trigger( name ); 19494 }; 19495 } 19496); 19497 19498 19499 19500 19501// Support: Android <=4.0 only 19502// Make sure we trim BOM and NBSP 19503// Require that the "whitespace run" starts from a non-whitespace 19504// to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position. 19505var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; 19506 19507// Bind a function to a context, optionally partially applying any 19508// arguments. 19509// jQuery.proxy is deprecated to promote standards (specifically Function#bind) 19510// However, it is not slated for removal any time soon 19511jQuery.proxy = function( fn, context ) { 19512 var tmp, args, proxy; 19513 19514 if ( typeof context === "string" ) { 19515 tmp = fn[ context ]; 19516 context = fn; 19517 fn = tmp; 19518 } 19519 19520 // Quick check to determine if target is callable, in the spec 19521 // this throws a TypeError, but we will just return undefined. 19522 if ( !isFunction( fn ) ) { 19523 return undefined; 19524 } 19525 19526 // Simulated bind 19527 args = slice.call( arguments, 2 ); 19528 proxy = function() { 19529 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 19530 }; 19531 19532 // Set the guid of unique handler to the same of original handler, so it can be removed 19533 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 19534 19535 return proxy; 19536}; 19537 19538jQuery.holdReady = function( hold ) { 19539 if ( hold ) { 19540 jQuery.readyWait++; 19541 } else { 19542 jQuery.ready( true ); 19543 } 19544}; 19545jQuery.isArray = Array.isArray; 19546jQuery.parseJSON = JSON.parse; 19547jQuery.nodeName = nodeName; 19548jQuery.isFunction = isFunction; 19549jQuery.isWindow = isWindow; 19550jQuery.camelCase = camelCase; 19551jQuery.type = toType; 19552 19553jQuery.now = Date.now; 19554 19555jQuery.isNumeric = function( obj ) { 19556 19557 // As of jQuery 3.0, isNumeric is limited to 19558 // strings and numbers (primitives or objects) 19559 // that can be coerced to finite numbers (gh-2662) 19560 var type = jQuery.type( obj ); 19561 return ( type === "number" || type === "string" ) && 19562 19563 // parseFloat NaNs numeric-cast false positives ("") 19564 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 19565 // subtraction forces infinities to NaN 19566 !isNaN( obj - parseFloat( obj ) ); 19567}; 19568 19569jQuery.trim = function( text ) { 19570 return text == null ? 19571 "" : 19572 ( text + "" ).replace( rtrim, "$1" ); 19573}; 19574 19575 19576 19577// Register as a named AMD module, since jQuery can be concatenated with other 19578// files that may use define, but not via a proper concatenation script that 19579// understands anonymous AMD modules. A named AMD is safest and most robust 19580// way to register. Lowercase jquery is used because AMD module names are 19581// derived from file names, and jQuery is normally delivered in a lowercase 19582// file name. Do this after creating the global so that if an AMD module wants 19583// to call noConflict to hide this version of jQuery, it will work. 19584 19585// Note that for maximum portability, libraries that are not jQuery should 19586// declare themselves as anonymous modules, and avoid setting a global if an 19587// AMD loader is present. jQuery is a special case. For more information, see 19588// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 19589 19590if ( true ) { 19591 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() { 19592 return jQuery; 19593 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 19594 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 19595} 19596 19597 19598 19599 19600var 19601 19602 // Map over jQuery in case of overwrite 19603 _jQuery = window.jQuery, 19604 19605 // Map over the $ in case of overwrite 19606 _$ = window.$; 19607 19608jQuery.noConflict = function( deep ) { 19609 if ( window.$ === jQuery ) { 19610 window.$ = _$; 19611 } 19612 19613 if ( deep && window.jQuery === jQuery ) { 19614 window.jQuery = _jQuery; 19615 } 19616 19617 return jQuery; 19618}; 19619 19620// Expose jQuery and $ identifiers, even in AMD 19621// (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557) 19622// and CommonJS for browser emulators (trac-13566) 19623if ( typeof noGlobal === "undefined" ) { 19624 window.jQuery = window.$ = jQuery; 19625} 19626 19627 19628 19629 19630return jQuery; 19631} ); 19632 19633 19634/***/ }), 19635
vendor: 544,380 bytes, lines 19636-36847
19636/***/ "./node_modules/lodash/lodash.js": 19637/*!***************************************!*\ 19638 !*** ./node_modules/lodash/lodash.js ***! 19639 \***************************************/ 19640/***/ (function(module, exports, __webpack_require__) { 19641 19642/* module decorator */ module = __webpack_require__.nmd(module); 19643var __WEBPACK_AMD_DEFINE_RESULT__;/** 19644 * @license 19645 * Lodash <https://lodash.com/> 19646 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/> 19647 * Released under MIT license <https://lodash.com/license> 19648 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 19649 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 19650 */ 19651;(function() { 19652 19653 /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 19654 var undefined; 19655 19656 /** Used as the semantic version number. */ 19657 var VERSION = '4.17.21'; 19658 19659 /** Used as the size to enable large array optimizations. */ 19660 var LARGE_ARRAY_SIZE = 200; 19661 19662 /** Error message constants. */ 19663 var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', 19664 FUNC_ERROR_TEXT = 'Expected a function', 19665 INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`'; 19666 19667 /** Used to stand-in for `undefined` hash values. */ 19668 var HASH_UNDEFINED = '__lodash_hash_undefined__'; 19669 19670 /** Used as the maximum memoize cache size. */ 19671 var MAX_MEMOIZE_SIZE = 500; 19672 19673 /** Used as the internal argument placeholder. */ 19674 var PLACEHOLDER = '__lodash_placeholder__'; 19675 19676 /** Used to compose bitmasks for cloning. */ 19677 var CLONE_DEEP_FLAG = 1, 19678 CLONE_FLAT_FLAG = 2, 19679 CLONE_SYMBOLS_FLAG = 4; 19680 19681 /** Used to compose bitmasks for value comparisons. */ 19682 var COMPARE_PARTIAL_FLAG = 1, 19683 COMPARE_UNORDERED_FLAG = 2; 19684 19685 /** Used to compose bitmasks for function metadata. */ 19686 var WRAP_BIND_FLAG = 1, 19687 WRAP_BIND_KEY_FLAG = 2, 19688 WRAP_CURRY_BOUND_FLAG = 4, 19689 WRAP_CURRY_FLAG = 8, 19690 WRAP_CURRY_RIGHT_FLAG = 16, 19691 WRAP_PARTIAL_FLAG = 32, 19692 WRAP_PARTIAL_RIGHT_FLAG = 64, 19693 WRAP_ARY_FLAG = 128, 19694 WRAP_REARG_FLAG = 256, 19695 WRAP_FLIP_FLAG = 512; 19696 19697 /** Used as default options for `_.truncate`. */ 19698 var DEFAULT_TRUNC_LENGTH = 30, 19699 DEFAULT_TRUNC_OMISSION = '...'; 19700 19701 /** Used to detect hot functions by number of calls within a span of milliseconds. */ 19702 var HOT_COUNT = 800, 19703 HOT_SPAN = 16; 19704 19705 /** Used to indicate the type of lazy iteratees. */ 19706 var LAZY_FILTER_FLAG = 1, 19707 LAZY_MAP_FLAG = 2, 19708 LAZY_WHILE_FLAG = 3; 19709 19710 /** Used as references for various `Number` constants. */ 19711 var INFINITY = 1 / 0, 19712 MAX_SAFE_INTEGER = 9007199254740991, 19713 MAX_INTEGER = 1.7976931348623157e+308, 19714 NAN = 0 / 0; 19715 19716 /** Used as references for the maximum length and index of an array. */ 19717 var MAX_ARRAY_LENGTH = 4294967295, 19718 MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, 19719 HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; 19720 19721 /** Used to associate wrap methods with their bit flags. */ 19722 var wrapFlags = [ 19723 ['ary', WRAP_ARY_FLAG], 19724 ['bind', WRAP_BIND_FLAG], 19725 ['bindKey', WRAP_BIND_KEY_FLAG], 19726 ['curry', WRAP_CURRY_FLAG], 19727 ['curryRight', WRAP_CURRY_RIGHT_FLAG], 19728 ['flip', WRAP_FLIP_FLAG], 19729 ['partial', WRAP_PARTIAL_FLAG], 19730 ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], 19731 ['rearg', WRAP_REARG_FLAG] 19732 ]; 19733 19734 /** `Object#toString` result references. */ 19735 var argsTag = '[object Arguments]', 19736 arrayTag = '[object Array]', 19737 asyncTag = '[object AsyncFunction]', 19738 boolTag = '[object Boolean]', 19739 dateTag = '[object Date]', 19740 domExcTag = '[object DOMException]', 19741 errorTag = '[object Error]', 19742 funcTag = '[object Function]', 19743 genTag = '[object GeneratorFunction]', 19744 mapTag = '[object Map]', 19745 numberTag = '[object Number]', 19746 nullTag = '[object Null]', 19747 objectTag = '[object Object]', 19748 promiseTag = '[object Promise]', 19749 proxyTag = '[object Proxy]', 19750 regexpTag = '[object RegExp]', 19751 setTag = '[object Set]', 19752 stringTag = '[object String]', 19753 symbolTag = '[object Symbol]', 19754 undefinedTag = '[object Undefined]', 19755 weakMapTag = '[object WeakMap]', 19756 weakSetTag = '[object WeakSet]'; 19757 19758 var arrayBufferTag = '[object ArrayBuffer]', 19759 dataViewTag = '[object DataView]', 19760 float32Tag = '[object Float32Array]', 19761 float64Tag = '[object Float64Array]', 19762 int8Tag = '[object Int8Array]', 19763 int16Tag = '[object Int16Array]', 19764 int32Tag = '[object Int32Array]', 19765 uint8Tag = '[object Uint8Array]', 19766 uint8ClampedTag = '[object Uint8ClampedArray]', 19767 uint16Tag = '[object Uint16Array]', 19768 uint32Tag = '[object Uint32Array]'; 19769 19770 /** Used to match empty string literals in compiled template source. */ 19771 var reEmptyStringLeading = /\b__p \+= '';/g, 19772 reEmptyStringMiddle = /\b(__p \+=) '' \+/g, 19773 reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; 19774 19775 /** Used to match HTML entities and HTML characters. */ 19776 var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, 19777 reUnescapedHtml = /[&<>"']/g, 19778 reHasEscapedHtml = RegExp(reEscapedHtml.source), 19779 reHasUnescapedHtml = RegExp(reUnescapedHtml.source); 19780 19781 /** Used to match template delimiters. */ 19782 var reEscape = /<%-([\s\S]+?)%>/g, 19783 reEvaluate = /<%([\s\S]+?)%>/g, 19784 reInterpolate = /<%=([\s\S]+?)%>/g; 19785 19786 /** Used to match property names within property paths. */ 19787 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, 19788 reIsPlainProp = /^\w*$/, 19789 rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; 19790 19791 /** 19792 * Used to match `RegExp` 19793 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). 19794 */ 19795 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, 19796 reHasRegExpChar = RegExp(reRegExpChar.source); 19797 19798 /** Used to match leading whitespace. */ 19799 var reTrimStart = /^\s+/; 19800 19801 /** Used to match a single whitespace character. */ 19802 var reWhitespace = /\s/; 19803 19804 /** Used to match wrap detail comments. */ 19805 var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, 19806 reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, 19807 reSplitDetails = /,? & /; 19808 19809 /** Used to match words composed of alphanumeric characters. */ 19810 var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; 19811 19812 /** 19813 * Used to validate the `validate` option in `_.template` variable. 19814 * 19815 * Forbids characters which could potentially change the meaning of the function argument definition: 19816 * - "()," (modification of function parameters) 19817 * - "=" (default value) 19818 * - "[]{}" (destructuring of function parameters) 19819 * - "/" (beginning of a comment) 19820 * - whitespace 19821 */ 19822 var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; 19823 19824 /** Used to match backslashes in property paths. */ 19825 var reEscapeChar = /\\(\\)?/g; 19826 19827 /** 19828 * Used to match 19829 * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). 19830 */ 19831 var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; 19832 19833 /** Used to match `RegExp` flags from their coerced string values. */ 19834 var reFlags = /\w*$/; 19835 19836 /** Used to detect bad signed hexadecimal string values. */ 19837 var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; 19838 19839 /** Used to detect binary string values. */ 19840 var reIsBinary = /^0b[01]+$/i; 19841 19842 /** Used to detect host constructors (Safari). */ 19843 var reIsHostCtor = /^\[object .+?Constructor\]$/; 19844 19845 /** Used to detect octal string values. */ 19846 var reIsOctal = /^0o[0-7]+$/i; 19847 19848 /** Used to detect unsigned integer values. */ 19849 var reIsUint = /^(?:0|[1-9]\d*)$/; 19850 19851 /** Used to match Latin Unicode letters (excluding mathematical operators). */ 19852 var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; 19853 19854 /** Used to ensure capturing order of template delimiters. */ 19855 var reNoMatch = /($^)/; 19856 19857 /** Used to match unescaped characters in compiled string literals. */ 19858 var reUnescapedString = /['\n\r\u2028\u2029\\]/g; 19859 19860 /** Used to compose unicode character classes. */ 19861 var rsAstralRange = '\\ud800-\\udfff', 19862 rsComboMarksRange = '\\u0300-\\u036f', 19863 reComboHalfMarksRange = '\\ufe20-\\ufe2f', 19864 rsComboSymbolsRange = '\\u20d0-\\u20ff', 19865 rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, 19866 rsDingbatRange = '\\u2700-\\u27bf', 19867 rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', 19868 rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', 19869 rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', 19870 rsPunctuationRange = '\\u2000-\\u206f', 19871 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', 19872 rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', 19873 rsVarRange = '\\ufe0e\\ufe0f', 19874 rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; 19875 19876 /** Used to compose unicode capture groups. */ 19877 var rsApos = "['\u2019]", 19878 rsAstral = '[' + rsAstralRange + ']', 19879 rsBreak = '[' + rsBreakRange + ']', 19880 rsCombo = '[' + rsComboRange + ']', 19881 rsDigits = '\\d+', 19882 rsDingbat = '[' + rsDingbatRange + ']', 19883 rsLower = '[' + rsLowerRange + ']', 19884 rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', 19885 rsFitz = '\\ud83c[\\udffb-\\udfff]', 19886 rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', 19887 rsNonAstral = '[^' + rsAstralRange + ']', 19888 rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', 19889 rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', 19890 rsUpper = '[' + rsUpperRange + ']', 19891 rsZWJ = '\\u200d'; 19892 19893 /** Used to compose unicode regexes. */ 19894 var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', 19895 rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', 19896 rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', 19897 rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', 19898 reOptMod = rsModifier + '?', 19899 rsOptVar = '[' + rsVarRange + ']?', 19900 rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', 19901 rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', 19902 rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', 19903 rsSeq = rsOptVar + reOptMod + rsOptJoin, 19904 rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, 19905 rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; 19906 19907 /** Used to match apostrophes. */ 19908 var reApos = RegExp(rsApos, 'g'); 19909 19910 /** 19911 * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and 19912 * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). 19913 */ 19914 var reComboMark = RegExp(rsCombo, 'g'); 19915 19916 /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ 19917 var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); 19918 19919 /** Used to match complex or compound words. */ 19920 var reUnicodeWord = RegExp([ 19921 rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', 19922 rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', 19923 rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, 19924 rsUpper + '+' + rsOptContrUpper, 19925 rsOrdUpper, 19926 rsOrdLower, 19927 rsDigits, 19928 rsEmoji 19929 ].join('|'), 'g'); 19930 19931 /** 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/). */ 19932 var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); 19933 19934 /** Used to detect strings that need a more robust regexp to match words. */ 19935 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 ]/; 19936 19937 /** Used to assign default `context` object properties. */ 19938 var contextProps = [ 19939 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', 19940 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', 19941 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', 19942 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', 19943 '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' 19944 ]; 19945 19946 /** Used to make template sourceURLs easier to identify. */ 19947 var templateCounter = -1; 19948 19949 /** Used to identify `toStringTag` values of typed arrays. */ 19950 var typedArrayTags = {}; 19951 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = 19952 typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = 19953 typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = 19954 typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = 19955 typedArrayTags[uint32Tag] = true; 19956 typedArrayTags[argsTag] = typedArrayTags[arrayTag] = 19957 typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = 19958 typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = 19959 typedArrayTags[errorTag] = typedArrayTags[funcTag] = 19960 typedArrayTags[mapTag] = typedArrayTags[numberTag] = 19961 typedArrayTags[objectTag] = typedArrayTags[regexpTag] = 19962 typedArrayTags[setTag] = typedArrayTags[stringTag] = 19963 typedArrayTags[weakMapTag] = false; 19964 19965 /** Used to identify `toStringTag` values supported by `_.clone`. */ 19966 var cloneableTags = {}; 19967 cloneableTags[argsTag] = cloneableTags[arrayTag] = 19968 cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = 19969 cloneableTags[boolTag] = cloneableTags[dateTag] = 19970 cloneableTags[float32Tag] = cloneableTags[float64Tag] = 19971 cloneableTags[int8Tag] = cloneableTags[int16Tag] = 19972 cloneableTags[int32Tag] = cloneableTags[mapTag] = 19973 cloneableTags[numberTag] = cloneableTags[objectTag] = 19974 cloneableTags[regexpTag] = cloneableTags[setTag] = 19975 cloneableTags[stringTag] = cloneableTags[symbolTag] = 19976 cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = 19977 cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; 19978 cloneableTags[errorTag] = cloneableTags[funcTag] = 19979 cloneableTags[weakMapTag] = false; 19980 19981 /** Used to map Latin Unicode letters to basic Latin letters. */ 19982 var deburredLetters = { 19983 // Latin-1 Supplement block. 19984 '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', 19985 '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', 19986 '\xc7': 'C', '\xe7': 'c', 19987 '\xd0': 'D', '\xf0': 'd', 19988 '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', 19989 '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', 19990 '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', 19991 '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', 19992 '\xd1': 'N', '\xf1': 'n', 19993 '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', 19994 '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', 19995 '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', 19996 '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', 19997 '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', 19998 '\xc6': 'Ae', '\xe6': 'ae', 19999 '\xde': 'Th', '\xfe': 'th', 20000 '\xdf': 'ss', 20001 // Latin Extended-A block. 20002 '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', 20003 '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', 20004 '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', 20005 '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', 20006 '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', 20007 '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', 20008 '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', 20009 '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', 20010 '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', 20011 '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', 20012 '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', 20013 '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', 20014 '\u0134': 'J', '\u0135': 'j', 20015 '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', 20016 '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', 20017 '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', 20018 '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', 20019 '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', 20020 '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', 20021 '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', 20022 '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', 20023 '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', 20024 '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', 20025 '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', 20026 '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', 20027 '\u0163': 't', '\u0165': 't', '\u0167': 't', 20028 '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', 20029 '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', 20030 '\u0174': 'W', '\u0175': 'w', 20031 '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', 20032 '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', 20033 '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', 20034 '\u0132': 'IJ', '\u0133': 'ij', 20035 '\u0152': 'Oe', '\u0153': 'oe', 20036 '\u0149': "'n", '\u017f': 's' 20037 }; 20038 20039 /** Used to map characters to HTML entities. */ 20040 var htmlEscapes = { 20041 '&': '&', 20042 '<': '<', 20043 '>': '>', 20044 '"': '"', 20045 "'": ''' 20046 }; 20047 20048 /** Used to map HTML entities to characters. */ 20049 var htmlUnescapes = { 20050 '&': '&', 20051 '<': '<', 20052 '>': '>', 20053 '"': '"', 20054 ''': "'" 20055 }; 20056 20057 /** Used to escape characters for inclusion in compiled string literals. */ 20058 var stringEscapes = { 20059 '\\': '\\', 20060 "'": "'", 20061 '\n': 'n', 20062 '\r': 'r', 20063 '\u2028': 'u2028', 20064 '\u2029': 'u2029' 20065 }; 20066 20067 /** Built-in method references without a dependency on `root`. */ 20068 var freeParseFloat = parseFloat, 20069 freeParseInt = parseInt; 20070 20071 /** Detect free variable `global` from Node.js. */ 20072 var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g; 20073 20074 /** Detect free variable `self`. */ 20075 var freeSelf = typeof self == 'object' && self && self.Object === Object && self; 20076 20077 /** Used as a reference to the global object. */ 20078 var root = freeGlobal || freeSelf || Function('return this')(); 20079 20080 /** Detect free variable `exports`. */ 20081 var freeExports = true && exports && !exports.nodeType && exports; 20082 20083 /** Detect free variable `module`. */ 20084 var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module; 20085 20086 /** Detect the popular CommonJS extension `module.exports`. */ 20087 var moduleExports = freeModule && freeModule.exports === freeExports; 20088 20089 /** Detect free variable `process` from Node.js. */ 20090 var freeProcess = moduleExports && freeGlobal.process; 20091 20092 /** Used to access faster Node.js helpers. */ 20093 var nodeUtil = (function() { 20094 try { 20095 // Use `util.types` for Node.js 10+. 20096 var types = freeModule && freeModule.require && freeModule.require('util').types; 20097 20098 if (types) { 20099 return types; 20100 } 20101 20102 // Legacy `process.binding('util')` for Node.js < 10. 20103 return freeProcess && freeProcess.binding && freeProcess.binding('util'); 20104 } catch (e) {} 20105 }()); 20106 20107 /* Node.js helper references. */ 20108 var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, 20109 nodeIsDate = nodeUtil && nodeUtil.isDate, 20110 nodeIsMap = nodeUtil && nodeUtil.isMap, 20111 nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, 20112 nodeIsSet = nodeUtil && nodeUtil.isSet, 20113 nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; 20114 20115 /*--------------------------------------------------------------------------*/ 20116 20117 /** 20118 * A faster alternative to `Function#apply`, this function invokes `func` 20119 * with the `this` binding of `thisArg` and the arguments of `args`. 20120 * 20121 * @private 20122 * @param {Function} func The function to invoke. 20123 * @param {*} thisArg The `this` binding of `func`. 20124 * @param {Array} args The arguments to invoke `func` with. 20125 * @returns {*} Returns the result of `func`. 20126 */ 20127 function apply(func, thisArg, args) { 20128 switch (args.length) { 20129 case 0: return func.call(thisArg); 20130 case 1: return func.call(thisArg, args[0]); 20131 case 2: return func.call(thisArg, args[0], args[1]); 20132 case 3: return func.call(thisArg, args[0], args[1], args[2]); 20133 } 20134 return func.apply(thisArg, args); 20135 } 20136 20137 /** 20138 * A specialized version of `baseAggregator` for arrays. 20139 * 20140 * @private 20141 * @param {Array} [array] The array to iterate over. 20142 * @param {Function} setter The function to set `accumulator` values. 20143 * @param {Function} iteratee The iteratee to transform keys. 20144 * @param {Object} accumulator The initial aggregated object. 20145 * @returns {Function} Returns `accumulator`. 20146 */ 20147 function arrayAggregator(array, setter, iteratee, accumulator) { 20148 var index = -1, 20149 length = array == null ? 0 : array.length; 20150 20151 while (++index < length) { 20152 var value = array[index]; 20153 setter(accumulator, value, iteratee(value), array); 20154 } 20155 return accumulator; 20156 } 20157 20158 /** 20159 * A specialized version of `_.forEach` for arrays without support for 20160 * iteratee shorthands. 20161 * 20162 * @private 20163 * @param {Array} [array] The array to iterate over. 20164 * @param {Function} iteratee The function invoked per iteration. 20165 * @returns {Array} Returns `array`. 20166 */ 20167 function arrayEach(array, iteratee) { 20168 var index = -1, 20169 length = array == null ? 0 : array.length; 20170 20171 while (++index < length) { 20172 if (iteratee(array[index], index, array) === false) { 20173 break; 20174 } 20175 } 20176 return array; 20177 } 20178 20179 /** 20180 * A specialized version of `_.forEachRight` for arrays without support for 20181 * iteratee shorthands. 20182 * 20183 * @private 20184 * @param {Array} [array] The array to iterate over. 20185 * @param {Function} iteratee The function invoked per iteration. 20186 * @returns {Array} Returns `array`. 20187 */ 20188 function arrayEachRight(array, iteratee) { 20189 var length = array == null ? 0 : array.length; 20190 20191 while (length--) { 20192 if (iteratee(array[length], length, array) === false) { 20193 break; 20194 } 20195 } 20196 return array; 20197 } 20198 20199 /** 20200 * A specialized version of `_.every` for arrays without support for 20201 * iteratee shorthands. 20202 * 20203 * @private 20204 * @param {Array} [array] The array to iterate over. 20205 * @param {Function} predicate The function invoked per iteration. 20206 * @returns {boolean} Returns `true` if all elements pass the predicate check, 20207 * else `false`. 20208 */ 20209 function arrayEvery(array, predicate) { 20210 var index = -1, 20211 length = array == null ? 0 : array.length; 20212 20213 while (++index < length) { 20214 if (!predicate(array[index], index, array)) { 20215 return false; 20216 } 20217 } 20218 return true; 20219 } 20220 20221 /** 20222 * A specialized version of `_.filter` for arrays without support for 20223 * iteratee shorthands. 20224 * 20225 * @private 20226 * @param {Array} [array] The array to iterate over. 20227 * @param {Function} predicate The function invoked per iteration. 20228 * @returns {Array} Returns the new filtered array. 20229 */ 20230 function arrayFilter(array, predicate) { 20231 var index = -1, 20232 length = array == null ? 0 : array.length, 20233 resIndex = 0, 20234 result = []; 20235 20236 while (++index < length) { 20237 var value = array[index]; 20238 if (predicate(value, index, array)) { 20239 result[resIndex++] = value; 20240 } 20241 } 20242 return result; 20243 } 20244 20245 /** 20246 * A specialized version of `_.includes` for arrays without support for 20247 * specifying an index to search from. 20248 * 20249 * @private 20250 * @param {Array} [array] The array to inspect. 20251 * @param {*} target The value to search for. 20252 * @returns {boolean} Returns `true` if `target` is found, else `false`. 20253 */ 20254 function arrayIncludes(array, value) { 20255 var length = array == null ? 0 : array.length; 20256 return !!length && baseIndexOf(array, value, 0) > -1; 20257 } 20258 20259 /** 20260 * This function is like `arrayIncludes` except that it accepts a comparator. 20261 * 20262 * @private 20263 * @param {Array} [array] The array to inspect. 20264 * @param {*} target The value to search for. 20265 * @param {Function} comparator The comparator invoked per element. 20266 * @returns {boolean} Returns `true` if `target` is found, else `false`. 20267 */ 20268 function arrayIncludesWith(array, value, comparator) { 20269 var index = -1, 20270 length = array == null ? 0 : array.length; 20271 20272 while (++index < length) { 20273 if (comparator(value, array[index])) { 20274 return true; 20275 } 20276 } 20277 return false; 20278 } 20279 20280 /** 20281 * A specialized version of `_.map` for arrays without support for iteratee 20282 * shorthands. 20283 * 20284 * @private 20285 * @param {Array} [array] The array to iterate over. 20286 * @param {Function} iteratee The function invoked per iteration. 20287 * @returns {Array} Returns the new mapped array. 20288 */ 20289 function arrayMap(array, iteratee) { 20290 var index = -1, 20291 length = array == null ? 0 : array.length, 20292 result = Array(length); 20293 20294 while (++index < length) { 20295 result[index] = iteratee(array[index], index, array); 20296 } 20297 return result; 20298 } 20299 20300 /** 20301 * Appends the elements of `values` to `array`. 20302 * 20303 * @private 20304 * @param {Array} array The array to modify. 20305 * @param {Array} values The values to append. 20306 * @returns {Array} Returns `array`. 20307 */ 20308 function arrayPush(array, values) { 20309 var index = -1, 20310 length = values.length, 20311 offset = array.length; 20312 20313 while (++index < length) { 20314 array[offset + index] = values[index]; 20315 } 20316 return array; 20317 } 20318 20319 /** 20320 * A specialized version of `_.reduce` for arrays without support for 20321 * iteratee shorthands. 20322 * 20323 * @private 20324 * @param {Array} [array] The array to iterate over. 20325 * @param {Function} iteratee The function invoked per iteration. 20326 * @param {*} [accumulator] The initial value. 20327 * @param {boolean} [initAccum] Specify using the first element of `array` as 20328 * the initial value. 20329 * @returns {*} Returns the accumulated value. 20330 */ 20331 function arrayReduce(array, iteratee, accumulator, initAccum) { 20332 var index = -1, 20333 length = array == null ? 0 : array.length; 20334 20335 if (initAccum && length) { 20336 accumulator = array[++index]; 20337 } 20338 while (++index < length) { 20339 accumulator = iteratee(accumulator, array[index], index, array); 20340 } 20341 return accumulator; 20342 } 20343 20344 /** 20345 * A specialized version of `_.reduceRight` for arrays without support for 20346 * iteratee shorthands. 20347 * 20348 * @private 20349 * @param {Array} [array] The array to iterate over. 20350 * @param {Function} iteratee The function invoked per iteration. 20351 * @param {*} [accumulator] The initial value. 20352 * @param {boolean} [initAccum] Specify using the last element of `array` as 20353 * the initial value. 20354 * @returns {*} Returns the accumulated value. 20355 */ 20356 function arrayReduceRight(array, iteratee, accumulator, initAccum) { 20357 var length = array == null ? 0 : array.length; 20358 if (initAccum && length) { 20359 accumulator = array[--length]; 20360 } 20361 while (length--) { 20362 accumulator = iteratee(accumulator, array[length], length, array); 20363 } 20364 return accumulator; 20365 } 20366 20367 /** 20368 * A specialized version of `_.some` for arrays without support for iteratee 20369 * shorthands. 20370 * 20371 * @private 20372 * @param {Array} [array] The array to iterate over. 20373 * @param {Function} predicate The function invoked per iteration. 20374 * @returns {boolean} Returns `true` if any element passes the predicate check, 20375 * else `false`. 20376 */ 20377 function arraySome(array, predicate) { 20378 var index = -1, 20379 length = array == null ? 0 : array.length; 20380 20381 while (++index < length) { 20382 if (predicate(array[index], index, array)) { 20383 return true; 20384 } 20385 } 20386 return false; 20387 } 20388 20389 /** 20390 * Gets the size of an ASCII `string`. 20391 * 20392 * @private 20393 * @param {string} string The string inspect. 20394 * @returns {number} Returns the string size. 20395 */ 20396 var asciiSize = baseProperty('length'); 20397 20398 /** 20399 * Converts an ASCII `string` to an array. 20400 * 20401 * @private 20402 * @param {string} string The string to convert. 20403 * @returns {Array} Returns the converted array. 20404 */ 20405 function asciiToArray(string) { 20406 return string.split(''); 20407 } 20408 20409 /** 20410 * Splits an ASCII `string` into an array of its words. 20411 * 20412 * @private 20413 * @param {string} The string to inspect. 20414 * @returns {Array} Returns the words of `string`. 20415 */ 20416 function asciiWords(string) { 20417 return string.match(reAsciiWord) || []; 20418 } 20419 20420 /** 20421 * The base implementation of methods like `_.findKey` and `_.findLastKey`, 20422 * without support for iteratee shorthands, which iterates over `collection` 20423 * using `eachFunc`. 20424 * 20425 * @private 20426 * @param {Array|Object} collection The collection to inspect. 20427 * @param {Function} predicate The function invoked per iteration. 20428 * @param {Function} eachFunc The function to iterate over `collection`. 20429 * @returns {*} Returns the found element or its key, else `undefined`. 20430 */ 20431 function baseFindKey(collection, predicate, eachFunc) { 20432 var result; 20433 eachFunc(collection, function(value, key, collection) { 20434 if (predicate(value, key, collection)) { 20435 result = key; 20436 return false; 20437 } 20438 }); 20439 return result; 20440 } 20441 20442 /** 20443 * The base implementation of `_.findIndex` and `_.findLastIndex` without 20444 * support for iteratee shorthands. 20445 * 20446 * @private 20447 * @param {Array} array The array to inspect. 20448 * @param {Function} predicate The function invoked per iteration. 20449 * @param {number} fromIndex The index to search from. 20450 * @param {boolean} [fromRight] Specify iterating from right to left. 20451 * @returns {number} Returns the index of the matched value, else `-1`. 20452 */ 20453 function baseFindIndex(array, predicate, fromIndex, fromRight) { 20454 var length = array.length, 20455 index = fromIndex + (fromRight ? 1 : -1); 20456 20457 while ((fromRight ? index-- : ++index < length)) { 20458 if (predicate(array[index], index, array)) { 20459 return index; 20460 } 20461 } 20462 return -1; 20463 } 20464 20465 /** 20466 * The base implementation of `_.indexOf` without `fromIndex` bounds checks. 20467 * 20468 * @private 20469 * @param {Array} array The array to inspect. 20470 * @param {*} value The value to search for. 20471 * @param {number} fromIndex The index to search from. 20472 * @returns {number} Returns the index of the matched value, else `-1`. 20473 */ 20474 function baseIndexOf(array, value, fromIndex) { 20475 return value === value 20476 ? strictIndexOf(array, value, fromIndex) 20477 : baseFindIndex(array, baseIsNaN, fromIndex); 20478 } 20479 20480 /** 20481 * This function is like `baseIndexOf` except that it accepts a comparator. 20482 * 20483 * @private 20484 * @param {Array} array The array to inspect. 20485 * @param {*} value The value to search for. 20486 * @param {number} fromIndex The index to search from. 20487 * @param {Function} comparator The comparator invoked per element. 20488 * @returns {number} Returns the index of the matched value, else `-1`. 20489 */ 20490 function baseIndexOfWith(array, value, fromIndex, comparator) { 20491 var index = fromIndex - 1, 20492 length = array.length; 20493 20494 while (++index < length) { 20495 if (comparator(array[index], value)) { 20496 return index; 20497 } 20498 } 20499 return -1; 20500 } 20501 20502 /** 20503 * The base implementation of `_.isNaN` without support for number objects. 20504 * 20505 * @private 20506 * @param {*} value The value to check. 20507 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. 20508 */ 20509 function baseIsNaN(value) { 20510 return value !== value; 20511 } 20512 20513 /** 20514 * The base implementation of `_.mean` and `_.meanBy` without support for 20515 * iteratee shorthands. 20516 * 20517 * @private 20518 * @param {Array} array The array to iterate over. 20519 * @param {Function} iteratee The function invoked per iteration. 20520 * @returns {number} Returns the mean. 20521 */ 20522 function baseMean(array, iteratee) { 20523 var length = array == null ? 0 : array.length; 20524 return length ? (baseSum(array, iteratee) / length) : NAN; 20525 } 20526 20527 /** 20528 * The base implementation of `_.property` without support for deep paths. 20529 * 20530 * @private 20531 * @param {string} key The key of the property to get. 20532 * @returns {Function} Returns the new accessor function. 20533 */ 20534 function baseProperty(key) { 20535 return function(object) { 20536 return object == null ? undefined : object[key]; 20537 }; 20538 } 20539 20540 /** 20541 * The base implementation of `_.propertyOf` without support for deep paths. 20542 * 20543 * @private 20544 * @param {Object} object The object to query. 20545 * @returns {Function} Returns the new accessor function. 20546 */ 20547 function basePropertyOf(object) { 20548 return function(key) { 20549 return object == null ? undefined : object[key]; 20550 }; 20551 } 20552 20553 /** 20554 * The base implementation of `_.reduce` and `_.reduceRight`, without support 20555 * for iteratee shorthands, which iterates over `collection` using `eachFunc`. 20556 * 20557 * @private 20558 * @param {Array|Object} collection The collection to iterate over. 20559 * @param {Function} iteratee The function invoked per iteration. 20560 * @param {*} accumulator The initial value. 20561 * @param {boolean} initAccum Specify using the first or last element of 20562 * `collection` as the initial value. 20563 * @param {Function} eachFunc The function to iterate over `collection`. 20564 * @returns {*} Returns the accumulated value. 20565 */ 20566 function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { 20567 eachFunc(collection, function(value, index, collection) { 20568 accumulator = initAccum 20569 ? (initAccum = false, value) 20570 : iteratee(accumulator, value, index, collection); 20571 }); 20572 return accumulator; 20573 } 20574 20575 /** 20576 * The base implementation of `_.sortBy` which uses `comparer` to define the 20577 * sort order of `array` and replaces criteria objects with their corresponding 20578 * values. 20579 * 20580 * @private 20581 * @param {Array} array The array to sort. 20582 * @param {Function} comparer The function to define sort order. 20583 * @returns {Array} Returns `array`. 20584 */ 20585 function baseSortBy(array, comparer) { 20586 var length = array.length; 20587 20588 array.sort(comparer); 20589 while (length--) { 20590 array[length] = array[length].value; 20591 } 20592 return array; 20593 } 20594 20595 /** 20596 * The base implementation of `_.sum` and `_.sumBy` without support for 20597 * iteratee shorthands. 20598 * 20599 * @private 20600 * @param {Array} array The array to iterate over. 20601 * @param {Function} iteratee The function invoked per iteration. 20602 * @returns {number} Returns the sum. 20603 */ 20604 function baseSum(array, iteratee) { 20605 var result, 20606 index = -1, 20607 length = array.length; 20608 20609 while (++index < length) { 20610 var current = iteratee(array[index]); 20611 if (current !== undefined) { 20612 result = result === undefined ? current : (result + current); 20613 } 20614 } 20615 return result; 20616 } 20617 20618 /** 20619 * The base implementation of `_.times` without support for iteratee shorthands 20620 * or max array length checks. 20621 * 20622 * @private 20623 * @param {number} n The number of times to invoke `iteratee`. 20624 * @param {Function} iteratee The function invoked per iteration. 20625 * @returns {Array} Returns the array of results. 20626 */ 20627 function baseTimes(n, iteratee) { 20628 var index = -1, 20629 result = Array(n); 20630 20631 while (++index < n) { 20632 result[index] = iteratee(index); 20633 } 20634 return result; 20635 } 20636 20637 /** 20638 * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array 20639 * of key-value pairs for `object` corresponding to the property names of `props`. 20640 * 20641 * @private 20642 * @param {Object} object The object to query. 20643 * @param {Array} props The property names to get values for. 20644 * @returns {Object} Returns the key-value pairs. 20645 */ 20646 function baseToPairs(object, props) { 20647 return arrayMap(props, function(key) { 20648 return [key, object[key]]; 20649 }); 20650 } 20651 20652 /** 20653 * The base implementation of `_.trim`. 20654 * 20655 * @private 20656 * @param {string} string The string to trim. 20657 * @returns {string} Returns the trimmed string. 20658 */ 20659 function baseTrim(string) { 20660 return string 20661 ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') 20662 : string; 20663 } 20664 20665 /** 20666 * The base implementation of `_.unary` without support for storing metadata. 20667 * 20668 * @private 20669 * @param {Function} func The function to cap arguments for. 20670 * @returns {Function} Returns the new capped function. 20671 */ 20672 function baseUnary(func) { 20673 return function(value) { 20674 return func(value); 20675 }; 20676 } 20677 20678 /** 20679 * The base implementation of `_.values` and `_.valuesIn` which creates an 20680 * array of `object` property values corresponding to the property names 20681 * of `props`. 20682 * 20683 * @private 20684 * @param {Object} object The object to query. 20685 * @param {Array} props The property names to get values for. 20686 * @returns {Object} Returns the array of property values. 20687 */ 20688 function baseValues(object, props) { 20689 return arrayMap(props, function(key) { 20690 return object[key]; 20691 }); 20692 } 20693 20694 /** 20695 * Checks if a `cache` value for `key` exists. 20696 * 20697 * @private 20698 * @param {Object} cache The cache to query. 20699 * @param {string} key The key of the entry to check. 20700 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 20701 */ 20702 function cacheHas(cache, key) { 20703 return cache.has(key); 20704 } 20705 20706 /** 20707 * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol 20708 * that is not found in the character symbols. 20709 * 20710 * @private 20711 * @param {Array} strSymbols The string symbols to inspect. 20712 * @param {Array} chrSymbols The character symbols to find. 20713 * @returns {number} Returns the index of the first unmatched string symbol. 20714 */ 20715 function charsStartIndex(strSymbols, chrSymbols) { 20716 var index = -1, 20717 length = strSymbols.length; 20718 20719 while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} 20720 return index; 20721 } 20722 20723 /** 20724 * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol 20725 * that is not found in the character symbols. 20726 * 20727 * @private 20728 * @param {Array} strSymbols The string symbols to inspect. 20729 * @param {Array} chrSymbols The character symbols to find. 20730 * @returns {number} Returns the index of the last unmatched string symbol. 20731 */ 20732 function charsEndIndex(strSymbols, chrSymbols) { 20733 var index = strSymbols.length; 20734 20735 while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} 20736 return index; 20737 } 20738 20739 /** 20740 * Gets the number of `placeholder` occurrences in `array`. 20741 * 20742 * @private 20743 * @param {Array} array The array to inspect. 20744 * @param {*} placeholder The placeholder to search for. 20745 * @returns {number} Returns the placeholder count. 20746 */ 20747 function countHolders(array, placeholder) { 20748 var length = array.length, 20749 result = 0; 20750 20751 while (length--) { 20752 if (array[length] === placeholder) { 20753 ++result; 20754 } 20755 } 20756 return result; 20757 } 20758 20759 /** 20760 * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A 20761 * letters to basic Latin letters. 20762 * 20763 * @private 20764 * @param {string} letter The matched letter to deburr. 20765 * @returns {string} Returns the deburred letter. 20766 */ 20767 var deburrLetter = basePropertyOf(deburredLetters); 20768 20769 /** 20770 * Used by `_.escape` to convert characters to HTML entities. 20771 * 20772 * @private 20773 * @param {string} chr The matched character to escape. 20774 * @returns {string} Returns the escaped character. 20775 */ 20776 var escapeHtmlChar = basePropertyOf(htmlEscapes); 20777 20778 /** 20779 * Used by `_.template` to escape characters for inclusion in compiled string literals. 20780 * 20781 * @private 20782 * @param {string} chr The matched character to escape. 20783 * @returns {string} Returns the escaped character. 20784 */ 20785 function escapeStringChar(chr) { 20786 return '\\' + stringEscapes[chr]; 20787 } 20788 20789 /** 20790 * Gets the value at `key` of `object`. 20791 * 20792 * @private 20793 * @param {Object} [object] The object to query. 20794 * @param {string} key The key of the property to get. 20795 * @returns {*} Returns the property value. 20796 */ 20797 function getValue(object, key) { 20798 return object == null ? undefined : object[key]; 20799 } 20800 20801 /** 20802 * Checks if `string` contains Unicode symbols. 20803 * 20804 * @private 20805 * @param {string} string The string to inspect. 20806 * @returns {boolean} Returns `true` if a symbol is found, else `false`. 20807 */ 20808 function hasUnicode(string) { 20809 return reHasUnicode.test(string); 20810 } 20811 20812 /** 20813 * Checks if `string` contains a word composed of Unicode symbols. 20814 * 20815 * @private 20816 * @param {string} string The string to inspect. 20817 * @returns {boolean} Returns `true` if a word is found, else `false`. 20818 */ 20819 function hasUnicodeWord(string) { 20820 return reHasUnicodeWord.test(string); 20821 } 20822 20823 /** 20824 * Converts `iterator` to an array. 20825 * 20826 * @private 20827 * @param {Object} iterator The iterator to convert. 20828 * @returns {Array} Returns the converted array. 20829 */ 20830 function iteratorToArray(iterator) { 20831 var data, 20832 result = []; 20833 20834 while (!(data = iterator.next()).done) { 20835 result.push(data.value); 20836 } 20837 return result; 20838 } 20839 20840 /** 20841 * Converts `map` to its key-value pairs. 20842 * 20843 * @private 20844 * @param {Object} map The map to convert. 20845 * @returns {Array} Returns the key-value pairs. 20846 */ 20847 function mapToArray(map) { 20848 var index = -1, 20849 result = Array(map.size); 20850 20851 map.forEach(function(value, key) { 20852 result[++index] = [key, value]; 20853 }); 20854 return result; 20855 } 20856 20857 /** 20858 * Creates a unary function that invokes `func` with its argument transformed. 20859 * 20860 * @private 20861 * @param {Function} func The function to wrap. 20862 * @param {Function} transform The argument transform. 20863 * @returns {Function} Returns the new function. 20864 */ 20865 function overArg(func, transform) { 20866 return function(arg) { 20867 return func(transform(arg)); 20868 }; 20869 } 20870 20871 /** 20872 * Replaces all `placeholder` elements in `array` with an internal placeholder 20873 * and returns an array of their indexes. 20874 * 20875 * @private 20876 * @param {Array} array The array to modify. 20877 * @param {*} placeholder The placeholder to replace. 20878 * @returns {Array} Returns the new array of placeholder indexes. 20879 */ 20880 function replaceHolders(array, placeholder) { 20881 var index = -1, 20882 length = array.length, 20883 resIndex = 0, 20884 result = []; 20885 20886 while (++index < length) { 20887 var value = array[index]; 20888 if (value === placeholder || value === PLACEHOLDER) { 20889 array[index] = PLACEHOLDER; 20890 result[resIndex++] = index; 20891 } 20892 } 20893 return result; 20894 } 20895 20896 /** 20897 * Converts `set` to an array of its values. 20898 * 20899 * @private 20900 * @param {Object} set The set to convert. 20901 * @returns {Array} Returns the values. 20902 */ 20903 function setToArray(set) { 20904 var index = -1, 20905 result = Array(set.size); 20906 20907 set.forEach(function(value) { 20908 result[++index] = value; 20909 }); 20910 return result; 20911 } 20912 20913 /** 20914 * Converts `set` to its value-value pairs. 20915 * 20916 * @private 20917 * @param {Object} set The set to convert. 20918 * @returns {Array} Returns the value-value pairs. 20919 */ 20920 function setToPairs(set) { 20921 var index = -1, 20922 result = Array(set.size); 20923 20924 set.forEach(function(value) { 20925 result[++index] = [value, value]; 20926 }); 20927 return result; 20928 } 20929 20930 /** 20931 * A specialized version of `_.indexOf` which performs strict equality 20932 * comparisons of values, i.e. `===`. 20933 * 20934 * @private 20935 * @param {Array} array The array to inspect. 20936 * @param {*} value The value to search for. 20937 * @param {number} fromIndex The index to search from. 20938 * @returns {number} Returns the index of the matched value, else `-1`. 20939 */ 20940 function strictIndexOf(array, value, fromIndex) { 20941 var index = fromIndex - 1, 20942 length = array.length; 20943 20944 while (++index < length) { 20945 if (array[index] === value) { 20946 return index; 20947 } 20948 } 20949 return -1; 20950 } 20951 20952 /** 20953 * A specialized version of `_.lastIndexOf` which performs strict equality 20954 * comparisons of values, i.e. `===`. 20955 * 20956 * @private 20957 * @param {Array} array The array to inspect. 20958 * @param {*} value The value to search for. 20959 * @param {number} fromIndex The index to search from. 20960 * @returns {number} Returns the index of the matched value, else `-1`. 20961 */ 20962 function strictLastIndexOf(array, value, fromIndex) { 20963 var index = fromIndex + 1; 20964 while (index--) { 20965 if (array[index] === value) { 20966 return index; 20967 } 20968 } 20969 return index; 20970 } 20971 20972 /** 20973 * Gets the number of symbols in `string`. 20974 * 20975 * @private 20976 * @param {string} string The string to inspect. 20977 * @returns {number} Returns the string size. 20978 */ 20979 function stringSize(string) { 20980 return hasUnicode(string) 20981 ? unicodeSize(string) 20982 : asciiSize(string); 20983 } 20984 20985 /** 20986 * Converts `string` to an array. 20987 * 20988 * @private 20989 * @param {string} string The string to convert. 20990 * @returns {Array} Returns the converted array. 20991 */ 20992 function stringToArray(string) { 20993 return hasUnicode(string) 20994 ? unicodeToArray(string) 20995 : asciiToArray(string); 20996 } 20997 20998 /** 20999 * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace 21000 * character of `string`. 21001 * 21002 * @private 21003 * @param {string} string The string to inspect. 21004 * @returns {number} Returns the index of the last non-whitespace character. 21005 */ 21006 function trimmedEndIndex(string) { 21007 var index = string.length; 21008 21009 while (index-- && reWhitespace.test(string.charAt(index))) {} 21010 return index; 21011 } 21012 21013 /** 21014 * Used by `_.unescape` to convert HTML entities to characters. 21015 * 21016 * @private 21017 * @param {string} chr The matched character to unescape. 21018 * @returns {string} Returns the unescaped character. 21019 */ 21020 var unescapeHtmlChar = basePropertyOf(htmlUnescapes); 21021 21022 /** 21023 * Gets the size of a Unicode `string`. 21024 * 21025 * @private 21026 * @param {string} string The string inspect. 21027 * @returns {number} Returns the string size. 21028 */ 21029 function unicodeSize(string) { 21030 var result = reUnicode.lastIndex = 0; 21031 while (reUnicode.test(string)) { 21032 ++result; 21033 } 21034 return result; 21035 } 21036 21037 /** 21038 * Converts a Unicode `string` to an array. 21039 * 21040 * @private 21041 * @param {string} string The string to convert. 21042 * @returns {Array} Returns the converted array. 21043 */ 21044 function unicodeToArray(string) { 21045 return string.match(reUnicode) || []; 21046 } 21047 21048 /** 21049 * Splits a Unicode `string` into an array of its words. 21050 * 21051 * @private 21052 * @param {string} The string to inspect. 21053 * @returns {Array} Returns the words of `string`. 21054 */ 21055 function unicodeWords(string) { 21056 return string.match(reUnicodeWord) || []; 21057 } 21058 21059 /*--------------------------------------------------------------------------*/ 21060 21061 /** 21062 * Create a new pristine `lodash` function using the `context` object. 21063 * 21064 * @static 21065 * @memberOf _ 21066 * @since 1.1.0 21067 * @category Util 21068 * @param {Object} [context=root] The context object. 21069 * @returns {Function} Returns a new `lodash` function. 21070 * @example 21071 * 21072 * _.mixin({ 'foo': _.constant('foo') }); 21073 * 21074 * var lodash = _.runInContext(); 21075 * lodash.mixin({ 'bar': lodash.constant('bar') }); 21076 * 21077 * _.isFunction(_.foo); 21078 * // => true 21079 * _.isFunction(_.bar); 21080 * // => false 21081 * 21082 * lodash.isFunction(lodash.foo); 21083 * // => false 21084 * lodash.isFunction(lodash.bar); 21085 * // => true 21086 * 21087 * // Create a suped-up `defer` in Node.js. 21088 * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; 21089 */ 21090 var runInContext = (function runInContext(context) { 21091 context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); 21092 21093 /** Built-in constructor references. */ 21094 var Array = context.Array, 21095 Date = context.Date, 21096 Error = context.Error, 21097 Function = context.Function, 21098 Math = context.Math, 21099 Object = context.Object, 21100 RegExp = context.RegExp, 21101 String = context.String, 21102 TypeError = context.TypeError; 21103 21104 /** Used for built-in method references. */ 21105 var arrayProto = Array.prototype, 21106 funcProto = Function.prototype, 21107 objectProto = Object.prototype; 21108 21109 /** Used to detect overreaching core-js shims. */ 21110 var coreJsData = context['__core-js_shared__']; 21111 21112 /** Used to resolve the decompiled source of functions. */ 21113 var funcToString = funcProto.toString; 21114 21115 /** Used to check objects for own properties. */ 21116 var hasOwnProperty = objectProto.hasOwnProperty; 21117 21118 /** Used to generate unique IDs. */ 21119 var idCounter = 0; 21120 21121 /** Used to detect methods masquerading as native. */ 21122 var maskSrcKey = (function() { 21123 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); 21124 return uid ? ('Symbol(src)_1.' + uid) : ''; 21125 }()); 21126 21127 /** 21128 * Used to resolve the 21129 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) 21130 * of values. 21131 */ 21132 var nativeObjectToString = objectProto.toString; 21133 21134 /** Used to infer the `Object` constructor. */ 21135 var objectCtorString = funcToString.call(Object); 21136 21137 /** Used to restore the original `_` reference in `_.noConflict`. */ 21138 var oldDash = root._; 21139 21140 /** Used to detect if a method is native. */ 21141 var reIsNative = RegExp('^' + 21142 funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') 21143 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' 21144 ); 21145 21146 /** Built-in value references. */ 21147 var Buffer = moduleExports ? context.Buffer : undefined, 21148 Symbol = context.Symbol, 21149 Uint8Array = context.Uint8Array, 21150 allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined, 21151 getPrototype = overArg(Object.getPrototypeOf, Object), 21152 objectCreate = Object.create, 21153 propertyIsEnumerable = objectProto.propertyIsEnumerable, 21154 splice = arrayProto.splice, 21155 spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined, 21156 symIterator = Symbol ? Symbol.iterator : undefined, 21157 symToStringTag = Symbol ? Symbol.toStringTag : undefined; 21158 21159 var defineProperty = (function() { 21160 try { 21161 var func = getNative(Object, 'defineProperty'); 21162 func({}, '', {}); 21163 return func; 21164 } catch (e) {} 21165 }()); 21166 21167 /** Mocked built-ins. */ 21168 var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, 21169 ctxNow = Date && Date.now !== root.Date.now && Date.now, 21170 ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; 21171 21172 /* Built-in method references for those with the same name as other `lodash` methods. */ 21173 var nativeCeil = Math.ceil, 21174 nativeFloor = Math.floor, 21175 nativeGetSymbols = Object.getOwnPropertySymbols, 21176 nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, 21177 nativeIsFinite = context.isFinite, 21178 nativeJoin = arrayProto.join, 21179 nativeKeys = overArg(Object.keys, Object), 21180 nativeMax = Math.max, 21181 nativeMin = Math.min, 21182 nativeNow = Date.now, 21183 nativeParseInt = context.parseInt, 21184 nativeRandom = Math.random, 21185 nativeReverse = arrayProto.reverse; 21186 21187 /* Built-in method references that are verified to be native. */ 21188 var DataView = getNative(context, 'DataView'), 21189 Map = getNative(context, 'Map'), 21190 Promise = getNative(context, 'Promise'), 21191 Set = getNative(context, 'Set'), 21192 WeakMap = getNative(context, 'WeakMap'), 21193 nativeCreate = getNative(Object, 'create'); 21194 21195 /** Used to store function metadata. */ 21196 var metaMap = WeakMap && new WeakMap; 21197 21198 /** Used to lookup unminified function names. */ 21199 var realNames = {}; 21200 21201 /** Used to detect maps, sets, and weakmaps. */ 21202 var dataViewCtorString = toSource(DataView), 21203 mapCtorString = toSource(Map), 21204 promiseCtorString = toSource(Promise), 21205 setCtorString = toSource(Set), 21206 weakMapCtorString = toSource(WeakMap); 21207 21208 /** Used to convert symbols to primitives and strings. */ 21209 var symbolProto = Symbol ? Symbol.prototype : undefined, 21210 symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, 21211 symbolToString = symbolProto ? symbolProto.toString : undefined; 21212 21213 /*------------------------------------------------------------------------*/ 21214 21215 /** 21216 * Creates a `lodash` object which wraps `value` to enable implicit method 21217 * chain sequences. Methods that operate on and return arrays, collections, 21218 * and functions can be chained together. Methods that retrieve a single value 21219 * or may return a primitive value will automatically end the chain sequence 21220 * and return the unwrapped value. Otherwise, the value must be unwrapped 21221 * with `_#value`. 21222 * 21223 * Explicit chain sequences, which must be unwrapped with `_#value`, may be 21224 * enabled using `_.chain`. 21225 * 21226 * The execution of chained methods is lazy, that is, it's deferred until 21227 * `_#value` is implicitly or explicitly called. 21228 * 21229 * Lazy evaluation allows several methods to support shortcut fusion. 21230 * Shortcut fusion is an optimization to merge iteratee calls; this avoids 21231 * the creation of intermediate arrays and can greatly reduce the number of 21232 * iteratee executions. Sections of a chain sequence qualify for shortcut 21233 * fusion if the section is applied to an array and iteratees accept only 21234 * one argument. The heuristic for whether a section qualifies for shortcut 21235 * fusion is subject to change. 21236 * 21237 * Chaining is supported in custom builds as long as the `_#value` method is 21238 * directly or indirectly included in the build. 21239 * 21240 * In addition to lodash methods, wrappers have `Array` and `String` methods. 21241 * 21242 * The wrapper `Array` methods are: 21243 * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` 21244 * 21245 * The wrapper `String` methods are: 21246 * `replace` and `split` 21247 * 21248 * The wrapper methods that support shortcut fusion are: 21249 * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, 21250 * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, 21251 * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` 21252 * 21253 * The chainable wrapper methods are: 21254 * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, 21255 * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, 21256 * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, 21257 * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, 21258 * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, 21259 * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, 21260 * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, 21261 * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, 21262 * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, 21263 * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, 21264 * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, 21265 * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, 21266 * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, 21267 * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, 21268 * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, 21269 * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, 21270 * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, 21271 * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, 21272 * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, 21273 * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, 21274 * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, 21275 * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, 21276 * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, 21277 * `zipObject`, `zipObjectDeep`, and `zipWith` 21278 * 21279 * The wrapper methods that are **not** chainable by default are: 21280 * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, 21281 * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, 21282 * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, 21283 * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, 21284 * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, 21285 * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, 21286 * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, 21287 * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, 21288 * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, 21289 * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, 21290 * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, 21291 * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, 21292 * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, 21293 * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, 21294 * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, 21295 * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, 21296 * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, 21297 * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, 21298 * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, 21299 * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, 21300 * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, 21301 * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, 21302 * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, 21303 * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, 21304 * `upperFirst`, `value`, and `words` 21305 * 21306 * @name _ 21307 * @constructor 21308 * @category Seq 21309 * @param {*} value The value to wrap in a `lodash` instance. 21310 * @returns {Object} Returns the new `lodash` wrapper instance. 21311 * @example 21312 * 21313 * function square(n) { 21314 * return n * n; 21315 * } 21316 * 21317 * var wrapped = _([1, 2, 3]); 21318 * 21319 * // Returns an unwrapped value. 21320 * wrapped.reduce(_.add); 21321 * // => 6 21322 * 21323 * // Returns a wrapped value. 21324 * var squares = wrapped.map(square); 21325 * 21326 * _.isArray(squares); 21327 * // => false 21328 * 21329 * _.isArray(squares.value()); 21330 * // => true 21331 */ 21332 function lodash(value) { 21333 if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { 21334 if (value instanceof LodashWrapper) { 21335 return value; 21336 } 21337 if (hasOwnProperty.call(value, '__wrapped__')) { 21338 return wrapperClone(value); 21339 } 21340 } 21341 return new LodashWrapper(value); 21342 } 21343 21344 /** 21345 * The base implementation of `_.create` without support for assigning 21346 * properties to the created object. 21347 * 21348 * @private 21349 * @param {Object} proto The object to inherit from. 21350 * @returns {Object} Returns the new object. 21351 */ 21352 var baseCreate = (function() { 21353 function object() {} 21354 return function(proto) { 21355 if (!isObject(proto)) { 21356 return {}; 21357 } 21358 if (objectCreate) { 21359 return objectCreate(proto); 21360 } 21361 object.prototype = proto; 21362 var result = new object; 21363 object.prototype = undefined; 21364 return result; 21365 }; 21366 }()); 21367 21368 /** 21369 * The function whose prototype chain sequence wrappers inherit from. 21370 * 21371 * @private 21372 */ 21373 function baseLodash() { 21374 // No operation performed. 21375 } 21376 21377 /** 21378 * The base constructor for creating `lodash` wrapper objects. 21379 * 21380 * @private 21381 * @param {*} value The value to wrap. 21382 * @param {boolean} [chainAll] Enable explicit method chain sequences. 21383 */ 21384 function LodashWrapper(value, chainAll) { 21385 this.__wrapped__ = value; 21386 this.__actions__ = []; 21387 this.__chain__ = !!chainAll; 21388 this.__index__ = 0; 21389 this.__values__ = undefined; 21390 } 21391 21392 /** 21393 * By default, the template delimiters used by lodash are like those in 21394 * embedded Ruby (ERB) as well as ES2015 template strings. Change the 21395 * following template settings to use alternative delimiters. 21396 * 21397 * @static 21398 * @memberOf _ 21399 * @type {Object} 21400 */ 21401 lodash.templateSettings = { 21402 21403 /** 21404 * Used to detect `data` property values to be HTML-escaped. 21405 * 21406 * @memberOf _.templateSettings 21407 * @type {RegExp} 21408 */ 21409 'escape': reEscape, 21410 21411 /** 21412 * Used to detect code to be evaluated. 21413 * 21414 * @memberOf _.templateSettings 21415 * @type {RegExp} 21416 */ 21417 'evaluate': reEvaluate, 21418 21419 /** 21420 * Used to detect `data` property values to inject. 21421 * 21422 * @memberOf _.templateSettings 21423 * @type {RegExp} 21424 */ 21425 'interpolate': reInterpolate, 21426 21427 /** 21428 * Used to reference the data object in the template text. 21429 * 21430 * @memberOf _.templateSettings 21431 * @type {string} 21432 */ 21433 'variable': '', 21434 21435 /** 21436 * Used to import variables into the compiled template. 21437 * 21438 * @memberOf _.templateSettings 21439 * @type {Object} 21440 */ 21441 'imports': { 21442 21443 /** 21444 * A reference to the `lodash` function. 21445 * 21446 * @memberOf _.templateSettings.imports 21447 * @type {Function} 21448 */ 21449 '_': lodash 21450 } 21451 }; 21452 21453 // Ensure wrappers are instances of `baseLodash`. 21454 lodash.prototype = baseLodash.prototype; 21455 lodash.prototype.constructor = lodash; 21456 21457 LodashWrapper.prototype = baseCreate(baseLodash.prototype); 21458 LodashWrapper.prototype.constructor = LodashWrapper; 21459 21460 /*------------------------------------------------------------------------*/ 21461 21462 /** 21463 * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. 21464 * 21465 * @private 21466 * @constructor 21467 * @param {*} value The value to wrap. 21468 */ 21469 function LazyWrapper(value) { 21470 this.__wrapped__ = value; 21471 this.__actions__ = []; 21472 this.__dir__ = 1; 21473 this.__filtered__ = false; 21474 this.__iteratees__ = []; 21475 this.__takeCount__ = MAX_ARRAY_LENGTH; 21476 this.__views__ = []; 21477 } 21478 21479 /** 21480 * Creates a clone of the lazy wrapper object. 21481 * 21482 * @private 21483 * @name clone 21484 * @memberOf LazyWrapper 21485 * @returns {Object} Returns the cloned `LazyWrapper` object. 21486 */ 21487 function lazyClone() { 21488 var result = new LazyWrapper(this.__wrapped__); 21489 result.__actions__ = copyArray(this.__actions__); 21490 result.__dir__ = this.__dir__; 21491 result.__filtered__ = this.__filtered__; 21492 result.__iteratees__ = copyArray(this.__iteratees__); 21493 result.__takeCount__ = this.__takeCount__; 21494 result.__views__ = copyArray(this.__views__); 21495 return result; 21496 } 21497 21498 /** 21499 * Reverses the direction of lazy iteration. 21500 * 21501 * @private 21502 * @name reverse 21503 * @memberOf LazyWrapper 21504 * @returns {Object} Returns the new reversed `LazyWrapper` object. 21505 */ 21506 function lazyReverse() { 21507 if (this.__filtered__) { 21508 var result = new LazyWrapper(this); 21509 result.__dir__ = -1; 21510 result.__filtered__ = true; 21511 } else { 21512 result = this.clone(); 21513 result.__dir__ *= -1; 21514 } 21515 return result; 21516 } 21517 21518 /** 21519 * Extracts the unwrapped value from its lazy wrapper. 21520 * 21521 * @private 21522 * @name value 21523 * @memberOf LazyWrapper 21524 * @returns {*} Returns the unwrapped value. 21525 */ 21526 function lazyValue() { 21527 var array = this.__wrapped__.value(), 21528 dir = this.__dir__, 21529 isArr = isArray(array), 21530 isRight = dir < 0, 21531 arrLength = isArr ? array.length : 0, 21532 view = getView(0, arrLength, this.__views__), 21533 start = view.start, 21534 end = view.end, 21535 length = end - start, 21536 index = isRight ? end : (start - 1), 21537 iteratees = this.__iteratees__, 21538 iterLength = iteratees.length, 21539 resIndex = 0, 21540 takeCount = nativeMin(length, this.__takeCount__); 21541 21542 if (!isArr || (!isRight && arrLength == length && takeCount == length)) { 21543 return baseWrapperValue(array, this.__actions__); 21544 } 21545 var result = []; 21546 21547 outer: 21548 while (length-- && resIndex < takeCount) { 21549 index += dir; 21550 21551 var iterIndex = -1, 21552 value = array[index]; 21553 21554 while (++iterIndex < iterLength) { 21555 var data = iteratees[iterIndex], 21556 iteratee = data.iteratee, 21557 type = data.type, 21558 computed = iteratee(value); 21559 21560 if (type == LAZY_MAP_FLAG) { 21561 value = computed; 21562 } else if (!computed) { 21563 if (type == LAZY_FILTER_FLAG) { 21564 continue outer; 21565 } else { 21566 break outer; 21567 } 21568 } 21569 } 21570 result[resIndex++] = value; 21571 } 21572 return result; 21573 } 21574 21575 // Ensure `LazyWrapper` is an instance of `baseLodash`. 21576 LazyWrapper.prototype = baseCreate(baseLodash.prototype); 21577 LazyWrapper.prototype.constructor = LazyWrapper; 21578 21579 /*------------------------------------------------------------------------*/ 21580 21581 /** 21582 * Creates a hash object. 21583 * 21584 * @private 21585 * @constructor 21586 * @param {Array} [entries] The key-value pairs to cache. 21587 */ 21588 function Hash(entries) { 21589 var index = -1, 21590 length = entries == null ? 0 : entries.length; 21591 21592 this.clear(); 21593 while (++index < length) { 21594 var entry = entries[index]; 21595 this.set(entry[0], entry[1]); 21596 } 21597 } 21598 21599 /** 21600 * Removes all key-value entries from the hash. 21601 * 21602 * @private 21603 * @name clear 21604 * @memberOf Hash 21605 */ 21606 function hashClear() { 21607 this.__data__ = nativeCreate ? nativeCreate(null) : {}; 21608 this.size = 0; 21609 } 21610 21611 /** 21612 * Removes `key` and its value from the hash. 21613 * 21614 * @private 21615 * @name delete 21616 * @memberOf Hash 21617 * @param {Object} hash The hash to modify. 21618 * @param {string} key The key of the value to remove. 21619 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 21620 */ 21621 function hashDelete(key) { 21622 var result = this.has(key) && delete this.__data__[key]; 21623 this.size -= result ? 1 : 0; 21624 return result; 21625 } 21626 21627 /** 21628 * Gets the hash value for `key`. 21629 * 21630 * @private 21631 * @name get 21632 * @memberOf Hash 21633 * @param {string} key The key of the value to get. 21634 * @returns {*} Returns the entry value. 21635 */ 21636 function hashGet(key) { 21637 var data = this.__data__; 21638 if (nativeCreate) { 21639 var result = data[key]; 21640 return result === HASH_UNDEFINED ? undefined : result; 21641 } 21642 return hasOwnProperty.call(data, key) ? data[key] : undefined; 21643 } 21644 21645 /** 21646 * Checks if a hash value for `key` exists. 21647 * 21648 * @private 21649 * @name has 21650 * @memberOf Hash 21651 * @param {string} key The key of the entry to check. 21652 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 21653 */ 21654 function hashHas(key) { 21655 var data = this.__data__; 21656 return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); 21657 } 21658 21659 /** 21660 * Sets the hash `key` to `value`. 21661 * 21662 * @private 21663 * @name set 21664 * @memberOf Hash 21665 * @param {string} key The key of the value to set. 21666 * @param {*} value The value to set. 21667 * @returns {Object} Returns the hash instance. 21668 */ 21669 function hashSet(key, value) { 21670 var data = this.__data__; 21671 this.size += this.has(key) ? 0 : 1; 21672 data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; 21673 return this; 21674 } 21675 21676 // Add methods to `Hash`. 21677 Hash.prototype.clear = hashClear; 21678 Hash.prototype['delete'] = hashDelete; 21679 Hash.prototype.get = hashGet; 21680 Hash.prototype.has = hashHas; 21681 Hash.prototype.set = hashSet; 21682 21683 /*------------------------------------------------------------------------*/ 21684 21685 /** 21686 * Creates an list cache object. 21687 * 21688 * @private 21689 * @constructor 21690 * @param {Array} [entries] The key-value pairs to cache. 21691 */ 21692 function ListCache(entries) { 21693 var index = -1, 21694 length = entries == null ? 0 : entries.length; 21695 21696 this.clear(); 21697 while (++index < length) { 21698 var entry = entries[index]; 21699 this.set(entry[0], entry[1]); 21700 } 21701 } 21702 21703 /** 21704 * Removes all key-value entries from the list cache. 21705 * 21706 * @private 21707 * @name clear 21708 * @memberOf ListCache 21709 */ 21710 function listCacheClear() { 21711 this.__data__ = []; 21712 this.size = 0; 21713 } 21714 21715 /** 21716 * Removes `key` and its value from the list cache. 21717 * 21718 * @private 21719 * @name delete 21720 * @memberOf ListCache 21721 * @param {string} key The key of the value to remove. 21722 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 21723 */ 21724 function listCacheDelete(key) { 21725 var data = this.__data__, 21726 index = assocIndexOf(data, key); 21727 21728 if (index < 0) { 21729 return false; 21730 } 21731 var lastIndex = data.length - 1; 21732 if (index == lastIndex) { 21733 data.pop(); 21734 } else { 21735 splice.call(data, index, 1); 21736 } 21737 --this.size; 21738 return true; 21739 } 21740 21741 /** 21742 * Gets the list cache value for `key`. 21743 * 21744 * @private 21745 * @name get 21746 * @memberOf ListCache 21747 * @param {string} key The key of the value to get. 21748 * @returns {*} Returns the entry value. 21749 */ 21750 function listCacheGet(key) { 21751 var data = this.__data__, 21752 index = assocIndexOf(data, key); 21753 21754 return index < 0 ? undefined : data[index][1]; 21755 } 21756 21757 /** 21758 * Checks if a list cache value for `key` exists. 21759 * 21760 * @private 21761 * @name has 21762 * @memberOf ListCache 21763 * @param {string} key The key of the entry to check. 21764 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 21765 */ 21766 function listCacheHas(key) { 21767 return assocIndexOf(this.__data__, key) > -1; 21768 } 21769 21770 /** 21771 * Sets the list cache `key` to `value`. 21772 * 21773 * @private 21774 * @name set 21775 * @memberOf ListCache 21776 * @param {string} key The key of the value to set. 21777 * @param {*} value The value to set. 21778 * @returns {Object} Returns the list cache instance. 21779 */ 21780 function listCacheSet(key, value) { 21781 var data = this.__data__, 21782 index = assocIndexOf(data, key); 21783 21784 if (index < 0) { 21785 ++this.size; 21786 data.push([key, value]); 21787 } else { 21788 data[index][1] = value; 21789 } 21790 return this; 21791 } 21792 21793 // Add methods to `ListCache`. 21794 ListCache.prototype.clear = listCacheClear; 21795 ListCache.prototype['delete'] = listCacheDelete; 21796 ListCache.prototype.get = listCacheGet; 21797 ListCache.prototype.has = listCacheHas; 21798 ListCache.prototype.set = listCacheSet; 21799 21800 /*------------------------------------------------------------------------*/ 21801 21802 /** 21803 * Creates a map cache object to store key-value pairs. 21804 * 21805 * @private 21806 * @constructor 21807 * @param {Array} [entries] The key-value pairs to cache. 21808 */ 21809 function MapCache(entries) { 21810 var index = -1, 21811 length = entries == null ? 0 : entries.length; 21812 21813 this.clear(); 21814 while (++index < length) { 21815 var entry = entries[index]; 21816 this.set(entry[0], entry[1]); 21817 } 21818 } 21819 21820 /** 21821 * Removes all key-value entries from the map. 21822 * 21823 * @private 21824 * @name clear 21825 * @memberOf MapCache 21826 */ 21827 function mapCacheClear() { 21828 this.size = 0; 21829 this.__data__ = { 21830 'hash': new Hash, 21831 'map': new (Map || ListCache), 21832 'string': new Hash 21833 }; 21834 } 21835 21836 /** 21837 * Removes `key` and its value from the map. 21838 * 21839 * @private 21840 * @name delete 21841 * @memberOf MapCache 21842 * @param {string} key The key of the value to remove. 21843 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 21844 */ 21845 function mapCacheDelete(key) { 21846 var result = getMapData(this, key)['delete'](key); 21847 this.size -= result ? 1 : 0; 21848 return result; 21849 } 21850 21851 /** 21852 * Gets the map value for `key`. 21853 * 21854 * @private 21855 * @name get 21856 * @memberOf MapCache 21857 * @param {string} key The key of the value to get. 21858 * @returns {*} Returns the entry value. 21859 */ 21860 function mapCacheGet(key) { 21861 return getMapData(this, key).get(key); 21862 } 21863 21864 /** 21865 * Checks if a map value for `key` exists. 21866 * 21867 * @private 21868 * @name has 21869 * @memberOf MapCache 21870 * @param {string} key The key of the entry to check. 21871 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 21872 */ 21873 function mapCacheHas(key) { 21874 return getMapData(this, key).has(key); 21875 } 21876 21877 /** 21878 * Sets the map `key` to `value`. 21879 * 21880 * @private 21881 * @name set 21882 * @memberOf MapCache 21883 * @param {string} key The key of the value to set. 21884 * @param {*} value The value to set. 21885 * @returns {Object} Returns the map cache instance. 21886 */ 21887 function mapCacheSet(key, value) { 21888 var data = getMapData(this, key), 21889 size = data.size; 21890 21891 data.set(key, value); 21892 this.size += data.size == size ? 0 : 1; 21893 return this; 21894 } 21895 21896 // Add methods to `MapCache`. 21897 MapCache.prototype.clear = mapCacheClear; 21898 MapCache.prototype['delete'] = mapCacheDelete; 21899 MapCache.prototype.get = mapCacheGet; 21900 MapCache.prototype.has = mapCacheHas; 21901 MapCache.prototype.set = mapCacheSet; 21902 21903 /*------------------------------------------------------------------------*/ 21904 21905 /** 21906 * 21907 * Creates an array cache object to store unique values. 21908 * 21909 * @private 21910 * @constructor 21911 * @param {Array} [values] The values to cache. 21912 */ 21913 function SetCache(values) { 21914 var index = -1, 21915 length = values == null ? 0 : values.length; 21916 21917 this.__data__ = new MapCache; 21918 while (++index < length) { 21919 this.add(values[index]); 21920 } 21921 } 21922 21923 /** 21924 * Adds `value` to the array cache. 21925 * 21926 * @private 21927 * @name add 21928 * @memberOf SetCache 21929 * @alias push 21930 * @param {*} value The value to cache. 21931 * @returns {Object} Returns the cache instance. 21932 */ 21933 function setCacheAdd(value) { 21934 this.__data__.set(value, HASH_UNDEFINED); 21935 return this; 21936 } 21937 21938 /** 21939 * Checks if `value` is in the array cache. 21940 * 21941 * @private 21942 * @name has 21943 * @memberOf SetCache 21944 * @param {*} value The value to search for. 21945 * @returns {number} Returns `true` if `value` is found, else `false`. 21946 */ 21947 function setCacheHas(value) { 21948 return this.__data__.has(value); 21949 } 21950 21951 // Add methods to `SetCache`. 21952 SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; 21953 SetCache.prototype.has = setCacheHas; 21954 21955 /*------------------------------------------------------------------------*/ 21956 21957 /** 21958 * Creates a stack cache object to store key-value pairs. 21959 * 21960 * @private 21961 * @constructor 21962 * @param {Array} [entries] The key-value pairs to cache. 21963 */ 21964 function Stack(entries) { 21965 var data = this.__data__ = new ListCache(entries); 21966 this.size = data.size; 21967 } 21968 21969 /** 21970 * Removes all key-value entries from the stack. 21971 * 21972 * @private 21973 * @name clear 21974 * @memberOf Stack 21975 */ 21976 function stackClear() { 21977 this.__data__ = new ListCache; 21978 this.size = 0; 21979 } 21980 21981 /** 21982 * Removes `key` and its value from the stack. 21983 * 21984 * @private 21985 * @name delete 21986 * @memberOf Stack 21987 * @param {string} key The key of the value to remove. 21988 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 21989 */ 21990 function stackDelete(key) { 21991 var data = this.__data__, 21992 result = data['delete'](key); 21993 21994 this.size = data.size; 21995 return result; 21996 } 21997 21998 /** 21999 * Gets the stack value for `key`. 22000 * 22001 * @private 22002 * @name get 22003 * @memberOf Stack 22004 * @param {string} key The key of the value to get. 22005 * @returns {*} Returns the entry value. 22006 */ 22007 function stackGet(key) { 22008 return this.__data__.get(key); 22009 } 22010 22011 /** 22012 * Checks if a stack value for `key` exists. 22013 * 22014 * @private 22015 * @name has 22016 * @memberOf Stack 22017 * @param {string} key The key of the entry to check. 22018 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 22019 */ 22020 function stackHas(key) { 22021 return this.__data__.has(key); 22022 } 22023 22024 /** 22025 * Sets the stack `key` to `value`. 22026 * 22027 * @private 22028 * @name set 22029 * @memberOf Stack 22030 * @param {string} key The key of the value to set. 22031 * @param {*} value The value to set. 22032 * @returns {Object} Returns the stack cache instance. 22033 */ 22034 function stackSet(key, value) { 22035 var data = this.__data__; 22036 if (data instanceof ListCache) { 22037 var pairs = data.__data__; 22038 if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { 22039 pairs.push([key, value]); 22040 this.size = ++data.size; 22041 return this; 22042 } 22043 data = this.__data__ = new MapCache(pairs); 22044 } 22045 data.set(key, value); 22046 this.size = data.size; 22047 return this; 22048 } 22049 22050 // Add methods to `Stack`. 22051 Stack.prototype.clear = stackClear; 22052 Stack.prototype['delete'] = stackDelete; 22053 Stack.prototype.get = stackGet; 22054 Stack.prototype.has = stackHas; 22055 Stack.prototype.set = stackSet; 22056 22057 /*------------------------------------------------------------------------*/ 22058 22059 /** 22060 * Creates an array of the enumerable property names of the array-like `value`. 22061 * 22062 * @private 22063 * @param {*} value The value to query. 22064 * @param {boolean} inherited Specify returning inherited property names. 22065 * @returns {Array} Returns the array of property names. 22066 */ 22067 function arrayLikeKeys(value, inherited) { 22068 var isArr = isArray(value), 22069 isArg = !isArr && isArguments(value), 22070 isBuff = !isArr && !isArg && isBuffer(value), 22071 isType = !isArr && !isArg && !isBuff && isTypedArray(value), 22072 skipIndexes = isArr || isArg || isBuff || isType, 22073 result = skipIndexes ? baseTimes(value.length, String) : [], 22074 length = result.length; 22075 22076 for (var key in value) { 22077 if ((inherited || hasOwnProperty.call(value, key)) && 22078 !(skipIndexes && ( 22079 // Safari 9 has enumerable `arguments.length` in strict mode. 22080 key == 'length' || 22081 // Node.js 0.10 has enumerable non-index properties on buffers. 22082 (isBuff && (key == 'offset' || key == 'parent')) || 22083 // PhantomJS 2 has enumerable non-index properties on typed arrays. 22084 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || 22085 // Skip index properties. 22086 isIndex(key, length) 22087 ))) { 22088 result.push(key); 22089 } 22090 } 22091 return result; 22092 } 22093 22094 /** 22095 * A specialized version of `_.sample` for arrays. 22096 * 22097 * @private 22098 * @param {Array} array The array to sample. 22099 * @returns {*} Returns the random element. 22100 */ 22101 function arraySample(array) { 22102 var length = array.length; 22103 return length ? array[baseRandom(0, length - 1)] : undefined; 22104 } 22105 22106 /** 22107 * A specialized version of `_.sampleSize` for arrays. 22108 * 22109 * @private 22110 * @param {Array} array The array to sample. 22111 * @param {number} n The number of elements to sample. 22112 * @returns {Array} Returns the random elements. 22113 */ 22114 function arraySampleSize(array, n) { 22115 return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); 22116 } 22117 22118 /** 22119 * A specialized version of `_.shuffle` for arrays. 22120 * 22121 * @private 22122 * @param {Array} array The array to shuffle. 22123 * @returns {Array} Returns the new shuffled array. 22124 */ 22125 function arrayShuffle(array) { 22126 return shuffleSelf(copyArray(array)); 22127 } 22128 22129 /** 22130 * This function is like `assignValue` except that it doesn't assign 22131 * `undefined` values. 22132 * 22133 * @private 22134 * @param {Object} object The object to modify. 22135 * @param {string} key The key of the property to assign. 22136 * @param {*} value The value to assign. 22137 */ 22138 function assignMergeValue(object, key, value) { 22139 if ((value !== undefined && !eq(object[key], value)) || 22140 (value === undefined && !(key in object))) { 22141 baseAssignValue(object, key, value); 22142 } 22143 } 22144 22145 /** 22146 * Assigns `value` to `key` of `object` if the existing value is not equivalent 22147 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 22148 * for equality comparisons. 22149 * 22150 * @private 22151 * @param {Object} object The object to modify. 22152 * @param {string} key The key of the property to assign. 22153 * @param {*} value The value to assign. 22154 */ 22155 function assignValue(object, key, value) { 22156 var objValue = object[key]; 22157 if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || 22158 (value === undefined && !(key in object))) { 22159 baseAssignValue(object, key, value); 22160 } 22161 } 22162 22163 /** 22164 * Gets the index at which the `key` is found in `array` of key-value pairs. 22165 * 22166 * @private 22167 * @param {Array} array The array to inspect. 22168 * @param {*} key The key to search for. 22169 * @returns {number} Returns the index of the matched value, else `-1`. 22170 */ 22171 function assocIndexOf(array, key) { 22172 var length = array.length; 22173 while (length--) { 22174 if (eq(array[length][0], key)) { 22175 return length; 22176 } 22177 } 22178 return -1; 22179 } 22180 22181 /** 22182 * Aggregates elements of `collection` on `accumulator` with keys transformed 22183 * by `iteratee` and values set by `setter`. 22184 * 22185 * @private 22186 * @param {Array|Object} collection The collection to iterate over. 22187 * @param {Function} setter The function to set `accumulator` values. 22188 * @param {Function} iteratee The iteratee to transform keys. 22189 * @param {Object} accumulator The initial aggregated object. 22190 * @returns {Function} Returns `accumulator`. 22191 */ 22192 function baseAggregator(collection, setter, iteratee, accumulator) { 22193 baseEach(collection, function(value, key, collection) { 22194 setter(accumulator, value, iteratee(value), collection); 22195 }); 22196 return accumulator; 22197 } 22198 22199 /** 22200 * The base implementation of `_.assign` without support for multiple sources 22201 * or `customizer` functions. 22202 * 22203 * @private 22204 * @param {Object} object The destination object. 22205 * @param {Object} source The source object. 22206 * @returns {Object} Returns `object`. 22207 */ 22208 function baseAssign(object, source) { 22209 return object && copyObject(source, keys(source), object); 22210 } 22211 22212 /** 22213 * The base implementation of `_.assignIn` without support for multiple sources 22214 * or `customizer` functions. 22215 * 22216 * @private 22217 * @param {Object} object The destination object. 22218 * @param {Object} source The source object. 22219 * @returns {Object} Returns `object`. 22220 */ 22221 function baseAssignIn(object, source) { 22222 return object && copyObject(source, keysIn(source), object); 22223 } 22224 22225 /** 22226 * The base implementation of `assignValue` and `assignMergeValue` without 22227 * value checks. 22228 * 22229 * @private 22230 * @param {Object} object The object to modify. 22231 * @param {string} key The key of the property to assign. 22232 * @param {*} value The value to assign. 22233 */ 22234 function baseAssignValue(object, key, value) { 22235 if (key == '__proto__' && defineProperty) { 22236 defineProperty(object, key, { 22237 'configurable': true, 22238 'enumerable': true, 22239 'value': value, 22240 'writable': true 22241 }); 22242 } else { 22243 object[key] = value; 22244 } 22245 } 22246 22247 /** 22248 * The base implementation of `_.at` without support for individual paths. 22249 * 22250 * @private 22251 * @param {Object} object The object to iterate over. 22252 * @param {string[]} paths The property paths to pick. 22253 * @returns {Array} Returns the picked elements. 22254 */ 22255 function baseAt(object, paths) { 22256 var index = -1, 22257 length = paths.length, 22258 result = Array(length), 22259 skip = object == null; 22260 22261 while (++index < length) { 22262 result[index] = skip ? undefined : get(object, paths[index]); 22263 } 22264 return result; 22265 } 22266 22267 /** 22268 * The base implementation of `_.clamp` which doesn't coerce arguments. 22269 * 22270 * @private 22271 * @param {number} number The number to clamp. 22272 * @param {number} [lower] The lower bound. 22273 * @param {number} upper The upper bound. 22274 * @returns {number} Returns the clamped number. 22275 */ 22276 function baseClamp(number, lower, upper) { 22277 if (number === number) { 22278 if (upper !== undefined) { 22279 number = number <= upper ? number : upper; 22280 } 22281 if (lower !== undefined) { 22282 number = number >= lower ? number : lower; 22283 } 22284 } 22285 return number; 22286 } 22287 22288 /** 22289 * The base implementation of `_.clone` and `_.cloneDeep` which tracks 22290 * traversed objects. 22291 * 22292 * @private 22293 * @param {*} value The value to clone. 22294 * @param {boolean} bitmask The bitmask flags. 22295 * 1 - Deep clone 22296 * 2 - Flatten inherited properties 22297 * 4 - Clone symbols 22298 * @param {Function} [customizer] The function to customize cloning. 22299 * @param {string} [key] The key of `value`. 22300 * @param {Object} [object] The parent object of `value`. 22301 * @param {Object} [stack] Tracks traversed objects and their clone counterparts. 22302 * @returns {*} Returns the cloned value. 22303 */ 22304 function baseClone(value, bitmask, customizer, key, object, stack) { 22305 var result, 22306 isDeep = bitmask & CLONE_DEEP_FLAG, 22307 isFlat = bitmask & CLONE_FLAT_FLAG, 22308 isFull = bitmask & CLONE_SYMBOLS_FLAG; 22309 22310 if (customizer) { 22311 result = object ? customizer(value, key, object, stack) : customizer(value); 22312 } 22313 if (result !== undefined) { 22314 return result; 22315 } 22316 if (!isObject(value)) { 22317 return value; 22318 } 22319 var isArr = isArray(value); 22320 if (isArr) { 22321 result = initCloneArray(value); 22322 if (!isDeep) { 22323 return copyArray(value, result); 22324 } 22325 } else { 22326 var tag = getTag(value), 22327 isFunc = tag == funcTag || tag == genTag; 22328 22329 if (isBuffer(value)) { 22330 return cloneBuffer(value, isDeep); 22331 } 22332 if (tag == objectTag || tag == argsTag || (isFunc && !object)) { 22333 result = (isFlat || isFunc) ? {} : initCloneObject(value); 22334 if (!isDeep) { 22335 return isFlat 22336 ? copySymbolsIn(value, baseAssignIn(result, value)) 22337 : copySymbols(value, baseAssign(result, value)); 22338 } 22339 } else { 22340 if (!cloneableTags[tag]) { 22341 return object ? value : {}; 22342 } 22343 result = initCloneByTag(value, tag, isDeep); 22344 } 22345 } 22346 // Check for circular references and return its corresponding clone. 22347 stack || (stack = new Stack); 22348 var stacked = stack.get(value); 22349 if (stacked) { 22350 return stacked; 22351 } 22352 stack.set(value, result); 22353 22354 if (isSet(value)) { 22355 value.forEach(function(subValue) { 22356 result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); 22357 }); 22358 } else if (isMap(value)) { 22359 value.forEach(function(subValue, key) { 22360 result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); 22361 }); 22362 } 22363 22364 var keysFunc = isFull 22365 ? (isFlat ? getAllKeysIn : getAllKeys) 22366 : (isFlat ? keysIn : keys); 22367 22368 var props = isArr ? undefined : keysFunc(value); 22369 arrayEach(props || value, function(subValue, key) { 22370 if (props) { 22371 key = subValue; 22372 subValue = value[key]; 22373 } 22374 // Recursively populate clone (susceptible to call stack limits). 22375 assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); 22376 }); 22377 return result; 22378 } 22379 22380 /** 22381 * The base implementation of `_.conforms` which doesn't clone `source`. 22382 * 22383 * @private 22384 * @param {Object} source The object of property predicates to conform to. 22385 * @returns {Function} Returns the new spec function. 22386 */ 22387 function baseConforms(source) { 22388 var props = keys(source); 22389 return function(object) { 22390 return baseConformsTo(object, source, props); 22391 }; 22392 } 22393 22394 /** 22395 * The base implementation of `_.conformsTo` which accepts `props` to check. 22396 * 22397 * @private 22398 * @param {Object} object The object to inspect. 22399 * @param {Object} source The object of property predicates to conform to. 22400 * @returns {boolean} Returns `true` if `object` conforms, else `false`. 22401 */ 22402 function baseConformsTo(object, source, props) { 22403 var length = props.length; 22404 if (object == null) { 22405 return !length; 22406 } 22407 object = Object(object); 22408 while (length--) { 22409 var key = props[length], 22410 predicate = source[key], 22411 value = object[key]; 22412 22413 if ((value === undefined && !(key in object)) || !predicate(value)) { 22414 return false; 22415 } 22416 } 22417 return true; 22418 } 22419 22420 /** 22421 * The base implementation of `_.delay` and `_.defer` which accepts `args` 22422 * to provide to `func`. 22423 * 22424 * @private 22425 * @param {Function} func The function to delay. 22426 * @param {number} wait The number of milliseconds to delay invocation. 22427 * @param {Array} args The arguments to provide to `func`. 22428 * @returns {number|Object} Returns the timer id or timeout object. 22429 */ 22430 function baseDelay(func, wait, args) { 22431 if (typeof func != 'function') { 22432 throw new TypeError(FUNC_ERROR_TEXT); 22433 } 22434 return setTimeout(function() { func.apply(undefined, args); }, wait); 22435 } 22436 22437 /** 22438 * The base implementation of methods like `_.difference` without support 22439 * for excluding multiple arrays or iteratee shorthands. 22440 * 22441 * @private 22442 * @param {Array} array The array to inspect. 22443 * @param {Array} values The values to exclude. 22444 * @param {Function} [iteratee] The iteratee invoked per element. 22445 * @param {Function} [comparator] The comparator invoked per element. 22446 * @returns {Array} Returns the new array of filtered values. 22447 */ 22448 function baseDifference(array, values, iteratee, comparator) { 22449 var index = -1, 22450 includes = arrayIncludes, 22451 isCommon = true, 22452 length = array.length, 22453 result = [], 22454 valuesLength = values.length; 22455 22456 if (!length) { 22457 return result; 22458 } 22459 if (iteratee) { 22460 values = arrayMap(values, baseUnary(iteratee)); 22461 } 22462 if (comparator) { 22463 includes = arrayIncludesWith; 22464 isCommon = false; 22465 } 22466 else if (values.length >= LARGE_ARRAY_SIZE) { 22467 includes = cacheHas; 22468 isCommon = false; 22469 values = new SetCache(values); 22470 } 22471 outer: 22472 while (++index < length) { 22473 var value = array[index], 22474 computed = iteratee == null ? value : iteratee(value); 22475 22476 value = (comparator || value !== 0) ? value : 0; 22477 if (isCommon && computed === computed) { 22478 var valuesIndex = valuesLength; 22479 while (valuesIndex--) { 22480 if (values[valuesIndex] === computed) { 22481 continue outer; 22482 } 22483 } 22484 result.push(value); 22485 } 22486 else if (!includes(values, computed, comparator)) { 22487 result.push(value); 22488 } 22489 } 22490 return result; 22491 } 22492 22493 /** 22494 * The base implementation of `_.forEach` without support for iteratee shorthands. 22495 * 22496 * @private 22497 * @param {Array|Object} collection The collection to iterate over. 22498 * @param {Function} iteratee The function invoked per iteration. 22499 * @returns {Array|Object} Returns `collection`. 22500 */ 22501 var baseEach = createBaseEach(baseForOwn); 22502 22503 /** 22504 * The base implementation of `_.forEachRight` without support for iteratee shorthands. 22505 * 22506 * @private 22507 * @param {Array|Object} collection The collection to iterate over. 22508 * @param {Function} iteratee The function invoked per iteration. 22509 * @returns {Array|Object} Returns `collection`. 22510 */ 22511 var baseEachRight = createBaseEach(baseForOwnRight, true); 22512 22513 /** 22514 * The base implementation of `_.every` without support for iteratee shorthands. 22515 * 22516 * @private 22517 * @param {Array|Object} collection The collection to iterate over. 22518 * @param {Function} predicate The function invoked per iteration. 22519 * @returns {boolean} Returns `true` if all elements pass the predicate check, 22520 * else `false` 22521 */ 22522 function baseEvery(collection, predicate) { 22523 var result = true; 22524 baseEach(collection, function(value, index, collection) { 22525 result = !!predicate(value, index, collection); 22526 return result; 22527 }); 22528 return result; 22529 } 22530 22531 /** 22532 * The base implementation of methods like `_.max` and `_.min` which accepts a 22533 * `comparator` to determine the extremum value. 22534 * 22535 * @private 22536 * @param {Array} array The array to iterate over. 22537 * @param {Function} iteratee The iteratee invoked per iteration. 22538 * @param {Function} comparator The comparator used to compare values. 22539 * @returns {*} Returns the extremum value. 22540 */ 22541 function baseExtremum(array, iteratee, comparator) { 22542 var index = -1, 22543 length = array.length; 22544 22545 while (++index < length) { 22546 var value = array[index], 22547 current = iteratee(value); 22548 22549 if (current != null && (computed === undefined 22550 ? (current === current && !isSymbol(current)) 22551 : comparator(current, computed) 22552 )) { 22553 var computed = current, 22554 result = value; 22555 } 22556 } 22557 return result; 22558 } 22559 22560 /** 22561 * The base implementation of `_.fill` without an iteratee call guard. 22562 * 22563 * @private 22564 * @param {Array} array The array to fill. 22565 * @param {*} value The value to fill `array` with. 22566 * @param {number} [start=0] The start position. 22567 * @param {number} [end=array.length] The end position. 22568 * @returns {Array} Returns `array`. 22569 */ 22570 function baseFill(array, value, start, end) { 22571 var length = array.length; 22572 22573 start = toInteger(start); 22574 if (start < 0) { 22575 start = -start > length ? 0 : (length + start); 22576 } 22577 end = (end === undefined || end > length) ? length : toInteger(end); 22578 if (end < 0) { 22579 end += length; 22580 } 22581 end = start > end ? 0 : toLength(end); 22582 while (start < end) { 22583 array[start++] = value; 22584 } 22585 return array; 22586 } 22587 22588 /** 22589 * The base implementation of `_.filter` without support for iteratee shorthands. 22590 * 22591 * @private 22592 * @param {Array|Object} collection The collection to iterate over. 22593 * @param {Function} predicate The function invoked per iteration. 22594 * @returns {Array} Returns the new filtered array. 22595 */ 22596 function baseFilter(collection, predicate) { 22597 var result = []; 22598 baseEach(collection, function(value, index, collection) { 22599 if (predicate(value, index, collection)) { 22600 result.push(value); 22601 } 22602 }); 22603 return result; 22604 } 22605 22606 /** 22607 * The base implementation of `_.flatten` with support for restricting flattening. 22608 * 22609 * @private 22610 * @param {Array} array The array to flatten. 22611 * @param {number} depth The maximum recursion depth. 22612 * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. 22613 * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. 22614 * @param {Array} [result=[]] The initial result value. 22615 * @returns {Array} Returns the new flattened array. 22616 */ 22617 function baseFlatten(array, depth, predicate, isStrict, result) { 22618 var index = -1, 22619 length = array.length; 22620 22621 predicate || (predicate = isFlattenable); 22622 result || (result = []); 22623 22624 while (++index < length) { 22625 var value = array[index]; 22626 if (depth > 0 && predicate(value)) { 22627 if (depth > 1) { 22628 // Recursively flatten arrays (susceptible to call stack limits). 22629 baseFlatten(value, depth - 1, predicate, isStrict, result); 22630 } else { 22631 arrayPush(result, value); 22632 } 22633 } else if (!isStrict) { 22634 result[result.length] = value; 22635 } 22636 } 22637 return result; 22638 } 22639 22640 /** 22641 * The base implementation of `baseForOwn` which iterates over `object` 22642 * properties returned by `keysFunc` and invokes `iteratee` for each property. 22643 * Iteratee functions may exit iteration early by explicitly returning `false`. 22644 * 22645 * @private 22646 * @param {Object} object The object to iterate over. 22647 * @param {Function} iteratee The function invoked per iteration. 22648 * @param {Function} keysFunc The function to get the keys of `object`. 22649 * @returns {Object} Returns `object`. 22650 */ 22651 var baseFor = createBaseFor(); 22652 22653 /** 22654 * This function is like `baseFor` except that it iterates over properties 22655 * in the opposite order. 22656 * 22657 * @private 22658 * @param {Object} object The object to iterate over. 22659 * @param {Function} iteratee The function invoked per iteration. 22660 * @param {Function} keysFunc The function to get the keys of `object`. 22661 * @returns {Object} Returns `object`. 22662 */ 22663 var baseForRight = createBaseFor(true); 22664 22665 /** 22666 * The base implementation of `_.forOwn` without support for iteratee shorthands. 22667 * 22668 * @private 22669 * @param {Object} object The object to iterate over. 22670 * @param {Function} iteratee The function invoked per iteration. 22671 * @returns {Object} Returns `object`. 22672 */ 22673 function baseForOwn(object, iteratee) { 22674 return object && baseFor(object, iteratee, keys); 22675 } 22676 22677 /** 22678 * The base implementation of `_.forOwnRight` without support for iteratee shorthands. 22679 * 22680 * @private 22681 * @param {Object} object The object to iterate over. 22682 * @param {Function} iteratee The function invoked per iteration. 22683 * @returns {Object} Returns `object`. 22684 */ 22685 function baseForOwnRight(object, iteratee) { 22686 return object && baseForRight(object, iteratee, keys); 22687 } 22688 22689 /** 22690 * The base implementation of `_.functions` which creates an array of 22691 * `object` function property names filtered from `props`. 22692 * 22693 * @private 22694 * @param {Object} object The object to inspect. 22695 * @param {Array} props The property names to filter. 22696 * @returns {Array} Returns the function names. 22697 */ 22698 function baseFunctions(object, props) { 22699 return arrayFilter(props, function(key) { 22700 return isFunction(object[key]); 22701 }); 22702 } 22703 22704 /** 22705 * The base implementation of `_.get` without support for default values. 22706 * 22707 * @private 22708 * @param {Object} object The object to query. 22709 * @param {Array|string} path The path of the property to get. 22710 * @returns {*} Returns the resolved value. 22711 */ 22712 function baseGet(object, path) { 22713 path = castPath(path, object); 22714 22715 var index = 0, 22716 length = path.length; 22717 22718 while (object != null && index < length) { 22719 object = object[toKey(path[index++])]; 22720 } 22721 return (index && index == length) ? object : undefined; 22722 } 22723 22724 /** 22725 * The base implementation of `getAllKeys` and `getAllKeysIn` which uses 22726 * `keysFunc` and `symbolsFunc` to get the enumerable property names and 22727 * symbols of `object`. 22728 * 22729 * @private 22730 * @param {Object} object The object to query. 22731 * @param {Function} keysFunc The function to get the keys of `object`. 22732 * @param {Function} symbolsFunc The function to get the symbols of `object`. 22733 * @returns {Array} Returns the array of property names and symbols. 22734 */ 22735 function baseGetAllKeys(object, keysFunc, symbolsFunc) { 22736 var result = keysFunc(object); 22737 return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); 22738 } 22739 22740 /** 22741 * The base implementation of `getTag` without fallbacks for buggy environments. 22742 * 22743 * @private 22744 * @param {*} value The value to query. 22745 * @returns {string} Returns the `toStringTag`. 22746 */ 22747 function baseGetTag(value) { 22748 if (value == null) { 22749 return value === undefined ? undefinedTag : nullTag; 22750 } 22751 return (symToStringTag && symToStringTag in Object(value)) 22752 ? getRawTag(value) 22753 : objectToString(value); 22754 } 22755 22756 /** 22757 * The base implementation of `_.gt` which doesn't coerce arguments. 22758 * 22759 * @private 22760 * @param {*} value The value to compare. 22761 * @param {*} other The other value to compare. 22762 * @returns {boolean} Returns `true` if `value` is greater than `other`, 22763 * else `false`. 22764 */ 22765 function baseGt(value, other) { 22766 return value > other; 22767 } 22768 22769 /** 22770 * The base implementation of `_.has` without support for deep paths. 22771 * 22772 * @private 22773 * @param {Object} [object] The object to query. 22774 * @param {Array|string} key The key to check. 22775 * @returns {boolean} Returns `true` if `key` exists, else `false`. 22776 */ 22777 function baseHas(object, key) { 22778 return object != null && hasOwnProperty.call(object, key); 22779 } 22780 22781 /** 22782 * The base implementation of `_.hasIn` without support for deep paths. 22783 * 22784 * @private 22785 * @param {Object} [object] The object to query. 22786 * @param {Array|string} key The key to check. 22787 * @returns {boolean} Returns `true` if `key` exists, else `false`. 22788 */ 22789 function baseHasIn(object, key) { 22790 return object != null && key in Object(object); 22791 } 22792 22793 /** 22794 * The base implementation of `_.inRange` which doesn't coerce arguments. 22795 * 22796 * @private 22797 * @param {number} number The number to check. 22798 * @param {number} start The start of the range. 22799 * @param {number} end The end of the range. 22800 * @returns {boolean} Returns `true` if `number` is in the range, else `false`. 22801 */ 22802 function baseInRange(number, start, end) { 22803 return number >= nativeMin(start, end) && number < nativeMax(start, end); 22804 } 22805 22806 /** 22807 * The base implementation of methods like `_.intersection`, without support 22808 * for iteratee shorthands, that accepts an array of arrays to inspect. 22809 * 22810 * @private 22811 * @param {Array} arrays The arrays to inspect. 22812 * @param {Function} [iteratee] The iteratee invoked per element. 22813 * @param {Function} [comparator] The comparator invoked per element. 22814 * @returns {Array} Returns the new array of shared values. 22815 */ 22816 function baseIntersection(arrays, iteratee, comparator) { 22817 var includes = comparator ? arrayIncludesWith : arrayIncludes, 22818 length = arrays[0].length, 22819 othLength = arrays.length, 22820 othIndex = othLength, 22821 caches = Array(othLength), 22822 maxLength = Infinity, 22823 result = []; 22824 22825 while (othIndex--) { 22826 var array = arrays[othIndex]; 22827 if (othIndex && iteratee) { 22828 array = arrayMap(array, baseUnary(iteratee)); 22829 } 22830 maxLength = nativeMin(array.length, maxLength); 22831 caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) 22832 ? new SetCache(othIndex && array) 22833 : undefined; 22834 } 22835 array = arrays[0]; 22836 22837 var index = -1, 22838 seen = caches[0]; 22839 22840 outer: 22841 while (++index < length && result.length < maxLength) { 22842 var value = array[index], 22843 computed = iteratee ? iteratee(value) : value; 22844 22845 value = (comparator || value !== 0) ? value : 0; 22846 if (!(seen 22847 ? cacheHas(seen, computed) 22848 : includes(result, computed, comparator) 22849 )) { 22850 othIndex = othLength; 22851 while (--othIndex) { 22852 var cache = caches[othIndex]; 22853 if (!(cache 22854 ? cacheHas(cache, computed) 22855 : includes(arrays[othIndex], computed, comparator)) 22856 ) { 22857 continue outer; 22858 } 22859 } 22860 if (seen) { 22861 seen.push(computed); 22862 } 22863 result.push(value); 22864 } 22865 } 22866 return result; 22867 } 22868 22869 /** 22870 * The base implementation of `_.invert` and `_.invertBy` which inverts 22871 * `object` with values transformed by `iteratee` and set by `setter`. 22872 * 22873 * @private 22874 * @param {Object} object The object to iterate over. 22875 * @param {Function} setter The function to set `accumulator` values. 22876 * @param {Function} iteratee The iteratee to transform values. 22877 * @param {Object} accumulator The initial inverted object. 22878 * @returns {Function} Returns `accumulator`. 22879 */ 22880 function baseInverter(object, setter, iteratee, accumulator) { 22881 baseForOwn(object, function(value, key, object) { 22882 setter(accumulator, iteratee(value), key, object); 22883 }); 22884 return accumulator; 22885 } 22886 22887 /** 22888 * The base implementation of `_.invoke` without support for individual 22889 * method arguments. 22890 * 22891 * @private 22892 * @param {Object} object The object to query. 22893 * @param {Array|string} path The path of the method to invoke. 22894 * @param {Array} args The arguments to invoke the method with. 22895 * @returns {*} Returns the result of the invoked method. 22896 */ 22897 function baseInvoke(object, path, args) { 22898 path = castPath(path, object); 22899 object = parent(object, path); 22900 var func = object == null ? object : object[toKey(last(path))]; 22901 return func == null ? undefined : apply(func, object, args); 22902 } 22903 22904 /** 22905 * The base implementation of `_.isArguments`. 22906 * 22907 * @private 22908 * @param {*} value The value to check. 22909 * @returns {boolean} Returns `true` if `value` is an `arguments` object, 22910 */ 22911 function baseIsArguments(value) { 22912 return isObjectLike(value) && baseGetTag(value) == argsTag; 22913 } 22914 22915 /** 22916 * The base implementation of `_.isArrayBuffer` without Node.js optimizations. 22917 * 22918 * @private 22919 * @param {*} value The value to check. 22920 * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. 22921 */ 22922 function baseIsArrayBuffer(value) { 22923 return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; 22924 } 22925 22926 /** 22927 * The base implementation of `_.isDate` without Node.js optimizations. 22928 * 22929 * @private 22930 * @param {*} value The value to check. 22931 * @returns {boolean} Returns `true` if `value` is a date object, else `false`. 22932 */ 22933 function baseIsDate(value) { 22934 return isObjectLike(value) && baseGetTag(value) == dateTag; 22935 } 22936 22937 /** 22938 * The base implementation of `_.isEqual` which supports partial comparisons 22939 * and tracks traversed objects. 22940 * 22941 * @private 22942 * @param {*} value The value to compare. 22943 * @param {*} other The other value to compare. 22944 * @param {boolean} bitmask The bitmask flags. 22945 * 1 - Unordered comparison 22946 * 2 - Partial comparison 22947 * @param {Function} [customizer] The function to customize comparisons. 22948 * @param {Object} [stack] Tracks traversed `value` and `other` objects. 22949 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 22950 */ 22951 function baseIsEqual(value, other, bitmask, customizer, stack) { 22952 if (value === other) { 22953 return true; 22954 } 22955 if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { 22956 return value !== value && other !== other; 22957 } 22958 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); 22959 } 22960 22961 /** 22962 * A specialized version of `baseIsEqual` for arrays and objects which performs 22963 * deep comparisons and tracks traversed objects enabling objects with circular 22964 * references to be compared. 22965 * 22966 * @private 22967 * @param {Object} object The object to compare. 22968 * @param {Object} other The other object to compare. 22969 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 22970 * @param {Function} customizer The function to customize comparisons. 22971 * @param {Function} equalFunc The function to determine equivalents of values. 22972 * @param {Object} [stack] Tracks traversed `object` and `other` objects. 22973 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 22974 */ 22975 function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { 22976 var objIsArr = isArray(object), 22977 othIsArr = isArray(other), 22978 objTag = objIsArr ? arrayTag : getTag(object), 22979 othTag = othIsArr ? arrayTag : getTag(other); 22980 22981 objTag = objTag == argsTag ? objectTag : objTag; 22982 othTag = othTag == argsTag ? objectTag : othTag; 22983 22984 var objIsObj = objTag == objectTag, 22985 othIsObj = othTag == objectTag, 22986 isSameTag = objTag == othTag; 22987 22988 if (isSameTag && isBuffer(object)) { 22989 if (!isBuffer(other)) { 22990 return false; 22991 } 22992 objIsArr = true; 22993 objIsObj = false; 22994 } 22995 if (isSameTag && !objIsObj) { 22996 stack || (stack = new Stack); 22997 return (objIsArr || isTypedArray(object)) 22998 ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) 22999 : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); 23000 } 23001 if (!(bitmask & COMPARE_PARTIAL_FLAG)) { 23002 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), 23003 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); 23004 23005 if (objIsWrapped || othIsWrapped) { 23006 var objUnwrapped = objIsWrapped ? object.value() : object, 23007 othUnwrapped = othIsWrapped ? other.value() : other; 23008 23009 stack || (stack = new Stack); 23010 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); 23011 } 23012 } 23013 if (!isSameTag) { 23014 return false; 23015 } 23016 stack || (stack = new Stack); 23017 return equalObjects(object, other, bitmask, customizer, equalFunc, stack); 23018 } 23019 23020 /** 23021 * The base implementation of `_.isMap` without Node.js optimizations. 23022 * 23023 * @private 23024 * @param {*} value The value to check. 23025 * @returns {boolean} Returns `true` if `value` is a map, else `false`. 23026 */ 23027 function baseIsMap(value) { 23028 return isObjectLike(value) && getTag(value) == mapTag; 23029 } 23030 23031 /** 23032 * The base implementation of `_.isMatch` without support for iteratee shorthands. 23033 * 23034 * @private 23035 * @param {Object} object The object to inspect. 23036 * @param {Object} source The object of property values to match. 23037 * @param {Array} matchData The property names, values, and compare flags to match. 23038 * @param {Function} [customizer] The function to customize comparisons. 23039 * @returns {boolean} Returns `true` if `object` is a match, else `false`. 23040 */ 23041 function baseIsMatch(object, source, matchData, customizer) { 23042 var index = matchData.length, 23043 length = index, 23044 noCustomizer = !customizer; 23045 23046 if (object == null) { 23047 return !length; 23048 } 23049 object = Object(object); 23050 while (index--) { 23051 var data = matchData[index]; 23052 if ((noCustomizer && data[2]) 23053 ? data[1] !== object[data[0]] 23054 : !(data[0] in object) 23055 ) { 23056 return false; 23057 } 23058 } 23059 while (++index < length) { 23060 data = matchData[index]; 23061 var key = data[0], 23062 objValue = object[key], 23063 srcValue = data[1]; 23064 23065 if (noCustomizer && data[2]) { 23066 if (objValue === undefined && !(key in object)) { 23067 return false; 23068 } 23069 } else { 23070 var stack = new Stack; 23071 if (customizer) { 23072 var result = customizer(objValue, srcValue, key, object, source, stack); 23073 } 23074 if (!(result === undefined 23075 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) 23076 : result 23077 )) { 23078 return false; 23079 } 23080 } 23081 } 23082 return true; 23083 } 23084 23085 /** 23086 * The base implementation of `_.isNative` without bad shim checks. 23087 * 23088 * @private 23089 * @param {*} value The value to check. 23090 * @returns {boolean} Returns `true` if `value` is a native function, 23091 * else `false`. 23092 */ 23093 function baseIsNative(value) { 23094 if (!isObject(value) || isMasked(value)) { 23095 return false; 23096 } 23097 var pattern = isFunction(value) ? reIsNative : reIsHostCtor; 23098 return pattern.test(toSource(value)); 23099 } 23100 23101 /** 23102 * The base implementation of `_.isRegExp` without Node.js optimizations. 23103 * 23104 * @private 23105 * @param {*} value The value to check. 23106 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. 23107 */ 23108 function baseIsRegExp(value) { 23109 return isObjectLike(value) && baseGetTag(value) == regexpTag; 23110 } 23111 23112 /** 23113 * The base implementation of `_.isSet` without Node.js optimizations. 23114 * 23115 * @private 23116 * @param {*} value The value to check. 23117 * @returns {boolean} Returns `true` if `value` is a set, else `false`. 23118 */ 23119 function baseIsSet(value) { 23120 return isObjectLike(value) && getTag(value) == setTag; 23121 } 23122 23123 /** 23124 * The base implementation of `_.isTypedArray` without Node.js optimizations. 23125 * 23126 * @private 23127 * @param {*} value The value to check. 23128 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. 23129 */ 23130 function baseIsTypedArray(value) { 23131 return isObjectLike(value) && 23132 isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; 23133 } 23134 23135 /** 23136 * The base implementation of `_.iteratee`. 23137 * 23138 * @private 23139 * @param {*} [value=_.identity] The value to convert to an iteratee. 23140 * @returns {Function} Returns the iteratee. 23141 */ 23142 function baseIteratee(value) { 23143 // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. 23144 // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. 23145 if (typeof value == 'function') { 23146 return value; 23147 } 23148 if (value == null) { 23149 return identity; 23150 } 23151 if (typeof value == 'object') { 23152 return isArray(value) 23153 ? baseMatchesProperty(value[0], value[1]) 23154 : baseMatches(value); 23155 } 23156 return property(value); 23157 } 23158 23159 /** 23160 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. 23161 * 23162 * @private 23163 * @param {Object} object The object to query. 23164 * @returns {Array} Returns the array of property names. 23165 */ 23166 function baseKeys(object) { 23167 if (!isPrototype(object)) { 23168 return nativeKeys(object); 23169 } 23170 var result = []; 23171 for (var key in Object(object)) { 23172 if (hasOwnProperty.call(object, key) && key != 'constructor') { 23173 result.push(key); 23174 } 23175 } 23176 return result; 23177 } 23178 23179 /** 23180 * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. 23181 * 23182 * @private 23183 * @param {Object} object The object to query. 23184 * @returns {Array} Returns the array of property names. 23185 */ 23186 function baseKeysIn(object) { 23187 if (!isObject(object)) { 23188 return nativeKeysIn(object); 23189 } 23190 var isProto = isPrototype(object), 23191 result = []; 23192 23193 for (var key in object) { 23194 if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { 23195 result.push(key); 23196 } 23197 } 23198 return result; 23199 } 23200 23201 /** 23202 * The base implementation of `_.lt` which doesn't coerce arguments. 23203 * 23204 * @private 23205 * @param {*} value The value to compare. 23206 * @param {*} other The other value to compare. 23207 * @returns {boolean} Returns `true` if `value` is less than `other`, 23208 * else `false`. 23209 */ 23210 function baseLt(value, other) { 23211 return value < other; 23212 } 23213 23214 /** 23215 * The base implementation of `_.map` without support for iteratee shorthands. 23216 * 23217 * @private 23218 * @param {Array|Object} collection The collection to iterate over. 23219 * @param {Function} iteratee The function invoked per iteration. 23220 * @returns {Array} Returns the new mapped array. 23221 */ 23222 function baseMap(collection, iteratee) { 23223 var index = -1, 23224 result = isArrayLike(collection) ? Array(collection.length) : []; 23225 23226 baseEach(collection, function(value, key, collection) { 23227 result[++index] = iteratee(value, key, collection); 23228 }); 23229 return result; 23230 } 23231 23232 /** 23233 * The base implementation of `_.matches` which doesn't clone `source`. 23234 * 23235 * @private 23236 * @param {Object} source The object of property values to match. 23237 * @returns {Function} Returns the new spec function. 23238 */ 23239 function baseMatches(source) { 23240 var matchData = getMatchData(source); 23241 if (matchData.length == 1 && matchData[0][2]) { 23242 return matchesStrictComparable(matchData[0][0], matchData[0][1]); 23243 } 23244 return function(object) { 23245 return object === source || baseIsMatch(object, source, matchData); 23246 }; 23247 } 23248 23249 /** 23250 * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. 23251 * 23252 * @private 23253 * @param {string} path The path of the property to get. 23254 * @param {*} srcValue The value to match. 23255 * @returns {Function} Returns the new spec function. 23256 */ 23257 function baseMatchesProperty(path, srcValue) { 23258 if (isKey(path) && isStrictComparable(srcValue)) { 23259 return matchesStrictComparable(toKey(path), srcValue); 23260 } 23261 return function(object) { 23262 var objValue = get(object, path); 23263 return (objValue === undefined && objValue === srcValue) 23264 ? hasIn(object, path) 23265 : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); 23266 }; 23267 } 23268 23269 /** 23270 * The base implementation of `_.merge` without support for multiple sources. 23271 * 23272 * @private 23273 * @param {Object} object The destination object. 23274 * @param {Object} source The source object. 23275 * @param {number} srcIndex The index of `source`. 23276 * @param {Function} [customizer] The function to customize merged values. 23277 * @param {Object} [stack] Tracks traversed source values and their merged 23278 * counterparts. 23279 */ 23280 function baseMerge(object, source, srcIndex, customizer, stack) { 23281 if (object === source) { 23282 return; 23283 } 23284 baseFor(source, function(srcValue, key) { 23285 stack || (stack = new Stack); 23286 if (isObject(srcValue)) { 23287 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); 23288 } 23289 else { 23290 var newValue = customizer 23291 ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) 23292 : undefined; 23293 23294 if (newValue === undefined) { 23295 newValue = srcValue; 23296 } 23297 assignMergeValue(object, key, newValue); 23298 } 23299 }, keysIn); 23300 } 23301 23302 /** 23303 * A specialized version of `baseMerge` for arrays and objects which performs 23304 * deep merges and tracks traversed objects enabling objects with circular 23305 * references to be merged. 23306 * 23307 * @private 23308 * @param {Object} object The destination object. 23309 * @param {Object} source The source object. 23310 * @param {string} key The key of the value to merge. 23311 * @param {number} srcIndex The index of `source`. 23312 * @param {Function} mergeFunc The function to merge values. 23313 * @param {Function} [customizer] The function to customize assigned values. 23314 * @param {Object} [stack] Tracks traversed source values and their merged 23315 * counterparts. 23316 */ 23317 function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { 23318 var objValue = safeGet(object, key), 23319 srcValue = safeGet(source, key), 23320 stacked = stack.get(srcValue); 23321 23322 if (stacked) { 23323 assignMergeValue(object, key, stacked); 23324 return; 23325 } 23326 var newValue = customizer 23327 ? customizer(objValue, srcValue, (key + ''), object, source, stack) 23328 : undefined; 23329 23330 var isCommon = newValue === undefined; 23331 23332 if (isCommon) { 23333 var isArr = isArray(srcValue), 23334 isBuff = !isArr && isBuffer(srcValue), 23335 isTyped = !isArr && !isBuff && isTypedArray(srcValue); 23336 23337 newValue = srcValue; 23338 if (isArr || isBuff || isTyped) { 23339 if (isArray(objValue)) { 23340 newValue = objValue; 23341 } 23342 else if (isArrayLikeObject(objValue)) { 23343 newValue = copyArray(objValue); 23344 } 23345 else if (isBuff) { 23346 isCommon = false; 23347 newValue = cloneBuffer(srcValue, true); 23348 } 23349 else if (isTyped) { 23350 isCommon = false; 23351 newValue = cloneTypedArray(srcValue, true); 23352 } 23353 else { 23354 newValue = []; 23355 } 23356 } 23357 else if (isPlainObject(srcValue) || isArguments(srcValue)) { 23358 newValue = objValue; 23359 if (isArguments(objValue)) { 23360 newValue = toPlainObject(objValue); 23361 } 23362 else if (!isObject(objValue) || isFunction(objValue)) { 23363 newValue = initCloneObject(srcValue); 23364 } 23365 } 23366 else { 23367 isCommon = false; 23368 } 23369 } 23370 if (isCommon) { 23371 // Recursively merge objects and arrays (susceptible to call stack limits). 23372 stack.set(srcValue, newValue); 23373 mergeFunc(newValue, srcValue, srcIndex, customizer, stack); 23374 stack['delete'](srcValue); 23375 } 23376 assignMergeValue(object, key, newValue); 23377 } 23378 23379 /** 23380 * The base implementation of `_.nth` which doesn't coerce arguments. 23381 * 23382 * @private 23383 * @param {Array} array The array to query. 23384 * @param {number} n The index of the element to return. 23385 * @returns {*} Returns the nth element of `array`. 23386 */ 23387 function baseNth(array, n) { 23388 var length = array.length; 23389 if (!length) { 23390 return; 23391 } 23392 n += n < 0 ? length : 0; 23393 return isIndex(n, length) ? array[n] : undefined; 23394 } 23395 23396 /** 23397 * The base implementation of `_.orderBy` without param guards. 23398 * 23399 * @private 23400 * @param {Array|Object} collection The collection to iterate over. 23401 * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. 23402 * @param {string[]} orders The sort orders of `iteratees`. 23403 * @returns {Array} Returns the new sorted array. 23404 */ 23405 function baseOrderBy(collection, iteratees, orders) { 23406 if (iteratees.length) { 23407 iteratees = arrayMap(iteratees, function(iteratee) { 23408 if (isArray(iteratee)) { 23409 return function(value) { 23410 return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); 23411 } 23412 } 23413 return iteratee; 23414 }); 23415 } else { 23416 iteratees = [identity]; 23417 } 23418 23419 var index = -1; 23420 iteratees = arrayMap(iteratees, baseUnary(getIteratee())); 23421 23422 var result = baseMap(collection, function(value, key, collection) { 23423 var criteria = arrayMap(iteratees, function(iteratee) { 23424 return iteratee(value); 23425 }); 23426 return { 'criteria': criteria, 'index': ++index, 'value': value }; 23427 }); 23428 23429 return baseSortBy(result, function(object, other) { 23430 return compareMultiple(object, other, orders); 23431 }); 23432 } 23433 23434 /** 23435 * The base implementation of `_.pick` without support for individual 23436 * property identifiers. 23437 * 23438 * @private 23439 * @param {Object} object The source object. 23440 * @param {string[]} paths The property paths to pick. 23441 * @returns {Object} Returns the new object. 23442 */ 23443 function basePick(object, paths) { 23444 return basePickBy(object, paths, function(value, path) { 23445 return hasIn(object, path); 23446 }); 23447 } 23448 23449 /** 23450 * The base implementation of `_.pickBy` without support for iteratee shorthands. 23451 * 23452 * @private 23453 * @param {Object} object The source object. 23454 * @param {string[]} paths The property paths to pick. 23455 * @param {Function} predicate The function invoked per property. 23456 * @returns {Object} Returns the new object. 23457 */ 23458 function basePickBy(object, paths, predicate) { 23459 var index = -1, 23460 length = paths.length, 23461 result = {}; 23462 23463 while (++index < length) { 23464 var path = paths[index], 23465 value = baseGet(object, path); 23466 23467 if (predicate(value, path)) { 23468 baseSet(result, castPath(path, object), value); 23469 } 23470 } 23471 return result; 23472 } 23473 23474 /** 23475 * A specialized version of `baseProperty` which supports deep paths. 23476 * 23477 * @private 23478 * @param {Array|string} path The path of the property to get. 23479 * @returns {Function} Returns the new accessor function. 23480 */ 23481 function basePropertyDeep(path) { 23482 return function(object) { 23483 return baseGet(object, path); 23484 }; 23485 } 23486 23487 /** 23488 * The base implementation of `_.pullAllBy` without support for iteratee 23489 * shorthands. 23490 * 23491 * @private 23492 * @param {Array} array The array to modify. 23493 * @param {Array} values The values to remove. 23494 * @param {Function} [iteratee] The iteratee invoked per element. 23495 * @param {Function} [comparator] The comparator invoked per element. 23496 * @returns {Array} Returns `array`. 23497 */ 23498 function basePullAll(array, values, iteratee, comparator) { 23499 var indexOf = comparator ? baseIndexOfWith : baseIndexOf, 23500 index = -1, 23501 length = values.length, 23502 seen = array; 23503 23504 if (array === values) { 23505 values = copyArray(values); 23506 } 23507 if (iteratee) { 23508 seen = arrayMap(array, baseUnary(iteratee)); 23509 } 23510 while (++index < length) { 23511 var fromIndex = 0, 23512 value = values[index], 23513 computed = iteratee ? iteratee(value) : value; 23514 23515 while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { 23516 if (seen !== array) { 23517 splice.call(seen, fromIndex, 1); 23518 } 23519 splice.call(array, fromIndex, 1); 23520 } 23521 } 23522 return array; 23523 } 23524 23525 /** 23526 * The base implementation of `_.pullAt` without support for individual 23527 * indexes or capturing the removed elements. 23528 * 23529 * @private 23530 * @param {Array} array The array to modify. 23531 * @param {number[]} indexes The indexes of elements to remove. 23532 * @returns {Array} Returns `array`. 23533 */ 23534 function basePullAt(array, indexes) { 23535 var length = array ? indexes.length : 0, 23536 lastIndex = length - 1; 23537 23538 while (length--) { 23539 var index = indexes[length]; 23540 if (length == lastIndex || index !== previous) { 23541 var previous = index; 23542 if (isIndex(index)) { 23543 splice.call(array, index, 1); 23544 } else { 23545 baseUnset(array, index); 23546 } 23547 } 23548 } 23549 return array; 23550 } 23551 23552 /** 23553 * The base implementation of `_.random` without support for returning 23554 * floating-point numbers. 23555 * 23556 * @private 23557 * @param {number} lower The lower bound. 23558 * @param {number} upper The upper bound. 23559 * @returns {number} Returns the random number. 23560 */ 23561 function baseRandom(lower, upper) { 23562 return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); 23563 } 23564 23565 /** 23566 * The base implementation of `_.range` and `_.rangeRight` which doesn't 23567 * coerce arguments. 23568 * 23569 * @private 23570 * @param {number} start The start of the range. 23571 * @param {number} end The end of the range. 23572 * @param {number} step The value to increment or decrement by. 23573 * @param {boolean} [fromRight] Specify iterating from right to left. 23574 * @returns {Array} Returns the range of numbers. 23575 */ 23576 function baseRange(start, end, step, fromRight) { 23577 var index = -1, 23578 length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), 23579 result = Array(length); 23580 23581 while (length--) { 23582 result[fromRight ? length : ++index] = start; 23583 start += step; 23584 } 23585 return result; 23586 } 23587 23588 /** 23589 * The base implementation of `_.repeat` which doesn't coerce arguments. 23590 * 23591 * @private 23592 * @param {string} string The string to repeat. 23593 * @param {number} n The number of times to repeat the string. 23594 * @returns {string} Returns the repeated string. 23595 */ 23596 function baseRepeat(string, n) { 23597 var result = ''; 23598 if (!string || n < 1 || n > MAX_SAFE_INTEGER) { 23599 return result; 23600 } 23601 // Leverage the exponentiation by squaring algorithm for a faster repeat. 23602 // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. 23603 do { 23604 if (n % 2) { 23605 result += string; 23606 } 23607 n = nativeFloor(n / 2); 23608 if (n) { 23609 string += string; 23610 } 23611 } while (n); 23612 23613 return result; 23614 } 23615 23616 /** 23617 * The base implementation of `_.rest` which doesn't validate or coerce arguments. 23618 * 23619 * @private 23620 * @param {Function} func The function to apply a rest parameter to. 23621 * @param {number} [start=func.length-1] The start position of the rest parameter. 23622 * @returns {Function} Returns the new function. 23623 */ 23624 function baseRest(func, start) { 23625 return setToString(overRest(func, start, identity), func + ''); 23626 } 23627 23628 /** 23629 * The base implementation of `_.sample`. 23630 * 23631 * @private 23632 * @param {Array|Object} collection The collection to sample. 23633 * @returns {*} Returns the random element. 23634 */ 23635 function baseSample(collection) { 23636 return arraySample(values(collection)); 23637 } 23638 23639 /** 23640 * The base implementation of `_.sampleSize` without param guards. 23641 * 23642 * @private 23643 * @param {Array|Object} collection The collection to sample. 23644 * @param {number} n The number of elements to sample. 23645 * @returns {Array} Returns the random elements. 23646 */ 23647 function baseSampleSize(collection, n) { 23648 var array = values(collection); 23649 return shuffleSelf(array, baseClamp(n, 0, array.length)); 23650 } 23651 23652 /** 23653 * The base implementation of `_.set`. 23654 * 23655 * @private 23656 * @param {Object} object The object to modify. 23657 * @param {Array|string} path The path of the property to set. 23658 * @param {*} value The value to set. 23659 * @param {Function} [customizer] The function to customize path creation. 23660 * @returns {Object} Returns `object`. 23661 */ 23662 function baseSet(object, path, value, customizer) { 23663 if (!isObject(object)) { 23664 return object; 23665 } 23666 path = castPath(path, object); 23667 23668 var index = -1, 23669 length = path.length, 23670 lastIndex = length - 1, 23671 nested = object; 23672 23673 while (nested != null && ++index < length) { 23674 var key = toKey(path[index]), 23675 newValue = value; 23676 23677 if (key === '__proto__' || key === 'constructor' || key === 'prototype') { 23678 return object; 23679 } 23680 23681 if (index != lastIndex) { 23682 var objValue = nested[key]; 23683 newValue = customizer ? customizer(objValue, key, nested) : undefined; 23684 if (newValue === undefined) { 23685 newValue = isObject(objValue) 23686 ? objValue 23687 : (isIndex(path[index + 1]) ? [] : {}); 23688 } 23689 } 23690 assignValue(nested, key, newValue); 23691 nested = nested[key]; 23692 } 23693 return object; 23694 } 23695 23696 /** 23697 * The base implementation of `setData` without support for hot loop shorting. 23698 * 23699 * @private 23700 * @param {Function} func The function to associate metadata with. 23701 * @param {*} data The metadata. 23702 * @returns {Function} Returns `func`. 23703 */ 23704 var baseSetData = !metaMap ? identity : function(func, data) { 23705 metaMap.set(func, data); 23706 return func; 23707 }; 23708 23709 /** 23710 * The base implementation of `setToString` without support for hot loop shorting. 23711 * 23712 * @private 23713 * @param {Function} func The function to modify. 23714 * @param {Function} string The `toString` result. 23715 * @returns {Function} Returns `func`. 23716 */ 23717 var baseSetToString = !defineProperty ? identity : function(func, string) { 23718 return defineProperty(func, 'toString', { 23719 'configurable': true, 23720 'enumerable': false, 23721 'value': constant(string), 23722 'writable': true 23723 }); 23724 }; 23725 23726 /** 23727 * The base implementation of `_.shuffle`. 23728 * 23729 * @private 23730 * @param {Array|Object} collection The collection to shuffle. 23731 * @returns {Array} Returns the new shuffled array. 23732 */ 23733 function baseShuffle(collection) { 23734 return shuffleSelf(values(collection)); 23735 } 23736 23737 /** 23738 * The base implementation of `_.slice` without an iteratee call guard. 23739 * 23740 * @private 23741 * @param {Array} array The array to slice. 23742 * @param {number} [start=0] The start position. 23743 * @param {number} [end=array.length] The end position. 23744 * @returns {Array} Returns the slice of `array`. 23745 */ 23746 function baseSlice(array, start, end) { 23747 var index = -1, 23748 length = array.length; 23749 23750 if (start < 0) { 23751 start = -start > length ? 0 : (length + start); 23752 } 23753 end = end > length ? length : end; 23754 if (end < 0) { 23755 end += length; 23756 } 23757 length = start > end ? 0 : ((end - start) >>> 0); 23758 start >>>= 0; 23759 23760 var result = Array(length); 23761 while (++index < length) { 23762 result[index] = array[index + start]; 23763 } 23764 return result; 23765 } 23766 23767 /** 23768 * The base implementation of `_.some` without support for iteratee shorthands. 23769 * 23770 * @private 23771 * @param {Array|Object} collection The collection to iterate over. 23772 * @param {Function} predicate The function invoked per iteration. 23773 * @returns {boolean} Returns `true` if any element passes the predicate check, 23774 * else `false`. 23775 */ 23776 function baseSome(collection, predicate) { 23777 var result; 23778 23779 baseEach(collection, function(value, index, collection) { 23780 result = predicate(value, index, collection); 23781 return !result; 23782 }); 23783 return !!result; 23784 } 23785 23786 /** 23787 * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which 23788 * performs a binary search of `array` to determine the index at which `value` 23789 * should be inserted into `array` in order to maintain its sort order. 23790 * 23791 * @private 23792 * @param {Array} array The sorted array to inspect. 23793 * @param {*} value The value to evaluate. 23794 * @param {boolean} [retHighest] Specify returning the highest qualified index. 23795 * @returns {number} Returns the index at which `value` should be inserted 23796 * into `array`. 23797 */ 23798 function baseSortedIndex(array, value, retHighest) { 23799 var low = 0, 23800 high = array == null ? low : array.length; 23801 23802 if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { 23803 while (low < high) { 23804 var mid = (low + high) >>> 1, 23805 computed = array[mid]; 23806 23807 if (computed !== null && !isSymbol(computed) && 23808 (retHighest ? (computed <= value) : (computed < value))) { 23809 low = mid + 1; 23810 } else { 23811 high = mid; 23812 } 23813 } 23814 return high; 23815 } 23816 return baseSortedIndexBy(array, value, identity, retHighest); 23817 } 23818 23819 /** 23820 * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` 23821 * which invokes `iteratee` for `value` and each element of `array` to compute 23822 * their sort ranking. The iteratee is invoked with one argument; (value). 23823 * 23824 * @private 23825 * @param {Array} array The sorted array to inspect. 23826 * @param {*} value The value to evaluate. 23827 * @param {Function} iteratee The iteratee invoked per element. 23828 * @param {boolean} [retHighest] Specify returning the highest qualified index. 23829 * @returns {number} Returns the index at which `value` should be inserted 23830 * into `array`. 23831 */ 23832 function baseSortedIndexBy(array, value, iteratee, retHighest) { 23833 var low = 0, 23834 high = array == null ? 0 : array.length; 23835 if (high === 0) { 23836 return 0; 23837 } 23838 23839 value = iteratee(value); 23840 var valIsNaN = value !== value, 23841 valIsNull = value === null, 23842 valIsSymbol = isSymbol(value), 23843 valIsUndefined = value === undefined; 23844 23845 while (low < high) { 23846 var mid = nativeFloor((low + high) / 2), 23847 computed = iteratee(array[mid]), 23848 othIsDefined = computed !== undefined, 23849 othIsNull = computed === null, 23850 othIsReflexive = computed === computed, 23851 othIsSymbol = isSymbol(computed); 23852 23853 if (valIsNaN) { 23854 var setLow = retHighest || othIsReflexive; 23855 } else if (valIsUndefined) { 23856 setLow = othIsReflexive && (retHighest || othIsDefined); 23857 } else if (valIsNull) { 23858 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); 23859 } else if (valIsSymbol) { 23860 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); 23861 } else if (othIsNull || othIsSymbol) { 23862 setLow = false; 23863 } else { 23864 setLow = retHighest ? (computed <= value) : (computed < value); 23865 } 23866 if (setLow) { 23867 low = mid + 1; 23868 } else { 23869 high = mid; 23870 } 23871 } 23872 return nativeMin(high, MAX_ARRAY_INDEX); 23873 } 23874 23875 /** 23876 * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without 23877 * support for iteratee shorthands. 23878 * 23879 * @private 23880 * @param {Array} array The array to inspect. 23881 * @param {Function} [iteratee] The iteratee invoked per element. 23882 * @returns {Array} Returns the new duplicate free array. 23883 */ 23884 function baseSortedUniq(array, iteratee) { 23885 var index = -1, 23886 length = array.length, 23887 resIndex = 0, 23888 result = []; 23889 23890 while (++index < length) { 23891 var value = array[index], 23892 computed = iteratee ? iteratee(value) : value; 23893 23894 if (!index || !eq(computed, seen)) { 23895 var seen = computed; 23896 result[resIndex++] = value === 0 ? 0 : value; 23897 } 23898 } 23899 return result; 23900 } 23901 23902 /** 23903 * The base implementation of `_.toNumber` which doesn't ensure correct 23904 * conversions of binary, hexadecimal, or octal string values. 23905 * 23906 * @private 23907 * @param {*} value The value to process. 23908 * @returns {number} Returns the number. 23909 */ 23910 function baseToNumber(value) { 23911 if (typeof value == 'number') { 23912 return value; 23913 } 23914 if (isSymbol(value)) { 23915 return NAN; 23916 } 23917 return +value; 23918 } 23919 23920 /** 23921 * The base implementation of `_.toString` which doesn't convert nullish 23922 * values to empty strings. 23923 * 23924 * @private 23925 * @param {*} value The value to process. 23926 * @returns {string} Returns the string. 23927 */ 23928 function baseToString(value) { 23929 // Exit early for strings to avoid a performance hit in some environments. 23930 if (typeof value == 'string') { 23931 return value; 23932 } 23933 if (isArray(value)) { 23934 // Recursively convert values (susceptible to call stack limits). 23935 return arrayMap(value, baseToString) + ''; 23936 } 23937 if (isSymbol(value)) { 23938 return symbolToString ? symbolToString.call(value) : ''; 23939 } 23940 var result = (value + ''); 23941 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; 23942 } 23943 23944 /** 23945 * The base implementation of `_.uniqBy` without support for iteratee shorthands. 23946 * 23947 * @private 23948 * @param {Array} array The array to inspect. 23949 * @param {Function} [iteratee] The iteratee invoked per element. 23950 * @param {Function} [comparator] The comparator invoked per element. 23951 * @returns {Array} Returns the new duplicate free array. 23952 */ 23953 function baseUniq(array, iteratee, comparator) { 23954 var index = -1, 23955 includes = arrayIncludes, 23956 length = array.length, 23957 isCommon = true, 23958 result = [], 23959 seen = result; 23960 23961 if (comparator) { 23962 isCommon = false; 23963 includes = arrayIncludesWith; 23964 } 23965 else if (length >= LARGE_ARRAY_SIZE) { 23966 var set = iteratee ? null : createSet(array); 23967 if (set) { 23968 return setToArray(set); 23969 } 23970 isCommon = false; 23971 includes = cacheHas; 23972 seen = new SetCache; 23973 } 23974 else { 23975 seen = iteratee ? [] : result; 23976 } 23977 outer: 23978 while (++index < length) { 23979 var value = array[index], 23980 computed = iteratee ? iteratee(value) : value; 23981 23982 value = (comparator || value !== 0) ? value : 0; 23983 if (isCommon && computed === computed) { 23984 var seenIndex = seen.length; 23985 while (seenIndex--) { 23986 if (seen[seenIndex] === computed) { 23987 continue outer; 23988 } 23989 } 23990 if (iteratee) { 23991 seen.push(computed); 23992 } 23993 result.push(value); 23994 } 23995 else if (!includes(seen, computed, comparator)) { 23996 if (seen !== result) { 23997 seen.push(computed); 23998 } 23999 result.push(value); 24000 } 24001 } 24002 return result; 24003 } 24004 24005 /** 24006 * The base implementation of `_.unset`. 24007 * 24008 * @private 24009 * @param {Object} object The object to modify. 24010 * @param {Array|string} path The property path to unset. 24011 * @returns {boolean} Returns `true` if the property is deleted, else `false`. 24012 */ 24013 function baseUnset(object, path) { 24014 path = castPath(path, object); 24015 object = parent(object, path); 24016 return object == null || delete object[toKey(last(path))]; 24017 } 24018 24019 /** 24020 * The base implementation of `_.update`. 24021 * 24022 * @private 24023 * @param {Object} object The object to modify. 24024 * @param {Array|string} path The path of the property to update. 24025 * @param {Function} updater The function to produce the updated value. 24026 * @param {Function} [customizer] The function to customize path creation. 24027 * @returns {Object} Returns `object`. 24028 */ 24029 function baseUpdate(object, path, updater, customizer) { 24030 return baseSet(object, path, updater(baseGet(object, path)), customizer); 24031 } 24032 24033 /** 24034 * The base implementation of methods like `_.dropWhile` and `_.takeWhile` 24035 * without support for iteratee shorthands. 24036 * 24037 * @private 24038 * @param {Array} array The array to query. 24039 * @param {Function} predicate The function invoked per iteration. 24040 * @param {boolean} [isDrop] Specify dropping elements instead of taking them. 24041 * @param {boolean} [fromRight] Specify iterating from right to left. 24042 * @returns {Array} Returns the slice of `array`. 24043 */ 24044 function baseWhile(array, predicate, isDrop, fromRight) { 24045 var length = array.length, 24046 index = fromRight ? length : -1; 24047 24048 while ((fromRight ? index-- : ++index < length) && 24049 predicate(array[index], index, array)) {} 24050 24051 return isDrop 24052 ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) 24053 : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); 24054 } 24055 24056 /** 24057 * The base implementation of `wrapperValue` which returns the result of 24058 * performing a sequence of actions on the unwrapped `value`, where each 24059 * successive action is supplied the return value of the previous. 24060 * 24061 * @private 24062 * @param {*} value The unwrapped value. 24063 * @param {Array} actions Actions to perform to resolve the unwrapped value. 24064 * @returns {*} Returns the resolved value. 24065 */ 24066 function baseWrapperValue(value, actions) { 24067 var result = value; 24068 if (result instanceof LazyWrapper) { 24069 result = result.value(); 24070 } 24071 return arrayReduce(actions, function(result, action) { 24072 return action.func.apply(action.thisArg, arrayPush([result], action.args)); 24073 }, result); 24074 } 24075 24076 /** 24077 * The base implementation of methods like `_.xor`, without support for 24078 * iteratee shorthands, that accepts an array of arrays to inspect. 24079 * 24080 * @private 24081 * @param {Array} arrays The arrays to inspect. 24082 * @param {Function} [iteratee] The iteratee invoked per element. 24083 * @param {Function} [comparator] The comparator invoked per element. 24084 * @returns {Array} Returns the new array of values. 24085 */ 24086 function baseXor(arrays, iteratee, comparator) { 24087 var length = arrays.length; 24088 if (length < 2) { 24089 return length ? baseUniq(arrays[0]) : []; 24090 } 24091 var index = -1, 24092 result = Array(length); 24093 24094 while (++index < length) { 24095 var array = arrays[index], 24096 othIndex = -1; 24097 24098 while (++othIndex < length) { 24099 if (othIndex != index) { 24100 result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); 24101 } 24102 } 24103 } 24104 return baseUniq(baseFlatten(result, 1), iteratee, comparator); 24105 } 24106 24107 /** 24108 * This base implementation of `_.zipObject` which assigns values using `assignFunc`. 24109 * 24110 * @private 24111 * @param {Array} props The property identifiers. 24112 * @param {Array} values The property values. 24113 * @param {Function} assignFunc The function to assign values. 24114 * @returns {Object} Returns the new object. 24115 */ 24116 function baseZipObject(props, values, assignFunc) { 24117 var index = -1, 24118 length = props.length, 24119 valsLength = values.length, 24120 result = {}; 24121 24122 while (++index < length) { 24123 var value = index < valsLength ? values[index] : undefined; 24124 assignFunc(result, props[index], value); 24125 } 24126 return result; 24127 } 24128 24129 /** 24130 * Casts `value` to an empty array if it's not an array like object. 24131 * 24132 * @private 24133 * @param {*} value The value to inspect. 24134 * @returns {Array|Object} Returns the cast array-like object. 24135 */ 24136 function castArrayLikeObject(value) { 24137 return isArrayLikeObject(value) ? value : []; 24138 } 24139 24140 /** 24141 * Casts `value` to `identity` if it's not a function. 24142 * 24143 * @private 24144 * @param {*} value The value to inspect. 24145 * @returns {Function} Returns cast function. 24146 */ 24147 function castFunction(value) { 24148 return typeof value == 'function' ? value : identity; 24149 } 24150 24151 /** 24152 * Casts `value` to a path array if it's not one. 24153 * 24154 * @private 24155 * @param {*} value The value to inspect. 24156 * @param {Object} [object] The object to query keys on. 24157 * @returns {Array} Returns the cast property path array. 24158 */ 24159 function castPath(value, object) { 24160 if (isArray(value)) { 24161 return value; 24162 } 24163 return isKey(value, object) ? [value] : stringToPath(toString(value)); 24164 } 24165 24166 /** 24167 * A `baseRest` alias which can be replaced with `identity` by module 24168 * replacement plugins. 24169 * 24170 * @private 24171 * @type {Function} 24172 * @param {Function} func The function to apply a rest parameter to. 24173 * @returns {Function} Returns the new function. 24174 */ 24175 var castRest = baseRest; 24176 24177 /** 24178 * Casts `array` to a slice if it's needed. 24179 * 24180 * @private 24181 * @param {Array} array The array to inspect. 24182 * @param {number} start The start position. 24183 * @param {number} [end=array.length] The end position. 24184 * @returns {Array} Returns the cast slice. 24185 */ 24186 function castSlice(array, start, end) { 24187 var length = array.length; 24188 end = end === undefined ? length : end; 24189 return (!start && end >= length) ? array : baseSlice(array, start, end); 24190 } 24191 24192 /** 24193 * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout). 24194 * 24195 * @private 24196 * @param {number|Object} id The timer id or timeout object of the timer to clear. 24197 */ 24198 var clearTimeout = ctxClearTimeout || function(id) { 24199 return root.clearTimeout(id); 24200 }; 24201 24202 /** 24203 * Creates a clone of `buffer`. 24204 * 24205 * @private 24206 * @param {Buffer} buffer The buffer to clone. 24207 * @param {boolean} [isDeep] Specify a deep clone. 24208 * @returns {Buffer} Returns the cloned buffer. 24209 */ 24210 function cloneBuffer(buffer, isDeep) { 24211 if (isDeep) { 24212 return buffer.slice(); 24213 } 24214 var length = buffer.length, 24215 result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); 24216 24217 buffer.copy(result); 24218 return result; 24219 } 24220 24221 /** 24222 * Creates a clone of `arrayBuffer`. 24223 * 24224 * @private 24225 * @param {ArrayBuffer} arrayBuffer The array buffer to clone. 24226 * @returns {ArrayBuffer} Returns the cloned array buffer. 24227 */ 24228 function cloneArrayBuffer(arrayBuffer) { 24229 var result = new arrayBuffer.constructor(arrayBuffer.byteLength); 24230 new Uint8Array(result).set(new Uint8Array(arrayBuffer)); 24231 return result; 24232 } 24233 24234 /** 24235 * Creates a clone of `dataView`. 24236 * 24237 * @private 24238 * @param {Object} dataView The data view to clone. 24239 * @param {boolean} [isDeep] Specify a deep clone. 24240 * @returns {Object} Returns the cloned data view. 24241 */ 24242 function cloneDataView(dataView, isDeep) { 24243 var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; 24244 return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); 24245 } 24246 24247 /** 24248 * Creates a clone of `regexp`. 24249 * 24250 * @private 24251 * @param {Object} regexp The regexp to clone. 24252 * @returns {Object} Returns the cloned regexp. 24253 */ 24254 function cloneRegExp(regexp) { 24255 var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); 24256 result.lastIndex = regexp.lastIndex; 24257 return result; 24258 } 24259 24260 /** 24261 * Creates a clone of the `symbol` object. 24262 * 24263 * @private 24264 * @param {Object} symbol The symbol object to clone. 24265 * @returns {Object} Returns the cloned symbol object. 24266 */ 24267 function cloneSymbol(symbol) { 24268 return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; 24269 } 24270 24271 /** 24272 * Creates a clone of `typedArray`. 24273 * 24274 * @private 24275 * @param {Object} typedArray The typed array to clone. 24276 * @param {boolean} [isDeep] Specify a deep clone. 24277 * @returns {Object} Returns the cloned typed array. 24278 */ 24279 function cloneTypedArray(typedArray, isDeep) { 24280 var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; 24281 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); 24282 } 24283 24284 /** 24285 * Compares values to sort them in ascending order. 24286 * 24287 * @private 24288 * @param {*} value The value to compare. 24289 * @param {*} other The other value to compare. 24290 * @returns {number} Returns the sort order indicator for `value`. 24291 */ 24292 function compareAscending(value, other) { 24293 if (value !== other) { 24294 var valIsDefined = value !== undefined, 24295 valIsNull = value === null, 24296 valIsReflexive = value === value, 24297 valIsSymbol = isSymbol(value); 24298 24299 var othIsDefined = other !== undefined, 24300 othIsNull = other === null, 24301 othIsReflexive = other === other, 24302 othIsSymbol = isSymbol(other); 24303 24304 if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || 24305 (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || 24306 (valIsNull && othIsDefined && othIsReflexive) || 24307 (!valIsDefined && othIsReflexive) || 24308 !valIsReflexive) { 24309 return 1; 24310 } 24311 if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || 24312 (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || 24313 (othIsNull && valIsDefined && valIsReflexive) || 24314 (!othIsDefined && valIsReflexive) || 24315 !othIsReflexive) { 24316 return -1; 24317 } 24318 } 24319 return 0; 24320 } 24321 24322 /** 24323 * Used by `_.orderBy` to compare multiple properties of a value to another 24324 * and stable sort them. 24325 * 24326 * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, 24327 * specify an order of "desc" for descending or "asc" for ascending sort order 24328 * of corresponding values. 24329 * 24330 * @private 24331 * @param {Object} object The object to compare. 24332 * @param {Object} other The other object to compare. 24333 * @param {boolean[]|string[]} orders The order to sort by for each property. 24334 * @returns {number} Returns the sort order indicator for `object`. 24335 */ 24336 function compareMultiple(object, other, orders) { 24337 var index = -1, 24338 objCriteria = object.criteria, 24339 othCriteria = other.criteria, 24340 length = objCriteria.length, 24341 ordersLength = orders.length; 24342 24343 while (++index < length) { 24344 var result = compareAscending(objCriteria[index], othCriteria[index]); 24345 if (result) { 24346 if (index >= ordersLength) { 24347 return result; 24348 } 24349 var order = orders[index]; 24350 return result * (order == 'desc' ? -1 : 1); 24351 } 24352 } 24353 // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications 24354 // that causes it, under certain circumstances, to provide the same value for 24355 // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 24356 // for more details. 24357 // 24358 // This also ensures a stable sort in V8 and other engines. 24359 // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. 24360 return object.index - other.index; 24361 } 24362 24363 /** 24364 * Creates an array that is the composition of partially applied arguments, 24365 * placeholders, and provided arguments into a single array of arguments. 24366 * 24367 * @private 24368 * @param {Array} args The provided arguments. 24369 * @param {Array} partials The arguments to prepend to those provided. 24370 * @param {Array} holders The `partials` placeholder indexes. 24371 * @params {boolean} [isCurried] Specify composing for a curried function. 24372 * @returns {Array} Returns the new array of composed arguments. 24373 */ 24374 function composeArgs(args, partials, holders, isCurried) { 24375 var argsIndex = -1, 24376 argsLength = args.length, 24377 holdersLength = holders.length, 24378 leftIndex = -1, 24379 leftLength = partials.length, 24380 rangeLength = nativeMax(argsLength - holdersLength, 0), 24381 result = Array(leftLength + rangeLength), 24382 isUncurried = !isCurried; 24383 24384 while (++leftIndex < leftLength) { 24385 result[leftIndex] = partials[leftIndex]; 24386 } 24387 while (++argsIndex < holdersLength) { 24388 if (isUncurried || argsIndex < argsLength) { 24389 result[holders[argsIndex]] = args[argsIndex]; 24390 } 24391 } 24392 while (rangeLength--) { 24393 result[leftIndex++] = args[argsIndex++]; 24394 } 24395 return result; 24396 } 24397 24398 /** 24399 * This function is like `composeArgs` except that the arguments composition 24400 * is tailored for `_.partialRight`. 24401 * 24402 * @private 24403 * @param {Array} args The provided arguments. 24404 * @param {Array} partials The arguments to append to those provided. 24405 * @param {Array} holders The `partials` placeholder indexes. 24406 * @params {boolean} [isCurried] Specify composing for a curried function. 24407 * @returns {Array} Returns the new array of composed arguments. 24408 */ 24409 function composeArgsRight(args, partials, holders, isCurried) { 24410 var argsIndex = -1, 24411 argsLength = args.length, 24412 holdersIndex = -1, 24413 holdersLength = holders.length, 24414 rightIndex = -1, 24415 rightLength = partials.length, 24416 rangeLength = nativeMax(argsLength - holdersLength, 0), 24417 result = Array(rangeLength + rightLength), 24418 isUncurried = !isCurried; 24419 24420 while (++argsIndex < rangeLength) { 24421 result[argsIndex] = args[argsIndex]; 24422 } 24423 var offset = argsIndex; 24424 while (++rightIndex < rightLength) { 24425 result[offset + rightIndex] = partials[rightIndex]; 24426 } 24427 while (++holdersIndex < holdersLength) { 24428 if (isUncurried || argsIndex < argsLength) { 24429 result[offset + holders[holdersIndex]] = args[argsIndex++]; 24430 } 24431 } 24432 return result; 24433 } 24434 24435 /** 24436 * Copies the values of `source` to `array`. 24437 * 24438 * @private 24439 * @param {Array} source The array to copy values from. 24440 * @param {Array} [array=[]] The array to copy values to. 24441 * @returns {Array} Returns `array`. 24442 */ 24443 function copyArray(source, array) { 24444 var index = -1, 24445 length = source.length; 24446 24447 array || (array = Array(length)); 24448 while (++index < length) { 24449 array[index] = source[index]; 24450 } 24451 return array; 24452 } 24453 24454 /** 24455 * Copies properties of `source` to `object`. 24456 * 24457 * @private 24458 * @param {Object} source The object to copy properties from. 24459 * @param {Array} props The property identifiers to copy. 24460 * @param {Object} [object={}] The object to copy properties to. 24461 * @param {Function} [customizer] The function to customize copied values. 24462 * @returns {Object} Returns `object`. 24463 */ 24464 function copyObject(source, props, object, customizer) { 24465 var isNew = !object; 24466 object || (object = {}); 24467 24468 var index = -1, 24469 length = props.length; 24470 24471 while (++index < length) { 24472 var key = props[index]; 24473 24474 var newValue = customizer 24475 ? customizer(object[key], source[key], key, object, source) 24476 : undefined; 24477 24478 if (newValue === undefined) { 24479 newValue = source[key]; 24480 } 24481 if (isNew) { 24482 baseAssignValue(object, key, newValue); 24483 } else { 24484 assignValue(object, key, newValue); 24485 } 24486 } 24487 return object; 24488 } 24489 24490 /** 24491 * Copies own symbols of `source` to `object`. 24492 * 24493 * @private 24494 * @param {Object} source The object to copy symbols from. 24495 * @param {Object} [object={}] The object to copy symbols to. 24496 * @returns {Object} Returns `object`. 24497 */ 24498 function copySymbols(source, object) { 24499 return copyObject(source, getSymbols(source), object); 24500 } 24501 24502 /** 24503 * Copies own and inherited symbols of `source` to `object`. 24504 * 24505 * @private 24506 * @param {Object} source The object to copy symbols from. 24507 * @param {Object} [object={}] The object to copy symbols to. 24508 * @returns {Object} Returns `object`. 24509 */ 24510 function copySymbolsIn(source, object) { 24511 return copyObject(source, getSymbolsIn(source), object); 24512 } 24513 24514 /** 24515 * Creates a function like `_.groupBy`. 24516 * 24517 * @private 24518 * @param {Function} setter The function to set accumulator values. 24519 * @param {Function} [initializer] The accumulator object initializer. 24520 * @returns {Function} Returns the new aggregator function. 24521 */ 24522 function createAggregator(setter, initializer) { 24523 return function(collection, iteratee) { 24524 var func = isArray(collection) ? arrayAggregator : baseAggregator, 24525 accumulator = initializer ? initializer() : {}; 24526 24527 return func(collection, setter, getIteratee(iteratee, 2), accumulator); 24528 }; 24529 } 24530 24531 /** 24532 * Creates a function like `_.assign`. 24533 * 24534 * @private 24535 * @param {Function} assigner The function to assign values. 24536 * @returns {Function} Returns the new assigner function. 24537 */ 24538 function createAssigner(assigner) { 24539 return baseRest(function(object, sources) { 24540 var index = -1, 24541 length = sources.length, 24542 customizer = length > 1 ? sources[length - 1] : undefined, 24543 guard = length > 2 ? sources[2] : undefined; 24544 24545 customizer = (assigner.length > 3 && typeof customizer == 'function') 24546 ? (length--, customizer) 24547 : undefined; 24548 24549 if (guard && isIterateeCall(sources[0], sources[1], guard)) { 24550 customizer = length < 3 ? undefined : customizer; 24551 length = 1; 24552 } 24553 object = Object(object); 24554 while (++index < length) { 24555 var source = sources[index]; 24556 if (source) { 24557 assigner(object, source, index, customizer); 24558 } 24559 } 24560 return object; 24561 }); 24562 } 24563 24564 /** 24565 * Creates a `baseEach` or `baseEachRight` function. 24566 * 24567 * @private 24568 * @param {Function} eachFunc The function to iterate over a collection. 24569 * @param {boolean} [fromRight] Specify iterating from right to left. 24570 * @returns {Function} Returns the new base function. 24571 */ 24572 function createBaseEach(eachFunc, fromRight) { 24573 return function(collection, iteratee) { 24574 if (collection == null) { 24575 return collection; 24576 } 24577 if (!isArrayLike(collection)) { 24578 return eachFunc(collection, iteratee); 24579 } 24580 var length = collection.length, 24581 index = fromRight ? length : -1, 24582 iterable = Object(collection); 24583 24584 while ((fromRight ? index-- : ++index < length)) { 24585 if (iteratee(iterable[index], index, iterable) === false) { 24586 break; 24587 } 24588 } 24589 return collection; 24590 }; 24591 } 24592 24593 /** 24594 * Creates a base function for methods like `_.forIn` and `_.forOwn`. 24595 * 24596 * @private 24597 * @param {boolean} [fromRight] Specify iterating from right to left. 24598 * @returns {Function} Returns the new base function. 24599 */ 24600 function createBaseFor(fromRight) { 24601 return function(object, iteratee, keysFunc) { 24602 var index = -1, 24603 iterable = Object(object), 24604 props = keysFunc(object), 24605 length = props.length; 24606 24607 while (length--) { 24608 var key = props[fromRight ? length : ++index]; 24609 if (iteratee(iterable[key], key, iterable) === false) { 24610 break; 24611 } 24612 } 24613 return object; 24614 }; 24615 } 24616 24617 /** 24618 * Creates a function that wraps `func` to invoke it with the optional `this` 24619 * binding of `thisArg`. 24620 * 24621 * @private 24622 * @param {Function} func The function to wrap. 24623 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 24624 * @param {*} [thisArg] The `this` binding of `func`. 24625 * @returns {Function} Returns the new wrapped function. 24626 */ 24627 function createBind(func, bitmask, thisArg) { 24628 var isBind = bitmask & WRAP_BIND_FLAG, 24629 Ctor = createCtor(func); 24630 24631 function wrapper() { 24632 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 24633 return fn.apply(isBind ? thisArg : this, arguments); 24634 } 24635 return wrapper; 24636 } 24637 24638 /** 24639 * Creates a function like `_.lowerFirst`. 24640 * 24641 * @private 24642 * @param {string} methodName The name of the `String` case method to use. 24643 * @returns {Function} Returns the new case function. 24644 */ 24645 function createCaseFirst(methodName) { 24646 return function(string) { 24647 string = toString(string); 24648 24649 var strSymbols = hasUnicode(string) 24650 ? stringToArray(string) 24651 : undefined; 24652 24653 var chr = strSymbols 24654 ? strSymbols[0] 24655 : string.charAt(0); 24656 24657 var trailing = strSymbols 24658 ? castSlice(strSymbols, 1).join('') 24659 : string.slice(1); 24660 24661 return chr[methodName]() + trailing; 24662 }; 24663 } 24664 24665 /** 24666 * Creates a function like `_.camelCase`. 24667 * 24668 * @private 24669 * @param {Function} callback The function to combine each word. 24670 * @returns {Function} Returns the new compounder function. 24671 */ 24672 function createCompounder(callback) { 24673 return function(string) { 24674 return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); 24675 }; 24676 } 24677 24678 /** 24679 * Creates a function that produces an instance of `Ctor` regardless of 24680 * whether it was invoked as part of a `new` expression or by `call` or `apply`. 24681 * 24682 * @private 24683 * @param {Function} Ctor The constructor to wrap. 24684 * @returns {Function} Returns the new wrapped function. 24685 */ 24686 function createCtor(Ctor) { 24687 return function() { 24688 // Use a `switch` statement to work with class constructors. See 24689 // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist 24690 // for more details. 24691 var args = arguments; 24692 switch (args.length) { 24693 case 0: return new Ctor; 24694 case 1: return new Ctor(args[0]); 24695 case 2: return new Ctor(args[0], args[1]); 24696 case 3: return new Ctor(args[0], args[1], args[2]); 24697 case 4: return new Ctor(args[0], args[1], args[2], args[3]); 24698 case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); 24699 case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); 24700 case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); 24701 } 24702 var thisBinding = baseCreate(Ctor.prototype), 24703 result = Ctor.apply(thisBinding, args); 24704 24705 // Mimic the constructor's `return` behavior. 24706 // See https://es5.github.io/#x13.2.2 for more details. 24707 return isObject(result) ? result : thisBinding; 24708 }; 24709 } 24710 24711 /** 24712 * Creates a function that wraps `func` to enable currying. 24713 * 24714 * @private 24715 * @param {Function} func The function to wrap. 24716 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 24717 * @param {number} arity The arity of `func`. 24718 * @returns {Function} Returns the new wrapped function. 24719 */ 24720 function createCurry(func, bitmask, arity) { 24721 var Ctor = createCtor(func); 24722 24723 function wrapper() { 24724 var length = arguments.length, 24725 args = Array(length), 24726 index = length, 24727 placeholder = getHolder(wrapper); 24728 24729 while (index--) { 24730 args[index] = arguments[index]; 24731 } 24732 var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) 24733 ? [] 24734 : replaceHolders(args, placeholder); 24735 24736 length -= holders.length; 24737 if (length < arity) { 24738 return createRecurry( 24739 func, bitmask, createHybrid, wrapper.placeholder, undefined, 24740 args, holders, undefined, undefined, arity - length); 24741 } 24742 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 24743 return apply(fn, this, args); 24744 } 24745 return wrapper; 24746 } 24747 24748 /** 24749 * Creates a `_.find` or `_.findLast` function. 24750 * 24751 * @private 24752 * @param {Function} findIndexFunc The function to find the collection index. 24753 * @returns {Function} Returns the new find function. 24754 */ 24755 function createFind(findIndexFunc) { 24756 return function(collection, predicate, fromIndex) { 24757 var iterable = Object(collection); 24758 if (!isArrayLike(collection)) { 24759 var iteratee = getIteratee(predicate, 3); 24760 collection = keys(collection); 24761 predicate = function(key) { return iteratee(iterable[key], key, iterable); }; 24762 } 24763 var index = findIndexFunc(collection, predicate, fromIndex); 24764 return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; 24765 }; 24766 } 24767 24768 /** 24769 * Creates a `_.flow` or `_.flowRight` function. 24770 * 24771 * @private 24772 * @param {boolean} [fromRight] Specify iterating from right to left. 24773 * @returns {Function} Returns the new flow function. 24774 */ 24775 function createFlow(fromRight) { 24776 return flatRest(function(funcs) { 24777 var length = funcs.length, 24778 index = length, 24779 prereq = LodashWrapper.prototype.thru; 24780 24781 if (fromRight) { 24782 funcs.reverse(); 24783 } 24784 while (index--) { 24785 var func = funcs[index]; 24786 if (typeof func != 'function') { 24787 throw new TypeError(FUNC_ERROR_TEXT); 24788 } 24789 if (prereq && !wrapper && getFuncName(func) == 'wrapper') { 24790 var wrapper = new LodashWrapper([], true); 24791 } 24792 } 24793 index = wrapper ? index : length; 24794 while (++index < length) { 24795 func = funcs[index]; 24796 24797 var funcName = getFuncName(func), 24798 data = funcName == 'wrapper' ? getData(func) : undefined; 24799 24800 if (data && isLaziable(data[0]) && 24801 data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && 24802 !data[4].length && data[9] == 1 24803 ) { 24804 wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); 24805 } else { 24806 wrapper = (func.length == 1 && isLaziable(func)) 24807 ? wrapper[funcName]() 24808 : wrapper.thru(func); 24809 } 24810 } 24811 return function() { 24812 var args = arguments, 24813 value = args[0]; 24814 24815 if (wrapper && args.length == 1 && isArray(value)) { 24816 return wrapper.plant(value).value(); 24817 } 24818 var index = 0, 24819 result = length ? funcs[index].apply(this, args) : value; 24820 24821 while (++index < length) { 24822 result = funcs[index].call(this, result); 24823 } 24824 return result; 24825 }; 24826 }); 24827 } 24828 24829 /** 24830 * Creates a function that wraps `func` to invoke it with optional `this` 24831 * binding of `thisArg`, partial application, and currying. 24832 * 24833 * @private 24834 * @param {Function|string} func The function or method name to wrap. 24835 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 24836 * @param {*} [thisArg] The `this` binding of `func`. 24837 * @param {Array} [partials] The arguments to prepend to those provided to 24838 * the new function. 24839 * @param {Array} [holders] The `partials` placeholder indexes. 24840 * @param {Array} [partialsRight] The arguments to append to those provided 24841 * to the new function. 24842 * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. 24843 * @param {Array} [argPos] The argument positions of the new function. 24844 * @param {number} [ary] The arity cap of `func`. 24845 * @param {number} [arity] The arity of `func`. 24846 * @returns {Function} Returns the new wrapped function. 24847 */ 24848 function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { 24849 var isAry = bitmask & WRAP_ARY_FLAG, 24850 isBind = bitmask & WRAP_BIND_FLAG, 24851 isBindKey = bitmask & WRAP_BIND_KEY_FLAG, 24852 isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), 24853 isFlip = bitmask & WRAP_FLIP_FLAG, 24854 Ctor = isBindKey ? undefined : createCtor(func); 24855 24856 function wrapper() { 24857 var length = arguments.length, 24858 args = Array(length), 24859 index = length; 24860 24861 while (index--) { 24862 args[index] = arguments[index]; 24863 } 24864 if (isCurried) { 24865 var placeholder = getHolder(wrapper), 24866 holdersCount = countHolders(args, placeholder); 24867 } 24868 if (partials) { 24869 args = composeArgs(args, partials, holders, isCurried); 24870 } 24871 if (partialsRight) { 24872 args = composeArgsRight(args, partialsRight, holdersRight, isCurried); 24873 } 24874 length -= holdersCount; 24875 if (isCurried && length < arity) { 24876 var newHolders = replaceHolders(args, placeholder); 24877 return createRecurry( 24878 func, bitmask, createHybrid, wrapper.placeholder, thisArg, 24879 args, newHolders, argPos, ary, arity - length 24880 ); 24881 } 24882 var thisBinding = isBind ? thisArg : this, 24883 fn = isBindKey ? thisBinding[func] : func; 24884 24885 length = args.length; 24886 if (argPos) { 24887 args = reorder(args, argPos); 24888 } else if (isFlip && length > 1) { 24889 args.reverse(); 24890 } 24891 if (isAry && ary < length) { 24892 args.length = ary; 24893 } 24894 if (this && this !== root && this instanceof wrapper) { 24895 fn = Ctor || createCtor(fn); 24896 } 24897 return fn.apply(thisBinding, args); 24898 } 24899 return wrapper; 24900 } 24901 24902 /** 24903 * Creates a function like `_.invertBy`. 24904 * 24905 * @private 24906 * @param {Function} setter The function to set accumulator values. 24907 * @param {Function} toIteratee The function to resolve iteratees. 24908 * @returns {Function} Returns the new inverter function. 24909 */ 24910 function createInverter(setter, toIteratee) { 24911 return function(object, iteratee) { 24912 return baseInverter(object, setter, toIteratee(iteratee), {}); 24913 }; 24914 } 24915 24916 /** 24917 * Creates a function that performs a mathematical operation on two values. 24918 * 24919 * @private 24920 * @param {Function} operator The function to perform the operation. 24921 * @param {number} [defaultValue] The value used for `undefined` arguments. 24922 * @returns {Function} Returns the new mathematical operation function. 24923 */ 24924 function createMathOperation(operator, defaultValue) { 24925 return function(value, other) { 24926 var result; 24927 if (value === undefined && other === undefined) { 24928 return defaultValue; 24929 } 24930 if (value !== undefined) { 24931 result = value; 24932 } 24933 if (other !== undefined) { 24934 if (result === undefined) { 24935 return other; 24936 } 24937 if (typeof value == 'string' || typeof other == 'string') { 24938 value = baseToString(value); 24939 other = baseToString(other); 24940 } else { 24941 value = baseToNumber(value); 24942 other = baseToNumber(other); 24943 } 24944 result = operator(value, other); 24945 } 24946 return result; 24947 }; 24948 } 24949 24950 /** 24951 * Creates a function like `_.over`. 24952 * 24953 * @private 24954 * @param {Function} arrayFunc The function to iterate over iteratees. 24955 * @returns {Function} Returns the new over function. 24956 */ 24957 function createOver(arrayFunc) { 24958 return flatRest(function(iteratees) { 24959 iteratees = arrayMap(iteratees, baseUnary(getIteratee())); 24960 return baseRest(function(args) { 24961 var thisArg = this; 24962 return arrayFunc(iteratees, function(iteratee) { 24963 return apply(iteratee, thisArg, args); 24964 }); 24965 }); 24966 }); 24967 } 24968 24969 /** 24970 * Creates the padding for `string` based on `length`. The `chars` string 24971 * is truncated if the number of characters exceeds `length`. 24972 * 24973 * @private 24974 * @param {number} length The padding length. 24975 * @param {string} [chars=' '] The string used as padding. 24976 * @returns {string} Returns the padding for `string`. 24977 */ 24978 function createPadding(length, chars) { 24979 chars = chars === undefined ? ' ' : baseToString(chars); 24980 24981 var charsLength = chars.length; 24982 if (charsLength < 2) { 24983 return charsLength ? baseRepeat(chars, length) : chars; 24984 } 24985 var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); 24986 return hasUnicode(chars) 24987 ? castSlice(stringToArray(result), 0, length).join('') 24988 : result.slice(0, length); 24989 } 24990 24991 /** 24992 * Creates a function that wraps `func` to invoke it with the `this` binding 24993 * of `thisArg` and `partials` prepended to the arguments it receives. 24994 * 24995 * @private 24996 * @param {Function} func The function to wrap. 24997 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 24998 * @param {*} thisArg The `this` binding of `func`. 24999 * @param {Array} partials The arguments to prepend to those provided to 25000 * the new function. 25001 * @returns {Function} Returns the new wrapped function. 25002 */ 25003 function createPartial(func, bitmask, thisArg, partials) { 25004 var isBind = bitmask & WRAP_BIND_FLAG, 25005 Ctor = createCtor(func); 25006 25007 function wrapper() { 25008 var argsIndex = -1, 25009 argsLength = arguments.length, 25010 leftIndex = -1, 25011 leftLength = partials.length, 25012 args = Array(leftLength + argsLength), 25013 fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 25014 25015 while (++leftIndex < leftLength) { 25016 args[leftIndex] = partials[leftIndex]; 25017 } 25018 while (argsLength--) { 25019 args[leftIndex++] = arguments[++argsIndex]; 25020 } 25021 return apply(fn, isBind ? thisArg : this, args); 25022 } 25023 return wrapper; 25024 } 25025 25026 /** 25027 * Creates a `_.range` or `_.rangeRight` function. 25028 * 25029 * @private 25030 * @param {boolean} [fromRight] Specify iterating from right to left. 25031 * @returns {Function} Returns the new range function. 25032 */ 25033 function createRange(fromRight) { 25034 return function(start, end, step) { 25035 if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { 25036 end = step = undefined; 25037 } 25038 // Ensure the sign of `-0` is preserved. 25039 start = toFinite(start); 25040 if (end === undefined) { 25041 end = start; 25042 start = 0; 25043 } else { 25044 end = toFinite(end); 25045 } 25046 step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); 25047 return baseRange(start, end, step, fromRight); 25048 }; 25049 } 25050 25051 /** 25052 * Creates a function that performs a relational operation on two values. 25053 * 25054 * @private 25055 * @param {Function} operator The function to perform the operation. 25056 * @returns {Function} Returns the new relational operation function. 25057 */ 25058 function createRelationalOperation(operator) { 25059 return function(value, other) { 25060 if (!(typeof value == 'string' && typeof other == 'string')) { 25061 value = toNumber(value); 25062 other = toNumber(other); 25063 } 25064 return operator(value, other); 25065 }; 25066 } 25067 25068 /** 25069 * Creates a function that wraps `func` to continue currying. 25070 * 25071 * @private 25072 * @param {Function} func The function to wrap. 25073 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 25074 * @param {Function} wrapFunc The function to create the `func` wrapper. 25075 * @param {*} placeholder The placeholder value. 25076 * @param {*} [thisArg] The `this` binding of `func`. 25077 * @param {Array} [partials] The arguments to prepend to those provided to 25078 * the new function. 25079 * @param {Array} [holders] The `partials` placeholder indexes. 25080 * @param {Array} [argPos] The argument positions of the new function. 25081 * @param {number} [ary] The arity cap of `func`. 25082 * @param {number} [arity] The arity of `func`. 25083 * @returns {Function} Returns the new wrapped function. 25084 */ 25085 function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { 25086 var isCurry = bitmask & WRAP_CURRY_FLAG, 25087 newHolders = isCurry ? holders : undefined, 25088 newHoldersRight = isCurry ? undefined : holders, 25089 newPartials = isCurry ? partials : undefined, 25090 newPartialsRight = isCurry ? undefined : partials; 25091 25092 bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); 25093 bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); 25094 25095 if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { 25096 bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); 25097 } 25098 var newData = [ 25099 func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, 25100 newHoldersRight, argPos, ary, arity 25101 ]; 25102 25103 var result = wrapFunc.apply(undefined, newData); 25104 if (isLaziable(func)) { 25105 setData(result, newData); 25106 } 25107 result.placeholder = placeholder; 25108 return setWrapToString(result, func, bitmask); 25109 } 25110 25111 /** 25112 * Creates a function like `_.round`. 25113 * 25114 * @private 25115 * @param {string} methodName The name of the `Math` method to use when rounding. 25116 * @returns {Function} Returns the new round function. 25117 */ 25118 function createRound(methodName) { 25119 var func = Math[methodName]; 25120 return function(number, precision) { 25121 number = toNumber(number); 25122 precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); 25123 if (precision && nativeIsFinite(number)) { 25124 // Shift with exponential notation to avoid floating-point issues. 25125 // See [MDN](https://mdn.io/round#Examples) for more details. 25126 var pair = (toString(number) + 'e').split('e'), 25127 value = func(pair[0] + 'e' + (+pair[1] + precision)); 25128 25129 pair = (toString(value) + 'e').split('e'); 25130 return +(pair[0] + 'e' + (+pair[1] - precision)); 25131 } 25132 return func(number); 25133 }; 25134 } 25135 25136 /** 25137 * Creates a set object of `values`. 25138 * 25139 * @private 25140 * @param {Array} values The values to add to the set. 25141 * @returns {Object} Returns the new set. 25142 */ 25143 var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { 25144 return new Set(values); 25145 }; 25146 25147 /** 25148 * Creates a `_.toPairs` or `_.toPairsIn` function. 25149 * 25150 * @private 25151 * @param {Function} keysFunc The function to get the keys of a given object. 25152 * @returns {Function} Returns the new pairs function. 25153 */ 25154 function createToPairs(keysFunc) { 25155 return function(object) { 25156 var tag = getTag(object); 25157 if (tag == mapTag) { 25158 return mapToArray(object); 25159 } 25160 if (tag == setTag) { 25161 return setToPairs(object); 25162 } 25163 return baseToPairs(object, keysFunc(object)); 25164 }; 25165 } 25166 25167 /** 25168 * Creates a function that either curries or invokes `func` with optional 25169 * `this` binding and partially applied arguments. 25170 * 25171 * @private 25172 * @param {Function|string} func The function or method name to wrap. 25173 * @param {number} bitmask The bitmask flags. 25174 * 1 - `_.bind` 25175 * 2 - `_.bindKey` 25176 * 4 - `_.curry` or `_.curryRight` of a bound function 25177 * 8 - `_.curry` 25178 * 16 - `_.curryRight` 25179 * 32 - `_.partial` 25180 * 64 - `_.partialRight` 25181 * 128 - `_.rearg` 25182 * 256 - `_.ary` 25183 * 512 - `_.flip` 25184 * @param {*} [thisArg] The `this` binding of `func`. 25185 * @param {Array} [partials] The arguments to be partially applied. 25186 * @param {Array} [holders] The `partials` placeholder indexes. 25187 * @param {Array} [argPos] The argument positions of the new function. 25188 * @param {number} [ary] The arity cap of `func`. 25189 * @param {number} [arity] The arity of `func`. 25190 * @returns {Function} Returns the new wrapped function. 25191 */ 25192 function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { 25193 var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; 25194 if (!isBindKey && typeof func != 'function') { 25195 throw new TypeError(FUNC_ERROR_TEXT); 25196 } 25197 var length = partials ? partials.length : 0; 25198 if (!length) { 25199 bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); 25200 partials = holders = undefined; 25201 } 25202 ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); 25203 arity = arity === undefined ? arity : toInteger(arity); 25204 length -= holders ? holders.length : 0; 25205 25206 if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { 25207 var partialsRight = partials, 25208 holdersRight = holders; 25209 25210 partials = holders = undefined; 25211 } 25212 var data = isBindKey ? undefined : getData(func); 25213 25214 var newData = [ 25215 func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, 25216 argPos, ary, arity 25217 ]; 25218 25219 if (data) { 25220 mergeData(newData, data); 25221 } 25222 func = newData[0]; 25223 bitmask = newData[1]; 25224 thisArg = newData[2]; 25225 partials = newData[3]; 25226 holders = newData[4]; 25227 arity = newData[9] = newData[9] === undefined 25228 ? (isBindKey ? 0 : func.length) 25229 : nativeMax(newData[9] - length, 0); 25230 25231 if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { 25232 bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); 25233 } 25234 if (!bitmask || bitmask == WRAP_BIND_FLAG) { 25235 var result = createBind(func, bitmask, thisArg); 25236 } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { 25237 result = createCurry(func, bitmask, arity); 25238 } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { 25239 result = createPartial(func, bitmask, thisArg, partials); 25240 } else { 25241 result = createHybrid.apply(undefined, newData); 25242 } 25243 var setter = data ? baseSetData : setData; 25244 return setWrapToString(setter(result, newData), func, bitmask); 25245 } 25246 25247 /** 25248 * Used by `_.defaults` to customize its `_.assignIn` use to assign properties 25249 * of source objects to the destination object for all destination properties 25250 * that resolve to `undefined`. 25251 * 25252 * @private 25253 * @param {*} objValue The destination value. 25254 * @param {*} srcValue The source value. 25255 * @param {string} key The key of the property to assign. 25256 * @param {Object} object The parent object of `objValue`. 25257 * @returns {*} Returns the value to assign. 25258 */ 25259 function customDefaultsAssignIn(objValue, srcValue, key, object) { 25260 if (objValue === undefined || 25261 (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { 25262 return srcValue; 25263 } 25264 return objValue; 25265 } 25266 25267 /** 25268 * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source 25269 * objects into destination objects that are passed thru. 25270 * 25271 * @private 25272 * @param {*} objValue The destination value. 25273 * @param {*} srcValue The source value. 25274 * @param {string} key The key of the property to merge. 25275 * @param {Object} object The parent object of `objValue`. 25276 * @param {Object} source The parent object of `srcValue`. 25277 * @param {Object} [stack] Tracks traversed source values and their merged 25278 * counterparts. 25279 * @returns {*} Returns the value to assign. 25280 */ 25281 function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { 25282 if (isObject(objValue) && isObject(srcValue)) { 25283 // Recursively merge objects and arrays (susceptible to call stack limits). 25284 stack.set(srcValue, objValue); 25285 baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); 25286 stack['delete'](srcValue); 25287 } 25288 return objValue; 25289 } 25290 25291 /** 25292 * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain 25293 * objects. 25294 * 25295 * @private 25296 * @param {*} value The value to inspect. 25297 * @param {string} key The key of the property to inspect. 25298 * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. 25299 */ 25300 function customOmitClone(value) { 25301 return isPlainObject(value) ? undefined : value; 25302 } 25303 25304 /** 25305 * A specialized version of `baseIsEqualDeep` for arrays with support for 25306 * partial deep comparisons. 25307 * 25308 * @private 25309 * @param {Array} array The array to compare. 25310 * @param {Array} other The other array to compare. 25311 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 25312 * @param {Function} customizer The function to customize comparisons. 25313 * @param {Function} equalFunc The function to determine equivalents of values. 25314 * @param {Object} stack Tracks traversed `array` and `other` objects. 25315 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. 25316 */ 25317 function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { 25318 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, 25319 arrLength = array.length, 25320 othLength = other.length; 25321 25322 if (arrLength != othLength && !(isPartial && othLength > arrLength)) { 25323 return false; 25324 } 25325 // Check that cyclic values are equal. 25326 var arrStacked = stack.get(array); 25327 var othStacked = stack.get(other); 25328 if (arrStacked && othStacked) { 25329 return arrStacked == other && othStacked == array; 25330 } 25331 var index = -1, 25332 result = true, 25333 seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; 25334 25335 stack.set(array, other); 25336 stack.set(other, array); 25337 25338 // Ignore non-index properties. 25339 while (++index < arrLength) { 25340 var arrValue = array[index], 25341 othValue = other[index]; 25342 25343 if (customizer) { 25344 var compared = isPartial 25345 ? customizer(othValue, arrValue, index, other, array, stack) 25346 : customizer(arrValue, othValue, index, array, other, stack); 25347 } 25348 if (compared !== undefined) { 25349 if (compared) { 25350 continue; 25351 } 25352 result = false; 25353 break; 25354 } 25355 // Recursively compare arrays (susceptible to call stack limits). 25356 if (seen) { 25357 if (!arraySome(other, function(othValue, othIndex) { 25358 if (!cacheHas(seen, othIndex) && 25359 (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { 25360 return seen.push(othIndex); 25361 } 25362 })) { 25363 result = false; 25364 break; 25365 } 25366 } else if (!( 25367 arrValue === othValue || 25368 equalFunc(arrValue, othValue, bitmask, customizer, stack) 25369 )) { 25370 result = false; 25371 break; 25372 } 25373 } 25374 stack['delete'](array); 25375 stack['delete'](other); 25376 return result; 25377 } 25378 25379 /** 25380 * A specialized version of `baseIsEqualDeep` for comparing objects of 25381 * the same `toStringTag`. 25382 * 25383 * **Note:** This function only supports comparing values with tags of 25384 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. 25385 * 25386 * @private 25387 * @param {Object} object The object to compare. 25388 * @param {Object} other The other object to compare. 25389 * @param {string} tag The `toStringTag` of the objects to compare. 25390 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 25391 * @param {Function} customizer The function to customize comparisons. 25392 * @param {Function} equalFunc The function to determine equivalents of values. 25393 * @param {Object} stack Tracks traversed `object` and `other` objects. 25394 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 25395 */ 25396 function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { 25397 switch (tag) { 25398 case dataViewTag: 25399 if ((object.byteLength != other.byteLength) || 25400 (object.byteOffset != other.byteOffset)) { 25401 return false; 25402 } 25403 object = object.buffer; 25404 other = other.buffer; 25405 25406 case arrayBufferTag: 25407 if ((object.byteLength != other.byteLength) || 25408 !equalFunc(new Uint8Array(object), new Uint8Array(other))) { 25409 return false; 25410 } 25411 return true; 25412 25413 case boolTag: 25414 case dateTag: 25415 case numberTag: 25416 // Coerce booleans to `1` or `0` and dates to milliseconds. 25417 // Invalid dates are coerced to `NaN`. 25418 return eq(+object, +other); 25419 25420 case errorTag: 25421 return object.name == other.name && object.message == other.message; 25422 25423 case regexpTag: 25424 case stringTag: 25425 // Coerce regexes to strings and treat strings, primitives and objects, 25426 // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring 25427 // for more details. 25428 return object == (other + ''); 25429 25430 case mapTag: 25431 var convert = mapToArray; 25432 25433 case setTag: 25434 var isPartial = bitmask & COMPARE_PARTIAL_FLAG; 25435 convert || (convert = setToArray); 25436 25437 if (object.size != other.size && !isPartial) { 25438 return false; 25439 } 25440 // Assume cyclic values are equal. 25441 var stacked = stack.get(object); 25442 if (stacked) { 25443 return stacked == other; 25444 } 25445 bitmask |= COMPARE_UNORDERED_FLAG; 25446 25447 // Recursively compare objects (susceptible to call stack limits). 25448 stack.set(object, other); 25449 var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); 25450 stack['delete'](object); 25451 return result; 25452 25453 case symbolTag: 25454 if (symbolValueOf) { 25455 return symbolValueOf.call(object) == symbolValueOf.call(other); 25456 } 25457 } 25458 return false; 25459 } 25460 25461 /** 25462 * A specialized version of `baseIsEqualDeep` for objects with support for 25463 * partial deep comparisons. 25464 * 25465 * @private 25466 * @param {Object} object The object to compare. 25467 * @param {Object} other The other object to compare. 25468 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 25469 * @param {Function} customizer The function to customize comparisons. 25470 * @param {Function} equalFunc The function to determine equivalents of values. 25471 * @param {Object} stack Tracks traversed `object` and `other` objects. 25472 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 25473 */ 25474 function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { 25475 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, 25476 objProps = getAllKeys(object), 25477 objLength = objProps.length, 25478 othProps = getAllKeys(other), 25479 othLength = othProps.length; 25480 25481 if (objLength != othLength && !isPartial) { 25482 return false; 25483 } 25484 var index = objLength; 25485 while (index--) { 25486 var key = objProps[index]; 25487 if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { 25488 return false; 25489 } 25490 } 25491 // Check that cyclic values are equal. 25492 var objStacked = stack.get(object); 25493 var othStacked = stack.get(other); 25494 if (objStacked && othStacked) { 25495 return objStacked == other && othStacked == object; 25496 } 25497 var result = true; 25498 stack.set(object, other); 25499 stack.set(other, object); 25500 25501 var skipCtor = isPartial; 25502 while (++index < objLength) { 25503 key = objProps[index]; 25504 var objValue = object[key], 25505 othValue = other[key]; 25506 25507 if (customizer) { 25508 var compared = isPartial 25509 ? customizer(othValue, objValue, key, other, object, stack) 25510 : customizer(objValue, othValue, key, object, other, stack); 25511 } 25512 // Recursively compare objects (susceptible to call stack limits). 25513 if (!(compared === undefined 25514 ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) 25515 : compared 25516 )) { 25517 result = false; 25518 break; 25519 } 25520 skipCtor || (skipCtor = key == 'constructor'); 25521 } 25522 if (result && !skipCtor) { 25523 var objCtor = object.constructor, 25524 othCtor = other.constructor; 25525 25526 // Non `Object` object instances with different constructors are not equal. 25527 if (objCtor != othCtor && 25528 ('constructor' in object && 'constructor' in other) && 25529 !(typeof objCtor == 'function' && objCtor instanceof objCtor && 25530 typeof othCtor == 'function' && othCtor instanceof othCtor)) { 25531 result = false; 25532 } 25533 } 25534 stack['delete'](object); 25535 stack['delete'](other); 25536 return result; 25537 } 25538 25539 /** 25540 * A specialized version of `baseRest` which flattens the rest array. 25541 * 25542 * @private 25543 * @param {Function} func The function to apply a rest parameter to. 25544 * @returns {Function} Returns the new function. 25545 */ 25546 function flatRest(func) { 25547 return setToString(overRest(func, undefined, flatten), func + ''); 25548 } 25549 25550 /** 25551 * Creates an array of own enumerable property names and symbols of `object`. 25552 * 25553 * @private 25554 * @param {Object} object The object to query. 25555 * @returns {Array} Returns the array of property names and symbols. 25556 */ 25557 function getAllKeys(object) { 25558 return baseGetAllKeys(object, keys, getSymbols); 25559 } 25560 25561 /** 25562 * Creates an array of own and inherited enumerable property names and 25563 * symbols of `object`. 25564 * 25565 * @private 25566 * @param {Object} object The object to query. 25567 * @returns {Array} Returns the array of property names and symbols. 25568 */ 25569 function getAllKeysIn(object) { 25570 return baseGetAllKeys(object, keysIn, getSymbolsIn); 25571 } 25572 25573 /** 25574 * Gets metadata for `func`. 25575 * 25576 * @private 25577 * @param {Function} func The function to query. 25578 * @returns {*} Returns the metadata for `func`. 25579 */ 25580 var getData = !metaMap ? noop : function(func) { 25581 return metaMap.get(func); 25582 }; 25583 25584 /** 25585 * Gets the name of `func`. 25586 * 25587 * @private 25588 * @param {Function} func The function to query. 25589 * @returns {string} Returns the function name. 25590 */ 25591 function getFuncName(func) { 25592 var result = (func.name + ''), 25593 array = realNames[result], 25594 length = hasOwnProperty.call(realNames, result) ? array.length : 0; 25595 25596 while (length--) { 25597 var data = array[length], 25598 otherFunc = data.func; 25599 if (otherFunc == null || otherFunc == func) { 25600 return data.name; 25601 } 25602 } 25603 return result; 25604 } 25605 25606 /** 25607 * Gets the argument placeholder value for `func`. 25608 * 25609 * @private 25610 * @param {Function} func The function to inspect. 25611 * @returns {*} Returns the placeholder value. 25612 */ 25613 function getHolder(func) { 25614 var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; 25615 return object.placeholder; 25616 } 25617 25618 /** 25619 * Gets the appropriate "iteratee" function. If `_.iteratee` is customized, 25620 * this function returns the custom method, otherwise it returns `baseIteratee`. 25621 * If arguments are provided, the chosen function is invoked with them and 25622 * its result is returned. 25623 * 25624 * @private 25625 * @param {*} [value] The value to convert to an iteratee. 25626 * @param {number} [arity] The arity of the created iteratee. 25627 * @returns {Function} Returns the chosen function or its result. 25628 */ 25629 function getIteratee() { 25630 var result = lodash.iteratee || iteratee; 25631 result = result === iteratee ? baseIteratee : result; 25632 return arguments.length ? result(arguments[0], arguments[1]) : result; 25633 } 25634 25635 /** 25636 * Gets the data for `map`. 25637 * 25638 * @private 25639 * @param {Object} map The map to query. 25640 * @param {string} key The reference key. 25641 * @returns {*} Returns the map data. 25642 */ 25643 function getMapData(map, key) { 25644 var data = map.__data__; 25645 return isKeyable(key) 25646 ? data[typeof key == 'string' ? 'string' : 'hash'] 25647 : data.map; 25648 } 25649 25650 /** 25651 * Gets the property names, values, and compare flags of `object`. 25652 * 25653 * @private 25654 * @param {Object} object The object to query. 25655 * @returns {Array} Returns the match data of `object`. 25656 */ 25657 function getMatchData(object) { 25658 var result = keys(object), 25659 length = result.length; 25660 25661 while (length--) { 25662 var key = result[length], 25663 value = object[key]; 25664 25665 result[length] = [key, value, isStrictComparable(value)]; 25666 } 25667 return result; 25668 } 25669 25670 /** 25671 * Gets the native function at `key` of `object`. 25672 * 25673 * @private 25674 * @param {Object} object The object to query. 25675 * @param {string} key The key of the method to get. 25676 * @returns {*} Returns the function if it's native, else `undefined`. 25677 */ 25678 function getNative(object, key) { 25679 var value = getValue(object, key); 25680 return baseIsNative(value) ? value : undefined; 25681 } 25682 25683 /** 25684 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. 25685 * 25686 * @private 25687 * @param {*} value The value to query. 25688 * @returns {string} Returns the raw `toStringTag`. 25689 */ 25690 function getRawTag(value) { 25691 var isOwn = hasOwnProperty.call(value, symToStringTag), 25692 tag = value[symToStringTag]; 25693 25694 try { 25695 value[symToStringTag] = undefined; 25696 var unmasked = true; 25697 } catch (e) {} 25698 25699 var result = nativeObjectToString.call(value); 25700 if (unmasked) { 25701 if (isOwn) { 25702 value[symToStringTag] = tag; 25703 } else { 25704 delete value[symToStringTag]; 25705 } 25706 } 25707 return result; 25708 } 25709 25710 /** 25711 * Creates an array of the own enumerable symbols of `object`. 25712 * 25713 * @private 25714 * @param {Object} object The object to query. 25715 * @returns {Array} Returns the array of symbols. 25716 */ 25717 var getSymbols = !nativeGetSymbols ? stubArray : function(object) { 25718 if (object == null) { 25719 return []; 25720 } 25721 object = Object(object); 25722 return arrayFilter(nativeGetSymbols(object), function(symbol) { 25723 return propertyIsEnumerable.call(object, symbol); 25724 }); 25725 }; 25726 25727 /** 25728 * Creates an array of the own and inherited enumerable symbols of `object`. 25729 * 25730 * @private 25731 * @param {Object} object The object to query. 25732 * @returns {Array} Returns the array of symbols. 25733 */ 25734 var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { 25735 var result = []; 25736 while (object) { 25737 arrayPush(result, getSymbols(object)); 25738 object = getPrototype(object); 25739 } 25740 return result; 25741 }; 25742 25743 /** 25744 * Gets the `toStringTag` of `value`. 25745 * 25746 * @private 25747 * @param {*} value The value to query. 25748 * @returns {string} Returns the `toStringTag`. 25749 */ 25750 var getTag = baseGetTag; 25751 25752 // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. 25753 if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || 25754 (Map && getTag(new Map) != mapTag) || 25755 (Promise && getTag(Promise.resolve()) != promiseTag) || 25756 (Set && getTag(new Set) != setTag) || 25757 (WeakMap && getTag(new WeakMap) != weakMapTag)) { 25758 getTag = function(value) { 25759 var result = baseGetTag(value), 25760 Ctor = result == objectTag ? value.constructor : undefined, 25761 ctorString = Ctor ? toSource(Ctor) : ''; 25762 25763 if (ctorString) { 25764 switch (ctorString) { 25765 case dataViewCtorString: return dataViewTag; 25766 case mapCtorString: return mapTag; 25767 case promiseCtorString: return promiseTag; 25768 case setCtorString: return setTag; 25769 case weakMapCtorString: return weakMapTag; 25770 } 25771 } 25772 return result; 25773 }; 25774 } 25775 25776 /** 25777 * Gets the view, applying any `transforms` to the `start` and `end` positions. 25778 * 25779 * @private 25780 * @param {number} start The start of the view. 25781 * @param {number} end The end of the view. 25782 * @param {Array} transforms The transformations to apply to the view. 25783 * @returns {Object} Returns an object containing the `start` and `end` 25784 * positions of the view. 25785 */ 25786 function getView(start, end, transforms) { 25787 var index = -1, 25788 length = transforms.length; 25789 25790 while (++index < length) { 25791 var data = transforms[index], 25792 size = data.size; 25793 25794 switch (data.type) { 25795 case 'drop': start += size; break; 25796 case 'dropRight': end -= size; break; 25797 case 'take': end = nativeMin(end, start + size); break; 25798 case 'takeRight': start = nativeMax(start, end - size); break; 25799 } 25800 } 25801 return { 'start': start, 'end': end }; 25802 } 25803 25804 /** 25805 * Extracts wrapper details from the `source` body comment. 25806 * 25807 * @private 25808 * @param {string} source The source to inspect. 25809 * @returns {Array} Returns the wrapper details. 25810 */ 25811 function getWrapDetails(source) { 25812 var match = source.match(reWrapDetails); 25813 return match ? match[1].split(reSplitDetails) : []; 25814 } 25815 25816 /** 25817 * Checks if `path` exists on `object`. 25818 * 25819 * @private 25820 * @param {Object} object The object to query. 25821 * @param {Array|string} path The path to check. 25822 * @param {Function} hasFunc The function to check properties. 25823 * @returns {boolean} Returns `true` if `path` exists, else `false`. 25824 */ 25825 function hasPath(object, path, hasFunc) { 25826 path = castPath(path, object); 25827 25828 var index = -1, 25829 length = path.length, 25830 result = false; 25831 25832 while (++index < length) { 25833 var key = toKey(path[index]); 25834 if (!(result = object != null && hasFunc(object, key))) { 25835 break; 25836 } 25837 object = object[key]; 25838 } 25839 if (result || ++index != length) { 25840 return result; 25841 } 25842 length = object == null ? 0 : object.length; 25843 return !!length && isLength(length) && isIndex(key, length) && 25844 (isArray(object) || isArguments(object)); 25845 } 25846 25847 /** 25848 * Initializes an array clone. 25849 * 25850 * @private 25851 * @param {Array} array The array to clone. 25852 * @returns {Array} Returns the initialized clone. 25853 */ 25854 function initCloneArray(array) { 25855 var length = array.length, 25856 result = new array.constructor(length); 25857 25858 // Add properties assigned by `RegExp#exec`. 25859 if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { 25860 result.index = array.index; 25861 result.input = array.input; 25862 } 25863 return result; 25864 } 25865 25866 /** 25867 * Initializes an object clone. 25868 * 25869 * @private 25870 * @param {Object} object The object to clone. 25871 * @returns {Object} Returns the initialized clone. 25872 */ 25873 function initCloneObject(object) { 25874 return (typeof object.constructor == 'function' && !isPrototype(object)) 25875 ? baseCreate(getPrototype(object)) 25876 : {}; 25877 } 25878 25879 /** 25880 * Initializes an object clone based on its `toStringTag`. 25881 * 25882 * **Note:** This function only supports cloning values with tags of 25883 * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. 25884 * 25885 * @private 25886 * @param {Object} object The object to clone. 25887 * @param {string} tag The `toStringTag` of the object to clone. 25888 * @param {boolean} [isDeep] Specify a deep clone. 25889 * @returns {Object} Returns the initialized clone. 25890 */ 25891 function initCloneByTag(object, tag, isDeep) { 25892 var Ctor = object.constructor; 25893 switch (tag) { 25894 case arrayBufferTag: 25895 return cloneArrayBuffer(object); 25896 25897 case boolTag: 25898 case dateTag: 25899 return new Ctor(+object); 25900 25901 case dataViewTag: 25902 return cloneDataView(object, isDeep); 25903 25904 case float32Tag: case float64Tag: 25905 case int8Tag: case int16Tag: case int32Tag: 25906 case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: 25907 return cloneTypedArray(object, isDeep); 25908 25909 case mapTag: 25910 return new Ctor; 25911 25912 case numberTag: 25913 case stringTag: 25914 return new Ctor(object); 25915 25916 case regexpTag: 25917 return cloneRegExp(object); 25918 25919 case setTag: 25920 return new Ctor; 25921 25922 case symbolTag: 25923 return cloneSymbol(object); 25924 } 25925 } 25926 25927 /** 25928 * Inserts wrapper `details` in a comment at the top of the `source` body. 25929 * 25930 * @private 25931 * @param {string} source The source to modify. 25932 * @returns {Array} details The details to insert. 25933 * @returns {string} Returns the modified source. 25934 */ 25935 function insertWrapDetails(source, details) { 25936 var length = details.length; 25937 if (!length) { 25938 return source; 25939 } 25940 var lastIndex = length - 1; 25941 details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; 25942 details = details.join(length > 2 ? ', ' : ' '); 25943 return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); 25944 } 25945 25946 /** 25947 * Checks if `value` is a flattenable `arguments` object or array. 25948 * 25949 * @private 25950 * @param {*} value The value to check. 25951 * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. 25952 */ 25953 function isFlattenable(value) { 25954 return isArray(value) || isArguments(value) || 25955 !!(spreadableSymbol && value && value[spreadableSymbol]); 25956 } 25957 25958 /** 25959 * Checks if `value` is a valid array-like index. 25960 * 25961 * @private 25962 * @param {*} value The value to check. 25963 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. 25964 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. 25965 */ 25966 function isIndex(value, length) { 25967 var type = typeof value; 25968 length = length == null ? MAX_SAFE_INTEGER : length; 25969 25970 return !!length && 25971 (type == 'number' || 25972 (type != 'symbol' && reIsUint.test(value))) && 25973 (value > -1 && value % 1 == 0 && value < length); 25974 } 25975 25976 /** 25977 * Checks if the given arguments are from an iteratee call. 25978 * 25979 * @private 25980 * @param {*} value The potential iteratee value argument. 25981 * @param {*} index The potential iteratee index or key argument. 25982 * @param {*} object The potential iteratee object argument. 25983 * @returns {boolean} Returns `true` if the arguments are from an iteratee call, 25984 * else `false`. 25985 */ 25986 function isIterateeCall(value, index, object) { 25987 if (!isObject(object)) { 25988 return false; 25989 } 25990 var type = typeof index; 25991 if (type == 'number' 25992 ? (isArrayLike(object) && isIndex(index, object.length)) 25993 : (type == 'string' && index in object) 25994 ) { 25995 return eq(object[index], value); 25996 } 25997 return false; 25998 } 25999 26000 /** 26001 * Checks if `value` is a property name and not a property path. 26002 * 26003 * @private 26004 * @param {*} value The value to check. 26005 * @param {Object} [object] The object to query keys on. 26006 * @returns {boolean} Returns `true` if `value` is a property name, else `false`. 26007 */ 26008 function isKey(value, object) { 26009 if (isArray(value)) { 26010 return false; 26011 } 26012 var type = typeof value; 26013 if (type == 'number' || type == 'symbol' || type == 'boolean' || 26014 value == null || isSymbol(value)) { 26015 return true; 26016 } 26017 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || 26018 (object != null && value in Object(object)); 26019 } 26020 26021 /** 26022 * Checks if `value` is suitable for use as unique object key. 26023 * 26024 * @private 26025 * @param {*} value The value to check. 26026 * @returns {boolean} Returns `true` if `value` is suitable, else `false`. 26027 */ 26028 function isKeyable(value) { 26029 var type = typeof value; 26030 return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') 26031 ? (value !== '__proto__') 26032 : (value === null); 26033 } 26034 26035 /** 26036 * Checks if `func` has a lazy counterpart. 26037 * 26038 * @private 26039 * @param {Function} func The function to check. 26040 * @returns {boolean} Returns `true` if `func` has a lazy counterpart, 26041 * else `false`. 26042 */ 26043 function isLaziable(func) { 26044 var funcName = getFuncName(func), 26045 other = lodash[funcName]; 26046 26047 if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { 26048 return false; 26049 } 26050 if (func === other) { 26051 return true; 26052 } 26053 var data = getData(other); 26054 return !!data && func === data[0]; 26055 } 26056 26057 /** 26058 * Checks if `func` has its source masked. 26059 * 26060 * @private 26061 * @param {Function} func The function to check. 26062 * @returns {boolean} Returns `true` if `func` is masked, else `false`. 26063 */ 26064 function isMasked(func) { 26065 return !!maskSrcKey && (maskSrcKey in func); 26066 } 26067 26068 /** 26069 * Checks if `func` is capable of being masked. 26070 * 26071 * @private 26072 * @param {*} value The value to check. 26073 * @returns {boolean} Returns `true` if `func` is maskable, else `false`. 26074 */ 26075 var isMaskable = coreJsData ? isFunction : stubFalse; 26076 26077 /** 26078 * Checks if `value` is likely a prototype object. 26079 * 26080 * @private 26081 * @param {*} value The value to check. 26082 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. 26083 */ 26084 function isPrototype(value) { 26085 var Ctor = value && value.constructor, 26086 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; 26087 26088 return value === proto; 26089 } 26090 26091 /** 26092 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. 26093 * 26094 * @private 26095 * @param {*} value The value to check. 26096 * @returns {boolean} Returns `true` if `value` if suitable for strict 26097 * equality comparisons, else `false`. 26098 */ 26099 function isStrictComparable(value) { 26100 return value === value && !isObject(value); 26101 } 26102 26103 /** 26104 * A specialized version of `matchesProperty` for source values suitable 26105 * for strict equality comparisons, i.e. `===`. 26106 * 26107 * @private 26108 * @param {string} key The key of the property to get. 26109 * @param {*} srcValue The value to match. 26110 * @returns {Function} Returns the new spec function. 26111 */ 26112 function matchesStrictComparable(key, srcValue) { 26113 return function(object) { 26114 if (object == null) { 26115 return false; 26116 } 26117 return object[key] === srcValue && 26118 (srcValue !== undefined || (key in Object(object))); 26119 }; 26120 } 26121 26122 /** 26123 * A specialized version of `_.memoize` which clears the memoized function's 26124 * cache when it exceeds `MAX_MEMOIZE_SIZE`. 26125 * 26126 * @private 26127 * @param {Function} func The function to have its output memoized. 26128 * @returns {Function} Returns the new memoized function. 26129 */ 26130 function memoizeCapped(func) { 26131 var result = memoize(func, function(key) { 26132 if (cache.size === MAX_MEMOIZE_SIZE) { 26133 cache.clear(); 26134 } 26135 return key; 26136 }); 26137 26138 var cache = result.cache; 26139 return result; 26140 } 26141 26142 /** 26143 * Merges the function metadata of `source` into `data`. 26144 * 26145 * Merging metadata reduces the number of wrappers used to invoke a function. 26146 * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` 26147 * may be applied regardless of execution order. Methods like `_.ary` and 26148 * `_.rearg` modify function arguments, making the order in which they are 26149 * executed important, preventing the merging of metadata. However, we make 26150 * an exception for a safe combined case where curried functions have `_.ary` 26151 * and or `_.rearg` applied. 26152 * 26153 * @private 26154 * @param {Array} data The destination metadata. 26155 * @param {Array} source The source metadata. 26156 * @returns {Array} Returns `data`. 26157 */ 26158 function mergeData(data, source) { 26159 var bitmask = data[1], 26160 srcBitmask = source[1], 26161 newBitmask = bitmask | srcBitmask, 26162 isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); 26163 26164 var isCombo = 26165 ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || 26166 ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || 26167 ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); 26168 26169 // Exit early if metadata can't be merged. 26170 if (!(isCommon || isCombo)) { 26171 return data; 26172 } 26173 // Use source `thisArg` if available. 26174 if (srcBitmask & WRAP_BIND_FLAG) { 26175 data[2] = source[2]; 26176 // Set when currying a bound function. 26177 newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; 26178 } 26179 // Compose partial arguments. 26180 var value = source[3]; 26181 if (value) { 26182 var partials = data[3]; 26183 data[3] = partials ? composeArgs(partials, value, source[4]) : value; 26184 data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; 26185 } 26186 // Compose partial right arguments. 26187 value = source[5]; 26188 if (value) { 26189 partials = data[5]; 26190 data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; 26191 data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; 26192 } 26193 // Use source `argPos` if available. 26194 value = source[7]; 26195 if (value) { 26196 data[7] = value; 26197 } 26198 // Use source `ary` if it's smaller. 26199 if (srcBitmask & WRAP_ARY_FLAG) { 26200 data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); 26201 } 26202 // Use source `arity` if one is not provided. 26203 if (data[9] == null) { 26204 data[9] = source[9]; 26205 } 26206 // Use source `func` and merge bitmasks. 26207 data[0] = source[0]; 26208 data[1] = newBitmask; 26209 26210 return data; 26211 } 26212 26213 /** 26214 * This function is like 26215 * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) 26216 * except that it includes inherited enumerable properties. 26217 * 26218 * @private 26219 * @param {Object} object The object to query. 26220 * @returns {Array} Returns the array of property names. 26221 */ 26222 function nativeKeysIn(object) { 26223 var result = []; 26224 if (object != null) { 26225 for (var key in Object(object)) { 26226 result.push(key); 26227 } 26228 } 26229 return result; 26230 } 26231 26232 /** 26233 * Converts `value` to a string using `Object.prototype.toString`. 26234 * 26235 * @private 26236 * @param {*} value The value to convert. 26237 * @returns {string} Returns the converted string. 26238 */ 26239 function objectToString(value) { 26240 return nativeObjectToString.call(value); 26241 } 26242 26243 /** 26244 * A specialized version of `baseRest` which transforms the rest array. 26245 * 26246 * @private 26247 * @param {Function} func The function to apply a rest parameter to. 26248 * @param {number} [start=func.length-1] The start position of the rest parameter. 26249 * @param {Function} transform The rest array transform. 26250 * @returns {Function} Returns the new function. 26251 */ 26252 function overRest(func, start, transform) { 26253 start = nativeMax(start === undefined ? (func.length - 1) : start, 0); 26254 return function() { 26255 var args = arguments, 26256 index = -1, 26257 length = nativeMax(args.length - start, 0), 26258 array = Array(length); 26259 26260 while (++index < length) { 26261 array[index] = args[start + index]; 26262 } 26263 index = -1; 26264 var otherArgs = Array(start + 1); 26265 while (++index < start) { 26266 otherArgs[index] = args[index]; 26267 } 26268 otherArgs[start] = transform(array); 26269 return apply(func, this, otherArgs); 26270 }; 26271 } 26272 26273 /** 26274 * Gets the parent value at `path` of `object`. 26275 * 26276 * @private 26277 * @param {Object} object The object to query. 26278 * @param {Array} path The path to get the parent value of. 26279 * @returns {*} Returns the parent value. 26280 */ 26281 function parent(object, path) { 26282 return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); 26283 } 26284 26285 /** 26286 * Reorder `array` according to the specified indexes where the element at 26287 * the first index is assigned as the first element, the element at 26288 * the second index is assigned as the second element, and so on. 26289 * 26290 * @private 26291 * @param {Array} array The array to reorder. 26292 * @param {Array} indexes The arranged array indexes. 26293 * @returns {Array} Returns `array`. 26294 */ 26295 function reorder(array, indexes) { 26296 var arrLength = array.length, 26297 length = nativeMin(indexes.length, arrLength), 26298 oldArray = copyArray(array); 26299 26300 while (length--) { 26301 var index = indexes[length]; 26302 array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; 26303 } 26304 return array; 26305 } 26306 26307 /** 26308 * Gets the value at `key`, unless `key` is "__proto__" or "constructor". 26309 * 26310 * @private 26311 * @param {Object} object The object to query. 26312 * @param {string} key The key of the property to get. 26313 * @returns {*} Returns the property value. 26314 */ 26315 function safeGet(object, key) { 26316 if (key === 'constructor' && typeof object[key] === 'function') { 26317 return; 26318 } 26319 26320 if (key == '__proto__') { 26321 return; 26322 } 26323 26324 return object[key]; 26325 } 26326 26327 /** 26328 * Sets metadata for `func`. 26329 * 26330 * **Note:** If this function becomes hot, i.e. is invoked a lot in a short 26331 * period of time, it will trip its breaker and transition to an identity 26332 * function to avoid garbage collection pauses in V8. See 26333 * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) 26334 * for more details. 26335 * 26336 * @private 26337 * @param {Function} func The function to associate metadata with. 26338 * @param {*} data The metadata. 26339 * @returns {Function} Returns `func`. 26340 */ 26341 var setData = shortOut(baseSetData); 26342 26343 /** 26344 * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout). 26345 * 26346 * @private 26347 * @param {Function} func The function to delay. 26348 * @param {number} wait The number of milliseconds to delay invocation. 26349 * @returns {number|Object} Returns the timer id or timeout object. 26350 */ 26351 var setTimeout = ctxSetTimeout || function(func, wait) { 26352 return root.setTimeout(func, wait); 26353 }; 26354 26355 /** 26356 * Sets the `toString` method of `func` to return `string`. 26357 * 26358 * @private 26359 * @param {Function} func The function to modify. 26360 * @param {Function} string The `toString` result. 26361 * @returns {Function} Returns `func`. 26362 */ 26363 var setToString = shortOut(baseSetToString); 26364 26365 /** 26366 * Sets the `toString` method of `wrapper` to mimic the source of `reference` 26367 * with wrapper details in a comment at the top of the source body. 26368 * 26369 * @private 26370 * @param {Function} wrapper The function to modify. 26371 * @param {Function} reference The reference function. 26372 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 26373 * @returns {Function} Returns `wrapper`. 26374 */ 26375 function setWrapToString(wrapper, reference, bitmask) { 26376 var source = (reference + ''); 26377 return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); 26378 } 26379 26380 /** 26381 * Creates a function that'll short out and invoke `identity` instead 26382 * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` 26383 * milliseconds. 26384 * 26385 * @private 26386 * @param {Function} func The function to restrict. 26387 * @returns {Function} Returns the new shortable function. 26388 */ 26389 function shortOut(func) { 26390 var count = 0, 26391 lastCalled = 0; 26392 26393 return function() { 26394 var stamp = nativeNow(), 26395 remaining = HOT_SPAN - (stamp - lastCalled); 26396 26397 lastCalled = stamp; 26398 if (remaining > 0) { 26399 if (++count >= HOT_COUNT) { 26400 return arguments[0]; 26401 } 26402 } else { 26403 count = 0; 26404 } 26405 return func.apply(undefined, arguments); 26406 }; 26407 } 26408 26409 /** 26410 * A specialized version of `_.shuffle` which mutates and sets the size of `array`. 26411 * 26412 * @private 26413 * @param {Array} array The array to shuffle. 26414 * @param {number} [size=array.length] The size of `array`. 26415 * @returns {Array} Returns `array`. 26416 */ 26417 function shuffleSelf(array, size) { 26418 var index = -1, 26419 length = array.length, 26420 lastIndex = length - 1; 26421 26422 size = size === undefined ? length : size; 26423 while (++index < size) { 26424 var rand = baseRandom(index, lastIndex), 26425 value = array[rand]; 26426 26427 array[rand] = array[index]; 26428 array[index] = value; 26429 } 26430 array.length = size; 26431 return array; 26432 } 26433 26434 /** 26435 * Converts `string` to a property path array. 26436 * 26437 * @private 26438 * @param {string} string The string to convert. 26439 * @returns {Array} Returns the property path array. 26440 */ 26441 var stringToPath = memoizeCapped(function(string) { 26442 var result = []; 26443 if (string.charCodeAt(0) === 46 /* . */) { 26444 result.push(''); 26445 } 26446 string.replace(rePropName, function(match, number, quote, subString) { 26447 result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); 26448 }); 26449 return result; 26450 }); 26451 26452 /** 26453 * Converts `value` to a string key if it's not a string or symbol. 26454 * 26455 * @private 26456 * @param {*} value The value to inspect. 26457 * @returns {string|symbol} Returns the key. 26458 */ 26459 function toKey(value) { 26460 if (typeof value == 'string' || isSymbol(value)) { 26461 return value; 26462 } 26463 var result = (value + ''); 26464 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; 26465 } 26466 26467 /** 26468 * Converts `func` to its source code. 26469 * 26470 * @private 26471 * @param {Function} func The function to convert. 26472 * @returns {string} Returns the source code. 26473 */ 26474 function toSource(func) { 26475 if (func != null) { 26476 try { 26477 return funcToString.call(func); 26478 } catch (e) {} 26479 try { 26480 return (func + ''); 26481 } catch (e) {} 26482 } 26483 return ''; 26484 } 26485 26486 /** 26487 * Updates wrapper `details` based on `bitmask` flags. 26488 * 26489 * @private 26490 * @returns {Array} details The details to modify. 26491 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 26492 * @returns {Array} Returns `details`. 26493 */ 26494 function updateWrapDetails(details, bitmask) { 26495 arrayEach(wrapFlags, function(pair) { 26496 var value = '_.' + pair[0]; 26497 if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { 26498 details.push(value); 26499 } 26500 }); 26501 return details.sort(); 26502 } 26503 26504 /** 26505 * Creates a clone of `wrapper`. 26506 * 26507 * @private 26508 * @param {Object} wrapper The wrapper to clone. 26509 * @returns {Object} Returns the cloned wrapper. 26510 */ 26511 function wrapperClone(wrapper) { 26512 if (wrapper instanceof LazyWrapper) { 26513 return wrapper.clone(); 26514 } 26515 var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); 26516 result.__actions__ = copyArray(wrapper.__actions__); 26517 result.__index__ = wrapper.__index__; 26518 result.__values__ = wrapper.__values__; 26519 return result; 26520 } 26521 26522 /*------------------------------------------------------------------------*/ 26523 26524 /** 26525 * Creates an array of elements split into groups the length of `size`. 26526 * If `array` can't be split evenly, the final chunk will be the remaining 26527 * elements. 26528 * 26529 * @static 26530 * @memberOf _ 26531 * @since 3.0.0 26532 * @category Array 26533 * @param {Array} array The array to process. 26534 * @param {number} [size=1] The length of each chunk 26535 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 26536 * @returns {Array} Returns the new array of chunks. 26537 * @example 26538 * 26539 * _.chunk(['a', 'b', 'c', 'd'], 2); 26540 * // => [['a', 'b'], ['c', 'd']] 26541 * 26542 * _.chunk(['a', 'b', 'c', 'd'], 3); 26543 * // => [['a', 'b', 'c'], ['d']] 26544 */ 26545 function chunk(array, size, guard) { 26546 if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { 26547 size = 1; 26548 } else { 26549 size = nativeMax(toInteger(size), 0); 26550 } 26551 var length = array == null ? 0 : array.length; 26552 if (!length || size < 1) { 26553 return []; 26554 } 26555 var index = 0, 26556 resIndex = 0, 26557 result = Array(nativeCeil(length / size)); 26558 26559 while (index < length) { 26560 result[resIndex++] = baseSlice(array, index, (index += size)); 26561 } 26562 return result; 26563 } 26564 26565 /** 26566 * Creates an array with all falsey values removed. The values `false`, `null`, 26567 * `0`, `""`, `undefined`, and `NaN` are falsey. 26568 * 26569 * @static 26570 * @memberOf _ 26571 * @since 0.1.0 26572 * @category Array 26573 * @param {Array} array The array to compact. 26574 * @returns {Array} Returns the new array of filtered values. 26575 * @example 26576 * 26577 * _.compact([0, 1, false, 2, '', 3]); 26578 * // => [1, 2, 3] 26579 */ 26580 function compact(array) { 26581 var index = -1, 26582 length = array == null ? 0 : array.length, 26583 resIndex = 0, 26584 result = []; 26585 26586 while (++index < length) { 26587 var value = array[index]; 26588 if (value) { 26589 result[resIndex++] = value; 26590 } 26591 } 26592 return result; 26593 } 26594 26595 /** 26596 * Creates a new array concatenating `array` with any additional arrays 26597 * and/or values. 26598 * 26599 * @static 26600 * @memberOf _ 26601 * @since 4.0.0 26602 * @category Array 26603 * @param {Array} array The array to concatenate. 26604 * @param {...*} [values] The values to concatenate. 26605 * @returns {Array} Returns the new concatenated array. 26606 * @example 26607 * 26608 * var array = [1]; 26609 * var other = _.concat(array, 2, [3], [[4]]); 26610 * 26611 * console.log(other); 26612 * // => [1, 2, 3, [4]] 26613 * 26614 * console.log(array); 26615 * // => [1] 26616 */ 26617 function concat() { 26618 var length = arguments.length; 26619 if (!length) { 26620 return []; 26621 } 26622 var args = Array(length - 1), 26623 array = arguments[0], 26624 index = length; 26625 26626 while (index--) { 26627 args[index - 1] = arguments[index]; 26628 } 26629 return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); 26630 } 26631 26632 /** 26633 * Creates an array of `array` values not included in the other given arrays 26634 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 26635 * for equality comparisons. The order and references of result values are 26636 * determined by the first array. 26637 * 26638 * **Note:** Unlike `_.pullAll`, this method returns a new array. 26639 * 26640 * @static 26641 * @memberOf _ 26642 * @since 0.1.0 26643 * @category Array 26644 * @param {Array} array The array to inspect. 26645 * @param {...Array} [values] The values to exclude. 26646 * @returns {Array} Returns the new array of filtered values. 26647 * @see _.without, _.xor 26648 * @example 26649 * 26650 * _.difference([2, 1], [2, 3]); 26651 * // => [1] 26652 */ 26653 var difference = baseRest(function(array, values) { 26654 return isArrayLikeObject(array) 26655 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) 26656 : []; 26657 }); 26658 26659 /** 26660 * This method is like `_.difference` except that it accepts `iteratee` which 26661 * is invoked for each element of `array` and `values` to generate the criterion 26662 * by which they're compared. The order and references of result values are 26663 * determined by the first array. The iteratee is invoked with one argument: 26664 * (value). 26665 * 26666 * **Note:** Unlike `_.pullAllBy`, this method returns a new array. 26667 * 26668 * @static 26669 * @memberOf _ 26670 * @since 4.0.0 26671 * @category Array 26672 * @param {Array} array The array to inspect. 26673 * @param {...Array} [values] The values to exclude. 26674 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 26675 * @returns {Array} Returns the new array of filtered values. 26676 * @example 26677 * 26678 * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); 26679 * // => [1.2] 26680 * 26681 * // The `_.property` iteratee shorthand. 26682 * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); 26683 * // => [{ 'x': 2 }] 26684 */ 26685 var differenceBy = baseRest(function(array, values) { 26686 var iteratee = last(values); 26687 if (isArrayLikeObject(iteratee)) { 26688 iteratee = undefined; 26689 } 26690 return isArrayLikeObject(array) 26691 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)) 26692 : []; 26693 }); 26694 26695 /** 26696 * This method is like `_.difference` except that it accepts `comparator` 26697 * which is invoked to compare elements of `array` to `values`. The order and 26698 * references of result values are determined by the first array. The comparator 26699 * is invoked with two arguments: (arrVal, othVal). 26700 * 26701 * **Note:** Unlike `_.pullAllWith`, this method returns a new array. 26702 * 26703 * @static 26704 * @memberOf _ 26705 * @since 4.0.0 26706 * @category Array 26707 * @param {Array} array The array to inspect. 26708 * @param {...Array} [values] The values to exclude. 26709 * @param {Function} [comparator] The comparator invoked per element. 26710 * @returns {Array} Returns the new array of filtered values. 26711 * @example 26712 * 26713 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 26714 * 26715 * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); 26716 * // => [{ 'x': 2, 'y': 1 }] 26717 */ 26718 var differenceWith = baseRest(function(array, values) { 26719 var comparator = last(values); 26720 if (isArrayLikeObject(comparator)) { 26721 comparator = undefined; 26722 } 26723 return isArrayLikeObject(array) 26724 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) 26725 : []; 26726 }); 26727 26728 /** 26729 * Creates a slice of `array` with `n` elements dropped from the beginning. 26730 * 26731 * @static 26732 * @memberOf _ 26733 * @since 0.5.0 26734 * @category Array 26735 * @param {Array} array The array to query. 26736 * @param {number} [n=1] The number of elements to drop. 26737 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 26738 * @returns {Array} Returns the slice of `array`. 26739 * @example 26740 * 26741 * _.drop([1, 2, 3]); 26742 * // => [2, 3] 26743 * 26744 * _.drop([1, 2, 3], 2); 26745 * // => [3] 26746 * 26747 * _.drop([1, 2, 3], 5); 26748 * // => [] 26749 * 26750 * _.drop([1, 2, 3], 0); 26751 * // => [1, 2, 3] 26752 */ 26753 function drop(array, n, guard) { 26754 var length = array == null ? 0 : array.length; 26755 if (!length) { 26756 return []; 26757 } 26758 n = (guard || n === undefined) ? 1 : toInteger(n); 26759 return baseSlice(array, n < 0 ? 0 : n, length); 26760 } 26761 26762 /** 26763 * Creates a slice of `array` with `n` elements dropped from the end. 26764 * 26765 * @static 26766 * @memberOf _ 26767 * @since 3.0.0 26768 * @category Array 26769 * @param {Array} array The array to query. 26770 * @param {number} [n=1] The number of elements to drop. 26771 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 26772 * @returns {Array} Returns the slice of `array`. 26773 * @example 26774 * 26775 * _.dropRight([1, 2, 3]); 26776 * // => [1, 2] 26777 * 26778 * _.dropRight([1, 2, 3], 2); 26779 * // => [1] 26780 * 26781 * _.dropRight([1, 2, 3], 5); 26782 * // => [] 26783 * 26784 * _.dropRight([1, 2, 3], 0); 26785 * // => [1, 2, 3] 26786 */ 26787 function dropRight(array, n, guard) { 26788 var length = array == null ? 0 : array.length; 26789 if (!length) { 26790 return []; 26791 } 26792 n = (guard || n === undefined) ? 1 : toInteger(n); 26793 n = length - n; 26794 return baseSlice(array, 0, n < 0 ? 0 : n); 26795 } 26796 26797 /** 26798 * Creates a slice of `array` excluding elements dropped from the end. 26799 * Elements are dropped until `predicate` returns falsey. The predicate is 26800 * invoked with three arguments: (value, index, array). 26801 * 26802 * @static 26803 * @memberOf _ 26804 * @since 3.0.0 26805 * @category Array 26806 * @param {Array} array The array to query. 26807 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26808 * @returns {Array} Returns the slice of `array`. 26809 * @example 26810 * 26811 * var users = [ 26812 * { 'user': 'barney', 'active': true }, 26813 * { 'user': 'fred', 'active': false }, 26814 * { 'user': 'pebbles', 'active': false } 26815 * ]; 26816 * 26817 * _.dropRightWhile(users, function(o) { return !o.active; }); 26818 * // => objects for ['barney'] 26819 * 26820 * // The `_.matches` iteratee shorthand. 26821 * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); 26822 * // => objects for ['barney', 'fred'] 26823 * 26824 * // The `_.matchesProperty` iteratee shorthand. 26825 * _.dropRightWhile(users, ['active', false]); 26826 * // => objects for ['barney'] 26827 * 26828 * // The `_.property` iteratee shorthand. 26829 * _.dropRightWhile(users, 'active'); 26830 * // => objects for ['barney', 'fred', 'pebbles'] 26831 */ 26832 function dropRightWhile(array, predicate) { 26833 return (array && array.length) 26834 ? baseWhile(array, getIteratee(predicate, 3), true, true) 26835 : []; 26836 } 26837 26838 /** 26839 * Creates a slice of `array` excluding elements dropped from the beginning. 26840 * Elements are dropped until `predicate` returns falsey. The predicate is 26841 * invoked with three arguments: (value, index, array). 26842 * 26843 * @static 26844 * @memberOf _ 26845 * @since 3.0.0 26846 * @category Array 26847 * @param {Array} array The array to query. 26848 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26849 * @returns {Array} Returns the slice of `array`. 26850 * @example 26851 * 26852 * var users = [ 26853 * { 'user': 'barney', 'active': false }, 26854 * { 'user': 'fred', 'active': false }, 26855 * { 'user': 'pebbles', 'active': true } 26856 * ]; 26857 * 26858 * _.dropWhile(users, function(o) { return !o.active; }); 26859 * // => objects for ['pebbles'] 26860 * 26861 * // The `_.matches` iteratee shorthand. 26862 * _.dropWhile(users, { 'user': 'barney', 'active': false }); 26863 * // => objects for ['fred', 'pebbles'] 26864 * 26865 * // The `_.matchesProperty` iteratee shorthand. 26866 * _.dropWhile(users, ['active', false]); 26867 * // => objects for ['pebbles'] 26868 * 26869 * // The `_.property` iteratee shorthand. 26870 * _.dropWhile(users, 'active'); 26871 * // => objects for ['barney', 'fred', 'pebbles'] 26872 */ 26873 function dropWhile(array, predicate) { 26874 return (array && array.length) 26875 ? baseWhile(array, getIteratee(predicate, 3), true) 26876 : []; 26877 } 26878 26879 /** 26880 * Fills elements of `array` with `value` from `start` up to, but not 26881 * including, `end`. 26882 * 26883 * **Note:** This method mutates `array`. 26884 * 26885 * @static 26886 * @memberOf _ 26887 * @since 3.2.0 26888 * @category Array 26889 * @param {Array} array The array to fill. 26890 * @param {*} value The value to fill `array` with. 26891 * @param {number} [start=0] The start position. 26892 * @param {number} [end=array.length] The end position. 26893 * @returns {Array} Returns `array`. 26894 * @example 26895 * 26896 * var array = [1, 2, 3]; 26897 * 26898 * _.fill(array, 'a'); 26899 * console.log(array); 26900 * // => ['a', 'a', 'a'] 26901 * 26902 * _.fill(Array(3), 2); 26903 * // => [2, 2, 2] 26904 * 26905 * _.fill([4, 6, 8, 10], '*', 1, 3); 26906 * // => [4, '*', '*', 10] 26907 */ 26908 function fill(array, value, start, end) { 26909 var length = array == null ? 0 : array.length; 26910 if (!length) { 26911 return []; 26912 } 26913 if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { 26914 start = 0; 26915 end = length; 26916 } 26917 return baseFill(array, value, start, end); 26918 } 26919 26920 /** 26921 * This method is like `_.find` except that it returns the index of the first 26922 * element `predicate` returns truthy for instead of the element itself. 26923 * 26924 * @static 26925 * @memberOf _ 26926 * @since 1.1.0 26927 * @category Array 26928 * @param {Array} array The array to inspect. 26929 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26930 * @param {number} [fromIndex=0] The index to search from. 26931 * @returns {number} Returns the index of the found element, else `-1`. 26932 * @example 26933 * 26934 * var users = [ 26935 * { 'user': 'barney', 'active': false }, 26936 * { 'user': 'fred', 'active': false }, 26937 * { 'user': 'pebbles', 'active': true } 26938 * ]; 26939 * 26940 * _.findIndex(users, function(o) { return o.user == 'barney'; }); 26941 * // => 0 26942 * 26943 * // The `_.matches` iteratee shorthand. 26944 * _.findIndex(users, { 'user': 'fred', 'active': false }); 26945 * // => 1 26946 * 26947 * // The `_.matchesProperty` iteratee shorthand. 26948 * _.findIndex(users, ['active', false]); 26949 * // => 0 26950 * 26951 * // The `_.property` iteratee shorthand. 26952 * _.findIndex(users, 'active'); 26953 * // => 2 26954 */ 26955 function findIndex(array, predicate, fromIndex) { 26956 var length = array == null ? 0 : array.length; 26957 if (!length) { 26958 return -1; 26959 } 26960 var index = fromIndex == null ? 0 : toInteger(fromIndex); 26961 if (index < 0) { 26962 index = nativeMax(length + index, 0); 26963 } 26964 return baseFindIndex(array, getIteratee(predicate, 3), index); 26965 } 26966 26967 /** 26968 * This method is like `_.findIndex` except that it iterates over elements 26969 * of `collection` from right to left. 26970 * 26971 * @static 26972 * @memberOf _ 26973 * @since 2.0.0 26974 * @category Array 26975 * @param {Array} array The array to inspect. 26976 * @param {Function} [predicate=_.identity] The function invoked per iteration. 26977 * @param {number} [fromIndex=array.length-1] The index to search from. 26978 * @returns {number} Returns the index of the found element, else `-1`. 26979 * @example 26980 * 26981 * var users = [ 26982 * { 'user': 'barney', 'active': true }, 26983 * { 'user': 'fred', 'active': false }, 26984 * { 'user': 'pebbles', 'active': false } 26985 * ]; 26986 * 26987 * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); 26988 * // => 2 26989 * 26990 * // The `_.matches` iteratee shorthand. 26991 * _.findLastIndex(users, { 'user': 'barney', 'active': true }); 26992 * // => 0 26993 * 26994 * // The `_.matchesProperty` iteratee shorthand. 26995 * _.findLastIndex(users, ['active', false]); 26996 * // => 2 26997 * 26998 * // The `_.property` iteratee shorthand. 26999 * _.findLastIndex(users, 'active'); 27000 * // => 0 27001 */ 27002 function findLastIndex(array, predicate, fromIndex) { 27003 var length = array == null ? 0 : array.length; 27004 if (!length) { 27005 return -1; 27006 } 27007 var index = length - 1; 27008 if (fromIndex !== undefined) { 27009 index = toInteger(fromIndex); 27010 index = fromIndex < 0 27011 ? nativeMax(length + index, 0) 27012 : nativeMin(index, length - 1); 27013 } 27014 return baseFindIndex(array, getIteratee(predicate, 3), index, true); 27015 } 27016 27017 /** 27018 * Flattens `array` a single level deep. 27019 * 27020 * @static 27021 * @memberOf _ 27022 * @since 0.1.0 27023 * @category Array 27024 * @param {Array} array The array to flatten. 27025 * @returns {Array} Returns the new flattened array. 27026 * @example 27027 * 27028 * _.flatten([1, [2, [3, [4]], 5]]); 27029 * // => [1, 2, [3, [4]], 5] 27030 */ 27031 function flatten(array) { 27032 var length = array == null ? 0 : array.length; 27033 return length ? baseFlatten(array, 1) : []; 27034 } 27035 27036 /** 27037 * Recursively flattens `array`. 27038 * 27039 * @static 27040 * @memberOf _ 27041 * @since 3.0.0 27042 * @category Array 27043 * @param {Array} array The array to flatten. 27044 * @returns {Array} Returns the new flattened array. 27045 * @example 27046 * 27047 * _.flattenDeep([1, [2, [3, [4]], 5]]); 27048 * // => [1, 2, 3, 4, 5] 27049 */ 27050 function flattenDeep(array) { 27051 var length = array == null ? 0 : array.length; 27052 return length ? baseFlatten(array, INFINITY) : []; 27053 } 27054 27055 /** 27056 * Recursively flatten `array` up to `depth` times. 27057 * 27058 * @static 27059 * @memberOf _ 27060 * @since 4.4.0 27061 * @category Array 27062 * @param {Array} array The array to flatten. 27063 * @param {number} [depth=1] The maximum recursion depth. 27064 * @returns {Array} Returns the new flattened array. 27065 * @example 27066 * 27067 * var array = [1, [2, [3, [4]], 5]]; 27068 * 27069 * _.flattenDepth(array, 1); 27070 * // => [1, 2, [3, [4]], 5] 27071 * 27072 * _.flattenDepth(array, 2); 27073 * // => [1, 2, 3, [4], 5] 27074 */ 27075 function flattenDepth(array, depth) { 27076 var length = array == null ? 0 : array.length; 27077 if (!length) { 27078 return []; 27079 } 27080 depth = depth === undefined ? 1 : toInteger(depth); 27081 return baseFlatten(array, depth); 27082 } 27083 27084 /** 27085 * The inverse of `_.toPairs`; this method returns an object composed 27086 * from key-value `pairs`. 27087 * 27088 * @static 27089 * @memberOf _ 27090 * @since 4.0.0 27091 * @category Array 27092 * @param {Array} pairs The key-value pairs. 27093 * @returns {Object} Returns the new object. 27094 * @example 27095 * 27096 * _.fromPairs([['a', 1], ['b', 2]]); 27097 * // => { 'a': 1, 'b': 2 } 27098 */ 27099 function fromPairs(pairs) { 27100 var index = -1, 27101 length = pairs == null ? 0 : pairs.length, 27102 result = {}; 27103 27104 while (++index < length) { 27105 var pair = pairs[index]; 27106 result[pair[0]] = pair[1]; 27107 } 27108 return result; 27109 } 27110 27111 /** 27112 * Gets the first element of `array`. 27113 * 27114 * @static 27115 * @memberOf _ 27116 * @since 0.1.0 27117 * @alias first 27118 * @category Array 27119 * @param {Array} array The array to query. 27120 * @returns {*} Returns the first element of `array`. 27121 * @example 27122 * 27123 * _.head([1, 2, 3]); 27124 * // => 1 27125 * 27126 * _.head([]); 27127 * // => undefined 27128 */ 27129 function head(array) { 27130 return (array && array.length) ? array[0] : undefined; 27131 } 27132 27133 /** 27134 * Gets the index at which the first occurrence of `value` is found in `array` 27135 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 27136 * for equality comparisons. If `fromIndex` is negative, it's used as the 27137 * offset from the end of `array`. 27138 * 27139 * @static 27140 * @memberOf _ 27141 * @since 0.1.0 27142 * @category Array 27143 * @param {Array} array The array to inspect. 27144 * @param {*} value The value to search for. 27145 * @param {number} [fromIndex=0] The index to search from. 27146 * @returns {number} Returns the index of the matched value, else `-1`. 27147 * @example 27148 * 27149 * _.indexOf([1, 2, 1, 2], 2); 27150 * // => 1 27151 * 27152 * // Search from the `fromIndex`. 27153 * _.indexOf([1, 2, 1, 2], 2, 2); 27154 * // => 3 27155 */ 27156 function indexOf(array, value, fromIndex) { 27157 var length = array == null ? 0 : array.length; 27158 if (!length) { 27159 return -1; 27160 } 27161 var index = fromIndex == null ? 0 : toInteger(fromIndex); 27162 if (index < 0) { 27163 index = nativeMax(length + index, 0); 27164 } 27165 return baseIndexOf(array, value, index); 27166 } 27167 27168 /** 27169 * Gets all but the last element of `array`. 27170 * 27171 * @static 27172 * @memberOf _ 27173 * @since 0.1.0 27174 * @category Array 27175 * @param {Array} array The array to query. 27176 * @returns {Array} Returns the slice of `array`. 27177 * @example 27178 * 27179 * _.initial([1, 2, 3]); 27180 * // => [1, 2] 27181 */ 27182 function initial(array) { 27183 var length = array == null ? 0 : array.length; 27184 return length ? baseSlice(array, 0, -1) : []; 27185 } 27186 27187 /** 27188 * Creates an array of unique values that are included in all given arrays 27189 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 27190 * for equality comparisons. The order and references of result values are 27191 * determined by the first array. 27192 * 27193 * @static 27194 * @memberOf _ 27195 * @since 0.1.0 27196 * @category Array 27197 * @param {...Array} [arrays] The arrays to inspect. 27198 * @returns {Array} Returns the new array of intersecting values. 27199 * @example 27200 * 27201 * _.intersection([2, 1], [2, 3]); 27202 * // => [2] 27203 */ 27204 var intersection = baseRest(function(arrays) { 27205 var mapped = arrayMap(arrays, castArrayLikeObject); 27206 return (mapped.length && mapped[0] === arrays[0]) 27207 ? baseIntersection(mapped) 27208 : []; 27209 }); 27210 27211 /** 27212 * This method is like `_.intersection` except that it accepts `iteratee` 27213 * which is invoked for each element of each `arrays` to generate the criterion 27214 * by which they're compared. The order and references of result values are 27215 * determined by the first array. The iteratee is invoked with one argument: 27216 * (value). 27217 * 27218 * @static 27219 * @memberOf _ 27220 * @since 4.0.0 27221 * @category Array 27222 * @param {...Array} [arrays] The arrays to inspect. 27223 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 27224 * @returns {Array} Returns the new array of intersecting values. 27225 * @example 27226 * 27227 * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); 27228 * // => [2.1] 27229 * 27230 * // The `_.property` iteratee shorthand. 27231 * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 27232 * // => [{ 'x': 1 }] 27233 */ 27234 var intersectionBy = baseRest(function(arrays) { 27235 var iteratee = last(arrays), 27236 mapped = arrayMap(arrays, castArrayLikeObject); 27237 27238 if (iteratee === last(mapped)) { 27239 iteratee = undefined; 27240 } else { 27241 mapped.pop(); 27242 } 27243 return (mapped.length && mapped[0] === arrays[0]) 27244 ? baseIntersection(mapped, getIteratee(iteratee, 2)) 27245 : []; 27246 }); 27247 27248 /** 27249 * This method is like `_.intersection` except that it accepts `comparator` 27250 * which is invoked to compare elements of `arrays`. The order and references 27251 * of result values are determined by the first array. The comparator is 27252 * invoked with two arguments: (arrVal, othVal). 27253 * 27254 * @static 27255 * @memberOf _ 27256 * @since 4.0.0 27257 * @category Array 27258 * @param {...Array} [arrays] The arrays to inspect. 27259 * @param {Function} [comparator] The comparator invoked per element. 27260 * @returns {Array} Returns the new array of intersecting values. 27261 * @example 27262 * 27263 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 27264 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 27265 * 27266 * _.intersectionWith(objects, others, _.isEqual); 27267 * // => [{ 'x': 1, 'y': 2 }] 27268 */ 27269 var intersectionWith = baseRest(function(arrays) { 27270 var comparator = last(arrays), 27271 mapped = arrayMap(arrays, castArrayLikeObject); 27272 27273 comparator = typeof comparator == 'function' ? comparator : undefined; 27274 if (comparator) { 27275 mapped.pop(); 27276 } 27277 return (mapped.length && mapped[0] === arrays[0]) 27278 ? baseIntersection(mapped, undefined, comparator) 27279 : []; 27280 }); 27281 27282 /** 27283 * Converts all elements in `array` into a string separated by `separator`. 27284 * 27285 * @static 27286 * @memberOf _ 27287 * @since 4.0.0 27288 * @category Array 27289 * @param {Array} array The array to convert. 27290 * @param {string} [separator=','] The element separator. 27291 * @returns {string} Returns the joined string. 27292 * @example 27293 * 27294 * _.join(['a', 'b', 'c'], '~'); 27295 * // => 'a~b~c' 27296 */ 27297 function join(array, separator) { 27298 return array == null ? '' : nativeJoin.call(array, separator); 27299 } 27300 27301 /** 27302 * Gets the last element of `array`. 27303 * 27304 * @static 27305 * @memberOf _ 27306 * @since 0.1.0 27307 * @category Array 27308 * @param {Array} array The array to query. 27309 * @returns {*} Returns the last element of `array`. 27310 * @example 27311 * 27312 * _.last([1, 2, 3]); 27313 * // => 3 27314 */ 27315 function last(array) { 27316 var length = array == null ? 0 : array.length; 27317 return length ? array[length - 1] : undefined; 27318 } 27319 27320 /** 27321 * This method is like `_.indexOf` except that it iterates over elements of 27322 * `array` from right to left. 27323 * 27324 * @static 27325 * @memberOf _ 27326 * @since 0.1.0 27327 * @category Array 27328 * @param {Array} array The array to inspect. 27329 * @param {*} value The value to search for. 27330 * @param {number} [fromIndex=array.length-1] The index to search from. 27331 * @returns {number} Returns the index of the matched value, else `-1`. 27332 * @example 27333 * 27334 * _.lastIndexOf([1, 2, 1, 2], 2); 27335 * // => 3 27336 * 27337 * // Search from the `fromIndex`. 27338 * _.lastIndexOf([1, 2, 1, 2], 2, 2); 27339 * // => 1 27340 */ 27341 function lastIndexOf(array, value, fromIndex) { 27342 var length = array == null ? 0 : array.length; 27343 if (!length) { 27344 return -1; 27345 } 27346 var index = length; 27347 if (fromIndex !== undefined) { 27348 index = toInteger(fromIndex); 27349 index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); 27350 } 27351 return value === value 27352 ? strictLastIndexOf(array, value, index) 27353 : baseFindIndex(array, baseIsNaN, index, true); 27354 } 27355 27356 /** 27357 * Gets the element at index `n` of `array`. If `n` is negative, the nth 27358 * element from the end is returned. 27359 * 27360 * @static 27361 * @memberOf _ 27362 * @since 4.11.0 27363 * @category Array 27364 * @param {Array} array The array to query. 27365 * @param {number} [n=0] The index of the element to return. 27366 * @returns {*} Returns the nth element of `array`. 27367 * @example 27368 * 27369 * var array = ['a', 'b', 'c', 'd']; 27370 * 27371 * _.nth(array, 1); 27372 * // => 'b' 27373 * 27374 * _.nth(array, -2); 27375 * // => 'c'; 27376 */ 27377 function nth(array, n) { 27378 return (array && array.length) ? baseNth(array, toInteger(n)) : undefined; 27379 } 27380 27381 /** 27382 * Removes all given values from `array` using 27383 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 27384 * for equality comparisons. 27385 * 27386 * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` 27387 * to remove elements from an array by predicate. 27388 * 27389 * @static 27390 * @memberOf _ 27391 * @since 2.0.0 27392 * @category Array 27393 * @param {Array} array The array to modify. 27394 * @param {...*} [values] The values to remove. 27395 * @returns {Array} Returns `array`. 27396 * @example 27397 * 27398 * var array = ['a', 'b', 'c', 'a', 'b', 'c']; 27399 * 27400 * _.pull(array, 'a', 'c'); 27401 * console.log(array); 27402 * // => ['b', 'b'] 27403 */ 27404 var pull = baseRest(pullAll); 27405 27406 /** 27407 * This method is like `_.pull` except that it accepts an array of values to remove. 27408 * 27409 * **Note:** Unlike `_.difference`, this method mutates `array`. 27410 * 27411 * @static 27412 * @memberOf _ 27413 * @since 4.0.0 27414 * @category Array 27415 * @param {Array} array The array to modify. 27416 * @param {Array} values The values to remove. 27417 * @returns {Array} Returns `array`. 27418 * @example 27419 * 27420 * var array = ['a', 'b', 'c', 'a', 'b', 'c']; 27421 * 27422 * _.pullAll(array, ['a', 'c']); 27423 * console.log(array); 27424 * // => ['b', 'b'] 27425 */ 27426 function pullAll(array, values) { 27427 return (array && array.length && values && values.length) 27428 ? basePullAll(array, values) 27429 : array; 27430 } 27431 27432 /** 27433 * This method is like `_.pullAll` except that it accepts `iteratee` which is 27434 * invoked for each element of `array` and `values` to generate the criterion 27435 * by which they're compared. The iteratee is invoked with one argument: (value). 27436 * 27437 * **Note:** Unlike `_.differenceBy`, this method mutates `array`. 27438 * 27439 * @static 27440 * @memberOf _ 27441 * @since 4.0.0 27442 * @category Array 27443 * @param {Array} array The array to modify. 27444 * @param {Array} values The values to remove. 27445 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 27446 * @returns {Array} Returns `array`. 27447 * @example 27448 * 27449 * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; 27450 * 27451 * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); 27452 * console.log(array); 27453 * // => [{ 'x': 2 }] 27454 */ 27455 function pullAllBy(array, values, iteratee) { 27456 return (array && array.length && values && values.length) 27457 ? basePullAll(array, values, getIteratee(iteratee, 2)) 27458 : array; 27459 } 27460 27461 /** 27462 * This method is like `_.pullAll` except that it accepts `comparator` which 27463 * is invoked to compare elements of `array` to `values`. The comparator is 27464 * invoked with two arguments: (arrVal, othVal). 27465 * 27466 * **Note:** Unlike `_.differenceWith`, this method mutates `array`. 27467 * 27468 * @static 27469 * @memberOf _ 27470 * @since 4.6.0 27471 * @category Array 27472 * @param {Array} array The array to modify. 27473 * @param {Array} values The values to remove. 27474 * @param {Function} [comparator] The comparator invoked per element. 27475 * @returns {Array} Returns `array`. 27476 * @example 27477 * 27478 * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; 27479 * 27480 * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); 27481 * console.log(array); 27482 * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] 27483 */ 27484 function pullAllWith(array, values, comparator) { 27485 return (array && array.length && values && values.length) 27486 ? basePullAll(array, values, undefined, comparator) 27487 : array; 27488 } 27489 27490 /** 27491 * Removes elements from `array` corresponding to `indexes` and returns an 27492 * array of removed elements. 27493 * 27494 * **Note:** Unlike `_.at`, this method mutates `array`. 27495 * 27496 * @static 27497 * @memberOf _ 27498 * @since 3.0.0 27499 * @category Array 27500 * @param {Array} array The array to modify. 27501 * @param {...(number|number[])} [indexes] The indexes of elements to remove. 27502 * @returns {Array} Returns the new array of removed elements. 27503 * @example 27504 * 27505 * var array = ['a', 'b', 'c', 'd']; 27506 * var pulled = _.pullAt(array, [1, 3]); 27507 * 27508 * console.log(array); 27509 * // => ['a', 'c'] 27510 * 27511 * console.log(pulled); 27512 * // => ['b', 'd'] 27513 */ 27514 var pullAt = flatRest(function(array, indexes) { 27515 var length = array == null ? 0 : array.length, 27516 result = baseAt(array, indexes); 27517 27518 basePullAt(array, arrayMap(indexes, function(index) { 27519 return isIndex(index, length) ? +index : index; 27520 }).sort(compareAscending)); 27521 27522 return result; 27523 }); 27524 27525 /** 27526 * Removes all elements from `array` that `predicate` returns truthy for 27527 * and returns an array of the removed elements. The predicate is invoked 27528 * with three arguments: (value, index, array). 27529 * 27530 * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` 27531 * to pull elements from an array by value. 27532 * 27533 * @static 27534 * @memberOf _ 27535 * @since 2.0.0 27536 * @category Array 27537 * @param {Array} array The array to modify. 27538 * @param {Function} [predicate=_.identity] The function invoked per iteration. 27539 * @returns {Array} Returns the new array of removed elements. 27540 * @example 27541 * 27542 * var array = [1, 2, 3, 4]; 27543 * var evens = _.remove(array, function(n) { 27544 * return n % 2 == 0; 27545 * }); 27546 * 27547 * console.log(array); 27548 * // => [1, 3] 27549 * 27550 * console.log(evens); 27551 * // => [2, 4] 27552 */ 27553 function remove(array, predicate) { 27554 var result = []; 27555 if (!(array && array.length)) { 27556 return result; 27557 } 27558 var index = -1, 27559 indexes = [], 27560 length = array.length; 27561 27562 predicate = getIteratee(predicate, 3); 27563 while (++index < length) { 27564 var value = array[index]; 27565 if (predicate(value, index, array)) { 27566 result.push(value); 27567 indexes.push(index); 27568 } 27569 } 27570 basePullAt(array, indexes); 27571 return result; 27572 } 27573 27574 /** 27575 * Reverses `array` so that the first element becomes the last, the second 27576 * element becomes the second to last, and so on. 27577 * 27578 * **Note:** This method mutates `array` and is based on 27579 * [`Array#reverse`](https://mdn.io/Array/reverse). 27580 * 27581 * @static 27582 * @memberOf _ 27583 * @since 4.0.0 27584 * @category Array 27585 * @param {Array} array The array to modify. 27586 * @returns {Array} Returns `array`. 27587 * @example 27588 * 27589 * var array = [1, 2, 3]; 27590 * 27591 * _.reverse(array); 27592 * // => [3, 2, 1] 27593 * 27594 * console.log(array); 27595 * // => [3, 2, 1] 27596 */ 27597 function reverse(array) { 27598 return array == null ? array : nativeReverse.call(array); 27599 } 27600 27601 /** 27602 * Creates a slice of `array` from `start` up to, but not including, `end`. 27603 * 27604 * **Note:** This method is used instead of 27605 * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are 27606 * returned. 27607 * 27608 * @static 27609 * @memberOf _ 27610 * @since 3.0.0 27611 * @category Array 27612 * @param {Array} array The array to slice. 27613 * @param {number} [start=0] The start position. 27614 * @param {number} [end=array.length] The end position. 27615 * @returns {Array} Returns the slice of `array`. 27616 */ 27617 function slice(array, start, end) { 27618 var length = array == null ? 0 : array.length; 27619 if (!length) { 27620 return []; 27621 } 27622 if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { 27623 start = 0; 27624 end = length; 27625 } 27626 else { 27627 start = start == null ? 0 : toInteger(start); 27628 end = end === undefined ? length : toInteger(end); 27629 } 27630 return baseSlice(array, start, end); 27631 } 27632 27633 /** 27634 * Uses a binary search to determine the lowest index at which `value` 27635 * should be inserted into `array` in order to maintain its sort order. 27636 * 27637 * @static 27638 * @memberOf _ 27639 * @since 0.1.0 27640 * @category Array 27641 * @param {Array} array The sorted array to inspect. 27642 * @param {*} value The value to evaluate. 27643 * @returns {number} Returns the index at which `value` should be inserted 27644 * into `array`. 27645 * @example 27646 * 27647 * _.sortedIndex([30, 50], 40); 27648 * // => 1 27649 */ 27650 function sortedIndex(array, value) { 27651 return baseSortedIndex(array, value); 27652 } 27653 27654 /** 27655 * This method is like `_.sortedIndex` except that it accepts `iteratee` 27656 * which is invoked for `value` and each element of `array` to compute their 27657 * sort ranking. The iteratee is invoked with one argument: (value). 27658 * 27659 * @static 27660 * @memberOf _ 27661 * @since 4.0.0 27662 * @category Array 27663 * @param {Array} array The sorted array to inspect. 27664 * @param {*} value The value to evaluate. 27665 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 27666 * @returns {number} Returns the index at which `value` should be inserted 27667 * into `array`. 27668 * @example 27669 * 27670 * var objects = [{ 'x': 4 }, { 'x': 5 }]; 27671 * 27672 * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); 27673 * // => 0 27674 * 27675 * // The `_.property` iteratee shorthand. 27676 * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); 27677 * // => 0 27678 */ 27679 function sortedIndexBy(array, value, iteratee) { 27680 return baseSortedIndexBy(array, value, getIteratee(iteratee, 2)); 27681 } 27682 27683 /** 27684 * This method is like `_.indexOf` except that it performs a binary 27685 * search on a sorted `array`. 27686 * 27687 * @static 27688 * @memberOf _ 27689 * @since 4.0.0 27690 * @category Array 27691 * @param {Array} array The array to inspect. 27692 * @param {*} value The value to search for. 27693 * @returns {number} Returns the index of the matched value, else `-1`. 27694 * @example 27695 * 27696 * _.sortedIndexOf([4, 5, 5, 5, 6], 5); 27697 * // => 1 27698 */ 27699 function sortedIndexOf(array, value) { 27700 var length = array == null ? 0 : array.length; 27701 if (length) { 27702 var index = baseSortedIndex(array, value); 27703 if (index < length && eq(array[index], value)) { 27704 return index; 27705 } 27706 } 27707 return -1; 27708 } 27709 27710 /** 27711 * This method is like `_.sortedIndex` except that it returns the highest 27712 * index at which `value` should be inserted into `array` in order to 27713 * maintain its sort order. 27714 * 27715 * @static 27716 * @memberOf _ 27717 * @since 3.0.0 27718 * @category Array 27719 * @param {Array} array The sorted array to inspect. 27720 * @param {*} value The value to evaluate. 27721 * @returns {number} Returns the index at which `value` should be inserted 27722 * into `array`. 27723 * @example 27724 * 27725 * _.sortedLastIndex([4, 5, 5, 5, 6], 5); 27726 * // => 4 27727 */ 27728 function sortedLastIndex(array, value) { 27729 return baseSortedIndex(array, value, true); 27730 } 27731 27732 /** 27733 * This method is like `_.sortedLastIndex` except that it accepts `iteratee` 27734 * which is invoked for `value` and each element of `array` to compute their 27735 * sort ranking. The iteratee is invoked with one argument: (value). 27736 * 27737 * @static 27738 * @memberOf _ 27739 * @since 4.0.0 27740 * @category Array 27741 * @param {Array} array The sorted array to inspect. 27742 * @param {*} value The value to evaluate. 27743 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 27744 * @returns {number} Returns the index at which `value` should be inserted 27745 * into `array`. 27746 * @example 27747 * 27748 * var objects = [{ 'x': 4 }, { 'x': 5 }]; 27749 * 27750 * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); 27751 * // => 1 27752 * 27753 * // The `_.property` iteratee shorthand. 27754 * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); 27755 * // => 1 27756 */ 27757 function sortedLastIndexBy(array, value, iteratee) { 27758 return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true); 27759 } 27760 27761 /** 27762 * This method is like `_.lastIndexOf` except that it performs a binary 27763 * search on a sorted `array`. 27764 * 27765 * @static 27766 * @memberOf _ 27767 * @since 4.0.0 27768 * @category Array 27769 * @param {Array} array The array to inspect. 27770 * @param {*} value The value to search for. 27771 * @returns {number} Returns the index of the matched value, else `-1`. 27772 * @example 27773 * 27774 * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); 27775 * // => 3 27776 */ 27777 function sortedLastIndexOf(array, value) { 27778 var length = array == null ? 0 : array.length; 27779 if (length) { 27780 var index = baseSortedIndex(array, value, true) - 1; 27781 if (eq(array[index], value)) { 27782 return index; 27783 } 27784 } 27785 return -1; 27786 } 27787 27788 /** 27789 * This method is like `_.uniq` except that it's designed and optimized 27790 * for sorted arrays. 27791 * 27792 * @static 27793 * @memberOf _ 27794 * @since 4.0.0 27795 * @category Array 27796 * @param {Array} array The array to inspect. 27797 * @returns {Array} Returns the new duplicate free array. 27798 * @example 27799 * 27800 * _.sortedUniq([1, 1, 2]); 27801 * // => [1, 2] 27802 */ 27803 function sortedUniq(array) { 27804 return (array && array.length) 27805 ? baseSortedUniq(array) 27806 : []; 27807 } 27808 27809 /** 27810 * This method is like `_.uniqBy` except that it's designed and optimized 27811 * for sorted arrays. 27812 * 27813 * @static 27814 * @memberOf _ 27815 * @since 4.0.0 27816 * @category Array 27817 * @param {Array} array The array to inspect. 27818 * @param {Function} [iteratee] The iteratee invoked per element. 27819 * @returns {Array} Returns the new duplicate free array. 27820 * @example 27821 * 27822 * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); 27823 * // => [1.1, 2.3] 27824 */ 27825 function sortedUniqBy(array, iteratee) { 27826 return (array && array.length) 27827 ? baseSortedUniq(array, getIteratee(iteratee, 2)) 27828 : []; 27829 } 27830 27831 /** 27832 * Gets all but the first element of `array`. 27833 * 27834 * @static 27835 * @memberOf _ 27836 * @since 4.0.0 27837 * @category Array 27838 * @param {Array} array The array to query. 27839 * @returns {Array} Returns the slice of `array`. 27840 * @example 27841 * 27842 * _.tail([1, 2, 3]); 27843 * // => [2, 3] 27844 */ 27845 function tail(array) { 27846 var length = array == null ? 0 : array.length; 27847 return length ? baseSlice(array, 1, length) : []; 27848 } 27849 27850 /** 27851 * Creates a slice of `array` with `n` elements taken from the beginning. 27852 * 27853 * @static 27854 * @memberOf _ 27855 * @since 0.1.0 27856 * @category Array 27857 * @param {Array} array The array to query. 27858 * @param {number} [n=1] The number of elements to take. 27859 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 27860 * @returns {Array} Returns the slice of `array`. 27861 * @example 27862 * 27863 * _.take([1, 2, 3]); 27864 * // => [1] 27865 * 27866 * _.take([1, 2, 3], 2); 27867 * // => [1, 2] 27868 * 27869 * _.take([1, 2, 3], 5); 27870 * // => [1, 2, 3] 27871 * 27872 * _.take([1, 2, 3], 0); 27873 * // => [] 27874 */ 27875 function take(array, n, guard) { 27876 if (!(array && array.length)) { 27877 return []; 27878 } 27879 n = (guard || n === undefined) ? 1 : toInteger(n); 27880 return baseSlice(array, 0, n < 0 ? 0 : n); 27881 } 27882 27883 /** 27884 * Creates a slice of `array` with `n` elements taken from the end. 27885 * 27886 * @static 27887 * @memberOf _ 27888 * @since 3.0.0 27889 * @category Array 27890 * @param {Array} array The array to query. 27891 * @param {number} [n=1] The number of elements to take. 27892 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 27893 * @returns {Array} Returns the slice of `array`. 27894 * @example 27895 * 27896 * _.takeRight([1, 2, 3]); 27897 * // => [3] 27898 * 27899 * _.takeRight([1, 2, 3], 2); 27900 * // => [2, 3] 27901 * 27902 * _.takeRight([1, 2, 3], 5); 27903 * // => [1, 2, 3] 27904 * 27905 * _.takeRight([1, 2, 3], 0); 27906 * // => [] 27907 */ 27908 function takeRight(array, n, guard) { 27909 var length = array == null ? 0 : array.length; 27910 if (!length) { 27911 return []; 27912 } 27913 n = (guard || n === undefined) ? 1 : toInteger(n); 27914 n = length - n; 27915 return baseSlice(array, n < 0 ? 0 : n, length); 27916 } 27917 27918 /** 27919 * Creates a slice of `array` with elements taken from the end. Elements are 27920 * taken until `predicate` returns falsey. The predicate is invoked with 27921 * three arguments: (value, index, array). 27922 * 27923 * @static 27924 * @memberOf _ 27925 * @since 3.0.0 27926 * @category Array 27927 * @param {Array} array The array to query. 27928 * @param {Function} [predicate=_.identity] The function invoked per iteration. 27929 * @returns {Array} Returns the slice of `array`. 27930 * @example 27931 * 27932 * var users = [ 27933 * { 'user': 'barney', 'active': true }, 27934 * { 'user': 'fred', 'active': false }, 27935 * { 'user': 'pebbles', 'active': false } 27936 * ]; 27937 * 27938 * _.takeRightWhile(users, function(o) { return !o.active; }); 27939 * // => objects for ['fred', 'pebbles'] 27940 * 27941 * // The `_.matches` iteratee shorthand. 27942 * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); 27943 * // => objects for ['pebbles'] 27944 * 27945 * // The `_.matchesProperty` iteratee shorthand. 27946 * _.takeRightWhile(users, ['active', false]); 27947 * // => objects for ['fred', 'pebbles'] 27948 * 27949 * // The `_.property` iteratee shorthand. 27950 * _.takeRightWhile(users, 'active'); 27951 * // => [] 27952 */ 27953 function takeRightWhile(array, predicate) { 27954 return (array && array.length) 27955 ? baseWhile(array, getIteratee(predicate, 3), false, true) 27956 : []; 27957 } 27958 27959 /** 27960 * Creates a slice of `array` with elements taken from the beginning. Elements 27961 * are taken until `predicate` returns falsey. The predicate is invoked with 27962 * three arguments: (value, index, array). 27963 * 27964 * @static 27965 * @memberOf _ 27966 * @since 3.0.0 27967 * @category Array 27968 * @param {Array} array The array to query. 27969 * @param {Function} [predicate=_.identity] The function invoked per iteration. 27970 * @returns {Array} Returns the slice of `array`. 27971 * @example 27972 * 27973 * var users = [ 27974 * { 'user': 'barney', 'active': false }, 27975 * { 'user': 'fred', 'active': false }, 27976 * { 'user': 'pebbles', 'active': true } 27977 * ]; 27978 * 27979 * _.takeWhile(users, function(o) { return !o.active; }); 27980 * // => objects for ['barney', 'fred'] 27981 * 27982 * // The `_.matches` iteratee shorthand. 27983 * _.takeWhile(users, { 'user': 'barney', 'active': false }); 27984 * // => objects for ['barney'] 27985 * 27986 * // The `_.matchesProperty` iteratee shorthand. 27987 * _.takeWhile(users, ['active', false]); 27988 * // => objects for ['barney', 'fred'] 27989 * 27990 * // The `_.property` iteratee shorthand. 27991 * _.takeWhile(users, 'active'); 27992 * // => [] 27993 */ 27994 function takeWhile(array, predicate) { 27995 return (array && array.length) 27996 ? baseWhile(array, getIteratee(predicate, 3)) 27997 : []; 27998 } 27999 28000 /** 28001 * Creates an array of unique values, in order, from all given arrays using 28002 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 28003 * for equality comparisons. 28004 * 28005 * @static 28006 * @memberOf _ 28007 * @since 0.1.0 28008 * @category Array 28009 * @param {...Array} [arrays] The arrays to inspect. 28010 * @returns {Array} Returns the new array of combined values. 28011 * @example 28012 * 28013 * _.union([2], [1, 2]); 28014 * // => [2, 1] 28015 */ 28016 var union = baseRest(function(arrays) { 28017 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); 28018 }); 28019 28020 /** 28021 * This method is like `_.union` except that it accepts `iteratee` which is 28022 * invoked for each element of each `arrays` to generate the criterion by 28023 * which uniqueness is computed. Result values are chosen from the first 28024 * array in which the value occurs. The iteratee is invoked with one argument: 28025 * (value). 28026 * 28027 * @static 28028 * @memberOf _ 28029 * @since 4.0.0 28030 * @category Array 28031 * @param {...Array} [arrays] The arrays to inspect. 28032 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 28033 * @returns {Array} Returns the new array of combined values. 28034 * @example 28035 * 28036 * _.unionBy([2.1], [1.2, 2.3], Math.floor); 28037 * // => [2.1, 1.2] 28038 * 28039 * // The `_.property` iteratee shorthand. 28040 * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 28041 * // => [{ 'x': 1 }, { 'x': 2 }] 28042 */ 28043 var unionBy = baseRest(function(arrays) { 28044 var iteratee = last(arrays); 28045 if (isArrayLikeObject(iteratee)) { 28046 iteratee = undefined; 28047 } 28048 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)); 28049 }); 28050 28051 /** 28052 * This method is like `_.union` except that it accepts `comparator` which 28053 * is invoked to compare elements of `arrays`. Result values are chosen from 28054 * the first array in which the value occurs. The comparator is invoked 28055 * with two arguments: (arrVal, othVal). 28056 * 28057 * @static 28058 * @memberOf _ 28059 * @since 4.0.0 28060 * @category Array 28061 * @param {...Array} [arrays] The arrays to inspect. 28062 * @param {Function} [comparator] The comparator invoked per element. 28063 * @returns {Array} Returns the new array of combined values. 28064 * @example 28065 * 28066 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 28067 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 28068 * 28069 * _.unionWith(objects, others, _.isEqual); 28070 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] 28071 */ 28072 var unionWith = baseRest(function(arrays) { 28073 var comparator = last(arrays); 28074 comparator = typeof comparator == 'function' ? comparator : undefined; 28075 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator); 28076 }); 28077 28078 /** 28079 * Creates a duplicate-free version of an array, using 28080 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 28081 * for equality comparisons, in which only the first occurrence of each element 28082 * is kept. The order of result values is determined by the order they occur 28083 * in the array. 28084 * 28085 * @static 28086 * @memberOf _ 28087 * @since 0.1.0 28088 * @category Array 28089 * @param {Array} array The array to inspect. 28090 * @returns {Array} Returns the new duplicate free array. 28091 * @example 28092 * 28093 * _.uniq([2, 1, 2]); 28094 * // => [2, 1] 28095 */ 28096 function uniq(array) { 28097 return (array && array.length) ? baseUniq(array) : []; 28098 } 28099 28100 /** 28101 * This method is like `_.uniq` except that it accepts `iteratee` which is 28102 * invoked for each element in `array` to generate the criterion by which 28103 * uniqueness is computed. The order of result values is determined by the 28104 * order they occur in the array. The iteratee is invoked with one argument: 28105 * (value). 28106 * 28107 * @static 28108 * @memberOf _ 28109 * @since 4.0.0 28110 * @category Array 28111 * @param {Array} array The array to inspect. 28112 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 28113 * @returns {Array} Returns the new duplicate free array. 28114 * @example 28115 * 28116 * _.uniqBy([2.1, 1.2, 2.3], Math.floor); 28117 * // => [2.1, 1.2] 28118 * 28119 * // The `_.property` iteratee shorthand. 28120 * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); 28121 * // => [{ 'x': 1 }, { 'x': 2 }] 28122 */ 28123 function uniqBy(array, iteratee) { 28124 return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : []; 28125 } 28126 28127 /** 28128 * This method is like `_.uniq` except that it accepts `comparator` which 28129 * is invoked to compare elements of `array`. The order of result values is 28130 * determined by the order they occur in the array.The comparator is invoked 28131 * with two arguments: (arrVal, othVal). 28132 * 28133 * @static 28134 * @memberOf _ 28135 * @since 4.0.0 28136 * @category Array 28137 * @param {Array} array The array to inspect. 28138 * @param {Function} [comparator] The comparator invoked per element. 28139 * @returns {Array} Returns the new duplicate free array. 28140 * @example 28141 * 28142 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; 28143 * 28144 * _.uniqWith(objects, _.isEqual); 28145 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] 28146 */ 28147 function uniqWith(array, comparator) { 28148 comparator = typeof comparator == 'function' ? comparator : undefined; 28149 return (array && array.length) ? baseUniq(array, undefined, comparator) : []; 28150 } 28151 28152 /** 28153 * This method is like `_.zip` except that it accepts an array of grouped 28154 * elements and creates an array regrouping the elements to their pre-zip 28155 * configuration. 28156 * 28157 * @static 28158 * @memberOf _ 28159 * @since 1.2.0 28160 * @category Array 28161 * @param {Array} array The array of grouped elements to process. 28162 * @returns {Array} Returns the new array of regrouped elements. 28163 * @example 28164 * 28165 * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]); 28166 * // => [['a', 1, true], ['b', 2, false]] 28167 * 28168 * _.unzip(zipped); 28169 * // => [['a', 'b'], [1, 2], [true, false]] 28170 */ 28171 function unzip(array) { 28172 if (!(array && array.length)) { 28173 return []; 28174 } 28175 var length = 0; 28176 array = arrayFilter(array, function(group) { 28177 if (isArrayLikeObject(group)) { 28178 length = nativeMax(group.length, length); 28179 return true; 28180 } 28181 }); 28182 return baseTimes(length, function(index) { 28183 return arrayMap(array, baseProperty(index)); 28184 }); 28185 } 28186 28187 /** 28188 * This method is like `_.unzip` except that it accepts `iteratee` to specify 28189 * how regrouped values should be combined. The iteratee is invoked with the 28190 * elements of each group: (...group). 28191 * 28192 * @static 28193 * @memberOf _ 28194 * @since 3.8.0 28195 * @category Array 28196 * @param {Array} array The array of grouped elements to process. 28197 * @param {Function} [iteratee=_.identity] The function to combine 28198 * regrouped values. 28199 * @returns {Array} Returns the new array of regrouped elements. 28200 * @example 28201 * 28202 * var zipped = _.zip([1, 2], [10, 20], [100, 200]); 28203 * // => [[1, 10, 100], [2, 20, 200]] 28204 * 28205 * _.unzipWith(zipped, _.add); 28206 * // => [3, 30, 300] 28207 */ 28208 function unzipWith(array, iteratee) { 28209 if (!(array && array.length)) { 28210 return []; 28211 } 28212 var result = unzip(array); 28213 if (iteratee == null) { 28214 return result; 28215 } 28216 return arrayMap(result, function(group) { 28217 return apply(iteratee, undefined, group); 28218 }); 28219 } 28220 28221 /** 28222 * Creates an array excluding all given values using 28223 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 28224 * for equality comparisons. 28225 * 28226 * **Note:** Unlike `_.pull`, this method returns a new array. 28227 * 28228 * @static 28229 * @memberOf _ 28230 * @since 0.1.0 28231 * @category Array 28232 * @param {Array} array The array to inspect. 28233 * @param {...*} [values] The values to exclude. 28234 * @returns {Array} Returns the new array of filtered values. 28235 * @see _.difference, _.xor 28236 * @example 28237 * 28238 * _.without([2, 1, 2, 3], 1, 2); 28239 * // => [3] 28240 */ 28241 var without = baseRest(function(array, values) { 28242 return isArrayLikeObject(array) 28243 ? baseDifference(array, values) 28244 : []; 28245 }); 28246 28247 /** 28248 * Creates an array of unique values that is the 28249 * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) 28250 * of the given arrays. The order of result values is determined by the order 28251 * they occur in the arrays. 28252 * 28253 * @static 28254 * @memberOf _ 28255 * @since 2.4.0 28256 * @category Array 28257 * @param {...Array} [arrays] The arrays to inspect. 28258 * @returns {Array} Returns the new array of filtered values. 28259 * @see _.difference, _.without 28260 * @example 28261 * 28262 * _.xor([2, 1], [2, 3]); 28263 * // => [1, 3] 28264 */ 28265 var xor = baseRest(function(arrays) { 28266 return baseXor(arrayFilter(arrays, isArrayLikeObject)); 28267 }); 28268 28269 /** 28270 * This method is like `_.xor` except that it accepts `iteratee` which is 28271 * invoked for each element of each `arrays` to generate the criterion by 28272 * which by which they're compared. The order of result values is determined 28273 * by the order they occur in the arrays. The iteratee is invoked with one 28274 * argument: (value). 28275 * 28276 * @static 28277 * @memberOf _ 28278 * @since 4.0.0 28279 * @category Array 28280 * @param {...Array} [arrays] The arrays to inspect. 28281 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 28282 * @returns {Array} Returns the new array of filtered values. 28283 * @example 28284 * 28285 * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); 28286 * // => [1.2, 3.4] 28287 * 28288 * // The `_.property` iteratee shorthand. 28289 * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 28290 * // => [{ 'x': 2 }] 28291 */ 28292 var xorBy = baseRest(function(arrays) { 28293 var iteratee = last(arrays); 28294 if (isArrayLikeObject(iteratee)) { 28295 iteratee = undefined; 28296 } 28297 return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2)); 28298 }); 28299 28300 /** 28301 * This method is like `_.xor` except that it accepts `comparator` which is 28302 * invoked to compare elements of `arrays`. The order of result values is 28303 * determined by the order they occur in the arrays. The comparator is invoked 28304 * with two arguments: (arrVal, othVal). 28305 * 28306 * @static 28307 * @memberOf _ 28308 * @since 4.0.0 28309 * @category Array 28310 * @param {...Array} [arrays] The arrays to inspect. 28311 * @param {Function} [comparator] The comparator invoked per element. 28312 * @returns {Array} Returns the new array of filtered values. 28313 * @example 28314 * 28315 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 28316 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 28317 * 28318 * _.xorWith(objects, others, _.isEqual); 28319 * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] 28320 */ 28321 var xorWith = baseRest(function(arrays) { 28322 var comparator = last(arrays); 28323 comparator = typeof comparator == 'function' ? comparator : undefined; 28324 return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator); 28325 }); 28326 28327 /** 28328 * Creates an array of grouped elements, the first of which contains the 28329 * first elements of the given arrays, the second of which contains the 28330 * second elements of the given arrays, and so on. 28331 * 28332 * @static 28333 * @memberOf _ 28334 * @since 0.1.0 28335 * @category Array 28336 * @param {...Array} [arrays] The arrays to process. 28337 * @returns {Array} Returns the new array of grouped elements. 28338 * @example 28339 * 28340 * _.zip(['a', 'b'], [1, 2], [true, false]); 28341 * // => [['a', 1, true], ['b', 2, false]] 28342 */ 28343 var zip = baseRest(unzip); 28344 28345 /** 28346 * This method is like `_.fromPairs` except that it accepts two arrays, 28347 * one of property identifiers and one of corresponding values. 28348 * 28349 * @static 28350 * @memberOf _ 28351 * @since 0.4.0 28352 * @category Array 28353 * @param {Array} [props=[]] The property identifiers. 28354 * @param {Array} [values=[]] The property values. 28355 * @returns {Object} Returns the new object. 28356 * @example 28357 * 28358 * _.zipObject(['a', 'b'], [1, 2]); 28359 * // => { 'a': 1, 'b': 2 } 28360 */ 28361 function zipObject(props, values) { 28362 return baseZipObject(props || [], values || [], assignValue); 28363 } 28364 28365 /** 28366 * This method is like `_.zipObject` except that it supports property paths. 28367 * 28368 * @static 28369 * @memberOf _ 28370 * @since 4.1.0 28371 * @category Array 28372 * @param {Array} [props=[]] The property identifiers. 28373 * @param {Array} [values=[]] The property values. 28374 * @returns {Object} Returns the new object. 28375 * @example 28376 * 28377 * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); 28378 * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } 28379 */ 28380 function zipObjectDeep(props, values) { 28381 return baseZipObject(props || [], values || [], baseSet); 28382 } 28383 28384 /** 28385 * This method is like `_.zip` except that it accepts `iteratee` to specify 28386 * how grouped values should be combined. The iteratee is invoked with the 28387 * elements of each group: (...group). 28388 * 28389 * @static 28390 * @memberOf _ 28391 * @since 3.8.0 28392 * @category Array 28393 * @param {...Array} [arrays] The arrays to process. 28394 * @param {Function} [iteratee=_.identity] The function to combine 28395 * grouped values. 28396 * @returns {Array} Returns the new array of grouped elements. 28397 * @example 28398 * 28399 * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { 28400 * return a + b + c; 28401 * }); 28402 * // => [111, 222] 28403 */ 28404 var zipWith = baseRest(function(arrays) { 28405 var length = arrays.length, 28406 iteratee = length > 1 ? arrays[length - 1] : undefined; 28407 28408 iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; 28409 return unzipWith(arrays, iteratee); 28410 }); 28411 28412 /*------------------------------------------------------------------------*/ 28413 28414 /** 28415 * Creates a `lodash` wrapper instance that wraps `value` with explicit method 28416 * chain sequences enabled. The result of such sequences must be unwrapped 28417 * with `_#value`. 28418 * 28419 * @static 28420 * @memberOf _ 28421 * @since 1.3.0 28422 * @category Seq 28423 * @param {*} value The value to wrap. 28424 * @returns {Object} Returns the new `lodash` wrapper instance. 28425 * @example 28426 * 28427 * var users = [ 28428 * { 'user': 'barney', 'age': 36 }, 28429 * { 'user': 'fred', 'age': 40 }, 28430 * { 'user': 'pebbles', 'age': 1 } 28431 * ]; 28432 * 28433 * var youngest = _ 28434 * .chain(users) 28435 * .sortBy('age') 28436 * .map(function(o) { 28437 * return o.user + ' is ' + o.age; 28438 * }) 28439 * .head() 28440 * .value(); 28441 * // => 'pebbles is 1' 28442 */ 28443 function chain(value) { 28444 var result = lodash(value); 28445 result.__chain__ = true; 28446 return result; 28447 } 28448 28449 /** 28450 * This method invokes `interceptor` and returns `value`. The interceptor 28451 * is invoked with one argument; (value). The purpose of this method is to 28452 * "tap into" a method chain sequence in order to modify intermediate results. 28453 * 28454 * @static 28455 * @memberOf _ 28456 * @since 0.1.0 28457 * @category Seq 28458 * @param {*} value The value to provide to `interceptor`. 28459 * @param {Function} interceptor The function to invoke. 28460 * @returns {*} Returns `value`. 28461 * @example 28462 * 28463 * _([1, 2, 3]) 28464 * .tap(function(array) { 28465 * // Mutate input array. 28466 * array.pop(); 28467 * }) 28468 * .reverse() 28469 * .value(); 28470 * // => [2, 1] 28471 */ 28472 function tap(value, interceptor) { 28473 interceptor(value); 28474 return value; 28475 } 28476 28477 /** 28478 * This method is like `_.tap` except that it returns the result of `interceptor`. 28479 * The purpose of this method is to "pass thru" values replacing intermediate 28480 * results in a method chain sequence. 28481 * 28482 * @static 28483 * @memberOf _ 28484 * @since 3.0.0 28485 * @category Seq 28486 * @param {*} value The value to provide to `interceptor`. 28487 * @param {Function} interceptor The function to invoke. 28488 * @returns {*} Returns the result of `interceptor`. 28489 * @example 28490 * 28491 * _(' abc ') 28492 * .chain() 28493 * .trim() 28494 * .thru(function(value) { 28495 * return [value]; 28496 * }) 28497 * .value(); 28498 * // => ['abc'] 28499 */ 28500 function thru(value, interceptor) { 28501 return interceptor(value); 28502 } 28503 28504 /** 28505 * This method is the wrapper version of `_.at`. 28506 * 28507 * @name at 28508 * @memberOf _ 28509 * @since 1.0.0 28510 * @category Seq 28511 * @param {...(string|string[])} [paths] The property paths to pick. 28512 * @returns {Object} Returns the new `lodash` wrapper instance. 28513 * @example 28514 * 28515 * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; 28516 * 28517 * _(object).at(['a[0].b.c', 'a[1]']).value(); 28518 * // => [3, 4] 28519 */ 28520 var wrapperAt = flatRest(function(paths) { 28521 var length = paths.length, 28522 start = length ? paths[0] : 0, 28523 value = this.__wrapped__, 28524 interceptor = function(object) { return baseAt(object, paths); }; 28525 28526 if (length > 1 || this.__actions__.length || 28527 !(value instanceof LazyWrapper) || !isIndex(start)) { 28528 return this.thru(interceptor); 28529 } 28530 value = value.slice(start, +start + (length ? 1 : 0)); 28531 value.__actions__.push({ 28532 'func': thru, 28533 'args': [interceptor], 28534 'thisArg': undefined 28535 }); 28536 return new LodashWrapper(value, this.__chain__).thru(function(array) { 28537 if (length && !array.length) { 28538 array.push(undefined); 28539 } 28540 return array; 28541 }); 28542 }); 28543 28544 /** 28545 * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. 28546 * 28547 * @name chain 28548 * @memberOf _ 28549 * @since 0.1.0 28550 * @category Seq 28551 * @returns {Object} Returns the new `lodash` wrapper instance. 28552 * @example 28553 * 28554 * var users = [ 28555 * { 'user': 'barney', 'age': 36 }, 28556 * { 'user': 'fred', 'age': 40 } 28557 * ]; 28558 * 28559 * // A sequence without explicit chaining. 28560 * _(users).head(); 28561 * // => { 'user': 'barney', 'age': 36 } 28562 * 28563 * // A sequence with explicit chaining. 28564 * _(users) 28565 * .chain() 28566 * .head() 28567 * .pick('user') 28568 * .value(); 28569 * // => { 'user': 'barney' } 28570 */ 28571 function wrapperChain() { 28572 return chain(this); 28573 } 28574 28575 /** 28576 * Executes the chain sequence and returns the wrapped result. 28577 * 28578 * @name commit 28579 * @memberOf _ 28580 * @since 3.2.0 28581 * @category Seq 28582 * @returns {Object} Returns the new `lodash` wrapper instance. 28583 * @example 28584 * 28585 * var array = [1, 2]; 28586 * var wrapped = _(array).push(3); 28587 * 28588 * console.log(array); 28589 * // => [1, 2] 28590 * 28591 * wrapped = wrapped.commit(); 28592 * console.log(array); 28593 * // => [1, 2, 3] 28594 * 28595 * wrapped.last(); 28596 * // => 3 28597 * 28598 * console.log(array); 28599 * // => [1, 2, 3] 28600 */ 28601 function wrapperCommit() { 28602 return new LodashWrapper(this.value(), this.__chain__); 28603 } 28604 28605 /** 28606 * Gets the next value on a wrapped object following the 28607 * [iterator protocol](https://mdn.io/iteration_protocols#iterator). 28608 * 28609 * @name next 28610 * @memberOf _ 28611 * @since 4.0.0 28612 * @category Seq 28613 * @returns {Object} Returns the next iterator value. 28614 * @example 28615 * 28616 * var wrapped = _([1, 2]); 28617 * 28618 * wrapped.next(); 28619 * // => { 'done': false, 'value': 1 } 28620 * 28621 * wrapped.next(); 28622 * // => { 'done': false, 'value': 2 } 28623 * 28624 * wrapped.next(); 28625 * // => { 'done': true, 'value': undefined } 28626 */ 28627 function wrapperNext() { 28628 if (this.__values__ === undefined) { 28629 this.__values__ = toArray(this.value()); 28630 } 28631 var done = this.__index__ >= this.__values__.length, 28632 value = done ? undefined : this.__values__[this.__index__++]; 28633 28634 return { 'done': done, 'value': value }; 28635 } 28636 28637 /** 28638 * Enables the wrapper to be iterable. 28639 * 28640 * @name Symbol.iterator 28641 * @memberOf _ 28642 * @since 4.0.0 28643 * @category Seq 28644 * @returns {Object} Returns the wrapper object. 28645 * @example 28646 * 28647 * var wrapped = _([1, 2]); 28648 * 28649 * wrapped[Symbol.iterator]() === wrapped; 28650 * // => true 28651 * 28652 * Array.from(wrapped); 28653 * // => [1, 2] 28654 */ 28655 function wrapperToIterator() { 28656 return this; 28657 } 28658 28659 /** 28660 * Creates a clone of the chain sequence planting `value` as the wrapped value. 28661 * 28662 * @name plant 28663 * @memberOf _ 28664 * @since 3.2.0 28665 * @category Seq 28666 * @param {*} value The value to plant. 28667 * @returns {Object} Returns the new `lodash` wrapper instance. 28668 * @example 28669 * 28670 * function square(n) { 28671 * return n * n; 28672 * } 28673 * 28674 * var wrapped = _([1, 2]).map(square); 28675 * var other = wrapped.plant([3, 4]); 28676 * 28677 * other.value(); 28678 * // => [9, 16] 28679 * 28680 * wrapped.value(); 28681 * // => [1, 4] 28682 */ 28683 function wrapperPlant(value) { 28684 var result, 28685 parent = this; 28686 28687 while (parent instanceof baseLodash) { 28688 var clone = wrapperClone(parent); 28689 clone.__index__ = 0; 28690 clone.__values__ = undefined; 28691 if (result) { 28692 previous.__wrapped__ = clone; 28693 } else { 28694 result = clone; 28695 } 28696 var previous = clone; 28697 parent = parent.__wrapped__; 28698 } 28699 previous.__wrapped__ = value; 28700 return result; 28701 } 28702 28703 /** 28704 * This method is the wrapper version of `_.reverse`. 28705 * 28706 * **Note:** This method mutates the wrapped array. 28707 * 28708 * @name reverse 28709 * @memberOf _ 28710 * @since 0.1.0 28711 * @category Seq 28712 * @returns {Object} Returns the new `lodash` wrapper instance. 28713 * @example 28714 * 28715 * var array = [1, 2, 3]; 28716 * 28717 * _(array).reverse().value() 28718 * // => [3, 2, 1] 28719 * 28720 * console.log(array); 28721 * // => [3, 2, 1] 28722 */ 28723 function wrapperReverse() { 28724 var value = this.__wrapped__; 28725 if (value instanceof LazyWrapper) { 28726 var wrapped = value; 28727 if (this.__actions__.length) { 28728 wrapped = new LazyWrapper(this); 28729 } 28730 wrapped = wrapped.reverse(); 28731 wrapped.__actions__.push({ 28732 'func': thru, 28733 'args': [reverse], 28734 'thisArg': undefined 28735 }); 28736 return new LodashWrapper(wrapped, this.__chain__); 28737 } 28738 return this.thru(reverse); 28739 } 28740 28741 /** 28742 * Executes the chain sequence to resolve the unwrapped value. 28743 * 28744 * @name value 28745 * @memberOf _ 28746 * @since 0.1.0 28747 * @alias toJSON, valueOf 28748 * @category Seq 28749 * @returns {*} Returns the resolved unwrapped value. 28750 * @example 28751 * 28752 * _([1, 2, 3]).value(); 28753 * // => [1, 2, 3] 28754 */ 28755 function wrapperValue() { 28756 return baseWrapperValue(this.__wrapped__, this.__actions__); 28757 } 28758 28759 /*------------------------------------------------------------------------*/ 28760 28761 /** 28762 * Creates an object composed of keys generated from the results of running 28763 * each element of `collection` thru `iteratee`. The corresponding value of 28764 * each key is the number of times the key was returned by `iteratee`. The 28765 * iteratee is invoked with one argument: (value). 28766 * 28767 * @static 28768 * @memberOf _ 28769 * @since 0.5.0 28770 * @category Collection 28771 * @param {Array|Object} collection The collection to iterate over. 28772 * @param {Function} [iteratee=_.identity] The iteratee to transform keys. 28773 * @returns {Object} Returns the composed aggregate object. 28774 * @example 28775 * 28776 * _.countBy([6.1, 4.2, 6.3], Math.floor); 28777 * // => { '4': 1, '6': 2 } 28778 * 28779 * // The `_.property` iteratee shorthand. 28780 * _.countBy(['one', 'two', 'three'], 'length'); 28781 * // => { '3': 2, '5': 1 } 28782 */ 28783 var countBy = createAggregator(function(result, value, key) { 28784 if (hasOwnProperty.call(result, key)) { 28785 ++result[key]; 28786 } else { 28787 baseAssignValue(result, key, 1); 28788 } 28789 }); 28790 28791 /** 28792 * Checks if `predicate` returns truthy for **all** elements of `collection`. 28793 * Iteration is stopped once `predicate` returns falsey. The predicate is 28794 * invoked with three arguments: (value, index|key, collection). 28795 * 28796 * **Note:** This method returns `true` for 28797 * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because 28798 * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of 28799 * elements of empty collections. 28800 * 28801 * @static 28802 * @memberOf _ 28803 * @since 0.1.0 28804 * @category Collection 28805 * @param {Array|Object} collection The collection to iterate over. 28806 * @param {Function} [predicate=_.identity] The function invoked per iteration. 28807 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 28808 * @returns {boolean} Returns `true` if all elements pass the predicate check, 28809 * else `false`. 28810 * @example 28811 * 28812 * _.every([true, 1, null, 'yes'], Boolean); 28813 * // => false 28814 * 28815 * var users = [ 28816 * { 'user': 'barney', 'age': 36, 'active': false }, 28817 * { 'user': 'fred', 'age': 40, 'active': false } 28818 * ]; 28819 * 28820 * // The `_.matches` iteratee shorthand. 28821 * _.every(users, { 'user': 'barney', 'active': false }); 28822 * // => false 28823 * 28824 * // The `_.matchesProperty` iteratee shorthand. 28825 * _.every(users, ['active', false]); 28826 * // => true 28827 * 28828 * // The `_.property` iteratee shorthand. 28829 * _.every(users, 'active'); 28830 * // => false 28831 */ 28832 function every(collection, predicate, guard) { 28833 var func = isArray(collection) ? arrayEvery : baseEvery; 28834 if (guard && isIterateeCall(collection, predicate, guard)) { 28835 predicate = undefined; 28836 } 28837 return func(collection, getIteratee(predicate, 3)); 28838 } 28839 28840 /** 28841 * Iterates over elements of `collection`, returning an array of all elements 28842 * `predicate` returns truthy for. The predicate is invoked with three 28843 * arguments: (value, index|key, collection). 28844 * 28845 * **Note:** Unlike `_.remove`, this method returns a new array. 28846 * 28847 * @static 28848 * @memberOf _ 28849 * @since 0.1.0 28850 * @category Collection 28851 * @param {Array|Object} collection The collection to iterate over. 28852 * @param {Function} [predicate=_.identity] The function invoked per iteration. 28853 * @returns {Array} Returns the new filtered array. 28854 * @see _.reject 28855 * @example 28856 * 28857 * var users = [ 28858 * { 'user': 'barney', 'age': 36, 'active': true }, 28859 * { 'user': 'fred', 'age': 40, 'active': false } 28860 * ]; 28861 * 28862 * _.filter(users, function(o) { return !o.active; }); 28863 * // => objects for ['fred'] 28864 * 28865 * // The `_.matches` iteratee shorthand. 28866 * _.filter(users, { 'age': 36, 'active': true }); 28867 * // => objects for ['barney'] 28868 * 28869 * // The `_.matchesProperty` iteratee shorthand. 28870 * _.filter(users, ['active', false]); 28871 * // => objects for ['fred'] 28872 * 28873 * // The `_.property` iteratee shorthand. 28874 * _.filter(users, 'active'); 28875 * // => objects for ['barney'] 28876 * 28877 * // Combining several predicates using `_.overEvery` or `_.overSome`. 28878 * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); 28879 * // => objects for ['fred', 'barney'] 28880 */ 28881 function filter(collection, predicate) { 28882 var func = isArray(collection) ? arrayFilter : baseFilter; 28883 return func(collection, getIteratee(predicate, 3)); 28884 } 28885 28886 /** 28887 * Iterates over elements of `collection`, returning the first element 28888 * `predicate` returns truthy for. The predicate is invoked with three 28889 * arguments: (value, index|key, collection). 28890 * 28891 * @static 28892 * @memberOf _ 28893 * @since 0.1.0 28894 * @category Collection 28895 * @param {Array|Object} collection The collection to inspect. 28896 * @param {Function} [predicate=_.identity] The function invoked per iteration. 28897 * @param {number} [fromIndex=0] The index to search from. 28898 * @returns {*} Returns the matched element, else `undefined`. 28899 * @example 28900 * 28901 * var users = [ 28902 * { 'user': 'barney', 'age': 36, 'active': true }, 28903 * { 'user': 'fred', 'age': 40, 'active': false }, 28904 * { 'user': 'pebbles', 'age': 1, 'active': true } 28905 * ]; 28906 * 28907 * _.find(users, function(o) { return o.age < 40; }); 28908 * // => object for 'barney' 28909 * 28910 * // The `_.matches` iteratee shorthand. 28911 * _.find(users, { 'age': 1, 'active': true }); 28912 * // => object for 'pebbles' 28913 * 28914 * // The `_.matchesProperty` iteratee shorthand. 28915 * _.find(users, ['active', false]); 28916 * // => object for 'fred' 28917 * 28918 * // The `_.property` iteratee shorthand. 28919 * _.find(users, 'active'); 28920 * // => object for 'barney' 28921 */ 28922 var find = createFind(findIndex); 28923 28924 /** 28925 * This method is like `_.find` except that it iterates over elements of 28926 * `collection` from right to left. 28927 * 28928 * @static 28929 * @memberOf _ 28930 * @since 2.0.0 28931 * @category Collection 28932 * @param {Array|Object} collection The collection to inspect. 28933 * @param {Function} [predicate=_.identity] The function invoked per iteration. 28934 * @param {number} [fromIndex=collection.length-1] The index to search from. 28935 * @returns {*} Returns the matched element, else `undefined`. 28936 * @example 28937 * 28938 * _.findLast([1, 2, 3, 4], function(n) { 28939 * return n % 2 == 1; 28940 * }); 28941 * // => 3 28942 */ 28943 var findLast = createFind(findLastIndex); 28944 28945 /** 28946 * Creates a flattened array of values by running each element in `collection` 28947 * thru `iteratee` and flattening the mapped results. The iteratee is invoked 28948 * with three arguments: (value, index|key, collection). 28949 * 28950 * @static 28951 * @memberOf _ 28952 * @since 4.0.0 28953 * @category Collection 28954 * @param {Array|Object} collection The collection to iterate over. 28955 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 28956 * @returns {Array} Returns the new flattened array. 28957 * @example 28958 * 28959 * function duplicate(n) { 28960 * return [n, n]; 28961 * } 28962 * 28963 * _.flatMap([1, 2], duplicate); 28964 * // => [1, 1, 2, 2] 28965 */ 28966 function flatMap(collection, iteratee) { 28967 return baseFlatten(map(collection, iteratee), 1); 28968 } 28969 28970 /** 28971 * This method is like `_.flatMap` except that it recursively flattens the 28972 * mapped results. 28973 * 28974 * @static 28975 * @memberOf _ 28976 * @since 4.7.0 28977 * @category Collection 28978 * @param {Array|Object} collection The collection to iterate over. 28979 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 28980 * @returns {Array} Returns the new flattened array. 28981 * @example 28982 * 28983 * function duplicate(n) { 28984 * return [[[n, n]]]; 28985 * } 28986 * 28987 * _.flatMapDeep([1, 2], duplicate); 28988 * // => [1, 1, 2, 2] 28989 */ 28990 function flatMapDeep(collection, iteratee) { 28991 return baseFlatten(map(collection, iteratee), INFINITY); 28992 } 28993 28994 /** 28995 * This method is like `_.flatMap` except that it recursively flattens the 28996 * mapped results up to `depth` times. 28997 * 28998 * @static 28999 * @memberOf _ 29000 * @since 4.7.0 29001 * @category Collection 29002 * @param {Array|Object} collection The collection to iterate over. 29003 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 29004 * @param {number} [depth=1] The maximum recursion depth. 29005 * @returns {Array} Returns the new flattened array. 29006 * @example 29007 * 29008 * function duplicate(n) { 29009 * return [[[n, n]]]; 29010 * } 29011 * 29012 * _.flatMapDepth([1, 2], duplicate, 2); 29013 * // => [[1, 1], [2, 2]] 29014 */ 29015 function flatMapDepth(collection, iteratee, depth) { 29016 depth = depth === undefined ? 1 : toInteger(depth); 29017 return baseFlatten(map(collection, iteratee), depth); 29018 } 29019 29020 /** 29021 * Iterates over elements of `collection` and invokes `iteratee` for each element. 29022 * The iteratee is invoked with three arguments: (value, index|key, collection). 29023 * Iteratee functions may exit iteration early by explicitly returning `false`. 29024 * 29025 * **Note:** As with other "Collections" methods, objects with a "length" 29026 * property are iterated like arrays. To avoid this behavior use `_.forIn` 29027 * or `_.forOwn` for object iteration. 29028 * 29029 * @static 29030 * @memberOf _ 29031 * @since 0.1.0 29032 * @alias each 29033 * @category Collection 29034 * @param {Array|Object} collection The collection to iterate over. 29035 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 29036 * @returns {Array|Object} Returns `collection`. 29037 * @see _.forEachRight 29038 * @example 29039 * 29040 * _.forEach([1, 2], function(value) { 29041 * console.log(value); 29042 * }); 29043 * // => Logs `1` then `2`. 29044 * 29045 * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { 29046 * console.log(key); 29047 * }); 29048 * // => Logs 'a' then 'b' (iteration order is not guaranteed). 29049 */ 29050 function forEach(collection, iteratee) { 29051 var func = isArray(collection) ? arrayEach : baseEach; 29052 return func(collection, getIteratee(iteratee, 3)); 29053 } 29054 29055 /** 29056 * This method is like `_.forEach` except that it iterates over elements of 29057 * `collection` from right to left. 29058 * 29059 * @static 29060 * @memberOf _ 29061 * @since 2.0.0 29062 * @alias eachRight 29063 * @category Collection 29064 * @param {Array|Object} collection The collection to iterate over. 29065 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 29066 * @returns {Array|Object} Returns `collection`. 29067 * @see _.forEach 29068 * @example 29069 * 29070 * _.forEachRight([1, 2], function(value) { 29071 * console.log(value); 29072 * }); 29073 * // => Logs `2` then `1`. 29074 */ 29075 function forEachRight(collection, iteratee) { 29076 var func = isArray(collection) ? arrayEachRight : baseEachRight; 29077 return func(collection, getIteratee(iteratee, 3)); 29078 } 29079 29080 /** 29081 * Creates an object composed of keys generated from the results of running 29082 * each element of `collection` thru `iteratee`. The order of grouped values 29083 * is determined by the order they occur in `collection`. The corresponding 29084 * value of each key is an array of elements responsible for generating the 29085 * key. The iteratee is invoked with one argument: (value). 29086 * 29087 * @static 29088 * @memberOf _ 29089 * @since 0.1.0 29090 * @category Collection 29091 * @param {Array|Object} collection The collection to iterate over. 29092 * @param {Function} [iteratee=_.identity] The iteratee to transform keys. 29093 * @returns {Object} Returns the composed aggregate object. 29094 * @example 29095 * 29096 * _.groupBy([6.1, 4.2, 6.3], Math.floor); 29097 * // => { '4': [4.2], '6': [6.1, 6.3] } 29098 * 29099 * // The `_.property` iteratee shorthand. 29100 * _.groupBy(['one', 'two', 'three'], 'length'); 29101 * // => { '3': ['one', 'two'], '5': ['three'] } 29102 */ 29103 var groupBy = createAggregator(function(result, value, key) { 29104 if (hasOwnProperty.call(result, key)) { 29105 result[key].push(value); 29106 } else { 29107 baseAssignValue(result, key, [value]); 29108 } 29109 }); 29110 29111 /** 29112 * Checks if `value` is in `collection`. If `collection` is a string, it's 29113 * checked for a substring of `value`, otherwise 29114 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 29115 * is used for equality comparisons. If `fromIndex` is negative, it's used as 29116 * the offset from the end of `collection`. 29117 * 29118 * @static 29119 * @memberOf _ 29120 * @since 0.1.0 29121 * @category Collection 29122 * @param {Array|Object|string} collection The collection to inspect. 29123 * @param {*} value The value to search for. 29124 * @param {number} [fromIndex=0] The index to search from. 29125 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. 29126 * @returns {boolean} Returns `true` if `value` is found, else `false`. 29127 * @example 29128 * 29129 * _.includes([1, 2, 3], 1); 29130 * // => true 29131 * 29132 * _.includes([1, 2, 3], 1, 2); 29133 * // => false 29134 * 29135 * _.includes({ 'a': 1, 'b': 2 }, 1); 29136 * // => true 29137 * 29138 * _.includes('abcd', 'bc'); 29139 * // => true 29140 */ 29141 function includes(collection, value, fromIndex, guard) { 29142 collection = isArrayLike(collection) ? collection : values(collection); 29143 fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; 29144 29145 var length = collection.length; 29146 if (fromIndex < 0) { 29147 fromIndex = nativeMax(length + fromIndex, 0); 29148 } 29149 return isString(collection) 29150 ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) 29151 : (!!length && baseIndexOf(collection, value, fromIndex) > -1); 29152 } 29153 29154 /** 29155 * Invokes the method at `path` of each element in `collection`, returning 29156 * an array of the results of each invoked method. Any additional arguments 29157 * are provided to each invoked method. If `path` is a function, it's invoked 29158 * for, and `this` bound to, each element in `collection`. 29159 * 29160 * @static 29161 * @memberOf _ 29162 * @since 4.0.0 29163 * @category Collection 29164 * @param {Array|Object} collection The collection to iterate over. 29165 * @param {Array|Function|string} path The path of the method to invoke or 29166 * the function invoked per iteration. 29167 * @param {...*} [args] The arguments to invoke each method with. 29168 * @returns {Array} Returns the array of results. 29169 * @example 29170 * 29171 * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); 29172 * // => [[1, 5, 7], [1, 2, 3]] 29173 * 29174 * _.invokeMap([123, 456], String.prototype.split, ''); 29175 * // => [['1', '2', '3'], ['4', '5', '6']] 29176 */ 29177 var invokeMap = baseRest(function(collection, path, args) { 29178 var index = -1, 29179 isFunc = typeof path == 'function', 29180 result = isArrayLike(collection) ? Array(collection.length) : []; 29181 29182 baseEach(collection, function(value) { 29183 result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); 29184 }); 29185 return result; 29186 }); 29187 29188 /** 29189 * Creates an object composed of keys generated from the results of running 29190 * each element of `collection` thru `iteratee`. The corresponding value of 29191 * each key is the last element responsible for generating the key. The 29192 * iteratee is invoked with one argument: (value). 29193 * 29194 * @static 29195 * @memberOf _ 29196 * @since 4.0.0 29197 * @category Collection 29198 * @param {Array|Object} collection The collection to iterate over. 29199 * @param {Function} [iteratee=_.identity] The iteratee to transform keys. 29200 * @returns {Object} Returns the composed aggregate object. 29201 * @example 29202 * 29203 * var array = [ 29204 * { 'dir': 'left', 'code': 97 }, 29205 * { 'dir': 'right', 'code': 100 } 29206 * ]; 29207 * 29208 * _.keyBy(array, function(o) { 29209 * return String.fromCharCode(o.code); 29210 * }); 29211 * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } 29212 * 29213 * _.keyBy(array, 'dir'); 29214 * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } 29215 */ 29216 var keyBy = createAggregator(function(result, value, key) { 29217 baseAssignValue(result, key, value); 29218 }); 29219 29220 /** 29221 * Creates an array of values by running each element in `collection` thru 29222 * `iteratee`. The iteratee is invoked with three arguments: 29223 * (value, index|key, collection). 29224 * 29225 * Many lodash methods are guarded to work as iteratees for methods like 29226 * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. 29227 * 29228 * The guarded methods are: 29229 * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, 29230 * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, 29231 * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, 29232 * `template`, `trim`, `trimEnd`, `trimStart`, and `words` 29233 * 29234 * @static 29235 * @memberOf _ 29236 * @since 0.1.0 29237 * @category Collection 29238 * @param {Array|Object} collection The collection to iterate over. 29239 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 29240 * @returns {Array} Returns the new mapped array. 29241 * @example 29242 * 29243 * function square(n) { 29244 * return n * n; 29245 * } 29246 * 29247 * _.map([4, 8], square); 29248 * // => [16, 64] 29249 * 29250 * _.map({ 'a': 4, 'b': 8 }, square); 29251 * // => [16, 64] (iteration order is not guaranteed) 29252 * 29253 * var users = [ 29254 * { 'user': 'barney' }, 29255 * { 'user': 'fred' } 29256 * ]; 29257 * 29258 * // The `_.property` iteratee shorthand. 29259 * _.map(users, 'user'); 29260 * // => ['barney', 'fred'] 29261 */ 29262 function map(collection, iteratee) { 29263 var func = isArray(collection) ? arrayMap : baseMap; 29264 return func(collection, getIteratee(iteratee, 3)); 29265 } 29266 29267 /** 29268 * This method is like `_.sortBy` except that it allows specifying the sort 29269 * orders of the iteratees to sort by. If `orders` is unspecified, all values 29270 * are sorted in ascending order. Otherwise, specify an order of "desc" for 29271 * descending or "asc" for ascending sort order of corresponding values. 29272 * 29273 * @static 29274 * @memberOf _ 29275 * @since 4.0.0 29276 * @category Collection 29277 * @param {Array|Object} collection The collection to iterate over. 29278 * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] 29279 * The iteratees to sort by. 29280 * @param {string[]} [orders] The sort orders of `iteratees`. 29281 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. 29282 * @returns {Array} Returns the new sorted array. 29283 * @example 29284 * 29285 * var users = [ 29286 * { 'user': 'fred', 'age': 48 }, 29287 * { 'user': 'barney', 'age': 34 }, 29288 * { 'user': 'fred', 'age': 40 }, 29289 * { 'user': 'barney', 'age': 36 } 29290 * ]; 29291 * 29292 * // Sort by `user` in ascending order and by `age` in descending order. 29293 * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); 29294 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] 29295 */ 29296 function orderBy(collection, iteratees, orders, guard) { 29297 if (collection == null) { 29298 return []; 29299 } 29300 if (!isArray(iteratees)) { 29301 iteratees = iteratees == null ? [] : [iteratees]; 29302 } 29303 orders = guard ? undefined : orders; 29304 if (!isArray(orders)) { 29305 orders = orders == null ? [] : [orders]; 29306 } 29307 return baseOrderBy(collection, iteratees, orders); 29308 } 29309 29310 /** 29311 * Creates an array of elements split into two groups, the first of which 29312 * contains elements `predicate` returns truthy for, the second of which 29313 * contains elements `predicate` returns falsey for. The predicate is 29314 * invoked with one argument: (value). 29315 * 29316 * @static 29317 * @memberOf _ 29318 * @since 3.0.0 29319 * @category Collection 29320 * @param {Array|Object} collection The collection to iterate over. 29321 * @param {Function} [predicate=_.identity] The function invoked per iteration. 29322 * @returns {Array} Returns the array of grouped elements. 29323 * @example 29324 * 29325 * var users = [ 29326 * { 'user': 'barney', 'age': 36, 'active': false }, 29327 * { 'user': 'fred', 'age': 40, 'active': true }, 29328 * { 'user': 'pebbles', 'age': 1, 'active': false } 29329 * ]; 29330 * 29331 * _.partition(users, function(o) { return o.active; }); 29332 * // => objects for [['fred'], ['barney', 'pebbles']] 29333 * 29334 * // The `_.matches` iteratee shorthand. 29335 * _.partition(users, { 'age': 1, 'active': false }); 29336 * // => objects for [['pebbles'], ['barney', 'fred']] 29337 * 29338 * // The `_.matchesProperty` iteratee shorthand. 29339 * _.partition(users, ['active', false]); 29340 * // => objects for [['barney', 'pebbles'], ['fred']] 29341 * 29342 * // The `_.property` iteratee shorthand. 29343 * _.partition(users, 'active'); 29344 * // => objects for [['fred'], ['barney', 'pebbles']] 29345 */ 29346 var partition = createAggregator(function(result, value, key) { 29347 result[key ? 0 : 1].push(value); 29348 }, function() { return [[], []]; }); 29349 29350 /** 29351 * Reduces `collection` to a value which is the accumulated result of running 29352 * each element in `collection` thru `iteratee`, where each successive 29353 * invocation is supplied the return value of the previous. If `accumulator` 29354 * is not given, the first element of `collection` is used as the initial 29355 * value. The iteratee is invoked with four arguments: 29356 * (accumulator, value, index|key, collection). 29357 * 29358 * Many lodash methods are guarded to work as iteratees for methods like 29359 * `_.reduce`, `_.reduceRight`, and `_.transform`. 29360 * 29361 * The guarded methods are: 29362 * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, 29363 * and `sortBy` 29364 * 29365 * @static 29366 * @memberOf _ 29367 * @since 0.1.0 29368 * @category Collection 29369 * @param {Array|Object} collection The collection to iterate over. 29370 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 29371 * @param {*} [accumulator] The initial value. 29372 * @returns {*} Returns the accumulated value. 29373 * @see _.reduceRight 29374 * @example 29375 * 29376 * _.reduce([1, 2], function(sum, n) { 29377 * return sum + n; 29378 * }, 0); 29379 * // => 3 29380 * 29381 * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { 29382 * (result[value] || (result[value] = [])).push(key); 29383 * return result; 29384 * }, {}); 29385 * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) 29386 */ 29387 function reduce(collection, iteratee, accumulator) { 29388 var func = isArray(collection) ? arrayReduce : baseReduce, 29389 initAccum = arguments.length < 3; 29390 29391 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach); 29392 } 29393 29394 /** 29395 * This method is like `_.reduce` except that it iterates over elements of 29396 * `collection` from right to left. 29397 * 29398 * @static 29399 * @memberOf _ 29400 * @since 0.1.0 29401 * @category Collection 29402 * @param {Array|Object} collection The collection to iterate over. 29403 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 29404 * @param {*} [accumulator] The initial value. 29405 * @returns {*} Returns the accumulated value. 29406 * @see _.reduce 29407 * @example 29408 * 29409 * var array = [[0, 1], [2, 3], [4, 5]]; 29410 * 29411 * _.reduceRight(array, function(flattened, other) { 29412 * return flattened.concat(other); 29413 * }, []); 29414 * // => [4, 5, 2, 3, 0, 1] 29415 */ 29416 function reduceRight(collection, iteratee, accumulator) { 29417 var func = isArray(collection) ? arrayReduceRight : baseReduce, 29418 initAccum = arguments.length < 3; 29419 29420 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); 29421 } 29422 29423 /** 29424 * The opposite of `_.filter`; this method returns the elements of `collection` 29425 * that `predicate` does **not** return truthy for. 29426 * 29427 * @static 29428 * @memberOf _ 29429 * @since 0.1.0 29430 * @category Collection 29431 * @param {Array|Object} collection The collection to iterate over. 29432 * @param {Function} [predicate=_.identity] The function invoked per iteration. 29433 * @returns {Array} Returns the new filtered array. 29434 * @see _.filter 29435 * @example 29436 * 29437 * var users = [ 29438 * { 'user': 'barney', 'age': 36, 'active': false }, 29439 * { 'user': 'fred', 'age': 40, 'active': true } 29440 * ]; 29441 * 29442 * _.reject(users, function(o) { return !o.active; }); 29443 * // => objects for ['fred'] 29444 * 29445 * // The `_.matches` iteratee shorthand. 29446 * _.reject(users, { 'age': 40, 'active': true }); 29447 * // => objects for ['barney'] 29448 * 29449 * // The `_.matchesProperty` iteratee shorthand. 29450 * _.reject(users, ['active', false]); 29451 * // => objects for ['fred'] 29452 * 29453 * // The `_.property` iteratee shorthand. 29454 * _.reject(users, 'active'); 29455 * // => objects for ['barney'] 29456 */ 29457 function reject(collection, predicate) { 29458 var func = isArray(collection) ? arrayFilter : baseFilter; 29459 return func(collection, negate(getIteratee(predicate, 3))); 29460 } 29461 29462 /** 29463 * Gets a random element from `collection`. 29464 * 29465 * @static 29466 * @memberOf _ 29467 * @since 2.0.0 29468 * @category Collection 29469 * @param {Array|Object} collection The collection to sample. 29470 * @returns {*} Returns the random element. 29471 * @example 29472 * 29473 * _.sample([1, 2, 3, 4]); 29474 * // => 2 29475 */ 29476 function sample(collection) { 29477 var func = isArray(collection) ? arraySample : baseSample; 29478 return func(collection); 29479 } 29480 29481 /** 29482 * Gets `n` random elements at unique keys from `collection` up to the 29483 * size of `collection`. 29484 * 29485 * @static 29486 * @memberOf _ 29487 * @since 4.0.0 29488 * @category Collection 29489 * @param {Array|Object} collection The collection to sample. 29490 * @param {number} [n=1] The number of elements to sample. 29491 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 29492 * @returns {Array} Returns the random elements. 29493 * @example 29494 * 29495 * _.sampleSize([1, 2, 3], 2); 29496 * // => [3, 1] 29497 * 29498 * _.sampleSize([1, 2, 3], 4); 29499 * // => [2, 3, 1] 29500 */ 29501 function sampleSize(collection, n, guard) { 29502 if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { 29503 n = 1; 29504 } else { 29505 n = toInteger(n); 29506 } 29507 var func = isArray(collection) ? arraySampleSize : baseSampleSize; 29508 return func(collection, n); 29509 } 29510 29511 /** 29512 * Creates an array of shuffled values, using a version of the 29513 * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). 29514 * 29515 * @static 29516 * @memberOf _ 29517 * @since 0.1.0 29518 * @category Collection 29519 * @param {Array|Object} collection The collection to shuffle. 29520 * @returns {Array} Returns the new shuffled array. 29521 * @example 29522 * 29523 * _.shuffle([1, 2, 3, 4]); 29524 * // => [4, 1, 3, 2] 29525 */ 29526 function shuffle(collection) { 29527 var func = isArray(collection) ? arrayShuffle : baseShuffle; 29528 return func(collection); 29529 } 29530 29531 /** 29532 * Gets the size of `collection` by returning its length for array-like 29533 * values or the number of own enumerable string keyed properties for objects. 29534 * 29535 * @static 29536 * @memberOf _ 29537 * @since 0.1.0 29538 * @category Collection 29539 * @param {Array|Object|string} collection The collection to inspect. 29540 * @returns {number} Returns the collection size. 29541 * @example 29542 * 29543 * _.size([1, 2, 3]); 29544 * // => 3 29545 * 29546 * _.size({ 'a': 1, 'b': 2 }); 29547 * // => 2 29548 * 29549 * _.size('pebbles'); 29550 * // => 7 29551 */ 29552 function size(collection) { 29553 if (collection == null) { 29554 return 0; 29555 } 29556 if (isArrayLike(collection)) { 29557 return isString(collection) ? stringSize(collection) : collection.length; 29558 } 29559 var tag = getTag(collection); 29560 if (tag == mapTag || tag == setTag) { 29561 return collection.size; 29562 } 29563 return baseKeys(collection).length; 29564 } 29565 29566 /** 29567 * Checks if `predicate` returns truthy for **any** element of `collection`. 29568 * Iteration is stopped once `predicate` returns truthy. The predicate is 29569 * invoked with three arguments: (value, index|key, collection). 29570 * 29571 * @static 29572 * @memberOf _ 29573 * @since 0.1.0 29574 * @category Collection 29575 * @param {Array|Object} collection The collection to iterate over. 29576 * @param {Function} [predicate=_.identity] The function invoked per iteration. 29577 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 29578 * @returns {boolean} Returns `true` if any element passes the predicate check, 29579 * else `false`. 29580 * @example 29581 * 29582 * _.some([null, 0, 'yes', false], Boolean); 29583 * // => true 29584 * 29585 * var users = [ 29586 * { 'user': 'barney', 'active': true }, 29587 * { 'user': 'fred', 'active': false } 29588 * ]; 29589 * 29590 * // The `_.matches` iteratee shorthand. 29591 * _.some(users, { 'user': 'barney', 'active': false }); 29592 * // => false 29593 * 29594 * // The `_.matchesProperty` iteratee shorthand. 29595 * _.some(users, ['active', false]); 29596 * // => true 29597 * 29598 * // The `_.property` iteratee shorthand. 29599 * _.some(users, 'active'); 29600 * // => true 29601 */ 29602 function some(collection, predicate, guard) { 29603 var func = isArray(collection) ? arraySome : baseSome; 29604 if (guard && isIterateeCall(collection, predicate, guard)) { 29605 predicate = undefined; 29606 } 29607 return func(collection, getIteratee(predicate, 3)); 29608 } 29609 29610 /** 29611 * Creates an array of elements, sorted in ascending order by the results of 29612 * running each element in a collection thru each iteratee. This method 29613 * performs a stable sort, that is, it preserves the original sort order of 29614 * equal elements. The iteratees are invoked with one argument: (value). 29615 * 29616 * @static 29617 * @memberOf _ 29618 * @since 0.1.0 29619 * @category Collection 29620 * @param {Array|Object} collection The collection to iterate over. 29621 * @param {...(Function|Function[])} [iteratees=[_.identity]] 29622 * The iteratees to sort by. 29623 * @returns {Array} Returns the new sorted array. 29624 * @example 29625 * 29626 * var users = [ 29627 * { 'user': 'fred', 'age': 48 }, 29628 * { 'user': 'barney', 'age': 36 }, 29629 * { 'user': 'fred', 'age': 30 }, 29630 * { 'user': 'barney', 'age': 34 } 29631 * ]; 29632 * 29633 * _.sortBy(users, [function(o) { return o.user; }]); 29634 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] 29635 * 29636 * _.sortBy(users, ['user', 'age']); 29637 * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] 29638 */ 29639 var sortBy = baseRest(function(collection, iteratees) { 29640 if (collection == null) { 29641 return []; 29642 } 29643 var length = iteratees.length; 29644 if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { 29645 iteratees = []; 29646 } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { 29647 iteratees = [iteratees[0]]; 29648 } 29649 return baseOrderBy(collection, baseFlatten(iteratees, 1), []); 29650 }); 29651 29652 /*------------------------------------------------------------------------*/ 29653 29654 /** 29655 * Gets the timestamp of the number of milliseconds that have elapsed since 29656 * the Unix epoch (1 January 1970 00:00:00 UTC). 29657 * 29658 * @static 29659 * @memberOf _ 29660 * @since 2.4.0 29661 * @category Date 29662 * @returns {number} Returns the timestamp. 29663 * @example 29664 * 29665 * _.defer(function(stamp) { 29666 * console.log(_.now() - stamp); 29667 * }, _.now()); 29668 * // => Logs the number of milliseconds it took for the deferred invocation. 29669 */ 29670 var now = ctxNow || function() { 29671 return root.Date.now(); 29672 }; 29673 29674 /*------------------------------------------------------------------------*/ 29675 29676 /** 29677 * The opposite of `_.before`; this method creates a function that invokes 29678 * `func` once it's called `n` or more times. 29679 * 29680 * @static 29681 * @memberOf _ 29682 * @since 0.1.0 29683 * @category Function 29684 * @param {number} n The number of calls before `func` is invoked. 29685 * @param {Function} func The function to restrict. 29686 * @returns {Function} Returns the new restricted function. 29687 * @example 29688 * 29689 * var saves = ['profile', 'settings']; 29690 * 29691 * var done = _.after(saves.length, function() { 29692 * console.log('done saving!'); 29693 * }); 29694 * 29695 * _.forEach(saves, function(type) { 29696 * asyncSave({ 'type': type, 'complete': done }); 29697 * }); 29698 * // => Logs 'done saving!' after the two async saves have completed. 29699 */ 29700 function after(n, func) { 29701 if (typeof func != 'function') { 29702 throw new TypeError(FUNC_ERROR_TEXT); 29703 } 29704 n = toInteger(n); 29705 return function() { 29706 if (--n < 1) { 29707 return func.apply(this, arguments); 29708 } 29709 }; 29710 } 29711 29712 /** 29713 * Creates a function that invokes `func`, with up to `n` arguments, 29714 * ignoring any additional arguments. 29715 * 29716 * @static 29717 * @memberOf _ 29718 * @since 3.0.0 29719 * @category Function 29720 * @param {Function} func The function to cap arguments for. 29721 * @param {number} [n=func.length] The arity cap. 29722 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 29723 * @returns {Function} Returns the new capped function. 29724 * @example 29725 * 29726 * _.map(['6', '8', '10'], _.ary(parseInt, 1)); 29727 * // => [6, 8, 10] 29728 */ 29729 function ary(func, n, guard) { 29730 n = guard ? undefined : n; 29731 n = (func && n == null) ? func.length : n; 29732 return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n); 29733 } 29734 29735 /** 29736 * Creates a function that invokes `func`, with the `this` binding and arguments 29737 * of the created function, while it's called less than `n` times. Subsequent 29738 * calls to the created function return the result of the last `func` invocation. 29739 * 29740 * @static 29741 * @memberOf _ 29742 * @since 3.0.0 29743 * @category Function 29744 * @param {number} n The number of calls at which `func` is no longer invoked. 29745 * @param {Function} func The function to restrict. 29746 * @returns {Function} Returns the new restricted function. 29747 * @example 29748 * 29749 * jQuery(element).on('click', _.before(5, addContactToList)); 29750 * // => Allows adding up to 4 contacts to the list. 29751 */ 29752 function before(n, func) { 29753 var result; 29754 if (typeof func != 'function') { 29755 throw new TypeError(FUNC_ERROR_TEXT); 29756 } 29757 n = toInteger(n); 29758 return function() { 29759 if (--n > 0) { 29760 result = func.apply(this, arguments); 29761 } 29762 if (n <= 1) { 29763 func = undefined; 29764 } 29765 return result; 29766 }; 29767 } 29768 29769 /** 29770 * Creates a function that invokes `func` with the `this` binding of `thisArg` 29771 * and `partials` prepended to the arguments it receives. 29772 * 29773 * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, 29774 * may be used as a placeholder for partially applied arguments. 29775 * 29776 * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" 29777 * property of bound functions. 29778 * 29779 * @static 29780 * @memberOf _ 29781 * @since 0.1.0 29782 * @category Function 29783 * @param {Function} func The function to bind. 29784 * @param {*} thisArg The `this` binding of `func`. 29785 * @param {...*} [partials] The arguments to be partially applied. 29786 * @returns {Function} Returns the new bound function. 29787 * @example 29788 * 29789 * function greet(greeting, punctuation) { 29790 * return greeting + ' ' + this.user + punctuation; 29791 * } 29792 * 29793 * var object = { 'user': 'fred' }; 29794 * 29795 * var bound = _.bind(greet, object, 'hi'); 29796 * bound('!'); 29797 * // => 'hi fred!' 29798 * 29799 * // Bound with placeholders. 29800 * var bound = _.bind(greet, object, _, '!'); 29801 * bound('hi'); 29802 * // => 'hi fred!' 29803 */ 29804 var bind = baseRest(function(func, thisArg, partials) { 29805 var bitmask = WRAP_BIND_FLAG; 29806 if (partials.length) { 29807 var holders = replaceHolders(partials, getHolder(bind)); 29808 bitmask |= WRAP_PARTIAL_FLAG; 29809 } 29810 return createWrap(func, bitmask, thisArg, partials, holders); 29811 }); 29812 29813 /** 29814 * Creates a function that invokes the method at `object[key]` with `partials` 29815 * prepended to the arguments it receives. 29816 * 29817 * This method differs from `_.bind` by allowing bound functions to reference 29818 * methods that may be redefined or don't yet exist. See 29819 * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) 29820 * for more details. 29821 * 29822 * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic 29823 * builds, may be used as a placeholder for partially applied arguments. 29824 * 29825 * @static 29826 * @memberOf _ 29827 * @since 0.10.0 29828 * @category Function 29829 * @param {Object} object The object to invoke the method on. 29830 * @param {string} key The key of the method. 29831 * @param {...*} [partials] The arguments to be partially applied. 29832 * @returns {Function} Returns the new bound function. 29833 * @example 29834 * 29835 * var object = { 29836 * 'user': 'fred', 29837 * 'greet': function(greeting, punctuation) { 29838 * return greeting + ' ' + this.user + punctuation; 29839 * } 29840 * }; 29841 * 29842 * var bound = _.bindKey(object, 'greet', 'hi'); 29843 * bound('!'); 29844 * // => 'hi fred!' 29845 * 29846 * object.greet = function(greeting, punctuation) { 29847 * return greeting + 'ya ' + this.user + punctuation; 29848 * }; 29849 * 29850 * bound('!'); 29851 * // => 'hiya fred!' 29852 * 29853 * // Bound with placeholders. 29854 * var bound = _.bindKey(object, 'greet', _, '!'); 29855 * bound('hi'); 29856 * // => 'hiya fred!' 29857 */ 29858 var bindKey = baseRest(function(object, key, partials) { 29859 var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; 29860 if (partials.length) { 29861 var holders = replaceHolders(partials, getHolder(bindKey)); 29862 bitmask |= WRAP_PARTIAL_FLAG; 29863 } 29864 return createWrap(key, bitmask, object, partials, holders); 29865 }); 29866 29867 /** 29868 * Creates a function that accepts arguments of `func` and either invokes 29869 * `func` returning its result, if at least `arity` number of arguments have 29870 * been provided, or returns a function that accepts the remaining `func` 29871 * arguments, and so on. The arity of `func` may be specified if `func.length` 29872 * is not sufficient. 29873 * 29874 * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, 29875 * may be used as a placeholder for provided arguments. 29876 * 29877 * **Note:** This method doesn't set the "length" property of curried functions. 29878 * 29879 * @static 29880 * @memberOf _ 29881 * @since 2.0.0 29882 * @category Function 29883 * @param {Function} func The function to curry. 29884 * @param {number} [arity=func.length] The arity of `func`. 29885 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 29886 * @returns {Function} Returns the new curried function. 29887 * @example 29888 * 29889 * var abc = function(a, b, c) { 29890 * return [a, b, c]; 29891 * }; 29892 * 29893 * var curried = _.curry(abc); 29894 * 29895 * curried(1)(2)(3); 29896 * // => [1, 2, 3] 29897 * 29898 * curried(1, 2)(3); 29899 * // => [1, 2, 3] 29900 * 29901 * curried(1, 2, 3); 29902 * // => [1, 2, 3] 29903 * 29904 * // Curried with placeholders. 29905 * curried(1)(_, 3)(2); 29906 * // => [1, 2, 3] 29907 */ 29908 function curry(func, arity, guard) { 29909 arity = guard ? undefined : arity; 29910 var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); 29911 result.placeholder = curry.placeholder; 29912 return result; 29913 } 29914 29915 /** 29916 * This method is like `_.curry` except that arguments are applied to `func` 29917 * in the manner of `_.partialRight` instead of `_.partial`. 29918 * 29919 * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic 29920 * builds, may be used as a placeholder for provided arguments. 29921 * 29922 * **Note:** This method doesn't set the "length" property of curried functions. 29923 * 29924 * @static 29925 * @memberOf _ 29926 * @since 3.0.0 29927 * @category Function 29928 * @param {Function} func The function to curry. 29929 * @param {number} [arity=func.length] The arity of `func`. 29930 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 29931 * @returns {Function} Returns the new curried function. 29932 * @example 29933 * 29934 * var abc = function(a, b, c) { 29935 * return [a, b, c]; 29936 * }; 29937 * 29938 * var curried = _.curryRight(abc); 29939 * 29940 * curried(3)(2)(1); 29941 * // => [1, 2, 3] 29942 * 29943 * curried(2, 3)(1); 29944 * // => [1, 2, 3] 29945 * 29946 * curried(1, 2, 3); 29947 * // => [1, 2, 3] 29948 * 29949 * // Curried with placeholders. 29950 * curried(3)(1, _)(2); 29951 * // => [1, 2, 3] 29952 */ 29953 function curryRight(func, arity, guard) { 29954 arity = guard ? undefined : arity; 29955 var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); 29956 result.placeholder = curryRight.placeholder; 29957 return result; 29958 } 29959 29960 /** 29961 * Creates a debounced function that delays invoking `func` until after `wait` 29962 * milliseconds have elapsed since the last time the debounced function was 29963 * invoked. The debounced function comes with a `cancel` method to cancel 29964 * delayed `func` invocations and a `flush` method to immediately invoke them. 29965 * Provide `options` to indicate whether `func` should be invoked on the 29966 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked 29967 * with the last arguments provided to the debounced function. Subsequent 29968 * calls to the debounced function return the result of the last `func` 29969 * invocation. 29970 * 29971 * **Note:** If `leading` and `trailing` options are `true`, `func` is 29972 * invoked on the trailing edge of the timeout only if the debounced function 29973 * is invoked more than once during the `wait` timeout. 29974 * 29975 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 29976 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 29977 * 29978 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 29979 * for details over the differences between `_.debounce` and `_.throttle`. 29980 * 29981 * @static 29982 * @memberOf _ 29983 * @since 0.1.0 29984 * @category Function 29985 * @param {Function} func The function to debounce. 29986 * @param {number} [wait=0] The number of milliseconds to delay. 29987 * @param {Object} [options={}] The options object. 29988 * @param {boolean} [options.leading=false] 29989 * Specify invoking on the leading edge of the timeout. 29990 * @param {number} [options.maxWait] 29991 * The maximum time `func` is allowed to be delayed before it's invoked. 29992 * @param {boolean} [options.trailing=true] 29993 * Specify invoking on the trailing edge of the timeout. 29994 * @returns {Function} Returns the new debounced function. 29995 * @example 29996 * 29997 * // Avoid costly calculations while the window size is in flux. 29998 * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); 29999 * 30000 * // Invoke `sendMail` when clicked, debouncing subsequent calls. 30001 * jQuery(element).on('click', _.debounce(sendMail, 300, { 30002 * 'leading': true, 30003 * 'trailing': false 30004 * })); 30005 * 30006 * // Ensure `batchLog` is invoked once after 1 second of debounced calls. 30007 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); 30008 * var source = new EventSource('/stream'); 30009 * jQuery(source).on('message', debounced); 30010 * 30011 * // Cancel the trailing debounced invocation. 30012 * jQuery(window).on('popstate', debounced.cancel); 30013 */ 30014 function debounce(func, wait, options) { 30015 var lastArgs, 30016 lastThis, 30017 maxWait, 30018 result, 30019 timerId, 30020 lastCallTime, 30021 lastInvokeTime = 0, 30022 leading = false, 30023 maxing = false, 30024 trailing = true; 30025 30026 if (typeof func != 'function') { 30027 throw new TypeError(FUNC_ERROR_TEXT); 30028 } 30029 wait = toNumber(wait) || 0; 30030 if (isObject(options)) { 30031 leading = !!options.leading; 30032 maxing = 'maxWait' in options; 30033 maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; 30034 trailing = 'trailing' in options ? !!options.trailing : trailing; 30035 } 30036 30037 function invokeFunc(time) { 30038 var args = lastArgs, 30039 thisArg = lastThis; 30040 30041 lastArgs = lastThis = undefined; 30042 lastInvokeTime = time; 30043 result = func.apply(thisArg, args); 30044 return result; 30045 } 30046 30047 function leadingEdge(time) { 30048 // Reset any `maxWait` timer. 30049 lastInvokeTime = time; 30050 // Start the timer for the trailing edge. 30051 timerId = setTimeout(timerExpired, wait); 30052 // Invoke the leading edge. 30053 return leading ? invokeFunc(time) : result; 30054 } 30055 30056 function remainingWait(time) { 30057 var timeSinceLastCall = time - lastCallTime, 30058 timeSinceLastInvoke = time - lastInvokeTime, 30059 timeWaiting = wait - timeSinceLastCall; 30060 30061 return maxing 30062 ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) 30063 : timeWaiting; 30064 } 30065 30066 function shouldInvoke(time) { 30067 var timeSinceLastCall = time - lastCallTime, 30068 timeSinceLastInvoke = time - lastInvokeTime; 30069 30070 // Either this is the first call, activity has stopped and we're at the 30071 // trailing edge, the system time has gone backwards and we're treating 30072 // it as the trailing edge, or we've hit the `maxWait` limit. 30073 return (lastCallTime === undefined || (timeSinceLastCall >= wait) || 30074 (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); 30075 } 30076 30077 function timerExpired() { 30078 var time = now(); 30079 if (shouldInvoke(time)) { 30080 return trailingEdge(time); 30081 } 30082 // Restart the timer. 30083 timerId = setTimeout(timerExpired, remainingWait(time)); 30084 } 30085 30086 function trailingEdge(time) { 30087 timerId = undefined; 30088 30089 // Only invoke if we have `lastArgs` which means `func` has been 30090 // debounced at least once. 30091 if (trailing && lastArgs) { 30092 return invokeFunc(time); 30093 } 30094 lastArgs = lastThis = undefined; 30095 return result; 30096 } 30097 30098 function cancel() { 30099 if (timerId !== undefined) { 30100 clearTimeout(timerId); 30101 } 30102 lastInvokeTime = 0; 30103 lastArgs = lastCallTime = lastThis = timerId = undefined; 30104 } 30105 30106 function flush() { 30107 return timerId === undefined ? result : trailingEdge(now()); 30108 } 30109 30110 function debounced() { 30111 var time = now(), 30112 isInvoking = shouldInvoke(time); 30113 30114 lastArgs = arguments; 30115 lastThis = this; 30116 lastCallTime = time; 30117 30118 if (isInvoking) { 30119 if (timerId === undefined) { 30120 return leadingEdge(lastCallTime); 30121 } 30122 if (maxing) { 30123 // Handle invocations in a tight loop. 30124 clearTimeout(timerId); 30125 timerId = setTimeout(timerExpired, wait); 30126 return invokeFunc(lastCallTime); 30127 } 30128 } 30129 if (timerId === undefined) { 30130 timerId = setTimeout(timerExpired, wait); 30131 } 30132 return result; 30133 } 30134 debounced.cancel = cancel; 30135 debounced.flush = flush; 30136 return debounced; 30137 } 30138 30139 /** 30140 * Defers invoking the `func` until the current call stack has cleared. Any 30141 * additional arguments are provided to `func` when it's invoked. 30142 * 30143 * @static 30144 * @memberOf _ 30145 * @since 0.1.0 30146 * @category Function 30147 * @param {Function} func The function to defer. 30148 * @param {...*} [args] The arguments to invoke `func` with. 30149 * @returns {number} Returns the timer id. 30150 * @example 30151 * 30152 * _.defer(function(text) { 30153 * console.log(text); 30154 * }, 'deferred'); 30155 * // => Logs 'deferred' after one millisecond. 30156 */ 30157 var defer = baseRest(function(func, args) { 30158 return baseDelay(func, 1, args); 30159 }); 30160 30161 /** 30162 * Invokes `func` after `wait` milliseconds. Any additional arguments are 30163 * provided to `func` when it's invoked. 30164 * 30165 * @static 30166 * @memberOf _ 30167 * @since 0.1.0 30168 * @category Function 30169 * @param {Function} func The function to delay. 30170 * @param {number} wait The number of milliseconds to delay invocation. 30171 * @param {...*} [args] The arguments to invoke `func` with. 30172 * @returns {number} Returns the timer id. 30173 * @example 30174 * 30175 * _.delay(function(text) { 30176 * console.log(text); 30177 * }, 1000, 'later'); 30178 * // => Logs 'later' after one second. 30179 */ 30180 var delay = baseRest(function(func, wait, args) { 30181 return baseDelay(func, toNumber(wait) || 0, args); 30182 }); 30183 30184 /** 30185 * Creates a function that invokes `func` with arguments reversed. 30186 * 30187 * @static 30188 * @memberOf _ 30189 * @since 4.0.0 30190 * @category Function 30191 * @param {Function} func The function to flip arguments for. 30192 * @returns {Function} Returns the new flipped function. 30193 * @example 30194 * 30195 * var flipped = _.flip(function() { 30196 * return _.toArray(arguments); 30197 * }); 30198 * 30199 * flipped('a', 'b', 'c', 'd'); 30200 * // => ['d', 'c', 'b', 'a'] 30201 */ 30202 function flip(func) { 30203 return createWrap(func, WRAP_FLIP_FLAG); 30204 } 30205 30206 /** 30207 * Creates a function that memoizes the result of `func`. If `resolver` is 30208 * provided, it determines the cache key for storing the result based on the 30209 * arguments provided to the memoized function. By default, the first argument 30210 * provided to the memoized function is used as the map cache key. The `func` 30211 * is invoked with the `this` binding of the memoized function. 30212 * 30213 * **Note:** The cache is exposed as the `cache` property on the memoized 30214 * function. Its creation may be customized by replacing the `_.memoize.Cache` 30215 * constructor with one whose instances implement the 30216 * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) 30217 * method interface of `clear`, `delete`, `get`, `has`, and `set`. 30218 * 30219 * @static 30220 * @memberOf _ 30221 * @since 0.1.0 30222 * @category Function 30223 * @param {Function} func The function to have its output memoized. 30224 * @param {Function} [resolver] The function to resolve the cache key. 30225 * @returns {Function} Returns the new memoized function. 30226 * @example 30227 * 30228 * var object = { 'a': 1, 'b': 2 }; 30229 * var other = { 'c': 3, 'd': 4 }; 30230 * 30231 * var values = _.memoize(_.values); 30232 * values(object); 30233 * // => [1, 2] 30234 * 30235 * values(other); 30236 * // => [3, 4] 30237 * 30238 * object.a = 2; 30239 * values(object); 30240 * // => [1, 2] 30241 * 30242 * // Modify the result cache. 30243 * values.cache.set(object, ['a', 'b']); 30244 * values(object); 30245 * // => ['a', 'b'] 30246 * 30247 * // Replace `_.memoize.Cache`. 30248 * _.memoize.Cache = WeakMap; 30249 */ 30250 function memoize(func, resolver) { 30251 if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { 30252 throw new TypeError(FUNC_ERROR_TEXT); 30253 } 30254 var memoized = function() { 30255 var args = arguments, 30256 key = resolver ? resolver.apply(this, args) : args[0], 30257 cache = memoized.cache; 30258 30259 if (cache.has(key)) { 30260 return cache.get(key); 30261 } 30262 var result = func.apply(this, args); 30263 memoized.cache = cache.set(key, result) || cache; 30264 return result; 30265 }; 30266 memoized.cache = new (memoize.Cache || MapCache); 30267 return memoized; 30268 } 30269 30270 // Expose `MapCache`. 30271 memoize.Cache = MapCache; 30272 30273 /** 30274 * Creates a function that negates the result of the predicate `func`. The 30275 * `func` predicate is invoked with the `this` binding and arguments of the 30276 * created function. 30277 * 30278 * @static 30279 * @memberOf _ 30280 * @since 3.0.0 30281 * @category Function 30282 * @param {Function} predicate The predicate to negate. 30283 * @returns {Function} Returns the new negated function. 30284 * @example 30285 * 30286 * function isEven(n) { 30287 * return n % 2 == 0; 30288 * } 30289 * 30290 * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); 30291 * // => [1, 3, 5] 30292 */ 30293 function negate(predicate) { 30294 if (typeof predicate != 'function') { 30295 throw new TypeError(FUNC_ERROR_TEXT); 30296 } 30297 return function() { 30298 var args = arguments; 30299 switch (args.length) { 30300 case 0: return !predicate.call(this); 30301 case 1: return !predicate.call(this, args[0]); 30302 case 2: return !predicate.call(this, args[0], args[1]); 30303 case 3: return !predicate.call(this, args[0], args[1], args[2]); 30304 } 30305 return !predicate.apply(this, args); 30306 }; 30307 } 30308 30309 /** 30310 * Creates a function that is restricted to invoking `func` once. Repeat calls 30311 * to the function return the value of the first invocation. The `func` is 30312 * invoked with the `this` binding and arguments of the created function. 30313 * 30314 * @static 30315 * @memberOf _ 30316 * @since 0.1.0 30317 * @category Function 30318 * @param {Function} func The function to restrict. 30319 * @returns {Function} Returns the new restricted function. 30320 * @example 30321 * 30322 * var initialize = _.once(createApplication); 30323 * initialize(); 30324 * initialize(); 30325 * // => `createApplication` is invoked once 30326 */ 30327 function once(func) { 30328 return before(2, func); 30329 } 30330 30331 /** 30332 * Creates a function that invokes `func` with its arguments transformed. 30333 * 30334 * @static 30335 * @since 4.0.0 30336 * @memberOf _ 30337 * @category Function 30338 * @param {Function} func The function to wrap. 30339 * @param {...(Function|Function[])} [transforms=[_.identity]] 30340 * The argument transforms. 30341 * @returns {Function} Returns the new function. 30342 * @example 30343 * 30344 * function doubled(n) { 30345 * return n * 2; 30346 * } 30347 * 30348 * function square(n) { 30349 * return n * n; 30350 * } 30351 * 30352 * var func = _.overArgs(function(x, y) { 30353 * return [x, y]; 30354 * }, [square, doubled]); 30355 * 30356 * func(9, 3); 30357 * // => [81, 6] 30358 * 30359 * func(10, 5); 30360 * // => [100, 10] 30361 */ 30362 var overArgs = castRest(function(func, transforms) { 30363 transforms = (transforms.length == 1 && isArray(transforms[0])) 30364 ? arrayMap(transforms[0], baseUnary(getIteratee())) 30365 : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); 30366 30367 var funcsLength = transforms.length; 30368 return baseRest(function(args) { 30369 var index = -1, 30370 length = nativeMin(args.length, funcsLength); 30371 30372 while (++index < length) { 30373 args[index] = transforms[index].call(this, args[index]); 30374 } 30375 return apply(func, this, args); 30376 }); 30377 }); 30378 30379 /** 30380 * Creates a function that invokes `func` with `partials` prepended to the 30381 * arguments it receives. This method is like `_.bind` except it does **not** 30382 * alter the `this` binding. 30383 * 30384 * The `_.partial.placeholder` value, which defaults to `_` in monolithic 30385 * builds, may be used as a placeholder for partially applied arguments. 30386 * 30387 * **Note:** This method doesn't set the "length" property of partially 30388 * applied functions. 30389 * 30390 * @static 30391 * @memberOf _ 30392 * @since 0.2.0 30393 * @category Function 30394 * @param {Function} func The function to partially apply arguments to. 30395 * @param {...*} [partials] The arguments to be partially applied. 30396 * @returns {Function} Returns the new partially applied function. 30397 * @example 30398 * 30399 * function greet(greeting, name) { 30400 * return greeting + ' ' + name; 30401 * } 30402 * 30403 * var sayHelloTo = _.partial(greet, 'hello'); 30404 * sayHelloTo('fred'); 30405 * // => 'hello fred' 30406 * 30407 * // Partially applied with placeholders. 30408 * var greetFred = _.partial(greet, _, 'fred'); 30409 * greetFred('hi'); 30410 * // => 'hi fred' 30411 */ 30412 var partial = baseRest(function(func, partials) { 30413 var holders = replaceHolders(partials, getHolder(partial)); 30414 return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders); 30415 }); 30416 30417 /** 30418 * This method is like `_.partial` except that partially applied arguments 30419 * are appended to the arguments it receives. 30420 * 30421 * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic 30422 * builds, may be used as a placeholder for partially applied arguments. 30423 * 30424 * **Note:** This method doesn't set the "length" property of partially 30425 * applied functions. 30426 * 30427 * @static 30428 * @memberOf _ 30429 * @since 1.0.0 30430 * @category Function 30431 * @param {Function} func The function to partially apply arguments to. 30432 * @param {...*} [partials] The arguments to be partially applied. 30433 * @returns {Function} Returns the new partially applied function. 30434 * @example 30435 * 30436 * function greet(greeting, name) { 30437 * return greeting + ' ' + name; 30438 * } 30439 * 30440 * var greetFred = _.partialRight(greet, 'fred'); 30441 * greetFred('hi'); 30442 * // => 'hi fred' 30443 * 30444 * // Partially applied with placeholders. 30445 * var sayHelloTo = _.partialRight(greet, 'hello', _); 30446 * sayHelloTo('fred'); 30447 * // => 'hello fred' 30448 */ 30449 var partialRight = baseRest(function(func, partials) { 30450 var holders = replaceHolders(partials, getHolder(partialRight)); 30451 return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders); 30452 }); 30453 30454 /** 30455 * Creates a function that invokes `func` with arguments arranged according 30456 * to the specified `indexes` where the argument value at the first index is 30457 * provided as the first argument, the argument value at the second index is 30458 * provided as the second argument, and so on. 30459 * 30460 * @static 30461 * @memberOf _ 30462 * @since 3.0.0 30463 * @category Function 30464 * @param {Function} func The function to rearrange arguments for. 30465 * @param {...(number|number[])} indexes The arranged argument indexes. 30466 * @returns {Function} Returns the new function. 30467 * @example 30468 * 30469 * var rearged = _.rearg(function(a, b, c) { 30470 * return [a, b, c]; 30471 * }, [2, 0, 1]); 30472 * 30473 * rearged('b', 'c', 'a') 30474 * // => ['a', 'b', 'c'] 30475 */ 30476 var rearg = flatRest(function(func, indexes) { 30477 return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes); 30478 }); 30479 30480 /** 30481 * Creates a function that invokes `func` with the `this` binding of the 30482 * created function and arguments from `start` and beyond provided as 30483 * an array. 30484 * 30485 * **Note:** This method is based on the 30486 * [rest parameter](https://mdn.io/rest_parameters). 30487 * 30488 * @static 30489 * @memberOf _ 30490 * @since 4.0.0 30491 * @category Function 30492 * @param {Function} func The function to apply a rest parameter to. 30493 * @param {number} [start=func.length-1] The start position of the rest parameter. 30494 * @returns {Function} Returns the new function. 30495 * @example 30496 * 30497 * var say = _.rest(function(what, names) { 30498 * return what + ' ' + _.initial(names).join(', ') + 30499 * (_.size(names) > 1 ? ', & ' : '') + _.last(names); 30500 * }); 30501 * 30502 * say('hello', 'fred', 'barney', 'pebbles'); 30503 * // => 'hello fred, barney, & pebbles' 30504 */ 30505 function rest(func, start) { 30506 if (typeof func != 'function') { 30507 throw new TypeError(FUNC_ERROR_TEXT); 30508 } 30509 start = start === undefined ? start : toInteger(start); 30510 return baseRest(func, start); 30511 } 30512 30513 /** 30514 * Creates a function that invokes `func` with the `this` binding of the 30515 * create function and an array of arguments much like 30516 * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply). 30517 * 30518 * **Note:** This method is based on the 30519 * [spread operator](https://mdn.io/spread_operator). 30520 * 30521 * @static 30522 * @memberOf _ 30523 * @since 3.2.0 30524 * @category Function 30525 * @param {Function} func The function to spread arguments over. 30526 * @param {number} [start=0] The start position of the spread. 30527 * @returns {Function} Returns the new function. 30528 * @example 30529 * 30530 * var say = _.spread(function(who, what) { 30531 * return who + ' says ' + what; 30532 * }); 30533 * 30534 * say(['fred', 'hello']); 30535 * // => 'fred says hello' 30536 * 30537 * var numbers = Promise.all([ 30538 * Promise.resolve(40), 30539 * Promise.resolve(36) 30540 * ]); 30541 * 30542 * numbers.then(_.spread(function(x, y) { 30543 * return x + y; 30544 * })); 30545 * // => a Promise of 76 30546 */ 30547 function spread(func, start) { 30548 if (typeof func != 'function') { 30549 throw new TypeError(FUNC_ERROR_TEXT); 30550 } 30551 start = start == null ? 0 : nativeMax(toInteger(start), 0); 30552 return baseRest(function(args) { 30553 var array = args[start], 30554 otherArgs = castSlice(args, 0, start); 30555 30556 if (array) { 30557 arrayPush(otherArgs, array); 30558 } 30559 return apply(func, this, otherArgs); 30560 }); 30561 } 30562 30563 /** 30564 * Creates a throttled function that only invokes `func` at most once per 30565 * every `wait` milliseconds. The throttled function comes with a `cancel` 30566 * method to cancel delayed `func` invocations and a `flush` method to 30567 * immediately invoke them. Provide `options` to indicate whether `func` 30568 * should be invoked on the leading and/or trailing edge of the `wait` 30569 * timeout. The `func` is invoked with the last arguments provided to the 30570 * throttled function. Subsequent calls to the throttled function return the 30571 * result of the last `func` invocation. 30572 * 30573 * **Note:** If `leading` and `trailing` options are `true`, `func` is 30574 * invoked on the trailing edge of the timeout only if the throttled function 30575 * is invoked more than once during the `wait` timeout. 30576 * 30577 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 30578 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 30579 * 30580 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 30581 * for details over the differences between `_.throttle` and `_.debounce`. 30582 * 30583 * @static 30584 * @memberOf _ 30585 * @since 0.1.0 30586 * @category Function 30587 * @param {Function} func The function to throttle. 30588 * @param {number} [wait=0] The number of milliseconds to throttle invocations to. 30589 * @param {Object} [options={}] The options object. 30590 * @param {boolean} [options.leading=true] 30591 * Specify invoking on the leading edge of the timeout. 30592 * @param {boolean} [options.trailing=true] 30593 * Specify invoking on the trailing edge of the timeout. 30594 * @returns {Function} Returns the new throttled function. 30595 * @example 30596 * 30597 * // Avoid excessively updating the position while scrolling. 30598 * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); 30599 * 30600 * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. 30601 * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); 30602 * jQuery(element).on('click', throttled); 30603 * 30604 * // Cancel the trailing throttled invocation. 30605 * jQuery(window).on('popstate', throttled.cancel); 30606 */ 30607 function throttle(func, wait, options) { 30608 var leading = true, 30609 trailing = true; 30610 30611 if (typeof func != 'function') { 30612 throw new TypeError(FUNC_ERROR_TEXT); 30613 } 30614 if (isObject(options)) { 30615 leading = 'leading' in options ? !!options.leading : leading; 30616 trailing = 'trailing' in options ? !!options.trailing : trailing; 30617 } 30618 return debounce(func, wait, { 30619 'leading': leading, 30620 'maxWait': wait, 30621 'trailing': trailing 30622 }); 30623 } 30624 30625 /** 30626 * Creates a function that accepts up to one argument, ignoring any 30627 * additional arguments. 30628 * 30629 * @static 30630 * @memberOf _ 30631 * @since 4.0.0 30632 * @category Function 30633 * @param {Function} func The function to cap arguments for. 30634 * @returns {Function} Returns the new capped function. 30635 * @example 30636 * 30637 * _.map(['6', '8', '10'], _.unary(parseInt)); 30638 * // => [6, 8, 10] 30639 */ 30640 function unary(func) { 30641 return ary(func, 1); 30642 } 30643 30644 /** 30645 * Creates a function that provides `value` to `wrapper` as its first 30646 * argument. Any additional arguments provided to the function are appended 30647 * to those provided to the `wrapper`. The wrapper is invoked with the `this` 30648 * binding of the created function. 30649 * 30650 * @static 30651 * @memberOf _ 30652 * @since 0.1.0 30653 * @category Function 30654 * @param {*} value The value to wrap. 30655 * @param {Function} [wrapper=identity] The wrapper function. 30656 * @returns {Function} Returns the new function. 30657 * @example 30658 * 30659 * var p = _.wrap(_.escape, function(func, text) { 30660 * return '<p>' + func(text) + '</p>'; 30661 * }); 30662 * 30663 * p('fred, barney, & pebbles'); 30664 * // => '<p>fred, barney, & pebbles</p>' 30665 */ 30666 function wrap(value, wrapper) { 30667 return partial(castFunction(wrapper), value); 30668 } 30669 30670 /*------------------------------------------------------------------------*/ 30671 30672 /** 30673 * Casts `value` as an array if it's not one. 30674 * 30675 * @static 30676 * @memberOf _ 30677 * @since 4.4.0 30678 * @category Lang 30679 * @param {*} value The value to inspect. 30680 * @returns {Array} Returns the cast array. 30681 * @example 30682 * 30683 * _.castArray(1); 30684 * // => [1] 30685 * 30686 * _.castArray({ 'a': 1 }); 30687 * // => [{ 'a': 1 }] 30688 * 30689 * _.castArray('abc'); 30690 * // => ['abc'] 30691 * 30692 * _.castArray(null); 30693 * // => [null] 30694 * 30695 * _.castArray(undefined); 30696 * // => [undefined] 30697 * 30698 * _.castArray(); 30699 * // => [] 30700 * 30701 * var array = [1, 2, 3]; 30702 * console.log(_.castArray(array) === array); 30703 * // => true 30704 */ 30705 function castArray() { 30706 if (!arguments.length) { 30707 return []; 30708 } 30709 var value = arguments[0]; 30710 return isArray(value) ? value : [value]; 30711 } 30712 30713 /** 30714 * Creates a shallow clone of `value`. 30715 * 30716 * **Note:** This method is loosely based on the 30717 * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) 30718 * and supports cloning arrays, array buffers, booleans, date objects, maps, 30719 * numbers, `Object` objects, regexes, sets, strings, symbols, and typed 30720 * arrays. The own enumerable properties of `arguments` objects are cloned 30721 * as plain objects. An empty object is returned for uncloneable values such 30722 * as error objects, functions, DOM nodes, and WeakMaps. 30723 * 30724 * @static 30725 * @memberOf _ 30726 * @since 0.1.0 30727 * @category Lang 30728 * @param {*} value The value to clone. 30729 * @returns {*} Returns the cloned value. 30730 * @see _.cloneDeep 30731 * @example 30732 * 30733 * var objects = [{ 'a': 1 }, { 'b': 2 }]; 30734 * 30735 * var shallow = _.clone(objects); 30736 * console.log(shallow[0] === objects[0]); 30737 * // => true 30738 */ 30739 function clone(value) { 30740 return baseClone(value, CLONE_SYMBOLS_FLAG); 30741 } 30742 30743 /** 30744 * This method is like `_.clone` except that it accepts `customizer` which 30745 * is invoked to produce the cloned value. If `customizer` returns `undefined`, 30746 * cloning is handled by the method instead. The `customizer` is invoked with 30747 * up to four arguments; (value [, index|key, object, stack]). 30748 * 30749 * @static 30750 * @memberOf _ 30751 * @since 4.0.0 30752 * @category Lang 30753 * @param {*} value The value to clone. 30754 * @param {Function} [customizer] The function to customize cloning. 30755 * @returns {*} Returns the cloned value. 30756 * @see _.cloneDeepWith 30757 * @example 30758 * 30759 * function customizer(value) { 30760 * if (_.isElement(value)) { 30761 * return value.cloneNode(false); 30762 * } 30763 * } 30764 * 30765 * var el = _.cloneWith(document.body, customizer); 30766 * 30767 * console.log(el === document.body); 30768 * // => false 30769 * console.log(el.nodeName); 30770 * // => 'BODY' 30771 * console.log(el.childNodes.length); 30772 * // => 0 30773 */ 30774 function cloneWith(value, customizer) { 30775 customizer = typeof customizer == 'function' ? customizer : undefined; 30776 return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); 30777 } 30778 30779 /** 30780 * This method is like `_.clone` except that it recursively clones `value`. 30781 * 30782 * @static 30783 * @memberOf _ 30784 * @since 1.0.0 30785 * @category Lang 30786 * @param {*} value The value to recursively clone. 30787 * @returns {*} Returns the deep cloned value. 30788 * @see _.clone 30789 * @example 30790 * 30791 * var objects = [{ 'a': 1 }, { 'b': 2 }]; 30792 * 30793 * var deep = _.cloneDeep(objects); 30794 * console.log(deep[0] === objects[0]); 30795 * // => false 30796 */ 30797 function cloneDeep(value) { 30798 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); 30799 } 30800 30801 /** 30802 * This method is like `_.cloneWith` except that it recursively clones `value`. 30803 * 30804 * @static 30805 * @memberOf _ 30806 * @since 4.0.0 30807 * @category Lang 30808 * @param {*} value The value to recursively clone. 30809 * @param {Function} [customizer] The function to customize cloning. 30810 * @returns {*} Returns the deep cloned value. 30811 * @see _.cloneWith 30812 * @example 30813 * 30814 * function customizer(value) { 30815 * if (_.isElement(value)) { 30816 * return value.cloneNode(true); 30817 * } 30818 * } 30819 * 30820 * var el = _.cloneDeepWith(document.body, customizer); 30821 * 30822 * console.log(el === document.body); 30823 * // => false 30824 * console.log(el.nodeName); 30825 * // => 'BODY' 30826 * console.log(el.childNodes.length); 30827 * // => 20 30828 */ 30829 function cloneDeepWith(value, customizer) { 30830 customizer = typeof customizer == 'function' ? customizer : undefined; 30831 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); 30832 } 30833 30834 /** 30835 * Checks if `object` conforms to `source` by invoking the predicate 30836 * properties of `source` with the corresponding property values of `object`. 30837 * 30838 * **Note:** This method is equivalent to `_.conforms` when `source` is 30839 * partially applied. 30840 * 30841 * @static 30842 * @memberOf _ 30843 * @since 4.14.0 30844 * @category Lang 30845 * @param {Object} object The object to inspect. 30846 * @param {Object} source The object of property predicates to conform to. 30847 * @returns {boolean} Returns `true` if `object` conforms, else `false`. 30848 * @example 30849 * 30850 * var object = { 'a': 1, 'b': 2 }; 30851 * 30852 * _.conformsTo(object, { 'b': function(n) { return n > 1; } }); 30853 * // => true 30854 * 30855 * _.conformsTo(object, { 'b': function(n) { return n > 2; } }); 30856 * // => false 30857 */ 30858 function conformsTo(object, source) { 30859 return source == null || baseConformsTo(object, source, keys(source)); 30860 } 30861 30862 /** 30863 * Performs a 30864 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 30865 * comparison between two values to determine if they are equivalent. 30866 * 30867 * @static 30868 * @memberOf _ 30869 * @since 4.0.0 30870 * @category Lang 30871 * @param {*} value The value to compare. 30872 * @param {*} other The other value to compare. 30873 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 30874 * @example 30875 * 30876 * var object = { 'a': 1 }; 30877 * var other = { 'a': 1 }; 30878 * 30879 * _.eq(object, object); 30880 * // => true 30881 * 30882 * _.eq(object, other); 30883 * // => false 30884 * 30885 * _.eq('a', 'a'); 30886 * // => true 30887 * 30888 * _.eq('a', Object('a')); 30889 * // => false 30890 * 30891 * _.eq(NaN, NaN); 30892 * // => true 30893 */ 30894 function eq(value, other) { 30895 return value === other || (value !== value && other !== other); 30896 } 30897 30898 /** 30899 * Checks if `value` is greater than `other`. 30900 * 30901 * @static 30902 * @memberOf _ 30903 * @since 3.9.0 30904 * @category Lang 30905 * @param {*} value The value to compare. 30906 * @param {*} other The other value to compare. 30907 * @returns {boolean} Returns `true` if `value` is greater than `other`, 30908 * else `false`. 30909 * @see _.lt 30910 * @example 30911 * 30912 * _.gt(3, 1); 30913 * // => true 30914 * 30915 * _.gt(3, 3); 30916 * // => false 30917 * 30918 * _.gt(1, 3); 30919 * // => false 30920 */ 30921 var gt = createRelationalOperation(baseGt); 30922 30923 /** 30924 * Checks if `value` is greater than or equal to `other`. 30925 * 30926 * @static 30927 * @memberOf _ 30928 * @since 3.9.0 30929 * @category Lang 30930 * @param {*} value The value to compare. 30931 * @param {*} other The other value to compare. 30932 * @returns {boolean} Returns `true` if `value` is greater than or equal to 30933 * `other`, else `false`. 30934 * @see _.lte 30935 * @example 30936 * 30937 * _.gte(3, 1); 30938 * // => true 30939 * 30940 * _.gte(3, 3); 30941 * // => true 30942 * 30943 * _.gte(1, 3); 30944 * // => false 30945 */ 30946 var gte = createRelationalOperation(function(value, other) { 30947 return value >= other; 30948 }); 30949 30950 /** 30951 * Checks if `value` is likely an `arguments` object. 30952 * 30953 * @static 30954 * @memberOf _ 30955 * @since 0.1.0 30956 * @category Lang 30957 * @param {*} value The value to check. 30958 * @returns {boolean} Returns `true` if `value` is an `arguments` object, 30959 * else `false`. 30960 * @example 30961 * 30962 * _.isArguments(function() { return arguments; }()); 30963 * // => true 30964 * 30965 * _.isArguments([1, 2, 3]); 30966 * // => false 30967 */ 30968 var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { 30969 return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && 30970 !propertyIsEnumerable.call(value, 'callee'); 30971 }; 30972 30973 /** 30974 * Checks if `value` is classified as an `Array` object. 30975 * 30976 * @static 30977 * @memberOf _ 30978 * @since 0.1.0 30979 * @category Lang 30980 * @param {*} value The value to check. 30981 * @returns {boolean} Returns `true` if `value` is an array, else `false`. 30982 * @example 30983 * 30984 * _.isArray([1, 2, 3]); 30985 * // => true 30986 * 30987 * _.isArray(document.body.children); 30988 * // => false 30989 * 30990 * _.isArray('abc'); 30991 * // => false 30992 * 30993 * _.isArray(_.noop); 30994 * // => false 30995 */ 30996 var isArray = Array.isArray; 30997 30998 /** 30999 * Checks if `value` is classified as an `ArrayBuffer` object. 31000 * 31001 * @static 31002 * @memberOf _ 31003 * @since 4.3.0 31004 * @category Lang 31005 * @param {*} value The value to check. 31006 * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. 31007 * @example 31008 * 31009 * _.isArrayBuffer(new ArrayBuffer(2)); 31010 * // => true 31011 * 31012 * _.isArrayBuffer(new Array(2)); 31013 * // => false 31014 */ 31015 var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; 31016 31017 /** 31018 * Checks if `value` is array-like. A value is considered array-like if it's 31019 * not a function and has a `value.length` that's an integer greater than or 31020 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. 31021 * 31022 * @static 31023 * @memberOf _ 31024 * @since 4.0.0 31025 * @category Lang 31026 * @param {*} value The value to check. 31027 * @returns {boolean} Returns `true` if `value` is array-like, else `false`. 31028 * @example 31029 * 31030 * _.isArrayLike([1, 2, 3]); 31031 * // => true 31032 * 31033 * _.isArrayLike(document.body.children); 31034 * // => true 31035 * 31036 * _.isArrayLike('abc'); 31037 * // => true 31038 * 31039 * _.isArrayLike(_.noop); 31040 * // => false 31041 */ 31042 function isArrayLike(value) { 31043 return value != null && isLength(value.length) && !isFunction(value); 31044 } 31045 31046 /** 31047 * This method is like `_.isArrayLike` except that it also checks if `value` 31048 * is an object. 31049 * 31050 * @static 31051 * @memberOf _ 31052 * @since 4.0.0 31053 * @category Lang 31054 * @param {*} value The value to check. 31055 * @returns {boolean} Returns `true` if `value` is an array-like object, 31056 * else `false`. 31057 * @example 31058 * 31059 * _.isArrayLikeObject([1, 2, 3]); 31060 * // => true 31061 * 31062 * _.isArrayLikeObject(document.body.children); 31063 * // => true 31064 * 31065 * _.isArrayLikeObject('abc'); 31066 * // => false 31067 * 31068 * _.isArrayLikeObject(_.noop); 31069 * // => false 31070 */ 31071 function isArrayLikeObject(value) { 31072 return isObjectLike(value) && isArrayLike(value); 31073 } 31074 31075 /** 31076 * Checks if `value` is classified as a boolean primitive or object. 31077 * 31078 * @static 31079 * @memberOf _ 31080 * @since 0.1.0 31081 * @category Lang 31082 * @param {*} value The value to check. 31083 * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. 31084 * @example 31085 * 31086 * _.isBoolean(false); 31087 * // => true 31088 * 31089 * _.isBoolean(null); 31090 * // => false 31091 */ 31092 function isBoolean(value) { 31093 return value === true || value === false || 31094 (isObjectLike(value) && baseGetTag(value) == boolTag); 31095 } 31096 31097 /** 31098 * Checks if `value` is a buffer. 31099 * 31100 * @static 31101 * @memberOf _ 31102 * @since 4.3.0 31103 * @category Lang 31104 * @param {*} value The value to check. 31105 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. 31106 * @example 31107 * 31108 * _.isBuffer(new Buffer(2)); 31109 * // => true 31110 * 31111 * _.isBuffer(new Uint8Array(2)); 31112 * // => false 31113 */ 31114 var isBuffer = nativeIsBuffer || stubFalse; 31115 31116 /** 31117 * Checks if `value` is classified as a `Date` object. 31118 * 31119 * @static 31120 * @memberOf _ 31121 * @since 0.1.0 31122 * @category Lang 31123 * @param {*} value The value to check. 31124 * @returns {boolean} Returns `true` if `value` is a date object, else `false`. 31125 * @example 31126 * 31127 * _.isDate(new Date); 31128 * // => true 31129 * 31130 * _.isDate('Mon April 23 2012'); 31131 * // => false 31132 */ 31133 var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; 31134 31135 /** 31136 * Checks if `value` is likely a DOM element. 31137 * 31138 * @static 31139 * @memberOf _ 31140 * @since 0.1.0 31141 * @category Lang 31142 * @param {*} value The value to check. 31143 * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. 31144 * @example 31145 * 31146 * _.isElement(document.body); 31147 * // => true 31148 * 31149 * _.isElement('<body>'); 31150 * // => false 31151 */ 31152 function isElement(value) { 31153 return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); 31154 } 31155 31156 /** 31157 * Checks if `value` is an empty object, collection, map, or set. 31158 * 31159 * Objects are considered empty if they have no own enumerable string keyed 31160 * properties. 31161 * 31162 * Array-like values such as `arguments` objects, arrays, buffers, strings, or 31163 * jQuery-like collections are considered empty if they have a `length` of `0`. 31164 * Similarly, maps and sets are considered empty if they have a `size` of `0`. 31165 * 31166 * @static 31167 * @memberOf _ 31168 * @since 0.1.0 31169 * @category Lang 31170 * @param {*} value The value to check. 31171 * @returns {boolean} Returns `true` if `value` is empty, else `false`. 31172 * @example 31173 * 31174 * _.isEmpty(null); 31175 * // => true 31176 * 31177 * _.isEmpty(true); 31178 * // => true 31179 * 31180 * _.isEmpty(1); 31181 * // => true 31182 * 31183 * _.isEmpty([1, 2, 3]); 31184 * // => false 31185 * 31186 * _.isEmpty({ 'a': 1 }); 31187 * // => false 31188 */ 31189 function isEmpty(value) { 31190 if (value == null) { 31191 return true; 31192 } 31193 if (isArrayLike(value) && 31194 (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || 31195 isBuffer(value) || isTypedArray(value) || isArguments(value))) { 31196 return !value.length; 31197 } 31198 var tag = getTag(value); 31199 if (tag == mapTag || tag == setTag) { 31200 return !value.size; 31201 } 31202 if (isPrototype(value)) { 31203 return !baseKeys(value).length; 31204 } 31205 for (var key in value) { 31206 if (hasOwnProperty.call(value, key)) { 31207 return false; 31208 } 31209 } 31210 return true; 31211 } 31212 31213 /** 31214 * Performs a deep comparison between two values to determine if they are 31215 * equivalent. 31216 * 31217 * **Note:** This method supports comparing arrays, array buffers, booleans, 31218 * date objects, error objects, maps, numbers, `Object` objects, regexes, 31219 * sets, strings, symbols, and typed arrays. `Object` objects are compared 31220 * by their own, not inherited, enumerable properties. Functions and DOM 31221 * nodes are compared by strict equality, i.e. `===`. 31222 * 31223 * @static 31224 * @memberOf _ 31225 * @since 0.1.0 31226 * @category Lang 31227 * @param {*} value The value to compare. 31228 * @param {*} other The other value to compare. 31229 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 31230 * @example 31231 * 31232 * var object = { 'a': 1 }; 31233 * var other = { 'a': 1 }; 31234 * 31235 * _.isEqual(object, other); 31236 * // => true 31237 * 31238 * object === other; 31239 * // => false 31240 */ 31241 function isEqual(value, other) { 31242 return baseIsEqual(value, other); 31243 } 31244 31245 /** 31246 * This method is like `_.isEqual` except that it accepts `customizer` which 31247 * is invoked to compare values. If `customizer` returns `undefined`, comparisons 31248 * are handled by the method instead. The `customizer` is invoked with up to 31249 * six arguments: (objValue, othValue [, index|key, object, other, stack]). 31250 * 31251 * @static 31252 * @memberOf _ 31253 * @since 4.0.0 31254 * @category Lang 31255 * @param {*} value The value to compare. 31256 * @param {*} other The other value to compare. 31257 * @param {Function} [customizer] The function to customize comparisons. 31258 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 31259 * @example 31260 * 31261 * function isGreeting(value) { 31262 * return /^h(?:i|ello)$/.test(value); 31263 * } 31264 * 31265 * function customizer(objValue, othValue) { 31266 * if (isGreeting(objValue) && isGreeting(othValue)) { 31267 * return true; 31268 * } 31269 * } 31270 * 31271 * var array = ['hello', 'goodbye']; 31272 * var other = ['hi', 'goodbye']; 31273 * 31274 * _.isEqualWith(array, other, customizer); 31275 * // => true 31276 */ 31277 function isEqualWith(value, other, customizer) { 31278 customizer = typeof customizer == 'function' ? customizer : undefined; 31279 var result = customizer ? customizer(value, other) : undefined; 31280 return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result; 31281 } 31282 31283 /** 31284 * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, 31285 * `SyntaxError`, `TypeError`, or `URIError` object. 31286 * 31287 * @static 31288 * @memberOf _ 31289 * @since 3.0.0 31290 * @category Lang 31291 * @param {*} value The value to check. 31292 * @returns {boolean} Returns `true` if `value` is an error object, else `false`. 31293 * @example 31294 * 31295 * _.isError(new Error); 31296 * // => true 31297 * 31298 * _.isError(Error); 31299 * // => false 31300 */ 31301 function isError(value) { 31302 if (!isObjectLike(value)) { 31303 return false; 31304 } 31305 var tag = baseGetTag(value); 31306 return tag == errorTag || tag == domExcTag || 31307 (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); 31308 } 31309 31310 /** 31311 * Checks if `value` is a finite primitive number. 31312 * 31313 * **Note:** This method is based on 31314 * [`Number.isFinite`](https://mdn.io/Number/isFinite). 31315 * 31316 * @static 31317 * @memberOf _ 31318 * @since 0.1.0 31319 * @category Lang 31320 * @param {*} value The value to check. 31321 * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. 31322 * @example 31323 * 31324 * _.isFinite(3); 31325 * // => true 31326 * 31327 * _.isFinite(Number.MIN_VALUE); 31328 * // => true 31329 * 31330 * _.isFinite(Infinity); 31331 * // => false 31332 * 31333 * _.isFinite('3'); 31334 * // => false 31335 */ 31336 function isFinite(value) { 31337 return typeof value == 'number' && nativeIsFinite(value); 31338 } 31339 31340 /** 31341 * Checks if `value` is classified as a `Function` object. 31342 * 31343 * @static 31344 * @memberOf _ 31345 * @since 0.1.0 31346 * @category Lang 31347 * @param {*} value The value to check. 31348 * @returns {boolean} Returns `true` if `value` is a function, else `false`. 31349 * @example 31350 * 31351 * _.isFunction(_); 31352 * // => true 31353 * 31354 * _.isFunction(/abc/); 31355 * // => false 31356 */ 31357 function isFunction(value) { 31358 if (!isObject(value)) { 31359 return false; 31360 } 31361 // The use of `Object#toString` avoids issues with the `typeof` operator 31362 // in Safari 9 which returns 'object' for typed arrays and other constructors. 31363 var tag = baseGetTag(value); 31364 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; 31365 } 31366 31367 /** 31368 * Checks if `value` is an integer. 31369 * 31370 * **Note:** This method is based on 31371 * [`Number.isInteger`](https://mdn.io/Number/isInteger). 31372 * 31373 * @static 31374 * @memberOf _ 31375 * @since 4.0.0 31376 * @category Lang 31377 * @param {*} value The value to check. 31378 * @returns {boolean} Returns `true` if `value` is an integer, else `false`. 31379 * @example 31380 * 31381 * _.isInteger(3); 31382 * // => true 31383 * 31384 * _.isInteger(Number.MIN_VALUE); 31385 * // => false 31386 * 31387 * _.isInteger(Infinity); 31388 * // => false 31389 * 31390 * _.isInteger('3'); 31391 * // => false 31392 */ 31393 function isInteger(value) { 31394 return typeof value == 'number' && value == toInteger(value); 31395 } 31396 31397 /** 31398 * Checks if `value` is a valid array-like length. 31399 * 31400 * **Note:** This method is loosely based on 31401 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). 31402 * 31403 * @static 31404 * @memberOf _ 31405 * @since 4.0.0 31406 * @category Lang 31407 * @param {*} value The value to check. 31408 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. 31409 * @example 31410 * 31411 * _.isLength(3); 31412 * // => true 31413 * 31414 * _.isLength(Number.MIN_VALUE); 31415 * // => false 31416 * 31417 * _.isLength(Infinity); 31418 * // => false 31419 * 31420 * _.isLength('3'); 31421 * // => false 31422 */ 31423 function isLength(value) { 31424 return typeof value == 'number' && 31425 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; 31426 } 31427 31428 /** 31429 * Checks if `value` is the 31430 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) 31431 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) 31432 * 31433 * @static 31434 * @memberOf _ 31435 * @since 0.1.0 31436 * @category Lang 31437 * @param {*} value The value to check. 31438 * @returns {boolean} Returns `true` if `value` is an object, else `false`. 31439 * @example 31440 * 31441 * _.isObject({}); 31442 * // => true 31443 * 31444 * _.isObject([1, 2, 3]); 31445 * // => true 31446 * 31447 * _.isObject(_.noop); 31448 * // => true 31449 * 31450 * _.isObject(null); 31451 * // => false 31452 */ 31453 function isObject(value) { 31454 var type = typeof value; 31455 return value != null && (type == 'object' || type == 'function'); 31456 } 31457 31458 /** 31459 * Checks if `value` is object-like. A value is object-like if it's not `null` 31460 * and has a `typeof` result of "object". 31461 * 31462 * @static 31463 * @memberOf _ 31464 * @since 4.0.0 31465 * @category Lang 31466 * @param {*} value The value to check. 31467 * @returns {boolean} Returns `true` if `value` is object-like, else `false`. 31468 * @example 31469 * 31470 * _.isObjectLike({}); 31471 * // => true 31472 * 31473 * _.isObjectLike([1, 2, 3]); 31474 * // => true 31475 * 31476 * _.isObjectLike(_.noop); 31477 * // => false 31478 * 31479 * _.isObjectLike(null); 31480 * // => false 31481 */ 31482 function isObjectLike(value) { 31483 return value != null && typeof value == 'object'; 31484 } 31485 31486 /** 31487 * Checks if `value` is classified as a `Map` object. 31488 * 31489 * @static 31490 * @memberOf _ 31491 * @since 4.3.0 31492 * @category Lang 31493 * @param {*} value The value to check. 31494 * @returns {boolean} Returns `true` if `value` is a map, else `false`. 31495 * @example 31496 * 31497 * _.isMap(new Map); 31498 * // => true 31499 * 31500 * _.isMap(new WeakMap); 31501 * // => false 31502 */ 31503 var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; 31504 31505 /** 31506 * Performs a partial deep comparison between `object` and `source` to 31507 * determine if `object` contains equivalent property values. 31508 * 31509 * **Note:** This method is equivalent to `_.matches` when `source` is 31510 * partially applied. 31511 * 31512 * Partial comparisons will match empty array and empty object `source` 31513 * values against any array or object value, respectively. See `_.isEqual` 31514 * for a list of supported value comparisons. 31515 * 31516 * @static 31517 * @memberOf _ 31518 * @since 3.0.0 31519 * @category Lang 31520 * @param {Object} object The object to inspect. 31521 * @param {Object} source The object of property values to match. 31522 * @returns {boolean} Returns `true` if `object` is a match, else `false`. 31523 * @example 31524 * 31525 * var object = { 'a': 1, 'b': 2 }; 31526 * 31527 * _.isMatch(object, { 'b': 2 }); 31528 * // => true 31529 * 31530 * _.isMatch(object, { 'b': 1 }); 31531 * // => false 31532 */ 31533 function isMatch(object, source) { 31534 return object === source || baseIsMatch(object, source, getMatchData(source)); 31535 } 31536 31537 /** 31538 * This method is like `_.isMatch` except that it accepts `customizer` which 31539 * is invoked to compare values. If `customizer` returns `undefined`, comparisons 31540 * are handled by the method instead. The `customizer` is invoked with five 31541 * arguments: (objValue, srcValue, index|key, object, source). 31542 * 31543 * @static 31544 * @memberOf _ 31545 * @since 4.0.0 31546 * @category Lang 31547 * @param {Object} object The object to inspect. 31548 * @param {Object} source The object of property values to match. 31549 * @param {Function} [customizer] The function to customize comparisons. 31550 * @returns {boolean} Returns `true` if `object` is a match, else `false`. 31551 * @example 31552 * 31553 * function isGreeting(value) { 31554 * return /^h(?:i|ello)$/.test(value); 31555 * } 31556 * 31557 * function customizer(objValue, srcValue) { 31558 * if (isGreeting(objValue) && isGreeting(srcValue)) { 31559 * return true; 31560 * } 31561 * } 31562 * 31563 * var object = { 'greeting': 'hello' }; 31564 * var source = { 'greeting': 'hi' }; 31565 * 31566 * _.isMatchWith(object, source, customizer); 31567 * // => true 31568 */ 31569 function isMatchWith(object, source, customizer) { 31570 customizer = typeof customizer == 'function' ? customizer : undefined; 31571 return baseIsMatch(object, source, getMatchData(source), customizer); 31572 } 31573 31574 /** 31575 * Checks if `value` is `NaN`. 31576 * 31577 * **Note:** This method is based on 31578 * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as 31579 * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for 31580 * `undefined` and other non-number values. 31581 * 31582 * @static 31583 * @memberOf _ 31584 * @since 0.1.0 31585 * @category Lang 31586 * @param {*} value The value to check. 31587 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. 31588 * @example 31589 * 31590 * _.isNaN(NaN); 31591 * // => true 31592 * 31593 * _.isNaN(new Number(NaN)); 31594 * // => true 31595 * 31596 * isNaN(undefined); 31597 * // => true 31598 * 31599 * _.isNaN(undefined); 31600 * // => false 31601 */ 31602 function isNaN(value) { 31603 // An `NaN` primitive is the only value that is not equal to itself. 31604 // Perform the `toStringTag` check first to avoid errors with some 31605 // ActiveX objects in IE. 31606 return isNumber(value) && value != +value; 31607 } 31608 31609 /** 31610 * Checks if `value` is a pristine native function. 31611 * 31612 * **Note:** This method can't reliably detect native functions in the presence 31613 * of the core-js package because core-js circumvents this kind of detection. 31614 * Despite multiple requests, the core-js maintainer has made it clear: any 31615 * attempt to fix the detection will be obstructed. As a result, we're left 31616 * with little choice but to throw an error. Unfortunately, this also affects 31617 * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), 31618 * which rely on core-js. 31619 * 31620 * @static 31621 * @memberOf _ 31622 * @since 3.0.0 31623 * @category Lang 31624 * @param {*} value The value to check. 31625 * @returns {boolean} Returns `true` if `value` is a native function, 31626 * else `false`. 31627 * @example 31628 * 31629 * _.isNative(Array.prototype.push); 31630 * // => true 31631 * 31632 * _.isNative(_); 31633 * // => false 31634 */ 31635 function isNative(value) { 31636 if (isMaskable(value)) { 31637 throw new Error(CORE_ERROR_TEXT); 31638 } 31639 return baseIsNative(value); 31640 } 31641 31642 /** 31643 * Checks if `value` is `null`. 31644 * 31645 * @static 31646 * @memberOf _ 31647 * @since 0.1.0 31648 * @category Lang 31649 * @param {*} value The value to check. 31650 * @returns {boolean} Returns `true` if `value` is `null`, else `false`. 31651 * @example 31652 * 31653 * _.isNull(null); 31654 * // => true 31655 * 31656 * _.isNull(void 0); 31657 * // => false 31658 */ 31659 function isNull(value) { 31660 return value === null; 31661 } 31662 31663 /** 31664 * Checks if `value` is `null` or `undefined`. 31665 * 31666 * @static 31667 * @memberOf _ 31668 * @since 4.0.0 31669 * @category Lang 31670 * @param {*} value The value to check. 31671 * @returns {boolean} Returns `true` if `value` is nullish, else `false`. 31672 * @example 31673 * 31674 * _.isNil(null); 31675 * // => true 31676 * 31677 * _.isNil(void 0); 31678 * // => true 31679 * 31680 * _.isNil(NaN); 31681 * // => false 31682 */ 31683 function isNil(value) { 31684 return value == null; 31685 } 31686 31687 /** 31688 * Checks if `value` is classified as a `Number` primitive or object. 31689 * 31690 * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are 31691 * classified as numbers, use the `_.isFinite` method. 31692 * 31693 * @static 31694 * @memberOf _ 31695 * @since 0.1.0 31696 * @category Lang 31697 * @param {*} value The value to check. 31698 * @returns {boolean} Returns `true` if `value` is a number, else `false`. 31699 * @example 31700 * 31701 * _.isNumber(3); 31702 * // => true 31703 * 31704 * _.isNumber(Number.MIN_VALUE); 31705 * // => true 31706 * 31707 * _.isNumber(Infinity); 31708 * // => true 31709 * 31710 * _.isNumber('3'); 31711 * // => false 31712 */ 31713 function isNumber(value) { 31714 return typeof value == 'number' || 31715 (isObjectLike(value) && baseGetTag(value) == numberTag); 31716 } 31717 31718 /** 31719 * Checks if `value` is a plain object, that is, an object created by the 31720 * `Object` constructor or one with a `[[Prototype]]` of `null`. 31721 * 31722 * @static 31723 * @memberOf _ 31724 * @since 0.8.0 31725 * @category Lang 31726 * @param {*} value The value to check. 31727 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. 31728 * @example 31729 * 31730 * function Foo() { 31731 * this.a = 1; 31732 * } 31733 * 31734 * _.isPlainObject(new Foo); 31735 * // => false 31736 * 31737 * _.isPlainObject([1, 2, 3]); 31738 * // => false 31739 * 31740 * _.isPlainObject({ 'x': 0, 'y': 0 }); 31741 * // => true 31742 * 31743 * _.isPlainObject(Object.create(null)); 31744 * // => true 31745 */ 31746 function isPlainObject(value) { 31747 if (!isObjectLike(value) || baseGetTag(value) != objectTag) { 31748 return false; 31749 } 31750 var proto = getPrototype(value); 31751 if (proto === null) { 31752 return true; 31753 } 31754 var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; 31755 return typeof Ctor == 'function' && Ctor instanceof Ctor && 31756 funcToString.call(Ctor) == objectCtorString; 31757 } 31758 31759 /** 31760 * Checks if `value` is classified as a `RegExp` object. 31761 * 31762 * @static 31763 * @memberOf _ 31764 * @since 0.1.0 31765 * @category Lang 31766 * @param {*} value The value to check. 31767 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. 31768 * @example 31769 * 31770 * _.isRegExp(/abc/); 31771 * // => true 31772 * 31773 * _.isRegExp('/abc/'); 31774 * // => false 31775 */ 31776 var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; 31777 31778 /** 31779 * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 31780 * double precision number which isn't the result of a rounded unsafe integer. 31781 * 31782 * **Note:** This method is based on 31783 * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). 31784 * 31785 * @static 31786 * @memberOf _ 31787 * @since 4.0.0 31788 * @category Lang 31789 * @param {*} value The value to check. 31790 * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. 31791 * @example 31792 * 31793 * _.isSafeInteger(3); 31794 * // => true 31795 * 31796 * _.isSafeInteger(Number.MIN_VALUE); 31797 * // => false 31798 * 31799 * _.isSafeInteger(Infinity); 31800 * // => false 31801 * 31802 * _.isSafeInteger('3'); 31803 * // => false 31804 */ 31805 function isSafeInteger(value) { 31806 return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; 31807 } 31808 31809 /** 31810 * Checks if `value` is classified as a `Set` object. 31811 * 31812 * @static 31813 * @memberOf _ 31814 * @since 4.3.0 31815 * @category Lang 31816 * @param {*} value The value to check. 31817 * @returns {boolean} Returns `true` if `value` is a set, else `false`. 31818 * @example 31819 * 31820 * _.isSet(new Set); 31821 * // => true 31822 * 31823 * _.isSet(new WeakSet); 31824 * // => false 31825 */ 31826 var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; 31827 31828 /** 31829 * Checks if `value` is classified as a `String` primitive or object. 31830 * 31831 * @static 31832 * @since 0.1.0 31833 * @memberOf _ 31834 * @category Lang 31835 * @param {*} value The value to check. 31836 * @returns {boolean} Returns `true` if `value` is a string, else `false`. 31837 * @example 31838 * 31839 * _.isString('abc'); 31840 * // => true 31841 * 31842 * _.isString(1); 31843 * // => false 31844 */ 31845 function isString(value) { 31846 return typeof value == 'string' || 31847 (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); 31848 } 31849 31850 /** 31851 * Checks if `value` is classified as a `Symbol` primitive or object. 31852 * 31853 * @static 31854 * @memberOf _ 31855 * @since 4.0.0 31856 * @category Lang 31857 * @param {*} value The value to check. 31858 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. 31859 * @example 31860 * 31861 * _.isSymbol(Symbol.iterator); 31862 * // => true 31863 * 31864 * _.isSymbol('abc'); 31865 * // => false 31866 */ 31867 function isSymbol(value) { 31868 return typeof value == 'symbol' || 31869 (isObjectLike(value) && baseGetTag(value) == symbolTag); 31870 } 31871 31872 /** 31873 * Checks if `value` is classified as a typed array. 31874 * 31875 * @static 31876 * @memberOf _ 31877 * @since 3.0.0 31878 * @category Lang 31879 * @param {*} value The value to check. 31880 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. 31881 * @example 31882 * 31883 * _.isTypedArray(new Uint8Array); 31884 * // => true 31885 * 31886 * _.isTypedArray([]); 31887 * // => false 31888 */ 31889 var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; 31890 31891 /** 31892 * Checks if `value` is `undefined`. 31893 * 31894 * @static 31895 * @since 0.1.0 31896 * @memberOf _ 31897 * @category Lang 31898 * @param {*} value The value to check. 31899 * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. 31900 * @example 31901 * 31902 * _.isUndefined(void 0); 31903 * // => true 31904 * 31905 * _.isUndefined(null); 31906 * // => false 31907 */ 31908 function isUndefined(value) { 31909 return value === undefined; 31910 } 31911 31912 /** 31913 * Checks if `value` is classified as a `WeakMap` object. 31914 * 31915 * @static 31916 * @memberOf _ 31917 * @since 4.3.0 31918 * @category Lang 31919 * @param {*} value The value to check. 31920 * @returns {boolean} Returns `true` if `value` is a weak map, else `false`. 31921 * @example 31922 * 31923 * _.isWeakMap(new WeakMap); 31924 * // => true 31925 * 31926 * _.isWeakMap(new Map); 31927 * // => false 31928 */ 31929 function isWeakMap(value) { 31930 return isObjectLike(value) && getTag(value) == weakMapTag; 31931 } 31932 31933 /** 31934 * Checks if `value` is classified as a `WeakSet` object. 31935 * 31936 * @static 31937 * @memberOf _ 31938 * @since 4.3.0 31939 * @category Lang 31940 * @param {*} value The value to check. 31941 * @returns {boolean} Returns `true` if `value` is a weak set, else `false`. 31942 * @example 31943 * 31944 * _.isWeakSet(new WeakSet); 31945 * // => true 31946 * 31947 * _.isWeakSet(new Set); 31948 * // => false 31949 */ 31950 function isWeakSet(value) { 31951 return isObjectLike(value) && baseGetTag(value) == weakSetTag; 31952 } 31953 31954 /** 31955 * Checks if `value` is less than `other`. 31956 * 31957 * @static 31958 * @memberOf _ 31959 * @since 3.9.0 31960 * @category Lang 31961 * @param {*} value The value to compare. 31962 * @param {*} other The other value to compare. 31963 * @returns {boolean} Returns `true` if `value` is less than `other`, 31964 * else `false`. 31965 * @see _.gt 31966 * @example 31967 * 31968 * _.lt(1, 3); 31969 * // => true 31970 * 31971 * _.lt(3, 3); 31972 * // => false 31973 * 31974 * _.lt(3, 1); 31975 * // => false 31976 */ 31977 var lt = createRelationalOperation(baseLt); 31978 31979 /** 31980 * Checks if `value` is less than or equal to `other`. 31981 * 31982 * @static 31983 * @memberOf _ 31984 * @since 3.9.0 31985 * @category Lang 31986 * @param {*} value The value to compare. 31987 * @param {*} other The other value to compare. 31988 * @returns {boolean} Returns `true` if `value` is less than or equal to 31989 * `other`, else `false`. 31990 * @see _.gte 31991 * @example 31992 * 31993 * _.lte(1, 3); 31994 * // => true 31995 * 31996 * _.lte(3, 3); 31997 * // => true 31998 * 31999 * _.lte(3, 1); 32000 * // => false 32001 */ 32002 var lte = createRelationalOperation(function(value, other) { 32003 return value <= other; 32004 }); 32005 32006 /** 32007 * Converts `value` to an array. 32008 * 32009 * @static 32010 * @since 0.1.0 32011 * @memberOf _ 32012 * @category Lang 32013 * @param {*} value The value to convert. 32014 * @returns {Array} Returns the converted array. 32015 * @example 32016 * 32017 * _.toArray({ 'a': 1, 'b': 2 }); 32018 * // => [1, 2] 32019 * 32020 * _.toArray('abc'); 32021 * // => ['a', 'b', 'c'] 32022 * 32023 * _.toArray(1); 32024 * // => [] 32025 * 32026 * _.toArray(null); 32027 * // => [] 32028 */ 32029 function toArray(value) { 32030 if (!value) { 32031 return []; 32032 } 32033 if (isArrayLike(value)) { 32034 return isString(value) ? stringToArray(value) : copyArray(value); 32035 } 32036 if (symIterator && value[symIterator]) { 32037 return iteratorToArray(value[symIterator]()); 32038 } 32039 var tag = getTag(value), 32040 func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); 32041 32042 return func(value); 32043 } 32044 32045 /** 32046 * Converts `value` to a finite number. 32047 * 32048 * @static 32049 * @memberOf _ 32050 * @since 4.12.0 32051 * @category Lang 32052 * @param {*} value The value to convert. 32053 * @returns {number} Returns the converted number. 32054 * @example 32055 * 32056 * _.toFinite(3.2); 32057 * // => 3.2 32058 * 32059 * _.toFinite(Number.MIN_VALUE); 32060 * // => 5e-324 32061 * 32062 * _.toFinite(Infinity); 32063 * // => 1.7976931348623157e+308 32064 * 32065 * _.toFinite('3.2'); 32066 * // => 3.2 32067 */ 32068 function toFinite(value) { 32069 if (!value) { 32070 return value === 0 ? value : 0; 32071 } 32072 value = toNumber(value); 32073 if (value === INFINITY || value === -INFINITY) { 32074 var sign = (value < 0 ? -1 : 1); 32075 return sign * MAX_INTEGER; 32076 } 32077 return value === value ? value : 0; 32078 } 32079 32080 /** 32081 * Converts `value` to an integer. 32082 * 32083 * **Note:** This method is loosely based on 32084 * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). 32085 * 32086 * @static 32087 * @memberOf _ 32088 * @since 4.0.0 32089 * @category Lang 32090 * @param {*} value The value to convert. 32091 * @returns {number} Returns the converted integer. 32092 * @example 32093 * 32094 * _.toInteger(3.2); 32095 * // => 3 32096 * 32097 * _.toInteger(Number.MIN_VALUE); 32098 * // => 0 32099 * 32100 * _.toInteger(Infinity); 32101 * // => 1.7976931348623157e+308 32102 * 32103 * _.toInteger('3.2'); 32104 * // => 3 32105 */ 32106 function toInteger(value) { 32107 var result = toFinite(value), 32108 remainder = result % 1; 32109 32110 return result === result ? (remainder ? result - remainder : result) : 0; 32111 } 32112 32113 /** 32114 * Converts `value` to an integer suitable for use as the length of an 32115 * array-like object. 32116 * 32117 * **Note:** This method is based on 32118 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). 32119 * 32120 * @static 32121 * @memberOf _ 32122 * @since 4.0.0 32123 * @category Lang 32124 * @param {*} value The value to convert. 32125 * @returns {number} Returns the converted integer. 32126 * @example 32127 * 32128 * _.toLength(3.2); 32129 * // => 3 32130 * 32131 * _.toLength(Number.MIN_VALUE); 32132 * // => 0 32133 * 32134 * _.toLength(Infinity); 32135 * // => 4294967295 32136 * 32137 * _.toLength('3.2'); 32138 * // => 3 32139 */ 32140 function toLength(value) { 32141 return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; 32142 } 32143 32144 /** 32145 * Converts `value` to a number. 32146 * 32147 * @static 32148 * @memberOf _ 32149 * @since 4.0.0 32150 * @category Lang 32151 * @param {*} value The value to process. 32152 * @returns {number} Returns the number. 32153 * @example 32154 * 32155 * _.toNumber(3.2); 32156 * // => 3.2 32157 * 32158 * _.toNumber(Number.MIN_VALUE); 32159 * // => 5e-324 32160 * 32161 * _.toNumber(Infinity); 32162 * // => Infinity 32163 * 32164 * _.toNumber('3.2'); 32165 * // => 3.2 32166 */ 32167 function toNumber(value) { 32168 if (typeof value == 'number') { 32169 return value; 32170 } 32171 if (isSymbol(value)) { 32172 return NAN; 32173 } 32174 if (isObject(value)) { 32175 var other = typeof value.valueOf == 'function' ? value.valueOf() : value; 32176 value = isObject(other) ? (other + '') : other; 32177 } 32178 if (typeof value != 'string') { 32179 return value === 0 ? value : +value; 32180 } 32181 value = baseTrim(value); 32182 var isBinary = reIsBinary.test(value); 32183 return (isBinary || reIsOctal.test(value)) 32184 ? freeParseInt(value.slice(2), isBinary ? 2 : 8) 32185 : (reIsBadHex.test(value) ? NAN : +value); 32186 } 32187 32188 /** 32189 * Converts `value` to a plain object flattening inherited enumerable string 32190 * keyed properties of `value` to own properties of the plain object. 32191 * 32192 * @static 32193 * @memberOf _ 32194 * @since 3.0.0 32195 * @category Lang 32196 * @param {*} value The value to convert. 32197 * @returns {Object} Returns the converted plain object. 32198 * @example 32199 * 32200 * function Foo() { 32201 * this.b = 2; 32202 * } 32203 * 32204 * Foo.prototype.c = 3; 32205 * 32206 * _.assign({ 'a': 1 }, new Foo); 32207 * // => { 'a': 1, 'b': 2 } 32208 * 32209 * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); 32210 * // => { 'a': 1, 'b': 2, 'c': 3 } 32211 */ 32212 function toPlainObject(value) { 32213 return copyObject(value, keysIn(value)); 32214 } 32215 32216 /** 32217 * Converts `value` to a safe integer. A safe integer can be compared and 32218 * represented correctly. 32219 * 32220 * @static 32221 * @memberOf _ 32222 * @since 4.0.0 32223 * @category Lang 32224 * @param {*} value The value to convert. 32225 * @returns {number} Returns the converted integer. 32226 * @example 32227 * 32228 * _.toSafeInteger(3.2); 32229 * // => 3 32230 * 32231 * _.toSafeInteger(Number.MIN_VALUE); 32232 * // => 0 32233 * 32234 * _.toSafeInteger(Infinity); 32235 * // => 9007199254740991 32236 * 32237 * _.toSafeInteger('3.2'); 32238 * // => 3 32239 */ 32240 function toSafeInteger(value) { 32241 return value 32242 ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) 32243 : (value === 0 ? value : 0); 32244 } 32245 32246 /** 32247 * Converts `value` to a string. An empty string is returned for `null` 32248 * and `undefined` values. The sign of `-0` is preserved. 32249 * 32250 * @static 32251 * @memberOf _ 32252 * @since 4.0.0 32253 * @category Lang 32254 * @param {*} value The value to convert. 32255 * @returns {string} Returns the converted string. 32256 * @example 32257 * 32258 * _.toString(null); 32259 * // => '' 32260 * 32261 * _.toString(-0); 32262 * // => '-0' 32263 * 32264 * _.toString([1, 2, 3]); 32265 * // => '1,2,3' 32266 */ 32267 function toString(value) { 32268 return value == null ? '' : baseToString(value); 32269 } 32270 32271 /*------------------------------------------------------------------------*/ 32272 32273 /** 32274 * Assigns own enumerable string keyed properties of source objects to the 32275 * destination object. Source objects are applied from left to right. 32276 * Subsequent sources overwrite property assignments of previous sources. 32277 * 32278 * **Note:** This method mutates `object` and is loosely based on 32279 * [`Object.assign`](https://mdn.io/Object/assign). 32280 * 32281 * @static 32282 * @memberOf _ 32283 * @since 0.10.0 32284 * @category Object 32285 * @param {Object} object The destination object. 32286 * @param {...Object} [sources] The source objects. 32287 * @returns {Object} Returns `object`. 32288 * @see _.assignIn 32289 * @example 32290 * 32291 * function Foo() { 32292 * this.a = 1; 32293 * } 32294 * 32295 * function Bar() { 32296 * this.c = 3; 32297 * } 32298 * 32299 * Foo.prototype.b = 2; 32300 * Bar.prototype.d = 4; 32301 * 32302 * _.assign({ 'a': 0 }, new Foo, new Bar); 32303 * // => { 'a': 1, 'c': 3 } 32304 */ 32305 var assign = createAssigner(function(object, source) { 32306 if (isPrototype(source) || isArrayLike(source)) { 32307 copyObject(source, keys(source), object); 32308 return; 32309 } 32310 for (var key in source) { 32311 if (hasOwnProperty.call(source, key)) { 32312 assignValue(object, key, source[key]); 32313 } 32314 } 32315 }); 32316 32317 /** 32318 * This method is like `_.assign` except that it iterates over own and 32319 * inherited source properties. 32320 * 32321 * **Note:** This method mutates `object`. 32322 * 32323 * @static 32324 * @memberOf _ 32325 * @since 4.0.0 32326 * @alias extend 32327 * @category Object 32328 * @param {Object} object The destination object. 32329 * @param {...Object} [sources] The source objects. 32330 * @returns {Object} Returns `object`. 32331 * @see _.assign 32332 * @example 32333 * 32334 * function Foo() { 32335 * this.a = 1; 32336 * } 32337 * 32338 * function Bar() { 32339 * this.c = 3; 32340 * } 32341 * 32342 * Foo.prototype.b = 2; 32343 * Bar.prototype.d = 4; 32344 * 32345 * _.assignIn({ 'a': 0 }, new Foo, new Bar); 32346 * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } 32347 */ 32348 var assignIn = createAssigner(function(object, source) { 32349 copyObject(source, keysIn(source), object); 32350 }); 32351 32352 /** 32353 * This method is like `_.assignIn` except that it accepts `customizer` 32354 * which is invoked to produce the assigned values. If `customizer` returns 32355 * `undefined`, assignment is handled by the method instead. The `customizer` 32356 * is invoked with five arguments: (objValue, srcValue, key, object, source). 32357 * 32358 * **Note:** This method mutates `object`. 32359 * 32360 * @static 32361 * @memberOf _ 32362 * @since 4.0.0 32363 * @alias extendWith 32364 * @category Object 32365 * @param {Object} object The destination object. 32366 * @param {...Object} sources The source objects. 32367 * @param {Function} [customizer] The function to customize assigned values. 32368 * @returns {Object} Returns `object`. 32369 * @see _.assignWith 32370 * @example 32371 * 32372 * function customizer(objValue, srcValue) { 32373 * return _.isUndefined(objValue) ? srcValue : objValue; 32374 * } 32375 * 32376 * var defaults = _.partialRight(_.assignInWith, customizer); 32377 * 32378 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 32379 * // => { 'a': 1, 'b': 2 } 32380 */ 32381 var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { 32382 copyObject(source, keysIn(source), object, customizer); 32383 }); 32384 32385 /** 32386 * This method is like `_.assign` except that it accepts `customizer` 32387 * which is invoked to produce the assigned values. If `customizer` returns 32388 * `undefined`, assignment is handled by the method instead. The `customizer` 32389 * is invoked with five arguments: (objValue, srcValue, key, object, source). 32390 * 32391 * **Note:** This method mutates `object`. 32392 * 32393 * @static 32394 * @memberOf _ 32395 * @since 4.0.0 32396 * @category Object 32397 * @param {Object} object The destination object. 32398 * @param {...Object} sources The source objects. 32399 * @param {Function} [customizer] The function to customize assigned values. 32400 * @returns {Object} Returns `object`. 32401 * @see _.assignInWith 32402 * @example 32403 * 32404 * function customizer(objValue, srcValue) { 32405 * return _.isUndefined(objValue) ? srcValue : objValue; 32406 * } 32407 * 32408 * var defaults = _.partialRight(_.assignWith, customizer); 32409 * 32410 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 32411 * // => { 'a': 1, 'b': 2 } 32412 */ 32413 var assignWith = createAssigner(function(object, source, srcIndex, customizer) { 32414 copyObject(source, keys(source), object, customizer); 32415 }); 32416 32417 /** 32418 * Creates an array of values corresponding to `paths` of `object`. 32419 * 32420 * @static 32421 * @memberOf _ 32422 * @since 1.0.0 32423 * @category Object 32424 * @param {Object} object The object to iterate over. 32425 * @param {...(string|string[])} [paths] The property paths to pick. 32426 * @returns {Array} Returns the picked values. 32427 * @example 32428 * 32429 * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; 32430 * 32431 * _.at(object, ['a[0].b.c', 'a[1]']); 32432 * // => [3, 4] 32433 */ 32434 var at = flatRest(baseAt); 32435 32436 /** 32437 * Creates an object that inherits from the `prototype` object. If a 32438 * `properties` object is given, its own enumerable string keyed properties 32439 * are assigned to the created object. 32440 * 32441 * @static 32442 * @memberOf _ 32443 * @since 2.3.0 32444 * @category Object 32445 * @param {Object} prototype The object to inherit from. 32446 * @param {Object} [properties] The properties to assign to the object. 32447 * @returns {Object} Returns the new object. 32448 * @example 32449 * 32450 * function Shape() { 32451 * this.x = 0; 32452 * this.y = 0; 32453 * } 32454 * 32455 * function Circle() { 32456 * Shape.call(this); 32457 * } 32458 * 32459 * Circle.prototype = _.create(Shape.prototype, { 32460 * 'constructor': Circle 32461 * }); 32462 * 32463 * var circle = new Circle; 32464 * circle instanceof Circle; 32465 * // => true 32466 * 32467 * circle instanceof Shape; 32468 * // => true 32469 */ 32470 function create(prototype, properties) { 32471 var result = baseCreate(prototype); 32472 return properties == null ? result : baseAssign(result, properties); 32473 } 32474 32475 /** 32476 * Assigns own and inherited enumerable string keyed properties of source 32477 * objects to the destination object for all destination properties that 32478 * resolve to `undefined`. Source objects are applied from left to right. 32479 * Once a property is set, additional values of the same property are ignored. 32480 * 32481 * **Note:** This method mutates `object`. 32482 * 32483 * @static 32484 * @since 0.1.0 32485 * @memberOf _ 32486 * @category Object 32487 * @param {Object} object The destination object. 32488 * @param {...Object} [sources] The source objects. 32489 * @returns {Object} Returns `object`. 32490 * @see _.defaultsDeep 32491 * @example 32492 * 32493 * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 32494 * // => { 'a': 1, 'b': 2 } 32495 */ 32496 var defaults = baseRest(function(object, sources) { 32497 object = Object(object); 32498 32499 var index = -1; 32500 var length = sources.length; 32501 var guard = length > 2 ? sources[2] : undefined; 32502 32503 if (guard && isIterateeCall(sources[0], sources[1], guard)) { 32504 length = 1; 32505 } 32506 32507 while (++index < length) { 32508 var source = sources[index]; 32509 var props = keysIn(source); 32510 var propsIndex = -1; 32511 var propsLength = props.length; 32512 32513 while (++propsIndex < propsLength) { 32514 var key = props[propsIndex]; 32515 var value = object[key]; 32516 32517 if (value === undefined || 32518 (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { 32519 object[key] = source[key]; 32520 } 32521 } 32522 } 32523 32524 return object; 32525 }); 32526 32527 /** 32528 * This method is like `_.defaults` except that it recursively assigns 32529 * default properties. 32530 * 32531 * **Note:** This method mutates `object`. 32532 * 32533 * @static 32534 * @memberOf _ 32535 * @since 3.10.0 32536 * @category Object 32537 * @param {Object} object The destination object. 32538 * @param {...Object} [sources] The source objects. 32539 * @returns {Object} Returns `object`. 32540 * @see _.defaults 32541 * @example 32542 * 32543 * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); 32544 * // => { 'a': { 'b': 2, 'c': 3 } } 32545 */ 32546 var defaultsDeep = baseRest(function(args) { 32547 args.push(undefined, customDefaultsMerge); 32548 return apply(mergeWith, undefined, args); 32549 }); 32550 32551 /** 32552 * This method is like `_.find` except that it returns the key of the first 32553 * element `predicate` returns truthy for instead of the element itself. 32554 * 32555 * @static 32556 * @memberOf _ 32557 * @since 1.1.0 32558 * @category Object 32559 * @param {Object} object The object to inspect. 32560 * @param {Function} [predicate=_.identity] The function invoked per iteration. 32561 * @returns {string|undefined} Returns the key of the matched element, 32562 * else `undefined`. 32563 * @example 32564 * 32565 * var users = { 32566 * 'barney': { 'age': 36, 'active': true }, 32567 * 'fred': { 'age': 40, 'active': false }, 32568 * 'pebbles': { 'age': 1, 'active': true } 32569 * }; 32570 * 32571 * _.findKey(users, function(o) { return o.age < 40; }); 32572 * // => 'barney' (iteration order is not guaranteed) 32573 * 32574 * // The `_.matches` iteratee shorthand. 32575 * _.findKey(users, { 'age': 1, 'active': true }); 32576 * // => 'pebbles' 32577 * 32578 * // The `_.matchesProperty` iteratee shorthand. 32579 * _.findKey(users, ['active', false]); 32580 * // => 'fred' 32581 * 32582 * // The `_.property` iteratee shorthand. 32583 * _.findKey(users, 'active'); 32584 * // => 'barney' 32585 */ 32586 function findKey(object, predicate) { 32587 return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); 32588 } 32589 32590 /** 32591 * This method is like `_.findKey` except that it iterates over elements of 32592 * a collection in the opposite order. 32593 * 32594 * @static 32595 * @memberOf _ 32596 * @since 2.0.0 32597 * @category Object 32598 * @param {Object} object The object to inspect. 32599 * @param {Function} [predicate=_.identity] The function invoked per iteration. 32600 * @returns {string|undefined} Returns the key of the matched element, 32601 * else `undefined`. 32602 * @example 32603 * 32604 * var users = { 32605 * 'barney': { 'age': 36, 'active': true }, 32606 * 'fred': { 'age': 40, 'active': false }, 32607 * 'pebbles': { 'age': 1, 'active': true } 32608 * }; 32609 * 32610 * _.findLastKey(users, function(o) { return o.age < 40; }); 32611 * // => returns 'pebbles' assuming `_.findKey` returns 'barney' 32612 * 32613 * // The `_.matches` iteratee shorthand. 32614 * _.findLastKey(users, { 'age': 36, 'active': true }); 32615 * // => 'barney' 32616 * 32617 * // The `_.matchesProperty` iteratee shorthand. 32618 * _.findLastKey(users, ['active', false]); 32619 * // => 'fred' 32620 * 32621 * // The `_.property` iteratee shorthand. 32622 * _.findLastKey(users, 'active'); 32623 * // => 'pebbles' 32624 */ 32625 function findLastKey(object, predicate) { 32626 return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); 32627 } 32628 32629 /** 32630 * Iterates over own and inherited enumerable string keyed properties of an 32631 * object and invokes `iteratee` for each property. The iteratee is invoked 32632 * with three arguments: (value, key, object). Iteratee functions may exit 32633 * iteration early by explicitly returning `false`. 32634 * 32635 * @static 32636 * @memberOf _ 32637 * @since 0.3.0 32638 * @category Object 32639 * @param {Object} object The object to iterate over. 32640 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 32641 * @returns {Object} Returns `object`. 32642 * @see _.forInRight 32643 * @example 32644 * 32645 * function Foo() { 32646 * this.a = 1; 32647 * this.b = 2; 32648 * } 32649 * 32650 * Foo.prototype.c = 3; 32651 * 32652 * _.forIn(new Foo, function(value, key) { 32653 * console.log(key); 32654 * }); 32655 * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). 32656 */ 32657 function forIn(object, iteratee) { 32658 return object == null 32659 ? object 32660 : baseFor(object, getIteratee(iteratee, 3), keysIn); 32661 } 32662 32663 /** 32664 * This method is like `_.forIn` except that it iterates over properties of 32665 * `object` in the opposite order. 32666 * 32667 * @static 32668 * @memberOf _ 32669 * @since 2.0.0 32670 * @category Object 32671 * @param {Object} object The object to iterate over. 32672 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 32673 * @returns {Object} Returns `object`. 32674 * @see _.forIn 32675 * @example 32676 * 32677 * function Foo() { 32678 * this.a = 1; 32679 * this.b = 2; 32680 * } 32681 * 32682 * Foo.prototype.c = 3; 32683 * 32684 * _.forInRight(new Foo, function(value, key) { 32685 * console.log(key); 32686 * }); 32687 * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. 32688 */ 32689 function forInRight(object, iteratee) { 32690 return object == null 32691 ? object 32692 : baseForRight(object, getIteratee(iteratee, 3), keysIn); 32693 } 32694 32695 /** 32696 * Iterates over own enumerable string keyed properties of an object and 32697 * invokes `iteratee` for each property. The iteratee is invoked with three 32698 * arguments: (value, key, object). Iteratee functions may exit iteration 32699 * early by explicitly returning `false`. 32700 * 32701 * @static 32702 * @memberOf _ 32703 * @since 0.3.0 32704 * @category Object 32705 * @param {Object} object The object to iterate over. 32706 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 32707 * @returns {Object} Returns `object`. 32708 * @see _.forOwnRight 32709 * @example 32710 * 32711 * function Foo() { 32712 * this.a = 1; 32713 * this.b = 2; 32714 * } 32715 * 32716 * Foo.prototype.c = 3; 32717 * 32718 * _.forOwn(new Foo, function(value, key) { 32719 * console.log(key); 32720 * }); 32721 * // => Logs 'a' then 'b' (iteration order is not guaranteed). 32722 */ 32723 function forOwn(object, iteratee) { 32724 return object && baseForOwn(object, getIteratee(iteratee, 3)); 32725 } 32726 32727 /** 32728 * This method is like `_.forOwn` except that it iterates over properties of 32729 * `object` in the opposite order. 32730 * 32731 * @static 32732 * @memberOf _ 32733 * @since 2.0.0 32734 * @category Object 32735 * @param {Object} object The object to iterate over. 32736 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 32737 * @returns {Object} Returns `object`. 32738 * @see _.forOwn 32739 * @example 32740 * 32741 * function Foo() { 32742 * this.a = 1; 32743 * this.b = 2; 32744 * } 32745 * 32746 * Foo.prototype.c = 3; 32747 * 32748 * _.forOwnRight(new Foo, function(value, key) { 32749 * console.log(key); 32750 * }); 32751 * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. 32752 */ 32753 function forOwnRight(object, iteratee) { 32754 return object && baseForOwnRight(object, getIteratee(iteratee, 3)); 32755 } 32756 32757 /** 32758 * Creates an array of function property names from own enumerable properties 32759 * of `object`. 32760 * 32761 * @static 32762 * @since 0.1.0 32763 * @memberOf _ 32764 * @category Object 32765 * @param {Object} object The object to inspect. 32766 * @returns {Array} Returns the function names. 32767 * @see _.functionsIn 32768 * @example 32769 * 32770 * function Foo() { 32771 * this.a = _.constant('a'); 32772 * this.b = _.constant('b'); 32773 * } 32774 * 32775 * Foo.prototype.c = _.constant('c'); 32776 * 32777 * _.functions(new Foo); 32778 * // => ['a', 'b'] 32779 */ 32780 function functions(object) { 32781 return object == null ? [] : baseFunctions(object, keys(object)); 32782 } 32783 32784 /** 32785 * Creates an array of function property names from own and inherited 32786 * enumerable properties of `object`. 32787 * 32788 * @static 32789 * @memberOf _ 32790 * @since 4.0.0 32791 * @category Object 32792 * @param {Object} object The object to inspect. 32793 * @returns {Array} Returns the function names. 32794 * @see _.functions 32795 * @example 32796 * 32797 * function Foo() { 32798 * this.a = _.constant('a'); 32799 * this.b = _.constant('b'); 32800 * } 32801 * 32802 * Foo.prototype.c = _.constant('c'); 32803 * 32804 * _.functionsIn(new Foo); 32805 * // => ['a', 'b', 'c'] 32806 */ 32807 function functionsIn(object) { 32808 return object == null ? [] : baseFunctions(object, keysIn(object)); 32809 } 32810 32811 /** 32812 * Gets the value at `path` of `object`. If the resolved value is 32813 * `undefined`, the `defaultValue` is returned in its place. 32814 * 32815 * @static 32816 * @memberOf _ 32817 * @since 3.7.0 32818 * @category Object 32819 * @param {Object} object The object to query. 32820 * @param {Array|string} path The path of the property to get. 32821 * @param {*} [defaultValue] The value returned for `undefined` resolved values. 32822 * @returns {*} Returns the resolved value. 32823 * @example 32824 * 32825 * var object = { 'a': [{ 'b': { 'c': 3 } }] }; 32826 * 32827 * _.get(object, 'a[0].b.c'); 32828 * // => 3 32829 * 32830 * _.get(object, ['a', '0', 'b', 'c']); 32831 * // => 3 32832 * 32833 * _.get(object, 'a.b.c', 'default'); 32834 * // => 'default' 32835 */ 32836 function get(object, path, defaultValue) { 32837 var result = object == null ? undefined : baseGet(object, path); 32838 return result === undefined ? defaultValue : result; 32839 } 32840 32841 /** 32842 * Checks if `path` is a direct property of `object`. 32843 * 32844 * @static 32845 * @since 0.1.0 32846 * @memberOf _ 32847 * @category Object 32848 * @param {Object} object The object to query. 32849 * @param {Array|string} path The path to check. 32850 * @returns {boolean} Returns `true` if `path` exists, else `false`. 32851 * @example 32852 * 32853 * var object = { 'a': { 'b': 2 } }; 32854 * var other = _.create({ 'a': _.create({ 'b': 2 }) }); 32855 * 32856 * _.has(object, 'a'); 32857 * // => true 32858 * 32859 * _.has(object, 'a.b'); 32860 * // => true 32861 * 32862 * _.has(object, ['a', 'b']); 32863 * // => true 32864 * 32865 * _.has(other, 'a'); 32866 * // => false 32867 */ 32868 function has(object, path) { 32869 return object != null && hasPath(object, path, baseHas); 32870 } 32871 32872 /** 32873 * Checks if `path` is a direct or inherited property of `object`. 32874 * 32875 * @static 32876 * @memberOf _ 32877 * @since 4.0.0 32878 * @category Object 32879 * @param {Object} object The object to query. 32880 * @param {Array|string} path The path to check. 32881 * @returns {boolean} Returns `true` if `path` exists, else `false`. 32882 * @example 32883 * 32884 * var object = _.create({ 'a': _.create({ 'b': 2 }) }); 32885 * 32886 * _.hasIn(object, 'a'); 32887 * // => true 32888 * 32889 * _.hasIn(object, 'a.b'); 32890 * // => true 32891 * 32892 * _.hasIn(object, ['a', 'b']); 32893 * // => true 32894 * 32895 * _.hasIn(object, 'b'); 32896 * // => false 32897 */ 32898 function hasIn(object, path) { 32899 return object != null && hasPath(object, path, baseHasIn); 32900 } 32901 32902 /** 32903 * Creates an object composed of the inverted keys and values of `object`. 32904 * If `object` contains duplicate values, subsequent values overwrite 32905 * property assignments of previous values. 32906 * 32907 * @static 32908 * @memberOf _ 32909 * @since 0.7.0 32910 * @category Object 32911 * @param {Object} object The object to invert. 32912 * @returns {Object} Returns the new inverted object. 32913 * @example 32914 * 32915 * var object = { 'a': 1, 'b': 2, 'c': 1 }; 32916 * 32917 * _.invert(object); 32918 * // => { '1': 'c', '2': 'b' } 32919 */ 32920 var invert = createInverter(function(result, value, key) { 32921 if (value != null && 32922 typeof value.toString != 'function') { 32923 value = nativeObjectToString.call(value); 32924 } 32925 32926 result[value] = key; 32927 }, constant(identity)); 32928 32929 /** 32930 * This method is like `_.invert` except that the inverted object is generated 32931 * from the results of running each element of `object` thru `iteratee`. The 32932 * corresponding inverted value of each inverted key is an array of keys 32933 * responsible for generating the inverted value. The iteratee is invoked 32934 * with one argument: (value). 32935 * 32936 * @static 32937 * @memberOf _ 32938 * @since 4.1.0 32939 * @category Object 32940 * @param {Object} object The object to invert. 32941 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 32942 * @returns {Object} Returns the new inverted object. 32943 * @example 32944 * 32945 * var object = { 'a': 1, 'b': 2, 'c': 1 }; 32946 * 32947 * _.invertBy(object); 32948 * // => { '1': ['a', 'c'], '2': ['b'] } 32949 * 32950 * _.invertBy(object, function(value) { 32951 * return 'group' + value; 32952 * }); 32953 * // => { 'group1': ['a', 'c'], 'group2': ['b'] } 32954 */ 32955 var invertBy = createInverter(function(result, value, key) { 32956 if (value != null && 32957 typeof value.toString != 'function') { 32958 value = nativeObjectToString.call(value); 32959 } 32960 32961 if (hasOwnProperty.call(result, value)) { 32962 result[value].push(key); 32963 } else { 32964 result[value] = [key]; 32965 } 32966 }, getIteratee); 32967 32968 /** 32969 * Invokes the method at `path` of `object`. 32970 * 32971 * @static 32972 * @memberOf _ 32973 * @since 4.0.0 32974 * @category Object 32975 * @param {Object} object The object to query. 32976 * @param {Array|string} path The path of the method to invoke. 32977 * @param {...*} [args] The arguments to invoke the method with. 32978 * @returns {*} Returns the result of the invoked method. 32979 * @example 32980 * 32981 * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; 32982 * 32983 * _.invoke(object, 'a[0].b.c.slice', 1, 3); 32984 * // => [2, 3] 32985 */ 32986 var invoke = baseRest(baseInvoke); 32987 32988 /** 32989 * Creates an array of the own enumerable property names of `object`. 32990 * 32991 * **Note:** Non-object values are coerced to objects. See the 32992 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) 32993 * for more details. 32994 * 32995 * @static 32996 * @since 0.1.0 32997 * @memberOf _ 32998 * @category Object 32999 * @param {Object} object The object to query. 33000 * @returns {Array} Returns the array of property names. 33001 * @example 33002 * 33003 * function Foo() { 33004 * this.a = 1; 33005 * this.b = 2; 33006 * } 33007 * 33008 * Foo.prototype.c = 3; 33009 * 33010 * _.keys(new Foo); 33011 * // => ['a', 'b'] (iteration order is not guaranteed) 33012 * 33013 * _.keys('hi'); 33014 * // => ['0', '1'] 33015 */ 33016 function keys(object) { 33017 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); 33018 } 33019 33020 /** 33021 * Creates an array of the own and inherited enumerable property names of `object`. 33022 * 33023 * **Note:** Non-object values are coerced to objects. 33024 * 33025 * @static 33026 * @memberOf _ 33027 * @since 3.0.0 33028 * @category Object 33029 * @param {Object} object The object to query. 33030 * @returns {Array} Returns the array of property names. 33031 * @example 33032 * 33033 * function Foo() { 33034 * this.a = 1; 33035 * this.b = 2; 33036 * } 33037 * 33038 * Foo.prototype.c = 3; 33039 * 33040 * _.keysIn(new Foo); 33041 * // => ['a', 'b', 'c'] (iteration order is not guaranteed) 33042 */ 33043 function keysIn(object) { 33044 return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); 33045 } 33046 33047 /** 33048 * The opposite of `_.mapValues`; this method creates an object with the 33049 * same values as `object` and keys generated by running each own enumerable 33050 * string keyed property of `object` thru `iteratee`. The iteratee is invoked 33051 * with three arguments: (value, key, object). 33052 * 33053 * @static 33054 * @memberOf _ 33055 * @since 3.8.0 33056 * @category Object 33057 * @param {Object} object The object to iterate over. 33058 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 33059 * @returns {Object} Returns the new mapped object. 33060 * @see _.mapValues 33061 * @example 33062 * 33063 * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { 33064 * return key + value; 33065 * }); 33066 * // => { 'a1': 1, 'b2': 2 } 33067 */ 33068 function mapKeys(object, iteratee) { 33069 var result = {}; 33070 iteratee = getIteratee(iteratee, 3); 33071 33072 baseForOwn(object, function(value, key, object) { 33073 baseAssignValue(result, iteratee(value, key, object), value); 33074 }); 33075 return result; 33076 } 33077 33078 /** 33079 * Creates an object with the same keys as `object` and values generated 33080 * by running each own enumerable string keyed property of `object` thru 33081 * `iteratee`. The iteratee is invoked with three arguments: 33082 * (value, key, object). 33083 * 33084 * @static 33085 * @memberOf _ 33086 * @since 2.4.0 33087 * @category Object 33088 * @param {Object} object The object to iterate over. 33089 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 33090 * @returns {Object} Returns the new mapped object. 33091 * @see _.mapKeys 33092 * @example 33093 * 33094 * var users = { 33095 * 'fred': { 'user': 'fred', 'age': 40 }, 33096 * 'pebbles': { 'user': 'pebbles', 'age': 1 } 33097 * }; 33098 * 33099 * _.mapValues(users, function(o) { return o.age; }); 33100 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) 33101 * 33102 * // The `_.property` iteratee shorthand. 33103 * _.mapValues(users, 'age'); 33104 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) 33105 */ 33106 function mapValues(object, iteratee) { 33107 var result = {}; 33108 iteratee = getIteratee(iteratee, 3); 33109 33110 baseForOwn(object, function(value, key, object) { 33111 baseAssignValue(result, key, iteratee(value, key, object)); 33112 }); 33113 return result; 33114 } 33115 33116 /** 33117 * This method is like `_.assign` except that it recursively merges own and 33118 * inherited enumerable string keyed properties of source objects into the 33119 * destination object. Source properties that resolve to `undefined` are 33120 * skipped if a destination value exists. Array and plain object properties 33121 * are merged recursively. Other objects and value types are overridden by 33122 * assignment. Source objects are applied from left to right. Subsequent 33123 * sources overwrite property assignments of previous sources. 33124 * 33125 * **Note:** This method mutates `object`. 33126 * 33127 * @static 33128 * @memberOf _ 33129 * @since 0.5.0 33130 * @category Object 33131 * @param {Object} object The destination object. 33132 * @param {...Object} [sources] The source objects. 33133 * @returns {Object} Returns `object`. 33134 * @example 33135 * 33136 * var object = { 33137 * 'a': [{ 'b': 2 }, { 'd': 4 }] 33138 * }; 33139 * 33140 * var other = { 33141 * 'a': [{ 'c': 3 }, { 'e': 5 }] 33142 * }; 33143 * 33144 * _.merge(object, other); 33145 * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } 33146 */ 33147 var merge = createAssigner(function(object, source, srcIndex) { 33148 baseMerge(object, source, srcIndex); 33149 }); 33150 33151 /** 33152 * This method is like `_.merge` except that it accepts `customizer` which 33153 * is invoked to produce the merged values of the destination and source 33154 * properties. If `customizer` returns `undefined`, merging is handled by the 33155 * method instead. The `customizer` is invoked with six arguments: 33156 * (objValue, srcValue, key, object, source, stack). 33157 * 33158 * **Note:** This method mutates `object`. 33159 * 33160 * @static 33161 * @memberOf _ 33162 * @since 4.0.0 33163 * @category Object 33164 * @param {Object} object The destination object. 33165 * @param {...Object} sources The source objects. 33166 * @param {Function} customizer The function to customize assigned values. 33167 * @returns {Object} Returns `object`. 33168 * @example 33169 * 33170 * function customizer(objValue, srcValue) { 33171 * if (_.isArray(objValue)) { 33172 * return objValue.concat(srcValue); 33173 * } 33174 * } 33175 * 33176 * var object = { 'a': [1], 'b': [2] }; 33177 * var other = { 'a': [3], 'b': [4] }; 33178 * 33179 * _.mergeWith(object, other, customizer); 33180 * // => { 'a': [1, 3], 'b': [2, 4] } 33181 */ 33182 var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { 33183 baseMerge(object, source, srcIndex, customizer); 33184 }); 33185 33186 /** 33187 * The opposite of `_.pick`; this method creates an object composed of the 33188 * own and inherited enumerable property paths of `object` that are not omitted. 33189 * 33190 * **Note:** This method is considerably slower than `_.pick`. 33191 * 33192 * @static 33193 * @since 0.1.0 33194 * @memberOf _ 33195 * @category Object 33196 * @param {Object} object The source object. 33197 * @param {...(string|string[])} [paths] The property paths to omit. 33198 * @returns {Object} Returns the new object. 33199 * @example 33200 * 33201 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 33202 * 33203 * _.omit(object, ['a', 'c']); 33204 * // => { 'b': '2' } 33205 */ 33206 var omit = flatRest(function(object, paths) { 33207 var result = {}; 33208 if (object == null) { 33209 return result; 33210 } 33211 var isDeep = false; 33212 paths = arrayMap(paths, function(path) { 33213 path = castPath(path, object); 33214 isDeep || (isDeep = path.length > 1); 33215 return path; 33216 }); 33217 copyObject(object, getAllKeysIn(object), result); 33218 if (isDeep) { 33219 result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); 33220 } 33221 var length = paths.length; 33222 while (length--) { 33223 baseUnset(result, paths[length]); 33224 } 33225 return result; 33226 }); 33227 33228 /** 33229 * The opposite of `_.pickBy`; this method creates an object composed of 33230 * the own and inherited enumerable string keyed properties of `object` that 33231 * `predicate` doesn't return truthy for. The predicate is invoked with two 33232 * arguments: (value, key). 33233 * 33234 * @static 33235 * @memberOf _ 33236 * @since 4.0.0 33237 * @category Object 33238 * @param {Object} object The source object. 33239 * @param {Function} [predicate=_.identity] The function invoked per property. 33240 * @returns {Object} Returns the new object. 33241 * @example 33242 * 33243 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 33244 * 33245 * _.omitBy(object, _.isNumber); 33246 * // => { 'b': '2' } 33247 */ 33248 function omitBy(object, predicate) { 33249 return pickBy(object, negate(getIteratee(predicate))); 33250 } 33251 33252 /** 33253 * Creates an object composed of the picked `object` properties. 33254 * 33255 * @static 33256 * @since 0.1.0 33257 * @memberOf _ 33258 * @category Object 33259 * @param {Object} object The source object. 33260 * @param {...(string|string[])} [paths] The property paths to pick. 33261 * @returns {Object} Returns the new object. 33262 * @example 33263 * 33264 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 33265 * 33266 * _.pick(object, ['a', 'c']); 33267 * // => { 'a': 1, 'c': 3 } 33268 */ 33269 var pick = flatRest(function(object, paths) { 33270 return object == null ? {} : basePick(object, paths); 33271 }); 33272 33273 /** 33274 * Creates an object composed of the `object` properties `predicate` returns 33275 * truthy for. The predicate is invoked with two arguments: (value, key). 33276 * 33277 * @static 33278 * @memberOf _ 33279 * @since 4.0.0 33280 * @category Object 33281 * @param {Object} object The source object. 33282 * @param {Function} [predicate=_.identity] The function invoked per property. 33283 * @returns {Object} Returns the new object. 33284 * @example 33285 * 33286 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 33287 * 33288 * _.pickBy(object, _.isNumber); 33289 * // => { 'a': 1, 'c': 3 } 33290 */ 33291 function pickBy(object, predicate) { 33292 if (object == null) { 33293 return {}; 33294 } 33295 var props = arrayMap(getAllKeysIn(object), function(prop) { 33296 return [prop]; 33297 }); 33298 predicate = getIteratee(predicate); 33299 return basePickBy(object, props, function(value, path) { 33300 return predicate(value, path[0]); 33301 }); 33302 } 33303 33304 /** 33305 * This method is like `_.get` except that if the resolved value is a 33306 * function it's invoked with the `this` binding of its parent object and 33307 * its result is returned. 33308 * 33309 * @static 33310 * @since 0.1.0 33311 * @memberOf _ 33312 * @category Object 33313 * @param {Object} object The object to query. 33314 * @param {Array|string} path The path of the property to resolve. 33315 * @param {*} [defaultValue] The value returned for `undefined` resolved values. 33316 * @returns {*} Returns the resolved value. 33317 * @example 33318 * 33319 * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; 33320 * 33321 * _.result(object, 'a[0].b.c1'); 33322 * // => 3 33323 * 33324 * _.result(object, 'a[0].b.c2'); 33325 * // => 4 33326 * 33327 * _.result(object, 'a[0].b.c3', 'default'); 33328 * // => 'default' 33329 * 33330 * _.result(object, 'a[0].b.c3', _.constant('default')); 33331 * // => 'default' 33332 */ 33333 function result(object, path, defaultValue) { 33334 path = castPath(path, object); 33335 33336 var index = -1, 33337 length = path.length; 33338 33339 // Ensure the loop is entered when path is empty. 33340 if (!length) { 33341 length = 1; 33342 object = undefined; 33343 } 33344 while (++index < length) { 33345 var value = object == null ? undefined : object[toKey(path[index])]; 33346 if (value === undefined) { 33347 index = length; 33348 value = defaultValue; 33349 } 33350 object = isFunction(value) ? value.call(object) : value; 33351 } 33352 return object; 33353 } 33354 33355 /** 33356 * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, 33357 * it's created. Arrays are created for missing index properties while objects 33358 * are created for all other missing properties. Use `_.setWith` to customize 33359 * `path` creation. 33360 * 33361 * **Note:** This method mutates `object`. 33362 * 33363 * @static 33364 * @memberOf _ 33365 * @since 3.7.0 33366 * @category Object 33367 * @param {Object} object The object to modify. 33368 * @param {Array|string} path The path of the property to set. 33369 * @param {*} value The value to set. 33370 * @returns {Object} Returns `object`. 33371 * @example 33372 * 33373 * var object = { 'a': [{ 'b': { 'c': 3 } }] }; 33374 * 33375 * _.set(object, 'a[0].b.c', 4); 33376 * console.log(object.a[0].b.c); 33377 * // => 4 33378 * 33379 * _.set(object, ['x', '0', 'y', 'z'], 5); 33380 * console.log(object.x[0].y.z); 33381 * // => 5 33382 */ 33383 function set(object, path, value) { 33384 return object == null ? object : baseSet(object, path, value); 33385 } 33386 33387 /** 33388 * This method is like `_.set` except that it accepts `customizer` which is 33389 * invoked to produce the objects of `path`. If `customizer` returns `undefined` 33390 * path creation is handled by the method instead. The `customizer` is invoked 33391 * with three arguments: (nsValue, key, nsObject). 33392 * 33393 * **Note:** This method mutates `object`. 33394 * 33395 * @static 33396 * @memberOf _ 33397 * @since 4.0.0 33398 * @category Object 33399 * @param {Object} object The object to modify. 33400 * @param {Array|string} path The path of the property to set. 33401 * @param {*} value The value to set. 33402 * @param {Function} [customizer] The function to customize assigned values. 33403 * @returns {Object} Returns `object`. 33404 * @example 33405 * 33406 * var object = {}; 33407 * 33408 * _.setWith(object, '[0][1]', 'a', Object); 33409 * // => { '0': { '1': 'a' } } 33410 */ 33411 function setWith(object, path, value, customizer) { 33412 customizer = typeof customizer == 'function' ? customizer : undefined; 33413 return object == null ? object : baseSet(object, path, value, customizer); 33414 } 33415 33416 /** 33417 * Creates an array of own enumerable string keyed-value pairs for `object` 33418 * which can be consumed by `_.fromPairs`. If `object` is a map or set, its 33419 * entries are returned. 33420 * 33421 * @static 33422 * @memberOf _ 33423 * @since 4.0.0 33424 * @alias entries 33425 * @category Object 33426 * @param {Object} object The object to query. 33427 * @returns {Array} Returns the key-value pairs. 33428 * @example 33429 * 33430 * function Foo() { 33431 * this.a = 1; 33432 * this.b = 2; 33433 * } 33434 * 33435 * Foo.prototype.c = 3; 33436 * 33437 * _.toPairs(new Foo); 33438 * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) 33439 */ 33440 var toPairs = createToPairs(keys); 33441 33442 /** 33443 * Creates an array of own and inherited enumerable string keyed-value pairs 33444 * for `object` which can be consumed by `_.fromPairs`. If `object` is a map 33445 * or set, its entries are returned. 33446 * 33447 * @static 33448 * @memberOf _ 33449 * @since 4.0.0 33450 * @alias entriesIn 33451 * @category Object 33452 * @param {Object} object The object to query. 33453 * @returns {Array} Returns the key-value pairs. 33454 * @example 33455 * 33456 * function Foo() { 33457 * this.a = 1; 33458 * this.b = 2; 33459 * } 33460 * 33461 * Foo.prototype.c = 3; 33462 * 33463 * _.toPairsIn(new Foo); 33464 * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed) 33465 */ 33466 var toPairsIn = createToPairs(keysIn); 33467 33468 /** 33469 * An alternative to `_.reduce`; this method transforms `object` to a new 33470 * `accumulator` object which is the result of running each of its own 33471 * enumerable string keyed properties thru `iteratee`, with each invocation 33472 * potentially mutating the `accumulator` object. If `accumulator` is not 33473 * provided, a new object with the same `[[Prototype]]` will be used. The 33474 * iteratee is invoked with four arguments: (accumulator, value, key, object). 33475 * Iteratee functions may exit iteration early by explicitly returning `false`. 33476 * 33477 * @static 33478 * @memberOf _ 33479 * @since 1.3.0 33480 * @category Object 33481 * @param {Object} object The object to iterate over. 33482 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 33483 * @param {*} [accumulator] The custom accumulator value. 33484 * @returns {*} Returns the accumulated value. 33485 * @example 33486 * 33487 * _.transform([2, 3, 4], function(result, n) { 33488 * result.push(n *= n); 33489 * return n % 2 == 0; 33490 * }, []); 33491 * // => [4, 9] 33492 * 33493 * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { 33494 * (result[value] || (result[value] = [])).push(key); 33495 * }, {}); 33496 * // => { '1': ['a', 'c'], '2': ['b'] } 33497 */ 33498 function transform(object, iteratee, accumulator) { 33499 var isArr = isArray(object), 33500 isArrLike = isArr || isBuffer(object) || isTypedArray(object); 33501 33502 iteratee = getIteratee(iteratee, 4); 33503 if (accumulator == null) { 33504 var Ctor = object && object.constructor; 33505 if (isArrLike) { 33506 accumulator = isArr ? new Ctor : []; 33507 } 33508 else if (isObject(object)) { 33509 accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; 33510 } 33511 else { 33512 accumulator = {}; 33513 } 33514 } 33515 (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) { 33516 return iteratee(accumulator, value, index, object); 33517 }); 33518 return accumulator; 33519 } 33520 33521 /** 33522 * Removes the property at `path` of `object`. 33523 * 33524 * **Note:** This method mutates `object`. 33525 * 33526 * @static 33527 * @memberOf _ 33528 * @since 4.0.0 33529 * @category Object 33530 * @param {Object} object The object to modify. 33531 * @param {Array|string} path The path of the property to unset. 33532 * @returns {boolean} Returns `true` if the property is deleted, else `false`. 33533 * @example 33534 * 33535 * var object = { 'a': [{ 'b': { 'c': 7 } }] }; 33536 * _.unset(object, 'a[0].b.c'); 33537 * // => true 33538 * 33539 * console.log(object); 33540 * // => { 'a': [{ 'b': {} }] }; 33541 * 33542 * _.unset(object, ['a', '0', 'b', 'c']); 33543 * // => true 33544 * 33545 * console.log(object); 33546 * // => { 'a': [{ 'b': {} }] }; 33547 */ 33548 function unset(object, path) { 33549 return object == null ? true : baseUnset(object, path); 33550 } 33551 33552 /** 33553 * This method is like `_.set` except that accepts `updater` to produce the 33554 * value to set. Use `_.updateWith` to customize `path` creation. The `updater` 33555 * is invoked with one argument: (value). 33556 * 33557 * **Note:** This method mutates `object`. 33558 * 33559 * @static 33560 * @memberOf _ 33561 * @since 4.6.0 33562 * @category Object 33563 * @param {Object} object The object to modify. 33564 * @param {Array|string} path The path of the property to set. 33565 * @param {Function} updater The function to produce the updated value. 33566 * @returns {Object} Returns `object`. 33567 * @example 33568 * 33569 * var object = { 'a': [{ 'b': { 'c': 3 } }] }; 33570 * 33571 * _.update(object, 'a[0].b.c', function(n) { return n * n; }); 33572 * console.log(object.a[0].b.c); 33573 * // => 9 33574 * 33575 * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); 33576 * console.log(object.x[0].y.z); 33577 * // => 0 33578 */ 33579 function update(object, path, updater) { 33580 return object == null ? object : baseUpdate(object, path, castFunction(updater)); 33581 } 33582 33583 /** 33584 * This method is like `_.update` except that it accepts `customizer` which is 33585 * invoked to produce the objects of `path`. If `customizer` returns `undefined` 33586 * path creation is handled by the method instead. The `customizer` is invoked 33587 * with three arguments: (nsValue, key, nsObject). 33588 * 33589 * **Note:** This method mutates `object`. 33590 * 33591 * @static 33592 * @memberOf _ 33593 * @since 4.6.0 33594 * @category Object 33595 * @param {Object} object The object to modify. 33596 * @param {Array|string} path The path of the property to set. 33597 * @param {Function} updater The function to produce the updated value. 33598 * @param {Function} [customizer] The function to customize assigned values. 33599 * @returns {Object} Returns `object`. 33600 * @example 33601 * 33602 * var object = {}; 33603 * 33604 * _.updateWith(object, '[0][1]', _.constant('a'), Object); 33605 * // => { '0': { '1': 'a' } } 33606 */ 33607 function updateWith(object, path, updater, customizer) { 33608 customizer = typeof customizer == 'function' ? customizer : undefined; 33609 return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); 33610 } 33611 33612 /** 33613 * Creates an array of the own enumerable string keyed property values of `object`. 33614 * 33615 * **Note:** Non-object values are coerced to objects. 33616 * 33617 * @static 33618 * @since 0.1.0 33619 * @memberOf _ 33620 * @category Object 33621 * @param {Object} object The object to query. 33622 * @returns {Array} Returns the array of property values. 33623 * @example 33624 * 33625 * function Foo() { 33626 * this.a = 1; 33627 * this.b = 2; 33628 * } 33629 * 33630 * Foo.prototype.c = 3; 33631 * 33632 * _.values(new Foo); 33633 * // => [1, 2] (iteration order is not guaranteed) 33634 * 33635 * _.values('hi'); 33636 * // => ['h', 'i'] 33637 */ 33638 function values(object) { 33639 return object == null ? [] : baseValues(object, keys(object)); 33640 } 33641 33642 /** 33643 * Creates an array of the own and inherited enumerable string keyed property 33644 * values of `object`. 33645 * 33646 * **Note:** Non-object values are coerced to objects. 33647 * 33648 * @static 33649 * @memberOf _ 33650 * @since 3.0.0 33651 * @category Object 33652 * @param {Object} object The object to query. 33653 * @returns {Array} Returns the array of property values. 33654 * @example 33655 * 33656 * function Foo() { 33657 * this.a = 1; 33658 * this.b = 2; 33659 * } 33660 * 33661 * Foo.prototype.c = 3; 33662 * 33663 * _.valuesIn(new Foo); 33664 * // => [1, 2, 3] (iteration order is not guaranteed) 33665 */ 33666 function valuesIn(object) { 33667 return object == null ? [] : baseValues(object, keysIn(object)); 33668 } 33669 33670 /*------------------------------------------------------------------------*/ 33671 33672 /** 33673 * Clamps `number` within the inclusive `lower` and `upper` bounds. 33674 * 33675 * @static 33676 * @memberOf _ 33677 * @since 4.0.0 33678 * @category Number 33679 * @param {number} number The number to clamp. 33680 * @param {number} [lower] The lower bound. 33681 * @param {number} upper The upper bound. 33682 * @returns {number} Returns the clamped number. 33683 * @example 33684 * 33685 * _.clamp(-10, -5, 5); 33686 * // => -5 33687 * 33688 * _.clamp(10, -5, 5); 33689 * // => 5 33690 */ 33691 function clamp(number, lower, upper) { 33692 if (upper === undefined) { 33693 upper = lower; 33694 lower = undefined; 33695 } 33696 if (upper !== undefined) { 33697 upper = toNumber(upper); 33698 upper = upper === upper ? upper : 0; 33699 } 33700 if (lower !== undefined) { 33701 lower = toNumber(lower); 33702 lower = lower === lower ? lower : 0; 33703 } 33704 return baseClamp(toNumber(number), lower, upper); 33705 } 33706 33707 /** 33708 * Checks if `n` is between `start` and up to, but not including, `end`. If 33709 * `end` is not specified, it's set to `start` with `start` then set to `0`. 33710 * If `start` is greater than `end` the params are swapped to support 33711 * negative ranges. 33712 * 33713 * @static 33714 * @memberOf _ 33715 * @since 3.3.0 33716 * @category Number 33717 * @param {number} number The number to check. 33718 * @param {number} [start=0] The start of the range. 33719 * @param {number} end The end of the range. 33720 * @returns {boolean} Returns `true` if `number` is in the range, else `false`. 33721 * @see _.range, _.rangeRight 33722 * @example 33723 * 33724 * _.inRange(3, 2, 4); 33725 * // => true 33726 * 33727 * _.inRange(4, 8); 33728 * // => true 33729 * 33730 * _.inRange(4, 2); 33731 * // => false 33732 * 33733 * _.inRange(2, 2); 33734 * // => false 33735 * 33736 * _.inRange(1.2, 2); 33737 * // => true 33738 * 33739 * _.inRange(5.2, 4); 33740 * // => false 33741 * 33742 * _.inRange(-3, -2, -6); 33743 * // => true 33744 */ 33745 function inRange(number, start, end) { 33746 start = toFinite(start); 33747 if (end === undefined) { 33748 end = start; 33749 start = 0; 33750 } else { 33751 end = toFinite(end); 33752 } 33753 number = toNumber(number); 33754 return baseInRange(number, start, end); 33755 } 33756 33757 /** 33758 * Produces a random number between the inclusive `lower` and `upper` bounds. 33759 * If only one argument is provided a number between `0` and the given number 33760 * is returned. If `floating` is `true`, or either `lower` or `upper` are 33761 * floats, a floating-point number is returned instead of an integer. 33762 * 33763 * **Note:** JavaScript follows the IEEE-754 standard for resolving 33764 * floating-point values which can produce unexpected results. 33765 * 33766 * @static 33767 * @memberOf _ 33768 * @since 0.7.0 33769 * @category Number 33770 * @param {number} [lower=0] The lower bound. 33771 * @param {number} [upper=1] The upper bound. 33772 * @param {boolean} [floating] Specify returning a floating-point number. 33773 * @returns {number} Returns the random number. 33774 * @example 33775 * 33776 * _.random(0, 5); 33777 * // => an integer between 0 and 5 33778 * 33779 * _.random(5); 33780 * // => also an integer between 0 and 5 33781 * 33782 * _.random(5, true); 33783 * // => a floating-point number between 0 and 5 33784 * 33785 * _.random(1.2, 5.2); 33786 * // => a floating-point number between 1.2 and 5.2 33787 */ 33788 function random(lower, upper, floating) { 33789 if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { 33790 upper = floating = undefined; 33791 } 33792 if (floating === undefined) { 33793 if (typeof upper == 'boolean') { 33794 floating = upper; 33795 upper = undefined; 33796 } 33797 else if (typeof lower == 'boolean') { 33798 floating = lower; 33799 lower = undefined; 33800 } 33801 } 33802 if (lower === undefined && upper === undefined) { 33803 lower = 0; 33804 upper = 1; 33805 } 33806 else { 33807 lower = toFinite(lower); 33808 if (upper === undefined) { 33809 upper = lower; 33810 lower = 0; 33811 } else { 33812 upper = toFinite(upper); 33813 } 33814 } 33815 if (lower > upper) { 33816 var temp = lower; 33817 lower = upper; 33818 upper = temp; 33819 } 33820 if (floating || lower % 1 || upper % 1) { 33821 var rand = nativeRandom(); 33822 return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); 33823 } 33824 return baseRandom(lower, upper); 33825 } 33826 33827 /*------------------------------------------------------------------------*/ 33828 33829 /** 33830 * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). 33831 * 33832 * @static 33833 * @memberOf _ 33834 * @since 3.0.0 33835 * @category String 33836 * @param {string} [string=''] The string to convert. 33837 * @returns {string} Returns the camel cased string. 33838 * @example 33839 * 33840 * _.camelCase('Foo Bar'); 33841 * // => 'fooBar' 33842 * 33843 * _.camelCase('--foo-bar--'); 33844 * // => 'fooBar' 33845 * 33846 * _.camelCase('__FOO_BAR__'); 33847 * // => 'fooBar' 33848 */ 33849 var camelCase = createCompounder(function(result, word, index) { 33850 word = word.toLowerCase(); 33851 return result + (index ? capitalize(word) : word); 33852 }); 33853 33854 /** 33855 * Converts the first character of `string` to upper case and the remaining 33856 * to lower case. 33857 * 33858 * @static 33859 * @memberOf _ 33860 * @since 3.0.0 33861 * @category String 33862 * @param {string} [string=''] The string to capitalize. 33863 * @returns {string} Returns the capitalized string. 33864 * @example 33865 * 33866 * _.capitalize('FRED'); 33867 * // => 'Fred' 33868 */ 33869 function capitalize(string) { 33870 return upperFirst(toString(string).toLowerCase()); 33871 } 33872 33873 /** 33874 * Deburrs `string` by converting 33875 * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) 33876 * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) 33877 * letters to basic Latin letters and removing 33878 * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). 33879 * 33880 * @static 33881 * @memberOf _ 33882 * @since 3.0.0 33883 * @category String 33884 * @param {string} [string=''] The string to deburr. 33885 * @returns {string} Returns the deburred string. 33886 * @example 33887 * 33888 * _.deburr('déjàvu'); 33889 * // => 'deja vu' 33890 */ 33891 function deburr(string) { 33892 string = toString(string); 33893 return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); 33894 } 33895 33896 /** 33897 * Checks if `string` ends with the given target string. 33898 * 33899 * @static 33900 * @memberOf _ 33901 * @since 3.0.0 33902 * @category String 33903 * @param {string} [string=''] The string to inspect. 33904 * @param {string} [target] The string to search for. 33905 * @param {number} [position=string.length] The position to search up to. 33906 * @returns {boolean} Returns `true` if `string` ends with `target`, 33907 * else `false`. 33908 * @example 33909 * 33910 * _.endsWith('abc', 'c'); 33911 * // => true 33912 * 33913 * _.endsWith('abc', 'b'); 33914 * // => false 33915 * 33916 * _.endsWith('abc', 'b', 2); 33917 * // => true 33918 */ 33919 function endsWith(string, target, position) { 33920 string = toString(string); 33921 target = baseToString(target); 33922 33923 var length = string.length; 33924 position = position === undefined 33925 ? length 33926 : baseClamp(toInteger(position), 0, length); 33927 33928 var end = position; 33929 position -= target.length; 33930 return position >= 0 && string.slice(position, end) == target; 33931 } 33932 33933 /** 33934 * Converts the characters "&", "<", ">", '"', and "'" in `string` to their 33935 * corresponding HTML entities. 33936 * 33937 * **Note:** No other characters are escaped. To escape additional 33938 * characters use a third-party library like [_he_](https://mths.be/he). 33939 * 33940 * Though the ">" character is escaped for symmetry, characters like 33941 * ">" and "/" don't need escaping in HTML and have no special meaning 33942 * unless they're part of a tag or unquoted attribute value. See 33943 * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) 33944 * (under "semi-related fun fact") for more details. 33945 * 33946 * When working with HTML you should always 33947 * [quote attribute values](http://wonko.com/post/html-escaping) to reduce 33948 * XSS vectors. 33949 * 33950 * @static 33951 * @since 0.1.0 33952 * @memberOf _ 33953 * @category String 33954 * @param {string} [string=''] The string to escape. 33955 * @returns {string} Returns the escaped string. 33956 * @example 33957 * 33958 * _.escape('fred, barney, & pebbles'); 33959 * // => 'fred, barney, & pebbles' 33960 */ 33961 function escape(string) { 33962 string = toString(string); 33963 return (string && reHasUnescapedHtml.test(string)) 33964 ? string.replace(reUnescapedHtml, escapeHtmlChar) 33965 : string; 33966 } 33967 33968 /** 33969 * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", 33970 * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. 33971 * 33972 * @static 33973 * @memberOf _ 33974 * @since 3.0.0 33975 * @category String 33976 * @param {string} [string=''] The string to escape. 33977 * @returns {string} Returns the escaped string. 33978 * @example 33979 * 33980 * _.escapeRegExp('[lodash](https://lodash.com/)'); 33981 * // => '\[lodash\]\(https://lodash\.com/\)' 33982 */ 33983 function escapeRegExp(string) { 33984 string = toString(string); 33985 return (string && reHasRegExpChar.test(string)) 33986 ? string.replace(reRegExpChar, '\\$&') 33987 : string; 33988 } 33989 33990 /** 33991 * Converts `string` to 33992 * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). 33993 * 33994 * @static 33995 * @memberOf _ 33996 * @since 3.0.0 33997 * @category String 33998 * @param {string} [string=''] The string to convert. 33999 * @returns {string} Returns the kebab cased string. 34000 * @example 34001 * 34002 * _.kebabCase('Foo Bar'); 34003 * // => 'foo-bar' 34004 * 34005 * _.kebabCase('fooBar'); 34006 * // => 'foo-bar' 34007 * 34008 * _.kebabCase('__FOO_BAR__'); 34009 * // => 'foo-bar' 34010 */ 34011 var kebabCase = createCompounder(function(result, word, index) { 34012 return result + (index ? '-' : '') + word.toLowerCase(); 34013 }); 34014 34015 /** 34016 * Converts `string`, as space separated words, to lower case. 34017 * 34018 * @static 34019 * @memberOf _ 34020 * @since 4.0.0 34021 * @category String 34022 * @param {string} [string=''] The string to convert. 34023 * @returns {string} Returns the lower cased string. 34024 * @example 34025 * 34026 * _.lowerCase('--Foo-Bar--'); 34027 * // => 'foo bar' 34028 * 34029 * _.lowerCase('fooBar'); 34030 * // => 'foo bar' 34031 * 34032 * _.lowerCase('__FOO_BAR__'); 34033 * // => 'foo bar' 34034 */ 34035 var lowerCase = createCompounder(function(result, word, index) { 34036 return result + (index ? ' ' : '') + word.toLowerCase(); 34037 }); 34038 34039 /** 34040 * Converts the first character of `string` to lower case. 34041 * 34042 * @static 34043 * @memberOf _ 34044 * @since 4.0.0 34045 * @category String 34046 * @param {string} [string=''] The string to convert. 34047 * @returns {string} Returns the converted string. 34048 * @example 34049 * 34050 * _.lowerFirst('Fred'); 34051 * // => 'fred' 34052 * 34053 * _.lowerFirst('FRED'); 34054 * // => 'fRED' 34055 */ 34056 var lowerFirst = createCaseFirst('toLowerCase'); 34057 34058 /** 34059 * Pads `string` on the left and right sides if it's shorter than `length`. 34060 * Padding characters are truncated if they can't be evenly divided by `length`. 34061 * 34062 * @static 34063 * @memberOf _ 34064 * @since 3.0.0 34065 * @category String 34066 * @param {string} [string=''] The string to pad. 34067 * @param {number} [length=0] The padding length. 34068 * @param {string} [chars=' '] The string used as padding. 34069 * @returns {string} Returns the padded string. 34070 * @example 34071 * 34072 * _.pad('abc', 8); 34073 * // => ' abc ' 34074 * 34075 * _.pad('abc', 8, '_-'); 34076 * // => '_-abc_-_' 34077 * 34078 * _.pad('abc', 3); 34079 * // => 'abc' 34080 */ 34081 function pad(string, length, chars) { 34082 string = toString(string); 34083 length = toInteger(length); 34084 34085 var strLength = length ? stringSize(string) : 0; 34086 if (!length || strLength >= length) { 34087 return string; 34088 } 34089 var mid = (length - strLength) / 2; 34090 return ( 34091 createPadding(nativeFloor(mid), chars) + 34092 string + 34093 createPadding(nativeCeil(mid), chars) 34094 ); 34095 } 34096 34097 /** 34098 * Pads `string` on the right side if it's shorter than `length`. Padding 34099 * characters are truncated if they exceed `length`. 34100 * 34101 * @static 34102 * @memberOf _ 34103 * @since 4.0.0 34104 * @category String 34105 * @param {string} [string=''] The string to pad. 34106 * @param {number} [length=0] The padding length. 34107 * @param {string} [chars=' '] The string used as padding. 34108 * @returns {string} Returns the padded string. 34109 * @example 34110 * 34111 * _.padEnd('abc', 6); 34112 * // => 'abc ' 34113 * 34114 * _.padEnd('abc', 6, '_-'); 34115 * // => 'abc_-_' 34116 * 34117 * _.padEnd('abc', 3); 34118 * // => 'abc' 34119 */ 34120 function padEnd(string, length, chars) { 34121 string = toString(string); 34122 length = toInteger(length); 34123 34124 var strLength = length ? stringSize(string) : 0; 34125 return (length && strLength < length) 34126 ? (string + createPadding(length - strLength, chars)) 34127 : string; 34128 } 34129 34130 /** 34131 * Pads `string` on the left side if it's shorter than `length`. Padding 34132 * characters are truncated if they exceed `length`. 34133 * 34134 * @static 34135 * @memberOf _ 34136 * @since 4.0.0 34137 * @category String 34138 * @param {string} [string=''] The string to pad. 34139 * @param {number} [length=0] The padding length. 34140 * @param {string} [chars=' '] The string used as padding. 34141 * @returns {string} Returns the padded string. 34142 * @example 34143 * 34144 * _.padStart('abc', 6); 34145 * // => ' abc' 34146 * 34147 * _.padStart('abc', 6, '_-'); 34148 * // => '_-_abc' 34149 * 34150 * _.padStart('abc', 3); 34151 * // => 'abc' 34152 */ 34153 function padStart(string, length, chars) { 34154 string = toString(string); 34155 length = toInteger(length); 34156 34157 var strLength = length ? stringSize(string) : 0; 34158 return (length && strLength < length) 34159 ? (createPadding(length - strLength, chars) + string) 34160 : string; 34161 } 34162 34163 /** 34164 * Converts `string` to an integer of the specified radix. If `radix` is 34165 * `undefined` or `0`, a `radix` of `10` is used unless `value` is a 34166 * hexadecimal, in which case a `radix` of `16` is used. 34167 * 34168 * **Note:** This method aligns with the 34169 * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. 34170 * 34171 * @static 34172 * @memberOf _ 34173 * @since 1.1.0 34174 * @category String 34175 * @param {string} string The string to convert. 34176 * @param {number} [radix=10] The radix to interpret `value` by. 34177 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 34178 * @returns {number} Returns the converted integer. 34179 * @example 34180 * 34181 * _.parseInt('08'); 34182 * // => 8 34183 * 34184 * _.map(['6', '08', '10'], _.parseInt); 34185 * // => [6, 8, 10] 34186 */ 34187 function parseInt(string, radix, guard) { 34188 if (guard || radix == null) { 34189 radix = 0; 34190 } else if (radix) { 34191 radix = +radix; 34192 } 34193 return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0); 34194 } 34195 34196 /** 34197 * Repeats the given string `n` times. 34198 * 34199 * @static 34200 * @memberOf _ 34201 * @since 3.0.0 34202 * @category String 34203 * @param {string} [string=''] The string to repeat. 34204 * @param {number} [n=1] The number of times to repeat the string. 34205 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 34206 * @returns {string} Returns the repeated string. 34207 * @example 34208 * 34209 * _.repeat('*', 3); 34210 * // => '***' 34211 * 34212 * _.repeat('abc', 2); 34213 * // => 'abcabc' 34214 * 34215 * _.repeat('abc', 0); 34216 * // => '' 34217 */ 34218 function repeat(string, n, guard) { 34219 if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) { 34220 n = 1; 34221 } else { 34222 n = toInteger(n); 34223 } 34224 return baseRepeat(toString(string), n); 34225 } 34226 34227 /** 34228 * Replaces matches for `pattern` in `string` with `replacement`. 34229 * 34230 * **Note:** This method is based on 34231 * [`String#replace`](https://mdn.io/String/replace). 34232 * 34233 * @static 34234 * @memberOf _ 34235 * @since 4.0.0 34236 * @category String 34237 * @param {string} [string=''] The string to modify. 34238 * @param {RegExp|string} pattern The pattern to replace. 34239 * @param {Function|string} replacement The match replacement. 34240 * @returns {string} Returns the modified string. 34241 * @example 34242 * 34243 * _.replace('Hi Fred', 'Fred', 'Barney'); 34244 * // => 'Hi Barney' 34245 */ 34246 function replace() { 34247 var args = arguments, 34248 string = toString(args[0]); 34249 34250 return args.length < 3 ? string : string.replace(args[1], args[2]); 34251 } 34252 34253 /** 34254 * Converts `string` to 34255 * [snake case](https://en.wikipedia.org/wiki/Snake_case). 34256 * 34257 * @static 34258 * @memberOf _ 34259 * @since 3.0.0 34260 * @category String 34261 * @param {string} [string=''] The string to convert. 34262 * @returns {string} Returns the snake cased string. 34263 * @example 34264 * 34265 * _.snakeCase('Foo Bar'); 34266 * // => 'foo_bar' 34267 * 34268 * _.snakeCase('fooBar'); 34269 * // => 'foo_bar' 34270 * 34271 * _.snakeCase('--FOO-BAR--'); 34272 * // => 'foo_bar' 34273 */ 34274 var snakeCase = createCompounder(function(result, word, index) { 34275 return result + (index ? '_' : '') + word.toLowerCase(); 34276 }); 34277 34278 /** 34279 * Splits `string` by `separator`. 34280 * 34281 * **Note:** This method is based on 34282 * [`String#split`](https://mdn.io/String/split). 34283 * 34284 * @static 34285 * @memberOf _ 34286 * @since 4.0.0 34287 * @category String 34288 * @param {string} [string=''] The string to split. 34289 * @param {RegExp|string} separator The separator pattern to split by. 34290 * @param {number} [limit] The length to truncate results to. 34291 * @returns {Array} Returns the string segments. 34292 * @example 34293 * 34294 * _.split('a-b-c', '-', 2); 34295 * // => ['a', 'b'] 34296 */ 34297 function split(string, separator, limit) { 34298 if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) { 34299 separator = limit = undefined; 34300 } 34301 limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0; 34302 if (!limit) { 34303 return []; 34304 } 34305 string = toString(string); 34306 if (string && ( 34307 typeof separator == 'string' || 34308 (separator != null && !isRegExp(separator)) 34309 )) { 34310 separator = baseToString(separator); 34311 if (!separator && hasUnicode(string)) { 34312 return castSlice(stringToArray(string), 0, limit); 34313 } 34314 } 34315 return string.split(separator, limit); 34316 } 34317 34318 /** 34319 * Converts `string` to 34320 * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). 34321 * 34322 * @static 34323 * @memberOf _ 34324 * @since 3.1.0 34325 * @category String 34326 * @param {string} [string=''] The string to convert. 34327 * @returns {string} Returns the start cased string. 34328 * @example 34329 * 34330 * _.startCase('--foo-bar--'); 34331 * // => 'Foo Bar' 34332 * 34333 * _.startCase('fooBar'); 34334 * // => 'Foo Bar' 34335 * 34336 * _.startCase('__FOO_BAR__'); 34337 * // => 'FOO BAR' 34338 */ 34339 var startCase = createCompounder(function(result, word, index) { 34340 return result + (index ? ' ' : '') + upperFirst(word); 34341 }); 34342 34343 /** 34344 * Checks if `string` starts with the given target string. 34345 * 34346 * @static 34347 * @memberOf _ 34348 * @since 3.0.0 34349 * @category String 34350 * @param {string} [string=''] The string to inspect. 34351 * @param {string} [target] The string to search for. 34352 * @param {number} [position=0] The position to search from. 34353 * @returns {boolean} Returns `true` if `string` starts with `target`, 34354 * else `false`. 34355 * @example 34356 * 34357 * _.startsWith('abc', 'a'); 34358 * // => true 34359 * 34360 * _.startsWith('abc', 'b'); 34361 * // => false 34362 * 34363 * _.startsWith('abc', 'b', 1); 34364 * // => true 34365 */ 34366 function startsWith(string, target, position) { 34367 string = toString(string); 34368 position = position == null 34369 ? 0 34370 : baseClamp(toInteger(position), 0, string.length); 34371 34372 target = baseToString(target); 34373 return string.slice(position, position + target.length) == target; 34374 } 34375 34376 /** 34377 * Creates a compiled template function that can interpolate data properties 34378 * in "interpolate" delimiters, HTML-escape interpolated data properties in 34379 * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data 34380 * properties may be accessed as free variables in the template. If a setting 34381 * object is given, it takes precedence over `_.templateSettings` values. 34382 * 34383 * **Note:** In the development build `_.template` utilizes 34384 * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) 34385 * for easier debugging. 34386 * 34387 * For more information on precompiling templates see 34388 * [lodash's custom builds documentation](https://lodash.com/custom-builds). 34389 * 34390 * For more information on Chrome extension sandboxes see 34391 * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). 34392 * 34393 * @static 34394 * @since 0.1.0 34395 * @memberOf _ 34396 * @category String 34397 * @param {string} [string=''] The template string. 34398 * @param {Object} [options={}] The options object. 34399 * @param {RegExp} [options.escape=_.templateSettings.escape] 34400 * The HTML "escape" delimiter. 34401 * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] 34402 * The "evaluate" delimiter. 34403 * @param {Object} [options.imports=_.templateSettings.imports] 34404 * An object to import into the template as free variables. 34405 * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] 34406 * The "interpolate" delimiter. 34407 * @param {string} [options.sourceURL='lodash.templateSources[n]'] 34408 * The sourceURL of the compiled template. 34409 * @param {string} [options.variable='obj'] 34410 * The data object variable name. 34411 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 34412 * @returns {Function} Returns the compiled template function. 34413 * @example 34414 * 34415 * // Use the "interpolate" delimiter to create a compiled template. 34416 * var compiled = _.template('hello <%= user %>!'); 34417 * compiled({ 'user': 'fred' }); 34418 * // => 'hello fred!' 34419 * 34420 * // Use the HTML "escape" delimiter to escape data property values. 34421 * var compiled = _.template('<b><%- value %></b>'); 34422 * compiled({ 'value': '<script>' }); 34423 * // => '<b><script></b>' 34424 * 34425 * // Use the "evaluate" delimiter to execute JavaScript and generate HTML. 34426 * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>'); 34427 * compiled({ 'users': ['fred', 'barney'] }); 34428 * // => '<li>fred</li><li>barney</li>' 34429 * 34430 * // Use the internal `print` function in "evaluate" delimiters. 34431 * var compiled = _.template('<% print("hello " + user); %>!'); 34432 * compiled({ 'user': 'barney' }); 34433 * // => 'hello barney!' 34434 * 34435 * // Use the ES template literal delimiter as an "interpolate" delimiter. 34436 * // Disable support by replacing the "interpolate" delimiter. 34437 * var compiled = _.template('hello ${ user }!'); 34438 * compiled({ 'user': 'pebbles' }); 34439 * // => 'hello pebbles!' 34440 * 34441 * // Use backslashes to treat delimiters as plain text. 34442 * var compiled = _.template('<%= "\\<%- value %\\>" %>'); 34443 * compiled({ 'value': 'ignored' }); 34444 * // => '<%- value %>' 34445 * 34446 * // Use the `imports` option to import `jQuery` as `jq`. 34447 * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>'; 34448 * var compiled = _.template(text, { 'imports': { 'jq': jQuery } }); 34449 * compiled({ 'users': ['fred', 'barney'] }); 34450 * // => '<li>fred</li><li>barney</li>' 34451 * 34452 * // Use the `sourceURL` option to specify a custom sourceURL for the template. 34453 * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' }); 34454 * compiled(data); 34455 * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector. 34456 * 34457 * // Use the `variable` option to ensure a with-statement isn't used in the compiled template. 34458 * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' }); 34459 * compiled.source; 34460 * // => function(data) { 34461 * // var __t, __p = ''; 34462 * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!'; 34463 * // return __p; 34464 * // } 34465 * 34466 * // Use custom template delimiters. 34467 * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g; 34468 * var compiled = _.template('hello {{ user }}!'); 34469 * compiled({ 'user': 'mustache' }); 34470 * // => 'hello mustache!' 34471 * 34472 * // Use the `source` property to inline compiled templates for meaningful 34473 * // line numbers in error messages and stack traces. 34474 * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\ 34475 * var JST = {\ 34476 * "main": ' + _.template(mainText).source + '\ 34477 * };\ 34478 * '); 34479 */ 34480 function template(string, options, guard) { 34481 // Based on John Resig's `tmpl` implementation 34482 // (http://ejohn.org/blog/javascript-micro-templating/) 34483 // and Laura Doktorova's doT.js (https://github.com/olado/doT). 34484 var settings = lodash.templateSettings; 34485 34486 if (guard && isIterateeCall(string, options, guard)) { 34487 options = undefined; 34488 } 34489 string = toString(string); 34490 options = assignInWith({}, options, settings, customDefaultsAssignIn); 34491 34492 var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), 34493 importsKeys = keys(imports), 34494 importsValues = baseValues(imports, importsKeys); 34495 34496 var isEscaping, 34497 isEvaluating, 34498 index = 0, 34499 interpolate = options.interpolate || reNoMatch, 34500 source = "__p += '"; 34501 34502 // Compile the regexp to match each delimiter. 34503 var reDelimiters = RegExp( 34504 (options.escape || reNoMatch).source + '|' + 34505 interpolate.source + '|' + 34506 (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' + 34507 (options.evaluate || reNoMatch).source + '|$' 34508 , 'g'); 34509 34510 // Use a sourceURL for easier debugging. 34511 // The sourceURL gets injected into the source that's eval-ed, so be careful 34512 // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in 34513 // and escape the comment, thus injecting code that gets evaled. 34514 var sourceURL = '//# sourceURL=' + 34515 (hasOwnProperty.call(options, 'sourceURL') 34516 ? (options.sourceURL + '').replace(/\s/g, ' ') 34517 : ('lodash.templateSources[' + (++templateCounter) + ']') 34518 ) + '\n'; 34519 34520 string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { 34521 interpolateValue || (interpolateValue = esTemplateValue); 34522 34523 // Escape characters that can't be included in string literals. 34524 source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar); 34525 34526 // Replace delimiters with snippets. 34527 if (escapeValue) { 34528 isEscaping = true; 34529 source += "' +\n__e(" + escapeValue + ") +\n'"; 34530 } 34531 if (evaluateValue) { 34532 isEvaluating = true; 34533 source += "';\n" + evaluateValue + ";\n__p += '"; 34534 } 34535 if (interpolateValue) { 34536 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; 34537 } 34538 index = offset + match.length; 34539 34540 // The JS engine embedded in Adobe products needs `match` returned in 34541 // order to produce the correct `offset` value. 34542 return match; 34543 }); 34544 34545 source += "';\n"; 34546 34547 // If `variable` is not specified wrap a with-statement around the generated 34548 // code to add the data object to the top of the scope chain. 34549 var variable = hasOwnProperty.call(options, 'variable') && options.variable; 34550 if (!variable) { 34551 source = 'with (obj) {\n' + source + '\n}\n'; 34552 } 34553 // Throw an error if a forbidden character was found in `variable`, to prevent 34554 // potential command injection attacks. 34555 else if (reForbiddenIdentifierChars.test(variable)) { 34556 throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT); 34557 } 34558 34559 // Cleanup code by stripping empty strings. 34560 source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source) 34561 .replace(reEmptyStringMiddle, '$1') 34562 .replace(reEmptyStringTrailing, '$1;'); 34563 34564 // Frame code as the function body. 34565 source = 'function(' + (variable || 'obj') + ') {\n' + 34566 (variable 34567 ? '' 34568 : 'obj || (obj = {});\n' 34569 ) + 34570 "var __t, __p = ''" + 34571 (isEscaping 34572 ? ', __e = _.escape' 34573 : '' 34574 ) + 34575 (isEvaluating 34576 ? ', __j = Array.prototype.join;\n' + 34577 "function print() { __p += __j.call(arguments, '') }\n" 34578 : ';\n' 34579 ) + 34580 source + 34581 'return __p\n}'; 34582 34583 var result = attempt(function() { 34584 return Function(importsKeys, sourceURL + 'return ' + source) 34585 .apply(undefined, importsValues); 34586 }); 34587 34588 // Provide the compiled function's source by its `toString` method or 34589 // the `source` property as a convenience for inlining compiled templates. 34590 result.source = source; 34591 if (isError(result)) { 34592 throw result; 34593 } 34594 return result; 34595 } 34596 34597 /** 34598 * Converts `string`, as a whole, to lower case just like 34599 * [String#toLowerCase](https://mdn.io/toLowerCase). 34600 * 34601 * @static 34602 * @memberOf _ 34603 * @since 4.0.0 34604 * @category String 34605 * @param {string} [string=''] The string to convert. 34606 * @returns {string} Returns the lower cased string. 34607 * @example 34608 * 34609 * _.toLower('--Foo-Bar--'); 34610 * // => '--foo-bar--' 34611 * 34612 * _.toLower('fooBar'); 34613 * // => 'foobar' 34614 * 34615 * _.toLower('__FOO_BAR__'); 34616 * // => '__foo_bar__' 34617 */ 34618 function toLower(value) { 34619 return toString(value).toLowerCase(); 34620 } 34621 34622 /** 34623 * Converts `string`, as a whole, to upper case just like 34624 * [String#toUpperCase](https://mdn.io/toUpperCase). 34625 * 34626 * @static 34627 * @memberOf _ 34628 * @since 4.0.0 34629 * @category String 34630 * @param {string} [string=''] The string to convert. 34631 * @returns {string} Returns the upper cased string. 34632 * @example 34633 * 34634 * _.toUpper('--foo-bar--'); 34635 * // => '--FOO-BAR--' 34636 * 34637 * _.toUpper('fooBar'); 34638 * // => 'FOOBAR' 34639 * 34640 * _.toUpper('__foo_bar__'); 34641 * // => '__FOO_BAR__' 34642 */ 34643 function toUpper(value) { 34644 return toString(value).toUpperCase(); 34645 } 34646 34647 /** 34648 * Removes leading and trailing whitespace or specified characters from `string`. 34649 * 34650 * @static 34651 * @memberOf _ 34652 * @since 3.0.0 34653 * @category String 34654 * @param {string} [string=''] The string to trim. 34655 * @param {string} [chars=whitespace] The characters to trim. 34656 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 34657 * @returns {string} Returns the trimmed string. 34658 * @example 34659 * 34660 * _.trim(' abc '); 34661 * // => 'abc' 34662 * 34663 * _.trim('-_-abc-_-', '_-'); 34664 * // => 'abc' 34665 * 34666 * _.map([' foo ', ' bar '], _.trim); 34667 * // => ['foo', 'bar'] 34668 */ 34669 function trim(string, chars, guard) { 34670 string = toString(string); 34671 if (string && (guard || chars === undefined)) { 34672 return baseTrim(string); 34673 } 34674 if (!string || !(chars = baseToString(chars))) { 34675 return string; 34676 } 34677 var strSymbols = stringToArray(string), 34678 chrSymbols = stringToArray(chars), 34679 start = charsStartIndex(strSymbols, chrSymbols), 34680 end = charsEndIndex(strSymbols, chrSymbols) + 1; 34681 34682 return castSlice(strSymbols, start, end).join(''); 34683 } 34684 34685 /** 34686 * Removes trailing whitespace or specified characters from `string`. 34687 * 34688 * @static 34689 * @memberOf _ 34690 * @since 4.0.0 34691 * @category String 34692 * @param {string} [string=''] The string to trim. 34693 * @param {string} [chars=whitespace] The characters to trim. 34694 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 34695 * @returns {string} Returns the trimmed string. 34696 * @example 34697 * 34698 * _.trimEnd(' abc '); 34699 * // => ' abc' 34700 * 34701 * _.trimEnd('-_-abc-_-', '_-'); 34702 * // => '-_-abc' 34703 */ 34704 function trimEnd(string, chars, guard) { 34705 string = toString(string); 34706 if (string && (guard || chars === undefined)) { 34707 return string.slice(0, trimmedEndIndex(string) + 1); 34708 } 34709 if (!string || !(chars = baseToString(chars))) { 34710 return string; 34711 } 34712 var strSymbols = stringToArray(string), 34713 end = charsEndIndex(strSymbols, stringToArray(chars)) + 1; 34714 34715 return castSlice(strSymbols, 0, end).join(''); 34716 } 34717 34718 /** 34719 * Removes leading whitespace or specified characters from `string`. 34720 * 34721 * @static 34722 * @memberOf _ 34723 * @since 4.0.0 34724 * @category String 34725 * @param {string} [string=''] The string to trim. 34726 * @param {string} [chars=whitespace] The characters to trim. 34727 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 34728 * @returns {string} Returns the trimmed string. 34729 * @example 34730 * 34731 * _.trimStart(' abc '); 34732 * // => 'abc ' 34733 * 34734 * _.trimStart('-_-abc-_-', '_-'); 34735 * // => 'abc-_-' 34736 */ 34737 function trimStart(string, chars, guard) { 34738 string = toString(string); 34739 if (string && (guard || chars === undefined)) { 34740 return string.replace(reTrimStart, ''); 34741 } 34742 if (!string || !(chars = baseToString(chars))) { 34743 return string; 34744 } 34745 var strSymbols = stringToArray(string), 34746 start = charsStartIndex(strSymbols, stringToArray(chars)); 34747 34748 return castSlice(strSymbols, start).join(''); 34749 } 34750 34751 /** 34752 * Truncates `string` if it's longer than the given maximum string length. 34753 * The last characters of the truncated string are replaced with the omission 34754 * string which defaults to "...". 34755 * 34756 * @static 34757 * @memberOf _ 34758 * @since 4.0.0 34759 * @category String 34760 * @param {string} [string=''] The string to truncate. 34761 * @param {Object} [options={}] The options object. 34762 * @param {number} [options.length=30] The maximum string length. 34763 * @param {string} [options.omission='...'] The string to indicate text is omitted. 34764 * @param {RegExp|string} [options.separator] The separator pattern to truncate to. 34765 * @returns {string} Returns the truncated string. 34766 * @example 34767 * 34768 * _.truncate('hi-diddly-ho there, neighborino'); 34769 * // => 'hi-diddly-ho there, neighbo...' 34770 * 34771 * _.truncate('hi-diddly-ho there, neighborino', { 34772 * 'length': 24, 34773 * 'separator': ' ' 34774 * }); 34775 * // => 'hi-diddly-ho there,...' 34776 * 34777 * _.truncate('hi-diddly-ho there, neighborino', { 34778 * 'length': 24, 34779 * 'separator': /,? +/ 34780 * }); 34781 * // => 'hi-diddly-ho there...' 34782 * 34783 * _.truncate('hi-diddly-ho there, neighborino', { 34784 * 'omission': ' [...]' 34785 * }); 34786 * // => 'hi-diddly-ho there, neig [...]' 34787 */ 34788 function truncate(string, options) { 34789 var length = DEFAULT_TRUNC_LENGTH, 34790 omission = DEFAULT_TRUNC_OMISSION; 34791 34792 if (isObject(options)) { 34793 var separator = 'separator' in options ? options.separator : separator; 34794 length = 'length' in options ? toInteger(options.length) : length; 34795 omission = 'omission' in options ? baseToString(options.omission) : omission; 34796 } 34797 string = toString(string); 34798 34799 var strLength = string.length; 34800 if (hasUnicode(string)) { 34801 var strSymbols = stringToArray(string); 34802 strLength = strSymbols.length; 34803 } 34804 if (length >= strLength) { 34805 return string; 34806 } 34807 var end = length - stringSize(omission); 34808 if (end < 1) { 34809 return omission; 34810 } 34811 var result = strSymbols 34812 ? castSlice(strSymbols, 0, end).join('') 34813 : string.slice(0, end); 34814 34815 if (separator === undefined) { 34816 return result + omission; 34817 } 34818 if (strSymbols) { 34819 end += (result.length - end); 34820 } 34821 if (isRegExp(separator)) { 34822 if (string.slice(end).search(separator)) { 34823 var match, 34824 substring = result; 34825 34826 if (!separator.global) { 34827 separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g'); 34828 } 34829 separator.lastIndex = 0; 34830 while ((match = separator.exec(substring))) { 34831 var newEnd = match.index; 34832 } 34833 result = result.slice(0, newEnd === undefined ? end : newEnd); 34834 } 34835 } else if (string.indexOf(baseToString(separator), end) != end) { 34836 var index = result.lastIndexOf(separator); 34837 if (index > -1) { 34838 result = result.slice(0, index); 34839 } 34840 } 34841 return result + omission; 34842 } 34843 34844 /** 34845 * The inverse of `_.escape`; this method converts the HTML entities 34846 * `&`, `<`, `>`, `"`, and `'` in `string` to 34847 * their corresponding characters. 34848 * 34849 * **Note:** No other HTML entities are unescaped. To unescape additional 34850 * HTML entities use a third-party library like [_he_](https://mths.be/he). 34851 * 34852 * @static 34853 * @memberOf _ 34854 * @since 0.6.0 34855 * @category String 34856 * @param {string} [string=''] The string to unescape. 34857 * @returns {string} Returns the unescaped string. 34858 * @example 34859 * 34860 * _.unescape('fred, barney, & pebbles'); 34861 * // => 'fred, barney, & pebbles' 34862 */ 34863 function unescape(string) { 34864 string = toString(string); 34865 return (string && reHasEscapedHtml.test(string)) 34866 ? string.replace(reEscapedHtml, unescapeHtmlChar) 34867 : string; 34868 } 34869 34870 /** 34871 * Converts `string`, as space separated words, to upper case. 34872 * 34873 * @static 34874 * @memberOf _ 34875 * @since 4.0.0 34876 * @category String 34877 * @param {string} [string=''] The string to convert. 34878 * @returns {string} Returns the upper cased string. 34879 * @example 34880 * 34881 * _.upperCase('--foo-bar'); 34882 * // => 'FOO BAR' 34883 * 34884 * _.upperCase('fooBar'); 34885 * // => 'FOO BAR' 34886 * 34887 * _.upperCase('__foo_bar__'); 34888 * // => 'FOO BAR' 34889 */ 34890 var upperCase = createCompounder(function(result, word, index) { 34891 return result + (index ? ' ' : '') + word.toUpperCase(); 34892 }); 34893 34894 /** 34895 * Converts the first character of `string` to upper case. 34896 * 34897 * @static 34898 * @memberOf _ 34899 * @since 4.0.0 34900 * @category String 34901 * @param {string} [string=''] The string to convert. 34902 * @returns {string} Returns the converted string. 34903 * @example 34904 * 34905 * _.upperFirst('fred'); 34906 * // => 'Fred' 34907 * 34908 * _.upperFirst('FRED'); 34909 * // => 'FRED' 34910 */ 34911 var upperFirst = createCaseFirst('toUpperCase'); 34912 34913 /** 34914 * Splits `string` into an array of its words. 34915 * 34916 * @static 34917 * @memberOf _ 34918 * @since 3.0.0 34919 * @category String 34920 * @param {string} [string=''] The string to inspect. 34921 * @param {RegExp|string} [pattern] The pattern to match words. 34922 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 34923 * @returns {Array} Returns the words of `string`. 34924 * @example 34925 * 34926 * _.words('fred, barney, & pebbles'); 34927 * // => ['fred', 'barney', 'pebbles'] 34928 * 34929 * _.words('fred, barney, & pebbles', /[^, ]+/g); 34930 * // => ['fred', 'barney', '&', 'pebbles'] 34931 */ 34932 function words(string, pattern, guard) { 34933 string = toString(string); 34934 pattern = guard ? undefined : pattern; 34935 34936 if (pattern === undefined) { 34937 return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); 34938 } 34939 return string.match(pattern) || []; 34940 } 34941 34942 /*------------------------------------------------------------------------*/ 34943 34944 /** 34945 * Attempts to invoke `func`, returning either the result or the caught error 34946 * object. Any additional arguments are provided to `func` when it's invoked. 34947 * 34948 * @static 34949 * @memberOf _ 34950 * @since 3.0.0 34951 * @category Util 34952 * @param {Function} func The function to attempt. 34953 * @param {...*} [args] The arguments to invoke `func` with. 34954 * @returns {*} Returns the `func` result or error object. 34955 * @example 34956 * 34957 * // Avoid throwing errors for invalid selectors. 34958 * var elements = _.attempt(function(selector) { 34959 * return document.querySelectorAll(selector); 34960 * }, '>_>'); 34961 * 34962 * if (_.isError(elements)) { 34963 * elements = []; 34964 * } 34965 */ 34966 var attempt = baseRest(function(func, args) { 34967 try { 34968 return apply(func, undefined, args); 34969 } catch (e) { 34970 return isError(e) ? e : new Error(e); 34971 } 34972 }); 34973 34974 /** 34975 * Binds methods of an object to the object itself, overwriting the existing 34976 * method. 34977 * 34978 * **Note:** This method doesn't set the "length" property of bound functions. 34979 * 34980 * @static 34981 * @since 0.1.0 34982 * @memberOf _ 34983 * @category Util 34984 * @param {Object} object The object to bind and assign the bound methods to. 34985 * @param {...(string|string[])} methodNames The object method names to bind. 34986 * @returns {Object} Returns `object`. 34987 * @example 34988 * 34989 * var view = { 34990 * 'label': 'docs', 34991 * 'click': function() { 34992 * console.log('clicked ' + this.label); 34993 * } 34994 * }; 34995 * 34996 * _.bindAll(view, ['click']); 34997 * jQuery(element).on('click', view.click); 34998 * // => Logs 'clicked docs' when clicked. 34999 */ 35000 var bindAll = flatRest(function(object, methodNames) { 35001 arrayEach(methodNames, function(key) { 35002 key = toKey(key); 35003 baseAssignValue(object, key, bind(object[key], object)); 35004 }); 35005 return object; 35006 }); 35007 35008 /** 35009 * Creates a function that iterates over `pairs` and invokes the corresponding 35010 * function of the first predicate to return truthy. The predicate-function 35011 * pairs are invoked with the `this` binding and arguments of the created 35012 * function. 35013 * 35014 * @static 35015 * @memberOf _ 35016 * @since 4.0.0 35017 * @category Util 35018 * @param {Array} pairs The predicate-function pairs. 35019 * @returns {Function} Returns the new composite function. 35020 * @example 35021 * 35022 * var func = _.cond([ 35023 * [_.matches({ 'a': 1 }), _.constant('matches A')], 35024 * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')], 35025 * [_.stubTrue, _.constant('no match')] 35026 * ]); 35027 * 35028 * func({ 'a': 1, 'b': 2 }); 35029 * // => 'matches A' 35030 * 35031 * func({ 'a': 0, 'b': 1 }); 35032 * // => 'matches B' 35033 * 35034 * func({ 'a': '1', 'b': '2' }); 35035 * // => 'no match' 35036 */ 35037 function cond(pairs) { 35038 var length = pairs == null ? 0 : pairs.length, 35039 toIteratee = getIteratee(); 35040 35041 pairs = !length ? [] : arrayMap(pairs, function(pair) { 35042 if (typeof pair[1] != 'function') { 35043 throw new TypeError(FUNC_ERROR_TEXT); 35044 } 35045 return [toIteratee(pair[0]), pair[1]]; 35046 }); 35047 35048 return baseRest(function(args) { 35049 var index = -1; 35050 while (++index < length) { 35051 var pair = pairs[index]; 35052 if (apply(pair[0], this, args)) { 35053 return apply(pair[1], this, args); 35054 } 35055 } 35056 }); 35057 } 35058 35059 /** 35060 * Creates a function that invokes the predicate properties of `source` with 35061 * the corresponding property values of a given object, returning `true` if 35062 * all predicates return truthy, else `false`. 35063 * 35064 * **Note:** The created function is equivalent to `_.conformsTo` with 35065 * `source` partially applied. 35066 * 35067 * @static 35068 * @memberOf _ 35069 * @since 4.0.0 35070 * @category Util 35071 * @param {Object} source The object of property predicates to conform to. 35072 * @returns {Function} Returns the new spec function. 35073 * @example 35074 * 35075 * var objects = [ 35076 * { 'a': 2, 'b': 1 }, 35077 * { 'a': 1, 'b': 2 } 35078 * ]; 35079 * 35080 * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } })); 35081 * // => [{ 'a': 1, 'b': 2 }] 35082 */ 35083 function conforms(source) { 35084 return baseConforms(baseClone(source, CLONE_DEEP_FLAG)); 35085 } 35086 35087 /** 35088 * Creates a function that returns `value`. 35089 * 35090 * @static 35091 * @memberOf _ 35092 * @since 2.4.0 35093 * @category Util 35094 * @param {*} value The value to return from the new function. 35095 * @returns {Function} Returns the new constant function. 35096 * @example 35097 * 35098 * var objects = _.times(2, _.constant({ 'a': 1 })); 35099 * 35100 * console.log(objects); 35101 * // => [{ 'a': 1 }, { 'a': 1 }] 35102 * 35103 * console.log(objects[0] === objects[1]); 35104 * // => true 35105 */ 35106 function constant(value) { 35107 return function() { 35108 return value; 35109 }; 35110 } 35111 35112 /** 35113 * Checks `value` to determine whether a default value should be returned in 35114 * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, 35115 * or `undefined`. 35116 * 35117 * @static 35118 * @memberOf _ 35119 * @since 4.14.0 35120 * @category Util 35121 * @param {*} value The value to check. 35122 * @param {*} defaultValue The default value. 35123 * @returns {*} Returns the resolved value. 35124 * @example 35125 * 35126 * _.defaultTo(1, 10); 35127 * // => 1 35128 * 35129 * _.defaultTo(undefined, 10); 35130 * // => 10 35131 */ 35132 function defaultTo(value, defaultValue) { 35133 return (value == null || value !== value) ? defaultValue : value; 35134 } 35135 35136 /** 35137 * Creates a function that returns the result of invoking the given functions 35138 * with the `this` binding of the created function, where each successive 35139 * invocation is supplied the return value of the previous. 35140 * 35141 * @static 35142 * @memberOf _ 35143 * @since 3.0.0 35144 * @category Util 35145 * @param {...(Function|Function[])} [funcs] The functions to invoke. 35146 * @returns {Function} Returns the new composite function. 35147 * @see _.flowRight 35148 * @example 35149 * 35150 * function square(n) { 35151 * return n * n; 35152 * } 35153 * 35154 * var addSquare = _.flow([_.add, square]); 35155 * addSquare(1, 2); 35156 * // => 9 35157 */ 35158 var flow = createFlow(); 35159 35160 /** 35161 * This method is like `_.flow` except that it creates a function that 35162 * invokes the given functions from right to left. 35163 * 35164 * @static 35165 * @since 3.0.0 35166 * @memberOf _ 35167 * @category Util 35168 * @param {...(Function|Function[])} [funcs] The functions to invoke. 35169 * @returns {Function} Returns the new composite function. 35170 * @see _.flow 35171 * @example 35172 * 35173 * function square(n) { 35174 * return n * n; 35175 * } 35176 * 35177 * var addSquare = _.flowRight([square, _.add]); 35178 * addSquare(1, 2); 35179 * // => 9 35180 */ 35181 var flowRight = createFlow(true); 35182 35183 /** 35184 * This method returns the first argument it receives. 35185 * 35186 * @static 35187 * @since 0.1.0 35188 * @memberOf _ 35189 * @category Util 35190 * @param {*} value Any value. 35191 * @returns {*} Returns `value`. 35192 * @example 35193 * 35194 * var object = { 'a': 1 }; 35195 * 35196 * console.log(_.identity(object) === object); 35197 * // => true 35198 */ 35199 function identity(value) { 35200 return value; 35201 } 35202 35203 /** 35204 * Creates a function that invokes `func` with the arguments of the created 35205 * function. If `func` is a property name, the created function returns the 35206 * property value for a given element. If `func` is an array or object, the 35207 * created function returns `true` for elements that contain the equivalent 35208 * source properties, otherwise it returns `false`. 35209 * 35210 * @static 35211 * @since 4.0.0 35212 * @memberOf _ 35213 * @category Util 35214 * @param {*} [func=_.identity] The value to convert to a callback. 35215 * @returns {Function} Returns the callback. 35216 * @example 35217 * 35218 * var users = [ 35219 * { 'user': 'barney', 'age': 36, 'active': true }, 35220 * { 'user': 'fred', 'age': 40, 'active': false } 35221 * ]; 35222 * 35223 * // The `_.matches` iteratee shorthand. 35224 * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true })); 35225 * // => [{ 'user': 'barney', 'age': 36, 'active': true }] 35226 * 35227 * // The `_.matchesProperty` iteratee shorthand. 35228 * _.filter(users, _.iteratee(['user', 'fred'])); 35229 * // => [{ 'user': 'fred', 'age': 40 }] 35230 * 35231 * // The `_.property` iteratee shorthand. 35232 * _.map(users, _.iteratee('user')); 35233 * // => ['barney', 'fred'] 35234 * 35235 * // Create custom iteratee shorthands. 35236 * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) { 35237 * return !_.isRegExp(func) ? iteratee(func) : function(string) { 35238 * return func.test(string); 35239 * }; 35240 * }); 35241 * 35242 * _.filter(['abc', 'def'], /ef/); 35243 * // => ['def'] 35244 */ 35245 function iteratee(func) { 35246 return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG)); 35247 } 35248 35249 /** 35250 * Creates a function that performs a partial deep comparison between a given 35251 * object and `source`, returning `true` if the given object has equivalent 35252 * property values, else `false`. 35253 * 35254 * **Note:** The created function is equivalent to `_.isMatch` with `source` 35255 * partially applied. 35256 * 35257 * Partial comparisons will match empty array and empty object `source` 35258 * values against any array or object value, respectively. See `_.isEqual` 35259 * for a list of supported value comparisons. 35260 * 35261 * **Note:** Multiple values can be checked by combining several matchers 35262 * using `_.overSome` 35263 * 35264 * @static 35265 * @memberOf _ 35266 * @since 3.0.0 35267 * @category Util 35268 * @param {Object} source The object of property values to match. 35269 * @returns {Function} Returns the new spec function. 35270 * @example 35271 * 35272 * var objects = [ 35273 * { 'a': 1, 'b': 2, 'c': 3 }, 35274 * { 'a': 4, 'b': 5, 'c': 6 } 35275 * ]; 35276 * 35277 * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); 35278 * // => [{ 'a': 4, 'b': 5, 'c': 6 }] 35279 * 35280 * // Checking for several possible values 35281 * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); 35282 * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] 35283 */ 35284 function matches(source) { 35285 return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); 35286 } 35287 35288 /** 35289 * Creates a function that performs a partial deep comparison between the 35290 * value at `path` of a given object to `srcValue`, returning `true` if the 35291 * object value is equivalent, else `false`. 35292 * 35293 * **Note:** Partial comparisons will match empty array and empty object 35294 * `srcValue` values against any array or object value, respectively. See 35295 * `_.isEqual` for a list of supported value comparisons. 35296 * 35297 * **Note:** Multiple values can be checked by combining several matchers 35298 * using `_.overSome` 35299 * 35300 * @static 35301 * @memberOf _ 35302 * @since 3.2.0 35303 * @category Util 35304 * @param {Array|string} path The path of the property to get. 35305 * @param {*} srcValue The value to match. 35306 * @returns {Function} Returns the new spec function. 35307 * @example 35308 * 35309 * var objects = [ 35310 * { 'a': 1, 'b': 2, 'c': 3 }, 35311 * { 'a': 4, 'b': 5, 'c': 6 } 35312 * ]; 35313 * 35314 * _.find(objects, _.matchesProperty('a', 4)); 35315 * // => { 'a': 4, 'b': 5, 'c': 6 } 35316 * 35317 * // Checking for several possible values 35318 * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)])); 35319 * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] 35320 */ 35321 function matchesProperty(path, srcValue) { 35322 return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); 35323 } 35324 35325 /** 35326 * Creates a function that invokes the method at `path` of a given object. 35327 * Any additional arguments are provided to the invoked method. 35328 * 35329 * @static 35330 * @memberOf _ 35331 * @since 3.7.0 35332 * @category Util 35333 * @param {Array|string} path The path of the method to invoke. 35334 * @param {...*} [args] The arguments to invoke the method with. 35335 * @returns {Function} Returns the new invoker function. 35336 * @example 35337 * 35338 * var objects = [ 35339 * { 'a': { 'b': _.constant(2) } }, 35340 * { 'a': { 'b': _.constant(1) } } 35341 * ]; 35342 * 35343 * _.map(objects, _.method('a.b')); 35344 * // => [2, 1] 35345 * 35346 * _.map(objects, _.method(['a', 'b'])); 35347 * // => [2, 1] 35348 */ 35349 var method = baseRest(function(path, args) { 35350 return function(object) { 35351 return baseInvoke(object, path, args); 35352 }; 35353 }); 35354 35355 /** 35356 * The opposite of `_.method`; this method creates a function that invokes 35357 * the method at a given path of `object`. Any additional arguments are 35358 * provided to the invoked method. 35359 * 35360 * @static 35361 * @memberOf _ 35362 * @since 3.7.0 35363 * @category Util 35364 * @param {Object} object The object to query. 35365 * @param {...*} [args] The arguments to invoke the method with. 35366 * @returns {Function} Returns the new invoker function. 35367 * @example 35368 * 35369 * var array = _.times(3, _.constant), 35370 * object = { 'a': array, 'b': array, 'c': array }; 35371 * 35372 * _.map(['a[2]', 'c[0]'], _.methodOf(object)); 35373 * // => [2, 0] 35374 * 35375 * _.map([['a', '2'], ['c', '0']], _.methodOf(object)); 35376 * // => [2, 0] 35377 */ 35378 var methodOf = baseRest(function(object, args) { 35379 return function(path) { 35380 return baseInvoke(object, path, args); 35381 }; 35382 }); 35383 35384 /** 35385 * Adds all own enumerable string keyed function properties of a source 35386 * object to the destination object. If `object` is a function, then methods 35387 * are added to its prototype as well. 35388 * 35389 * **Note:** Use `_.runInContext` to create a pristine `lodash` function to 35390 * avoid conflicts caused by modifying the original. 35391 * 35392 * @static 35393 * @since 0.1.0 35394 * @memberOf _ 35395 * @category Util 35396 * @param {Function|Object} [object=lodash] The destination object. 35397 * @param {Object} source The object of functions to add. 35398 * @param {Object} [options={}] The options object. 35399 * @param {boolean} [options.chain=true] Specify whether mixins are chainable. 35400 * @returns {Function|Object} Returns `object`. 35401 * @example 35402 * 35403 * function vowels(string) { 35404 * return _.filter(string, function(v) { 35405 * return /[aeiou]/i.test(v); 35406 * }); 35407 * } 35408 * 35409 * _.mixin({ 'vowels': vowels }); 35410 * _.vowels('fred'); 35411 * // => ['e'] 35412 * 35413 * _('fred').vowels().value(); 35414 * // => ['e'] 35415 * 35416 * _.mixin({ 'vowels': vowels }, { 'chain': false }); 35417 * _('fred').vowels(); 35418 * // => ['e'] 35419 */ 35420 function mixin(object, source, options) { 35421 var props = keys(source), 35422 methodNames = baseFunctions(source, props); 35423 35424 if (options == null && 35425 !(isObject(source) && (methodNames.length || !props.length))) { 35426 options = source; 35427 source = object; 35428 object = this; 35429 methodNames = baseFunctions(source, keys(source)); 35430 } 35431 var chain = !(isObject(options) && 'chain' in options) || !!options.chain, 35432 isFunc = isFunction(object); 35433 35434 arrayEach(methodNames, function(methodName) { 35435 var func = source[methodName]; 35436 object[methodName] = func; 35437 if (isFunc) { 35438 object.prototype[methodName] = function() { 35439 var chainAll = this.__chain__; 35440 if (chain || chainAll) { 35441 var result = object(this.__wrapped__), 35442 actions = result.__actions__ = copyArray(this.__actions__); 35443 35444 actions.push({ 'func': func, 'args': arguments, 'thisArg': object }); 35445 result.__chain__ = chainAll; 35446 return result; 35447 } 35448 return func.apply(object, arrayPush([this.value()], arguments)); 35449 }; 35450 } 35451 }); 35452 35453 return object; 35454 } 35455 35456 /** 35457 * Reverts the `_` variable to its previous value and returns a reference to 35458 * the `lodash` function. 35459 * 35460 * @static 35461 * @since 0.1.0 35462 * @memberOf _ 35463 * @category Util 35464 * @returns {Function} Returns the `lodash` function. 35465 * @example 35466 * 35467 * var lodash = _.noConflict(); 35468 */ 35469 function noConflict() { 35470 if (root._ === this) { 35471 root._ = oldDash; 35472 } 35473 return this; 35474 } 35475 35476 /** 35477 * This method returns `undefined`. 35478 * 35479 * @static 35480 * @memberOf _ 35481 * @since 2.3.0 35482 * @category Util 35483 * @example 35484 * 35485 * _.times(2, _.noop); 35486 * // => [undefined, undefined] 35487 */ 35488 function noop() { 35489 // No operation performed. 35490 } 35491 35492 /** 35493 * Creates a function that gets the argument at index `n`. If `n` is negative, 35494 * the nth argument from the end is returned. 35495 * 35496 * @static 35497 * @memberOf _ 35498 * @since 4.0.0 35499 * @category Util 35500 * @param {number} [n=0] The index of the argument to return. 35501 * @returns {Function} Returns the new pass-thru function. 35502 * @example 35503 * 35504 * var func = _.nthArg(1); 35505 * func('a', 'b', 'c', 'd'); 35506 * // => 'b' 35507 * 35508 * var func = _.nthArg(-2); 35509 * func('a', 'b', 'c', 'd'); 35510 * // => 'c' 35511 */ 35512 function nthArg(n) { 35513 n = toInteger(n); 35514 return baseRest(function(args) { 35515 return baseNth(args, n); 35516 }); 35517 } 35518 35519 /** 35520 * Creates a function that invokes `iteratees` with the arguments it receives 35521 * and returns their results. 35522 * 35523 * @static 35524 * @memberOf _ 35525 * @since 4.0.0 35526 * @category Util 35527 * @param {...(Function|Function[])} [iteratees=[_.identity]] 35528 * The iteratees to invoke. 35529 * @returns {Function} Returns the new function. 35530 * @example 35531 * 35532 * var func = _.over([Math.max, Math.min]); 35533 * 35534 * func(1, 2, 3, 4); 35535 * // => [4, 1] 35536 */ 35537 var over = createOver(arrayMap); 35538 35539 /** 35540 * Creates a function that checks if **all** of the `predicates` return 35541 * truthy when invoked with the arguments it receives. 35542 * 35543 * Following shorthands are possible for providing predicates. 35544 * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate. 35545 * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them. 35546 * 35547 * @static 35548 * @memberOf _ 35549 * @since 4.0.0 35550 * @category Util 35551 * @param {...(Function|Function[])} [predicates=[_.identity]] 35552 * The predicates to check. 35553 * @returns {Function} Returns the new function. 35554 * @example 35555 * 35556 * var func = _.overEvery([Boolean, isFinite]); 35557 * 35558 * func('1'); 35559 * // => true 35560 * 35561 * func(null); 35562 * // => false 35563 * 35564 * func(NaN); 35565 * // => false 35566 */ 35567 var overEvery = createOver(arrayEvery); 35568 35569 /** 35570 * Creates a function that checks if **any** of the `predicates` return 35571 * truthy when invoked with the arguments it receives. 35572 * 35573 * Following shorthands are possible for providing predicates. 35574 * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate. 35575 * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them. 35576 * 35577 * @static 35578 * @memberOf _ 35579 * @since 4.0.0 35580 * @category Util 35581 * @param {...(Function|Function[])} [predicates=[_.identity]] 35582 * The predicates to check. 35583 * @returns {Function} Returns the new function. 35584 * @example 35585 * 35586 * var func = _.overSome([Boolean, isFinite]); 35587 * 35588 * func('1'); 35589 * // => true 35590 * 35591 * func(null); 35592 * // => true 35593 * 35594 * func(NaN); 35595 * // => false 35596 * 35597 * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }]) 35598 * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]]) 35599 */ 35600 var overSome = createOver(arraySome); 35601 35602 /** 35603 * Creates a function that returns the value at `path` of a given object. 35604 * 35605 * @static 35606 * @memberOf _ 35607 * @since 2.4.0 35608 * @category Util 35609 * @param {Array|string} path The path of the property to get. 35610 * @returns {Function} Returns the new accessor function. 35611 * @example 35612 * 35613 * var objects = [ 35614 * { 'a': { 'b': 2 } }, 35615 * { 'a': { 'b': 1 } } 35616 * ]; 35617 * 35618 * _.map(objects, _.property('a.b')); 35619 * // => [2, 1] 35620 * 35621 * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); 35622 * // => [1, 2] 35623 */ 35624 function property(path) { 35625 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); 35626 } 35627 35628 /** 35629 * The opposite of `_.property`; this method creates a function that returns 35630 * the value at a given path of `object`. 35631 * 35632 * @static 35633 * @memberOf _ 35634 * @since 3.0.0 35635 * @category Util 35636 * @param {Object} object The object to query. 35637 * @returns {Function} Returns the new accessor function. 35638 * @example 35639 * 35640 * var array = [0, 1, 2], 35641 * object = { 'a': array, 'b': array, 'c': array }; 35642 * 35643 * _.map(['a[2]', 'c[0]'], _.propertyOf(object)); 35644 * // => [2, 0] 35645 * 35646 * _.map([['a', '2'], ['c', '0']], _.propertyOf(object)); 35647 * // => [2, 0] 35648 */ 35649 function propertyOf(object) { 35650 return function(path) { 35651 return object == null ? undefined : baseGet(object, path); 35652 }; 35653 } 35654 35655 /** 35656 * Creates an array of numbers (positive and/or negative) progressing from 35657 * `start` up to, but not including, `end`. A step of `-1` is used if a negative 35658 * `start` is specified without an `end` or `step`. If `end` is not specified, 35659 * it's set to `start` with `start` then set to `0`. 35660 * 35661 * **Note:** JavaScript follows the IEEE-754 standard for resolving 35662 * floating-point values which can produce unexpected results. 35663 * 35664 * @static 35665 * @since 0.1.0 35666 * @memberOf _ 35667 * @category Util 35668 * @param {number} [start=0] The start of the range. 35669 * @param {number} end The end of the range. 35670 * @param {number} [step=1] The value to increment or decrement by. 35671 * @returns {Array} Returns the range of numbers. 35672 * @see _.inRange, _.rangeRight 35673 * @example 35674 * 35675 * _.range(4); 35676 * // => [0, 1, 2, 3] 35677 * 35678 * _.range(-4); 35679 * // => [0, -1, -2, -3] 35680 * 35681 * _.range(1, 5); 35682 * // => [1, 2, 3, 4] 35683 * 35684 * _.range(0, 20, 5); 35685 * // => [0, 5, 10, 15] 35686 * 35687 * _.range(0, -4, -1); 35688 * // => [0, -1, -2, -3] 35689 * 35690 * _.range(1, 4, 0); 35691 * // => [1, 1, 1] 35692 * 35693 * _.range(0); 35694 * // => [] 35695 */ 35696 var range = createRange(); 35697 35698 /** 35699 * This method is like `_.range` except that it populates values in 35700 * descending order. 35701 * 35702 * @static 35703 * @memberOf _ 35704 * @since 4.0.0 35705 * @category Util 35706 * @param {number} [start=0] The start of the range. 35707 * @param {number} end The end of the range. 35708 * @param {number} [step=1] The value to increment or decrement by. 35709 * @returns {Array} Returns the range of numbers. 35710 * @see _.inRange, _.range 35711 * @example 35712 * 35713 * _.rangeRight(4); 35714 * // => [3, 2, 1, 0] 35715 * 35716 * _.rangeRight(-4); 35717 * // => [-3, -2, -1, 0] 35718 * 35719 * _.rangeRight(1, 5); 35720 * // => [4, 3, 2, 1] 35721 * 35722 * _.rangeRight(0, 20, 5); 35723 * // => [15, 10, 5, 0] 35724 * 35725 * _.rangeRight(0, -4, -1); 35726 * // => [-3, -2, -1, 0] 35727 * 35728 * _.rangeRight(1, 4, 0); 35729 * // => [1, 1, 1] 35730 * 35731 * _.rangeRight(0); 35732 * // => [] 35733 */ 35734 var rangeRight = createRange(true); 35735 35736 /** 35737 * This method returns a new empty array. 35738 * 35739 * @static 35740 * @memberOf _ 35741 * @since 4.13.0 35742 * @category Util 35743 * @returns {Array} Returns the new empty array. 35744 * @example 35745 * 35746 * var arrays = _.times(2, _.stubArray); 35747 * 35748 * console.log(arrays); 35749 * // => [[], []] 35750 * 35751 * console.log(arrays[0] === arrays[1]); 35752 * // => false 35753 */ 35754 function stubArray() { 35755 return []; 35756 } 35757 35758 /** 35759 * This method returns `false`. 35760 * 35761 * @static 35762 * @memberOf _ 35763 * @since 4.13.0 35764 * @category Util 35765 * @returns {boolean} Returns `false`. 35766 * @example 35767 * 35768 * _.times(2, _.stubFalse); 35769 * // => [false, false] 35770 */ 35771 function stubFalse() { 35772 return false; 35773 } 35774 35775 /** 35776 * This method returns a new empty object. 35777 * 35778 * @static 35779 * @memberOf _ 35780 * @since 4.13.0 35781 * @category Util 35782 * @returns {Object} Returns the new empty object. 35783 * @example 35784 * 35785 * var objects = _.times(2, _.stubObject); 35786 * 35787 * console.log(objects); 35788 * // => [{}, {}] 35789 * 35790 * console.log(objects[0] === objects[1]); 35791 * // => false 35792 */ 35793 function stubObject() { 35794 return {}; 35795 } 35796 35797 /** 35798 * This method returns an empty string. 35799 * 35800 * @static 35801 * @memberOf _ 35802 * @since 4.13.0 35803 * @category Util 35804 * @returns {string} Returns the empty string. 35805 * @example 35806 * 35807 * _.times(2, _.stubString); 35808 * // => ['', ''] 35809 */ 35810 function stubString() { 35811 return ''; 35812 } 35813 35814 /** 35815 * This method returns `true`. 35816 * 35817 * @static 35818 * @memberOf _ 35819 * @since 4.13.0 35820 * @category Util 35821 * @returns {boolean} Returns `true`. 35822 * @example 35823 * 35824 * _.times(2, _.stubTrue); 35825 * // => [true, true] 35826 */ 35827 function stubTrue() { 35828 return true; 35829 } 35830 35831 /** 35832 * Invokes the iteratee `n` times, returning an array of the results of 35833 * each invocation. The iteratee is invoked with one argument; (index). 35834 * 35835 * @static 35836 * @since 0.1.0 35837 * @memberOf _ 35838 * @category Util 35839 * @param {number} n The number of times to invoke `iteratee`. 35840 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 35841 * @returns {Array} Returns the array of results. 35842 * @example 35843 * 35844 * _.times(3, String); 35845 * // => ['0', '1', '2'] 35846 * 35847 * _.times(4, _.constant(0)); 35848 * // => [0, 0, 0, 0] 35849 */ 35850 function times(n, iteratee) { 35851 n = toInteger(n); 35852 if (n < 1 || n > MAX_SAFE_INTEGER) { 35853 return []; 35854 } 35855 var index = MAX_ARRAY_LENGTH, 35856 length = nativeMin(n, MAX_ARRAY_LENGTH); 35857 35858 iteratee = getIteratee(iteratee); 35859 n -= MAX_ARRAY_LENGTH; 35860 35861 var result = baseTimes(length, iteratee); 35862 while (++index < n) { 35863 iteratee(index); 35864 } 35865 return result; 35866 } 35867 35868 /** 35869 * Converts `value` to a property path array. 35870 * 35871 * @static 35872 * @memberOf _ 35873 * @since 4.0.0 35874 * @category Util 35875 * @param {*} value The value to convert. 35876 * @returns {Array} Returns the new property path array. 35877 * @example 35878 * 35879 * _.toPath('a.b.c'); 35880 * // => ['a', 'b', 'c'] 35881 * 35882 * _.toPath('a[0].b.c'); 35883 * // => ['a', '0', 'b', 'c'] 35884 */ 35885 function toPath(value) { 35886 if (isArray(value)) { 35887 return arrayMap(value, toKey); 35888 } 35889 return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value))); 35890 } 35891 35892 /** 35893 * Generates a unique ID. If `prefix` is given, the ID is appended to it. 35894 * 35895 * @static 35896 * @since 0.1.0 35897 * @memberOf _ 35898 * @category Util 35899 * @param {string} [prefix=''] The value to prefix the ID with. 35900 * @returns {string} Returns the unique ID. 35901 * @example 35902 * 35903 * _.uniqueId('contact_'); 35904 * // => 'contact_104' 35905 * 35906 * _.uniqueId(); 35907 * // => '105' 35908 */ 35909 function uniqueId(prefix) { 35910 var id = ++idCounter; 35911 return toString(prefix) + id; 35912 } 35913 35914 /*------------------------------------------------------------------------*/ 35915 35916 /** 35917 * Adds two numbers. 35918 * 35919 * @static 35920 * @memberOf _ 35921 * @since 3.4.0 35922 * @category Math 35923 * @param {number} augend The first number in an addition. 35924 * @param {number} addend The second number in an addition. 35925 * @returns {number} Returns the total. 35926 * @example 35927 * 35928 * _.add(6, 4); 35929 * // => 10 35930 */ 35931 var add = createMathOperation(function(augend, addend) { 35932 return augend + addend; 35933 }, 0); 35934 35935 /** 35936 * Computes `number` rounded up to `precision`. 35937 * 35938 * @static 35939 * @memberOf _ 35940 * @since 3.10.0 35941 * @category Math 35942 * @param {number} number The number to round up. 35943 * @param {number} [precision=0] The precision to round up to. 35944 * @returns {number} Returns the rounded up number. 35945 * @example 35946 * 35947 * _.ceil(4.006); 35948 * // => 5 35949 * 35950 * _.ceil(6.004, 2); 35951 * // => 6.01 35952 * 35953 * _.ceil(6040, -2); 35954 * // => 6100 35955 */ 35956 var ceil = createRound('ceil'); 35957 35958 /** 35959 * Divide two numbers. 35960 * 35961 * @static 35962 * @memberOf _ 35963 * @since 4.7.0 35964 * @category Math 35965 * @param {number} dividend The first number in a division. 35966 * @param {number} divisor The second number in a division. 35967 * @returns {number} Returns the quotient. 35968 * @example 35969 * 35970 * _.divide(6, 4); 35971 * // => 1.5 35972 */ 35973 var divide = createMathOperation(function(dividend, divisor) { 35974 return dividend / divisor; 35975 }, 1); 35976 35977 /** 35978 * Computes `number` rounded down to `precision`. 35979 * 35980 * @static 35981 * @memberOf _ 35982 * @since 3.10.0 35983 * @category Math 35984 * @param {number} number The number to round down. 35985 * @param {number} [precision=0] The precision to round down to. 35986 * @returns {number} Returns the rounded down number. 35987 * @example 35988 * 35989 * _.floor(4.006); 35990 * // => 4 35991 * 35992 * _.floor(0.046, 2); 35993 * // => 0.04 35994 * 35995 * _.floor(4060, -2); 35996 * // => 4000 35997 */ 35998 var floor = createRound('floor'); 35999 36000 /** 36001 * Computes the maximum value of `array`. If `array` is empty or falsey, 36002 * `undefined` is returned. 36003 * 36004 * @static 36005 * @since 0.1.0 36006 * @memberOf _ 36007 * @category Math 36008 * @param {Array} array The array to iterate over. 36009 * @returns {*} Returns the maximum value. 36010 * @example 36011 * 36012 * _.max([4, 2, 8, 6]); 36013 * // => 8 36014 * 36015 * _.max([]); 36016 * // => undefined 36017 */ 36018 function max(array) { 36019 return (array && array.length) 36020 ? baseExtremum(array, identity, baseGt) 36021 : undefined; 36022 } 36023 36024 /** 36025 * This method is like `_.max` except that it accepts `iteratee` which is 36026 * invoked for each element in `array` to generate the criterion by which 36027 * the value is ranked. The iteratee is invoked with one argument: (value). 36028 * 36029 * @static 36030 * @memberOf _ 36031 * @since 4.0.0 36032 * @category Math 36033 * @param {Array} array The array to iterate over. 36034 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 36035 * @returns {*} Returns the maximum value. 36036 * @example 36037 * 36038 * var objects = [{ 'n': 1 }, { 'n': 2 }]; 36039 * 36040 * _.maxBy(objects, function(o) { return o.n; }); 36041 * // => { 'n': 2 } 36042 * 36043 * // The `_.property` iteratee shorthand. 36044 * _.maxBy(objects, 'n'); 36045 * // => { 'n': 2 } 36046 */ 36047 function maxBy(array, iteratee) { 36048 return (array && array.length) 36049 ? baseExtremum(array, getIteratee(iteratee, 2), baseGt) 36050 : undefined; 36051 } 36052 36053 /** 36054 * Computes the mean of the values in `array`. 36055 * 36056 * @static 36057 * @memberOf _ 36058 * @since 4.0.0 36059 * @category Math 36060 * @param {Array} array The array to iterate over. 36061 * @returns {number} Returns the mean. 36062 * @example 36063 * 36064 * _.mean([4, 2, 8, 6]); 36065 * // => 5 36066 */ 36067 function mean(array) { 36068 return baseMean(array, identity); 36069 } 36070 36071 /** 36072 * This method is like `_.mean` except that it accepts `iteratee` which is 36073 * invoked for each element in `array` to generate the value to be averaged. 36074 * The iteratee is invoked with one argument: (value). 36075 * 36076 * @static 36077 * @memberOf _ 36078 * @since 4.7.0 36079 * @category Math 36080 * @param {Array} array The array to iterate over. 36081 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 36082 * @returns {number} Returns the mean. 36083 * @example 36084 * 36085 * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; 36086 * 36087 * _.meanBy(objects, function(o) { return o.n; }); 36088 * // => 5 36089 * 36090 * // The `_.property` iteratee shorthand. 36091 * _.meanBy(objects, 'n'); 36092 * // => 5 36093 */ 36094 function meanBy(array, iteratee) { 36095 return baseMean(array, getIteratee(iteratee, 2)); 36096 } 36097 36098 /** 36099 * Computes the minimum value of `array`. If `array` is empty or falsey, 36100 * `undefined` is returned. 36101 * 36102 * @static 36103 * @since 0.1.0 36104 * @memberOf _ 36105 * @category Math 36106 * @param {Array} array The array to iterate over. 36107 * @returns {*} Returns the minimum value. 36108 * @example 36109 * 36110 * _.min([4, 2, 8, 6]); 36111 * // => 2 36112 * 36113 * _.min([]); 36114 * // => undefined 36115 */ 36116 function min(array) { 36117 return (array && array.length) 36118 ? baseExtremum(array, identity, baseLt) 36119 : undefined; 36120 } 36121 36122 /** 36123 * This method is like `_.min` except that it accepts `iteratee` which is 36124 * invoked for each element in `array` to generate the criterion by which 36125 * the value is ranked. The iteratee is invoked with one argument: (value). 36126 * 36127 * @static 36128 * @memberOf _ 36129 * @since 4.0.0 36130 * @category Math 36131 * @param {Array} array The array to iterate over. 36132 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 36133 * @returns {*} Returns the minimum value. 36134 * @example 36135 * 36136 * var objects = [{ 'n': 1 }, { 'n': 2 }]; 36137 * 36138 * _.minBy(objects, function(o) { return o.n; }); 36139 * // => { 'n': 1 } 36140 * 36141 * // The `_.property` iteratee shorthand. 36142 * _.minBy(objects, 'n'); 36143 * // => { 'n': 1 } 36144 */ 36145 function minBy(array, iteratee) { 36146 return (array && array.length) 36147 ? baseExtremum(array, getIteratee(iteratee, 2), baseLt) 36148 : undefined; 36149 } 36150 36151 /** 36152 * Multiply two numbers. 36153 * 36154 * @static 36155 * @memberOf _ 36156 * @since 4.7.0 36157 * @category Math 36158 * @param {number} multiplier The first number in a multiplication. 36159 * @param {number} multiplicand The second number in a multiplication. 36160 * @returns {number} Returns the product. 36161 * @example 36162 * 36163 * _.multiply(6, 4); 36164 * // => 24 36165 */ 36166 var multiply = createMathOperation(function(multiplier, multiplicand) { 36167 return multiplier * multiplicand; 36168 }, 1); 36169 36170 /** 36171 * Computes `number` rounded to `precision`. 36172 * 36173 * @static 36174 * @memberOf _ 36175 * @since 3.10.0 36176 * @category Math 36177 * @param {number} number The number to round. 36178 * @param {number} [precision=0] The precision to round to. 36179 * @returns {number} Returns the rounded number. 36180 * @example 36181 * 36182 * _.round(4.006); 36183 * // => 4 36184 * 36185 * _.round(4.006, 2); 36186 * // => 4.01 36187 * 36188 * _.round(4060, -2); 36189 * // => 4100 36190 */ 36191 var round = createRound('round'); 36192 36193 /** 36194 * Subtract two numbers. 36195 * 36196 * @static 36197 * @memberOf _ 36198 * @since 4.0.0 36199 * @category Math 36200 * @param {number} minuend The first number in a subtraction. 36201 * @param {number} subtrahend The second number in a subtraction. 36202 * @returns {number} Returns the difference. 36203 * @example 36204 * 36205 * _.subtract(6, 4); 36206 * // => 2 36207 */ 36208 var subtract = createMathOperation(function(minuend, subtrahend) { 36209 return minuend - subtrahend; 36210 }, 0); 36211 36212 /** 36213 * Computes the sum of the values in `array`. 36214 * 36215 * @static 36216 * @memberOf _ 36217 * @since 3.4.0 36218 * @category Math 36219 * @param {Array} array The array to iterate over. 36220 * @returns {number} Returns the sum. 36221 * @example 36222 * 36223 * _.sum([4, 2, 8, 6]); 36224 * // => 20 36225 */ 36226 function sum(array) { 36227 return (array && array.length) 36228 ? baseSum(array, identity) 36229 : 0; 36230 } 36231 36232 /** 36233 * This method is like `_.sum` except that it accepts `iteratee` which is 36234 * invoked for each element in `array` to generate the value to be summed. 36235 * The iteratee is invoked with one argument: (value). 36236 * 36237 * @static 36238 * @memberOf _ 36239 * @since 4.0.0 36240 * @category Math 36241 * @param {Array} array The array to iterate over. 36242 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 36243 * @returns {number} Returns the sum. 36244 * @example 36245 * 36246 * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; 36247 * 36248 * _.sumBy(objects, function(o) { return o.n; }); 36249 * // => 20 36250 * 36251 * // The `_.property` iteratee shorthand. 36252 * _.sumBy(objects, 'n'); 36253 * // => 20 36254 */ 36255 function sumBy(array, iteratee) { 36256 return (array && array.length) 36257 ? baseSum(array, getIteratee(iteratee, 2)) 36258 : 0; 36259 } 36260 36261 /*------------------------------------------------------------------------*/ 36262 36263 // Add methods that return wrapped values in chain sequences. 36264 lodash.after = after; 36265 lodash.ary = ary; 36266 lodash.assign = assign; 36267 lodash.assignIn = assignIn; 36268 lodash.assignInWith = assignInWith; 36269 lodash.assignWith = assignWith; 36270 lodash.at = at; 36271 lodash.before = before; 36272 lodash.bind = bind; 36273 lodash.bindAll = bindAll; 36274 lodash.bindKey = bindKey; 36275 lodash.castArray = castArray; 36276 lodash.chain = chain; 36277 lodash.chunk = chunk; 36278 lodash.compact = compact; 36279 lodash.concat = concat; 36280 lodash.cond = cond; 36281 lodash.conforms = conforms; 36282 lodash.constant = constant; 36283 lodash.countBy = countBy; 36284 lodash.create = create; 36285 lodash.curry = curry; 36286 lodash.curryRight = curryRight; 36287 lodash.debounce = debounce; 36288 lodash.defaults = defaults; 36289 lodash.defaultsDeep = defaultsDeep; 36290 lodash.defer = defer; 36291 lodash.delay = delay; 36292 lodash.difference = difference; 36293 lodash.differenceBy = differenceBy; 36294 lodash.differenceWith = differenceWith; 36295 lodash.drop = drop; 36296 lodash.dropRight = dropRight; 36297 lodash.dropRightWhile = dropRightWhile; 36298 lodash.dropWhile = dropWhile; 36299 lodash.fill = fill; 36300 lodash.filter = filter; 36301 lodash.flatMap = flatMap; 36302 lodash.flatMapDeep = flatMapDeep; 36303 lodash.flatMapDepth = flatMapDepth; 36304 lodash.flatten = flatten; 36305 lodash.flattenDeep = flattenDeep; 36306 lodash.flattenDepth = flattenDepth; 36307 lodash.flip = flip; 36308 lodash.flow = flow; 36309 lodash.flowRight = flowRight; 36310 lodash.fromPairs = fromPairs; 36311 lodash.functions = functions; 36312 lodash.functionsIn = functionsIn; 36313 lodash.groupBy = groupBy; 36314 lodash.initial = initial; 36315 lodash.intersection = intersection; 36316 lodash.intersectionBy = intersectionBy; 36317 lodash.intersectionWith = intersectionWith; 36318 lodash.invert = invert; 36319 lodash.invertBy = invertBy; 36320 lodash.invokeMap = invokeMap; 36321 lodash.iteratee = iteratee; 36322 lodash.keyBy = keyBy; 36323 lodash.keys = keys; 36324 lodash.keysIn = keysIn; 36325 lodash.map = map; 36326 lodash.mapKeys = mapKeys; 36327 lodash.mapValues = mapValues; 36328 lodash.matches = matches; 36329 lodash.matchesProperty = matchesProperty; 36330 lodash.memoize = memoize; 36331 lodash.merge = merge; 36332 lodash.mergeWith = mergeWith; 36333 lodash.method = method; 36334 lodash.methodOf = methodOf; 36335 lodash.mixin = mixin; 36336 lodash.negate = negate; 36337 lodash.nthArg = nthArg; 36338 lodash.omit = omit; 36339 lodash.omitBy = omitBy; 36340 lodash.once = once; 36341 lodash.orderBy = orderBy; 36342 lodash.over = over; 36343 lodash.overArgs = overArgs; 36344 lodash.overEvery = overEvery; 36345 lodash.overSome = overSome; 36346 lodash.partial = partial; 36347 lodash.partialRight = partialRight; 36348 lodash.partition = partition; 36349 lodash.pick = pick; 36350 lodash.pickBy = pickBy; 36351 lodash.property = property; 36352 lodash.propertyOf = propertyOf; 36353 lodash.pull = pull; 36354 lodash.pullAll = pullAll; 36355 lodash.pullAllBy = pullAllBy; 36356 lodash.pullAllWith = pullAllWith; 36357 lodash.pullAt = pullAt; 36358 lodash.range = range; 36359 lodash.rangeRight = rangeRight; 36360 lodash.rearg = rearg; 36361 lodash.reject = reject; 36362 lodash.remove = remove; 36363 lodash.rest = rest; 36364 lodash.reverse = reverse; 36365 lodash.sampleSize = sampleSize; 36366 lodash.set = set; 36367 lodash.setWith = setWith; 36368 lodash.shuffle = shuffle; 36369 lodash.slice = slice; 36370 lodash.sortBy = sortBy; 36371 lodash.sortedUniq = sortedUniq; 36372 lodash.sortedUniqBy = sortedUniqBy; 36373 lodash.split = split; 36374 lodash.spread = spread; 36375 lodash.tail = tail; 36376 lodash.take = take; 36377 lodash.takeRight = takeRight; 36378 lodash.takeRightWhile = takeRightWhile; 36379 lodash.takeWhile = takeWhile; 36380 lodash.tap = tap; 36381 lodash.throttle = throttle; 36382 lodash.thru = thru; 36383 lodash.toArray = toArray; 36384 lodash.toPairs = toPairs; 36385 lodash.toPairsIn = toPairsIn; 36386 lodash.toPath = toPath; 36387 lodash.toPlainObject = toPlainObject; 36388 lodash.transform = transform; 36389 lodash.unary = unary; 36390 lodash.union = union; 36391 lodash.unionBy = unionBy; 36392 lodash.unionWith = unionWith; 36393 lodash.uniq = uniq; 36394 lodash.uniqBy = uniqBy; 36395 lodash.uniqWith = uniqWith; 36396 lodash.unset = unset; 36397 lodash.unzip = unzip; 36398 lodash.unzipWith = unzipWith; 36399 lodash.update = update; 36400 lodash.updateWith = updateWith; 36401 lodash.values = values; 36402 lodash.valuesIn = valuesIn; 36403 lodash.without = without; 36404 lodash.words = words; 36405 lodash.wrap = wrap; 36406 lodash.xor = xor; 36407 lodash.xorBy = xorBy; 36408 lodash.xorWith = xorWith; 36409 lodash.zip = zip; 36410 lodash.zipObject = zipObject; 36411 lodash.zipObjectDeep = zipObjectDeep; 36412 lodash.zipWith = zipWith; 36413 36414 // Add aliases. 36415 lodash.entries = toPairs; 36416 lodash.entriesIn = toPairsIn; 36417 lodash.extend = assignIn; 36418 lodash.extendWith = assignInWith; 36419 36420 // Add methods to `lodash.prototype`. 36421 mixin(lodash, lodash); 36422 36423 /*------------------------------------------------------------------------*/ 36424 36425 // Add methods that return unwrapped values in chain sequences. 36426 lodash.add = add; 36427 lodash.attempt = attempt; 36428 lodash.camelCase = camelCase; 36429 lodash.capitalize = capitalize; 36430 lodash.ceil = ceil; 36431 lodash.clamp = clamp; 36432 lodash.clone = clone; 36433 lodash.cloneDeep = cloneDeep; 36434 lodash.cloneDeepWith = cloneDeepWith; 36435 lodash.cloneWith = cloneWith; 36436 lodash.conformsTo = conformsTo; 36437 lodash.deburr = deburr; 36438 lodash.defaultTo = defaultTo; 36439 lodash.divide = divide; 36440 lodash.endsWith = endsWith; 36441 lodash.eq = eq; 36442 lodash.escape = escape; 36443 lodash.escapeRegExp = escapeRegExp; 36444 lodash.every = every; 36445 lodash.find = find; 36446 lodash.findIndex = findIndex; 36447 lodash.findKey = findKey; 36448 lodash.findLast = findLast; 36449 lodash.findLastIndex = findLastIndex; 36450 lodash.findLastKey = findLastKey; 36451 lodash.floor = floor; 36452 lodash.forEach = forEach; 36453 lodash.forEachRight = forEachRight; 36454 lodash.forIn = forIn; 36455 lodash.forInRight = forInRight; 36456 lodash.forOwn = forOwn; 36457 lodash.forOwnRight = forOwnRight; 36458 lodash.get = get; 36459 lodash.gt = gt; 36460 lodash.gte = gte; 36461 lodash.has = has; 36462 lodash.hasIn = hasIn; 36463 lodash.head = head; 36464 lodash.identity = identity; 36465 lodash.includes = includes; 36466 lodash.indexOf = indexOf; 36467 lodash.inRange = inRange; 36468 lodash.invoke = invoke; 36469 lodash.isArguments = isArguments; 36470 lodash.isArray = isArray; 36471 lodash.isArrayBuffer = isArrayBuffer; 36472 lodash.isArrayLike = isArrayLike; 36473 lodash.isArrayLikeObject = isArrayLikeObject; 36474 lodash.isBoolean = isBoolean; 36475 lodash.isBuffer = isBuffer; 36476 lodash.isDate = isDate; 36477 lodash.isElement = isElement; 36478 lodash.isEmpty = isEmpty; 36479 lodash.isEqual = isEqual; 36480 lodash.isEqualWith = isEqualWith; 36481 lodash.isError = isError; 36482 lodash.isFinite = isFinite; 36483 lodash.isFunction = isFunction; 36484 lodash.isInteger = isInteger; 36485 lodash.isLength = isLength; 36486 lodash.isMap = isMap; 36487 lodash.isMatch = isMatch; 36488 lodash.isMatchWith = isMatchWith; 36489 lodash.isNaN = isNaN; 36490 lodash.isNative = isNative; 36491 lodash.isNil = isNil; 36492 lodash.isNull = isNull; 36493 lodash.isNumber = isNumber; 36494 lodash.isObject = isObject; 36495 lodash.isObjectLike = isObjectLike; 36496 lodash.isPlainObject = isPlainObject; 36497 lodash.isRegExp = isRegExp; 36498 lodash.isSafeInteger = isSafeInteger; 36499 lodash.isSet = isSet; 36500 lodash.isString = isString; 36501 lodash.isSymbol = isSymbol; 36502 lodash.isTypedArray = isTypedArray; 36503 lodash.isUndefined = isUndefined; 36504 lodash.isWeakMap = isWeakMap; 36505 lodash.isWeakSet = isWeakSet; 36506 lodash.join = join; 36507 lodash.kebabCase = kebabCase; 36508 lodash.last = last; 36509 lodash.lastIndexOf = lastIndexOf; 36510 lodash.lowerCase = lowerCase; 36511 lodash.lowerFirst = lowerFirst; 36512 lodash.lt = lt; 36513 lodash.lte = lte; 36514 lodash.max = max; 36515 lodash.maxBy = maxBy; 36516 lodash.mean = mean; 36517 lodash.meanBy = meanBy; 36518 lodash.min = min; 36519 lodash.minBy = minBy; 36520 lodash.stubArray = stubArray; 36521 lodash.stubFalse = stubFalse; 36522 lodash.stubObject = stubObject; 36523 lodash.stubString = stubString; 36524 lodash.stubTrue = stubTrue; 36525 lodash.multiply = multiply; 36526 lodash.nth = nth; 36527 lodash.noConflict = noConflict; 36528 lodash.noop = noop; 36529 lodash.now = now; 36530 lodash.pad = pad; 36531 lodash.padEnd = padEnd; 36532 lodash.padStart = padStart; 36533 lodash.parseInt = parseInt; 36534 lodash.random = random; 36535 lodash.reduce = reduce; 36536 lodash.reduceRight = reduceRight; 36537 lodash.repeat = repeat; 36538 lodash.replace = replace; 36539 lodash.result = result; 36540 lodash.round = round; 36541 lodash.runInContext = runInContext; 36542 lodash.sample = sample; 36543 lodash.size = size; 36544 lodash.snakeCase = snakeCase; 36545 lodash.some = some; 36546 lodash.sortedIndex = sortedIndex; 36547 lodash.sortedIndexBy = sortedIndexBy; 36548 lodash.sortedIndexOf = sortedIndexOf; 36549 lodash.sortedLastIndex = sortedLastIndex; 36550 lodash.sortedLastIndexBy = sortedLastIndexBy; 36551 lodash.sortedLastIndexOf = sortedLastIndexOf; 36552 lodash.startCase = startCase; 36553 lodash.startsWith = startsWith; 36554 lodash.subtract = subtract; 36555 lodash.sum = sum; 36556 lodash.sumBy = sumBy; 36557 lodash.template = template; 36558 lodash.times = times; 36559 lodash.toFinite = toFinite; 36560 lodash.toInteger = toInteger; 36561 lodash.toLength = toLength; 36562 lodash.toLower = toLower; 36563 lodash.toNumber = toNumber; 36564 lodash.toSafeInteger = toSafeInteger; 36565 lodash.toString = toString; 36566 lodash.toUpper = toUpper; 36567 lodash.trim = trim; 36568 lodash.trimEnd = trimEnd; 36569 lodash.trimStart = trimStart; 36570 lodash.truncate = truncate; 36571 lodash.unescape = unescape; 36572 lodash.uniqueId = uniqueId; 36573 lodash.upperCase = upperCase; 36574 lodash.upperFirst = upperFirst; 36575 36576 // Add aliases. 36577 lodash.each = forEach; 36578 lodash.eachRight = forEachRight; 36579 lodash.first = head; 36580 36581 mixin(lodash, (function() { 36582 var source = {}; 36583 baseForOwn(lodash, function(func, methodName) { 36584 if (!hasOwnProperty.call(lodash.prototype, methodName)) { 36585 source[methodName] = func; 36586 } 36587 }); 36588 return source; 36589 }()), { 'chain': false }); 36590 36591 /*------------------------------------------------------------------------*/ 36592 36593 /** 36594 * The semantic version number. 36595 * 36596 * @static 36597 * @memberOf _ 36598 * @type {string} 36599 */ 36600 lodash.VERSION = VERSION; 36601 36602 // Assign default placeholders. 36603 arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) { 36604 lodash[methodName].placeholder = lodash; 36605 }); 36606 36607 // Add `LazyWrapper` methods for `_.drop` and `_.take` variants. 36608 arrayEach(['drop', 'take'], function(methodName, index) { 36609 LazyWrapper.prototype[methodName] = function(n) { 36610 n = n === undefined ? 1 : nativeMax(toInteger(n), 0); 36611 36612 var result = (this.__filtered__ && !index) 36613 ? new LazyWrapper(this) 36614 : this.clone(); 36615 36616 if (result.__filtered__) { 36617 result.__takeCount__ = nativeMin(n, result.__takeCount__); 36618 } else { 36619 result.__views__.push({ 36620 'size': nativeMin(n, MAX_ARRAY_LENGTH), 36621 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') 36622 }); 36623 } 36624 return result; 36625 }; 36626 36627 LazyWrapper.prototype[methodName + 'Right'] = function(n) { 36628 return this.reverse()[methodName](n).reverse(); 36629 }; 36630 }); 36631 36632 // Add `LazyWrapper` methods that accept an `iteratee` value. 36633 arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) { 36634 var type = index + 1, 36635 isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; 36636 36637 LazyWrapper.prototype[methodName] = function(iteratee) { 36638 var result = this.clone(); 36639 result.__iteratees__.push({ 36640 'iteratee': getIteratee(iteratee, 3), 36641 'type': type 36642 }); 36643 result.__filtered__ = result.__filtered__ || isFilter; 36644 return result; 36645 }; 36646 }); 36647 36648 // Add `LazyWrapper` methods for `_.head` and `_.last`. 36649 arrayEach(['head', 'last'], function(methodName, index) { 36650 var takeName = 'take' + (index ? 'Right' : ''); 36651 36652 LazyWrapper.prototype[methodName] = function() { 36653 return this[takeName](1).value()[0]; 36654 }; 36655 }); 36656 36657 // Add `LazyWrapper` methods for `_.initial` and `_.tail`. 36658 arrayEach(['initial', 'tail'], function(methodName, index) { 36659 var dropName = 'drop' + (index ? '' : 'Right'); 36660 36661 LazyWrapper.prototype[methodName] = function() { 36662 return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); 36663 }; 36664 }); 36665 36666 LazyWrapper.prototype.compact = function() { 36667 return this.filter(identity); 36668 }; 36669 36670 LazyWrapper.prototype.find = function(predicate) { 36671 return this.filter(predicate).head(); 36672 }; 36673 36674 LazyWrapper.prototype.findLast = function(predicate) { 36675 return this.reverse().find(predicate); 36676 }; 36677 36678 LazyWrapper.prototype.invokeMap = baseRest(function(path, args) { 36679 if (typeof path == 'function') { 36680 return new LazyWrapper(this); 36681 } 36682 return this.map(function(value) { 36683 return baseInvoke(value, path, args); 36684 }); 36685 }); 36686 36687 LazyWrapper.prototype.reject = function(predicate) { 36688 return this.filter(negate(getIteratee(predicate))); 36689 }; 36690 36691 LazyWrapper.prototype.slice = function(start, end) { 36692 start = toInteger(start); 36693 36694 var result = this; 36695 if (result.__filtered__ && (start > 0 || end < 0)) { 36696 return new LazyWrapper(result); 36697 } 36698 if (start < 0) { 36699 result = result.takeRight(-start); 36700 } else if (start) { 36701 result = result.drop(start); 36702 } 36703 if (end !== undefined) { 36704 end = toInteger(end); 36705 result = end < 0 ? result.dropRight(-end) : result.take(end - start); 36706 } 36707 return result; 36708 }; 36709 36710 LazyWrapper.prototype.takeRightWhile = function(predicate) { 36711 return this.reverse().takeWhile(predicate).reverse(); 36712 }; 36713 36714 LazyWrapper.prototype.toArray = function() { 36715 return this.take(MAX_ARRAY_LENGTH); 36716 }; 36717 36718 // Add `LazyWrapper` methods to `lodash.prototype`. 36719 baseForOwn(LazyWrapper.prototype, function(func, methodName) { 36720 var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), 36721 isTaker = /^(?:head|last)$/.test(methodName), 36722 lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName], 36723 retUnwrapped = isTaker || /^find/.test(methodName); 36724 36725 if (!lodashFunc) { 36726 return; 36727 } 36728 lodash.prototype[methodName] = function() { 36729 var value = this.__wrapped__, 36730 args = isTaker ? [1] : arguments, 36731 isLazy = value instanceof LazyWrapper, 36732 iteratee = args[0], 36733 useLazy = isLazy || isArray(value); 36734 36735 var interceptor = function(value) { 36736 var result = lodashFunc.apply(lodash, arrayPush([value], args)); 36737 return (isTaker && chainAll) ? result[0] : result; 36738 }; 36739 36740 if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) { 36741 // Avoid lazy use if the iteratee has a "length" value other than `1`. 36742 isLazy = useLazy = false; 36743 } 36744 var chainAll = this.__chain__, 36745 isHybrid = !!this.__actions__.length, 36746 isUnwrapped = retUnwrapped && !chainAll, 36747 onlyLazy = isLazy && !isHybrid; 36748 36749 if (!retUnwrapped && useLazy) { 36750 value = onlyLazy ? value : new LazyWrapper(this); 36751 var result = func.apply(value, args); 36752 result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); 36753 return new LodashWrapper(result, chainAll); 36754 } 36755 if (isUnwrapped && onlyLazy) { 36756 return func.apply(this, args); 36757 } 36758 result = this.thru(interceptor); 36759 return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result; 36760 }; 36761 }); 36762 36763 // Add `Array` methods to `lodash.prototype`. 36764 arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { 36765 var func = arrayProto[methodName], 36766 chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', 36767 retUnwrapped = /^(?:pop|shift)$/.test(methodName); 36768 36769 lodash.prototype[methodName] = function() { 36770 var args = arguments; 36771 if (retUnwrapped && !this.__chain__) { 36772 var value = this.value(); 36773 return func.apply(isArray(value) ? value : [], args); 36774 } 36775 return this[chainName](function(value) { 36776 return func.apply(isArray(value) ? value : [], args); 36777 }); 36778 }; 36779 }); 36780 36781 // Map minified method names to their real names. 36782 baseForOwn(LazyWrapper.prototype, function(func, methodName) { 36783 var lodashFunc = lodash[methodName]; 36784 if (lodashFunc) { 36785 var key = lodashFunc.name + ''; 36786 if (!hasOwnProperty.call(realNames, key)) { 36787 realNames[key] = []; 36788 } 36789 realNames[key].push({ 'name': methodName, 'func': lodashFunc }); 36790 } 36791 }); 36792 36793 realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{ 36794 'name': 'wrapper', 36795 'func': undefined 36796 }]; 36797 36798 // Add methods to `LazyWrapper`. 36799 LazyWrapper.prototype.clone = lazyClone; 36800 LazyWrapper.prototype.reverse = lazyReverse; 36801 LazyWrapper.prototype.value = lazyValue; 36802 36803 // Add chain sequence methods to the `lodash` wrapper. 36804 lodash.prototype.at = wrapperAt; 36805 lodash.prototype.chain = wrapperChain; 36806 lodash.prototype.commit = wrapperCommit; 36807 lodash.prototype.next = wrapperNext; 36808 lodash.prototype.plant = wrapperPlant; 36809 lodash.prototype.reverse = wrapperReverse; 36810 lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue; 36811 36812 // Add lazy aliases. 36813 lodash.prototype.first = lodash.prototype.head; 36814 36815 if (symIterator) { 36816 lodash.prototype[symIterator] = wrapperToIterator; 36817 } 36818 return lodash; 36819 }); 36820 36821 /*--------------------------------------------------------------------------*/ 36822 36823 // Export lodash. 36824 var _ = runInContext(); 36825 36826 // Some AMD build optimizers, like r.js, check for condition patterns like: 36827 if (true) { 36828 // Expose Lodash on the global object to prevent errors when Lodash is 36829 // loaded by a script tag in the presence of an AMD loader. 36830 // See http://requirejs.org/docs/errors.html#mismatch for more details. 36831 // Use `_.noConflict` to remove Lodash from the global object. 36832 root._ = _; 36833 36834 // Define as an anonymous module so, through path mapping, it can be 36835 // referenced as the "underscore" module. 36836 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { 36837 return _; 36838 }).call(exports, __webpack_require__, exports, module), 36839 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 36840 } 36841 // Check for `exports` after `define` in case a build optimizer adds it. 36842 else {} 36843}.call(this)); 36844 36845 36846/***/ }), 36847
36848/***/ "./resources/assets/sass/app.scss": 36849/*!****************************************!*\ 36850 !*** ./resources/assets/sass/app.scss ***! 36851 \****************************************/ 36852/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 36853 36854"use strict"; 36855__webpack_require__.r(__webpack_exports__); 36856// extracted by mini-css-extract-plugin 36857 36858 36859/***/ }), 36860
vendor: 89,083 bytes, lines 36861-39491
36861/***/ "./node_modules/popper.js/dist/esm/popper.js": 36862/*!***************************************************!*\ 36863 !*** ./node_modules/popper.js/dist/esm/popper.js ***! 36864 \***************************************************/ 36865/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 36866 36867"use strict"; 36868__webpack_require__.r(__webpack_exports__); 36869/* harmony export */ __webpack_require__.d(__webpack_exports__, { 36870/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 36871/* harmony export */ }); 36872/**! 36873 * @fileOverview Kickass library to create and place poppers near their reference elements. 36874 * @version 1.16.1 36875 * @license 36876 * Copyright (c) 2016 Federico Zivolo and contributors 36877 * 36878 * Permission is hereby granted, free of charge, to any person obtaining a copy 36879 * of this software and associated documentation files (the "Software"), to deal 36880 * in the Software without restriction, including without limitation the rights 36881 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 36882 * copies of the Software, and to permit persons to whom the Software is 36883 * furnished to do so, subject to the following conditions: 36884 * 36885 * The above copyright notice and this permission notice shall be included in all 36886 * copies or substantial portions of the Software. 36887 * 36888 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 36889 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 36890 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 36891 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 36892 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36893 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36894 * SOFTWARE. 36895 */ 36896var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined'; 36897 36898var timeoutDuration = function () { 36899 var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox']; 36900 for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) { 36901 if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) { 36902 return 1; 36903 } 36904 } 36905 return 0; 36906}(); 36907 36908function microtaskDebounce(fn) { 36909 var called = false; 36910 return function () { 36911 if (called) { 36912 return; 36913 } 36914 called = true; 36915 window.Promise.resolve().then(function () { 36916 called = false; 36917 fn(); 36918 }); 36919 }; 36920} 36921 36922function taskDebounce(fn) { 36923 var scheduled = false; 36924 return function () { 36925 if (!scheduled) { 36926 scheduled = true; 36927 setTimeout(function () { 36928 scheduled = false; 36929 fn(); 36930 }, timeoutDuration); 36931 } 36932 }; 36933} 36934 36935var supportsMicroTasks = isBrowser && window.Promise; 36936 36937/** 36938* Create a debounced version of a method, that's asynchronously deferred 36939* but called in the minimum time possible. 36940* 36941* @method 36942* @memberof Popper.Utils 36943* @argument {Function} fn 36944* @returns {Function} 36945*/ 36946var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce; 36947 36948/** 36949 * Check if the given variable is a function 36950 * @method 36951 * @memberof Popper.Utils 36952 * @argument {Any} functionToCheck - variable to check 36953 * @returns {Boolean} answer to: is a function? 36954 */ 36955function isFunction(functionToCheck) { 36956 var getType = {}; 36957 return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; 36958} 36959 36960/** 36961 * Get CSS computed property of the given element 36962 * @method 36963 * @memberof Popper.Utils 36964 * @argument {Eement} element 36965 * @argument {String} property 36966 */ 36967function getStyleComputedProperty(element, property) { 36968 if (element.nodeType !== 1) { 36969 return []; 36970 } 36971 // NOTE: 1 DOM access here 36972 var window = element.ownerDocument.defaultView; 36973 var css = window.getComputedStyle(element, null); 36974 return property ? css[property] : css; 36975} 36976 36977/** 36978 * Returns the parentNode or the host of the element 36979 * @method 36980 * @memberof Popper.Utils 36981 * @argument {Element} element 36982 * @returns {Element} parent 36983 */ 36984function getParentNode(element) { 36985 if (element.nodeName === 'HTML') { 36986 return element; 36987 } 36988 return element.parentNode || element.host; 36989} 36990 36991/** 36992 * Returns the scrolling parent of the given element 36993 * @method 36994 * @memberof Popper.Utils 36995 * @argument {Element} element 36996 * @returns {Element} scroll parent 36997 */ 36998function getScrollParent(element) { 36999 // Return body, `getScroll` will take care to get the correct `scrollTop` from it 37000 if (!element) { 37001 return document.body; 37002 } 37003 37004 switch (element.nodeName) { 37005 case 'HTML': 37006 case 'BODY': 37007 return element.ownerDocument.body; 37008 case '#document': 37009 return element.body; 37010 } 37011 37012 // Firefox want us to check `-x` and `-y` variations as well 37013 37014 var _getStyleComputedProp = getStyleComputedProperty(element), 37015 overflow = _getStyleComputedProp.overflow, 37016 overflowX = _getStyleComputedProp.overflowX, 37017 overflowY = _getStyleComputedProp.overflowY; 37018 37019 if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) { 37020 return element; 37021 } 37022 37023 return getScrollParent(getParentNode(element)); 37024} 37025 37026/** 37027 * Returns the reference node of the reference object, or the reference object itself. 37028 * @method 37029 * @memberof Popper.Utils 37030 * @param {Element|Object} reference - the reference element (the popper will be relative to this) 37031 * @returns {Element} parent 37032 */ 37033function getReferenceNode(reference) { 37034 return reference && reference.referenceNode ? reference.referenceNode : reference; 37035} 37036 37037var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode); 37038var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent); 37039 37040/** 37041 * Determines if the browser is Internet Explorer 37042 * @method 37043 * @memberof Popper.Utils 37044 * @param {Number} version to check 37045 * @returns {Boolean} isIE 37046 */ 37047function isIE(version) { 37048 if (version === 11) { 37049 return isIE11; 37050 } 37051 if (version === 10) { 37052 return isIE10; 37053 } 37054 return isIE11 || isIE10; 37055} 37056 37057/** 37058 * Returns the offset parent of the given element 37059 * @method 37060 * @memberof Popper.Utils 37061 * @argument {Element} element 37062 * @returns {Element} offset parent 37063 */ 37064function getOffsetParent(element) { 37065 if (!element) { 37066 return document.documentElement; 37067 } 37068 37069 var noOffsetParent = isIE(10) ? document.body : null; 37070 37071 // NOTE: 1 DOM access here 37072 var offsetParent = element.offsetParent || null; 37073 // Skip hidden elements which don't have an offsetParent 37074 while (offsetParent === noOffsetParent && element.nextElementSibling) { 37075 offsetParent = (element = element.nextElementSibling).offsetParent; 37076 } 37077 37078 var nodeName = offsetParent && offsetParent.nodeName; 37079 37080 if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') { 37081 return element ? element.ownerDocument.documentElement : document.documentElement; 37082 } 37083 37084 // .offsetParent will return the closest TH, TD or TABLE in case 37085 // no offsetParent is present, I hate this job... 37086 if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') { 37087 return getOffsetParent(offsetParent); 37088 } 37089 37090 return offsetParent; 37091} 37092 37093function isOffsetContainer(element) { 37094 var nodeName = element.nodeName; 37095 37096 if (nodeName === 'BODY') { 37097 return false; 37098 } 37099 return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element; 37100} 37101 37102/** 37103 * Finds the root node (document, shadowDOM root) of the given element 37104 * @method 37105 * @memberof Popper.Utils 37106 * @argument {Element} node 37107 * @returns {Element} root node 37108 */ 37109function getRoot(node) { 37110 if (node.parentNode !== null) { 37111 return getRoot(node.parentNode); 37112 } 37113 37114 return node; 37115} 37116 37117/** 37118 * Finds the offset parent common to the two provided nodes 37119 * @method 37120 * @memberof Popper.Utils 37121 * @argument {Element} element1 37122 * @argument {Element} element2 37123 * @returns {Element} common offset parent 37124 */ 37125function findCommonOffsetParent(element1, element2) { 37126 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 37127 if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) { 37128 return document.documentElement; 37129 } 37130 37131 // Here we make sure to give as "start" the element that comes first in the DOM 37132 var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING; 37133 var start = order ? element1 : element2; 37134 var end = order ? element2 : element1; 37135 37136 // Get common ancestor container 37137 var range = document.createRange(); 37138 range.setStart(start, 0); 37139 range.setEnd(end, 0); 37140 var commonAncestorContainer = range.commonAncestorContainer; 37141 37142 // Both nodes are inside #document 37143 37144 if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) { 37145 if (isOffsetContainer(commonAncestorContainer)) { 37146 return commonAncestorContainer; 37147 } 37148 37149 return getOffsetParent(commonAncestorContainer); 37150 } 37151 37152 // one of the nodes is inside shadowDOM, find which one 37153 var element1root = getRoot(element1); 37154 if (element1root.host) { 37155 return findCommonOffsetParent(element1root.host, element2); 37156 } else { 37157 return findCommonOffsetParent(element1, getRoot(element2).host); 37158 } 37159} 37160 37161/** 37162 * Gets the scroll value of the given element in the given side (top and left) 37163 * @method 37164 * @memberof Popper.Utils 37165 * @argument {Element} element 37166 * @argument {String} side `top` or `left` 37167 * @returns {number} amount of scrolled pixels 37168 */ 37169function getScroll(element) { 37170 var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top'; 37171 37172 var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft'; 37173 var nodeName = element.nodeName; 37174 37175 if (nodeName === 'BODY' || nodeName === 'HTML') { 37176 var html = element.ownerDocument.documentElement; 37177 var scrollingElement = element.ownerDocument.scrollingElement || html; 37178 return scrollingElement[upperSide]; 37179 } 37180 37181 return element[upperSide]; 37182} 37183 37184/* 37185 * Sum or subtract the element scroll values (left and top) from a given rect object 37186 * @method 37187 * @memberof Popper.Utils 37188 * @param {Object} rect - Rect object you want to change 37189 * @param {HTMLElement} element - The element from the function reads the scroll values 37190 * @param {Boolean} subtract - set to true if you want to subtract the scroll values 37191 * @return {Object} rect - The modifier rect object 37192 */ 37193function includeScroll(rect, element) { 37194 var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 37195 37196 var scrollTop = getScroll(element, 'top'); 37197 var scrollLeft = getScroll(element, 'left'); 37198 var modifier = subtract ? -1 : 1; 37199 rect.top += scrollTop * modifier; 37200 rect.bottom += scrollTop * modifier; 37201 rect.left += scrollLeft * modifier; 37202 rect.right += scrollLeft * modifier; 37203 return rect; 37204} 37205 37206/* 37207 * Helper to detect borders of a given element 37208 * @method 37209 * @memberof Popper.Utils 37210 * @param {CSSStyleDeclaration} styles 37211 * Result of `getStyleComputedProperty` on the given element 37212 * @param {String} axis - `x` or `y` 37213 * @return {number} borders - The borders size of the given axis 37214 */ 37215 37216function getBordersSize(styles, axis) { 37217 var sideA = axis === 'x' ? 'Left' : 'Top'; 37218 var sideB = sideA === 'Left' ? 'Right' : 'Bottom'; 37219 37220 return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']); 37221} 37222 37223function getSize(axis, body, html, computedStyle) { 37224 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); 37225} 37226 37227function getWindowSizes(document) { 37228 var body = document.body; 37229 var html = document.documentElement; 37230 var computedStyle = isIE(10) && getComputedStyle(html); 37231 37232 return { 37233 height: getSize('Height', body, html, computedStyle), 37234 width: getSize('Width', body, html, computedStyle) 37235 }; 37236} 37237 37238var classCallCheck = function (instance, Constructor) { 37239 if (!(instance instanceof Constructor)) { 37240 throw new TypeError("Cannot call a class as a function"); 37241 } 37242}; 37243 37244var createClass = function () { 37245 function defineProperties(target, props) { 37246 for (var i = 0; i < props.length; i++) { 37247 var descriptor = props[i]; 37248 descriptor.enumerable = descriptor.enumerable || false; 37249 descriptor.configurable = true; 37250 if ("value" in descriptor) descriptor.writable = true; 37251 Object.defineProperty(target, descriptor.key, descriptor); 37252 } 37253 } 37254 37255 return function (Constructor, protoProps, staticProps) { 37256 if (protoProps) defineProperties(Constructor.prototype, protoProps); 37257 if (staticProps) defineProperties(Constructor, staticProps); 37258 return Constructor; 37259 }; 37260}(); 37261 37262 37263 37264 37265 37266var defineProperty = function (obj, key, value) { 37267 if (key in obj) { 37268 Object.defineProperty(obj, key, { 37269 value: value, 37270 enumerable: true, 37271 configurable: true, 37272 writable: true 37273 }); 37274 } else { 37275 obj[key] = value; 37276 } 37277 37278 return obj; 37279}; 37280 37281var _extends = Object.assign || function (target) { 37282 for (var i = 1; i < arguments.length; i++) { 37283 var source = arguments[i]; 37284 37285 for (var key in source) { 37286 if (Object.prototype.hasOwnProperty.call(source, key)) { 37287 target[key] = source[key]; 37288 } 37289 } 37290 } 37291 37292 return target; 37293}; 37294 37295/** 37296 * Given element offsets, generate an output similar to getBoundingClientRect 37297 * @method 37298 * @memberof Popper.Utils 37299 * @argument {Object} offsets 37300 * @returns {Object} ClientRect like output 37301 */ 37302function getClientRect(offsets) { 37303 return _extends({}, offsets, { 37304 right: offsets.left + offsets.width, 37305 bottom: offsets.top + offsets.height 37306 }); 37307} 37308 37309/** 37310 * Get bounding client rect of given element 37311 * @method 37312 * @memberof Popper.Utils 37313 * @param {HTMLElement} element 37314 * @return {Object} client rect 37315 */ 37316function getBoundingClientRect(element) { 37317 var rect = {}; 37318 37319 // IE10 10 FIX: Please, don't ask, the element isn't 37320 // considered in DOM in some circumstances... 37321 // This isn't reproducible in IE10 compatibility mode of IE11 37322 try { 37323 if (isIE(10)) { 37324 rect = element.getBoundingClientRect(); 37325 var scrollTop = getScroll(element, 'top'); 37326 var scrollLeft = getScroll(element, 'left'); 37327 rect.top += scrollTop; 37328 rect.left += scrollLeft; 37329 rect.bottom += scrollTop; 37330 rect.right += scrollLeft; 37331 } else { 37332 rect = element.getBoundingClientRect(); 37333 } 37334 } catch (e) {} 37335 37336 var result = { 37337 left: rect.left, 37338 top: rect.top, 37339 width: rect.right - rect.left, 37340 height: rect.bottom - rect.top 37341 }; 37342 37343 // subtract scrollbar size from sizes 37344 var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {}; 37345 var width = sizes.width || element.clientWidth || result.width; 37346 var height = sizes.height || element.clientHeight || result.height; 37347 37348 var horizScrollbar = element.offsetWidth - width; 37349 var vertScrollbar = element.offsetHeight - height; 37350 37351 // if an hypothetical scrollbar is detected, we must be sure it's not a `border` 37352 // we make this check conditional for performance reasons 37353 if (horizScrollbar || vertScrollbar) { 37354 var styles = getStyleComputedProperty(element); 37355 horizScrollbar -= getBordersSize(styles, 'x'); 37356 vertScrollbar -= getBordersSize(styles, 'y'); 37357 37358 result.width -= horizScrollbar; 37359 result.height -= vertScrollbar; 37360 } 37361 37362 return getClientRect(result); 37363} 37364 37365function getOffsetRectRelativeToArbitraryNode(children, parent) { 37366 var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 37367 37368 var isIE10 = isIE(10); 37369 var isHTML = parent.nodeName === 'HTML'; 37370 var childrenRect = getBoundingClientRect(children); 37371 var parentRect = getBoundingClientRect(parent); 37372 var scrollParent = getScrollParent(children); 37373 37374 var styles = getStyleComputedProperty(parent); 37375 var borderTopWidth = parseFloat(styles.borderTopWidth); 37376 var borderLeftWidth = parseFloat(styles.borderLeftWidth); 37377 37378 // In cases where the parent is fixed, we must ignore negative scroll in offset calc 37379 if (fixedPosition && isHTML) { 37380 parentRect.top = Math.max(parentRect.top, 0); 37381 parentRect.left = Math.max(parentRect.left, 0); 37382 } 37383 var offsets = getClientRect({ 37384 top: childrenRect.top - parentRect.top - borderTopWidth, 37385 left: childrenRect.left - parentRect.left - borderLeftWidth, 37386 width: childrenRect.width, 37387 height: childrenRect.height 37388 }); 37389 offsets.marginTop = 0; 37390 offsets.marginLeft = 0; 37391 37392 // Subtract margins of documentElement in case it's being used as parent 37393 // we do this only on HTML because it's the only element that behaves 37394 // differently when margins are applied to it. The margins are included in 37395 // the box of the documentElement, in the other cases not. 37396 if (!isIE10 && isHTML) { 37397 var marginTop = parseFloat(styles.marginTop); 37398 var marginLeft = parseFloat(styles.marginLeft); 37399 37400 offsets.top -= borderTopWidth - marginTop; 37401 offsets.bottom -= borderTopWidth - marginTop; 37402 offsets.left -= borderLeftWidth - marginLeft; 37403 offsets.right -= borderLeftWidth - marginLeft; 37404 37405 // Attach marginTop and marginLeft because in some circumstances we may need them 37406 offsets.marginTop = marginTop; 37407 offsets.marginLeft = marginLeft; 37408 } 37409 37410 if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') { 37411 offsets = includeScroll(offsets, parent); 37412 } 37413 37414 return offsets; 37415} 37416 37417function getViewportOffsetRectRelativeToArtbitraryNode(element) { 37418 var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 37419 37420 var html = element.ownerDocument.documentElement; 37421 var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html); 37422 var width = Math.max(html.clientWidth, window.innerWidth || 0); 37423 var height = Math.max(html.clientHeight, window.innerHeight || 0); 37424 37425 var scrollTop = !excludeScroll ? getScroll(html) : 0; 37426 var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0; 37427 37428 var offset = { 37429 top: scrollTop - relativeOffset.top + relativeOffset.marginTop, 37430 left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft, 37431 width: width, 37432 height: height 37433 }; 37434 37435 return getClientRect(offset); 37436} 37437 37438/** 37439 * Check if the given element is fixed or is inside a fixed parent 37440 * @method 37441 * @memberof Popper.Utils 37442 * @argument {Element} element 37443 * @argument {Element} customContainer 37444 * @returns {Boolean} answer to "isFixed?" 37445 */ 37446function isFixed(element) { 37447 var nodeName = element.nodeName; 37448 if (nodeName === 'BODY' || nodeName === 'HTML') { 37449 return false; 37450 } 37451 if (getStyleComputedProperty(element, 'position') === 'fixed') { 37452 return true; 37453 } 37454 var parentNode = getParentNode(element); 37455 if (!parentNode) { 37456 return false; 37457 } 37458 return isFixed(parentNode); 37459} 37460 37461/** 37462 * Finds the first parent of an element that has a transformed property defined 37463 * @method 37464 * @memberof Popper.Utils 37465 * @argument {Element} element 37466 * @returns {Element} first transformed parent or documentElement 37467 */ 37468 37469function getFixedPositionOffsetParent(element) { 37470 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 37471 if (!element || !element.parentElement || isIE()) { 37472 return document.documentElement; 37473 } 37474 var el = element.parentElement; 37475 while (el && getStyleComputedProperty(el, 'transform') === 'none') { 37476 el = el.parentElement; 37477 } 37478 return el || document.documentElement; 37479} 37480 37481/** 37482 * Computed the boundaries limits and return them 37483 * @method 37484 * @memberof Popper.Utils 37485 * @param {HTMLElement} popper 37486 * @param {HTMLElement} reference 37487 * @param {number} padding 37488 * @param {HTMLElement} boundariesElement - Element used to define the boundaries 37489 * @param {Boolean} fixedPosition - Is in fixed position mode 37490 * @returns {Object} Coordinates of the boundaries 37491 */ 37492function getBoundaries(popper, reference, padding, boundariesElement) { 37493 var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; 37494 37495 // NOTE: 1 DOM access here 37496 37497 var boundaries = { top: 0, left: 0 }; 37498 var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference)); 37499 37500 // Handle viewport case 37501 if (boundariesElement === 'viewport') { 37502 boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition); 37503 } else { 37504 // Handle other cases based on DOM element used as boundaries 37505 var boundariesNode = void 0; 37506 if (boundariesElement === 'scrollParent') { 37507 boundariesNode = getScrollParent(getParentNode(reference)); 37508 if (boundariesNode.nodeName === 'BODY') { 37509 boundariesNode = popper.ownerDocument.documentElement; 37510 } 37511 } else if (boundariesElement === 'window') { 37512 boundariesNode = popper.ownerDocument.documentElement; 37513 } else { 37514 boundariesNode = boundariesElement; 37515 } 37516 37517 var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition); 37518 37519 // In case of HTML, we need a different computation 37520 if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) { 37521 var _getWindowSizes = getWindowSizes(popper.ownerDocument), 37522 height = _getWindowSizes.height, 37523 width = _getWindowSizes.width; 37524 37525 boundaries.top += offsets.top - offsets.marginTop; 37526 boundaries.bottom = height + offsets.top; 37527 boundaries.left += offsets.left - offsets.marginLeft; 37528 boundaries.right = width + offsets.left; 37529 } else { 37530 // for all the other DOM elements, this one is good 37531 boundaries = offsets; 37532 } 37533 } 37534 37535 // Add paddings 37536 padding = padding || 0; 37537 var isPaddingNumber = typeof padding === 'number'; 37538 boundaries.left += isPaddingNumber ? padding : padding.left || 0; 37539 boundaries.top += isPaddingNumber ? padding : padding.top || 0; 37540 boundaries.right -= isPaddingNumber ? padding : padding.right || 0; 37541 boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0; 37542 37543 return boundaries; 37544} 37545 37546function getArea(_ref) { 37547 var width = _ref.width, 37548 height = _ref.height; 37549 37550 return width * height; 37551} 37552 37553/** 37554 * Utility used to transform the `auto` placement to the placement with more 37555 * available space. 37556 * @method 37557 * @memberof Popper.Utils 37558 * @argument {Object} data - The data object generated by update method 37559 * @argument {Object} options - Modifiers configuration and options 37560 * @returns {Object} The data object, properly modified 37561 */ 37562function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) { 37563 var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; 37564 37565 if (placement.indexOf('auto') === -1) { 37566 return placement; 37567 } 37568 37569 var boundaries = getBoundaries(popper, reference, padding, boundariesElement); 37570 37571 var rects = { 37572 top: { 37573 width: boundaries.width, 37574 height: refRect.top - boundaries.top 37575 }, 37576 right: { 37577 width: boundaries.right - refRect.right, 37578 height: boundaries.height 37579 }, 37580 bottom: { 37581 width: boundaries.width, 37582 height: boundaries.bottom - refRect.bottom 37583 }, 37584 left: { 37585 width: refRect.left - boundaries.left, 37586 height: boundaries.height 37587 } 37588 }; 37589 37590 var sortedAreas = Object.keys(rects).map(function (key) { 37591 return _extends({ 37592 key: key 37593 }, rects[key], { 37594 area: getArea(rects[key]) 37595 }); 37596 }).sort(function (a, b) { 37597 return b.area - a.area; 37598 }); 37599 37600 var filteredAreas = sortedAreas.filter(function (_ref2) { 37601 var width = _ref2.width, 37602 height = _ref2.height; 37603 return width >= popper.clientWidth && height >= popper.clientHeight; 37604 }); 37605 37606 var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key; 37607 37608 var variation = placement.split('-')[1]; 37609 37610 return computedPlacement + (variation ? '-' + variation : ''); 37611} 37612 37613/** 37614 * Get offsets to the reference element 37615 * @method 37616 * @memberof Popper.Utils 37617 * @param {Object} state 37618 * @param {Element} popper - the popper element 37619 * @param {Element} reference - the reference element (the popper will be relative to this) 37620 * @param {Element} fixedPosition - is in fixed position mode 37621 * @returns {Object} An object containing the offsets which will be applied to the popper 37622 */ 37623function getReferenceOffsets(state, popper, reference) { 37624 var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 37625 37626 var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference)); 37627 return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition); 37628} 37629 37630/** 37631 * Get the outer sizes of the given element (offset size + margins) 37632 * @method 37633 * @memberof Popper.Utils 37634 * @argument {Element} element 37635 * @returns {Object} object containing width and height properties 37636 */ 37637function getOuterSizes(element) { 37638 var window = element.ownerDocument.defaultView; 37639 var styles = window.getComputedStyle(element); 37640 var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0); 37641 var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0); 37642 var result = { 37643 width: element.offsetWidth + y, 37644 height: element.offsetHeight + x 37645 }; 37646 return result; 37647} 37648 37649/** 37650 * Get the opposite placement of the given one 37651 * @method 37652 * @memberof Popper.Utils 37653 * @argument {String} placement 37654 * @returns {String} flipped placement 37655 */ 37656function getOppositePlacement(placement) { 37657 var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; 37658 return placement.replace(/left|right|bottom|top/g, function (matched) { 37659 return hash[matched]; 37660 }); 37661} 37662 37663/** 37664 * Get offsets to the popper 37665 * @method 37666 * @memberof Popper.Utils 37667 * @param {Object} position - CSS position the Popper will get applied 37668 * @param {HTMLElement} popper - the popper element 37669 * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this) 37670 * @param {String} placement - one of the valid placement options 37671 * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper 37672 */ 37673function getPopperOffsets(popper, referenceOffsets, placement) { 37674 placement = placement.split('-')[0]; 37675 37676 // Get popper node sizes 37677 var popperRect = getOuterSizes(popper); 37678 37679 // Add position, width and height to our offsets object 37680 var popperOffsets = { 37681 width: popperRect.width, 37682 height: popperRect.height 37683 }; 37684 37685 // depending by the popper placement we have to compute its offsets slightly differently 37686 var isHoriz = ['right', 'left'].indexOf(placement) !== -1; 37687 var mainSide = isHoriz ? 'top' : 'left'; 37688 var secondarySide = isHoriz ? 'left' : 'top'; 37689 var measurement = isHoriz ? 'height' : 'width'; 37690 var secondaryMeasurement = !isHoriz ? 'height' : 'width'; 37691 37692 popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; 37693 if (placement === secondarySide) { 37694 popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; 37695 } else { 37696 popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)]; 37697 } 37698 37699 return popperOffsets; 37700} 37701 37702/** 37703 * Mimics the `find` method of Array 37704 * @method 37705 * @memberof Popper.Utils 37706 * @argument {Array} arr 37707 * @argument prop 37708 * @argument value 37709 * @returns index or -1 37710 */ 37711function find(arr, check) { 37712 // use native find if supported 37713 if (Array.prototype.find) { 37714 return arr.find(check); 37715 } 37716 37717 // use `filter` to obtain the same behavior of `find` 37718 return arr.filter(check)[0]; 37719} 37720 37721/** 37722 * Return the index of the matching object 37723 * @method 37724 * @memberof Popper.Utils 37725 * @argument {Array} arr 37726 * @argument prop 37727 * @argument value 37728 * @returns index or -1 37729 */ 37730function findIndex(arr, prop, value) { 37731 // use native findIndex if supported 37732 if (Array.prototype.findIndex) { 37733 return arr.findIndex(function (cur) { 37734 return cur[prop] === value; 37735 }); 37736 } 37737 37738 // use `find` + `indexOf` if `findIndex` isn't supported 37739 var match = find(arr, function (obj) { 37740 return obj[prop] === value; 37741 }); 37742 return arr.indexOf(match); 37743} 37744 37745/** 37746 * Loop trough the list of modifiers and run them in order, 37747 * each of them will then edit the data object. 37748 * @method 37749 * @memberof Popper.Utils 37750 * @param {dataObject} data 37751 * @param {Array} modifiers 37752 * @param {String} ends - Optional modifier name used as stopper 37753 * @returns {dataObject} 37754 */ 37755function runModifiers(modifiers, data, ends) { 37756 var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends)); 37757 37758 modifiersToRun.forEach(function (modifier) { 37759 if (modifier['function']) { 37760 // eslint-disable-line dot-notation 37761 console.warn('`modifier.function` is deprecated, use `modifier.fn`!'); 37762 } 37763 var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation 37764 if (modifier.enabled && isFunction(fn)) { 37765 // Add properties to offsets to make them a complete clientRect object 37766 // we do this before each modifier to make sure the previous one doesn't 37767 // mess with these values 37768 data.offsets.popper = getClientRect(data.offsets.popper); 37769 data.offsets.reference = getClientRect(data.offsets.reference); 37770 37771 data = fn(data, modifier); 37772 } 37773 }); 37774 37775 return data; 37776} 37777 37778/** 37779 * Updates the position of the popper, computing the new offsets and applying 37780 * the new style.<br /> 37781 * Prefer `scheduleUpdate` over `update` because of performance reasons. 37782 * @method 37783 * @memberof Popper 37784 */ 37785function update() { 37786 // if popper is destroyed, don't perform any further update 37787 if (this.state.isDestroyed) { 37788 return; 37789 } 37790 37791 var data = { 37792 instance: this, 37793 styles: {}, 37794 arrowStyles: {}, 37795 attributes: {}, 37796 flipped: false, 37797 offsets: {} 37798 }; 37799 37800 // compute reference element offsets 37801 data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed); 37802 37803 // compute auto placement, store placement inside the data object, 37804 // modifiers will be able to edit `placement` if needed 37805 // and refer to originalPlacement to know the original value 37806 data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); 37807 37808 // store the computed placement inside `originalPlacement` 37809 data.originalPlacement = data.placement; 37810 37811 data.positionFixed = this.options.positionFixed; 37812 37813 // compute the popper offsets 37814 data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); 37815 37816 data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute'; 37817 37818 // run the modifiers 37819 data = runModifiers(this.modifiers, data); 37820 37821 // the first `update` will call `onCreate` callback 37822 // the other ones will call `onUpdate` callback 37823 if (!this.state.isCreated) { 37824 this.state.isCreated = true; 37825 this.options.onCreate(data); 37826 } else { 37827 this.options.onUpdate(data); 37828 } 37829} 37830 37831/** 37832 * Helper used to know if the given modifier is enabled. 37833 * @method 37834 * @memberof Popper.Utils 37835 * @returns {Boolean} 37836 */ 37837function isModifierEnabled(modifiers, modifierName) { 37838 return modifiers.some(function (_ref) { 37839 var name = _ref.name, 37840 enabled = _ref.enabled; 37841 return enabled && name === modifierName; 37842 }); 37843} 37844 37845/** 37846 * Get the prefixed supported property name 37847 * @method 37848 * @memberof Popper.Utils 37849 * @argument {String} property (camelCase) 37850 * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) 37851 */ 37852function getSupportedPropertyName(property) { 37853 var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; 37854 var upperProp = property.charAt(0).toUpperCase() + property.slice(1); 37855 37856 for (var i = 0; i < prefixes.length; i++) { 37857 var prefix = prefixes[i]; 37858 var toCheck = prefix ? '' + prefix + upperProp : property; 37859 if (typeof document.body.style[toCheck] !== 'undefined') { 37860 return toCheck; 37861 } 37862 } 37863 return null; 37864} 37865 37866/** 37867 * Destroys the popper. 37868 * @method 37869 * @memberof Popper 37870 */ 37871function destroy() { 37872 this.state.isDestroyed = true; 37873 37874 // touch DOM only if `applyStyle` modifier is enabled 37875 if (isModifierEnabled(this.modifiers, 'applyStyle')) { 37876 this.popper.removeAttribute('x-placement'); 37877 this.popper.style.position = ''; 37878 this.popper.style.top = ''; 37879 this.popper.style.left = ''; 37880 this.popper.style.right = ''; 37881 this.popper.style.bottom = ''; 37882 this.popper.style.willChange = ''; 37883 this.popper.style[getSupportedPropertyName('transform')] = ''; 37884 } 37885 37886 this.disableEventListeners(); 37887 37888 // remove the popper if user explicitly asked for the deletion on destroy 37889 // do not use `remove` because IE11 doesn't support it 37890 if (this.options.removeOnDestroy) { 37891 this.popper.parentNode.removeChild(this.popper); 37892 } 37893 return this; 37894} 37895 37896/** 37897 * Get the window associated with the element 37898 * @argument {Element} element 37899 * @returns {Window} 37900 */ 37901function getWindow(element) { 37902 var ownerDocument = element.ownerDocument; 37903 return ownerDocument ? ownerDocument.defaultView : window; 37904} 37905 37906function attachToScrollParents(scrollParent, event, callback, scrollParents) { 37907 var isBody = scrollParent.nodeName === 'BODY'; 37908 var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent; 37909 target.addEventListener(event, callback, { passive: true }); 37910 37911 if (!isBody) { 37912 attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents); 37913 } 37914 scrollParents.push(target); 37915} 37916 37917/** 37918 * Setup needed event listeners used to update the popper position 37919 * @method 37920 * @memberof Popper.Utils 37921 * @private 37922 */ 37923function setupEventListeners(reference, options, state, updateBound) { 37924 // Resize event listener on window 37925 state.updateBound = updateBound; 37926 getWindow(reference).addEventListener('resize', state.updateBound, { passive: true }); 37927 37928 // Scroll event listener on scroll parents 37929 var scrollElement = getScrollParent(reference); 37930 attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents); 37931 state.scrollElement = scrollElement; 37932 state.eventsEnabled = true; 37933 37934 return state; 37935} 37936 37937/** 37938 * It will add resize/scroll events and start recalculating 37939 * position of the popper element when they are triggered. 37940 * @method 37941 * @memberof Popper 37942 */ 37943function enableEventListeners() { 37944 if (!this.state.eventsEnabled) { 37945 this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); 37946 } 37947} 37948 37949/** 37950 * Remove event listeners used to update the popper position 37951 * @method 37952 * @memberof Popper.Utils 37953 * @private 37954 */ 37955function removeEventListeners(reference, state) { 37956 // Remove resize event listener on window 37957 getWindow(reference).removeEventListener('resize', state.updateBound); 37958 37959 // Remove scroll event listener on scroll parents 37960 state.scrollParents.forEach(function (target) { 37961 target.removeEventListener('scroll', state.updateBound); 37962 }); 37963 37964 // Reset state 37965 state.updateBound = null; 37966 state.scrollParents = []; 37967 state.scrollElement = null; 37968 state.eventsEnabled = false; 37969 return state; 37970} 37971 37972/** 37973 * It will remove resize/scroll events and won't recalculate popper position 37974 * when they are triggered. It also won't trigger `onUpdate` callback anymore, 37975 * unless you call `update` method manually. 37976 * @method 37977 * @memberof Popper 37978 */ 37979function disableEventListeners() { 37980 if (this.state.eventsEnabled) { 37981 cancelAnimationFrame(this.scheduleUpdate); 37982 this.state = removeEventListeners(this.reference, this.state); 37983 } 37984} 37985 37986/** 37987 * Tells if a given input is a number 37988 * @method 37989 * @memberof Popper.Utils 37990 * @param {*} input to check 37991 * @return {Boolean} 37992 */ 37993function isNumeric(n) { 37994 return n !== '' && !isNaN(parseFloat(n)) && isFinite(n); 37995} 37996 37997/** 37998 * Set the style to the given popper 37999 * @method 38000 * @memberof Popper.Utils 38001 * @argument {Element} element - Element to apply the style to 38002 * @argument {Object} styles 38003 * Object with a list of properties and values which will be applied to the element 38004 */ 38005function setStyles(element, styles) { 38006 Object.keys(styles).forEach(function (prop) { 38007 var unit = ''; 38008 // add unit if the value is numeric and is one of the following 38009 if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) { 38010 unit = 'px'; 38011 } 38012 element.style[prop] = styles[prop] + unit; 38013 }); 38014} 38015 38016/** 38017 * Set the attributes to the given popper 38018 * @method 38019 * @memberof Popper.Utils 38020 * @argument {Element} element - Element to apply the attributes to 38021 * @argument {Object} styles 38022 * Object with a list of properties and values which will be applied to the element 38023 */ 38024function setAttributes(element, attributes) { 38025 Object.keys(attributes).forEach(function (prop) { 38026 var value = attributes[prop]; 38027 if (value !== false) { 38028 element.setAttribute(prop, attributes[prop]); 38029 } else { 38030 element.removeAttribute(prop); 38031 } 38032 }); 38033} 38034 38035/** 38036 * @function 38037 * @memberof Modifiers 38038 * @argument {Object} data - The data object generated by `update` method 38039 * @argument {Object} data.styles - List of style properties - values to apply to popper element 38040 * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element 38041 * @argument {Object} options - Modifiers configuration and options 38042 * @returns {Object} The same data object 38043 */ 38044function applyStyle(data) { 38045 // any property present in `data.styles` will be applied to the popper, 38046 // in this way we can make the 3rd party modifiers add custom styles to it 38047 // Be aware, modifiers could override the properties defined in the previous 38048 // lines of this modifier! 38049 setStyles(data.instance.popper, data.styles); 38050 38051 // any property present in `data.attributes` will be applied to the popper, 38052 // they will be set as HTML attributes of the element 38053 setAttributes(data.instance.popper, data.attributes); 38054 38055 // if arrowElement is defined and arrowStyles has some properties 38056 if (data.arrowElement && Object.keys(data.arrowStyles).length) { 38057 setStyles(data.arrowElement, data.arrowStyles); 38058 } 38059 38060 return data; 38061} 38062 38063/** 38064 * Set the x-placement attribute before everything else because it could be used 38065 * to add margins to the popper margins needs to be calculated to get the 38066 * correct popper offsets. 38067 * @method 38068 * @memberof Popper.modifiers 38069 * @param {HTMLElement} reference - The reference element used to position the popper 38070 * @param {HTMLElement} popper - The HTML element used as popper 38071 * @param {Object} options - Popper.js options 38072 */ 38073function applyStyleOnLoad(reference, popper, options, modifierOptions, state) { 38074 // compute reference element offsets 38075 var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed); 38076 38077 // compute auto placement, store placement inside the data object, 38078 // modifiers will be able to edit `placement` if needed 38079 // and refer to originalPlacement to know the original value 38080 var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding); 38081 38082 popper.setAttribute('x-placement', placement); 38083 38084 // Apply `position` to popper before anything else because 38085 // without the position applied we can't guarantee correct computations 38086 setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' }); 38087 38088 return options; 38089} 38090 38091/** 38092 * @function 38093 * @memberof Popper.Utils 38094 * @argument {Object} data - The data object generated by `update` method 38095 * @argument {Boolean} shouldRound - If the offsets should be rounded at all 38096 * @returns {Object} The popper's position offsets rounded 38097 * 38098 * The tale of pixel-perfect positioning. It's still not 100% perfect, but as 38099 * good as it can be within reason. 38100 * Discussion here: https://github.com/FezVrasta/popper.js/pull/715 38101 * 38102 * Low DPI screens cause a popper to be blurry if not using full pixels (Safari 38103 * as well on High DPI screens). 38104 * 38105 * Firefox prefers no rounding for positioning and does not have blurriness on 38106 * high DPI screens. 38107 * 38108 * Only horizontal placement and left/right values need to be considered. 38109 */ 38110function getRoundedOffsets(data, shouldRound) { 38111 var _data$offsets = data.offsets, 38112 popper = _data$offsets.popper, 38113 reference = _data$offsets.reference; 38114 var round = Math.round, 38115 floor = Math.floor; 38116 38117 var noRound = function noRound(v) { 38118 return v; 38119 }; 38120 38121 var referenceWidth = round(reference.width); 38122 var popperWidth = round(popper.width); 38123 38124 var isVertical = ['left', 'right'].indexOf(data.placement) !== -1; 38125 var isVariation = data.placement.indexOf('-') !== -1; 38126 var sameWidthParity = referenceWidth % 2 === popperWidth % 2; 38127 var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1; 38128 38129 var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor; 38130 var verticalToInteger = !shouldRound ? noRound : round; 38131 38132 return { 38133 left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left), 38134 top: verticalToInteger(popper.top), 38135 bottom: verticalToInteger(popper.bottom), 38136 right: horizontalToInteger(popper.right) 38137 }; 38138} 38139 38140var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent); 38141 38142/** 38143 * @function 38144 * @memberof Modifiers 38145 * @argument {Object} data - The data object generated by `update` method 38146 * @argument {Object} options - Modifiers configuration and options 38147 * @returns {Object} The data object, properly modified 38148 */ 38149function computeStyle(data, options) { 38150 var x = options.x, 38151 y = options.y; 38152 var popper = data.offsets.popper; 38153 38154 // Remove this legacy support in Popper.js v2 38155 38156 var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) { 38157 return modifier.name === 'applyStyle'; 38158 }).gpuAcceleration; 38159 if (legacyGpuAccelerationOption !== undefined) { 38160 console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!'); 38161 } 38162 var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration; 38163 38164 var offsetParent = getOffsetParent(data.instance.popper); 38165 var offsetParentRect = getBoundingClientRect(offsetParent); 38166 38167 // Styles 38168 var styles = { 38169 position: popper.position 38170 }; 38171 38172 var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox); 38173 38174 var sideA = x === 'bottom' ? 'top' : 'bottom'; 38175 var sideB = y === 'right' ? 'left' : 'right'; 38176 38177 // if gpuAcceleration is set to `true` and transform is supported, 38178 // we use `translate3d` to apply the position to the popper we 38179 // automatically use the supported prefixed version if needed 38180 var prefixedProperty = getSupportedPropertyName('transform'); 38181 38182 // now, let's make a step back and look at this code closely (wtf?) 38183 // If the content of the popper grows once it's been positioned, it 38184 // may happen that the popper gets misplaced because of the new content 38185 // overflowing its reference element 38186 // To avoid this problem, we provide two options (x and y), which allow 38187 // the consumer to define the offset origin. 38188 // If we position a popper on top of a reference element, we can set 38189 // `x` to `top` to make the popper grow towards its top instead of 38190 // its bottom. 38191 var left = void 0, 38192 top = void 0; 38193 if (sideA === 'bottom') { 38194 // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar) 38195 // and not the bottom of the html element 38196 if (offsetParent.nodeName === 'HTML') { 38197 top = -offsetParent.clientHeight + offsets.bottom; 38198 } else { 38199 top = -offsetParentRect.height + offsets.bottom; 38200 } 38201 } else { 38202 top = offsets.top; 38203 } 38204 if (sideB === 'right') { 38205 if (offsetParent.nodeName === 'HTML') { 38206 left = -offsetParent.clientWidth + offsets.right; 38207 } else { 38208 left = -offsetParentRect.width + offsets.right; 38209 } 38210 } else { 38211 left = offsets.left; 38212 } 38213 if (gpuAcceleration && prefixedProperty) { 38214 styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)'; 38215 styles[sideA] = 0; 38216 styles[sideB] = 0; 38217 styles.willChange = 'transform'; 38218 } else { 38219 // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties 38220 var invertTop = sideA === 'bottom' ? -1 : 1; 38221 var invertLeft = sideB === 'right' ? -1 : 1; 38222 styles[sideA] = top * invertTop; 38223 styles[sideB] = left * invertLeft; 38224 styles.willChange = sideA + ', ' + sideB; 38225 } 38226 38227 // Attributes 38228 var attributes = { 38229 'x-placement': data.placement 38230 }; 38231 38232 // Update `data` attributes, styles and arrowStyles 38233 data.attributes = _extends({}, attributes, data.attributes); 38234 data.styles = _extends({}, styles, data.styles); 38235 data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles); 38236 38237 return data; 38238} 38239 38240/** 38241 * Helper used to know if the given modifier depends from another one.<br /> 38242 * It checks if the needed modifier is listed and enabled. 38243 * @method 38244 * @memberof Popper.Utils 38245 * @param {Array} modifiers - list of modifiers 38246 * @param {String} requestingName - name of requesting modifier 38247 * @param {String} requestedName - name of requested modifier 38248 * @returns {Boolean} 38249 */ 38250function isModifierRequired(modifiers, requestingName, requestedName) { 38251 var requesting = find(modifiers, function (_ref) { 38252 var name = _ref.name; 38253 return name === requestingName; 38254 }); 38255 38256 var isRequired = !!requesting && modifiers.some(function (modifier) { 38257 return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; 38258 }); 38259 38260 if (!isRequired) { 38261 var _requesting = '`' + requestingName + '`'; 38262 var requested = '`' + requestedName + '`'; 38263 console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!'); 38264 } 38265 return isRequired; 38266} 38267 38268/** 38269 * @function 38270 * @memberof Modifiers 38271 * @argument {Object} data - The data object generated by update method 38272 * @argument {Object} options - Modifiers configuration and options 38273 * @returns {Object} The data object, properly modified 38274 */ 38275function arrow(data, options) { 38276 var _data$offsets$arrow; 38277 38278 // arrow depends on keepTogether in order to work 38279 if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) { 38280 return data; 38281 } 38282 38283 var arrowElement = options.element; 38284 38285 // if arrowElement is a string, suppose it's a CSS selector 38286 if (typeof arrowElement === 'string') { 38287 arrowElement = data.instance.popper.querySelector(arrowElement); 38288 38289 // if arrowElement is not found, don't run the modifier 38290 if (!arrowElement) { 38291 return data; 38292 } 38293 } else { 38294 // if the arrowElement isn't a query selector we must check that the 38295 // provided DOM node is child of its popper node 38296 if (!data.instance.popper.contains(arrowElement)) { 38297 console.warn('WARNING: `arrow.element` must be child of its popper element!'); 38298 return data; 38299 } 38300 } 38301 38302 var placement = data.placement.split('-')[0]; 38303 var _data$offsets = data.offsets, 38304 popper = _data$offsets.popper, 38305 reference = _data$offsets.reference; 38306 38307 var isVertical = ['left', 'right'].indexOf(placement) !== -1; 38308 38309 var len = isVertical ? 'height' : 'width'; 38310 var sideCapitalized = isVertical ? 'Top' : 'Left'; 38311 var side = sideCapitalized.toLowerCase(); 38312 var altSide = isVertical ? 'left' : 'top'; 38313 var opSide = isVertical ? 'bottom' : 'right'; 38314 var arrowElementSize = getOuterSizes(arrowElement)[len]; 38315 38316 // 38317 // extends keepTogether behavior making sure the popper and its 38318 // reference have enough pixels in conjunction 38319 // 38320 38321 // top/left side 38322 if (reference[opSide] - arrowElementSize < popper[side]) { 38323 data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize); 38324 } 38325 // bottom/right side 38326 if (reference[side] + arrowElementSize > popper[opSide]) { 38327 data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide]; 38328 } 38329 data.offsets.popper = getClientRect(data.offsets.popper); 38330 38331 // compute center of the popper 38332 var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; 38333 38334 // Compute the sideValue using the updated popper offsets 38335 // take popper margin in account because we don't have this info available 38336 var css = getStyleComputedProperty(data.instance.popper); 38337 var popperMarginSide = parseFloat(css['margin' + sideCapitalized]); 38338 var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']); 38339 var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide; 38340 38341 // prevent arrowElement from being placed not contiguously to its popper 38342 sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); 38343 38344 data.arrowElement = arrowElement; 38345 data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow); 38346 38347 return data; 38348} 38349 38350/** 38351 * Get the opposite placement variation of the given one 38352 * @method 38353 * @memberof Popper.Utils 38354 * @argument {String} placement variation 38355 * @returns {String} flipped placement variation 38356 */ 38357function getOppositeVariation(variation) { 38358 if (variation === 'end') { 38359 return 'start'; 38360 } else if (variation === 'start') { 38361 return 'end'; 38362 } 38363 return variation; 38364} 38365 38366/** 38367 * List of accepted placements to use as values of the `placement` option.<br /> 38368 * Valid placements are: 38369 * - `auto` 38370 * - `top` 38371 * - `right` 38372 * - `bottom` 38373 * - `left` 38374 * 38375 * Each placement can have a variation from this list: 38376 * - `-start` 38377 * - `-end` 38378 * 38379 * Variations are interpreted easily if you think of them as the left to right 38380 * written languages. Horizontally (`top` and `bottom`), `start` is left and `end` 38381 * is right.<br /> 38382 * Vertically (`left` and `right`), `start` is top and `end` is bottom. 38383 * 38384 * Some valid examples are: 38385 * - `top-end` (on top of reference, right aligned) 38386 * - `right-start` (on right of reference, top aligned) 38387 * - `bottom` (on bottom, centered) 38388 * - `auto-end` (on the side with more space available, alignment depends by placement) 38389 * 38390 * @static 38391 * @type {Array} 38392 * @enum {String} 38393 * @readonly 38394 * @method placements 38395 * @memberof Popper 38396 */ 38397var 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']; 38398 38399// Get rid of `auto` `auto-start` and `auto-end` 38400var validPlacements = placements.slice(3); 38401 38402/** 38403 * Given an initial placement, returns all the subsequent placements 38404 * clockwise (or counter-clockwise). 38405 * 38406 * @method 38407 * @memberof Popper.Utils 38408 * @argument {String} placement - A valid placement (it accepts variations) 38409 * @argument {Boolean} counter - Set to true to walk the placements counterclockwise 38410 * @returns {Array} placements including their variations 38411 */ 38412function clockwise(placement) { 38413 var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 38414 38415 var index = validPlacements.indexOf(placement); 38416 var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); 38417 return counter ? arr.reverse() : arr; 38418} 38419 38420var BEHAVIORS = { 38421 FLIP: 'flip', 38422 CLOCKWISE: 'clockwise', 38423 COUNTERCLOCKWISE: 'counterclockwise' 38424}; 38425 38426/** 38427 * @function 38428 * @memberof Modifiers 38429 * @argument {Object} data - The data object generated by update method 38430 * @argument {Object} options - Modifiers configuration and options 38431 * @returns {Object} The data object, properly modified 38432 */ 38433function flip(data, options) { 38434 // if `inner` modifier is enabled, we can't use the `flip` modifier 38435 if (isModifierEnabled(data.instance.modifiers, 'inner')) { 38436 return data; 38437 } 38438 38439 if (data.flipped && data.placement === data.originalPlacement) { 38440 // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides 38441 return data; 38442 } 38443 38444 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed); 38445 38446 var placement = data.placement.split('-')[0]; 38447 var placementOpposite = getOppositePlacement(placement); 38448 var variation = data.placement.split('-')[1] || ''; 38449 38450 var flipOrder = []; 38451 38452 switch (options.behavior) { 38453 case BEHAVIORS.FLIP: 38454 flipOrder = [placement, placementOpposite]; 38455 break; 38456 case BEHAVIORS.CLOCKWISE: 38457 flipOrder = clockwise(placement); 38458 break; 38459 case BEHAVIORS.COUNTERCLOCKWISE: 38460 flipOrder = clockwise(placement, true); 38461 break; 38462 default: 38463 flipOrder = options.behavior; 38464 } 38465 38466 flipOrder.forEach(function (step, index) { 38467 if (placement !== step || flipOrder.length === index + 1) { 38468 return data; 38469 } 38470 38471 placement = data.placement.split('-')[0]; 38472 placementOpposite = getOppositePlacement(placement); 38473 38474 var popperOffsets = data.offsets.popper; 38475 var refOffsets = data.offsets.reference; 38476 38477 // using floor because the reference offsets may contain decimals we are not going to consider here 38478 var floor = Math.floor; 38479 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); 38480 38481 var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left); 38482 var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right); 38483 var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top); 38484 var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom); 38485 38486 var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom; 38487 38488 // flip the variation if required 38489 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 38490 38491 // flips variation if reference element overflows boundaries 38492 var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom); 38493 38494 // flips variation if popper content overflows boundaries 38495 var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop); 38496 38497 var flippedVariation = flippedVariationByRef || flippedVariationByContent; 38498 38499 if (overlapsRef || overflowsBoundaries || flippedVariation) { 38500 // this boolean to detect any flip loop 38501 data.flipped = true; 38502 38503 if (overlapsRef || overflowsBoundaries) { 38504 placement = flipOrder[index + 1]; 38505 } 38506 38507 if (flippedVariation) { 38508 variation = getOppositeVariation(variation); 38509 } 38510 38511 data.placement = placement + (variation ? '-' + variation : ''); 38512 38513 // this object contains `position`, we want to preserve it along with 38514 // any additional property we may add in the future 38515 data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)); 38516 38517 data = runModifiers(data.instance.modifiers, data, 'flip'); 38518 } 38519 }); 38520 return data; 38521} 38522 38523/** 38524 * @function 38525 * @memberof Modifiers 38526 * @argument {Object} data - The data object generated by update method 38527 * @argument {Object} options - Modifiers configuration and options 38528 * @returns {Object} The data object, properly modified 38529 */ 38530function keepTogether(data) { 38531 var _data$offsets = data.offsets, 38532 popper = _data$offsets.popper, 38533 reference = _data$offsets.reference; 38534 38535 var placement = data.placement.split('-')[0]; 38536 var floor = Math.floor; 38537 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 38538 var side = isVertical ? 'right' : 'bottom'; 38539 var opSide = isVertical ? 'left' : 'top'; 38540 var measurement = isVertical ? 'width' : 'height'; 38541 38542 if (popper[side] < floor(reference[opSide])) { 38543 data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement]; 38544 } 38545 if (popper[opSide] > floor(reference[side])) { 38546 data.offsets.popper[opSide] = floor(reference[side]); 38547 } 38548 38549 return data; 38550} 38551 38552/** 38553 * Converts a string containing value + unit into a px value number 38554 * @function 38555 * @memberof {modifiers~offset} 38556 * @private 38557 * @argument {String} str - Value + unit string 38558 * @argument {String} measurement - `height` or `width` 38559 * @argument {Object} popperOffsets 38560 * @argument {Object} referenceOffsets 38561 * @returns {Number|String} 38562 * Value in pixels, or original string if no values were extracted 38563 */ 38564function toValue(str, measurement, popperOffsets, referenceOffsets) { 38565 // separate value from unit 38566 var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/); 38567 var value = +split[1]; 38568 var unit = split[2]; 38569 38570 // If it's not a number it's an operator, I guess 38571 if (!value) { 38572 return str; 38573 } 38574 38575 if (unit.indexOf('%') === 0) { 38576 var element = void 0; 38577 switch (unit) { 38578 case '%p': 38579 element = popperOffsets; 38580 break; 38581 case '%': 38582 case '%r': 38583 default: 38584 element = referenceOffsets; 38585 } 38586 38587 var rect = getClientRect(element); 38588 return rect[measurement] / 100 * value; 38589 } else if (unit === 'vh' || unit === 'vw') { 38590 // if is a vh or vw, we calculate the size based on the viewport 38591 var size = void 0; 38592 if (unit === 'vh') { 38593 size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); 38594 } else { 38595 size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 38596 } 38597 return size / 100 * value; 38598 } else { 38599 // if is an explicit pixel unit, we get rid of the unit and keep the value 38600 // if is an implicit unit, it's px, and we return just the value 38601 return value; 38602 } 38603} 38604 38605/** 38606 * Parse an `offset` string to extrapolate `x` and `y` numeric offsets. 38607 * @function 38608 * @memberof {modifiers~offset} 38609 * @private 38610 * @argument {String} offset 38611 * @argument {Object} popperOffsets 38612 * @argument {Object} referenceOffsets 38613 * @argument {String} basePlacement 38614 * @returns {Array} a two cells array with x and y offsets in numbers 38615 */ 38616function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) { 38617 var offsets = [0, 0]; 38618 38619 // Use height if placement is left or right and index is 0 otherwise use width 38620 // in this way the first offset will use an axis and the second one 38621 // will use the other one 38622 var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1; 38623 38624 // Split the offset string to obtain a list of values and operands 38625 // The regex addresses values with the plus or minus sign in front (+10, -20, etc) 38626 var fragments = offset.split(/(\+|\-)/).map(function (frag) { 38627 return frag.trim(); 38628 }); 38629 38630 // Detect if the offset string contains a pair of values or a single one 38631 // they could be separated by comma or space 38632 var divider = fragments.indexOf(find(fragments, function (frag) { 38633 return frag.search(/,|\s/) !== -1; 38634 })); 38635 38636 if (fragments[divider] && fragments[divider].indexOf(',') === -1) { 38637 console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.'); 38638 } 38639 38640 // If divider is found, we divide the list of values and operands to divide 38641 // them by ofset X and Y. 38642 var splitRegex = /\s*,\s*|\s+/; 38643 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]; 38644 38645 // Convert the values with units to absolute pixels to allow our computations 38646 ops = ops.map(function (op, index) { 38647 // Most of the units rely on the orientation of the popper 38648 var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width'; 38649 var mergeWithPrevious = false; 38650 return op 38651 // This aggregates any `+` or `-` sign that aren't considered operators 38652 // e.g.: 10 + +5 => [10, +, +5] 38653 .reduce(function (a, b) { 38654 if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) { 38655 a[a.length - 1] = b; 38656 mergeWithPrevious = true; 38657 return a; 38658 } else if (mergeWithPrevious) { 38659 a[a.length - 1] += b; 38660 mergeWithPrevious = false; 38661 return a; 38662 } else { 38663 return a.concat(b); 38664 } 38665 }, []) 38666 // Here we convert the string values into number values (in px) 38667 .map(function (str) { 38668 return toValue(str, measurement, popperOffsets, referenceOffsets); 38669 }); 38670 }); 38671 38672 // Loop trough the offsets arrays and execute the operations 38673 ops.forEach(function (op, index) { 38674 op.forEach(function (frag, index2) { 38675 if (isNumeric(frag)) { 38676 offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1); 38677 } 38678 }); 38679 }); 38680 return offsets; 38681} 38682 38683/** 38684 * @function 38685 * @memberof Modifiers 38686 * @argument {Object} data - The data object generated by update method 38687 * @argument {Object} options - Modifiers configuration and options 38688 * @argument {Number|String} options.offset=0 38689 * The offset value as described in the modifier description 38690 * @returns {Object} The data object, properly modified 38691 */ 38692function offset(data, _ref) { 38693 var offset = _ref.offset; 38694 var placement = data.placement, 38695 _data$offsets = data.offsets, 38696 popper = _data$offsets.popper, 38697 reference = _data$offsets.reference; 38698 38699 var basePlacement = placement.split('-')[0]; 38700 38701 var offsets = void 0; 38702 if (isNumeric(+offset)) { 38703 offsets = [+offset, 0]; 38704 } else { 38705 offsets = parseOffset(offset, popper, reference, basePlacement); 38706 } 38707 38708 if (basePlacement === 'left') { 38709 popper.top += offsets[0]; 38710 popper.left -= offsets[1]; 38711 } else if (basePlacement === 'right') { 38712 popper.top += offsets[0]; 38713 popper.left += offsets[1]; 38714 } else if (basePlacement === 'top') { 38715 popper.left += offsets[0]; 38716 popper.top -= offsets[1]; 38717 } else if (basePlacement === 'bottom') { 38718 popper.left += offsets[0]; 38719 popper.top += offsets[1]; 38720 } 38721 38722 data.popper = popper; 38723 return data; 38724} 38725 38726/** 38727 * @function 38728 * @memberof Modifiers 38729 * @argument {Object} data - The data object generated by `update` method 38730 * @argument {Object} options - Modifiers configuration and options 38731 * @returns {Object} The data object, properly modified 38732 */ 38733function preventOverflow(data, options) { 38734 var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper); 38735 38736 // If offsetParent is the reference element, we really want to 38737 // go one step up and use the next offsetParent as reference to 38738 // avoid to make this modifier completely useless and look like broken 38739 if (data.instance.reference === boundariesElement) { 38740 boundariesElement = getOffsetParent(boundariesElement); 38741 } 38742 38743 // NOTE: DOM access here 38744 // resets the popper's position so that the document size can be calculated excluding 38745 // the size of the popper element itself 38746 var transformProp = getSupportedPropertyName('transform'); 38747 var popperStyles = data.instance.popper.style; // assignment to help minification 38748 var top = popperStyles.top, 38749 left = popperStyles.left, 38750 transform = popperStyles[transformProp]; 38751 38752 popperStyles.top = ''; 38753 popperStyles.left = ''; 38754 popperStyles[transformProp] = ''; 38755 38756 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed); 38757 38758 // NOTE: DOM access here 38759 // restores the original style properties after the offsets have been computed 38760 popperStyles.top = top; 38761 popperStyles.left = left; 38762 popperStyles[transformProp] = transform; 38763 38764 options.boundaries = boundaries; 38765 38766 var order = options.priority; 38767 var popper = data.offsets.popper; 38768 38769 var check = { 38770 primary: function primary(placement) { 38771 var value = popper[placement]; 38772 if (popper[placement] < boundaries[placement] && !options.escapeWithReference) { 38773 value = Math.max(popper[placement], boundaries[placement]); 38774 } 38775 return defineProperty({}, placement, value); 38776 }, 38777 secondary: function secondary(placement) { 38778 var mainSide = placement === 'right' ? 'left' : 'top'; 38779 var value = popper[mainSide]; 38780 if (popper[placement] > boundaries[placement] && !options.escapeWithReference) { 38781 value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height)); 38782 } 38783 return defineProperty({}, mainSide, value); 38784 } 38785 }; 38786 38787 order.forEach(function (placement) { 38788 var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary'; 38789 popper = _extends({}, popper, check[side](placement)); 38790 }); 38791 38792 data.offsets.popper = popper; 38793 38794 return data; 38795} 38796 38797/** 38798 * @function 38799 * @memberof Modifiers 38800 * @argument {Object} data - The data object generated by `update` method 38801 * @argument {Object} options - Modifiers configuration and options 38802 * @returns {Object} The data object, properly modified 38803 */ 38804function shift(data) { 38805 var placement = data.placement; 38806 var basePlacement = placement.split('-')[0]; 38807 var shiftvariation = placement.split('-')[1]; 38808 38809 // if shift shiftvariation is specified, run the modifier 38810 if (shiftvariation) { 38811 var _data$offsets = data.offsets, 38812 reference = _data$offsets.reference, 38813 popper = _data$offsets.popper; 38814 38815 var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1; 38816 var side = isVertical ? 'left' : 'top'; 38817 var measurement = isVertical ? 'width' : 'height'; 38818 38819 var shiftOffsets = { 38820 start: defineProperty({}, side, reference[side]), 38821 end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement]) 38822 }; 38823 38824 data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]); 38825 } 38826 38827 return data; 38828} 38829 38830/** 38831 * @function 38832 * @memberof Modifiers 38833 * @argument {Object} data - The data object generated by update method 38834 * @argument {Object} options - Modifiers configuration and options 38835 * @returns {Object} The data object, properly modified 38836 */ 38837function hide(data) { 38838 if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) { 38839 return data; 38840 } 38841 38842 var refRect = data.offsets.reference; 38843 var bound = find(data.instance.modifiers, function (modifier) { 38844 return modifier.name === 'preventOverflow'; 38845 }).boundaries; 38846 38847 if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { 38848 // Avoid unnecessary DOM access if visibility hasn't changed 38849 if (data.hide === true) { 38850 return data; 38851 } 38852 38853 data.hide = true; 38854 data.attributes['x-out-of-boundaries'] = ''; 38855 } else { 38856 // Avoid unnecessary DOM access if visibility hasn't changed 38857 if (data.hide === false) { 38858 return data; 38859 } 38860 38861 data.hide = false; 38862 data.attributes['x-out-of-boundaries'] = false; 38863 } 38864 38865 return data; 38866} 38867 38868/** 38869 * @function 38870 * @memberof Modifiers 38871 * @argument {Object} data - The data object generated by `update` method 38872 * @argument {Object} options - Modifiers configuration and options 38873 * @returns {Object} The data object, properly modified 38874 */ 38875function inner(data) { 38876 var placement = data.placement; 38877 var basePlacement = placement.split('-')[0]; 38878 var _data$offsets = data.offsets, 38879 popper = _data$offsets.popper, 38880 reference = _data$offsets.reference; 38881 38882 var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1; 38883 38884 var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1; 38885 38886 popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); 38887 38888 data.placement = getOppositePlacement(placement); 38889 data.offsets.popper = getClientRect(popper); 38890 38891 return data; 38892} 38893 38894/** 38895 * Modifier function, each modifier can have a function of this type assigned 38896 * to its `fn` property.<br /> 38897 * These functions will be called on each update, this means that you must 38898 * make sure they are performant enough to avoid performance bottlenecks. 38899 * 38900 * @function ModifierFn 38901 * @argument {dataObject} data - The data object generated by `update` method 38902 * @argument {Object} options - Modifiers configuration and options 38903 * @returns {dataObject} The data object, properly modified 38904 */ 38905 38906/** 38907 * Modifiers are plugins used to alter the behavior of your poppers.<br /> 38908 * Popper.js uses a set of 9 modifiers to provide all the basic functionalities 38909 * needed by the library. 38910 * 38911 * Usually you don't want to override the `order`, `fn` and `onLoad` props. 38912 * All the other properties are configurations that could be tweaked. 38913 * @namespace modifiers 38914 */ 38915var modifiers = { 38916 /** 38917 * Modifier used to shift the popper on the start or end of its reference 38918 * element.<br /> 38919 * It will read the variation of the `placement` property.<br /> 38920 * It can be one either `-end` or `-start`. 38921 * @memberof modifiers 38922 * @inner 38923 */ 38924 shift: { 38925 /** @prop {number} order=100 - Index used to define the order of execution */ 38926 order: 100, 38927 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 38928 enabled: true, 38929 /** @prop {ModifierFn} */ 38930 fn: shift 38931 }, 38932 38933 /** 38934 * The `offset` modifier can shift your popper on both its axis. 38935 * 38936 * It accepts the following units: 38937 * - `px` or unit-less, interpreted as pixels 38938 * - `%` or `%r`, percentage relative to the length of the reference element 38939 * - `%p`, percentage relative to the length of the popper element 38940 * - `vw`, CSS viewport width unit 38941 * - `vh`, CSS viewport height unit 38942 * 38943 * For length is intended the main axis relative to the placement of the popper.<br /> 38944 * This means that if the placement is `top` or `bottom`, the length will be the 38945 * `width`. In case of `left` or `right`, it will be the `height`. 38946 * 38947 * You can provide a single value (as `Number` or `String`), or a pair of values 38948 * as `String` divided by a comma or one (or more) white spaces.<br /> 38949 * The latter is a deprecated method because it leads to confusion and will be 38950 * removed in v2.<br /> 38951 * Additionally, it accepts additions and subtractions between different units. 38952 * Note that multiplications and divisions aren't supported. 38953 * 38954 * Valid examples are: 38955 * ``` 38956 * 10 38957 * '10%' 38958 * '10, 10' 38959 * '10%, 10' 38960 * '10 + 10%' 38961 * '10 - 5vh + 3%' 38962 * '-10px + 5vh, 5px - 6%' 38963 * ``` 38964 * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap 38965 * > with their reference element, unfortunately, you will have to disable the `flip` modifier. 38966 * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373). 38967 * 38968 * @memberof modifiers 38969 * @inner 38970 */ 38971 offset: { 38972 /** @prop {number} order=200 - Index used to define the order of execution */ 38973 order: 200, 38974 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 38975 enabled: true, 38976 /** @prop {ModifierFn} */ 38977 fn: offset, 38978 /** @prop {Number|String} offset=0 38979 * The offset value as described in the modifier description 38980 */ 38981 offset: 0 38982 }, 38983 38984 /** 38985 * Modifier used to prevent the popper from being positioned outside the boundary. 38986 * 38987 * A scenario exists where the reference itself is not within the boundaries.<br /> 38988 * We can say it has "escaped the boundaries" — or just "escaped".<br /> 38989 * In this case we need to decide whether the popper should either: 38990 * 38991 * - detach from the reference and remain "trapped" in the boundaries, or 38992 * - if it should ignore the boundary and "escape with its reference" 38993 * 38994 * When `escapeWithReference` is set to`true` and reference is completely 38995 * outside its boundaries, the popper will overflow (or completely leave) 38996 * the boundaries in order to remain attached to the edge of the reference. 38997 * 38998 * @memberof modifiers 38999 * @inner 39000 */ 39001 preventOverflow: { 39002 /** @prop {number} order=300 - Index used to define the order of execution */ 39003 order: 300, 39004 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 39005 enabled: true, 39006 /** @prop {ModifierFn} */ 39007 fn: preventOverflow, 39008 /** 39009 * @prop {Array} [priority=['left','right','top','bottom']] 39010 * Popper will try to prevent overflow following these priorities by default, 39011 * then, it could overflow on the left and on top of the `boundariesElement` 39012 */ 39013 priority: ['left', 'right', 'top', 'bottom'], 39014 /** 39015 * @prop {number} padding=5 39016 * Amount of pixel used to define a minimum distance between the boundaries 39017 * and the popper. This makes sure the popper always has a little padding 39018 * between the edges of its container 39019 */ 39020 padding: 5, 39021 /** 39022 * @prop {String|HTMLElement} boundariesElement='scrollParent' 39023 * Boundaries used by the modifier. Can be `scrollParent`, `window`, 39024 * `viewport` or any DOM element. 39025 */ 39026 boundariesElement: 'scrollParent' 39027 }, 39028 39029 /** 39030 * Modifier used to make sure the reference and its popper stay near each other 39031 * without leaving any gap between the two. Especially useful when the arrow is 39032 * enabled and you want to ensure that it points to its reference element. 39033 * It cares only about the first axis. You can still have poppers with margin 39034 * between the popper and its reference element. 39035 * @memberof modifiers 39036 * @inner 39037 */ 39038 keepTogether: { 39039 /** @prop {number} order=400 - Index used to define the order of execution */ 39040 order: 400, 39041 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 39042 enabled: true, 39043 /** @prop {ModifierFn} */ 39044 fn: keepTogether 39045 }, 39046 39047 /** 39048 * This modifier is used to move the `arrowElement` of the popper to make 39049 * sure it is positioned between the reference element and its popper element. 39050 * It will read the outer size of the `arrowElement` node to detect how many 39051 * pixels of conjunction are needed. 39052 * 39053 * It has no effect if no `arrowElement` is provided. 39054 * @memberof modifiers 39055 * @inner 39056 */ 39057 arrow: { 39058 /** @prop {number} order=500 - Index used to define the order of execution */ 39059 order: 500, 39060 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 39061 enabled: true, 39062 /** @prop {ModifierFn} */ 39063 fn: arrow, 39064 /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */ 39065 element: '[x-arrow]' 39066 }, 39067 39068 /** 39069 * Modifier used to flip the popper's placement when it starts to overlap its 39070 * reference element. 39071 * 39072 * Requires the `preventOverflow` modifier before it in order to work. 39073 * 39074 * **NOTE:** this modifier will interrupt the current update cycle and will 39075 * restart it if it detects the need to flip the placement. 39076 * @memberof modifiers 39077 * @inner 39078 */ 39079 flip: { 39080 /** @prop {number} order=600 - Index used to define the order of execution */ 39081 order: 600, 39082 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 39083 enabled: true, 39084 /** @prop {ModifierFn} */ 39085 fn: flip, 39086 /** 39087 * @prop {String|Array} behavior='flip' 39088 * The behavior used to change the popper's placement. It can be one of 39089 * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid 39090 * placements (with optional variations) 39091 */ 39092 behavior: 'flip', 39093 /** 39094 * @prop {number} padding=5 39095 * The popper will flip if it hits the edges of the `boundariesElement` 39096 */ 39097 padding: 5, 39098 /** 39099 * @prop {String|HTMLElement} boundariesElement='viewport' 39100 * The element which will define the boundaries of the popper position. 39101 * The popper will never be placed outside of the defined boundaries 39102 * (except if `keepTogether` is enabled) 39103 */ 39104 boundariesElement: 'viewport', 39105 /** 39106 * @prop {Boolean} flipVariations=false 39107 * The popper will switch placement variation between `-start` and `-end` when 39108 * the reference element overlaps its boundaries. 39109 * 39110 * The original placement should have a set variation. 39111 */ 39112 flipVariations: false, 39113 /** 39114 * @prop {Boolean} flipVariationsByContent=false 39115 * The popper will switch placement variation between `-start` and `-end` when 39116 * the popper element overlaps its reference boundaries. 39117 * 39118 * The original placement should have a set variation. 39119 */ 39120 flipVariationsByContent: false 39121 }, 39122 39123 /** 39124 * Modifier used to make the popper flow toward the inner of the reference element. 39125 * By default, when this modifier is disabled, the popper will be placed outside 39126 * the reference element. 39127 * @memberof modifiers 39128 * @inner 39129 */ 39130 inner: { 39131 /** @prop {number} order=700 - Index used to define the order of execution */ 39132 order: 700, 39133 /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */ 39134 enabled: false, 39135 /** @prop {ModifierFn} */ 39136 fn: inner 39137 }, 39138 39139 /** 39140 * Modifier used to hide the popper when its reference element is outside of the 39141 * popper boundaries. It will set a `x-out-of-boundaries` attribute which can 39142 * be used to hide with a CSS selector the popper when its reference is 39143 * out of boundaries. 39144 * 39145 * Requires the `preventOverflow` modifier before it in order to work. 39146 * @memberof modifiers 39147 * @inner 39148 */ 39149 hide: { 39150 /** @prop {number} order=800 - Index used to define the order of execution */ 39151 order: 800, 39152 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 39153 enabled: true, 39154 /** @prop {ModifierFn} */ 39155 fn: hide 39156 }, 39157 39158 /** 39159 * Computes the style that will be applied to the popper element to gets 39160 * properly positioned. 39161 * 39162 * Note that this modifier will not touch the DOM, it just prepares the styles 39163 * so that `applyStyle` modifier can apply it. This separation is useful 39164 * in case you need to replace `applyStyle` with a custom implementation. 39165 * 39166 * This modifier has `850` as `order` value to maintain backward compatibility 39167 * with previous versions of Popper.js. Expect the modifiers ordering method 39168 * to change in future major versions of the library. 39169 * 39170 * @memberof modifiers 39171 * @inner 39172 */ 39173 computeStyle: { 39174 /** @prop {number} order=850 - Index used to define the order of execution */ 39175 order: 850, 39176 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 39177 enabled: true, 39178 /** @prop {ModifierFn} */ 39179 fn: computeStyle, 39180 /** 39181 * @prop {Boolean} gpuAcceleration=true 39182 * If true, it uses the CSS 3D transformation to position the popper. 39183 * Otherwise, it will use the `top` and `left` properties 39184 */ 39185 gpuAcceleration: true, 39186 /** 39187 * @prop {string} [x='bottom'] 39188 * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin. 39189 * Change this if your popper should grow in a direction different from `bottom` 39190 */ 39191 x: 'bottom', 39192 /** 39193 * @prop {string} [x='left'] 39194 * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin. 39195 * Change this if your popper should grow in a direction different from `right` 39196 */ 39197 y: 'right' 39198 }, 39199 39200 /** 39201 * Applies the computed styles to the popper element. 39202 * 39203 * All the DOM manipulations are limited to this modifier. This is useful in case 39204 * you want to integrate Popper.js inside a framework or view library and you 39205 * want to delegate all the DOM manipulations to it. 39206 * 39207 * Note that if you disable this modifier, you must make sure the popper element 39208 * has its position set to `absolute` before Popper.js can do its work! 39209 * 39210 * Just disable this modifier and define your own to achieve the desired effect. 39211 * 39212 * @memberof modifiers 39213 * @inner 39214 */ 39215 applyStyle: { 39216 /** @prop {number} order=900 - Index used to define the order of execution */ 39217 order: 900, 39218 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 39219 enabled: true, 39220 /** @prop {ModifierFn} */ 39221 fn: applyStyle, 39222 /** @prop {Function} */ 39223 onLoad: applyStyleOnLoad, 39224 /** 39225 * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier 39226 * @prop {Boolean} gpuAcceleration=true 39227 * If true, it uses the CSS 3D transformation to position the popper. 39228 * Otherwise, it will use the `top` and `left` properties 39229 */ 39230 gpuAcceleration: undefined 39231 } 39232}; 39233 39234/** 39235 * The `dataObject` is an object containing all the information used by Popper.js. 39236 * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks. 39237 * @name dataObject 39238 * @property {Object} data.instance The Popper.js instance 39239 * @property {String} data.placement Placement applied to popper 39240 * @property {String} data.originalPlacement Placement originally defined on init 39241 * @property {Boolean} data.flipped True if popper has been flipped by flip modifier 39242 * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper 39243 * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier 39244 * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`) 39245 * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`) 39246 * @property {Object} data.boundaries Offsets of the popper boundaries 39247 * @property {Object} data.offsets The measurements of popper, reference and arrow elements 39248 * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values 39249 * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values 39250 * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0 39251 */ 39252 39253/** 39254 * Default options provided to Popper.js constructor.<br /> 39255 * These can be overridden using the `options` argument of Popper.js.<br /> 39256 * To override an option, simply pass an object with the same 39257 * structure of the `options` object, as the 3rd argument. For example: 39258 * ``` 39259 * new Popper(ref, pop, { 39260 * modifiers: { 39261 * preventOverflow: { enabled: false } 39262 * } 39263 * }) 39264 * ``` 39265 * @type {Object} 39266 * @static 39267 * @memberof Popper 39268 */ 39269var Defaults = { 39270 /** 39271 * Popper's placement. 39272 * @prop {Popper.placements} placement='bottom' 39273 */ 39274 placement: 'bottom', 39275 39276 /** 39277 * Set this to true if you want popper to position it self in 'fixed' mode 39278 * @prop {Boolean} positionFixed=false 39279 */ 39280 positionFixed: false, 39281 39282 /** 39283 * Whether events (resize, scroll) are initially enabled. 39284 * @prop {Boolean} eventsEnabled=true 39285 */ 39286 eventsEnabled: true, 39287 39288 /** 39289 * Set to true if you want to automatically remove the popper when 39290 * you call the `destroy` method. 39291 * @prop {Boolean} removeOnDestroy=false 39292 */ 39293 removeOnDestroy: false, 39294 39295 /** 39296 * Callback called when the popper is created.<br /> 39297 * By default, it is set to no-op.<br /> 39298 * Access Popper.js instance with `data.instance`. 39299 * @prop {onCreate} 39300 */ 39301 onCreate: function onCreate() {}, 39302 39303 /** 39304 * Callback called when the popper is updated. This callback is not called 39305 * on the initialization/creation of the popper, but only on subsequent 39306 * updates.<br /> 39307 * By default, it is set to no-op.<br /> 39308 * Access Popper.js instance with `data.instance`. 39309 * @prop {onUpdate} 39310 */ 39311 onUpdate: function onUpdate() {}, 39312 39313 /** 39314 * List of modifiers used to modify the offsets before they are applied to the popper. 39315 * They provide most of the functionalities of Popper.js. 39316 * @prop {modifiers} 39317 */ 39318 modifiers: modifiers 39319}; 39320 39321/** 39322 * @callback onCreate 39323 * @param {dataObject} data 39324 */ 39325 39326/** 39327 * @callback onUpdate 39328 * @param {dataObject} data 39329 */ 39330 39331// Utils 39332// Methods 39333var Popper = function () { 39334 /** 39335 * Creates a new Popper.js instance. 39336 * @class Popper 39337 * @param {Element|referenceObject} reference - The reference element used to position the popper 39338 * @param {Element} popper - The HTML / XML element used as the popper 39339 * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults) 39340 * @return {Object} instance - The generated Popper.js instance 39341 */ 39342 function Popper(reference, popper) { 39343 var _this = this; 39344 39345 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 39346 classCallCheck(this, Popper); 39347 39348 this.scheduleUpdate = function () { 39349 return requestAnimationFrame(_this.update); 39350 }; 39351 39352 // make update() debounced, so that it only runs at most once-per-tick 39353 this.update = debounce(this.update.bind(this)); 39354 39355 // with {} we create a new object with the options inside it 39356 this.options = _extends({}, Popper.Defaults, options); 39357 39358 // init state 39359 this.state = { 39360 isDestroyed: false, 39361 isCreated: false, 39362 scrollParents: [] 39363 }; 39364 39365 // get reference and popper elements (allow jQuery wrappers) 39366 this.reference = reference && reference.jquery ? reference[0] : reference; 39367 this.popper = popper && popper.jquery ? popper[0] : popper; 39368 39369 // Deep merge modifiers options 39370 this.options.modifiers = {}; 39371 Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) { 39372 _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {}); 39373 }); 39374 39375 // Refactoring modifiers' list (Object => Array) 39376 this.modifiers = Object.keys(this.options.modifiers).map(function (name) { 39377 return _extends({ 39378 name: name 39379 }, _this.options.modifiers[name]); 39380 }) 39381 // sort the modifiers by order 39382 .sort(function (a, b) { 39383 return a.order - b.order; 39384 }); 39385 39386 // modifiers have the ability to execute arbitrary code when Popper.js get inited 39387 // such code is executed in the same order of its modifier 39388 // they could add new properties to their options configuration 39389 // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`! 39390 this.modifiers.forEach(function (modifierOptions) { 39391 if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) { 39392 modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state); 39393 } 39394 }); 39395 39396 // fire the first update to position the popper in the right place 39397 this.update(); 39398 39399 var eventsEnabled = this.options.eventsEnabled; 39400 if (eventsEnabled) { 39401 // setup event listeners, they will take care of update the position in specific situations 39402 this.enableEventListeners(); 39403 } 39404 39405 this.state.eventsEnabled = eventsEnabled; 39406 } 39407 39408 // We can't use class properties because they don't get listed in the 39409 // class prototype and break stuff like Sinon stubs 39410 39411 39412 createClass(Popper, [{ 39413 key: 'update', 39414 value: function update$$1() { 39415 return update.call(this); 39416 } 39417 }, { 39418 key: 'destroy', 39419 value: function destroy$$1() { 39420 return destroy.call(this); 39421 } 39422 }, { 39423 key: 'enableEventListeners', 39424 value: function enableEventListeners$$1() { 39425 return enableEventListeners.call(this); 39426 } 39427 }, { 39428 key: 'disableEventListeners', 39429 value: function disableEventListeners$$1() { 39430 return disableEventListeners.call(this); 39431 } 39432 39433 /** 39434 * Schedules an update. It will run on the next UI update available. 39435 * @method scheduleUpdate 39436 * @memberof Popper 39437 */ 39438 39439 39440 /** 39441 * Collection of utilities useful when writing custom modifiers. 39442 * Starting from version 1.7, this method is available only if you 39443 * include `popper-utils.js` before `popper.js`. 39444 * 39445 * **DEPRECATION**: This way to access PopperUtils is deprecated 39446 * and will be removed in v2! Use the PopperUtils module directly instead. 39447 * Due to the high instability of the methods contained in Utils, we can't 39448 * guarantee them to follow semver. Use them at your own risk! 39449 * @static 39450 * @private 39451 * @type {Object} 39452 * @deprecated since version 1.8 39453 * @member Utils 39454 * @memberof Popper 39455 */ 39456 39457 }]); 39458 return Popper; 39459}(); 39460 39461/** 39462 * The `referenceObject` is an object that provides an interface compatible with Popper.js 39463 * and lets you use it as replacement of a real DOM node.<br /> 39464 * You can use this method to position a popper relatively to a set of coordinates 39465 * in case you don't have a DOM node to use as reference. 39466 * 39467 * ``` 39468 * new Popper(referenceObject, popperNode); 39469 * ``` 39470 * 39471 * NB: This feature isn't supported in Internet Explorer 10. 39472 * @name referenceObject 39473 * @property {Function} data.getBoundingClientRect 39474 * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method. 39475 * @property {number} data.clientWidth 39476 * An ES6 getter that will return the width of the virtual reference element. 39477 * @property {number} data.clientHeight 39478 * An ES6 getter that will return the height of the virtual reference element. 39479 */ 39480 39481 39482Popper.Utils = (typeof window !== 'undefined' ? window : __webpack_require__.g).PopperUtils; 39483Popper.placements = placements; 39484Popper.Defaults = Defaults; 39485 39486/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Popper); 39487//# sourceMappingURL=popper.js.map 39488 39489 39490/***/ }), 39491
vendor: 5,636 bytes, lines 39492-39685
39492/***/ "./node_modules/process/browser.js": 39493/*!*****************************************!*\ 39494 !*** ./node_modules/process/browser.js ***! 39495 \*****************************************/ 39496/***/ ((module) => { 39497 39498// shim for using process in browser 39499var process = module.exports = {}; 39500 39501// cached from whatever global is present so that test runners that stub it 39502// don't break things. But we need to wrap it in a try catch in case it is 39503// wrapped in strict mode code which doesn't define any globals. It's inside a 39504// function because try/catches deoptimize in certain engines. 39505 39506var cachedSetTimeout; 39507var cachedClearTimeout; 39508 39509function defaultSetTimout() { 39510 throw new Error('setTimeout has not been defined'); 39511} 39512function defaultClearTimeout () { 39513 throw new Error('clearTimeout has not been defined'); 39514} 39515(function () { 39516 try { 39517 if (typeof setTimeout === 'function') { 39518 cachedSetTimeout = setTimeout; 39519 } else { 39520 cachedSetTimeout = defaultSetTimout; 39521 } 39522 } catch (e) { 39523 cachedSetTimeout = defaultSetTimout; 39524 } 39525 try { 39526 if (typeof clearTimeout === 'function') { 39527 cachedClearTimeout = clearTimeout; 39528 } else { 39529 cachedClearTimeout = defaultClearTimeout; 39530 } 39531 } catch (e) { 39532 cachedClearTimeout = defaultClearTimeout; 39533 } 39534} ()) 39535function runTimeout(fun) { 39536 if (cachedSetTimeout === setTimeout) { 39537 //normal enviroments in sane situations 39538 return setTimeout(fun, 0); 39539 } 39540 // if setTimeout wasn't available but was latter defined 39541 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { 39542 cachedSetTimeout = setTimeout; 39543 return setTimeout(fun, 0); 39544 } 39545 try { 39546 // when when somebody has screwed with setTimeout but no I.E. maddness 39547 return cachedSetTimeout(fun, 0); 39548 } catch(e){ 39549 try { 39550 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 39551 return cachedSetTimeout.call(null, fun, 0); 39552 } catch(e){ 39553 // 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 39554 return cachedSetTimeout.call(this, fun, 0); 39555 } 39556 } 39557 39558 39559} 39560function runClearTimeout(marker) { 39561 if (cachedClearTimeout === clearTimeout) { 39562 //normal enviroments in sane situations 39563 return clearTimeout(marker); 39564 } 39565 // if clearTimeout wasn't available but was latter defined 39566 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { 39567 cachedClearTimeout = clearTimeout; 39568 return clearTimeout(marker); 39569 } 39570 try { 39571 // when when somebody has screwed with setTimeout but no I.E. maddness 39572 return cachedClearTimeout(marker); 39573 } catch (e){ 39574 try { 39575 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 39576 return cachedClearTimeout.call(null, marker); 39577 } catch (e){ 39578 // 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. 39579 // Some versions of I.E. have different rules for clearTimeout vs setTimeout 39580 return cachedClearTimeout.call(this, marker); 39581 } 39582 } 39583 39584 39585 39586} 39587var queue = []; 39588var draining = false; 39589var currentQueue; 39590var queueIndex = -1; 39591 39592function cleanUpNextTick() { 39593 if (!draining || !currentQueue) { 39594 return; 39595 } 39596 draining = false; 39597 if (currentQueue.length) { 39598 queue = currentQueue.concat(queue); 39599 } else { 39600 queueIndex = -1; 39601 } 39602 if (queue.length) { 39603 drainQueue(); 39604 } 39605} 39606 39607function drainQueue() { 39608 if (draining) { 39609 return; 39610 } 39611 var timeout = runTimeout(cleanUpNextTick); 39612 draining = true; 39613 39614 var len = queue.length; 39615 while(len) { 39616 currentQueue = queue; 39617 queue = []; 39618 while (++queueIndex < len) { 39619 if (currentQueue) { 39620 currentQueue[queueIndex].run(); 39621 } 39622 } 39623 queueIndex = -1; 39624 len = queue.length; 39625 } 39626 currentQueue = null; 39627 draining = false; 39628 runClearTimeout(timeout); 39629} 39630 39631process.nextTick = function (fun) { 39632 var args = new Array(arguments.length - 1); 39633 if (arguments.length > 1) { 39634 for (var i = 1; i < arguments.length; i++) { 39635 args[i - 1] = arguments[i]; 39636 } 39637 } 39638 queue.push(new Item(fun, args)); 39639 if (queue.length === 1 && !draining) { 39640 runTimeout(drainQueue); 39641 } 39642}; 39643 39644// v8 likes predictible objects 39645function Item(fun, array) { 39646 this.fun = fun; 39647 this.array = array; 39648} 39649Item.prototype.run = function () { 39650 this.fun.apply(null, this.array); 39651}; 39652process.title = 'browser'; 39653process.browser = true; 39654process.env = {}; 39655process.argv = []; 39656process.version = ''; // empty string to avoid regexp issues 39657process.versions = {}; 39658 39659function noop() {} 39660 39661process.on = noop; 39662process.addListener = noop; 39663process.once = noop; 39664process.off = noop; 39665process.removeListener = noop; 39666process.removeAllListeners = noop; 39667process.emit = noop; 39668process.prependListener = noop; 39669process.prependOnceListener = noop; 39670 39671process.listeners = function (name) { return [] } 39672 39673process.binding = function (name) { 39674 throw new Error('process.binding is not supported'); 39675}; 39676 39677process.cwd = function () { return '/' }; 39678process.chdir = function (dir) { 39679 throw new Error('process.chdir is not supported'); 39680}; 39681process.umask = function() { return 0; }; 39682 39683 39684/***/ }), 39685
vendor: 291,410 bytes, lines 39686-48432
39686/***/ "./node_modules/vue/dist/vue.runtime.common.dev.js": 39687/*!*********************************************************!*\ 39688 !*** ./node_modules/vue/dist/vue.runtime.common.dev.js ***! 39689 \*********************************************************/ 39690/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 39691 39692"use strict"; 39693/*! 39694 * Vue.js v2.7.16 39695 * (c) 2014-2023 Evan You 39696 * Released under the MIT License. 39697 */ 39698 39699 39700const emptyObject = Object.freeze({}); 39701const isArray = Array.isArray; 39702// These helpers produce better VM code in JS engines due to their 39703// explicitness and function inlining. 39704function isUndef(v) { 39705 return v === undefined || v === null; 39706} 39707function isDef(v) { 39708 return v !== undefined && v !== null; 39709} 39710function isTrue(v) { 39711 return v === true; 39712} 39713function isFalse(v) { 39714 return v === false; 39715} 39716/** 39717 * Check if value is primitive. 39718 */ 39719function isPrimitive(value) { 39720 return (typeof value === 'string' || 39721 typeof value === 'number' || 39722 // $flow-disable-line 39723 typeof value === 'symbol' || 39724 typeof value === 'boolean'); 39725} 39726function isFunction(value) { 39727 return typeof value === 'function'; 39728} 39729/** 39730 * Quick object check - this is primarily used to tell 39731 * objects from primitive values when we know the value 39732 * is a JSON-compliant type. 39733 */ 39734function isObject(obj) { 39735 return obj !== null && typeof obj === 'object'; 39736} 39737/** 39738 * Get the raw type string of a value, e.g., [object Object]. 39739 */ 39740const _toString = Object.prototype.toString; 39741function toRawType(value) { 39742 return _toString.call(value).slice(8, -1); 39743} 39744/** 39745 * Strict object type check. Only returns true 39746 * for plain JavaScript objects. 39747 */ 39748function isPlainObject(obj) { 39749 return _toString.call(obj) === '[object Object]'; 39750} 39751function isRegExp(v) { 39752 return _toString.call(v) === '[object RegExp]'; 39753} 39754/** 39755 * Check if val is a valid array index. 39756 */ 39757function isValidArrayIndex(val) { 39758 const n = parseFloat(String(val)); 39759 return n >= 0 && Math.floor(n) === n && isFinite(val); 39760} 39761function isPromise(val) { 39762 return (isDef(val) && 39763 typeof val.then === 'function' && 39764 typeof val.catch === 'function'); 39765} 39766/** 39767 * Convert a value to a string that is actually rendered. 39768 */ 39769function toString(val) { 39770 return val == null 39771 ? '' 39772 : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString) 39773 ? JSON.stringify(val, replacer, 2) 39774 : String(val); 39775} 39776function replacer(_key, val) { 39777 // avoid circular deps from v3 39778 if (val && val.__v_isRef) { 39779 return val.value; 39780 } 39781 return val; 39782} 39783/** 39784 * Convert an input value to a number for persistence. 39785 * If the conversion fails, return original string. 39786 */ 39787function toNumber(val) { 39788 const n = parseFloat(val); 39789 return isNaN(n) ? val : n; 39790} 39791/** 39792 * Make a map and return a function for checking if a key 39793 * is in that map. 39794 */ 39795function makeMap(str, expectsLowerCase) { 39796 const map = Object.create(null); 39797 const list = str.split(','); 39798 for (let i = 0; i < list.length; i++) { 39799 map[list[i]] = true; 39800 } 39801 return expectsLowerCase ? val => map[val.toLowerCase()] : val => map[val]; 39802} 39803/** 39804 * Check if a tag is a built-in tag. 39805 */ 39806const isBuiltInTag = makeMap('slot,component', true); 39807/** 39808 * Check if an attribute is a reserved attribute. 39809 */ 39810const isReservedAttribute = makeMap('key,ref,slot,slot-scope,is'); 39811/** 39812 * Remove an item from an array. 39813 */ 39814function remove$2(arr, item) { 39815 const len = arr.length; 39816 if (len) { 39817 // fast path for the only / last item 39818 if (item === arr[len - 1]) { 39819 arr.length = len - 1; 39820 return; 39821 } 39822 const index = arr.indexOf(item); 39823 if (index > -1) { 39824 return arr.splice(index, 1); 39825 } 39826 } 39827} 39828/** 39829 * Check whether an object has the property. 39830 */ 39831const hasOwnProperty = Object.prototype.hasOwnProperty; 39832function hasOwn(obj, key) { 39833 return hasOwnProperty.call(obj, key); 39834} 39835/** 39836 * Create a cached version of a pure function. 39837 */ 39838function cached(fn) { 39839 const cache = Object.create(null); 39840 return function cachedFn(str) { 39841 const hit = cache[str]; 39842 return hit || (cache[str] = fn(str)); 39843 }; 39844} 39845/** 39846 * Camelize a hyphen-delimited string. 39847 */ 39848const camelizeRE = /-(\w)/g; 39849const camelize = cached((str) => { 39850 return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : '')); 39851}); 39852/** 39853 * Capitalize a string. 39854 */ 39855const capitalize = cached((str) => { 39856 return str.charAt(0).toUpperCase() + str.slice(1); 39857}); 39858/** 39859 * Hyphenate a camelCase string. 39860 */ 39861const hyphenateRE = /\B([A-Z])/g; 39862const hyphenate = cached((str) => { 39863 return str.replace(hyphenateRE, '-$1').toLowerCase(); 39864}); 39865/** 39866 * Simple bind polyfill for environments that do not support it, 39867 * e.g., PhantomJS 1.x. Technically, we don't need this anymore 39868 * since native bind is now performant enough in most browsers. 39869 * But removing it would mean breaking code that was able to run in 39870 * PhantomJS 1.x, so this must be kept for backward compatibility. 39871 */ 39872/* istanbul ignore next */ 39873function polyfillBind(fn, ctx) { 39874 function boundFn(a) { 39875 const l = arguments.length; 39876 return l 39877 ? l > 1 39878 ? fn.apply(ctx, arguments) 39879 : fn.call(ctx, a) 39880 : fn.call(ctx); 39881 } 39882 boundFn._length = fn.length; 39883 return boundFn; 39884} 39885function nativeBind(fn, ctx) { 39886 return fn.bind(ctx); 39887} 39888// @ts-expect-error bind cannot be `undefined` 39889const bind = Function.prototype.bind ? nativeBind : polyfillBind; 39890/** 39891 * Convert an Array-like object to a real Array. 39892 */ 39893function toArray(list, start) { 39894 start = start || 0; 39895 let i = list.length - start; 39896 const ret = new Array(i); 39897 while (i--) { 39898 ret[i] = list[i + start]; 39899 } 39900 return ret; 39901} 39902/** 39903 * Mix properties into target object. 39904 */ 39905function extend(to, _from) { 39906 for (const key in _from) { 39907 to[key] = _from[key]; 39908 } 39909 return to; 39910} 39911/** 39912 * Merge an Array of Objects into a single Object. 39913 */ 39914function toObject(arr) { 39915 const res = {}; 39916 for (let i = 0; i < arr.length; i++) { 39917 if (arr[i]) { 39918 extend(res, arr[i]); 39919 } 39920 } 39921 return res; 39922} 39923/* eslint-disable no-unused-vars */ 39924/** 39925 * Perform no operation. 39926 * Stubbing args to make Flow happy without leaving useless transpiled code 39927 * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/). 39928 */ 39929function noop(a, b, c) { } 39930/** 39931 * Always return false. 39932 */ 39933const no = (a, b, c) => false; 39934/* eslint-enable no-unused-vars */ 39935/** 39936 * Return the same value. 39937 */ 39938const identity = (_) => _; 39939/** 39940 * Check if two values are loosely equal - that is, 39941 * if they are plain objects, do they have the same shape? 39942 */ 39943function looseEqual(a, b) { 39944 if (a === b) 39945 return true; 39946 const isObjectA = isObject(a); 39947 const isObjectB = isObject(b); 39948 if (isObjectA && isObjectB) { 39949 try { 39950 const isArrayA = Array.isArray(a); 39951 const isArrayB = Array.isArray(b); 39952 if (isArrayA && isArrayB) { 39953 return (a.length === b.length && 39954 a.every((e, i) => { 39955 return looseEqual(e, b[i]); 39956 })); 39957 } 39958 else if (a instanceof Date && b instanceof Date) { 39959 return a.getTime() === b.getTime(); 39960 } 39961 else if (!isArrayA && !isArrayB) { 39962 const keysA = Object.keys(a); 39963 const keysB = Object.keys(b); 39964 return (keysA.length === keysB.length && 39965 keysA.every(key => { 39966 return looseEqual(a[key], b[key]); 39967 })); 39968 } 39969 else { 39970 /* istanbul ignore next */ 39971 return false; 39972 } 39973 } 39974 catch (e) { 39975 /* istanbul ignore next */ 39976 return false; 39977 } 39978 } 39979 else if (!isObjectA && !isObjectB) { 39980 return String(a) === String(b); 39981 } 39982 else { 39983 return false; 39984 } 39985} 39986/** 39987 * Return the first index at which a loosely equal value can be 39988 * found in the array (if value is a plain object, the array must 39989 * contain an object of the same shape), or -1 if it is not present. 39990 */ 39991function looseIndexOf(arr, val) { 39992 for (let i = 0; i < arr.length; i++) { 39993 if (looseEqual(arr[i], val)) 39994 return i; 39995 } 39996 return -1; 39997} 39998/** 39999 * Ensure a function is called only once. 40000 */ 40001function once(fn) { 40002 let called = false; 40003 return function () { 40004 if (!called) { 40005 called = true; 40006 fn.apply(this, arguments); 40007 } 40008 }; 40009} 40010// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is#polyfill 40011function hasChanged(x, y) { 40012 if (x === y) { 40013 return x === 0 && 1 / x !== 1 / y; 40014 } 40015 else { 40016 return x === x || y === y; 40017 } 40018} 40019 40020const SSR_ATTR = 'data-server-rendered'; 40021const ASSET_TYPES = ['component', 'directive', 'filter']; 40022const LIFECYCLE_HOOKS = [ 40023 'beforeCreate', 40024 'created', 40025 'beforeMount', 40026 'mounted', 40027 'beforeUpdate', 40028 'updated', 40029 'beforeDestroy', 40030 'destroyed', 40031 'activated', 40032 'deactivated', 40033 'errorCaptured', 40034 'serverPrefetch', 40035 'renderTracked', 40036 'renderTriggered' 40037]; 40038 40039var config = { 40040 /** 40041 * Option merge strategies (used in core/util/options) 40042 */ 40043 // $flow-disable-line 40044 optionMergeStrategies: Object.create(null), 40045 /** 40046 * Whether to suppress warnings. 40047 */ 40048 silent: false, 40049 /** 40050 * Show production mode tip message on boot? 40051 */ 40052 productionTip: true, 40053 /** 40054 * Whether to enable devtools 40055 */ 40056 devtools: true, 40057 /** 40058 * Whether to record perf 40059 */ 40060 performance: false, 40061 /** 40062 * Error handler for watcher errors 40063 */ 40064 errorHandler: null, 40065 /** 40066 * Warn handler for watcher warns 40067 */ 40068 warnHandler: null, 40069 /** 40070 * Ignore certain custom elements 40071 */ 40072 ignoredElements: [], 40073 /** 40074 * Custom user key aliases for v-on 40075 */ 40076 // $flow-disable-line 40077 keyCodes: Object.create(null), 40078 /** 40079 * Check if a tag is reserved so that it cannot be registered as a 40080 * component. This is platform-dependent and may be overwritten. 40081 */ 40082 isReservedTag: no, 40083 /** 40084 * Check if an attribute is reserved so that it cannot be used as a component 40085 * prop. This is platform-dependent and may be overwritten. 40086 */ 40087 isReservedAttr: no, 40088 /** 40089 * Check if a tag is an unknown element. 40090 * Platform-dependent. 40091 */ 40092 isUnknownElement: no, 40093 /** 40094 * Get the namespace of an element 40095 */ 40096 getTagNamespace: noop, 40097 /** 40098 * Parse the real tag name for the specific platform. 40099 */ 40100 parsePlatformTagName: identity, 40101 /** 40102 * Check if an attribute must be bound using property, e.g. value 40103 * Platform-dependent. 40104 */ 40105 mustUseProp: no, 40106 /** 40107 * Perform updates asynchronously. Intended to be used by Vue Test Utils 40108 * This will significantly reduce performance if set to false. 40109 */ 40110 async: true, 40111 /** 40112 * Exposed for legacy reasons 40113 */ 40114 _lifecycleHooks: LIFECYCLE_HOOKS 40115}; 40116 40117/** 40118 * unicode letters used for parsing html tags, component names and property paths. 40119 * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname 40120 * skipping \u10000-\uEFFFF due to it freezing up PhantomJS 40121 */ 40122const unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/; 40123/** 40124 * Check if a string starts with $ or _ 40125 */ 40126function isReserved(str) { 40127 const c = (str + '').charCodeAt(0); 40128 return c === 0x24 || c === 0x5f; 40129} 40130/** 40131 * Define a property. 40132 */ 40133function def(obj, key, val, enumerable) { 40134 Object.defineProperty(obj, key, { 40135 value: val, 40136 enumerable: !!enumerable, 40137 writable: true, 40138 configurable: true 40139 }); 40140} 40141/** 40142 * Parse simple path. 40143 */ 40144const bailRE = new RegExp(`[^${unicodeRegExp.source}.$_\\d]`); 40145function parsePath(path) { 40146 if (bailRE.test(path)) { 40147 return; 40148 } 40149 const segments = path.split('.'); 40150 return function (obj) { 40151 for (let i = 0; i < segments.length; i++) { 40152 if (!obj) 40153 return; 40154 obj = obj[segments[i]]; 40155 } 40156 return obj; 40157 }; 40158} 40159 40160// can we use __proto__? 40161const hasProto = '__proto__' in {}; 40162// Browser environment sniffing 40163const inBrowser = typeof window !== 'undefined'; 40164const UA = inBrowser && window.navigator.userAgent.toLowerCase(); 40165const isIE = UA && /msie|trident/.test(UA); 40166const isIE9 = UA && UA.indexOf('msie 9.0') > 0; 40167const isEdge = UA && UA.indexOf('edge/') > 0; 40168UA && UA.indexOf('android') > 0; 40169const isIOS = UA && /iphone|ipad|ipod|ios/.test(UA); 40170UA && /chrome\/\d+/.test(UA) && !isEdge; 40171UA && /phantomjs/.test(UA); 40172const isFF = UA && UA.match(/firefox\/(\d+)/); 40173// Firefox has a "watch" function on Object.prototype... 40174// @ts-expect-error firebox support 40175const nativeWatch = {}.watch; 40176let supportsPassive = false; 40177if (inBrowser) { 40178 try { 40179 const opts = {}; 40180 Object.defineProperty(opts, 'passive', { 40181 get() { 40182 /* istanbul ignore next */ 40183 supportsPassive = true; 40184 } 40185 }); // https://github.com/facebook/flow/issues/285 40186 window.addEventListener('test-passive', null, opts); 40187 } 40188 catch (e) { } 40189} 40190// this needs to be lazy-evaled because vue may be required before 40191// vue-server-renderer can set VUE_ENV 40192let _isServer; 40193const isServerRendering = () => { 40194 if (_isServer === undefined) { 40195 /* istanbul ignore if */ 40196 if (!inBrowser && typeof __webpack_require__.g !== 'undefined') { 40197 // detect presence of vue-server-renderer and avoid 40198 // Webpack shimming the process 40199 _isServer = 40200 __webpack_require__.g['process'] && __webpack_require__.g['process'].env.VUE_ENV === 'server'; 40201 } 40202 else { 40203 _isServer = false; 40204 } 40205 } 40206 return _isServer; 40207}; 40208// detect devtools 40209const devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__; 40210/* istanbul ignore next */ 40211function isNative(Ctor) { 40212 return typeof Ctor === 'function' && /native code/.test(Ctor.toString()); 40213} 40214const hasSymbol = typeof Symbol !== 'undefined' && 40215 isNative(Symbol) && 40216 typeof Reflect !== 'undefined' && 40217 isNative(Reflect.ownKeys); 40218let _Set; // $flow-disable-line 40219/* istanbul ignore if */ if (typeof Set !== 'undefined' && isNative(Set)) { 40220 // use native Set when available. 40221 _Set = Set; 40222} 40223else { 40224 // a non-standard Set polyfill that only works with primitive keys. 40225 _Set = class Set { 40226 constructor() { 40227 this.set = Object.create(null); 40228 } 40229 has(key) { 40230 return this.set[key] === true; 40231 } 40232 add(key) { 40233 this.set[key] = true; 40234 } 40235 clear() { 40236 this.set = Object.create(null); 40237 } 40238 }; 40239} 40240 40241let currentInstance = null; 40242/** 40243 * This is exposed for compatibility with v3 (e.g. some functions in VueUse 40244 * relies on it). Do not use this internally, just use `currentInstance`. 40245 * 40246 * @internal this function needs manual type declaration because it relies 40247 * on previously manually authored types from Vue 2 40248 */ 40249function getCurrentInstance() { 40250 return currentInstance && { proxy: currentInstance }; 40251} 40252/** 40253 * @internal 40254 */ 40255function setCurrentInstance(vm = null) { 40256 if (!vm) 40257 currentInstance && currentInstance._scope.off(); 40258 currentInstance = vm; 40259 vm && vm._scope.on(); 40260} 40261 40262/** 40263 * @internal 40264 */ 40265class VNode { 40266 constructor(tag, data, children, text, elm, context, componentOptions, asyncFactory) { 40267 this.tag = tag; 40268 this.data = data; 40269 this.children = children; 40270 this.text = text; 40271 this.elm = elm; 40272 this.ns = undefined; 40273 this.context = context; 40274 this.fnContext = undefined; 40275 this.fnOptions = undefined; 40276 this.fnScopeId = undefined; 40277 this.key = data && data.key; 40278 this.componentOptions = componentOptions; 40279 this.componentInstance = undefined; 40280 this.parent = undefined; 40281 this.raw = false; 40282 this.isStatic = false; 40283 this.isRootInsert = true; 40284 this.isComment = false; 40285 this.isCloned = false; 40286 this.isOnce = false; 40287 this.asyncFactory = asyncFactory; 40288 this.asyncMeta = undefined; 40289 this.isAsyncPlaceholder = false; 40290 } 40291 // DEPRECATED: alias for componentInstance for backwards compat. 40292 /* istanbul ignore next */ 40293 get child() { 40294 return this.componentInstance; 40295 } 40296} 40297const createEmptyVNode = (text = '') => { 40298 const node = new VNode(); 40299 node.text = text; 40300 node.isComment = true; 40301 return node; 40302}; 40303function createTextVNode(val) { 40304 return new VNode(undefined, undefined, undefined, String(val)); 40305} 40306// optimized shallow clone 40307// used for static nodes and slot nodes because they may be reused across 40308// multiple renders, cloning them avoids errors when DOM manipulations rely 40309// on their elm reference. 40310function cloneVNode(vnode) { 40311 const cloned = new VNode(vnode.tag, vnode.data, 40312 // #7975 40313 // clone children array to avoid mutating original in case of cloning 40314 // a child. 40315 vnode.children && vnode.children.slice(), vnode.text, vnode.elm, vnode.context, vnode.componentOptions, vnode.asyncFactory); 40316 cloned.ns = vnode.ns; 40317 cloned.isStatic = vnode.isStatic; 40318 cloned.key = vnode.key; 40319 cloned.isComment = vnode.isComment; 40320 cloned.fnContext = vnode.fnContext; 40321 cloned.fnOptions = vnode.fnOptions; 40322 cloned.fnScopeId = vnode.fnScopeId; 40323 cloned.asyncMeta = vnode.asyncMeta; 40324 cloned.isCloned = true; 40325 return cloned; 40326} 40327 40328let uid$2 = 0; 40329const pendingCleanupDeps = []; 40330const cleanupDeps = () => { 40331 for (let i = 0; i < pendingCleanupDeps.length; i++) { 40332 const dep = pendingCleanupDeps[i]; 40333 dep.subs = dep.subs.filter(s => s); 40334 dep._pending = false; 40335 } 40336 pendingCleanupDeps.length = 0; 40337}; 40338/** 40339 * A dep is an observable that can have multiple 40340 * directives subscribing to it. 40341 * @internal 40342 */ 40343class Dep { 40344 constructor() { 40345 // pending subs cleanup 40346 this._pending = false; 40347 this.id = uid$2++; 40348 this.subs = []; 40349 } 40350 addSub(sub) { 40351 this.subs.push(sub); 40352 } 40353 removeSub(sub) { 40354 // #12696 deps with massive amount of subscribers are extremely slow to 40355 // clean up in Chromium 40356 // to workaround this, we unset the sub for now, and clear them on 40357 // next scheduler flush. 40358 this.subs[this.subs.indexOf(sub)] = null; 40359 if (!this._pending) { 40360 this._pending = true; 40361 pendingCleanupDeps.push(this); 40362 } 40363 } 40364 depend(info) { 40365 if (Dep.target) { 40366 Dep.target.addDep(this); 40367 if (info && Dep.target.onTrack) { 40368 Dep.target.onTrack(Object.assign({ effect: Dep.target }, info)); 40369 } 40370 } 40371 } 40372 notify(info) { 40373 // stabilize the subscriber list first 40374 const subs = this.subs.filter(s => s); 40375 if (!config.async) { 40376 // subs aren't sorted in scheduler if not running async 40377 // we need to sort them now to make sure they fire in correct 40378 // order 40379 subs.sort((a, b) => a.id - b.id); 40380 } 40381 for (let i = 0, l = subs.length; i < l; i++) { 40382 const sub = subs[i]; 40383 if (info) { 40384 sub.onTrigger && 40385 sub.onTrigger(Object.assign({ effect: subs[i] }, info)); 40386 } 40387 sub.update(); 40388 } 40389 } 40390} 40391// The current target watcher being evaluated. 40392// This is globally unique because only one watcher 40393// can be evaluated at a time. 40394Dep.target = null; 40395const targetStack = []; 40396function pushTarget(target) { 40397 targetStack.push(target); 40398 Dep.target = target; 40399} 40400function popTarget() { 40401 targetStack.pop(); 40402 Dep.target = targetStack[targetStack.length - 1]; 40403} 40404 40405/* 40406 * not type checking this file because flow doesn't play well with 40407 * dynamically accessing methods on Array prototype 40408 */ 40409const arrayProto = Array.prototype; 40410const arrayMethods = Object.create(arrayProto); 40411const methodsToPatch = [ 40412 'push', 40413 'pop', 40414 'shift', 40415 'unshift', 40416 'splice', 40417 'sort', 40418 'reverse' 40419]; 40420/** 40421 * Intercept mutating methods and emit events 40422 */ 40423methodsToPatch.forEach(function (method) { 40424 // cache original method 40425 const original = arrayProto[method]; 40426 def(arrayMethods, method, function mutator(...args) { 40427 const result = original.apply(this, args); 40428 const ob = this.__ob__; 40429 let inserted; 40430 switch (method) { 40431 case 'push': 40432 case 'unshift': 40433 inserted = args; 40434 break; 40435 case 'splice': 40436 inserted = args.slice(2); 40437 break; 40438 } 40439 if (inserted) 40440 ob.observeArray(inserted); 40441 // notify change 40442 { 40443 ob.dep.notify({ 40444 type: "array mutation" /* TriggerOpTypes.ARRAY_MUTATION */, 40445 target: this, 40446 key: method 40447 }); 40448 } 40449 return result; 40450 }); 40451}); 40452 40453const arrayKeys = Object.getOwnPropertyNames(arrayMethods); 40454const NO_INITIAL_VALUE = {}; 40455/** 40456 * In some cases we may want to disable observation inside a component's 40457 * update computation. 40458 */ 40459let shouldObserve = true; 40460function toggleObserving(value) { 40461 shouldObserve = value; 40462} 40463// ssr mock dep 40464const mockDep = { 40465 notify: noop, 40466 depend: noop, 40467 addSub: noop, 40468 removeSub: noop 40469}; 40470/** 40471 * Observer class that is attached to each observed 40472 * object. Once attached, the observer converts the target 40473 * object's property keys into getter/setters that 40474 * collect dependencies and dispatch updates. 40475 */ 40476class Observer { 40477 constructor(value, shallow = false, mock = false) { 40478 this.value = value; 40479 this.shallow = shallow; 40480 this.mock = mock; 40481 // this.value = value 40482 this.dep = mock ? mockDep : new Dep(); 40483 this.vmCount = 0; 40484 def(value, '__ob__', this); 40485 if (isArray(value)) { 40486 if (!mock) { 40487 if (hasProto) { 40488 value.__proto__ = arrayMethods; 40489 /* eslint-enable no-proto */ 40490 } 40491 else { 40492 for (let i = 0, l = arrayKeys.length; i < l; i++) { 40493 const key = arrayKeys[i]; 40494 def(value, key, arrayMethods[key]); 40495 } 40496 } 40497 } 40498 if (!shallow) { 40499 this.observeArray(value); 40500 } 40501 } 40502 else { 40503 /** 40504 * Walk through all properties and convert them into 40505 * getter/setters. This method should only be called when 40506 * value type is Object. 40507 */ 40508 const keys = Object.keys(value); 40509 for (let i = 0; i < keys.length; i++) { 40510 const key = keys[i]; 40511 defineReactive(value, key, NO_INITIAL_VALUE, undefined, shallow, mock); 40512 } 40513 } 40514 } 40515 /** 40516 * Observe a list of Array items. 40517 */ 40518 observeArray(value) { 40519 for (let i = 0, l = value.length; i < l; i++) { 40520 observe(value[i], false, this.mock); 40521 } 40522 } 40523} 40524// helpers 40525/** 40526 * Attempt to create an observer instance for a value, 40527 * returns the new observer if successfully observed, 40528 * or the existing observer if the value already has one. 40529 */ 40530function observe(value, shallow, ssrMockReactivity) { 40531 if (value && hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) { 40532 return value.__ob__; 40533 } 40534 if (shouldObserve && 40535 (ssrMockReactivity || !isServerRendering()) && 40536 (isArray(value) || isPlainObject(value)) && 40537 Object.isExtensible(value) && 40538 !value.__v_skip /* ReactiveFlags.SKIP */ && 40539 !isRef(value) && 40540 !(value instanceof VNode)) { 40541 return new Observer(value, shallow, ssrMockReactivity); 40542 } 40543} 40544/** 40545 * Define a reactive property on an Object. 40546 */ 40547function defineReactive(obj, key, val, customSetter, shallow, mock, observeEvenIfShallow = false) { 40548 const dep = new Dep(); 40549 const property = Object.getOwnPropertyDescriptor(obj, key); 40550 if (property && property.configurable === false) { 40551 return; 40552 } 40553 // cater for pre-defined getter/setters 40554 const getter = property && property.get; 40555 const setter = property && property.set; 40556 if ((!getter || setter) && 40557 (val === NO_INITIAL_VALUE || arguments.length === 2)) { 40558 val = obj[key]; 40559 } 40560 let childOb = shallow ? val && val.__ob__ : observe(val, false, mock); 40561 Object.defineProperty(obj, key, { 40562 enumerable: true, 40563 configurable: true, 40564 get: function reactiveGetter() { 40565 const value = getter ? getter.call(obj) : val; 40566 if (Dep.target) { 40567 { 40568 dep.depend({ 40569 target: obj, 40570 type: "get" /* TrackOpTypes.GET */, 40571 key 40572 }); 40573 } 40574 if (childOb) { 40575 childOb.dep.depend(); 40576 if (isArray(value)) { 40577 dependArray(value); 40578 } 40579 } 40580 } 40581 return isRef(value) && !shallow ? value.value : value; 40582 }, 40583 set: function reactiveSetter(newVal) { 40584 const value = getter ? getter.call(obj) : val; 40585 if (!hasChanged(value, newVal)) { 40586 return; 40587 } 40588 if (customSetter) { 40589 customSetter(); 40590 } 40591 if (setter) { 40592 setter.call(obj, newVal); 40593 } 40594 else if (getter) { 40595 // #7981: for accessor properties without setter 40596 return; 40597 } 40598 else if (!shallow && isRef(value) && !isRef(newVal)) { 40599 value.value = newVal; 40600 return; 40601 } 40602 else { 40603 val = newVal; 40604 } 40605 childOb = shallow ? newVal && newVal.__ob__ : observe(newVal, false, mock); 40606 { 40607 dep.notify({ 40608 type: "set" /* TriggerOpTypes.SET */, 40609 target: obj, 40610 key, 40611 newValue: newVal, 40612 oldValue: value 40613 }); 40614 } 40615 } 40616 }); 40617 return dep; 40618} 40619function set(target, key, val) { 40620 if ((isUndef(target) || isPrimitive(target))) { 40621 warn(`Cannot set reactive property on undefined, null, or primitive value: ${target}`); 40622 } 40623 if (isReadonly(target)) { 40624 warn(`Set operation on key "${key}" failed: target is readonly.`); 40625 return; 40626 } 40627 const ob = target.__ob__; 40628 if (isArray(target) && isValidArrayIndex(key)) { 40629 target.length = Math.max(target.length, key); 40630 target.splice(key, 1, val); 40631 // when mocking for SSR, array methods are not hijacked 40632 if (ob && !ob.shallow && ob.mock) { 40633 observe(val, false, true); 40634 } 40635 return val; 40636 } 40637 if (key in target && !(key in Object.prototype)) { 40638 target[key] = val; 40639 return val; 40640 } 40641 if (target._isVue || (ob && ob.vmCount)) { 40642 warn('Avoid adding reactive properties to a Vue instance or its root $data ' + 40643 'at runtime - declare it upfront in the data option.'); 40644 return val; 40645 } 40646 if (!ob) { 40647 target[key] = val; 40648 return val; 40649 } 40650 defineReactive(ob.value, key, val, undefined, ob.shallow, ob.mock); 40651 { 40652 ob.dep.notify({ 40653 type: "add" /* TriggerOpTypes.ADD */, 40654 target: target, 40655 key, 40656 newValue: val, 40657 oldValue: undefined 40658 }); 40659 } 40660 return val; 40661} 40662function del(target, key) { 40663 if ((isUndef(target) || isPrimitive(target))) { 40664 warn(`Cannot delete reactive property on undefined, null, or primitive value: ${target}`); 40665 } 40666 if (isArray(target) && isValidArrayIndex(key)) { 40667 target.splice(key, 1); 40668 return; 40669 } 40670 const ob = target.__ob__; 40671 if (target._isVue || (ob && ob.vmCount)) { 40672 warn('Avoid deleting properties on a Vue instance or its root $data ' + 40673 '- just set it to null.'); 40674 return; 40675 } 40676 if (isReadonly(target)) { 40677 warn(`Delete operation on key "${key}" failed: target is readonly.`); 40678 return; 40679 } 40680 if (!hasOwn(target, key)) { 40681 return; 40682 } 40683 delete target[key]; 40684 if (!ob) { 40685 return; 40686 } 40687 { 40688 ob.dep.notify({ 40689 type: "delete" /* TriggerOpTypes.DELETE */, 40690 target: target, 40691 key 40692 }); 40693 } 40694} 40695/** 40696 * Collect dependencies on array elements when the array is touched, since 40697 * we cannot intercept array element access like property getters. 40698 */ 40699function dependArray(value) { 40700 for (let e, i = 0, l = value.length; i < l; i++) { 40701 e = value[i]; 40702 if (e && e.__ob__) { 40703 e.__ob__.dep.depend(); 40704 } 40705 if (isArray(e)) { 40706 dependArray(e); 40707 } 40708 } 40709} 40710 40711function reactive(target) { 40712 makeReactive(target, false); 40713 return target; 40714} 40715/** 40716 * Return a shallowly-reactive copy of the original object, where only the root 40717 * level properties are reactive. It also does not auto-unwrap refs (even at the 40718 * root level). 40719 */ 40720function shallowReactive(target) { 40721 makeReactive(target, true); 40722 def(target, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true); 40723 return target; 40724} 40725function makeReactive(target, shallow) { 40726 // if trying to observe a readonly proxy, return the readonly version. 40727 if (!isReadonly(target)) { 40728 { 40729 if (isArray(target)) { 40730 warn(`Avoid using Array as root value for ${shallow ? `shallowReactive()` : `reactive()`} as it cannot be tracked in watch() or watchEffect(). Use ${shallow ? `shallowRef()` : `ref()`} instead. This is a Vue-2-only limitation.`); 40731 } 40732 const existingOb = target && target.__ob__; 40733 if (existingOb && existingOb.shallow !== shallow) { 40734 warn(`Target is already a ${existingOb.shallow ? `` : `non-`}shallow reactive object, and cannot be converted to ${shallow ? `` : `non-`}shallow.`); 40735 } 40736 } 40737 const ob = observe(target, shallow, isServerRendering() /* ssr mock reactivity */); 40738 if (!ob) { 40739 if (target == null || isPrimitive(target)) { 40740 warn(`value cannot be made reactive: ${String(target)}`); 40741 } 40742 if (isCollectionType(target)) { 40743 warn(`Vue 2 does not support reactive collection types such as Map or Set.`); 40744 } 40745 } 40746 } 40747} 40748function isReactive(value) { 40749 if (isReadonly(value)) { 40750 return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]); 40751 } 40752 return !!(value && value.__ob__); 40753} 40754function isShallow(value) { 40755 return !!(value && value.__v_isShallow); 40756} 40757function isReadonly(value) { 40758 return !!(value && value.__v_isReadonly); 40759} 40760function isProxy(value) { 40761 return isReactive(value) || isReadonly(value); 40762} 40763function toRaw(observed) { 40764 const raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */]; 40765 return raw ? toRaw(raw) : observed; 40766} 40767function markRaw(value) { 40768 // non-extensible objects won't be observed anyway 40769 if (Object.isExtensible(value)) { 40770 def(value, "__v_skip" /* ReactiveFlags.SKIP */, true); 40771 } 40772 return value; 40773} 40774/** 40775 * @internal 40776 */ 40777function isCollectionType(value) { 40778 const type = toRawType(value); 40779 return (type === 'Map' || type === 'WeakMap' || type === 'Set' || type === 'WeakSet'); 40780} 40781 40782/** 40783 * @internal 40784 */ 40785const RefFlag = `__v_isRef`; 40786function isRef(r) { 40787 return !!(r && r.__v_isRef === true); 40788} 40789function ref$1(value) { 40790 return createRef(value, false); 40791} 40792function shallowRef(value) { 40793 return createRef(value, true); 40794} 40795function createRef(rawValue, shallow) { 40796 if (isRef(rawValue)) { 40797 return rawValue; 40798 } 40799 const ref = {}; 40800 def(ref, RefFlag, true); 40801 def(ref, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, shallow); 40802 def(ref, 'dep', defineReactive(ref, 'value', rawValue, null, shallow, isServerRendering())); 40803 return ref; 40804} 40805function triggerRef(ref) { 40806 if (!ref.dep) { 40807 warn(`received object is not a triggerable ref.`); 40808 } 40809 { 40810 ref.dep && 40811 ref.dep.notify({ 40812 type: "set" /* TriggerOpTypes.SET */, 40813 target: ref, 40814 key: 'value' 40815 }); 40816 } 40817} 40818function unref(ref) { 40819 return isRef(ref) ? ref.value : ref; 40820} 40821function proxyRefs(objectWithRefs) { 40822 if (isReactive(objectWithRefs)) { 40823 return objectWithRefs; 40824 } 40825 const proxy = {}; 40826 const keys = Object.keys(objectWithRefs); 40827 for (let i = 0; i < keys.length; i++) { 40828 proxyWithRefUnwrap(proxy, objectWithRefs, keys[i]); 40829 } 40830 return proxy; 40831} 40832function proxyWithRefUnwrap(target, source, key) { 40833 Object.defineProperty(target, key, { 40834 enumerable: true, 40835 configurable: true, 40836 get: () => { 40837 const val = source[key]; 40838 if (isRef(val)) { 40839 return val.value; 40840 } 40841 else { 40842 const ob = val && val.__ob__; 40843 if (ob) 40844 ob.dep.depend(); 40845 return val; 40846 } 40847 }, 40848 set: value => { 40849 const oldValue = source[key]; 40850 if (isRef(oldValue) && !isRef(value)) { 40851 oldValue.value = value; 40852 } 40853 else { 40854 source[key] = value; 40855 } 40856 } 40857 }); 40858} 40859function customRef(factory) { 40860 const dep = new Dep(); 40861 const { get, set } = factory(() => { 40862 { 40863 dep.depend({ 40864 target: ref, 40865 type: "get" /* TrackOpTypes.GET */, 40866 key: 'value' 40867 }); 40868 } 40869 }, () => { 40870 { 40871 dep.notify({ 40872 target: ref, 40873 type: "set" /* TriggerOpTypes.SET */, 40874 key: 'value' 40875 }); 40876 } 40877 }); 40878 const ref = { 40879 get value() { 40880 return get(); 40881 }, 40882 set value(newVal) { 40883 set(newVal); 40884 } 40885 }; 40886 def(ref, RefFlag, true); 40887 return ref; 40888} 40889function toRefs(object) { 40890 if (!isReactive(object)) { 40891 warn(`toRefs() expects a reactive object but received a plain one.`); 40892 } 40893 const ret = isArray(object) ? new Array(object.length) : {}; 40894 for (const key in object) { 40895 ret[key] = toRef(object, key); 40896 } 40897 return ret; 40898} 40899function toRef(object, key, defaultValue) { 40900 const val = object[key]; 40901 if (isRef(val)) { 40902 return val; 40903 } 40904 const ref = { 40905 get value() { 40906 const val = object[key]; 40907 return val === undefined ? defaultValue : val; 40908 }, 40909 set value(newVal) { 40910 object[key] = newVal; 40911 } 40912 }; 40913 def(ref, RefFlag, true); 40914 return ref; 40915} 40916 40917const rawToReadonlyFlag = `__v_rawToReadonly`; 40918const rawToShallowReadonlyFlag = `__v_rawToShallowReadonly`; 40919function readonly(target) { 40920 return createReadonly(target, false); 40921} 40922function createReadonly(target, shallow) { 40923 if (!isPlainObject(target)) { 40924 { 40925 if (isArray(target)) { 40926 warn(`Vue 2 does not support readonly arrays.`); 40927 } 40928 else if (isCollectionType(target)) { 40929 warn(`Vue 2 does not support readonly collection types such as Map or Set.`); 40930 } 40931 else { 40932 warn(`value cannot be made readonly: ${typeof target}`); 40933 } 40934 } 40935 return target; 40936 } 40937 if (!Object.isExtensible(target)) { 40938 warn(`Vue 2 does not support creating readonly proxy for non-extensible object.`); 40939 } 40940 // already a readonly object 40941 if (isReadonly(target)) { 40942 return target; 40943 } 40944 // already has a readonly proxy 40945 const existingFlag = shallow ? rawToShallowReadonlyFlag : rawToReadonlyFlag; 40946 const existingProxy = target[existingFlag]; 40947 if (existingProxy) { 40948 return existingProxy; 40949 } 40950 const proxy = Object.create(Object.getPrototypeOf(target)); 40951 def(target, existingFlag, proxy); 40952 def(proxy, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, true); 40953 def(proxy, "__v_raw" /* ReactiveFlags.RAW */, target); 40954 if (isRef(target)) { 40955 def(proxy, RefFlag, true); 40956 } 40957 if (shallow || isShallow(target)) { 40958 def(proxy, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true); 40959 } 40960 const keys = Object.keys(target); 40961 for (let i = 0; i < keys.length; i++) { 40962 defineReadonlyProperty(proxy, target, keys[i], shallow); 40963 } 40964 return proxy; 40965} 40966function defineReadonlyProperty(proxy, target, key, shallow) { 40967 Object.defineProperty(proxy, key, { 40968 enumerable: true, 40969 configurable: true, 40970 get() { 40971 const val = target[key]; 40972 return shallow || !isPlainObject(val) ? val : readonly(val); 40973 }, 40974 set() { 40975 warn(`Set operation on key "${key}" failed: target is readonly.`); 40976 } 40977 }); 40978} 40979/** 40980 * Returns a reactive-copy of the original object, where only the root level 40981 * properties are readonly, and does NOT unwrap refs nor recursively convert 40982 * returned properties. 40983 * This is used for creating the props proxy object for stateful components. 40984 */ 40985function shallowReadonly(target) { 40986 return createReadonly(target, true); 40987} 40988 40989function computed(getterOrOptions, debugOptions) { 40990 let getter; 40991 let setter; 40992 const onlyGetter = isFunction(getterOrOptions); 40993 if (onlyGetter) { 40994 getter = getterOrOptions; 40995 setter = () => { 40996 warn('Write operation failed: computed value is readonly'); 40997 } 40998 ; 40999 } 41000 else { 41001 getter = getterOrOptions.get; 41002 setter = getterOrOptions.set; 41003 } 41004 const watcher = isServerRendering() 41005 ? null 41006 : new Watcher(currentInstance, getter, noop, { lazy: true }); 41007 if (watcher && debugOptions) { 41008 watcher.onTrack = debugOptions.onTrack; 41009 watcher.onTrigger = debugOptions.onTrigger; 41010 } 41011 const ref = { 41012 // some libs rely on the presence effect for checking computed refs 41013 // from normal refs, but the implementation doesn't matter 41014 effect: watcher, 41015 get value() { 41016 if (watcher) { 41017 if (watcher.dirty) { 41018 watcher.evaluate(); 41019 } 41020 if (Dep.target) { 41021 if (Dep.target.onTrack) { 41022 Dep.target.onTrack({ 41023 effect: Dep.target, 41024 target: ref, 41025 type: "get" /* TrackOpTypes.GET */, 41026 key: 'value' 41027 }); 41028 } 41029 watcher.depend(); 41030 } 41031 return watcher.value; 41032 } 41033 else { 41034 return getter(); 41035 } 41036 }, 41037 set value(newVal) { 41038 setter(newVal); 41039 } 41040 }; 41041 def(ref, RefFlag, true); 41042 def(ref, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, onlyGetter); 41043 return ref; 41044} 41045 41046const WATCHER = `watcher`; 41047const WATCHER_CB = `${WATCHER} callback`; 41048const WATCHER_GETTER = `${WATCHER} getter`; 41049const WATCHER_CLEANUP = `${WATCHER} cleanup`; 41050// Simple effect. 41051function watchEffect(effect, options) { 41052 return doWatch(effect, null, options); 41053} 41054function watchPostEffect(effect, options) { 41055 return doWatch(effect, null, (Object.assign(Object.assign({}, options), { flush: 'post' }) )); 41056} 41057function watchSyncEffect(effect, options) { 41058 return doWatch(effect, null, (Object.assign(Object.assign({}, options), { flush: 'sync' }) )); 41059} 41060// initial value for watchers to trigger on undefined initial values 41061const INITIAL_WATCHER_VALUE = {}; 41062// implementation 41063function watch(source, cb, options) { 41064 if (typeof cb !== 'function') { 41065 warn(`\`watch(fn, options?)\` signature has been moved to a separate API. ` + 41066 `Use \`watchEffect(fn, options?)\` instead. \`watch\` now only ` + 41067 `supports \`watch(source, cb, options?) signature.`); 41068 } 41069 return doWatch(source, cb, options); 41070} 41071function doWatch(source, cb, { immediate, deep, flush = 'pre', onTrack, onTrigger } = emptyObject) { 41072 if (!cb) { 41073 if (immediate !== undefined) { 41074 warn(`watch() "immediate" option is only respected when using the ` + 41075 `watch(source, callback, options?) signature.`); 41076 } 41077 if (deep !== undefined) { 41078 warn(`watch() "deep" option is only respected when using the ` + 41079 `watch(source, callback, options?) signature.`); 41080 } 41081 } 41082 const warnInvalidSource = (s) => { 41083 warn(`Invalid watch source: ${s}. A watch source can only be a getter/effect ` + 41084 `function, a ref, a reactive object, or an array of these types.`); 41085 }; 41086 const instance = currentInstance; 41087 const call = (fn, type, args = null) => { 41088 const res = invokeWithErrorHandling(fn, null, args, instance, type); 41089 if (deep && res && res.__ob__) 41090 res.__ob__.dep.depend(); 41091 return res; 41092 }; 41093 let getter; 41094 let forceTrigger = false; 41095 let isMultiSource = false; 41096 if (isRef(source)) { 41097 getter = () => source.value; 41098 forceTrigger = isShallow(source); 41099 } 41100 else if (isReactive(source)) { 41101 getter = () => { 41102 source.__ob__.dep.depend(); 41103 return source; 41104 }; 41105 deep = true; 41106 } 41107 else if (isArray(source)) { 41108 isMultiSource = true; 41109 forceTrigger = source.some(s => isReactive(s) || isShallow(s)); 41110 getter = () => source.map(s => { 41111 if (isRef(s)) { 41112 return s.value; 41113 } 41114 else if (isReactive(s)) { 41115 s.__ob__.dep.depend(); 41116 return traverse(s); 41117 } 41118 else if (isFunction(s)) { 41119 return call(s, WATCHER_GETTER); 41120 } 41121 else { 41122 warnInvalidSource(s); 41123 } 41124 }); 41125 } 41126 else if (isFunction(source)) { 41127 if (cb) { 41128 // getter with cb 41129 getter = () => call(source, WATCHER_GETTER); 41130 } 41131 else { 41132 // no cb -> simple effect 41133 getter = () => { 41134 if (instance && instance._isDestroyed) { 41135 return; 41136 } 41137 if (cleanup) { 41138 cleanup(); 41139 } 41140 return call(source, WATCHER, [onCleanup]); 41141 }; 41142 } 41143 } 41144 else { 41145 getter = noop; 41146 warnInvalidSource(source); 41147 } 41148 if (cb && deep) { 41149 const baseGetter = getter; 41150 getter = () => traverse(baseGetter()); 41151 } 41152 let cleanup; 41153 let onCleanup = (fn) => { 41154 cleanup = watcher.onStop = () => { 41155 call(fn, WATCHER_CLEANUP); 41156 }; 41157 }; 41158 // in SSR there is no need to setup an actual effect, and it should be noop 41159 // unless it's eager 41160 if (isServerRendering()) { 41161 // we will also not call the invalidate callback (+ runner is not set up) 41162 onCleanup = noop; 41163 if (!cb) { 41164 getter(); 41165 } 41166 else if (immediate) { 41167 call(cb, WATCHER_CB, [ 41168 getter(), 41169 isMultiSource ? [] : undefined, 41170 onCleanup 41171 ]); 41172 } 41173 return noop; 41174 } 41175 const watcher = new Watcher(currentInstance, getter, noop, { 41176 lazy: true 41177 }); 41178 watcher.noRecurse = !cb; 41179 let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE; 41180 // overwrite default run 41181 watcher.run = () => { 41182 if (!watcher.active) { 41183 return; 41184 } 41185 if (cb) { 41186 // watch(source, cb) 41187 const newValue = watcher.get(); 41188 if (deep || 41189 forceTrigger || 41190 (isMultiSource 41191 ? newValue.some((v, i) => hasChanged(v, oldValue[i])) 41192 : hasChanged(newValue, oldValue))) { 41193 // cleanup before running cb again 41194 if (cleanup) { 41195 cleanup(); 41196 } 41197 call(cb, WATCHER_CB, [ 41198 newValue, 41199 // pass undefined as the old value when it's changed for the first time 41200 oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue, 41201 onCleanup 41202 ]); 41203 oldValue = newValue; 41204 } 41205 } 41206 else { 41207 // watchEffect 41208 watcher.get(); 41209 } 41210 }; 41211 if (flush === 'sync') { 41212 watcher.update = watcher.run; 41213 } 41214 else if (flush === 'post') { 41215 watcher.post = true; 41216 watcher.update = () => queueWatcher(watcher); 41217 } 41218 else { 41219 // pre 41220 watcher.update = () => { 41221 if (instance && instance === currentInstance && !instance._isMounted) { 41222 // pre-watcher triggered before 41223 const buffer = instance._preWatchers || (instance._preWatchers = []); 41224 if (buffer.indexOf(watcher) < 0) 41225 buffer.push(watcher); 41226 } 41227 else { 41228 queueWatcher(watcher); 41229 } 41230 }; 41231 } 41232 { 41233 watcher.onTrack = onTrack; 41234 watcher.onTrigger = onTrigger; 41235 } 41236 // initial run 41237 if (cb) { 41238 if (immediate) { 41239 watcher.run(); 41240 } 41241 else { 41242 oldValue = watcher.get(); 41243 } 41244 } 41245 else if (flush === 'post' && instance) { 41246 instance.$once('hook:mounted', () => watcher.get()); 41247 } 41248 else { 41249 watcher.get(); 41250 } 41251 return () => { 41252 watcher.teardown(); 41253 }; 41254} 41255 41256let activeEffectScope; 41257class EffectScope { 41258 constructor(detached = false) { 41259 this.detached = detached; 41260 /** 41261 * @internal 41262 */ 41263 this.active = true; 41264 /** 41265 * @internal 41266 */ 41267 this.effects = []; 41268 /** 41269 * @internal 41270 */ 41271 this.cleanups = []; 41272 this.parent = activeEffectScope; 41273 if (!detached && activeEffectScope) { 41274 this.index = 41275 (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1; 41276 } 41277 } 41278 run(fn) { 41279 if (this.active) { 41280 const currentEffectScope = activeEffectScope; 41281 try { 41282 activeEffectScope = this; 41283 return fn(); 41284 } 41285 finally { 41286 activeEffectScope = currentEffectScope; 41287 } 41288 } 41289 else { 41290 warn(`cannot run an inactive effect scope.`); 41291 } 41292 } 41293 /** 41294 * This should only be called on non-detached scopes 41295 * @internal 41296 */ 41297 on() { 41298 activeEffectScope = this; 41299 } 41300 /** 41301 * This should only be called on non-detached scopes 41302 * @internal 41303 */ 41304 off() { 41305 activeEffectScope = this.parent; 41306 } 41307 stop(fromParent) { 41308 if (this.active) { 41309 let i, l; 41310 for (i = 0, l = this.effects.length; i < l; i++) { 41311 this.effects[i].teardown(); 41312 } 41313 for (i = 0, l = this.cleanups.length; i < l; i++) { 41314 this.cleanups[i](); 41315 } 41316 if (this.scopes) { 41317 for (i = 0, l = this.scopes.length; i < l; i++) { 41318 this.scopes[i].stop(true); 41319 } 41320 } 41321 // nested scope, dereference from parent to avoid memory leaks 41322 if (!this.detached && this.parent && !fromParent) { 41323 // optimized O(1) removal 41324 const last = this.parent.scopes.pop(); 41325 if (last && last !== this) { 41326 this.parent.scopes[this.index] = last; 41327 last.index = this.index; 41328 } 41329 } 41330 this.parent = undefined; 41331 this.active = false; 41332 } 41333 } 41334} 41335function effectScope(detached) { 41336 return new EffectScope(detached); 41337} 41338/** 41339 * @internal 41340 */ 41341function recordEffectScope(effect, scope = activeEffectScope) { 41342 if (scope && scope.active) { 41343 scope.effects.push(effect); 41344 } 41345} 41346function getCurrentScope() { 41347 return activeEffectScope; 41348} 41349function onScopeDispose(fn) { 41350 if (activeEffectScope) { 41351 activeEffectScope.cleanups.push(fn); 41352 } 41353 else { 41354 warn(`onScopeDispose() is called when there is no active effect scope` + 41355 ` to be associated with.`); 41356 } 41357} 41358 41359function provide(key, value) { 41360 if (!currentInstance) { 41361 { 41362 warn(`provide() can only be used inside setup().`); 41363 } 41364 } 41365 else { 41366 // TS doesn't allow symbol as index type 41367 resolveProvided(currentInstance)[key] = value; 41368 } 41369} 41370function resolveProvided(vm) { 41371 // by default an instance inherits its parent's provides object 41372 // but when it needs to provide values of its own, it creates its 41373 // own provides object using parent provides object as prototype. 41374 // this way in `inject` we can simply look up injections from direct 41375 // parent and let the prototype chain do the work. 41376 const existing = vm._provided; 41377 const parentProvides = vm.$parent && vm.$parent._provided; 41378 if (parentProvides === existing) { 41379 return (vm._provided = Object.create(parentProvides)); 41380 } 41381 else { 41382 return existing; 41383 } 41384} 41385function inject(key, defaultValue, treatDefaultAsFactory = false) { 41386 // fallback to `currentRenderingInstance` so that this can be called in 41387 // a functional component 41388 const instance = currentInstance; 41389 if (instance) { 41390 // #2400 41391 // to support `app.use` plugins, 41392 // fallback to appContext's `provides` if the instance is at root 41393 const provides = instance.$parent && instance.$parent._provided; 41394 if (provides && key in provides) { 41395 // TS doesn't allow symbol as index type 41396 return provides[key]; 41397 } 41398 else if (arguments.length > 1) { 41399 return treatDefaultAsFactory && isFunction(defaultValue) 41400 ? defaultValue.call(instance) 41401 : defaultValue; 41402 } 41403 else { 41404 warn(`injection "${String(key)}" not found.`); 41405 } 41406 } 41407 else { 41408 warn(`inject() can only be used inside setup() or functional components.`); 41409 } 41410} 41411 41412const normalizeEvent = cached((name) => { 41413 const passive = name.charAt(0) === '&'; 41414 name = passive ? name.slice(1) : name; 41415 const once = name.charAt(0) === '~'; // Prefixed last, checked first 41416 name = once ? name.slice(1) : name; 41417 const capture = name.charAt(0) === '!'; 41418 name = capture ? name.slice(1) : name; 41419 return { 41420 name, 41421 once, 41422 capture, 41423 passive 41424 }; 41425}); 41426function createFnInvoker(fns, vm) { 41427 function invoker() { 41428 const fns = invoker.fns; 41429 if (isArray(fns)) { 41430 const cloned = fns.slice(); 41431 for (let i = 0; i < cloned.length; i++) { 41432 invokeWithErrorHandling(cloned[i], null, arguments, vm, `v-on handler`); 41433 } 41434 } 41435 else { 41436 // return handler return value for single handlers 41437 return invokeWithErrorHandling(fns, null, arguments, vm, `v-on handler`); 41438 } 41439 } 41440 invoker.fns = fns; 41441 return invoker; 41442} 41443function updateListeners(on, oldOn, add, remove, createOnceHandler, vm) { 41444 let name, cur, old, event; 41445 for (name in on) { 41446 cur = on[name]; 41447 old = oldOn[name]; 41448 event = normalizeEvent(name); 41449 if (isUndef(cur)) { 41450 warn(`Invalid handler for event "${event.name}": got ` + String(cur), vm); 41451 } 41452 else if (isUndef(old)) { 41453 if (isUndef(cur.fns)) { 41454 cur = on[name] = createFnInvoker(cur, vm); 41455 } 41456 if (isTrue(event.once)) { 41457 cur = on[name] = createOnceHandler(event.name, cur, event.capture); 41458 } 41459 add(event.name, cur, event.capture, event.passive, event.params); 41460 } 41461 else if (cur !== old) { 41462 old.fns = cur; 41463 on[name] = old; 41464 } 41465 } 41466 for (name in oldOn) { 41467 if (isUndef(on[name])) { 41468 event = normalizeEvent(name); 41469 remove(event.name, oldOn[name], event.capture); 41470 } 41471 } 41472} 41473 41474function mergeVNodeHook(def, hookKey, hook) { 41475 if (def instanceof VNode) { 41476 def = def.data.hook || (def.data.hook = {}); 41477 } 41478 let invoker; 41479 const oldHook = def[hookKey]; 41480 function wrappedHook() { 41481 hook.apply(this, arguments); 41482 // important: remove merged hook to ensure it's called only once 41483 // and prevent memory leak 41484 remove$2(invoker.fns, wrappedHook); 41485 } 41486 if (isUndef(oldHook)) { 41487 // no existing hook 41488 invoker = createFnInvoker([wrappedHook]); 41489 } 41490 else { 41491 /* istanbul ignore if */ 41492 if (isDef(oldHook.fns) && isTrue(oldHook.merged)) { 41493 // already a merged invoker 41494 invoker = oldHook; 41495 invoker.fns.push(wrappedHook); 41496 } 41497 else { 41498 // existing plain hook 41499 invoker = createFnInvoker([oldHook, wrappedHook]); 41500 } 41501 } 41502 invoker.merged = true; 41503 def[hookKey] = invoker; 41504} 41505 41506function extractPropsFromVNodeData(data, Ctor, tag) { 41507 // we are only extracting raw values here. 41508 // validation and default values are handled in the child 41509 // component itself. 41510 const propOptions = Ctor.options.props; 41511 if (isUndef(propOptions)) { 41512 return; 41513 } 41514 const res = {}; 41515 const { attrs, props } = data; 41516 if (isDef(attrs) || isDef(props)) { 41517 for (const key in propOptions) { 41518 const altKey = hyphenate(key); 41519 { 41520 const keyInLowerCase = key.toLowerCase(); 41521 if (key !== keyInLowerCase && attrs && hasOwn(attrs, keyInLowerCase)) { 41522 tip(`Prop "${keyInLowerCase}" is passed to component ` + 41523 `${formatComponentName( 41524 // @ts-expect-error tag is string 41525 tag || Ctor)}, but the declared prop name is` + 41526 ` "${key}". ` + 41527 `Note that HTML attributes are case-insensitive and camelCased ` + 41528 `props need to use their kebab-case equivalents when using in-DOM ` + 41529 `templates. You should probably use "${altKey}" instead of "${key}".`); 41530 } 41531 } 41532 checkProp(res, props, key, altKey, true) || 41533 checkProp(res, attrs, key, altKey, false); 41534 } 41535 } 41536 return res; 41537} 41538function checkProp(res, hash, key, altKey, preserve) { 41539 if (isDef(hash)) { 41540 if (hasOwn(hash, key)) { 41541 res[key] = hash[key]; 41542 if (!preserve) { 41543 delete hash[key]; 41544 } 41545 return true; 41546 } 41547 else if (hasOwn(hash, altKey)) { 41548 res[key] = hash[altKey]; 41549 if (!preserve) { 41550 delete hash[altKey]; 41551 } 41552 return true; 41553 } 41554 } 41555 return false; 41556} 41557 41558// The template compiler attempts to minimize the need for normalization by 41559// statically analyzing the template at compile time. 41560// 41561// For plain HTML markup, normalization can be completely skipped because the 41562// generated render function is guaranteed to return Array<VNode>. There are 41563// two cases where extra normalization is needed: 41564// 1. When the children contains components - because a functional component 41565// may return an Array instead of a single root. In this case, just a simple 41566// normalization is needed - if any child is an Array, we flatten the whole 41567// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep 41568// because functional components already normalize their own children. 41569function simpleNormalizeChildren(children) { 41570 for (let i = 0; i < children.length; i++) { 41571 if (isArray(children[i])) { 41572 return Array.prototype.concat.apply([], children); 41573 } 41574 } 41575 return children; 41576} 41577// 2. When the children contains constructs that always generated nested Arrays, 41578// e.g. <template>, <slot>, v-for, or when the children is provided by user 41579// with hand-written render functions / JSX. In such cases a full normalization 41580// is needed to cater to all possible types of children values. 41581function normalizeChildren(children) { 41582 return isPrimitive(children) 41583 ? [createTextVNode(children)] 41584 : isArray(children) 41585 ? normalizeArrayChildren(children) 41586 : undefined; 41587} 41588function isTextNode(node) { 41589 return isDef(node) && isDef(node.text) && isFalse(node.isComment); 41590} 41591function normalizeArrayChildren(children, nestedIndex) { 41592 const res = []; 41593 let i, c, lastIndex, last; 41594 for (i = 0; i < children.length; i++) { 41595 c = children[i]; 41596 if (isUndef(c) || typeof c === 'boolean') 41597 continue; 41598 lastIndex = res.length - 1; 41599 last = res[lastIndex]; 41600 // nested 41601 if (isArray(c)) { 41602 if (c.length > 0) { 41603 c = normalizeArrayChildren(c, `${nestedIndex || ''}_${i}`); 41604 // merge adjacent text nodes 41605 if (isTextNode(c[0]) && isTextNode(last)) { 41606 res[lastIndex] = createTextVNode(last.text + c[0].text); 41607 c.shift(); 41608 } 41609 res.push.apply(res, c); 41610 } 41611 } 41612 else if (isPrimitive(c)) { 41613 if (isTextNode(last)) { 41614 // merge adjacent text nodes 41615 // this is necessary for SSR hydration because text nodes are 41616 // essentially merged when rendered to HTML strings 41617 res[lastIndex] = createTextVNode(last.text + c); 41618 } 41619 else if (c !== '') { 41620 // convert primitive to vnode 41621 res.push(createTextVNode(c)); 41622 } 41623 } 41624 else { 41625 if (isTextNode(c) && isTextNode(last)) { 41626 // merge adjacent text nodes 41627 res[lastIndex] = createTextVNode(last.text + c.text); 41628 } 41629 else { 41630 // default key for nested array children (likely generated by v-for) 41631 if (isTrue(children._isVList) && 41632 isDef(c.tag) && 41633 isUndef(c.key) && 41634 isDef(nestedIndex)) { 41635 c.key = `__vlist${nestedIndex}_${i}__`; 41636 } 41637 res.push(c); 41638 } 41639 } 41640 } 41641 return res; 41642} 41643 41644/** 41645 * Runtime helper for rendering v-for lists. 41646 */ 41647function renderList(val, render) { 41648 let ret = null, i, l, keys, key; 41649 if (isArray(val) || typeof val === 'string') { 41650 ret = new Array(val.length); 41651 for (i = 0, l = val.length; i < l; i++) { 41652 ret[i] = render(val[i], i); 41653 } 41654 } 41655 else if (typeof val === 'number') { 41656 ret = new Array(val); 41657 for (i = 0; i < val; i++) { 41658 ret[i] = render(i + 1, i); 41659 } 41660 } 41661 else if (isObject(val)) { 41662 if (hasSymbol && val[Symbol.iterator]) { 41663 ret = []; 41664 const iterator = val[Symbol.iterator](); 41665 let result = iterator.next(); 41666 while (!result.done) { 41667 ret.push(render(result.value, ret.length)); 41668 result = iterator.next(); 41669 } 41670 } 41671 else { 41672 keys = Object.keys(val); 41673 ret = new Array(keys.length); 41674 for (i = 0, l = keys.length; i < l; i++) { 41675 key = keys[i]; 41676 ret[i] = render(val[key], key, i); 41677 } 41678 } 41679 } 41680 if (!isDef(ret)) { 41681 ret = []; 41682 } 41683 ret._isVList = true; 41684 return ret; 41685} 41686 41687/** 41688 * Runtime helper for rendering <slot> 41689 */ 41690function renderSlot(name, fallbackRender, props, bindObject) { 41691 const scopedSlotFn = this.$scopedSlots[name]; 41692 let nodes; 41693 if (scopedSlotFn) { 41694 // scoped slot 41695 props = props || {}; 41696 if (bindObject) { 41697 if (!isObject(bindObject)) { 41698 warn('slot v-bind without argument expects an Object', this); 41699 } 41700 props = extend(extend({}, bindObject), props); 41701 } 41702 nodes = 41703 scopedSlotFn(props) || 41704 (isFunction(fallbackRender) ? fallbackRender() : fallbackRender); 41705 } 41706 else { 41707 nodes = 41708 this.$slots[name] || 41709 (isFunction(fallbackRender) ? fallbackRender() : fallbackRender); 41710 } 41711 const target = props && props.slot; 41712 if (target) { 41713 return this.$createElement('template', { slot: target }, nodes); 41714 } 41715 else { 41716 return nodes; 41717 } 41718} 41719 41720/** 41721 * Runtime helper for resolving filters 41722 */ 41723function resolveFilter(id) { 41724 return resolveAsset(this.$options, 'filters', id, true) || identity; 41725} 41726 41727function isKeyNotMatch(expect, actual) { 41728 if (isArray(expect)) { 41729 return expect.indexOf(actual) === -1; 41730 } 41731 else { 41732 return expect !== actual; 41733 } 41734} 41735/** 41736 * Runtime helper for checking keyCodes from config. 41737 * exposed as Vue.prototype._k 41738 * passing in eventKeyName as last argument separately for backwards compat 41739 */ 41740function checkKeyCodes(eventKeyCode, key, builtInKeyCode, eventKeyName, builtInKeyName) { 41741 const mappedKeyCode = config.keyCodes[key] || builtInKeyCode; 41742 if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { 41743 return isKeyNotMatch(builtInKeyName, eventKeyName); 41744 } 41745 else if (mappedKeyCode) { 41746 return isKeyNotMatch(mappedKeyCode, eventKeyCode); 41747 } 41748 else if (eventKeyName) { 41749 return hyphenate(eventKeyName) !== key; 41750 } 41751 return eventKeyCode === undefined; 41752} 41753 41754/** 41755 * Runtime helper for merging v-bind="object" into a VNode's data. 41756 */ 41757function bindObjectProps(data, tag, value, asProp, isSync) { 41758 if (value) { 41759 if (!isObject(value)) { 41760 warn('v-bind without argument expects an Object or Array value', this); 41761 } 41762 else { 41763 if (isArray(value)) { 41764 value = toObject(value); 41765 } 41766 let hash; 41767 for (const key in value) { 41768 if (key === 'class' || key === 'style' || isReservedAttribute(key)) { 41769 hash = data; 41770 } 41771 else { 41772 const type = data.attrs && data.attrs.type; 41773 hash = 41774 asProp || config.mustUseProp(tag, type, key) 41775 ? data.domProps || (data.domProps = {}) 41776 : data.attrs || (data.attrs = {}); 41777 } 41778 const camelizedKey = camelize(key); 41779 const hyphenatedKey = hyphenate(key); 41780 if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) { 41781 hash[key] = value[key]; 41782 if (isSync) { 41783 const on = data.on || (data.on = {}); 41784 on[`update:${key}`] = function ($event) { 41785 value[key] = $event; 41786 }; 41787 } 41788 } 41789 } 41790 } 41791 } 41792 return data; 41793} 41794 41795/** 41796 * Runtime helper for rendering static trees. 41797 */ 41798function renderStatic(index, isInFor) { 41799 const cached = this._staticTrees || (this._staticTrees = []); 41800 let tree = cached[index]; 41801 // if has already-rendered static tree and not inside v-for, 41802 // we can reuse the same tree. 41803 if (tree && !isInFor) { 41804 return tree; 41805 } 41806 // otherwise, render a fresh tree. 41807 tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, this._c, this // for render fns generated for functional component templates 41808 ); 41809 markStatic(tree, `__static__${index}`, false); 41810 return tree; 41811} 41812/** 41813 * Runtime helper for v-once. 41814 * Effectively it means marking the node as static with a unique key. 41815 */ 41816function markOnce(tree, index, key) { 41817 markStatic(tree, `__once__${index}${key ? `_${key}` : ``}`, true); 41818 return tree; 41819} 41820function markStatic(tree, key, isOnce) { 41821 if (isArray(tree)) { 41822 for (let i = 0; i < tree.length; i++) { 41823 if (tree[i] && typeof tree[i] !== 'string') { 41824 markStaticNode(tree[i], `${key}_${i}`, isOnce); 41825 } 41826 } 41827 } 41828 else { 41829 markStaticNode(tree, key, isOnce); 41830 } 41831} 41832function markStaticNode(node, key, isOnce) { 41833 node.isStatic = true; 41834 node.key = key; 41835 node.isOnce = isOnce; 41836} 41837 41838function bindObjectListeners(data, value) { 41839 if (value) { 41840 if (!isPlainObject(value)) { 41841 warn('v-on without argument expects an Object value', this); 41842 } 41843 else { 41844 const on = (data.on = data.on ? extend({}, data.on) : {}); 41845 for (const key in value) { 41846 const existing = on[key]; 41847 const ours = value[key]; 41848 on[key] = existing ? [].concat(existing, ours) : ours; 41849 } 41850 } 41851 } 41852 return data; 41853} 41854 41855function resolveScopedSlots(fns, res, 41856// the following are added in 2.6 41857hasDynamicKeys, contentHashKey) { 41858 res = res || { $stable: !hasDynamicKeys }; 41859 for (let i = 0; i < fns.length; i++) { 41860 const slot = fns[i]; 41861 if (isArray(slot)) { 41862 resolveScopedSlots(slot, res, hasDynamicKeys); 41863 } 41864 else if (slot) { 41865 // marker for reverse proxying v-slot without scope on this.$slots 41866 // @ts-expect-error 41867 if (slot.proxy) { 41868 // @ts-expect-error 41869 slot.fn.proxy = true; 41870 } 41871 res[slot.key] = slot.fn; 41872 } 41873 } 41874 if (contentHashKey) { 41875 res.$key = contentHashKey; 41876 } 41877 return res; 41878} 41879 41880// helper to process dynamic keys for dynamic arguments in v-bind and v-on. 41881function bindDynamicKeys(baseObj, values) { 41882 for (let i = 0; i < values.length; i += 2) { 41883 const key = values[i]; 41884 if (typeof key === 'string' && key) { 41885 baseObj[values[i]] = values[i + 1]; 41886 } 41887 else if (key !== '' && key !== null) { 41888 // null is a special value for explicitly removing a binding 41889 warn(`Invalid value for dynamic directive argument (expected string or null): ${key}`, this); 41890 } 41891 } 41892 return baseObj; 41893} 41894// helper to dynamically append modifier runtime markers to event names. 41895// ensure only append when value is already string, otherwise it will be cast 41896// to string and cause the type check to miss. 41897function prependModifier(value, symbol) { 41898 return typeof value === 'string' ? symbol + value : value; 41899} 41900 41901function installRenderHelpers(target) { 41902 target._o = markOnce; 41903 target._n = toNumber; 41904 target._s = toString; 41905 target._l = renderList; 41906 target._t = renderSlot; 41907 target._q = looseEqual; 41908 target._i = looseIndexOf; 41909 target._m = renderStatic; 41910 target._f = resolveFilter; 41911 target._k = checkKeyCodes; 41912 target._b = bindObjectProps; 41913 target._v = createTextVNode; 41914 target._e = createEmptyVNode; 41915 target._u = resolveScopedSlots; 41916 target._g = bindObjectListeners; 41917 target._d = bindDynamicKeys; 41918 target._p = prependModifier; 41919} 41920 41921/** 41922 * Runtime helper for resolving raw children VNodes into a slot object. 41923 */ 41924function resolveSlots(children, context) { 41925 if (!children || !children.length) { 41926 return {}; 41927 } 41928 const slots = {}; 41929 for (let i = 0, l = children.length; i < l; i++) { 41930 const child = children[i]; 41931 const data = child.data; 41932 // remove slot attribute if the node is resolved as a Vue slot node 41933 if (data && data.attrs && data.attrs.slot) { 41934 delete data.attrs.slot; 41935 } 41936 // named slots should only be respected if the vnode was rendered in the 41937 // same context. 41938 if ((child.context === context || child.fnContext === context) && 41939 data && 41940 data.slot != null) { 41941 const name = data.slot; 41942 const slot = slots[name] || (slots[name] = []); 41943 if (child.tag === 'template') { 41944 slot.push.apply(slot, child.children || []); 41945 } 41946 else { 41947 slot.push(child); 41948 } 41949 } 41950 else { 41951 (slots.default || (slots.default = [])).push(child); 41952 } 41953 } 41954 // ignore slots that contains only whitespace 41955 for (const name in slots) { 41956 if (slots[name].every(isWhitespace)) { 41957 delete slots[name]; 41958 } 41959 } 41960 return slots; 41961} 41962function isWhitespace(node) { 41963 return (node.isComment && !node.asyncFactory) || node.text === ' '; 41964} 41965 41966function isAsyncPlaceholder(node) { 41967 // @ts-expect-error not really boolean type 41968 return node.isComment && node.asyncFactory; 41969} 41970 41971function normalizeScopedSlots(ownerVm, scopedSlots, normalSlots, prevScopedSlots) { 41972 let res; 41973 const hasNormalSlots = Object.keys(normalSlots).length > 0; 41974 const isStable = scopedSlots ? !!scopedSlots.$stable : !hasNormalSlots; 41975 const key = scopedSlots && scopedSlots.$key; 41976 if (!scopedSlots) { 41977 res = {}; 41978 } 41979 else if (scopedSlots._normalized) { 41980 // fast path 1: child component re-render only, parent did not change 41981 return scopedSlots._normalized; 41982 } 41983 else if (isStable && 41984 prevScopedSlots && 41985 prevScopedSlots !== emptyObject && 41986 key === prevScopedSlots.$key && 41987 !hasNormalSlots && 41988 !prevScopedSlots.$hasNormal) { 41989 // fast path 2: stable scoped slots w/ no normal slots to proxy, 41990 // only need to normalize once 41991 return prevScopedSlots; 41992 } 41993 else { 41994 res = {}; 41995 for (const key in scopedSlots) { 41996 if (scopedSlots[key] && key[0] !== '$') { 41997 res[key] = normalizeScopedSlot(ownerVm, normalSlots, key, scopedSlots[key]); 41998 } 41999 } 42000 } 42001 // expose normal slots on scopedSlots 42002 for (const key in normalSlots) { 42003 if (!(key in res)) { 42004 res[key] = proxyNormalSlot(normalSlots, key); 42005 } 42006 } 42007 // avoriaz seems to mock a non-extensible $scopedSlots object 42008 // and when that is passed down this would cause an error 42009 if (scopedSlots && Object.isExtensible(scopedSlots)) { 42010 scopedSlots._normalized = res; 42011 } 42012 def(res, '$stable', isStable); 42013 def(res, '$key', key); 42014 def(res, '$hasNormal', hasNormalSlots); 42015 return res; 42016} 42017function normalizeScopedSlot(vm, normalSlots, key, fn) { 42018 const normalized = function () { 42019 const cur = currentInstance; 42020 setCurrentInstance(vm); 42021 let res = arguments.length ? fn.apply(null, arguments) : fn({}); 42022 res = 42023 res && typeof res === 'object' && !isArray(res) 42024 ? [res] // single vnode 42025 : normalizeChildren(res); 42026 const vnode = res && res[0]; 42027 setCurrentInstance(cur); 42028 return res && 42029 (!vnode || 42030 (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode))) // #9658, #10391 42031 ? undefined 42032 : res; 42033 }; 42034 // this is a slot using the new v-slot syntax without scope. although it is 42035 // compiled as a scoped slot, render fn users would expect it to be present 42036 // on this.$slots because the usage is semantically a normal slot. 42037 if (fn.proxy) { 42038 Object.defineProperty(normalSlots, key, { 42039 get: normalized, 42040 enumerable: true, 42041 configurable: true 42042 }); 42043 } 42044 return normalized; 42045} 42046function proxyNormalSlot(slots, key) { 42047 return () => slots[key]; 42048} 42049 42050function initSetup(vm) { 42051 const options = vm.$options; 42052 const setup = options.setup; 42053 if (setup) { 42054 const ctx = (vm._setupContext = createSetupContext(vm)); 42055 setCurrentInstance(vm); 42056 pushTarget(); 42057 const setupResult = invokeWithErrorHandling(setup, null, [vm._props || shallowReactive({}), ctx], vm, `setup`); 42058 popTarget(); 42059 setCurrentInstance(); 42060 if (isFunction(setupResult)) { 42061 // render function 42062 // @ts-ignore 42063 options.render = setupResult; 42064 } 42065 else if (isObject(setupResult)) { 42066 // bindings 42067 if (setupResult instanceof VNode) { 42068 warn(`setup() should not return VNodes directly - ` + 42069 `return a render function instead.`); 42070 } 42071 vm._setupState = setupResult; 42072 // __sfc indicates compiled bindings from <script setup> 42073 if (!setupResult.__sfc) { 42074 for (const key in setupResult) { 42075 if (!isReserved(key)) { 42076 proxyWithRefUnwrap(vm, setupResult, key); 42077 } 42078 else { 42079 warn(`Avoid using variables that start with _ or $ in setup().`); 42080 } 42081 } 42082 } 42083 else { 42084 // exposed for compiled render fn 42085 const proxy = (vm._setupProxy = {}); 42086 for (const key in setupResult) { 42087 if (key !== '__sfc') { 42088 proxyWithRefUnwrap(proxy, setupResult, key); 42089 } 42090 } 42091 } 42092 } 42093 else if (setupResult !== undefined) { 42094 warn(`setup() should return an object. Received: ${setupResult === null ? 'null' : typeof setupResult}`); 42095 } 42096 } 42097} 42098function createSetupContext(vm) { 42099 let exposeCalled = false; 42100 return { 42101 get attrs() { 42102 if (!vm._attrsProxy) { 42103 const proxy = (vm._attrsProxy = {}); 42104 def(proxy, '_v_attr_proxy', true); 42105 syncSetupProxy(proxy, vm.$attrs, emptyObject, vm, '$attrs'); 42106 } 42107 return vm._attrsProxy; 42108 }, 42109 get listeners() { 42110 if (!vm._listenersProxy) { 42111 const proxy = (vm._listenersProxy = {}); 42112 syncSetupProxy(proxy, vm.$listeners, emptyObject, vm, '$listeners'); 42113 } 42114 return vm._listenersProxy; 42115 }, 42116 get slots() { 42117 return initSlotsProxy(vm); 42118 }, 42119 emit: bind(vm.$emit, vm), 42120 expose(exposed) { 42121 { 42122 if (exposeCalled) { 42123 warn(`expose() should be called only once per setup().`, vm); 42124 } 42125 exposeCalled = true; 42126 } 42127 if (exposed) { 42128 Object.keys(exposed).forEach(key => proxyWithRefUnwrap(vm, exposed, key)); 42129 } 42130 } 42131 }; 42132} 42133function syncSetupProxy(to, from, prev, instance, type) { 42134 let changed = false; 42135 for (const key in from) { 42136 if (!(key in to)) { 42137 changed = true; 42138 defineProxyAttr(to, key, instance, type); 42139 } 42140 else if (from[key] !== prev[key]) { 42141 changed = true; 42142 } 42143 } 42144 for (const key in to) { 42145 if (!(key in from)) { 42146 changed = true; 42147 delete to[key]; 42148 } 42149 } 42150 return changed; 42151} 42152function defineProxyAttr(proxy, key, instance, type) { 42153 Object.defineProperty(proxy, key, { 42154 enumerable: true, 42155 configurable: true, 42156 get() { 42157 return instance[type][key]; 42158 } 42159 }); 42160} 42161function initSlotsProxy(vm) { 42162 if (!vm._slotsProxy) { 42163 syncSetupSlots((vm._slotsProxy = {}), vm.$scopedSlots); 42164 } 42165 return vm._slotsProxy; 42166} 42167function syncSetupSlots(to, from) { 42168 for (const key in from) { 42169 to[key] = from[key]; 42170 } 42171 for (const key in to) { 42172 if (!(key in from)) { 42173 delete to[key]; 42174 } 42175 } 42176} 42177/** 42178 * @internal use manual type def because public setup context type relies on 42179 * legacy VNode types 42180 */ 42181function useSlots() { 42182 return getContext().slots; 42183} 42184/** 42185 * @internal use manual type def because public setup context type relies on 42186 * legacy VNode types 42187 */ 42188function useAttrs() { 42189 return getContext().attrs; 42190} 42191/** 42192 * Vue 2 only 42193 * @internal use manual type def because public setup context type relies on 42194 * legacy VNode types 42195 */ 42196function useListeners() { 42197 return getContext().listeners; 42198} 42199function getContext() { 42200 if (!currentInstance) { 42201 warn(`useContext() called without active instance.`); 42202 } 42203 const vm = currentInstance; 42204 return vm._setupContext || (vm._setupContext = createSetupContext(vm)); 42205} 42206/** 42207 * Runtime helper for merging default declarations. Imported by compiled code 42208 * only. 42209 * @internal 42210 */ 42211function mergeDefaults(raw, defaults) { 42212 const props = isArray(raw) 42213 ? raw.reduce((normalized, p) => ((normalized[p] = {}), normalized), {}) 42214 : raw; 42215 for (const key in defaults) { 42216 const opt = props[key]; 42217 if (opt) { 42218 if (isArray(opt) || isFunction(opt)) { 42219 props[key] = { type: opt, default: defaults[key] }; 42220 } 42221 else { 42222 opt.default = defaults[key]; 42223 } 42224 } 42225 else if (opt === null) { 42226 props[key] = { default: defaults[key] }; 42227 } 42228 else { 42229 warn(`props default key "${key}" has no corresponding declaration.`); 42230 } 42231 } 42232 return props; 42233} 42234 42235function initRender(vm) { 42236 vm._vnode = null; // the root of the child tree 42237 vm._staticTrees = null; // v-once cached trees 42238 const options = vm.$options; 42239 const parentVnode = (vm.$vnode = options._parentVnode); // the placeholder node in parent tree 42240 const renderContext = parentVnode && parentVnode.context; 42241 vm.$slots = resolveSlots(options._renderChildren, renderContext); 42242 vm.$scopedSlots = parentVnode 42243 ? normalizeScopedSlots(vm.$parent, parentVnode.data.scopedSlots, vm.$slots) 42244 : emptyObject; 42245 // bind the createElement fn to this instance 42246 // so that we get proper render context inside it. 42247 // args order: tag, data, children, normalizationType, alwaysNormalize 42248 // internal version is used by render functions compiled from templates 42249 // @ts-expect-error 42250 vm._c = (a, b, c, d) => createElement$1(vm, a, b, c, d, false); 42251 // normalization is always applied for the public version, used in 42252 // user-written render functions. 42253 // @ts-expect-error 42254 vm.$createElement = (a, b, c, d) => createElement$1(vm, a, b, c, d, true); 42255 // $attrs & $listeners are exposed for easier HOC creation. 42256 // they need to be reactive so that HOCs using them are always updated 42257 const parentData = parentVnode && parentVnode.data; 42258 /* istanbul ignore else */ 42259 { 42260 defineReactive(vm, '$attrs', (parentData && parentData.attrs) || emptyObject, () => { 42261 !isUpdatingChildComponent && warn(`$attrs is readonly.`, vm); 42262 }, true); 42263 defineReactive(vm, '$listeners', options._parentListeners || emptyObject, () => { 42264 !isUpdatingChildComponent && warn(`$listeners is readonly.`, vm); 42265 }, true); 42266 } 42267} 42268let currentRenderingInstance = null; 42269function renderMixin(Vue) { 42270 // install runtime convenience helpers 42271 installRenderHelpers(Vue.prototype); 42272 Vue.prototype.$nextTick = function (fn) { 42273 return nextTick(fn, this); 42274 }; 42275 Vue.prototype._render = function () { 42276 const vm = this; 42277 const { render, _parentVnode } = vm.$options; 42278 if (_parentVnode && vm._isMounted) { 42279 vm.$scopedSlots = normalizeScopedSlots(vm.$parent, _parentVnode.data.scopedSlots, vm.$slots, vm.$scopedSlots); 42280 if (vm._slotsProxy) { 42281 syncSetupSlots(vm._slotsProxy, vm.$scopedSlots); 42282 } 42283 } 42284 // set parent vnode. this allows render functions to have access 42285 // to the data on the placeholder node. 42286 vm.$vnode = _parentVnode; 42287 // render self 42288 const prevInst = currentInstance; 42289 const prevRenderInst = currentRenderingInstance; 42290 let vnode; 42291 try { 42292 setCurrentInstance(vm); 42293 currentRenderingInstance = vm; 42294 vnode = render.call(vm._renderProxy, vm.$createElement); 42295 } 42296 catch (e) { 42297 handleError(e, vm, `render`); 42298 // return error render result, 42299 // or previous vnode to prevent render error causing blank component 42300 /* istanbul ignore else */ 42301 if (vm.$options.renderError) { 42302 try { 42303 vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e); 42304 } 42305 catch (e) { 42306 handleError(e, vm, `renderError`); 42307 vnode = vm._vnode; 42308 } 42309 } 42310 else { 42311 vnode = vm._vnode; 42312 } 42313 } 42314 finally { 42315 currentRenderingInstance = prevRenderInst; 42316 setCurrentInstance(prevInst); 42317 } 42318 // if the returned array contains only a single node, allow it 42319 if (isArray(vnode) && vnode.length === 1) { 42320 vnode = vnode[0]; 42321 } 42322 // return empty vnode in case the render function errored out 42323 if (!(vnode instanceof VNode)) { 42324 if (isArray(vnode)) { 42325 warn('Multiple root nodes returned from render function. Render function ' + 42326 'should return a single root node.', vm); 42327 } 42328 vnode = createEmptyVNode(); 42329 } 42330 // set parent 42331 vnode.parent = _parentVnode; 42332 return vnode; 42333 }; 42334} 42335 42336function ensureCtor(comp, base) { 42337 if (comp.__esModule || (hasSymbol && comp[Symbol.toStringTag] === 'Module')) { 42338 comp = comp.default; 42339 } 42340 return isObject(comp) ? base.extend(comp) : comp; 42341} 42342function createAsyncPlaceholder(factory, data, context, children, tag) { 42343 const node = createEmptyVNode(); 42344 node.asyncFactory = factory; 42345 node.asyncMeta = { data, context, children, tag }; 42346 return node; 42347} 42348function resolveAsyncComponent(factory, baseCtor) { 42349 if (isTrue(factory.error) && isDef(factory.errorComp)) { 42350 return factory.errorComp; 42351 } 42352 if (isDef(factory.resolved)) { 42353 return factory.resolved; 42354 } 42355 const owner = currentRenderingInstance; 42356 if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) { 42357 // already pending 42358 factory.owners.push(owner); 42359 } 42360 if (isTrue(factory.loading) && isDef(factory.loadingComp)) { 42361 return factory.loadingComp; 42362 } 42363 if (owner && !isDef(factory.owners)) { 42364 const owners = (factory.owners = [owner]); 42365 let sync = true; 42366 let timerLoading = null; 42367 let timerTimeout = null; 42368 owner.$on('hook:destroyed', () => remove$2(owners, owner)); 42369 const forceRender = (renderCompleted) => { 42370 for (let i = 0, l = owners.length; i < l; i++) { 42371 owners[i].$forceUpdate(); 42372 } 42373 if (renderCompleted) { 42374 owners.length = 0; 42375 if (timerLoading !== null) { 42376 clearTimeout(timerLoading); 42377 timerLoading = null; 42378 } 42379 if (timerTimeout !== null) { 42380 clearTimeout(timerTimeout); 42381 timerTimeout = null; 42382 } 42383 } 42384 }; 42385 const resolve = once((res) => { 42386 // cache resolved 42387 factory.resolved = ensureCtor(res, baseCtor); 42388 // invoke callbacks only if this is not a synchronous resolve 42389 // (async resolves are shimmed as synchronous during SSR) 42390 if (!sync) { 42391 forceRender(true); 42392 } 42393 else { 42394 owners.length = 0; 42395 } 42396 }); 42397 const reject = once(reason => { 42398 warn(`Failed to resolve async component: ${String(factory)}` + 42399 (reason ? `\nReason: ${reason}` : '')); 42400 if (isDef(factory.errorComp)) { 42401 factory.error = true; 42402 forceRender(true); 42403 } 42404 }); 42405 const res = factory(resolve, reject); 42406 if (isObject(res)) { 42407 if (isPromise(res)) { 42408 // () => Promise 42409 if (isUndef(factory.resolved)) { 42410 res.then(resolve, reject); 42411 } 42412 } 42413 else if (isPromise(res.component)) { 42414 res.component.then(resolve, reject); 42415 if (isDef(res.error)) { 42416 factory.errorComp = ensureCtor(res.error, baseCtor); 42417 } 42418 if (isDef(res.loading)) { 42419 factory.loadingComp = ensureCtor(res.loading, baseCtor); 42420 if (res.delay === 0) { 42421 factory.loading = true; 42422 } 42423 else { 42424 // @ts-expect-error NodeJS timeout type 42425 timerLoading = setTimeout(() => { 42426 timerLoading = null; 42427 if (isUndef(factory.resolved) && isUndef(factory.error)) { 42428 factory.loading = true; 42429 forceRender(false); 42430 } 42431 }, res.delay || 200); 42432 } 42433 } 42434 if (isDef(res.timeout)) { 42435 // @ts-expect-error NodeJS timeout type 42436 timerTimeout = setTimeout(() => { 42437 timerTimeout = null; 42438 if (isUndef(factory.resolved)) { 42439 reject(`timeout (${res.timeout}ms)` ); 42440 } 42441 }, res.timeout); 42442 } 42443 } 42444 } 42445 sync = false; 42446 // return in case resolved synchronously 42447 return factory.loading ? factory.loadingComp : factory.resolved; 42448 } 42449} 42450 42451function getFirstComponentChild(children) { 42452 if (isArray(children)) { 42453 for (let i = 0; i < children.length; i++) { 42454 const c = children[i]; 42455 if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) { 42456 return c; 42457 } 42458 } 42459 } 42460} 42461 42462const SIMPLE_NORMALIZE = 1; 42463const ALWAYS_NORMALIZE = 2; 42464// wrapper function for providing a more flexible interface 42465// without getting yelled at by flow 42466function createElement$1(context, tag, data, children, normalizationType, alwaysNormalize) { 42467 if (isArray(data) || isPrimitive(data)) { 42468 normalizationType = children; 42469 children = data; 42470 data = undefined; 42471 } 42472 if (isTrue(alwaysNormalize)) { 42473 normalizationType = ALWAYS_NORMALIZE; 42474 } 42475 return _createElement(context, tag, data, children, normalizationType); 42476} 42477function _createElement(context, tag, data, children, normalizationType) { 42478 if (isDef(data) && isDef(data.__ob__)) { 42479 warn(`Avoid using observed data object as vnode data: ${JSON.stringify(data)}\n` + 'Always create fresh vnode data objects in each render!', context); 42480 return createEmptyVNode(); 42481 } 42482 // object syntax in v-bind 42483 if (isDef(data) && isDef(data.is)) { 42484 tag = data.is; 42485 } 42486 if (!tag) { 42487 // in case of component :is set to falsy value 42488 return createEmptyVNode(); 42489 } 42490 // warn against non-primitive key 42491 if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)) { 42492 warn('Avoid using non-primitive value as key, ' + 42493 'use string/number value instead.', context); 42494 } 42495 // support single function children as default scoped slot 42496 if (isArray(children) && isFunction(children[0])) { 42497 data = data || {}; 42498 data.scopedSlots = { default: children[0] }; 42499 children.length = 0; 42500 } 42501 if (normalizationType === ALWAYS_NORMALIZE) { 42502 children = normalizeChildren(children); 42503 } 42504 else if (normalizationType === SIMPLE_NORMALIZE) { 42505 children = simpleNormalizeChildren(children); 42506 } 42507 let vnode, ns; 42508 if (typeof tag === 'string') { 42509 let Ctor; 42510 ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); 42511 if (config.isReservedTag(tag)) { 42512 // platform built-in elements 42513 if (isDef(data) && 42514 isDef(data.nativeOn) && 42515 data.tag !== 'component') { 42516 warn(`The .native modifier for v-on is only valid on components but it was used on <${tag}>.`, context); 42517 } 42518 vnode = new VNode(config.parsePlatformTagName(tag), data, children, undefined, undefined, context); 42519 } 42520 else if ((!data || !data.pre) && 42521 isDef((Ctor = resolveAsset(context.$options, 'components', tag)))) { 42522 // component 42523 vnode = createComponent(Ctor, data, context, children, tag); 42524 } 42525 else { 42526 // unknown or unlisted namespaced elements 42527 // check at runtime because it may get assigned a namespace when its 42528 // parent normalizes children 42529 vnode = new VNode(tag, data, children, undefined, undefined, context); 42530 } 42531 } 42532 else { 42533 // direct component options / constructor 42534 vnode = createComponent(tag, data, context, children); 42535 } 42536 if (isArray(vnode)) { 42537 return vnode; 42538 } 42539 else if (isDef(vnode)) { 42540 if (isDef(ns)) 42541 applyNS(vnode, ns); 42542 if (isDef(data)) 42543 registerDeepBindings(data); 42544 return vnode; 42545 } 42546 else { 42547 return createEmptyVNode(); 42548 } 42549} 42550function applyNS(vnode, ns, force) { 42551 vnode.ns = ns; 42552 if (vnode.tag === 'foreignObject') { 42553 // use default namespace inside foreignObject 42554 ns = undefined; 42555 force = true; 42556 } 42557 if (isDef(vnode.children)) { 42558 for (let i = 0, l = vnode.children.length; i < l; i++) { 42559 const child = vnode.children[i]; 42560 if (isDef(child.tag) && 42561 (isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { 42562 applyNS(child, ns, force); 42563 } 42564 } 42565 } 42566} 42567// ref #5318 42568// necessary to ensure parent re-render when deep bindings like :style and 42569// :class are used on slot nodes 42570function registerDeepBindings(data) { 42571 if (isObject(data.style)) { 42572 traverse(data.style); 42573 } 42574 if (isObject(data.class)) { 42575 traverse(data.class); 42576 } 42577} 42578 42579/** 42580 * @internal this function needs manual public type declaration because it relies 42581 * on previously manually authored types from Vue 2 42582 */ 42583function h(type, props, children) { 42584 if (!currentInstance) { 42585 warn(`globally imported h() can only be invoked when there is an active ` + 42586 `component instance, e.g. synchronously in a component's render or setup function.`); 42587 } 42588 return createElement$1(currentInstance, type, props, children, 2, true); 42589} 42590 42591function handleError(err, vm, info) { 42592 // Deactivate deps tracking while processing error handler to avoid possible infinite rendering. 42593 // See: https://github.com/vuejs/vuex/issues/1505 42594 pushTarget(); 42595 try { 42596 if (vm) { 42597 let cur = vm; 42598 while ((cur = cur.$parent)) { 42599 const hooks = cur.$options.errorCaptured; 42600 if (hooks) { 42601 for (let i = 0; i < hooks.length; i++) { 42602 try { 42603 const capture = hooks[i].call(cur, err, vm, info) === false; 42604 if (capture) 42605 return; 42606 } 42607 catch (e) { 42608 globalHandleError(e, cur, 'errorCaptured hook'); 42609 } 42610 } 42611 } 42612 } 42613 } 42614 globalHandleError(err, vm, info); 42615 } 42616 finally { 42617 popTarget(); 42618 } 42619} 42620function invokeWithErrorHandling(handler, context, args, vm, info) { 42621 let res; 42622 try { 42623 res = args ? handler.apply(context, args) : handler.call(context); 42624 if (res && !res._isVue && isPromise(res) && !res._handled) { 42625 res.catch(e => handleError(e, vm, info + ` (Promise/async)`)); 42626 res._handled = true; 42627 } 42628 } 42629 catch (e) { 42630 handleError(e, vm, info); 42631 } 42632 return res; 42633} 42634function globalHandleError(err, vm, info) { 42635 if (config.errorHandler) { 42636 try { 42637 return config.errorHandler.call(null, err, vm, info); 42638 } 42639 catch (e) { 42640 // if the user intentionally throws the original error in the handler, 42641 // do not log it twice 42642 if (e !== err) { 42643 logError(e, null, 'config.errorHandler'); 42644 } 42645 } 42646 } 42647 logError(err, vm, info); 42648} 42649function logError(err, vm, info) { 42650 { 42651 warn(`Error in ${info}: "${err.toString()}"`, vm); 42652 } 42653 /* istanbul ignore else */ 42654 if (inBrowser && typeof console !== 'undefined') { 42655 console.error(err); 42656 } 42657 else { 42658 throw err; 42659 } 42660} 42661 42662/* globals MutationObserver */ 42663let isUsingMicroTask = false; 42664const callbacks = []; 42665let pending = false; 42666function flushCallbacks() { 42667 pending = false; 42668 const copies = callbacks.slice(0); 42669 callbacks.length = 0; 42670 for (let i = 0; i < copies.length; i++) { 42671 copies[i](); 42672 } 42673} 42674// Here we have async deferring wrappers using microtasks. 42675// In 2.5 we used (macro) tasks (in combination with microtasks). 42676// However, it has subtle problems when state is changed right before repaint 42677// (e.g. #6813, out-in transitions). 42678// Also, using (macro) tasks in event handler would cause some weird behaviors 42679// that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109). 42680// So we now use microtasks everywhere, again. 42681// A major drawback of this tradeoff is that there are some scenarios 42682// where microtasks have too high a priority and fire in between supposedly 42683// sequential events (e.g. #4521, #6690, which have workarounds) 42684// or even between bubbling of the same event (#6566). 42685let timerFunc; 42686// The nextTick behavior leverages the microtask queue, which can be accessed 42687// via either native Promise.then or MutationObserver. 42688// MutationObserver has wider support, however it is seriously bugged in 42689// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It 42690// completely stops working after triggering a few times... so, if native 42691// Promise is available, we will use it: 42692/* istanbul ignore next, $flow-disable-line */ 42693if (typeof Promise !== 'undefined' && isNative(Promise)) { 42694 const p = Promise.resolve(); 42695 timerFunc = () => { 42696 p.then(flushCallbacks); 42697 // In problematic UIWebViews, Promise.then doesn't completely break, but 42698 // it can get stuck in a weird state where callbacks are pushed into the 42699 // microtask queue but the queue isn't being flushed, until the browser 42700 // needs to do some other work, e.g. handle a timer. Therefore we can 42701 // "force" the microtask queue to be flushed by adding an empty timer. 42702 if (isIOS) 42703 setTimeout(noop); 42704 }; 42705 isUsingMicroTask = true; 42706} 42707else if (!isIE && 42708 typeof MutationObserver !== 'undefined' && 42709 (isNative(MutationObserver) || 42710 // PhantomJS and iOS 7.x 42711 MutationObserver.toString() === '[object MutationObserverConstructor]')) { 42712 // Use MutationObserver where native Promise is not available, 42713 // e.g. PhantomJS, iOS7, Android 4.4 42714 // (#6466 MutationObserver is unreliable in IE11) 42715 let counter = 1; 42716 const observer = new MutationObserver(flushCallbacks); 42717 const textNode = document.createTextNode(String(counter)); 42718 observer.observe(textNode, { 42719 characterData: true 42720 }); 42721 timerFunc = () => { 42722 counter = (counter + 1) % 2; 42723 textNode.data = String(counter); 42724 }; 42725 isUsingMicroTask = true; 42726} 42727else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) { 42728 // Fallback to setImmediate. 42729 // Technically it leverages the (macro) task queue, 42730 // but it is still a better choice than setTimeout. 42731 timerFunc = () => { 42732 setImmediate(flushCallbacks); 42733 }; 42734} 42735else { 42736 // Fallback to setTimeout. 42737 timerFunc = () => { 42738 setTimeout(flushCallbacks, 0); 42739 }; 42740} 42741/** 42742 * @internal 42743 */ 42744function nextTick(cb, ctx) { 42745 let _resolve; 42746 callbacks.push(() => { 42747 if (cb) { 42748 try { 42749 cb.call(ctx); 42750 } 42751 catch (e) { 42752 handleError(e, ctx, 'nextTick'); 42753 } 42754 } 42755 else if (_resolve) { 42756 _resolve(ctx); 42757 } 42758 }); 42759 if (!pending) { 42760 pending = true; 42761 timerFunc(); 42762 } 42763 // $flow-disable-line 42764 if (!cb && typeof Promise !== 'undefined') { 42765 return new Promise(resolve => { 42766 _resolve = resolve; 42767 }); 42768 } 42769} 42770 42771function useCssModule(name = '$style') { 42772 /* istanbul ignore else */ 42773 { 42774 if (!currentInstance) { 42775 warn(`useCssModule must be called inside setup()`); 42776 return emptyObject; 42777 } 42778 const mod = currentInstance[name]; 42779 if (!mod) { 42780 warn(`Current instance does not have CSS module named "${name}".`); 42781 return emptyObject; 42782 } 42783 return mod; 42784 } 42785} 42786 42787/** 42788 * Runtime helper for SFC's CSS variable injection feature. 42789 * @private 42790 */ 42791function useCssVars(getter) { 42792 if (!inBrowser && !false) 42793 return; 42794 const instance = currentInstance; 42795 if (!instance) { 42796 warn(`useCssVars is called without current active component instance.`); 42797 return; 42798 } 42799 watchPostEffect(() => { 42800 const el = instance.$el; 42801 const vars = getter(instance, instance._setupProxy); 42802 if (el && el.nodeType === 1) { 42803 const style = el.style; 42804 for (const key in vars) { 42805 style.setProperty(`--${key}`, vars[key]); 42806 } 42807 } 42808 }); 42809} 42810 42811/** 42812 * v3-compatible async component API. 42813 * @internal the type is manually declared in <root>/types/v3-define-async-component.d.ts 42814 * because it relies on existing manual types 42815 */ 42816function defineAsyncComponent(source) { 42817 if (isFunction(source)) { 42818 source = { loader: source }; 42819 } 42820 const { loader, loadingComponent, errorComponent, delay = 200, timeout, // undefined = never times out 42821 suspensible = false, // in Vue 3 default is true 42822 onError: userOnError } = source; 42823 if (suspensible) { 42824 warn(`The suspensible option for async components is not supported in Vue2. It is ignored.`); 42825 } 42826 let pendingRequest = null; 42827 let retries = 0; 42828 const retry = () => { 42829 retries++; 42830 pendingRequest = null; 42831 return load(); 42832 }; 42833 const load = () => { 42834 let thisRequest; 42835 return (pendingRequest || 42836 (thisRequest = pendingRequest = 42837 loader() 42838 .catch(err => { 42839 err = err instanceof Error ? err : new Error(String(err)); 42840 if (userOnError) { 42841 return new Promise((resolve, reject) => { 42842 const userRetry = () => resolve(retry()); 42843 const userFail = () => reject(err); 42844 userOnError(err, userRetry, userFail, retries + 1); 42845 }); 42846 } 42847 else { 42848 throw err; 42849 } 42850 }) 42851 .then((comp) => { 42852 if (thisRequest !== pendingRequest && pendingRequest) { 42853 return pendingRequest; 42854 } 42855 if (!comp) { 42856 warn(`Async component loader resolved to undefined. ` + 42857 `If you are using retry(), make sure to return its return value.`); 42858 } 42859 // interop module default 42860 if (comp && 42861 (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) { 42862 comp = comp.default; 42863 } 42864 if (comp && !isObject(comp) && !isFunction(comp)) { 42865 throw new Error(`Invalid async component load result: ${comp}`); 42866 } 42867 return comp; 42868 }))); 42869 }; 42870 return () => { 42871 const component = load(); 42872 return { 42873 component, 42874 delay, 42875 timeout, 42876 error: errorComponent, 42877 loading: loadingComponent 42878 }; 42879 }; 42880} 42881 42882function createLifeCycle(hookName) { 42883 return (fn, target = currentInstance) => { 42884 if (!target) { 42885 warn(`${formatName(hookName)} is called when there is no active component instance to be ` + 42886 `associated with. ` + 42887 `Lifecycle injection APIs can only be used during execution of setup().`); 42888 return; 42889 } 42890 return injectHook(target, hookName, fn); 42891 }; 42892} 42893function formatName(name) { 42894 if (name === 'beforeDestroy') { 42895 name = 'beforeUnmount'; 42896 } 42897 else if (name === 'destroyed') { 42898 name = 'unmounted'; 42899 } 42900 return `on${name[0].toUpperCase() + name.slice(1)}`; 42901} 42902function injectHook(instance, hookName, fn) { 42903 const options = instance.$options; 42904 options[hookName] = mergeLifecycleHook(options[hookName], fn); 42905} 42906const onBeforeMount = createLifeCycle('beforeMount'); 42907const onMounted = createLifeCycle('mounted'); 42908const onBeforeUpdate = createLifeCycle('beforeUpdate'); 42909const onUpdated = createLifeCycle('updated'); 42910const onBeforeUnmount = createLifeCycle('beforeDestroy'); 42911const onUnmounted = createLifeCycle('destroyed'); 42912const onActivated = createLifeCycle('activated'); 42913const onDeactivated = createLifeCycle('deactivated'); 42914const onServerPrefetch = createLifeCycle('serverPrefetch'); 42915const onRenderTracked = createLifeCycle('renderTracked'); 42916const onRenderTriggered = createLifeCycle('renderTriggered'); 42917const injectErrorCapturedHook = createLifeCycle('errorCaptured'); 42918function onErrorCaptured(hook, target = currentInstance) { 42919 injectErrorCapturedHook(hook, target); 42920} 42921 42922/** 42923 * Note: also update dist/vue.runtime.mjs when adding new exports to this file. 42924 */ 42925const version = '2.7.16'; 42926/** 42927 * @internal type is manually declared in <root>/types/v3-define-component.d.ts 42928 */ 42929function defineComponent(options) { 42930 return options; 42931} 42932 42933var vca = /*#__PURE__*/Object.freeze({ 42934 __proto__: null, 42935 version: version, 42936 defineComponent: defineComponent, 42937 ref: ref$1, 42938 shallowRef: shallowRef, 42939 isRef: isRef, 42940 toRef: toRef, 42941 toRefs: toRefs, 42942 unref: unref, 42943 proxyRefs: proxyRefs, 42944 customRef: customRef, 42945 triggerRef: triggerRef, 42946 reactive: reactive, 42947 isReactive: isReactive, 42948 isReadonly: isReadonly, 42949 isShallow: isShallow, 42950 isProxy: isProxy, 42951 shallowReactive: shallowReactive, 42952 markRaw: markRaw, 42953 toRaw: toRaw, 42954 readonly: readonly, 42955 shallowReadonly: shallowReadonly, 42956 computed: computed, 42957 watch: watch, 42958 watchEffect: watchEffect, 42959 watchPostEffect: watchPostEffect, 42960 watchSyncEffect: watchSyncEffect, 42961 EffectScope: EffectScope, 42962 effectScope: effectScope, 42963 onScopeDispose: onScopeDispose, 42964 getCurrentScope: getCurrentScope, 42965 provide: provide, 42966 inject: inject, 42967 h: h, 42968 getCurrentInstance: getCurrentInstance, 42969 useSlots: useSlots, 42970 useAttrs: useAttrs, 42971 useListeners: useListeners, 42972 mergeDefaults: mergeDefaults, 42973 nextTick: nextTick, 42974 set: set, 42975 del: del, 42976 useCssModule: useCssModule, 42977 useCssVars: useCssVars, 42978 defineAsyncComponent: defineAsyncComponent, 42979 onBeforeMount: onBeforeMount, 42980 onMounted: onMounted, 42981 onBeforeUpdate: onBeforeUpdate, 42982 onUpdated: onUpdated, 42983 onBeforeUnmount: onBeforeUnmount, 42984 onUnmounted: onUnmounted, 42985 onActivated: onActivated, 42986 onDeactivated: onDeactivated, 42987 onServerPrefetch: onServerPrefetch, 42988 onRenderTracked: onRenderTracked, 42989 onRenderTriggered: onRenderTriggered, 42990 onErrorCaptured: onErrorCaptured 42991}); 42992 42993const seenObjects = new _Set(); 42994/** 42995 * Recursively traverse an object to evoke all converted 42996 * getters, so that every nested property inside the object 42997 * is collected as a "deep" dependency. 42998 */ 42999function traverse(val) { 43000 _traverse(val, seenObjects); 43001 seenObjects.clear(); 43002 return val; 43003} 43004function _traverse(val, seen) { 43005 let i, keys; 43006 const isA = isArray(val); 43007 if ((!isA && !isObject(val)) || 43008 val.__v_skip /* ReactiveFlags.SKIP */ || 43009 Object.isFrozen(val) || 43010 val instanceof VNode) { 43011 return; 43012 } 43013 if (val.__ob__) { 43014 const depId = val.__ob__.dep.id; 43015 if (seen.has(depId)) { 43016 return; 43017 } 43018 seen.add(depId); 43019 } 43020 if (isA) { 43021 i = val.length; 43022 while (i--) 43023 _traverse(val[i], seen); 43024 } 43025 else if (isRef(val)) { 43026 _traverse(val.value, seen); 43027 } 43028 else { 43029 keys = Object.keys(val); 43030 i = keys.length; 43031 while (i--) 43032 _traverse(val[keys[i]], seen); 43033 } 43034} 43035 43036let uid$1 = 0; 43037/** 43038 * A watcher parses an expression, collects dependencies, 43039 * and fires callback when the expression value changes. 43040 * This is used for both the $watch() api and directives. 43041 * @internal 43042 */ 43043class Watcher { 43044 constructor(vm, expOrFn, cb, options, isRenderWatcher) { 43045 recordEffectScope(this, 43046 // if the active effect scope is manually created (not a component scope), 43047 // prioritize it 43048 activeEffectScope && !activeEffectScope._vm 43049 ? activeEffectScope 43050 : vm 43051 ? vm._scope 43052 : undefined); 43053 if ((this.vm = vm) && isRenderWatcher) { 43054 vm._watcher = this; 43055 } 43056 // options 43057 if (options) { 43058 this.deep = !!options.deep; 43059 this.user = !!options.user; 43060 this.lazy = !!options.lazy; 43061 this.sync = !!options.sync; 43062 this.before = options.before; 43063 { 43064 this.onTrack = options.onTrack; 43065 this.onTrigger = options.onTrigger; 43066 } 43067 } 43068 else { 43069 this.deep = this.user = this.lazy = this.sync = false; 43070 } 43071 this.cb = cb; 43072 this.id = ++uid$1; // uid for batching 43073 this.active = true; 43074 this.post = false; 43075 this.dirty = this.lazy; // for lazy watchers 43076 this.deps = []; 43077 this.newDeps = []; 43078 this.depIds = new _Set(); 43079 this.newDepIds = new _Set(); 43080 this.expression = expOrFn.toString() ; 43081 // parse expression for getter 43082 if (isFunction(expOrFn)) { 43083 this.getter = expOrFn; 43084 } 43085 else { 43086 this.getter = parsePath(expOrFn); 43087 if (!this.getter) { 43088 this.getter = noop; 43089 warn(`Failed watching path: "${expOrFn}" ` + 43090 'Watcher only accepts simple dot-delimited paths. ' + 43091 'For full control, use a function instead.', vm); 43092 } 43093 } 43094 this.value = this.lazy ? undefined : this.get(); 43095 } 43096 /** 43097 * Evaluate the getter, and re-collect dependencies. 43098 */ 43099 get() { 43100 pushTarget(this); 43101 let value; 43102 const vm = this.vm; 43103 try { 43104 value = this.getter.call(vm, vm); 43105 } 43106 catch (e) { 43107 if (this.user) { 43108 handleError(e, vm, `getter for watcher "${this.expression}"`); 43109 } 43110 else { 43111 throw e; 43112 } 43113 } 43114 finally { 43115 // "touch" every property so they are all tracked as 43116 // dependencies for deep watching 43117 if (this.deep) { 43118 traverse(value); 43119 } 43120 popTarget(); 43121 this.cleanupDeps(); 43122 } 43123 return value; 43124 } 43125 /** 43126 * Add a dependency to this directive. 43127 */ 43128 addDep(dep) { 43129 const id = dep.id; 43130 if (!this.newDepIds.has(id)) { 43131 this.newDepIds.add(id); 43132 this.newDeps.push(dep); 43133 if (!this.depIds.has(id)) { 43134 dep.addSub(this); 43135 } 43136 } 43137 } 43138 /** 43139 * Clean up for dependency collection. 43140 */ 43141 cleanupDeps() { 43142 let i = this.deps.length; 43143 while (i--) { 43144 const dep = this.deps[i]; 43145 if (!this.newDepIds.has(dep.id)) { 43146 dep.removeSub(this); 43147 } 43148 } 43149 let tmp = this.depIds; 43150 this.depIds = this.newDepIds; 43151 this.newDepIds = tmp; 43152 this.newDepIds.clear(); 43153 tmp = this.deps; 43154 this.deps = this.newDeps; 43155 this.newDeps = tmp; 43156 this.newDeps.length = 0; 43157 } 43158 /** 43159 * Subscriber interface. 43160 * Will be called when a dependency changes. 43161 */ 43162 update() { 43163 /* istanbul ignore else */ 43164 if (this.lazy) { 43165 this.dirty = true; 43166 } 43167 else if (this.sync) { 43168 this.run(); 43169 } 43170 else { 43171 queueWatcher(this); 43172 } 43173 } 43174 /** 43175 * Scheduler job interface. 43176 * Will be called by the scheduler. 43177 */ 43178 run() { 43179 if (this.active) { 43180 const value = this.get(); 43181 if (value !== this.value || 43182 // Deep watchers and watchers on Object/Arrays should fire even 43183 // when the value is the same, because the value may 43184 // have mutated. 43185 isObject(value) || 43186 this.deep) { 43187 // set new value 43188 const oldValue = this.value; 43189 this.value = value; 43190 if (this.user) { 43191 const info = `callback for watcher "${this.expression}"`; 43192 invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info); 43193 } 43194 else { 43195 this.cb.call(this.vm, value, oldValue); 43196 } 43197 } 43198 } 43199 } 43200 /** 43201 * Evaluate the value of the watcher. 43202 * This only gets called for lazy watchers. 43203 */ 43204 evaluate() { 43205 this.value = this.get(); 43206 this.dirty = false; 43207 } 43208 /** 43209 * Depend on all deps collected by this watcher. 43210 */ 43211 depend() { 43212 let i = this.deps.length; 43213 while (i--) { 43214 this.deps[i].depend(); 43215 } 43216 } 43217 /** 43218 * Remove self from all dependencies' subscriber list. 43219 */ 43220 teardown() { 43221 if (this.vm && !this.vm._isBeingDestroyed) { 43222 remove$2(this.vm._scope.effects, this); 43223 } 43224 if (this.active) { 43225 let i = this.deps.length; 43226 while (i--) { 43227 this.deps[i].removeSub(this); 43228 } 43229 this.active = false; 43230 if (this.onStop) { 43231 this.onStop(); 43232 } 43233 } 43234 } 43235} 43236 43237let mark; 43238let measure; 43239{ 43240 const perf = inBrowser && window.performance; 43241 /* istanbul ignore if */ 43242 if (perf && 43243 // @ts-ignore 43244 perf.mark && 43245 // @ts-ignore 43246 perf.measure && 43247 // @ts-ignore 43248 perf.clearMarks && 43249 // @ts-ignore 43250 perf.clearMeasures) { 43251 mark = tag => perf.mark(tag); 43252 measure = (name, startTag, endTag) => { 43253 perf.measure(name, startTag, endTag); 43254 perf.clearMarks(startTag); 43255 perf.clearMarks(endTag); 43256 // perf.clearMeasures(name) 43257 }; 43258 } 43259} 43260 43261function initEvents(vm) { 43262 vm._events = Object.create(null); 43263 vm._hasHookEvent = false; 43264 // init parent attached events 43265 const listeners = vm.$options._parentListeners; 43266 if (listeners) { 43267 updateComponentListeners(vm, listeners); 43268 } 43269} 43270let target$1; 43271function add$1(event, fn) { 43272 target$1.$on(event, fn); 43273} 43274function remove$1(event, fn) { 43275 target$1.$off(event, fn); 43276} 43277function createOnceHandler$1(event, fn) { 43278 const _target = target$1; 43279 return function onceHandler() { 43280 const res = fn.apply(null, arguments); 43281 if (res !== null) { 43282 _target.$off(event, onceHandler); 43283 } 43284 }; 43285} 43286function updateComponentListeners(vm, listeners, oldListeners) { 43287 target$1 = vm; 43288 updateListeners(listeners, oldListeners || {}, add$1, remove$1, createOnceHandler$1, vm); 43289 target$1 = undefined; 43290} 43291function eventsMixin(Vue) { 43292 const hookRE = /^hook:/; 43293 Vue.prototype.$on = function (event, fn) { 43294 const vm = this; 43295 if (isArray(event)) { 43296 for (let i = 0, l = event.length; i < l; i++) { 43297 vm.$on(event[i], fn); 43298 } 43299 } 43300 else { 43301 (vm._events[event] || (vm._events[event] = [])).push(fn); 43302 // optimize hook:event cost by using a boolean flag marked at registration 43303 // instead of a hash lookup 43304 if (hookRE.test(event)) { 43305 vm._hasHookEvent = true; 43306 } 43307 } 43308 return vm; 43309 }; 43310 Vue.prototype.$once = function (event, fn) { 43311 const vm = this; 43312 function on() { 43313 vm.$off(event, on); 43314 fn.apply(vm, arguments); 43315 } 43316 on.fn = fn; 43317 vm.$on(event, on); 43318 return vm; 43319 }; 43320 Vue.prototype.$off = function (event, fn) { 43321 const vm = this; 43322 // all 43323 if (!arguments.length) { 43324 vm._events = Object.create(null); 43325 return vm; 43326 } 43327 // array of events 43328 if (isArray(event)) { 43329 for (let i = 0, l = event.length; i < l; i++) { 43330 vm.$off(event[i], fn); 43331 } 43332 return vm; 43333 } 43334 // specific event 43335 const cbs = vm._events[event]; 43336 if (!cbs) { 43337 return vm; 43338 } 43339 if (!fn) { 43340 vm._events[event] = null; 43341 return vm; 43342 } 43343 // specific handler 43344 let cb; 43345 let i = cbs.length; 43346 while (i--) { 43347 cb = cbs[i]; 43348 if (cb === fn || cb.fn === fn) { 43349 cbs.splice(i, 1); 43350 break; 43351 } 43352 } 43353 return vm; 43354 }; 43355 Vue.prototype.$emit = function (event) { 43356 const vm = this; 43357 { 43358 const lowerCaseEvent = event.toLowerCase(); 43359 if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) { 43360 tip(`Event "${lowerCaseEvent}" is emitted in component ` + 43361 `${formatComponentName(vm)} but the handler is registered for "${event}". ` + 43362 `Note that HTML attributes are case-insensitive and you cannot use ` + 43363 `v-on to listen to camelCase events when using in-DOM templates. ` + 43364 `You should probably use "${hyphenate(event)}" instead of "${event}".`); 43365 } 43366 } 43367 let cbs = vm._events[event]; 43368 if (cbs) { 43369 cbs = cbs.length > 1 ? toArray(cbs) : cbs; 43370 const args = toArray(arguments, 1); 43371 const info = `event handler for "${event}"`; 43372 for (let i = 0, l = cbs.length; i < l; i++) { 43373 invokeWithErrorHandling(cbs[i], vm, args, vm, info); 43374 } 43375 } 43376 return vm; 43377 }; 43378} 43379 43380let activeInstance = null; 43381let isUpdatingChildComponent = false; 43382function setActiveInstance(vm) { 43383 const prevActiveInstance = activeInstance; 43384 activeInstance = vm; 43385 return () => { 43386 activeInstance = prevActiveInstance; 43387 }; 43388} 43389function initLifecycle(vm) { 43390 const options = vm.$options; 43391 // locate first non-abstract parent 43392 let parent = options.parent; 43393 if (parent && !options.abstract) { 43394 while (parent.$options.abstract && parent.$parent) { 43395 parent = parent.$parent; 43396 } 43397 parent.$children.push(vm); 43398 } 43399 vm.$parent = parent; 43400 vm.$root = parent ? parent.$root : vm; 43401 vm.$children = []; 43402 vm.$refs = {}; 43403 vm._provided = parent ? parent._provided : Object.create(null); 43404 vm._watcher = null; 43405 vm._inactive = null; 43406 vm._directInactive = false; 43407 vm._isMounted = false; 43408 vm._isDestroyed = false; 43409 vm._isBeingDestroyed = false; 43410} 43411function lifecycleMixin(Vue) { 43412 Vue.prototype._update = function (vnode, hydrating) { 43413 const vm = this; 43414 const prevEl = vm.$el; 43415 const prevVnode = vm._vnode; 43416 const restoreActiveInstance = setActiveInstance(vm); 43417 vm._vnode = vnode; 43418 // Vue.prototype.__patch__ is injected in entry points 43419 // based on the rendering backend used. 43420 if (!prevVnode) { 43421 // initial render 43422 vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */); 43423 } 43424 else { 43425 // updates 43426 vm.$el = vm.__patch__(prevVnode, vnode); 43427 } 43428 restoreActiveInstance(); 43429 // update __vue__ reference 43430 if (prevEl) { 43431 prevEl.__vue__ = null; 43432 } 43433 if (vm.$el) { 43434 vm.$el.__vue__ = vm; 43435 } 43436 // if parent is an HOC, update its $el as well 43437 let wrapper = vm; 43438 while (wrapper && 43439 wrapper.$vnode && 43440 wrapper.$parent && 43441 wrapper.$vnode === wrapper.$parent._vnode) { 43442 wrapper.$parent.$el = wrapper.$el; 43443 wrapper = wrapper.$parent; 43444 } 43445 // updated hook is called by the scheduler to ensure that children are 43446 // updated in a parent's updated hook. 43447 }; 43448 Vue.prototype.$forceUpdate = function () { 43449 const vm = this; 43450 if (vm._watcher) { 43451 vm._watcher.update(); 43452 } 43453 }; 43454 Vue.prototype.$destroy = function () { 43455 const vm = this; 43456 if (vm._isBeingDestroyed) { 43457 return; 43458 } 43459 callHook$1(vm, 'beforeDestroy'); 43460 vm._isBeingDestroyed = true; 43461 // remove self from parent 43462 const parent = vm.$parent; 43463 if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) { 43464 remove$2(parent.$children, vm); 43465 } 43466 // teardown scope. this includes both the render watcher and other 43467 // watchers created 43468 vm._scope.stop(); 43469 // remove reference from data ob 43470 // frozen object may not have observer. 43471 if (vm._data.__ob__) { 43472 vm._data.__ob__.vmCount--; 43473 } 43474 // call the last hook... 43475 vm._isDestroyed = true; 43476 // invoke destroy hooks on current rendered tree 43477 vm.__patch__(vm._vnode, null); 43478 // fire destroyed hook 43479 callHook$1(vm, 'destroyed'); 43480 // turn off all instance listeners. 43481 vm.$off(); 43482 // remove __vue__ reference 43483 if (vm.$el) { 43484 vm.$el.__vue__ = null; 43485 } 43486 // release circular reference (#6759) 43487 if (vm.$vnode) { 43488 vm.$vnode.parent = null; 43489 } 43490 }; 43491} 43492function mountComponent(vm, el, hydrating) { 43493 vm.$el = el; 43494 if (!vm.$options.render) { 43495 // @ts-expect-error invalid type 43496 vm.$options.render = createEmptyVNode; 43497 { 43498 /* istanbul ignore if */ 43499 if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') || 43500 vm.$options.el || 43501 el) { 43502 warn('You are using the runtime-only build of Vue where the template ' + 43503 'compiler is not available. Either pre-compile the templates into ' + 43504 'render functions, or use the compiler-included build.', vm); 43505 } 43506 else { 43507 warn('Failed to mount component: template or render function not defined.', vm); 43508 } 43509 } 43510 } 43511 callHook$1(vm, 'beforeMount'); 43512 let updateComponent; 43513 /* istanbul ignore if */ 43514 if (config.performance && mark) { 43515 updateComponent = () => { 43516 const name = vm._name; 43517 const id = vm._uid; 43518 const startTag = `vue-perf-start:${id}`; 43519 const endTag = `vue-perf-end:${id}`; 43520 mark(startTag); 43521 const vnode = vm._render(); 43522 mark(endTag); 43523 measure(`vue ${name} render`, startTag, endTag); 43524 mark(startTag); 43525 vm._update(vnode, hydrating); 43526 mark(endTag); 43527 measure(`vue ${name} patch`, startTag, endTag); 43528 }; 43529 } 43530 else { 43531 updateComponent = () => { 43532 vm._update(vm._render(), hydrating); 43533 }; 43534 } 43535 const watcherOptions = { 43536 before() { 43537 if (vm._isMounted && !vm._isDestroyed) { 43538 callHook$1(vm, 'beforeUpdate'); 43539 } 43540 } 43541 }; 43542 { 43543 watcherOptions.onTrack = e => callHook$1(vm, 'renderTracked', [e]); 43544 watcherOptions.onTrigger = e => callHook$1(vm, 'renderTriggered', [e]); 43545 } 43546 // we set this to vm._watcher inside the watcher's constructor 43547 // since the watcher's initial patch may call $forceUpdate (e.g. inside child 43548 // component's mounted hook), which relies on vm._watcher being already defined 43549 new Watcher(vm, updateComponent, noop, watcherOptions, true /* isRenderWatcher */); 43550 hydrating = false; 43551 // flush buffer for flush: "pre" watchers queued in setup() 43552 const preWatchers = vm._preWatchers; 43553 if (preWatchers) { 43554 for (let i = 0; i < preWatchers.length; i++) { 43555 preWatchers[i].run(); 43556 } 43557 } 43558 // manually mounted instance, call mounted on self 43559 // mounted is called for render-created child components in its inserted hook 43560 if (vm.$vnode == null) { 43561 vm._isMounted = true; 43562 callHook$1(vm, 'mounted'); 43563 } 43564 return vm; 43565} 43566function updateChildComponent(vm, propsData, listeners, parentVnode, renderChildren) { 43567 { 43568 isUpdatingChildComponent = true; 43569 } 43570 // determine whether component has slot children 43571 // we need to do this before overwriting $options._renderChildren. 43572 // check if there are dynamic scopedSlots (hand-written or compiled but with 43573 // dynamic slot names). Static scoped slots compiled from template has the 43574 // "$stable" marker. 43575 const newScopedSlots = parentVnode.data.scopedSlots; 43576 const oldScopedSlots = vm.$scopedSlots; 43577 const hasDynamicScopedSlot = !!((newScopedSlots && !newScopedSlots.$stable) || 43578 (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) || 43579 (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) || 43580 (!newScopedSlots && vm.$scopedSlots.$key)); 43581 // Any static slot children from the parent may have changed during parent's 43582 // update. Dynamic scoped slots may also have changed. In such cases, a forced 43583 // update is necessary to ensure correctness. 43584 let needsForceUpdate = !!(renderChildren || // has new static slots 43585 vm.$options._renderChildren || // has old static slots 43586 hasDynamicScopedSlot); 43587 const prevVNode = vm.$vnode; 43588 vm.$options._parentVnode = parentVnode; 43589 vm.$vnode = parentVnode; // update vm's placeholder node without re-render 43590 if (vm._vnode) { 43591 // update child tree's parent 43592 vm._vnode.parent = parentVnode; 43593 } 43594 vm.$options._renderChildren = renderChildren; 43595 // update $attrs and $listeners hash 43596 // these are also reactive so they may trigger child update if the child 43597 // used them during render 43598 const attrs = parentVnode.data.attrs || emptyObject; 43599 if (vm._attrsProxy) { 43600 // force update if attrs are accessed and has changed since it may be 43601 // passed to a child component. 43602 if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) { 43603 needsForceUpdate = true; 43604 } 43605 } 43606 vm.$attrs = attrs; 43607 // update listeners 43608 listeners = listeners || emptyObject; 43609 const prevListeners = vm.$options._parentListeners; 43610 if (vm._listenersProxy) { 43611 syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners'); 43612 } 43613 vm.$listeners = vm.$options._parentListeners = listeners; 43614 updateComponentListeners(vm, listeners, prevListeners); 43615 // update props 43616 if (propsData && vm.$options.props) { 43617 toggleObserving(false); 43618 const props = vm._props; 43619 const propKeys = vm.$options._propKeys || []; 43620 for (let i = 0; i < propKeys.length; i++) { 43621 const key = propKeys[i]; 43622 const propOptions = vm.$options.props; // wtf flow? 43623 props[key] = validateProp(key, propOptions, propsData, vm); 43624 } 43625 toggleObserving(true); 43626 // keep a copy of raw propsData 43627 vm.$options.propsData = propsData; 43628 } 43629 // resolve slots + force update if has children 43630 if (needsForceUpdate) { 43631 vm.$slots = resolveSlots(renderChildren, parentVnode.context); 43632 vm.$forceUpdate(); 43633 } 43634 { 43635 isUpdatingChildComponent = false; 43636 } 43637} 43638function isInInactiveTree(vm) { 43639 while (vm && (vm = vm.$parent)) { 43640 if (vm._inactive) 43641 return true; 43642 } 43643 return false; 43644} 43645function activateChildComponent(vm, direct) { 43646 if (direct) { 43647 vm._directInactive = false; 43648 if (isInInactiveTree(vm)) { 43649 return; 43650 } 43651 } 43652 else if (vm._directInactive) { 43653 return; 43654 } 43655 if (vm._inactive || vm._inactive === null) { 43656 vm._inactive = false; 43657 for (let i = 0; i < vm.$children.length; i++) { 43658 activateChildComponent(vm.$children[i]); 43659 } 43660 callHook$1(vm, 'activated'); 43661 } 43662} 43663function deactivateChildComponent(vm, direct) { 43664 if (direct) { 43665 vm._directInactive = true; 43666 if (isInInactiveTree(vm)) { 43667 return; 43668 } 43669 } 43670 if (!vm._inactive) { 43671 vm._inactive = true; 43672 for (let i = 0; i < vm.$children.length; i++) { 43673 deactivateChildComponent(vm.$children[i]); 43674 } 43675 callHook$1(vm, 'deactivated'); 43676 } 43677} 43678function callHook$1(vm, hook, args, setContext = true) { 43679 // #7573 disable dep collection when invoking lifecycle hooks 43680 pushTarget(); 43681 const prevInst = currentInstance; 43682 const prevScope = getCurrentScope(); 43683 setContext && setCurrentInstance(vm); 43684 const handlers = vm.$options[hook]; 43685 const info = `${hook} hook`; 43686 if (handlers) { 43687 for (let i = 0, j = handlers.length; i < j; i++) { 43688 invokeWithErrorHandling(handlers[i], vm, args || null, vm, info); 43689 } 43690 } 43691 if (vm._hasHookEvent) { 43692 vm.$emit('hook:' + hook); 43693 } 43694 if (setContext) { 43695 setCurrentInstance(prevInst); 43696 prevScope && prevScope.on(); 43697 } 43698 popTarget(); 43699} 43700 43701const MAX_UPDATE_COUNT = 100; 43702const queue = []; 43703const activatedChildren = []; 43704let has = {}; 43705let circular = {}; 43706let waiting = false; 43707let flushing = false; 43708let index = 0; 43709/** 43710 * Reset the scheduler's state. 43711 */ 43712function resetSchedulerState() { 43713 index = queue.length = activatedChildren.length = 0; 43714 has = {}; 43715 { 43716 circular = {}; 43717 } 43718 waiting = flushing = false; 43719} 43720// Async edge case #6566 requires saving the timestamp when event listeners are 43721// attached. However, calling performance.now() has a perf overhead especially 43722// if the page has thousands of event listeners. Instead, we take a timestamp 43723// every time the scheduler flushes and use that for all event listeners 43724// attached during that flush. 43725let currentFlushTimestamp = 0; 43726// Async edge case fix requires storing an event listener's attach timestamp. 43727let getNow = Date.now; 43728// Determine what event timestamp the browser is using. Annoyingly, the 43729// timestamp can either be hi-res (relative to page load) or low-res 43730// (relative to UNIX epoch), so in order to compare time we have to use the 43731// same timestamp type when saving the flush timestamp. 43732// All IE versions use low-res event timestamps, and have problematic clock 43733// implementations (#9632) 43734if (inBrowser && !isIE) { 43735 const performance = window.performance; 43736 if (performance && 43737 typeof performance.now === 'function' && 43738 getNow() > document.createEvent('Event').timeStamp) { 43739 // if the event timestamp, although evaluated AFTER the Date.now(), is 43740 // smaller than it, it means the event is using a hi-res timestamp, 43741 // and we need to use the hi-res version for event listener timestamps as 43742 // well. 43743 getNow = () => performance.now(); 43744 } 43745} 43746const sortCompareFn = (a, b) => { 43747 if (a.post) { 43748 if (!b.post) 43749 return 1; 43750 } 43751 else if (b.post) { 43752 return -1; 43753 } 43754 return a.id - b.id; 43755}; 43756/** 43757 * Flush both queues and run the watchers. 43758 */ 43759function flushSchedulerQueue() { 43760 currentFlushTimestamp = getNow(); 43761 flushing = true; 43762 let watcher, id; 43763 // Sort queue before flush. 43764 // This ensures that: 43765 // 1. Components are updated from parent to child. (because parent is always 43766 // created before the child) 43767 // 2. A component's user watchers are run before its render watcher (because 43768 // user watchers are created before the render watcher) 43769 // 3. If a component is destroyed during a parent component's watcher run, 43770 // its watchers can be skipped. 43771 queue.sort(sortCompareFn); 43772 // do not cache length because more watchers might be pushed 43773 // as we run existing watchers 43774 for (index = 0; index < queue.length; index++) { 43775 watcher = queue[index]; 43776 if (watcher.before) { 43777 watcher.before(); 43778 } 43779 id = watcher.id; 43780 has[id] = null; 43781 watcher.run(); 43782 // in dev build, check and stop circular updates. 43783 if (has[id] != null) { 43784 circular[id] = (circular[id] || 0) + 1; 43785 if (circular[id] > MAX_UPDATE_COUNT) { 43786 warn('You may have an infinite update loop ' + 43787 (watcher.user 43788 ? `in watcher with expression "${watcher.expression}"` 43789 : `in a component render function.`), watcher.vm); 43790 break; 43791 } 43792 } 43793 } 43794 // keep copies of post queues before resetting state 43795 const activatedQueue = activatedChildren.slice(); 43796 const updatedQueue = queue.slice(); 43797 resetSchedulerState(); 43798 // call component updated and activated hooks 43799 callActivatedHooks(activatedQueue); 43800 callUpdatedHooks(updatedQueue); 43801 cleanupDeps(); 43802 // devtool hook 43803 /* istanbul ignore if */ 43804 if (devtools && config.devtools) { 43805 devtools.emit('flush'); 43806 } 43807} 43808function callUpdatedHooks(queue) { 43809 let i = queue.length; 43810 while (i--) { 43811 const watcher = queue[i]; 43812 const vm = watcher.vm; 43813 if (vm && vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) { 43814 callHook$1(vm, 'updated'); 43815 } 43816 } 43817} 43818/** 43819 * Queue a kept-alive component that was activated during patch. 43820 * The queue will be processed after the entire tree has been patched. 43821 */ 43822function queueActivatedComponent(vm) { 43823 // setting _inactive to false here so that a render function can 43824 // rely on checking whether it's in an inactive tree (e.g. router-view) 43825 vm._inactive = false; 43826 activatedChildren.push(vm); 43827} 43828function callActivatedHooks(queue) { 43829 for (let i = 0; i < queue.length; i++) { 43830 queue[i]._inactive = true; 43831 activateChildComponent(queue[i], true /* true */); 43832 } 43833} 43834/** 43835 * Push a watcher into the watcher queue. 43836 * Jobs with duplicate IDs will be skipped unless it's 43837 * pushed when the queue is being flushed. 43838 */ 43839function queueWatcher(watcher) { 43840 const id = watcher.id; 43841 if (has[id] != null) { 43842 return; 43843 } 43844 if (watcher === Dep.target && watcher.noRecurse) { 43845 return; 43846 } 43847 has[id] = true; 43848 if (!flushing) { 43849 queue.push(watcher); 43850 } 43851 else { 43852 // if already flushing, splice the watcher based on its id 43853 // if already past its id, it will be run next immediately. 43854 let i = queue.length - 1; 43855 while (i > index && queue[i].id > watcher.id) { 43856 i--; 43857 } 43858 queue.splice(i + 1, 0, watcher); 43859 } 43860 // queue the flush 43861 if (!waiting) { 43862 waiting = true; 43863 if (!config.async) { 43864 flushSchedulerQueue(); 43865 return; 43866 } 43867 nextTick(flushSchedulerQueue); 43868 } 43869} 43870 43871function initProvide(vm) { 43872 const provideOption = vm.$options.provide; 43873 if (provideOption) { 43874 const provided = isFunction(provideOption) 43875 ? provideOption.call(vm) 43876 : provideOption; 43877 if (!isObject(provided)) { 43878 return; 43879 } 43880 const source = resolveProvided(vm); 43881 // IE9 doesn't support Object.getOwnPropertyDescriptors so we have to 43882 // iterate the keys ourselves. 43883 const keys = hasSymbol ? Reflect.ownKeys(provided) : Object.keys(provided); 43884 for (let i = 0; i < keys.length; i++) { 43885 const key = keys[i]; 43886 Object.defineProperty(source, key, Object.getOwnPropertyDescriptor(provided, key)); 43887 } 43888 } 43889} 43890function initInjections(vm) { 43891 const result = resolveInject(vm.$options.inject, vm); 43892 if (result) { 43893 toggleObserving(false); 43894 Object.keys(result).forEach(key => { 43895 /* istanbul ignore else */ 43896 { 43897 defineReactive(vm, key, result[key], () => { 43898 warn(`Avoid mutating an injected value directly since the changes will be ` + 43899 `overwritten whenever the provided component re-renders. ` + 43900 `injection being mutated: "${key}"`, vm); 43901 }); 43902 } 43903 }); 43904 toggleObserving(true); 43905 } 43906} 43907function resolveInject(inject, vm) { 43908 if (inject) { 43909 // inject is :any because flow is not smart enough to figure out cached 43910 const result = Object.create(null); 43911 const keys = hasSymbol ? Reflect.ownKeys(inject) : Object.keys(inject); 43912 for (let i = 0; i < keys.length; i++) { 43913 const key = keys[i]; 43914 // #6574 in case the inject object is observed... 43915 if (key === '__ob__') 43916 continue; 43917 const provideKey = inject[key].from; 43918 if (provideKey in vm._provided) { 43919 result[key] = vm._provided[provideKey]; 43920 } 43921 else if ('default' in inject[key]) { 43922 const provideDefault = inject[key].default; 43923 result[key] = isFunction(provideDefault) 43924 ? provideDefault.call(vm) 43925 : provideDefault; 43926 } 43927 else { 43928 warn(`Injection "${key}" not found`, vm); 43929 } 43930 } 43931 return result; 43932 } 43933} 43934 43935function FunctionalRenderContext(data, props, children, parent, Ctor) { 43936 const options = Ctor.options; 43937 // ensure the createElement function in functional components 43938 // gets a unique context - this is necessary for correct named slot check 43939 let contextVm; 43940 if (hasOwn(parent, '_uid')) { 43941 contextVm = Object.create(parent); 43942 contextVm._original = parent; 43943 } 43944 else { 43945 // the context vm passed in is a functional context as well. 43946 // in this case we want to make sure we are able to get a hold to the 43947 // real context instance. 43948 contextVm = parent; 43949 // @ts-ignore 43950 parent = parent._original; 43951 } 43952 const isCompiled = isTrue(options._compiled); 43953 const needNormalization = !isCompiled; 43954 this.data = data; 43955 this.props = props; 43956 this.children = children; 43957 this.parent = parent; 43958 this.listeners = data.on || emptyObject; 43959 this.injections = resolveInject(options.inject, parent); 43960 this.slots = () => { 43961 if (!this.$slots) { 43962 normalizeScopedSlots(parent, data.scopedSlots, (this.$slots = resolveSlots(children, parent))); 43963 } 43964 return this.$slots; 43965 }; 43966 Object.defineProperty(this, 'scopedSlots', { 43967 enumerable: true, 43968 get() { 43969 return normalizeScopedSlots(parent, data.scopedSlots, this.slots()); 43970 } 43971 }); 43972 // support for compiled functional template 43973 if (isCompiled) { 43974 // exposing $options for renderStatic() 43975 this.$options = options; 43976 // pre-resolve slots for renderSlot() 43977 this.$slots = this.slots(); 43978 this.$scopedSlots = normalizeScopedSlots(parent, data.scopedSlots, this.$slots); 43979 } 43980 if (options._scopeId) { 43981 this._c = (a, b, c, d) => { 43982 const vnode = createElement$1(contextVm, a, b, c, d, needNormalization); 43983 if (vnode && !isArray(vnode)) { 43984 vnode.fnScopeId = options._scopeId; 43985 vnode.fnContext = parent; 43986 } 43987 return vnode; 43988 }; 43989 } 43990 else { 43991 this._c = (a, b, c, d) => createElement$1(contextVm, a, b, c, d, needNormalization); 43992 } 43993} 43994installRenderHelpers(FunctionalRenderContext.prototype); 43995function createFunctionalComponent(Ctor, propsData, data, contextVm, children) { 43996 const options = Ctor.options; 43997 const props = {}; 43998 const propOptions = options.props; 43999 if (isDef(propOptions)) { 44000 for (const key in propOptions) { 44001 props[key] = validateProp(key, propOptions, propsData || emptyObject); 44002 } 44003 } 44004 else { 44005 if (isDef(data.attrs)) 44006 mergeProps(props, data.attrs); 44007 if (isDef(data.props)) 44008 mergeProps(props, data.props); 44009 } 44010 const renderContext = new FunctionalRenderContext(data, props, children, contextVm, Ctor); 44011 const vnode = options.render.call(null, renderContext._c, renderContext); 44012 if (vnode instanceof VNode) { 44013 return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext); 44014 } 44015 else if (isArray(vnode)) { 44016 const vnodes = normalizeChildren(vnode) || []; 44017 const res = new Array(vnodes.length); 44018 for (let i = 0; i < vnodes.length; i++) { 44019 res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext); 44020 } 44021 return res; 44022 } 44023} 44024function cloneAndMarkFunctionalResult(vnode, data, contextVm, options, renderContext) { 44025 // #7817 clone node before setting fnContext, otherwise if the node is reused 44026 // (e.g. it was from a cached normal slot) the fnContext causes named slots 44027 // that should not be matched to match. 44028 const clone = cloneVNode(vnode); 44029 clone.fnContext = contextVm; 44030 clone.fnOptions = options; 44031 { 44032 (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = 44033 renderContext; 44034 } 44035 if (data.slot) { 44036 (clone.data || (clone.data = {})).slot = data.slot; 44037 } 44038 return clone; 44039} 44040function mergeProps(to, from) { 44041 for (const key in from) { 44042 to[camelize(key)] = from[key]; 44043 } 44044} 44045 44046function getComponentName(options) { 44047 return options.name || options.__name || options._componentTag; 44048} 44049// inline hooks to be invoked on component VNodes during patch 44050const componentVNodeHooks = { 44051 init(vnode, hydrating) { 44052 if (vnode.componentInstance && 44053 !vnode.componentInstance._isDestroyed && 44054 vnode.data.keepAlive) { 44055 // kept-alive components, treat as a patch 44056 const mountedNode = vnode; // work around flow 44057 componentVNodeHooks.prepatch(mountedNode, mountedNode); 44058 } 44059 else { 44060 const child = (vnode.componentInstance = createComponentInstanceForVnode(vnode, activeInstance)); 44061 child.$mount(hydrating ? vnode.elm : undefined, hydrating); 44062 } 44063 }, 44064 prepatch(oldVnode, vnode) { 44065 const options = vnode.componentOptions; 44066 const child = (vnode.componentInstance = oldVnode.componentInstance); 44067 updateChildComponent(child, options.propsData, // updated props 44068 options.listeners, // updated listeners 44069 vnode, // new parent vnode 44070 options.children // new children 44071 ); 44072 }, 44073 insert(vnode) { 44074 const { context, componentInstance } = vnode; 44075 if (!componentInstance._isMounted) { 44076 componentInstance._isMounted = true; 44077 callHook$1(componentInstance, 'mounted'); 44078 } 44079 if (vnode.data.keepAlive) { 44080 if (context._isMounted) { 44081 // vue-router#1212 44082 // During updates, a kept-alive component's child components may 44083 // change, so directly walking the tree here may call activated hooks 44084 // on incorrect children. Instead we push them into a queue which will 44085 // be processed after the whole patch process ended. 44086 queueActivatedComponent(componentInstance); 44087 } 44088 else { 44089 activateChildComponent(componentInstance, true /* direct */); 44090 } 44091 } 44092 }, 44093 destroy(vnode) { 44094 const { componentInstance } = vnode; 44095 if (!componentInstance._isDestroyed) { 44096 if (!vnode.data.keepAlive) { 44097 componentInstance.$destroy(); 44098 } 44099 else { 44100 deactivateChildComponent(componentInstance, true /* direct */); 44101 } 44102 } 44103 } 44104}; 44105const hooksToMerge = Object.keys(componentVNodeHooks); 44106function createComponent(Ctor, data, context, children, tag) { 44107 if (isUndef(Ctor)) { 44108 return; 44109 } 44110 const baseCtor = context.$options._base; 44111 // plain options object: turn it into a constructor 44112 if (isObject(Ctor)) { 44113 Ctor = baseCtor.extend(Ctor); 44114 } 44115 // if at this stage it's not a constructor or an async component factory, 44116 // reject. 44117 if (typeof Ctor !== 'function') { 44118 { 44119 warn(`Invalid Component definition: ${String(Ctor)}`, context); 44120 } 44121 return; 44122 } 44123 // async component 44124 let asyncFactory; 44125 // @ts-expect-error 44126 if (isUndef(Ctor.cid)) { 44127 asyncFactory = Ctor; 44128 Ctor = resolveAsyncComponent(asyncFactory, baseCtor); 44129 if (Ctor === undefined) { 44130 // return a placeholder node for async component, which is rendered 44131 // as a comment node but preserves all the raw information for the node. 44132 // the information will be used for async server-rendering and hydration. 44133 return createAsyncPlaceholder(asyncFactory, data, context, children, tag); 44134 } 44135 } 44136 data = data || {}; 44137 // resolve constructor options in case global mixins are applied after 44138 // component constructor creation 44139 resolveConstructorOptions(Ctor); 44140 // transform component v-model data into props & events 44141 if (isDef(data.model)) { 44142 // @ts-expect-error 44143 transformModel(Ctor.options, data); 44144 } 44145 // extract props 44146 // @ts-expect-error 44147 const propsData = extractPropsFromVNodeData(data, Ctor, tag); 44148 // functional component 44149 // @ts-expect-error 44150 if (isTrue(Ctor.options.functional)) { 44151 return createFunctionalComponent(Ctor, propsData, data, context, children); 44152 } 44153 // extract listeners, since these needs to be treated as 44154 // child component listeners instead of DOM listeners 44155 const listeners = data.on; 44156 // replace with listeners with .native modifier 44157 // so it gets processed during parent component patch. 44158 data.on = data.nativeOn; 44159 // @ts-expect-error 44160 if (isTrue(Ctor.options.abstract)) { 44161 // abstract components do not keep anything 44162 // other than props & listeners & slot 44163 // work around flow 44164 const slot = data.slot; 44165 data = {}; 44166 if (slot) { 44167 data.slot = slot; 44168 } 44169 } 44170 // install component management hooks onto the placeholder node 44171 installComponentHooks(data); 44172 // return a placeholder vnode 44173 // @ts-expect-error 44174 const name = getComponentName(Ctor.options) || tag; 44175 const vnode = new VNode( 44176 // @ts-expect-error 44177 `vue-component-${Ctor.cid}${name ? `-${name}` : ''}`, data, undefined, undefined, undefined, context, 44178 // @ts-expect-error 44179 { Ctor, propsData, listeners, tag, children }, asyncFactory); 44180 return vnode; 44181} 44182function createComponentInstanceForVnode( 44183// we know it's MountedComponentVNode but flow doesn't 44184vnode, 44185// activeInstance in lifecycle state 44186parent) { 44187 const options = { 44188 _isComponent: true, 44189 _parentVnode: vnode, 44190 parent 44191 }; 44192 // check inline-template render functions 44193 const inlineTemplate = vnode.data.inlineTemplate; 44194 if (isDef(inlineTemplate)) { 44195 options.render = inlineTemplate.render; 44196 options.staticRenderFns = inlineTemplate.staticRenderFns; 44197 } 44198 return new vnode.componentOptions.Ctor(options); 44199} 44200function installComponentHooks(data) { 44201 const hooks = data.hook || (data.hook = {}); 44202 for (let i = 0; i < hooksToMerge.length; i++) { 44203 const key = hooksToMerge[i]; 44204 const existing = hooks[key]; 44205 const toMerge = componentVNodeHooks[key]; 44206 // @ts-expect-error 44207 if (existing !== toMerge && !(existing && existing._merged)) { 44208 hooks[key] = existing ? mergeHook(toMerge, existing) : toMerge; 44209 } 44210 } 44211} 44212function mergeHook(f1, f2) { 44213 const merged = (a, b) => { 44214 // flow complains about extra args which is why we use any 44215 f1(a, b); 44216 f2(a, b); 44217 }; 44218 merged._merged = true; 44219 return merged; 44220} 44221// transform component v-model info (value and callback) into 44222// prop and event handler respectively. 44223function transformModel(options, data) { 44224 const prop = (options.model && options.model.prop) || 'value'; 44225 const event = (options.model && options.model.event) || 'input'; 44226 (data.attrs || (data.attrs = {}))[prop] = data.model.value; 44227 const on = data.on || (data.on = {}); 44228 const existing = on[event]; 44229 const callback = data.model.callback; 44230 if (isDef(existing)) { 44231 if (isArray(existing) 44232 ? existing.indexOf(callback) === -1 44233 : existing !== callback) { 44234 on[event] = [callback].concat(existing); 44235 } 44236 } 44237 else { 44238 on[event] = callback; 44239 } 44240} 44241 44242let warn = noop; 44243let tip = noop; 44244let generateComponentTrace; // work around flow check 44245let formatComponentName; 44246{ 44247 const hasConsole = typeof console !== 'undefined'; 44248 const classifyRE = /(?:^|[-_])(\w)/g; 44249 const classify = str => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, ''); 44250 warn = (msg, vm = currentInstance) => { 44251 const trace = vm ? generateComponentTrace(vm) : ''; 44252 if (config.warnHandler) { 44253 config.warnHandler.call(null, msg, vm, trace); 44254 } 44255 else if (hasConsole && !config.silent) { 44256 console.error(`[Vue warn]: ${msg}${trace}`); 44257 } 44258 }; 44259 tip = (msg, vm) => { 44260 if (hasConsole && !config.silent) { 44261 console.warn(`[Vue tip]: ${msg}` + (vm ? generateComponentTrace(vm) : '')); 44262 } 44263 }; 44264 formatComponentName = (vm, includeFile) => { 44265 if (vm.$root === vm) { 44266 return '<Root>'; 44267 } 44268 const options = isFunction(vm) && vm.cid != null 44269 ? vm.options 44270 : vm._isVue 44271 ? vm.$options || vm.constructor.options 44272 : vm; 44273 let name = getComponentName(options); 44274 const file = options.__file; 44275 if (!name && file) { 44276 const match = file.match(/([^/\\]+)\.vue$/); 44277 name = match && match[1]; 44278 } 44279 return ((name ? `<${classify(name)}>` : `<Anonymous>`) + 44280 (file && includeFile !== false ? ` at ${file}` : '')); 44281 }; 44282 const repeat = (str, n) => { 44283 let res = ''; 44284 while (n) { 44285 if (n % 2 === 1) 44286 res += str; 44287 if (n > 1) 44288 str += str; 44289 n >>= 1; 44290 } 44291 return res; 44292 }; 44293 generateComponentTrace = (vm) => { 44294 if (vm._isVue && vm.$parent) { 44295 const tree = []; 44296 let currentRecursiveSequence = 0; 44297 while (vm) { 44298 if (tree.length > 0) { 44299 const last = tree[tree.length - 1]; 44300 if (last.constructor === vm.constructor) { 44301 currentRecursiveSequence++; 44302 vm = vm.$parent; 44303 continue; 44304 } 44305 else if (currentRecursiveSequence > 0) { 44306 tree[tree.length - 1] = [last, currentRecursiveSequence]; 44307 currentRecursiveSequence = 0; 44308 } 44309 } 44310 tree.push(vm); 44311 vm = vm.$parent; 44312 } 44313 return ('\n\nfound in\n\n' + 44314 tree 44315 .map((vm, i) => `${i === 0 ? '---> ' : repeat(' ', 5 + i * 2)}${isArray(vm) 44316 ? `${formatComponentName(vm[0])}... (${vm[1]} recursive calls)` 44317 : formatComponentName(vm)}`) 44318 .join('\n')); 44319 } 44320 else { 44321 return `\n\n(found in ${formatComponentName(vm)})`; 44322 } 44323 }; 44324} 44325 44326/** 44327 * Option overwriting strategies are functions that handle 44328 * how to merge a parent option value and a child option 44329 * value into the final value. 44330 */ 44331const strats = config.optionMergeStrategies; 44332/** 44333 * Options with restrictions 44334 */ 44335{ 44336 strats.el = strats.propsData = function (parent, child, vm, key) { 44337 if (!vm) { 44338 warn(`option "${key}" can only be used during instance ` + 44339 'creation with the `new` keyword.'); 44340 } 44341 return defaultStrat(parent, child); 44342 }; 44343} 44344/** 44345 * Helper that recursively merges two data objects together. 44346 */ 44347function mergeData(to, from, recursive = true) { 44348 if (!from) 44349 return to; 44350 let key, toVal, fromVal; 44351 const keys = hasSymbol 44352 ? Reflect.ownKeys(from) 44353 : Object.keys(from); 44354 for (let i = 0; i < keys.length; i++) { 44355 key = keys[i]; 44356 // in case the object is already observed... 44357 if (key === '__ob__') 44358 continue; 44359 toVal = to[key]; 44360 fromVal = from[key]; 44361 if (!recursive || !hasOwn(to, key)) { 44362 set(to, key, fromVal); 44363 } 44364 else if (toVal !== fromVal && 44365 isPlainObject(toVal) && 44366 isPlainObject(fromVal)) { 44367 mergeData(toVal, fromVal); 44368 } 44369 } 44370 return to; 44371} 44372/** 44373 * Data 44374 */ 44375function mergeDataOrFn(parentVal, childVal, vm) { 44376 if (!vm) { 44377 // in a Vue.extend merge, both should be functions 44378 if (!childVal) { 44379 return parentVal; 44380 } 44381 if (!parentVal) { 44382 return childVal; 44383 } 44384 // when parentVal & childVal are both present, 44385 // we need to return a function that returns the 44386 // merged result of both functions... no need to 44387 // check if parentVal is a function here because 44388 // it has to be a function to pass previous merges. 44389 return function mergedDataFn() { 44390 return mergeData(isFunction(childVal) ? childVal.call(this, this) : childVal, isFunction(parentVal) ? parentVal.call(this, this) : parentVal); 44391 }; 44392 } 44393 else { 44394 return function mergedInstanceDataFn() { 44395 // instance merge 44396 const instanceData = isFunction(childVal) 44397 ? childVal.call(vm, vm) 44398 : childVal; 44399 const defaultData = isFunction(parentVal) 44400 ? parentVal.call(vm, vm) 44401 : parentVal; 44402 if (instanceData) { 44403 return mergeData(instanceData, defaultData); 44404 } 44405 else { 44406 return defaultData; 44407 } 44408 }; 44409 } 44410} 44411strats.data = function (parentVal, childVal, vm) { 44412 if (!vm) { 44413 if (childVal && typeof childVal !== 'function') { 44414 warn('The "data" option should be a function ' + 44415 'that returns a per-instance value in component ' + 44416 'definitions.', vm); 44417 return parentVal; 44418 } 44419 return mergeDataOrFn(parentVal, childVal); 44420 } 44421 return mergeDataOrFn(parentVal, childVal, vm); 44422}; 44423/** 44424 * Hooks and props are merged as arrays. 44425 */ 44426function mergeLifecycleHook(parentVal, childVal) { 44427 const res = childVal 44428 ? parentVal 44429 ? parentVal.concat(childVal) 44430 : isArray(childVal) 44431 ? childVal 44432 : [childVal] 44433 : parentVal; 44434 return res ? dedupeHooks(res) : res; 44435} 44436function dedupeHooks(hooks) { 44437 const res = []; 44438 for (let i = 0; i < hooks.length; i++) { 44439 if (res.indexOf(hooks[i]) === -1) { 44440 res.push(hooks[i]); 44441 } 44442 } 44443 return res; 44444} 44445LIFECYCLE_HOOKS.forEach(hook => { 44446 strats[hook] = mergeLifecycleHook; 44447}); 44448/** 44449 * Assets 44450 * 44451 * When a vm is present (instance creation), we need to do 44452 * a three-way merge between constructor options, instance 44453 * options and parent options. 44454 */ 44455function mergeAssets(parentVal, childVal, vm, key) { 44456 const res = Object.create(parentVal || null); 44457 if (childVal) { 44458 assertObjectType(key, childVal, vm); 44459 return extend(res, childVal); 44460 } 44461 else { 44462 return res; 44463 } 44464} 44465ASSET_TYPES.forEach(function (type) { 44466 strats[type + 's'] = mergeAssets; 44467}); 44468/** 44469 * Watchers. 44470 * 44471 * Watchers hashes should not overwrite one 44472 * another, so we merge them as arrays. 44473 */ 44474strats.watch = function (parentVal, childVal, vm, key) { 44475 // work around Firefox's Object.prototype.watch... 44476 //@ts-expect-error work around 44477 if (parentVal === nativeWatch) 44478 parentVal = undefined; 44479 //@ts-expect-error work around 44480 if (childVal === nativeWatch) 44481 childVal = undefined; 44482 /* istanbul ignore if */ 44483 if (!childVal) 44484 return Object.create(parentVal || null); 44485 { 44486 assertObjectType(key, childVal, vm); 44487 } 44488 if (!parentVal) 44489 return childVal; 44490 const ret = {}; 44491 extend(ret, parentVal); 44492 for (const key in childVal) { 44493 let parent = ret[key]; 44494 const child = childVal[key]; 44495 if (parent && !isArray(parent)) { 44496 parent = [parent]; 44497 } 44498 ret[key] = parent ? parent.concat(child) : isArray(child) ? child : [child]; 44499 } 44500 return ret; 44501}; 44502/** 44503 * Other object hashes. 44504 */ 44505strats.props = 44506 strats.methods = 44507 strats.inject = 44508 strats.computed = 44509 function (parentVal, childVal, vm, key) { 44510 if (childVal && true) { 44511 assertObjectType(key, childVal, vm); 44512 } 44513 if (!parentVal) 44514 return childVal; 44515 const ret = Object.create(null); 44516 extend(ret, parentVal); 44517 if (childVal) 44518 extend(ret, childVal); 44519 return ret; 44520 }; 44521strats.provide = function (parentVal, childVal) { 44522 if (!parentVal) 44523 return childVal; 44524 return function () { 44525 const ret = Object.create(null); 44526 mergeData(ret, isFunction(parentVal) ? parentVal.call(this) : parentVal); 44527 if (childVal) { 44528 mergeData(ret, isFunction(childVal) ? childVal.call(this) : childVal, false // non-recursive 44529 ); 44530 } 44531 return ret; 44532 }; 44533}; 44534/** 44535 * Default strategy. 44536 */ 44537const defaultStrat = function (parentVal, childVal) { 44538 return childVal === undefined ? parentVal : childVal; 44539}; 44540/** 44541 * Validate component names 44542 */ 44543function checkComponents(options) { 44544 for (const key in options.components) { 44545 validateComponentName(key); 44546 } 44547} 44548function validateComponentName(name) { 44549 if (!new RegExp(`^[a-zA-Z][\\-\\.0-9_${unicodeRegExp.source}]*$`).test(name)) { 44550 warn('Invalid component name: "' + 44551 name + 44552 '". Component names ' + 44553 'should conform to valid custom element name in html5 specification.'); 44554 } 44555 if (isBuiltInTag(name) || config.isReservedTag(name)) { 44556 warn('Do not use built-in or reserved HTML elements as component ' + 44557 'id: ' + 44558 name); 44559 } 44560} 44561/** 44562 * Ensure all props option syntax are normalized into the 44563 * Object-based format. 44564 */ 44565function normalizeProps(options, vm) { 44566 const props = options.props; 44567 if (!props) 44568 return; 44569 const res = {}; 44570 let i, val, name; 44571 if (isArray(props)) { 44572 i = props.length; 44573 while (i--) { 44574 val = props[i]; 44575 if (typeof val === 'string') { 44576 name = camelize(val); 44577 res[name] = { type: null }; 44578 } 44579 else { 44580 warn('props must be strings when using array syntax.'); 44581 } 44582 } 44583 } 44584 else if (isPlainObject(props)) { 44585 for (const key in props) { 44586 val = props[key]; 44587 name = camelize(key); 44588 res[name] = isPlainObject(val) ? val : { type: val }; 44589 } 44590 } 44591 else { 44592 warn(`Invalid value for option "props": expected an Array or an Object, ` + 44593 `but got ${toRawType(props)}.`, vm); 44594 } 44595 options.props = res; 44596} 44597/** 44598 * Normalize all injections into Object-based format 44599 */ 44600function normalizeInject(options, vm) { 44601 const inject = options.inject; 44602 if (!inject) 44603 return; 44604 const normalized = (options.inject = {}); 44605 if (isArray(inject)) { 44606 for (let i = 0; i < inject.length; i++) { 44607 normalized[inject[i]] = { from: inject[i] }; 44608 } 44609 } 44610 else if (isPlainObject(inject)) { 44611 for (const key in inject) { 44612 const val = inject[key]; 44613 normalized[key] = isPlainObject(val) 44614 ? extend({ from: key }, val) 44615 : { from: val }; 44616 } 44617 } 44618 else { 44619 warn(`Invalid value for option "inject": expected an Array or an Object, ` + 44620 `but got ${toRawType(inject)}.`, vm); 44621 } 44622} 44623/** 44624 * Normalize raw function directives into object format. 44625 */ 44626function normalizeDirectives$1(options) { 44627 const dirs = options.directives; 44628 if (dirs) { 44629 for (const key in dirs) { 44630 const def = dirs[key]; 44631 if (isFunction(def)) { 44632 dirs[key] = { bind: def, update: def }; 44633 } 44634 } 44635 } 44636} 44637function assertObjectType(name, value, vm) { 44638 if (!isPlainObject(value)) { 44639 warn(`Invalid value for option "${name}": expected an Object, ` + 44640 `but got ${toRawType(value)}.`, vm); 44641 } 44642} 44643/** 44644 * Merge two option objects into a new one. 44645 * Core utility used in both instantiation and inheritance. 44646 */ 44647function mergeOptions(parent, child, vm) { 44648 { 44649 checkComponents(child); 44650 } 44651 if (isFunction(child)) { 44652 // @ts-expect-error 44653 child = child.options; 44654 } 44655 normalizeProps(child, vm); 44656 normalizeInject(child, vm); 44657 normalizeDirectives$1(child); 44658 // Apply extends and mixins on the child options, 44659 // but only if it is a raw options object that isn't 44660 // the result of another mergeOptions call. 44661 // Only merged options has the _base property. 44662 if (!child._base) { 44663 if (child.extends) { 44664 parent = mergeOptions(parent, child.extends, vm); 44665 } 44666 if (child.mixins) { 44667 for (let i = 0, l = child.mixins.length; i < l; i++) { 44668 parent = mergeOptions(parent, child.mixins[i], vm); 44669 } 44670 } 44671 } 44672 const options = {}; 44673 let key; 44674 for (key in parent) { 44675 mergeField(key); 44676 } 44677 for (key in child) { 44678 if (!hasOwn(parent, key)) { 44679 mergeField(key); 44680 } 44681 } 44682 function mergeField(key) { 44683 const strat = strats[key] || defaultStrat; 44684 options[key] = strat(parent[key], child[key], vm, key); 44685 } 44686 return options; 44687} 44688/** 44689 * Resolve an asset. 44690 * This function is used because child instances need access 44691 * to assets defined in its ancestor chain. 44692 */ 44693function resolveAsset(options, type, id, warnMissing) { 44694 /* istanbul ignore if */ 44695 if (typeof id !== 'string') { 44696 return; 44697 } 44698 const assets = options[type]; 44699 // check local registration variations first 44700 if (hasOwn(assets, id)) 44701 return assets[id]; 44702 const camelizedId = camelize(id); 44703 if (hasOwn(assets, camelizedId)) 44704 return assets[camelizedId]; 44705 const PascalCaseId = capitalize(camelizedId); 44706 if (hasOwn(assets, PascalCaseId)) 44707 return assets[PascalCaseId]; 44708 // fallback to prototype chain 44709 const res = assets[id] || assets[camelizedId] || assets[PascalCaseId]; 44710 if (warnMissing && !res) { 44711 warn('Failed to resolve ' + type.slice(0, -1) + ': ' + id); 44712 } 44713 return res; 44714} 44715 44716function validateProp(key, propOptions, propsData, vm) { 44717 const prop = propOptions[key]; 44718 const absent = !hasOwn(propsData, key); 44719 let value = propsData[key]; 44720 // boolean casting 44721 const booleanIndex = getTypeIndex(Boolean, prop.type); 44722 if (booleanIndex > -1) { 44723 if (absent && !hasOwn(prop, 'default')) { 44724 value = false; 44725 } 44726 else if (value === '' || value === hyphenate(key)) { 44727 // only cast empty string / same name to boolean if 44728 // boolean has higher priority 44729 const stringIndex = getTypeIndex(String, prop.type); 44730 if (stringIndex < 0 || booleanIndex < stringIndex) { 44731 value = true; 44732 } 44733 } 44734 } 44735 // check default value 44736 if (value === undefined) { 44737 value = getPropDefaultValue(vm, prop, key); 44738 // since the default value is a fresh copy, 44739 // make sure to observe it. 44740 const prevShouldObserve = shouldObserve; 44741 toggleObserving(true); 44742 observe(value); 44743 toggleObserving(prevShouldObserve); 44744 } 44745 { 44746 assertProp(prop, key, value, vm, absent); 44747 } 44748 return value; 44749} 44750/** 44751 * Get the default value of a prop. 44752 */ 44753function getPropDefaultValue(vm, prop, key) { 44754 // no default, return undefined 44755 if (!hasOwn(prop, 'default')) { 44756 return undefined; 44757 } 44758 const def = prop.default; 44759 // warn against non-factory defaults for Object & Array 44760 if (isObject(def)) { 44761 warn('Invalid default value for prop "' + 44762 key + 44763 '": ' + 44764 'Props with type Object/Array must use a factory function ' + 44765 'to return the default value.', vm); 44766 } 44767 // the raw prop value was also undefined from previous render, 44768 // return previous default value to avoid unnecessary watcher trigger 44769 if (vm && 44770 vm.$options.propsData && 44771 vm.$options.propsData[key] === undefined && 44772 vm._props[key] !== undefined) { 44773 return vm._props[key]; 44774 } 44775 // call factory function for non-Function types 44776 // a value is Function if its prototype is function even across different execution context 44777 return isFunction(def) && getType(prop.type) !== 'Function' 44778 ? def.call(vm) 44779 : def; 44780} 44781/** 44782 * Assert whether a prop is valid. 44783 */ 44784function assertProp(prop, name, value, vm, absent) { 44785 if (prop.required && absent) { 44786 warn('Missing required prop: "' + name + '"', vm); 44787 return; 44788 } 44789 if (value == null && !prop.required) { 44790 return; 44791 } 44792 let type = prop.type; 44793 let valid = !type || type === true; 44794 const expectedTypes = []; 44795 if (type) { 44796 if (!isArray(type)) { 44797 type = [type]; 44798 } 44799 for (let i = 0; i < type.length && !valid; i++) { 44800 const assertedType = assertType(value, type[i], vm); 44801 expectedTypes.push(assertedType.expectedType || ''); 44802 valid = assertedType.valid; 44803 } 44804 } 44805 const haveExpectedTypes = expectedTypes.some(t => t); 44806 if (!valid && haveExpectedTypes) { 44807 warn(getInvalidTypeMessage(name, value, expectedTypes), vm); 44808 return; 44809 } 44810 const validator = prop.validator; 44811 if (validator) { 44812 if (!validator(value)) { 44813 warn('Invalid prop: custom validator check failed for prop "' + name + '".', vm); 44814 } 44815 } 44816} 44817const simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/; 44818function assertType(value, type, vm) { 44819 let valid; 44820 const expectedType = getType(type); 44821 if (simpleCheckRE.test(expectedType)) { 44822 const t = typeof value; 44823 valid = t === expectedType.toLowerCase(); 44824 // for primitive wrapper objects 44825 if (!valid && t === 'object') { 44826 valid = value instanceof type; 44827 } 44828 } 44829 else if (expectedType === 'Object') { 44830 valid = isPlainObject(value); 44831 } 44832 else if (expectedType === 'Array') { 44833 valid = isArray(value); 44834 } 44835 else { 44836 try { 44837 valid = value instanceof type; 44838 } 44839 catch (e) { 44840 warn('Invalid prop type: "' + String(type) + '" is not a constructor', vm); 44841 valid = false; 44842 } 44843 } 44844 return { 44845 valid, 44846 expectedType 44847 }; 44848} 44849const functionTypeCheckRE = /^\s*function (\w+)/; 44850/** 44851 * Use function string name to check built-in types, 44852 * because a simple equality check will fail when running 44853 * across different vms / iframes. 44854 */ 44855function getType(fn) { 44856 const match = fn && fn.toString().match(functionTypeCheckRE); 44857 return match ? match[1] : ''; 44858} 44859function isSameType(a, b) { 44860 return getType(a) === getType(b); 44861} 44862function getTypeIndex(type, expectedTypes) { 44863 if (!isArray(expectedTypes)) { 44864 return isSameType(expectedTypes, type) ? 0 : -1; 44865 } 44866 for (let i = 0, len = expectedTypes.length; i < len; i++) { 44867 if (isSameType(expectedTypes[i], type)) { 44868 return i; 44869 } 44870 } 44871 return -1; 44872} 44873function getInvalidTypeMessage(name, value, expectedTypes) { 44874 let message = `Invalid prop: type check failed for prop "${name}".` + 44875 ` Expected ${expectedTypes.map(capitalize).join(', ')}`; 44876 const expectedType = expectedTypes[0]; 44877 const receivedType = toRawType(value); 44878 // check if we need to specify expected value 44879 if (expectedTypes.length === 1 && 44880 isExplicable(expectedType) && 44881 isExplicable(typeof value) && 44882 !isBoolean(expectedType, receivedType)) { 44883 message += ` with value ${styleValue(value, expectedType)}`; 44884 } 44885 message += `, got ${receivedType} `; 44886 // check if we need to specify received value 44887 if (isExplicable(receivedType)) { 44888 message += `with value ${styleValue(value, receivedType)}.`; 44889 } 44890 return message; 44891} 44892function styleValue(value, type) { 44893 if (type === 'String') { 44894 return `"${value}"`; 44895 } 44896 else if (type === 'Number') { 44897 return `${Number(value)}`; 44898 } 44899 else { 44900 return `${value}`; 44901 } 44902} 44903const EXPLICABLE_TYPES = ['string', 'number', 'boolean']; 44904function isExplicable(value) { 44905 return EXPLICABLE_TYPES.some(elem => value.toLowerCase() === elem); 44906} 44907function isBoolean(...args) { 44908 return args.some(elem => elem.toLowerCase() === 'boolean'); 44909} 44910 44911/* not type checking this file because flow doesn't play well with Proxy */ 44912let initProxy; 44913{ 44914 const allowedGlobals = makeMap('Infinity,undefined,NaN,isFinite,isNaN,' + 44915 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' + 44916 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' + 44917 'require' // for Webpack/Browserify 44918 ); 44919 const warnNonPresent = (target, key) => { 44920 warn(`Property or method "${key}" is not defined on the instance but ` + 44921 'referenced during render. Make sure that this property is reactive, ' + 44922 'either in the data option, or for class-based components, by ' + 44923 'initializing the property. ' + 44924 'See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', target); 44925 }; 44926 const warnReservedPrefix = (target, key) => { 44927 warn(`Property "${key}" must be accessed with "$data.${key}" because ` + 44928 'properties starting with "$" or "_" are not proxied in the Vue instance to ' + 44929 'prevent conflicts with Vue internals. ' + 44930 'See: https://v2.vuejs.org/v2/api/#data', target); 44931 }; 44932 const hasProxy = typeof Proxy !== 'undefined' && isNative(Proxy); 44933 if (hasProxy) { 44934 const isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact'); 44935 config.keyCodes = new Proxy(config.keyCodes, { 44936 set(target, key, value) { 44937 if (isBuiltInModifier(key)) { 44938 warn(`Avoid overwriting built-in modifier in config.keyCodes: .${key}`); 44939 return false; 44940 } 44941 else { 44942 target[key] = value; 44943 return true; 44944 } 44945 } 44946 }); 44947 } 44948 const hasHandler = { 44949 has(target, key) { 44950 const has = key in target; 44951 const isAllowed = allowedGlobals(key) || 44952 (typeof key === 'string' && 44953 key.charAt(0) === '_' && 44954 !(key in target.$data)); 44955 if (!has && !isAllowed) { 44956 if (key in target.$data) 44957 warnReservedPrefix(target, key); 44958 else 44959 warnNonPresent(target, key); 44960 } 44961 return has || !isAllowed; 44962 } 44963 }; 44964 const getHandler = { 44965 get(target, key) { 44966 if (typeof key === 'string' && !(key in target)) { 44967 if (key in target.$data) 44968 warnReservedPrefix(target, key); 44969 else 44970 warnNonPresent(target, key); 44971 } 44972 return target[key]; 44973 } 44974 }; 44975 initProxy = function initProxy(vm) { 44976 if (hasProxy) { 44977 // determine which proxy handler to use 44978 const options = vm.$options; 44979 const handlers = options.render && options.render._withStripped ? getHandler : hasHandler; 44980 vm._renderProxy = new Proxy(vm, handlers); 44981 } 44982 else { 44983 vm._renderProxy = vm; 44984 } 44985 }; 44986} 44987 44988const sharedPropertyDefinition = { 44989 enumerable: true, 44990 configurable: true, 44991 get: noop, 44992 set: noop 44993}; 44994function proxy(target, sourceKey, key) { 44995 sharedPropertyDefinition.get = function proxyGetter() { 44996 return this[sourceKey][key]; 44997 }; 44998 sharedPropertyDefinition.set = function proxySetter(val) { 44999 this[sourceKey][key] = val; 45000 }; 45001 Object.defineProperty(target, key, sharedPropertyDefinition); 45002} 45003function initState(vm) { 45004 const opts = vm.$options; 45005 if (opts.props) 45006 initProps$1(vm, opts.props); 45007 // Composition API 45008 initSetup(vm); 45009 if (opts.methods) 45010 initMethods(vm, opts.methods); 45011 if (opts.data) { 45012 initData(vm); 45013 } 45014 else { 45015 const ob = observe((vm._data = {})); 45016 ob && ob.vmCount++; 45017 } 45018 if (opts.computed) 45019 initComputed$1(vm, opts.computed); 45020 if (opts.watch && opts.watch !== nativeWatch) { 45021 initWatch(vm, opts.watch); 45022 } 45023} 45024function initProps$1(vm, propsOptions) { 45025 const propsData = vm.$options.propsData || {}; 45026 const props = (vm._props = shallowReactive({})); 45027 // cache prop keys so that future props updates can iterate using Array 45028 // instead of dynamic object key enumeration. 45029 const keys = (vm.$options._propKeys = []); 45030 const isRoot = !vm.$parent; 45031 // root instance props should be converted 45032 if (!isRoot) { 45033 toggleObserving(false); 45034 } 45035 for (const key in propsOptions) { 45036 keys.push(key); 45037 const value = validateProp(key, propsOptions, propsData, vm); 45038 /* istanbul ignore else */ 45039 { 45040 const hyphenatedKey = hyphenate(key); 45041 if (isReservedAttribute(hyphenatedKey) || 45042 config.isReservedAttr(hyphenatedKey)) { 45043 warn(`"${hyphenatedKey}" is a reserved attribute and cannot be used as component prop.`, vm); 45044 } 45045 defineReactive(props, key, value, () => { 45046 if (!isRoot && !isUpdatingChildComponent) { 45047 warn(`Avoid mutating a prop directly since the value will be ` + 45048 `overwritten whenever the parent component re-renders. ` + 45049 `Instead, use a data or computed property based on the prop's ` + 45050 `value. Prop being mutated: "${key}"`, vm); 45051 } 45052 }, true /* shallow */); 45053 } 45054 // static props are already proxied on the component's prototype 45055 // during Vue.extend(). We only need to proxy props defined at 45056 // instantiation here. 45057 if (!(key in vm)) { 45058 proxy(vm, `_props`, key); 45059 } 45060 } 45061 toggleObserving(true); 45062} 45063function initData(vm) { 45064 let data = vm.$options.data; 45065 data = vm._data = isFunction(data) ? getData(data, vm) : data || {}; 45066 if (!isPlainObject(data)) { 45067 data = {}; 45068 warn('data functions should return an object:\n' + 45069 'https://v2.vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm); 45070 } 45071 // proxy data on instance 45072 const keys = Object.keys(data); 45073 const props = vm.$options.props; 45074 const methods = vm.$options.methods; 45075 let i = keys.length; 45076 while (i--) { 45077 const key = keys[i]; 45078 { 45079 if (methods && hasOwn(methods, key)) { 45080 warn(`Method "${key}" has already been defined as a data property.`, vm); 45081 } 45082 } 45083 if (props && hasOwn(props, key)) { 45084 warn(`The data property "${key}" is already declared as a prop. ` + 45085 `Use prop default value instead.`, vm); 45086 } 45087 else if (!isReserved(key)) { 45088 proxy(vm, `_data`, key); 45089 } 45090 } 45091 // observe data 45092 const ob = observe(data); 45093 ob && ob.vmCount++; 45094} 45095function getData(data, vm) { 45096 // #7573 disable dep collection when invoking data getters 45097 pushTarget(); 45098 try { 45099 return data.call(vm, vm); 45100 } 45101 catch (e) { 45102 handleError(e, vm, `data()`); 45103 return {}; 45104 } 45105 finally { 45106 popTarget(); 45107 } 45108} 45109const computedWatcherOptions = { lazy: true }; 45110function initComputed$1(vm, computed) { 45111 // $flow-disable-line 45112 const watchers = (vm._computedWatchers = Object.create(null)); 45113 // computed properties are just getters during SSR 45114 const isSSR = isServerRendering(); 45115 for (const key in computed) { 45116 const userDef = computed[key]; 45117 const getter = isFunction(userDef) ? userDef : userDef.get; 45118 if (getter == null) { 45119 warn(`Getter is missing for computed property "${key}".`, vm); 45120 } 45121 if (!isSSR) { 45122 // create internal watcher for the computed property. 45123 watchers[key] = new Watcher(vm, getter || noop, noop, computedWatcherOptions); 45124 } 45125 // component-defined computed properties are already defined on the 45126 // component prototype. We only need to define computed properties defined 45127 // at instantiation here. 45128 if (!(key in vm)) { 45129 defineComputed(vm, key, userDef); 45130 } 45131 else { 45132 if (key in vm.$data) { 45133 warn(`The computed property "${key}" is already defined in data.`, vm); 45134 } 45135 else if (vm.$options.props && key in vm.$options.props) { 45136 warn(`The computed property "${key}" is already defined as a prop.`, vm); 45137 } 45138 else if (vm.$options.methods && key in vm.$options.methods) { 45139 warn(`The computed property "${key}" is already defined as a method.`, vm); 45140 } 45141 } 45142 } 45143} 45144function defineComputed(target, key, userDef) { 45145 const shouldCache = !isServerRendering(); 45146 if (isFunction(userDef)) { 45147 sharedPropertyDefinition.get = shouldCache 45148 ? createComputedGetter(key) 45149 : createGetterInvoker(userDef); 45150 sharedPropertyDefinition.set = noop; 45151 } 45152 else { 45153 sharedPropertyDefinition.get = userDef.get 45154 ? shouldCache && userDef.cache !== false 45155 ? createComputedGetter(key) 45156 : createGetterInvoker(userDef.get) 45157 : noop; 45158 sharedPropertyDefinition.set = userDef.set || noop; 45159 } 45160 if (sharedPropertyDefinition.set === noop) { 45161 sharedPropertyDefinition.set = function () { 45162 warn(`Computed property "${key}" was assigned to but it has no setter.`, this); 45163 }; 45164 } 45165 Object.defineProperty(target, key, sharedPropertyDefinition); 45166} 45167function createComputedGetter(key) { 45168 return function computedGetter() { 45169 const watcher = this._computedWatchers && this._computedWatchers[key]; 45170 if (watcher) { 45171 if (watcher.dirty) { 45172 watcher.evaluate(); 45173 } 45174 if (Dep.target) { 45175 if (Dep.target.onTrack) { 45176 Dep.target.onTrack({ 45177 effect: Dep.target, 45178 target: this, 45179 type: "get" /* TrackOpTypes.GET */, 45180 key 45181 }); 45182 } 45183 watcher.depend(); 45184 } 45185 return watcher.value; 45186 } 45187 }; 45188} 45189function createGetterInvoker(fn) { 45190 return function computedGetter() { 45191 return fn.call(this, this); 45192 }; 45193} 45194function initMethods(vm, methods) { 45195 const props = vm.$options.props; 45196 for (const key in methods) { 45197 { 45198 if (typeof methods[key] !== 'function') { 45199 warn(`Method "${key}" has type "${typeof methods[key]}" in the component definition. ` + 45200 `Did you reference the function correctly?`, vm); 45201 } 45202 if (props && hasOwn(props, key)) { 45203 warn(`Method "${key}" has already been defined as a prop.`, vm); 45204 } 45205 if (key in vm && isReserved(key)) { 45206 warn(`Method "${key}" conflicts with an existing Vue instance method. ` + 45207 `Avoid defining component methods that start with _ or $.`); 45208 } 45209 } 45210 vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm); 45211 } 45212} 45213function initWatch(vm, watch) { 45214 for (const key in watch) { 45215 const handler = watch[key]; 45216 if (isArray(handler)) { 45217 for (let i = 0; i < handler.length; i++) { 45218 createWatcher(vm, key, handler[i]); 45219 } 45220 } 45221 else { 45222 createWatcher(vm, key, handler); 45223 } 45224 } 45225} 45226function createWatcher(vm, expOrFn, handler, options) { 45227 if (isPlainObject(handler)) { 45228 options = handler; 45229 handler = handler.handler; 45230 } 45231 if (typeof handler === 'string') { 45232 handler = vm[handler]; 45233 } 45234 return vm.$watch(expOrFn, handler, options); 45235} 45236function stateMixin(Vue) { 45237 // flow somehow has problems with directly declared definition object 45238 // when using Object.defineProperty, so we have to procedurally build up 45239 // the object here. 45240 const dataDef = {}; 45241 dataDef.get = function () { 45242 return this._data; 45243 }; 45244 const propsDef = {}; 45245 propsDef.get = function () { 45246 return this._props; 45247 }; 45248 { 45249 dataDef.set = function () { 45250 warn('Avoid replacing instance root $data. ' + 45251 'Use nested data properties instead.', this); 45252 }; 45253 propsDef.set = function () { 45254 warn(`$props is readonly.`, this); 45255 }; 45256 } 45257 Object.defineProperty(Vue.prototype, '$data', dataDef); 45258 Object.defineProperty(Vue.prototype, '$props', propsDef); 45259 Vue.prototype.$set = set; 45260 Vue.prototype.$delete = del; 45261 Vue.prototype.$watch = function (expOrFn, cb, options) { 45262 const vm = this; 45263 if (isPlainObject(cb)) { 45264 return createWatcher(vm, expOrFn, cb, options); 45265 } 45266 options = options || {}; 45267 options.user = true; 45268 const watcher = new Watcher(vm, expOrFn, cb, options); 45269 if (options.immediate) { 45270 const info = `callback for immediate watcher "${watcher.expression}"`; 45271 pushTarget(); 45272 invokeWithErrorHandling(cb, vm, [watcher.value], vm, info); 45273 popTarget(); 45274 } 45275 return function unwatchFn() { 45276 watcher.teardown(); 45277 }; 45278 }; 45279} 45280 45281let uid = 0; 45282function initMixin$1(Vue) { 45283 Vue.prototype._init = function (options) { 45284 const vm = this; 45285 // a uid 45286 vm._uid = uid++; 45287 let startTag, endTag; 45288 /* istanbul ignore if */ 45289 if (config.performance && mark) { 45290 startTag = `vue-perf-start:${vm._uid}`; 45291 endTag = `vue-perf-end:${vm._uid}`; 45292 mark(startTag); 45293 } 45294 // a flag to mark this as a Vue instance without having to do instanceof 45295 // check 45296 vm._isVue = true; 45297 // avoid instances from being observed 45298 vm.__v_skip = true; 45299 // effect scope 45300 vm._scope = new EffectScope(true /* detached */); 45301 // #13134 edge case where a child component is manually created during the 45302 // render of a parent component 45303 vm._scope.parent = undefined; 45304 vm._scope._vm = true; 45305 // merge options 45306 if (options && options._isComponent) { 45307 // optimize internal component instantiation 45308 // since dynamic options merging is pretty slow, and none of the 45309 // internal component options needs special treatment. 45310 initInternalComponent(vm, options); 45311 } 45312 else { 45313 vm.$options = mergeOptions(resolveConstructorOptions(vm.constructor), options || {}, vm); 45314 } 45315 /* istanbul ignore else */ 45316 { 45317 initProxy(vm); 45318 } 45319 // expose real self 45320 vm._self = vm; 45321 initLifecycle(vm); 45322 initEvents(vm); 45323 initRender(vm); 45324 callHook$1(vm, 'beforeCreate', undefined, false /* setContext */); 45325 initInjections(vm); // resolve injections before data/props 45326 initState(vm); 45327 initProvide(vm); // resolve provide after data/props 45328 callHook$1(vm, 'created'); 45329 /* istanbul ignore if */ 45330 if (config.performance && mark) { 45331 vm._name = formatComponentName(vm, false); 45332 mark(endTag); 45333 measure(`vue ${vm._name} init`, startTag, endTag); 45334 } 45335 if (vm.$options.el) { 45336 vm.$mount(vm.$options.el); 45337 } 45338 }; 45339} 45340function initInternalComponent(vm, options) { 45341 const opts = (vm.$options = Object.create(vm.constructor.options)); 45342 // doing this because it's faster than dynamic enumeration. 45343 const parentVnode = options._parentVnode; 45344 opts.parent = options.parent; 45345 opts._parentVnode = parentVnode; 45346 const vnodeComponentOptions = parentVnode.componentOptions; 45347 opts.propsData = vnodeComponentOptions.propsData; 45348 opts._parentListeners = vnodeComponentOptions.listeners; 45349 opts._renderChildren = vnodeComponentOptions.children; 45350 opts._componentTag = vnodeComponentOptions.tag; 45351 if (options.render) { 45352 opts.render = options.render; 45353 opts.staticRenderFns = options.staticRenderFns; 45354 } 45355} 45356function resolveConstructorOptions(Ctor) { 45357 let options = Ctor.options; 45358 if (Ctor.super) { 45359 const superOptions = resolveConstructorOptions(Ctor.super); 45360 const cachedSuperOptions = Ctor.superOptions; 45361 if (superOptions !== cachedSuperOptions) { 45362 // super option changed, 45363 // need to resolve new options. 45364 Ctor.superOptions = superOptions; 45365 // check if there are any late-modified/attached options (#4976) 45366 const modifiedOptions = resolveModifiedOptions(Ctor); 45367 // update base extend options 45368 if (modifiedOptions) { 45369 extend(Ctor.extendOptions, modifiedOptions); 45370 } 45371 options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions); 45372 if (options.name) { 45373 options.components[options.name] = Ctor; 45374 } 45375 } 45376 } 45377 return options; 45378} 45379function resolveModifiedOptions(Ctor) { 45380 let modified; 45381 const latest = Ctor.options; 45382 const sealed = Ctor.sealedOptions; 45383 for (const key in latest) { 45384 if (latest[key] !== sealed[key]) { 45385 if (!modified) 45386 modified = {}; 45387 modified[key] = latest[key]; 45388 } 45389 } 45390 return modified; 45391} 45392 45393function Vue(options) { 45394 if (!(this instanceof Vue)) { 45395 warn('Vue is a constructor and should be called with the `new` keyword'); 45396 } 45397 this._init(options); 45398} 45399//@ts-expect-error Vue has function type 45400initMixin$1(Vue); 45401//@ts-expect-error Vue has function type 45402stateMixin(Vue); 45403//@ts-expect-error Vue has function type 45404eventsMixin(Vue); 45405//@ts-expect-error Vue has function type 45406lifecycleMixin(Vue); 45407//@ts-expect-error Vue has function type 45408renderMixin(Vue); 45409 45410function initUse(Vue) { 45411 Vue.use = function (plugin) { 45412 const installedPlugins = this._installedPlugins || (this._installedPlugins = []); 45413 if (installedPlugins.indexOf(plugin) > -1) { 45414 return this; 45415 } 45416 // additional parameters 45417 const args = toArray(arguments, 1); 45418 args.unshift(this); 45419 if (isFunction(plugin.install)) { 45420 plugin.install.apply(plugin, args); 45421 } 45422 else if (isFunction(plugin)) { 45423 plugin.apply(null, args); 45424 } 45425 installedPlugins.push(plugin); 45426 return this; 45427 }; 45428} 45429 45430function initMixin(Vue) { 45431 Vue.mixin = function (mixin) { 45432 this.options = mergeOptions(this.options, mixin); 45433 return this; 45434 }; 45435} 45436 45437function initExtend(Vue) { 45438 /** 45439 * Each instance constructor, including Vue, has a unique 45440 * cid. This enables us to create wrapped "child 45441 * constructors" for prototypal inheritance and cache them. 45442 */ 45443 Vue.cid = 0; 45444 let cid = 1; 45445 /** 45446 * Class inheritance 45447 */ 45448 Vue.extend = function (extendOptions) { 45449 extendOptions = extendOptions || {}; 45450 const Super = this; 45451 const SuperId = Super.cid; 45452 const cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {}); 45453 if (cachedCtors[SuperId]) { 45454 return cachedCtors[SuperId]; 45455 } 45456 const name = getComponentName(extendOptions) || getComponentName(Super.options); 45457 if (name) { 45458 validateComponentName(name); 45459 } 45460 const Sub = function VueComponent(options) { 45461 this._init(options); 45462 }; 45463 Sub.prototype = Object.create(Super.prototype); 45464 Sub.prototype.constructor = Sub; 45465 Sub.cid = cid++; 45466 Sub.options = mergeOptions(Super.options, extendOptions); 45467 Sub['super'] = Super; 45468 // For props and computed properties, we define the proxy getters on 45469 // the Vue instances at extension time, on the extended prototype. This 45470 // avoids Object.defineProperty calls for each instance created. 45471 if (Sub.options.props) { 45472 initProps(Sub); 45473 } 45474 if (Sub.options.computed) { 45475 initComputed(Sub); 45476 } 45477 // allow further extension/mixin/plugin usage 45478 Sub.extend = Super.extend; 45479 Sub.mixin = Super.mixin; 45480 Sub.use = Super.use; 45481 // create asset registers, so extended classes 45482 // can have their private assets too. 45483 ASSET_TYPES.forEach(function (type) { 45484 Sub[type] = Super[type]; 45485 }); 45486 // enable recursive self-lookup 45487 if (name) { 45488 Sub.options.components[name] = Sub; 45489 } 45490 // keep a reference to the super options at extension time. 45491 // later at instantiation we can check if Super's options have 45492 // been updated. 45493 Sub.superOptions = Super.options; 45494 Sub.extendOptions = extendOptions; 45495 Sub.sealedOptions = extend({}, Sub.options); 45496 // cache constructor 45497 cachedCtors[SuperId] = Sub; 45498 return Sub; 45499 }; 45500} 45501function initProps(Comp) { 45502 const props = Comp.options.props; 45503 for (const key in props) { 45504 proxy(Comp.prototype, `_props`, key); 45505 } 45506} 45507function initComputed(Comp) { 45508 const computed = Comp.options.computed; 45509 for (const key in computed) { 45510 defineComputed(Comp.prototype, key, computed[key]); 45511 } 45512} 45513 45514function initAssetRegisters(Vue) { 45515 /** 45516 * Create asset registration methods. 45517 */ 45518 ASSET_TYPES.forEach(type => { 45519 // @ts-expect-error function is not exact same type 45520 Vue[type] = function (id, definition) { 45521 if (!definition) { 45522 return this.options[type + 's'][id]; 45523 } 45524 else { 45525 /* istanbul ignore if */ 45526 if (type === 'component') { 45527 validateComponentName(id); 45528 } 45529 if (type === 'component' && isPlainObject(definition)) { 45530 // @ts-expect-error 45531 definition.name = definition.name || id; 45532 definition = this.options._base.extend(definition); 45533 } 45534 if (type === 'directive' && isFunction(definition)) { 45535 definition = { bind: definition, update: definition }; 45536 } 45537 this.options[type + 's'][id] = definition; 45538 return definition; 45539 } 45540 }; 45541 }); 45542} 45543 45544function _getComponentName(opts) { 45545 return opts && (getComponentName(opts.Ctor.options) || opts.tag); 45546} 45547function matches(pattern, name) { 45548 if (isArray(pattern)) { 45549 return pattern.indexOf(name) > -1; 45550 } 45551 else if (typeof pattern === 'string') { 45552 return pattern.split(',').indexOf(name) > -1; 45553 } 45554 else if (isRegExp(pattern)) { 45555 return pattern.test(name); 45556 } 45557 /* istanbul ignore next */ 45558 return false; 45559} 45560function pruneCache(keepAliveInstance, filter) { 45561 const { cache, keys, _vnode, $vnode } = keepAliveInstance; 45562 for (const key in cache) { 45563 const entry = cache[key]; 45564 if (entry) { 45565 const name = entry.name; 45566 if (name && !filter(name)) { 45567 pruneCacheEntry(cache, key, keys, _vnode); 45568 } 45569 } 45570 } 45571 $vnode.componentOptions.children = undefined; 45572} 45573function pruneCacheEntry(cache, key, keys, current) { 45574 const entry = cache[key]; 45575 if (entry && (!current || entry.tag !== current.tag)) { 45576 // @ts-expect-error can be undefined 45577 entry.componentInstance.$destroy(); 45578 } 45579 cache[key] = null; 45580 remove$2(keys, key); 45581} 45582const patternTypes = [String, RegExp, Array]; 45583// TODO defineComponent 45584var KeepAlive = { 45585 name: 'keep-alive', 45586 abstract: true, 45587 props: { 45588 include: patternTypes, 45589 exclude: patternTypes, 45590 max: [String, Number] 45591 }, 45592 methods: { 45593 cacheVNode() { 45594 const { cache, keys, vnodeToCache, keyToCache } = this; 45595 if (vnodeToCache) { 45596 const { tag, componentInstance, componentOptions } = vnodeToCache; 45597 cache[keyToCache] = { 45598 name: _getComponentName(componentOptions), 45599 tag, 45600 componentInstance 45601 }; 45602 keys.push(keyToCache); 45603 // prune oldest entry 45604 if (this.max && keys.length > parseInt(this.max)) { 45605 pruneCacheEntry(cache, keys[0], keys, this._vnode); 45606 } 45607 this.vnodeToCache = null; 45608 } 45609 } 45610 }, 45611 created() { 45612 this.cache = Object.create(null); 45613 this.keys = []; 45614 }, 45615 destroyed() { 45616 for (const key in this.cache) { 45617 pruneCacheEntry(this.cache, key, this.keys); 45618 } 45619 }, 45620 mounted() { 45621 this.cacheVNode(); 45622 this.$watch('include', val => { 45623 pruneCache(this, name => matches(val, name)); 45624 }); 45625 this.$watch('exclude', val => { 45626 pruneCache(this, name => !matches(val, name)); 45627 }); 45628 }, 45629 updated() { 45630 this.cacheVNode(); 45631 }, 45632 render() { 45633 const slot = this.$slots.default; 45634 const vnode = getFirstComponentChild(slot); 45635 const componentOptions = vnode && vnode.componentOptions; 45636 if (componentOptions) { 45637 // check pattern 45638 const name = _getComponentName(componentOptions); 45639 const { include, exclude } = this; 45640 if ( 45641 // not included 45642 (include && (!name || !matches(include, name))) || 45643 // excluded 45644 (exclude && name && matches(exclude, name))) { 45645 return vnode; 45646 } 45647 const { cache, keys } = this; 45648 const key = vnode.key == null 45649 ? // same constructor may get registered as different local components 45650 // so cid alone is not enough (#3269) 45651 componentOptions.Ctor.cid + 45652 (componentOptions.tag ? `::${componentOptions.tag}` : '') 45653 : vnode.key; 45654 if (cache[key]) { 45655 vnode.componentInstance = cache[key].componentInstance; 45656 // make current key freshest 45657 remove$2(keys, key); 45658 keys.push(key); 45659 } 45660 else { 45661 // delay setting the cache until update 45662 this.vnodeToCache = vnode; 45663 this.keyToCache = key; 45664 } 45665 // @ts-expect-error can vnode.data can be undefined 45666 vnode.data.keepAlive = true; 45667 } 45668 return vnode || (slot && slot[0]); 45669 } 45670}; 45671 45672var builtInComponents = { 45673 KeepAlive 45674}; 45675 45676function initGlobalAPI(Vue) { 45677 // config 45678 const configDef = {}; 45679 configDef.get = () => config; 45680 { 45681 configDef.set = () => { 45682 warn('Do not replace the Vue.config object, set individual fields instead.'); 45683 }; 45684 } 45685 Object.defineProperty(Vue, 'config', configDef); 45686 // exposed util methods. 45687 // NOTE: these are not considered part of the public API - avoid relying on 45688 // them unless you are aware of the risk. 45689 Vue.util = { 45690 warn, 45691 extend, 45692 mergeOptions, 45693 defineReactive 45694 }; 45695 Vue.set = set; 45696 Vue.delete = del; 45697 Vue.nextTick = nextTick; 45698 // 2.6 explicit observable API 45699 Vue.observable = (obj) => { 45700 observe(obj); 45701 return obj; 45702 }; 45703 Vue.options = Object.create(null); 45704 ASSET_TYPES.forEach(type => { 45705 Vue.options[type + 's'] = Object.create(null); 45706 }); 45707 // this is used to identify the "base" constructor to extend all plain-object 45708 // components with in Weex's multi-instance scenarios. 45709 Vue.options._base = Vue; 45710 extend(Vue.options.components, builtInComponents); 45711 initUse(Vue); 45712 initMixin(Vue); 45713 initExtend(Vue); 45714 initAssetRegisters(Vue); 45715} 45716 45717initGlobalAPI(Vue); 45718Object.defineProperty(Vue.prototype, '$isServer', { 45719 get: isServerRendering 45720}); 45721Object.defineProperty(Vue.prototype, '$ssrContext', { 45722 get() { 45723 /* istanbul ignore next */ 45724 return this.$vnode && this.$vnode.ssrContext; 45725 } 45726}); 45727// expose FunctionalRenderContext for ssr runtime helper installation 45728Object.defineProperty(Vue, 'FunctionalRenderContext', { 45729 value: FunctionalRenderContext 45730}); 45731Vue.version = version; 45732 45733// these are reserved for web because they are directly compiled away 45734// during template compilation 45735const isReservedAttr = makeMap('style,class'); 45736// attributes that should be using props for binding 45737const acceptValue = makeMap('input,textarea,option,select,progress'); 45738const mustUseProp = (tag, type, attr) => { 45739 return ((attr === 'value' && acceptValue(tag) && type !== 'button') || 45740 (attr === 'selected' && tag === 'option') || 45741 (attr === 'checked' && tag === 'input') || 45742 (attr === 'muted' && tag === 'video')); 45743}; 45744const isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck'); 45745const isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only'); 45746const convertEnumeratedValue = (key, value) => { 45747 return isFalsyAttrValue(value) || value === 'false' 45748 ? 'false' 45749 : // allow arbitrary string value for contenteditable 45750 key === 'contenteditable' && isValidContentEditableValue(value) 45751 ? value 45752 : 'true'; 45753}; 45754const isBooleanAttr = makeMap('allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' + 45755 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' + 45756 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' + 45757 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' + 45758 'required,reversed,scoped,seamless,selected,sortable,' + 45759 'truespeed,typemustmatch,visible'); 45760const xlinkNS = 'http://www.w3.org/1999/xlink'; 45761const isXlink = (name) => { 45762 return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'; 45763}; 45764const getXlinkProp = (name) => { 45765 return isXlink(name) ? name.slice(6, name.length) : ''; 45766}; 45767const isFalsyAttrValue = (val) => { 45768 return val == null || val === false; 45769}; 45770 45771function genClassForVnode(vnode) { 45772 let data = vnode.data; 45773 let parentNode = vnode; 45774 let childNode = vnode; 45775 while (isDef(childNode.componentInstance)) { 45776 childNode = childNode.componentInstance._vnode; 45777 if (childNode && childNode.data) { 45778 data = mergeClassData(childNode.data, data); 45779 } 45780 } 45781 // @ts-expect-error parentNode.parent not VNodeWithData 45782 while (isDef((parentNode = parentNode.parent))) { 45783 if (parentNode && parentNode.data) { 45784 data = mergeClassData(data, parentNode.data); 45785 } 45786 } 45787 return renderClass(data.staticClass, data.class); 45788} 45789function mergeClassData(child, parent) { 45790 return { 45791 staticClass: concat(child.staticClass, parent.staticClass), 45792 class: isDef(child.class) ? [child.class, parent.class] : parent.class 45793 }; 45794} 45795function renderClass(staticClass, dynamicClass) { 45796 if (isDef(staticClass) || isDef(dynamicClass)) { 45797 return concat(staticClass, stringifyClass(dynamicClass)); 45798 } 45799 /* istanbul ignore next */ 45800 return ''; 45801} 45802function concat(a, b) { 45803 return a ? (b ? a + ' ' + b : a) : b || ''; 45804} 45805function stringifyClass(value) { 45806 if (Array.isArray(value)) { 45807 return stringifyArray(value); 45808 } 45809 if (isObject(value)) { 45810 return stringifyObject(value); 45811 } 45812 if (typeof value === 'string') { 45813 return value; 45814 } 45815 /* istanbul ignore next */ 45816 return ''; 45817} 45818function stringifyArray(value) { 45819 let res = ''; 45820 let stringified; 45821 for (let i = 0, l = value.length; i < l; i++) { 45822 if (isDef((stringified = stringifyClass(value[i]))) && stringified !== '') { 45823 if (res) 45824 res += ' '; 45825 res += stringified; 45826 } 45827 } 45828 return res; 45829} 45830function stringifyObject(value) { 45831 let res = ''; 45832 for (const key in value) { 45833 if (value[key]) { 45834 if (res) 45835 res += ' '; 45836 res += key; 45837 } 45838 } 45839 return res; 45840} 45841 45842const namespaceMap = { 45843 svg: 'http://www.w3.org/2000/svg', 45844 math: 'http://www.w3.org/1998/Math/MathML' 45845}; 45846const isHTMLTag = makeMap('html,body,base,head,link,meta,style,title,' + 45847 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' + 45848 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' + 45849 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' + 45850 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' + 45851 'embed,object,param,source,canvas,script,noscript,del,ins,' + 45852 'caption,col,colgroup,table,thead,tbody,td,th,tr,' + 45853 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' + 45854 'output,progress,select,textarea,' + 45855 'details,dialog,menu,menuitem,summary,' + 45856 'content,element,shadow,template,blockquote,iframe,tfoot'); 45857// this map is intentionally selective, only covering SVG elements that may 45858// contain child elements. 45859const isSVG = makeMap('svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' + 45860 'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' + 45861 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view', true); 45862const isReservedTag = (tag) => { 45863 return isHTMLTag(tag) || isSVG(tag); 45864}; 45865function getTagNamespace(tag) { 45866 if (isSVG(tag)) { 45867 return 'svg'; 45868 } 45869 // basic support for MathML 45870 // note it doesn't support other MathML elements being component roots 45871 if (tag === 'math') { 45872 return 'math'; 45873 } 45874} 45875const unknownElementCache = Object.create(null); 45876function isUnknownElement(tag) { 45877 /* istanbul ignore if */ 45878 if (!inBrowser) { 45879 return true; 45880 } 45881 if (isReservedTag(tag)) { 45882 return false; 45883 } 45884 tag = tag.toLowerCase(); 45885 /* istanbul ignore if */ 45886 if (unknownElementCache[tag] != null) { 45887 return unknownElementCache[tag]; 45888 } 45889 const el = document.createElement(tag); 45890 if (tag.indexOf('-') > -1) { 45891 // https://stackoverflow.com/a/28210364/1070244 45892 return (unknownElementCache[tag] = 45893 el.constructor === window.HTMLUnknownElement || 45894 el.constructor === window.HTMLElement); 45895 } 45896 else { 45897 return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString())); 45898 } 45899} 45900const isTextInputType = makeMap('text,number,password,search,email,tel,url'); 45901 45902/** 45903 * Query an element selector if it's not an element already. 45904 */ 45905function query(el) { 45906 if (typeof el === 'string') { 45907 const selected = document.querySelector(el); 45908 if (!selected) { 45909 warn('Cannot find element: ' + el); 45910 return document.createElement('div'); 45911 } 45912 return selected; 45913 } 45914 else { 45915 return el; 45916 } 45917} 45918 45919function createElement(tagName, vnode) { 45920 const elm = document.createElement(tagName); 45921 if (tagName !== 'select') { 45922 return elm; 45923 } 45924 // false or null will remove the attribute but undefined will not 45925 if (vnode.data && 45926 vnode.data.attrs && 45927 vnode.data.attrs.multiple !== undefined) { 45928 elm.setAttribute('multiple', 'multiple'); 45929 } 45930 return elm; 45931} 45932function createElementNS(namespace, tagName) { 45933 return document.createElementNS(namespaceMap[namespace], tagName); 45934} 45935function createTextNode(text) { 45936 return document.createTextNode(text); 45937} 45938function createComment(text) { 45939 return document.createComment(text); 45940} 45941function insertBefore(parentNode, newNode, referenceNode) { 45942 parentNode.insertBefore(newNode, referenceNode); 45943} 45944function removeChild(node, child) { 45945 node.removeChild(child); 45946} 45947function appendChild(node, child) { 45948 node.appendChild(child); 45949} 45950function parentNode(node) { 45951 return node.parentNode; 45952} 45953function nextSibling(node) { 45954 return node.nextSibling; 45955} 45956function tagName(node) { 45957 return node.tagName; 45958} 45959function setTextContent(node, text) { 45960 node.textContent = text; 45961} 45962function setStyleScope(node, scopeId) { 45963 node.setAttribute(scopeId, ''); 45964} 45965 45966var nodeOps = /*#__PURE__*/Object.freeze({ 45967 __proto__: null, 45968 createElement: createElement, 45969 createElementNS: createElementNS, 45970 createTextNode: createTextNode, 45971 createComment: createComment, 45972 insertBefore: insertBefore, 45973 removeChild: removeChild, 45974 appendChild: appendChild, 45975 parentNode: parentNode, 45976 nextSibling: nextSibling, 45977 tagName: tagName, 45978 setTextContent: setTextContent, 45979 setStyleScope: setStyleScope 45980}); 45981 45982var ref = { 45983 create(_, vnode) { 45984 registerRef(vnode); 45985 }, 45986 update(oldVnode, vnode) { 45987 if (oldVnode.data.ref !== vnode.data.ref) { 45988 registerRef(oldVnode, true); 45989 registerRef(vnode); 45990 } 45991 }, 45992 destroy(vnode) { 45993 registerRef(vnode, true); 45994 } 45995}; 45996function registerRef(vnode, isRemoval) { 45997 const ref = vnode.data.ref; 45998 if (!isDef(ref)) 45999 return; 46000 const vm = vnode.context; 46001 const refValue = vnode.componentInstance || vnode.elm; 46002 const value = isRemoval ? null : refValue; 46003 const $refsValue = isRemoval ? undefined : refValue; 46004 if (isFunction(ref)) { 46005 invokeWithErrorHandling(ref, vm, [value], vm, `template ref function`); 46006 return; 46007 } 46008 const isFor = vnode.data.refInFor; 46009 const _isString = typeof ref === 'string' || typeof ref === 'number'; 46010 const _isRef = isRef(ref); 46011 const refs = vm.$refs; 46012 if (_isString || _isRef) { 46013 if (isFor) { 46014 const existing = _isString ? refs[ref] : ref.value; 46015 if (isRemoval) { 46016 isArray(existing) && remove$2(existing, refValue); 46017 } 46018 else { 46019 if (!isArray(existing)) { 46020 if (_isString) { 46021 refs[ref] = [refValue]; 46022 setSetupRef(vm, ref, refs[ref]); 46023 } 46024 else { 46025 ref.value = [refValue]; 46026 } 46027 } 46028 else if (!existing.includes(refValue)) { 46029 existing.push(refValue); 46030 } 46031 } 46032 } 46033 else if (_isString) { 46034 if (isRemoval && refs[ref] !== refValue) { 46035 return; 46036 } 46037 refs[ref] = $refsValue; 46038 setSetupRef(vm, ref, value); 46039 } 46040 else if (_isRef) { 46041 if (isRemoval && ref.value !== refValue) { 46042 return; 46043 } 46044 ref.value = value; 46045 } 46046 else { 46047 warn(`Invalid template ref type: ${typeof ref}`); 46048 } 46049 } 46050} 46051function setSetupRef({ _setupState }, key, val) { 46052 if (_setupState && hasOwn(_setupState, key)) { 46053 if (isRef(_setupState[key])) { 46054 _setupState[key].value = val; 46055 } 46056 else { 46057 _setupState[key] = val; 46058 } 46059 } 46060} 46061 46062/** 46063 * Virtual DOM patching algorithm based on Snabbdom by 46064 * Simon Friis Vindum (@paldepind) 46065 * Licensed under the MIT License 46066 * https://github.com/paldepind/snabbdom/blob/master/LICENSE 46067 * 46068 * modified by Evan You (@yyx990803) 46069 * 46070 * Not type-checking this because this file is perf-critical and the cost 46071 * of making flow understand it is not worth it. 46072 */ 46073const emptyNode = new VNode('', {}, []); 46074const hooks = ['create', 'activate', 'update', 'remove', 'destroy']; 46075function sameVnode(a, b) { 46076 return (a.key === b.key && 46077 a.asyncFactory === b.asyncFactory && 46078 ((a.tag === b.tag && 46079 a.isComment === b.isComment && 46080 isDef(a.data) === isDef(b.data) && 46081 sameInputType(a, b)) || 46082 (isTrue(a.isAsyncPlaceholder) && isUndef(b.asyncFactory.error)))); 46083} 46084function sameInputType(a, b) { 46085 if (a.tag !== 'input') 46086 return true; 46087 let i; 46088 const typeA = isDef((i = a.data)) && isDef((i = i.attrs)) && i.type; 46089 const typeB = isDef((i = b.data)) && isDef((i = i.attrs)) && i.type; 46090 return typeA === typeB || (isTextInputType(typeA) && isTextInputType(typeB)); 46091} 46092function createKeyToOldIdx(children, beginIdx, endIdx) { 46093 let i, key; 46094 const map = {}; 46095 for (i = beginIdx; i <= endIdx; ++i) { 46096 key = children[i].key; 46097 if (isDef(key)) 46098 map[key] = i; 46099 } 46100 return map; 46101} 46102function createPatchFunction(backend) { 46103 let i, j; 46104 const cbs = {}; 46105 const { modules, nodeOps } = backend; 46106 for (i = 0; i < hooks.length; ++i) { 46107 cbs[hooks[i]] = []; 46108 for (j = 0; j < modules.length; ++j) { 46109 if (isDef(modules[j][hooks[i]])) { 46110 cbs[hooks[i]].push(modules[j][hooks[i]]); 46111 } 46112 } 46113 } 46114 function emptyNodeAt(elm) { 46115 return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm); 46116 } 46117 function createRmCb(childElm, listeners) { 46118 function remove() { 46119 if (--remove.listeners === 0) { 46120 removeNode(childElm); 46121 } 46122 } 46123 remove.listeners = listeners; 46124 return remove; 46125 } 46126 function removeNode(el) { 46127 const parent = nodeOps.parentNode(el); 46128 // element may have already been removed due to v-html / v-text 46129 if (isDef(parent)) { 46130 nodeOps.removeChild(parent, el); 46131 } 46132 } 46133 function isUnknownElement(vnode, inVPre) { 46134 return (!inVPre && 46135 !vnode.ns && 46136 !(config.ignoredElements.length && 46137 config.ignoredElements.some(ignore => { 46138 return isRegExp(ignore) 46139 ? ignore.test(vnode.tag) 46140 : ignore === vnode.tag; 46141 })) && 46142 config.isUnknownElement(vnode.tag)); 46143 } 46144 let creatingElmInVPre = 0; 46145 function createElm(vnode, insertedVnodeQueue, parentElm, refElm, nested, ownerArray, index) { 46146 if (isDef(vnode.elm) && isDef(ownerArray)) { 46147 // This vnode was used in a previous render! 46148 // now it's used as a new node, overwriting its elm would cause 46149 // potential patch errors down the road when it's used as an insertion 46150 // reference node. Instead, we clone the node on-demand before creating 46151 // associated DOM element for it. 46152 vnode = ownerArray[index] = cloneVNode(vnode); 46153 } 46154 vnode.isRootInsert = !nested; // for transition enter check 46155 if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) { 46156 return; 46157 } 46158 const data = vnode.data; 46159 const children = vnode.children; 46160 const tag = vnode.tag; 46161 if (isDef(tag)) { 46162 { 46163 if (data && data.pre) { 46164 creatingElmInVPre++; 46165 } 46166 if (isUnknownElement(vnode, creatingElmInVPre)) { 46167 warn('Unknown custom element: <' + 46168 tag + 46169 '> - did you ' + 46170 'register the component correctly? For recursive components, ' + 46171 'make sure to provide the "name" option.', vnode.context); 46172 } 46173 } 46174 vnode.elm = vnode.ns 46175 ? nodeOps.createElementNS(vnode.ns, tag) 46176 : nodeOps.createElement(tag, vnode); 46177 setScope(vnode); 46178 createChildren(vnode, children, insertedVnodeQueue); 46179 if (isDef(data)) { 46180 invokeCreateHooks(vnode, insertedVnodeQueue); 46181 } 46182 insert(parentElm, vnode.elm, refElm); 46183 if (data && data.pre) { 46184 creatingElmInVPre--; 46185 } 46186 } 46187 else if (isTrue(vnode.isComment)) { 46188 vnode.elm = nodeOps.createComment(vnode.text); 46189 insert(parentElm, vnode.elm, refElm); 46190 } 46191 else { 46192 vnode.elm = nodeOps.createTextNode(vnode.text); 46193 insert(parentElm, vnode.elm, refElm); 46194 } 46195 } 46196 function createComponent(vnode, insertedVnodeQueue, parentElm, refElm) { 46197 let i = vnode.data; 46198 if (isDef(i)) { 46199 const isReactivated = isDef(vnode.componentInstance) && i.keepAlive; 46200 if (isDef((i = i.hook)) && isDef((i = i.init))) { 46201 i(vnode, false /* hydrating */); 46202 } 46203 // after calling the init hook, if the vnode is a child component 46204 // it should've created a child instance and mounted it. the child 46205 // component also has set the placeholder vnode's elm. 46206 // in that case we can just return the element and be done. 46207 if (isDef(vnode.componentInstance)) { 46208 initComponent(vnode, insertedVnodeQueue); 46209 insert(parentElm, vnode.elm, refElm); 46210 if (isTrue(isReactivated)) { 46211 reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm); 46212 } 46213 return true; 46214 } 46215 } 46216 } 46217 function initComponent(vnode, insertedVnodeQueue) { 46218 if (isDef(vnode.data.pendingInsert)) { 46219 insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert); 46220 vnode.data.pendingInsert = null; 46221 } 46222 vnode.elm = vnode.componentInstance.$el; 46223 if (isPatchable(vnode)) { 46224 invokeCreateHooks(vnode, insertedVnodeQueue); 46225 setScope(vnode); 46226 } 46227 else { 46228 // empty component root. 46229 // skip all element-related modules except for ref (#3455) 46230 registerRef(vnode); 46231 // make sure to invoke the insert hook 46232 insertedVnodeQueue.push(vnode); 46233 } 46234 } 46235 function reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm) { 46236 let i; 46237 // hack for #4339: a reactivated component with inner transition 46238 // does not trigger because the inner node's created hooks are not called 46239 // again. It's not ideal to involve module-specific logic in here but 46240 // there doesn't seem to be a better way to do it. 46241 let innerNode = vnode; 46242 while (innerNode.componentInstance) { 46243 innerNode = innerNode.componentInstance._vnode; 46244 if (isDef((i = innerNode.data)) && isDef((i = i.transition))) { 46245 for (i = 0; i < cbs.activate.length; ++i) { 46246 cbs.activate[i](emptyNode, innerNode); 46247 } 46248 insertedVnodeQueue.push(innerNode); 46249 break; 46250 } 46251 } 46252 // unlike a newly created component, 46253 // a reactivated keep-alive component doesn't insert itself 46254 insert(parentElm, vnode.elm, refElm); 46255 } 46256 function insert(parent, elm, ref) { 46257 if (isDef(parent)) { 46258 if (isDef(ref)) { 46259 if (nodeOps.parentNode(ref) === parent) { 46260 nodeOps.insertBefore(parent, elm, ref); 46261 } 46262 } 46263 else { 46264 nodeOps.appendChild(parent, elm); 46265 } 46266 } 46267 } 46268 function createChildren(vnode, children, insertedVnodeQueue) { 46269 if (isArray(children)) { 46270 { 46271 checkDuplicateKeys(children); 46272 } 46273 for (let i = 0; i < children.length; ++i) { 46274 createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i); 46275 } 46276 } 46277 else if (isPrimitive(vnode.text)) { 46278 nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text))); 46279 } 46280 } 46281 function isPatchable(vnode) { 46282 while (vnode.componentInstance) { 46283 vnode = vnode.componentInstance._vnode; 46284 } 46285 return isDef(vnode.tag); 46286 } 46287 function invokeCreateHooks(vnode, insertedVnodeQueue) { 46288 for (let i = 0; i < cbs.create.length; ++i) { 46289 cbs.create[i](emptyNode, vnode); 46290 } 46291 i = vnode.data.hook; // Reuse variable 46292 if (isDef(i)) { 46293 if (isDef(i.create)) 46294 i.create(emptyNode, vnode); 46295 if (isDef(i.insert)) 46296 insertedVnodeQueue.push(vnode); 46297 } 46298 } 46299 // set scope id attribute for scoped CSS. 46300 // this is implemented as a special case to avoid the overhead 46301 // of going through the normal attribute patching process. 46302 function setScope(vnode) { 46303 let i; 46304 if (isDef((i = vnode.fnScopeId))) { 46305 nodeOps.setStyleScope(vnode.elm, i); 46306 } 46307 else { 46308 let ancestor = vnode; 46309 while (ancestor) { 46310 if (isDef((i = ancestor.context)) && isDef((i = i.$options._scopeId))) { 46311 nodeOps.setStyleScope(vnode.elm, i); 46312 } 46313 ancestor = ancestor.parent; 46314 } 46315 } 46316 // for slot content they should also get the scopeId from the host instance. 46317 if (isDef((i = activeInstance)) && 46318 i !== vnode.context && 46319 i !== vnode.fnContext && 46320 isDef((i = i.$options._scopeId))) { 46321 nodeOps.setStyleScope(vnode.elm, i); 46322 } 46323 } 46324 function addVnodes(parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) { 46325 for (; startIdx <= endIdx; ++startIdx) { 46326 createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx); 46327 } 46328 } 46329 function invokeDestroyHook(vnode) { 46330 let i, j; 46331 const data = vnode.data; 46332 if (isDef(data)) { 46333 if (isDef((i = data.hook)) && isDef((i = i.destroy))) 46334 i(vnode); 46335 for (i = 0; i < cbs.destroy.length; ++i) 46336 cbs.destroy[i](vnode); 46337 } 46338 if (isDef((i = vnode.children))) { 46339 for (j = 0; j < vnode.children.length; ++j) { 46340 invokeDestroyHook(vnode.children[j]); 46341 } 46342 } 46343 } 46344 function removeVnodes(vnodes, startIdx, endIdx) { 46345 for (; startIdx <= endIdx; ++startIdx) { 46346 const ch = vnodes[startIdx]; 46347 if (isDef(ch)) { 46348 if (isDef(ch.tag)) { 46349 removeAndInvokeRemoveHook(ch); 46350 invokeDestroyHook(ch); 46351 } 46352 else { 46353 // Text node 46354 removeNode(ch.elm); 46355 } 46356 } 46357 } 46358 } 46359 function removeAndInvokeRemoveHook(vnode, rm) { 46360 if (isDef(rm) || isDef(vnode.data)) { 46361 let i; 46362 const listeners = cbs.remove.length + 1; 46363 if (isDef(rm)) { 46364 // we have a recursively passed down rm callback 46365 // increase the listeners count 46366 rm.listeners += listeners; 46367 } 46368 else { 46369 // directly removing 46370 rm = createRmCb(vnode.elm, listeners); 46371 } 46372 // recursively invoke hooks on child component root node 46373 if (isDef((i = vnode.componentInstance)) && 46374 isDef((i = i._vnode)) && 46375 isDef(i.data)) { 46376 removeAndInvokeRemoveHook(i, rm); 46377 } 46378 for (i = 0; i < cbs.remove.length; ++i) { 46379 cbs.remove[i](vnode, rm); 46380 } 46381 if (isDef((i = vnode.data.hook)) && isDef((i = i.remove))) { 46382 i(vnode, rm); 46383 } 46384 else { 46385 rm(); 46386 } 46387 } 46388 else { 46389 removeNode(vnode.elm); 46390 } 46391 } 46392 function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) { 46393 let oldStartIdx = 0; 46394 let newStartIdx = 0; 46395 let oldEndIdx = oldCh.length - 1; 46396 let oldStartVnode = oldCh[0]; 46397 let oldEndVnode = oldCh[oldEndIdx]; 46398 let newEndIdx = newCh.length - 1; 46399 let newStartVnode = newCh[0]; 46400 let newEndVnode = newCh[newEndIdx]; 46401 let oldKeyToIdx, idxInOld, vnodeToMove, refElm; 46402 // removeOnly is a special flag used only by <transition-group> 46403 // to ensure removed elements stay in correct relative positions 46404 // during leaving transitions 46405 const canMove = !removeOnly; 46406 { 46407 checkDuplicateKeys(newCh); 46408 } 46409 while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) { 46410 if (isUndef(oldStartVnode)) { 46411 oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left 46412 } 46413 else if (isUndef(oldEndVnode)) { 46414 oldEndVnode = oldCh[--oldEndIdx]; 46415 } 46416 else if (sameVnode(oldStartVnode, newStartVnode)) { 46417 patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx); 46418 oldStartVnode = oldCh[++oldStartIdx]; 46419 newStartVnode = newCh[++newStartIdx]; 46420 } 46421 else if (sameVnode(oldEndVnode, newEndVnode)) { 46422 patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx); 46423 oldEndVnode = oldCh[--oldEndIdx]; 46424 newEndVnode = newCh[--newEndIdx]; 46425 } 46426 else if (sameVnode(oldStartVnode, newEndVnode)) { 46427 // Vnode moved right 46428 patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx); 46429 canMove && 46430 nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm)); 46431 oldStartVnode = oldCh[++oldStartIdx]; 46432 newEndVnode = newCh[--newEndIdx]; 46433 } 46434 else if (sameVnode(oldEndVnode, newStartVnode)) { 46435 // Vnode moved left 46436 patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx); 46437 canMove && 46438 nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm); 46439 oldEndVnode = oldCh[--oldEndIdx]; 46440 newStartVnode = newCh[++newStartIdx]; 46441 } 46442 else { 46443 if (isUndef(oldKeyToIdx)) 46444 oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); 46445 idxInOld = isDef(newStartVnode.key) 46446 ? oldKeyToIdx[newStartVnode.key] 46447 : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx); 46448 if (isUndef(idxInOld)) { 46449 // New element 46450 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx); 46451 } 46452 else { 46453 vnodeToMove = oldCh[idxInOld]; 46454 if (sameVnode(vnodeToMove, newStartVnode)) { 46455 patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx); 46456 oldCh[idxInOld] = undefined; 46457 canMove && 46458 nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm); 46459 } 46460 else { 46461 // same key but different element. treat as new element 46462 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx); 46463 } 46464 } 46465 newStartVnode = newCh[++newStartIdx]; 46466 } 46467 } 46468 if (oldStartIdx > oldEndIdx) { 46469 refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm; 46470 addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue); 46471 } 46472 else if (newStartIdx > newEndIdx) { 46473 removeVnodes(oldCh, oldStartIdx, oldEndIdx); 46474 } 46475 } 46476 function checkDuplicateKeys(children) { 46477 const seenKeys = {}; 46478 for (let i = 0; i < children.length; i++) { 46479 const vnode = children[i]; 46480 const key = vnode.key; 46481 if (isDef(key)) { 46482 if (seenKeys[key]) { 46483 warn(`Duplicate keys detected: '${key}'. This may cause an update error.`, vnode.context); 46484 } 46485 else { 46486 seenKeys[key] = true; 46487 } 46488 } 46489 } 46490 } 46491 function findIdxInOld(node, oldCh, start, end) { 46492 for (let i = start; i < end; i++) { 46493 const c = oldCh[i]; 46494 if (isDef(c) && sameVnode(node, c)) 46495 return i; 46496 } 46497 } 46498 function patchVnode(oldVnode, vnode, insertedVnodeQueue, ownerArray, index, removeOnly) { 46499 if (oldVnode === vnode) { 46500 return; 46501 } 46502 if (isDef(vnode.elm) && isDef(ownerArray)) { 46503 // clone reused vnode 46504 vnode = ownerArray[index] = cloneVNode(vnode); 46505 } 46506 const elm = (vnode.elm = oldVnode.elm); 46507 if (isTrue(oldVnode.isAsyncPlaceholder)) { 46508 if (isDef(vnode.asyncFactory.resolved)) { 46509 hydrate(oldVnode.elm, vnode, insertedVnodeQueue); 46510 } 46511 else { 46512 vnode.isAsyncPlaceholder = true; 46513 } 46514 return; 46515 } 46516 // reuse element for static trees. 46517 // note we only do this if the vnode is cloned - 46518 // if the new node is not cloned it means the render functions have been 46519 // reset by the hot-reload-api and we need to do a proper re-render. 46520 if (isTrue(vnode.isStatic) && 46521 isTrue(oldVnode.isStatic) && 46522 vnode.key === oldVnode.key && 46523 (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))) { 46524 vnode.componentInstance = oldVnode.componentInstance; 46525 return; 46526 } 46527 let i; 46528 const data = vnode.data; 46529 if (isDef(data) && isDef((i = data.hook)) && isDef((i = i.prepatch))) { 46530 i(oldVnode, vnode); 46531 } 46532 const oldCh = oldVnode.children; 46533 const ch = vnode.children; 46534 if (isDef(data) && isPatchable(vnode)) { 46535 for (i = 0; i < cbs.update.length; ++i) 46536 cbs.update[i](oldVnode, vnode); 46537 if (isDef((i = data.hook)) && isDef((i = i.update))) 46538 i(oldVnode, vnode); 46539 } 46540 if (isUndef(vnode.text)) { 46541 if (isDef(oldCh) && isDef(ch)) { 46542 if (oldCh !== ch) 46543 updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); 46544 } 46545 else if (isDef(ch)) { 46546 { 46547 checkDuplicateKeys(ch); 46548 } 46549 if (isDef(oldVnode.text)) 46550 nodeOps.setTextContent(elm, ''); 46551 addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue); 46552 } 46553 else if (isDef(oldCh)) { 46554 removeVnodes(oldCh, 0, oldCh.length - 1); 46555 } 46556 else if (isDef(oldVnode.text)) { 46557 nodeOps.setTextContent(elm, ''); 46558 } 46559 } 46560 else if (oldVnode.text !== vnode.text) { 46561 nodeOps.setTextContent(elm, vnode.text); 46562 } 46563 if (isDef(data)) { 46564 if (isDef((i = data.hook)) && isDef((i = i.postpatch))) 46565 i(oldVnode, vnode); 46566 } 46567 } 46568 function invokeInsertHook(vnode, queue, initial) { 46569 // delay insert hooks for component root nodes, invoke them after the 46570 // element is really inserted 46571 if (isTrue(initial) && isDef(vnode.parent)) { 46572 vnode.parent.data.pendingInsert = queue; 46573 } 46574 else { 46575 for (let i = 0; i < queue.length; ++i) { 46576 queue[i].data.hook.insert(queue[i]); 46577 } 46578 } 46579 } 46580 let hydrationBailed = false; 46581 // list of modules that can skip create hook during hydration because they 46582 // are already rendered on the client or has no need for initialization 46583 // Note: style is excluded because it relies on initial clone for future 46584 // deep updates (#7063). 46585 const isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key'); 46586 // Note: this is a browser-only function so we can assume elms are DOM nodes. 46587 function hydrate(elm, vnode, insertedVnodeQueue, inVPre) { 46588 let i; 46589 const { tag, data, children } = vnode; 46590 inVPre = inVPre || (data && data.pre); 46591 vnode.elm = elm; 46592 if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) { 46593 vnode.isAsyncPlaceholder = true; 46594 return true; 46595 } 46596 // assert node match 46597 { 46598 if (!assertNodeMatch(elm, vnode, inVPre)) { 46599 return false; 46600 } 46601 } 46602 if (isDef(data)) { 46603 if (isDef((i = data.hook)) && isDef((i = i.init))) 46604 i(vnode, true /* hydrating */); 46605 if (isDef((i = vnode.componentInstance))) { 46606 // child component. it should have hydrated its own tree. 46607 initComponent(vnode, insertedVnodeQueue); 46608 return true; 46609 } 46610 } 46611 if (isDef(tag)) { 46612 if (isDef(children)) { 46613 // empty element, allow client to pick up and populate children 46614 if (!elm.hasChildNodes()) { 46615 createChildren(vnode, children, insertedVnodeQueue); 46616 } 46617 else { 46618 // v-html and domProps: innerHTML 46619 if (isDef((i = data)) && 46620 isDef((i = i.domProps)) && 46621 isDef((i = i.innerHTML))) { 46622 if (i !== elm.innerHTML) { 46623 /* istanbul ignore if */ 46624 if (typeof console !== 'undefined' && 46625 !hydrationBailed) { 46626 hydrationBailed = true; 46627 console.warn('Parent: ', elm); 46628 console.warn('server innerHTML: ', i); 46629 console.warn('client innerHTML: ', elm.innerHTML); 46630 } 46631 return false; 46632 } 46633 } 46634 else { 46635 // iterate and compare children lists 46636 let childrenMatch = true; 46637 let childNode = elm.firstChild; 46638 for (let i = 0; i < children.length; i++) { 46639 if (!childNode || 46640 !hydrate(childNode, children[i], insertedVnodeQueue, inVPre)) { 46641 childrenMatch = false; 46642 break; 46643 } 46644 childNode = childNode.nextSibling; 46645 } 46646 // if childNode is not null, it means the actual childNodes list is 46647 // longer than the virtual children list. 46648 if (!childrenMatch || childNode) { 46649 /* istanbul ignore if */ 46650 if (typeof console !== 'undefined' && 46651 !hydrationBailed) { 46652 hydrationBailed = true; 46653 console.warn('Parent: ', elm); 46654 console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children); 46655 } 46656 return false; 46657 } 46658 } 46659 } 46660 } 46661 if (isDef(data)) { 46662 let fullInvoke = false; 46663 for (const key in data) { 46664 if (!isRenderedModule(key)) { 46665 fullInvoke = true; 46666 invokeCreateHooks(vnode, insertedVnodeQueue); 46667 break; 46668 } 46669 } 46670 if (!fullInvoke && data['class']) { 46671 // ensure collecting deps for deep class bindings for future updates 46672 traverse(data['class']); 46673 } 46674 } 46675 } 46676 else if (elm.data !== vnode.text) { 46677 elm.data = vnode.text; 46678 } 46679 return true; 46680 } 46681 function assertNodeMatch(node, vnode, inVPre) { 46682 if (isDef(vnode.tag)) { 46683 return (vnode.tag.indexOf('vue-component') === 0 || 46684 (!isUnknownElement(vnode, inVPre) && 46685 vnode.tag.toLowerCase() === 46686 (node.tagName && node.tagName.toLowerCase()))); 46687 } 46688 else { 46689 return node.nodeType === (vnode.isComment ? 8 : 3); 46690 } 46691 } 46692 return function patch(oldVnode, vnode, hydrating, removeOnly) { 46693 if (isUndef(vnode)) { 46694 if (isDef(oldVnode)) 46695 invokeDestroyHook(oldVnode); 46696 return; 46697 } 46698 let isInitialPatch = false; 46699 const insertedVnodeQueue = []; 46700 if (isUndef(oldVnode)) { 46701 // empty mount (likely as component), create new root element 46702 isInitialPatch = true; 46703 createElm(vnode, insertedVnodeQueue); 46704 } 46705 else { 46706 const isRealElement = isDef(oldVnode.nodeType); 46707 if (!isRealElement && sameVnode(oldVnode, vnode)) { 46708 // patch existing root node 46709 patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly); 46710 } 46711 else { 46712 if (isRealElement) { 46713 // mounting to a real element 46714 // check if this is server-rendered content and if we can perform 46715 // a successful hydration. 46716 if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) { 46717 oldVnode.removeAttribute(SSR_ATTR); 46718 hydrating = true; 46719 } 46720 if (isTrue(hydrating)) { 46721 if (hydrate(oldVnode, vnode, insertedVnodeQueue)) { 46722 invokeInsertHook(vnode, insertedVnodeQueue, true); 46723 return oldVnode; 46724 } 46725 else { 46726 warn('The client-side rendered virtual DOM tree is not matching ' + 46727 'server-rendered content. This is likely caused by incorrect ' + 46728 'HTML markup, for example nesting block-level elements inside ' + 46729 '<p>, or missing <tbody>. Bailing hydration and performing ' + 46730 'full client-side render.'); 46731 } 46732 } 46733 // either not server-rendered, or hydration failed. 46734 // create an empty node and replace it 46735 oldVnode = emptyNodeAt(oldVnode); 46736 } 46737 // replacing existing element 46738 const oldElm = oldVnode.elm; 46739 const parentElm = nodeOps.parentNode(oldElm); 46740 // create new node 46741 createElm(vnode, insertedVnodeQueue, 46742 // extremely rare edge case: do not insert if old element is in a 46743 // leaving transition. Only happens when combining transition + 46744 // keep-alive + HOCs. (#4590) 46745 oldElm._leaveCb ? null : parentElm, nodeOps.nextSibling(oldElm)); 46746 // update parent placeholder node element, recursively 46747 if (isDef(vnode.parent)) { 46748 let ancestor = vnode.parent; 46749 const patchable = isPatchable(vnode); 46750 while (ancestor) { 46751 for (let i = 0; i < cbs.destroy.length; ++i) { 46752 cbs.destroy[i](ancestor); 46753 } 46754 ancestor.elm = vnode.elm; 46755 if (patchable) { 46756 for (let i = 0; i < cbs.create.length; ++i) { 46757 cbs.create[i](emptyNode, ancestor); 46758 } 46759 // #6513 46760 // invoke insert hooks that may have been merged by create hooks. 46761 // e.g. for directives that uses the "inserted" hook. 46762 const insert = ancestor.data.hook.insert; 46763 if (insert.merged) { 46764 // start at index 1 to avoid re-invoking component mounted hook 46765 // clone insert hooks to avoid being mutated during iteration. 46766 // e.g. for customed directives under transition group. 46767 const cloned = insert.fns.slice(1); 46768 for (let i = 0; i < cloned.length; i++) { 46769 cloned[i](); 46770 } 46771 } 46772 } 46773 else { 46774 registerRef(ancestor); 46775 } 46776 ancestor = ancestor.parent; 46777 } 46778 } 46779 // destroy old node 46780 if (isDef(parentElm)) { 46781 removeVnodes([oldVnode], 0, 0); 46782 } 46783 else if (isDef(oldVnode.tag)) { 46784 invokeDestroyHook(oldVnode); 46785 } 46786 } 46787 } 46788 invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch); 46789 return vnode.elm; 46790 }; 46791} 46792 46793var directives = { 46794 create: updateDirectives, 46795 update: updateDirectives, 46796 destroy: function unbindDirectives(vnode) { 46797 // @ts-expect-error emptyNode is not VNodeWithData 46798 updateDirectives(vnode, emptyNode); 46799 } 46800}; 46801function updateDirectives(oldVnode, vnode) { 46802 if (oldVnode.data.directives || vnode.data.directives) { 46803 _update(oldVnode, vnode); 46804 } 46805} 46806function _update(oldVnode, vnode) { 46807 const isCreate = oldVnode === emptyNode; 46808 const isDestroy = vnode === emptyNode; 46809 const oldDirs = normalizeDirectives(oldVnode.data.directives, oldVnode.context); 46810 const newDirs = normalizeDirectives(vnode.data.directives, vnode.context); 46811 const dirsWithInsert = []; 46812 const dirsWithPostpatch = []; 46813 let key, oldDir, dir; 46814 for (key in newDirs) { 46815 oldDir = oldDirs[key]; 46816 dir = newDirs[key]; 46817 if (!oldDir) { 46818 // new directive, bind 46819 callHook(dir, 'bind', vnode, oldVnode); 46820 if (dir.def && dir.def.inserted) { 46821 dirsWithInsert.push(dir); 46822 } 46823 } 46824 else { 46825 // existing directive, update 46826 dir.oldValue = oldDir.value; 46827 dir.oldArg = oldDir.arg; 46828 callHook(dir, 'update', vnode, oldVnode); 46829 if (dir.def && dir.def.componentUpdated) { 46830 dirsWithPostpatch.push(dir); 46831 } 46832 } 46833 } 46834 if (dirsWithInsert.length) { 46835 const callInsert = () => { 46836 for (let i = 0; i < dirsWithInsert.length; i++) { 46837 callHook(dirsWithInsert[i], 'inserted', vnode, oldVnode); 46838 } 46839 }; 46840 if (isCreate) { 46841 mergeVNodeHook(vnode, 'insert', callInsert); 46842 } 46843 else { 46844 callInsert(); 46845 } 46846 } 46847 if (dirsWithPostpatch.length) { 46848 mergeVNodeHook(vnode, 'postpatch', () => { 46849 for (let i = 0; i < dirsWithPostpatch.length; i++) { 46850 callHook(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode); 46851 } 46852 }); 46853 } 46854 if (!isCreate) { 46855 for (key in oldDirs) { 46856 if (!newDirs[key]) { 46857 // no longer present, unbind 46858 callHook(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy); 46859 } 46860 } 46861 } 46862} 46863const emptyModifiers = Object.create(null); 46864function normalizeDirectives(dirs, vm) { 46865 const res = Object.create(null); 46866 if (!dirs) { 46867 // $flow-disable-line 46868 return res; 46869 } 46870 let i, dir; 46871 for (i = 0; i < dirs.length; i++) { 46872 dir = dirs[i]; 46873 if (!dir.modifiers) { 46874 // $flow-disable-line 46875 dir.modifiers = emptyModifiers; 46876 } 46877 res[getRawDirName(dir)] = dir; 46878 if (vm._setupState && vm._setupState.__sfc) { 46879 const setupDef = dir.def || resolveAsset(vm, '_setupState', 'v-' + dir.name); 46880 if (typeof setupDef === 'function') { 46881 dir.def = { 46882 bind: setupDef, 46883 update: setupDef, 46884 }; 46885 } 46886 else { 46887 dir.def = setupDef; 46888 } 46889 } 46890 dir.def = dir.def || resolveAsset(vm.$options, 'directives', dir.name, true); 46891 } 46892 // $flow-disable-line 46893 return res; 46894} 46895function getRawDirName(dir) { 46896 return (dir.rawName || `${dir.name}.${Object.keys(dir.modifiers || {}).join('.')}`); 46897} 46898function callHook(dir, hook, vnode, oldVnode, isDestroy) { 46899 const fn = dir.def && dir.def[hook]; 46900 if (fn) { 46901 try { 46902 fn(vnode.elm, dir, vnode, oldVnode, isDestroy); 46903 } 46904 catch (e) { 46905 handleError(e, vnode.context, `directive ${dir.name} ${hook} hook`); 46906 } 46907 } 46908} 46909 46910var baseModules = [ref, directives]; 46911 46912function updateAttrs(oldVnode, vnode) { 46913 const opts = vnode.componentOptions; 46914 if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) { 46915 return; 46916 } 46917 if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) { 46918 return; 46919 } 46920 let key, cur, old; 46921 const elm = vnode.elm; 46922 const oldAttrs = oldVnode.data.attrs || {}; 46923 let attrs = vnode.data.attrs || {}; 46924 // clone observed objects, as the user probably wants to mutate it 46925 if (isDef(attrs.__ob__) || isTrue(attrs._v_attr_proxy)) { 46926 attrs = vnode.data.attrs = extend({}, attrs); 46927 } 46928 for (key in attrs) { 46929 cur = attrs[key]; 46930 old = oldAttrs[key]; 46931 if (old !== cur) { 46932 setAttr(elm, key, cur, vnode.data.pre); 46933 } 46934 } 46935 // #4391: in IE9, setting type can reset value for input[type=radio] 46936 // #6666: IE/Edge forces progress value down to 1 before setting a max 46937 /* istanbul ignore if */ 46938 if ((isIE || isEdge) && attrs.value !== oldAttrs.value) { 46939 setAttr(elm, 'value', attrs.value); 46940 } 46941 for (key in oldAttrs) { 46942 if (isUndef(attrs[key])) { 46943 if (isXlink(key)) { 46944 elm.removeAttributeNS(xlinkNS, getXlinkProp(key)); 46945 } 46946 else if (!isEnumeratedAttr(key)) { 46947 elm.removeAttribute(key); 46948 } 46949 } 46950 } 46951} 46952function setAttr(el, key, value, isInPre) { 46953 if (isInPre || el.tagName.indexOf('-') > -1) { 46954 baseSetAttr(el, key, value); 46955 } 46956 else if (isBooleanAttr(key)) { 46957 // set attribute for blank value 46958 // e.g. <option disabled>Select one</option> 46959 if (isFalsyAttrValue(value)) { 46960 el.removeAttribute(key); 46961 } 46962 else { 46963 // technically allowfullscreen is a boolean attribute for <iframe>, 46964 // but Flash expects a value of "true" when used on <embed> tag 46965 value = key === 'allowfullscreen' && el.tagName === 'EMBED' ? 'true' : key; 46966 el.setAttribute(key, value); 46967 } 46968 } 46969 else if (isEnumeratedAttr(key)) { 46970 el.setAttribute(key, convertEnumeratedValue(key, value)); 46971 } 46972 else if (isXlink(key)) { 46973 if (isFalsyAttrValue(value)) { 46974 el.removeAttributeNS(xlinkNS, getXlinkProp(key)); 46975 } 46976 else { 46977 el.setAttributeNS(xlinkNS, key, value); 46978 } 46979 } 46980 else { 46981 baseSetAttr(el, key, value); 46982 } 46983} 46984function baseSetAttr(el, key, value) { 46985 if (isFalsyAttrValue(value)) { 46986 el.removeAttribute(key); 46987 } 46988 else { 46989 // #7138: IE10 & 11 fires input event when setting placeholder on 46990 // <textarea>... block the first input event and remove the blocker 46991 // immediately. 46992 /* istanbul ignore if */ 46993 if (isIE && 46994 !isIE9 && 46995 el.tagName === 'TEXTAREA' && 46996 key === 'placeholder' && 46997 value !== '' && 46998 !el.__ieph) { 46999 const blocker = e => { 47000 e.stopImmediatePropagation(); 47001 el.removeEventListener('input', blocker); 47002 }; 47003 el.addEventListener('input', blocker); 47004 // $flow-disable-line 47005 el.__ieph = true; /* IE placeholder patched */ 47006 } 47007 el.setAttribute(key, value); 47008 } 47009} 47010var attrs = { 47011 create: updateAttrs, 47012 update: updateAttrs 47013}; 47014 47015function updateClass(oldVnode, vnode) { 47016 const el = vnode.elm; 47017 const data = vnode.data; 47018 const oldData = oldVnode.data; 47019 if (isUndef(data.staticClass) && 47020 isUndef(data.class) && 47021 (isUndef(oldData) || 47022 (isUndef(oldData.staticClass) && isUndef(oldData.class)))) { 47023 return; 47024 } 47025 let cls = genClassForVnode(vnode); 47026 // handle transition classes 47027 const transitionClass = el._transitionClasses; 47028 if (isDef(transitionClass)) { 47029 cls = concat(cls, stringifyClass(transitionClass)); 47030 } 47031 // set the class 47032 if (cls !== el._prevClass) { 47033 el.setAttribute('class', cls); 47034 el._prevClass = cls; 47035 } 47036} 47037var klass = { 47038 create: updateClass, 47039 update: updateClass 47040}; 47041 47042// in some cases, the event used has to be determined at runtime 47043// so we used some reserved tokens during compile. 47044const RANGE_TOKEN = '__r'; 47045const CHECKBOX_RADIO_TOKEN = '__c'; 47046 47047// normalize v-model event tokens that can only be determined at runtime. 47048// it's important to place the event as the first in the array because 47049// the whole point is ensuring the v-model callback gets called before 47050// user-attached handlers. 47051function normalizeEvents(on) { 47052 /* istanbul ignore if */ 47053 if (isDef(on[RANGE_TOKEN])) { 47054 // IE input[type=range] only supports `change` event 47055 const event = isIE ? 'change' : 'input'; 47056 on[event] = [].concat(on[RANGE_TOKEN], on[event] || []); 47057 delete on[RANGE_TOKEN]; 47058 } 47059 // This was originally intended to fix #4521 but no longer necessary 47060 // after 2.5. Keeping it for backwards compat with generated code from < 2.4 47061 /* istanbul ignore if */ 47062 if (isDef(on[CHECKBOX_RADIO_TOKEN])) { 47063 on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []); 47064 delete on[CHECKBOX_RADIO_TOKEN]; 47065 } 47066} 47067let target; 47068function createOnceHandler(event, handler, capture) { 47069 const _target = target; // save current target element in closure 47070 return function onceHandler() { 47071 const res = handler.apply(null, arguments); 47072 if (res !== null) { 47073 remove(event, onceHandler, capture, _target); 47074 } 47075 }; 47076} 47077// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp 47078// implementation and does not fire microtasks in between event propagation, so 47079// safe to exclude. 47080const useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53); 47081function add(name, handler, capture, passive) { 47082 // async edge case #6566: inner click event triggers patch, event handler 47083 // attached to outer element during patch, and triggered again. This 47084 // happens because browsers fire microtask ticks between event propagation. 47085 // the solution is simple: we save the timestamp when a handler is attached, 47086 // and the handler would only fire if the event passed to it was fired 47087 // AFTER it was attached. 47088 if (useMicrotaskFix) { 47089 const attachedTimestamp = currentFlushTimestamp; 47090 const original = handler; 47091 //@ts-expect-error 47092 handler = original._wrapper = function (e) { 47093 if ( 47094 // no bubbling, should always fire. 47095 // this is just a safety net in case event.timeStamp is unreliable in 47096 // certain weird environments... 47097 e.target === e.currentTarget || 47098 // event is fired after handler attachment 47099 e.timeStamp >= attachedTimestamp || 47100 // bail for environments that have buggy event.timeStamp implementations 47101 // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState 47102 // #9681 QtWebEngine event.timeStamp is negative value 47103 e.timeStamp <= 0 || 47104 // #9448 bail if event is fired in another document in a multi-page 47105 // electron/nw.js app, since event.timeStamp will be using a different 47106 // starting reference 47107 e.target.ownerDocument !== document) { 47108 return original.apply(this, arguments); 47109 } 47110 }; 47111 } 47112 target.addEventListener(name, handler, supportsPassive ? { capture, passive } : capture); 47113} 47114function remove(name, handler, capture, _target) { 47115 (_target || target).removeEventListener(name, 47116 //@ts-expect-error 47117 handler._wrapper || handler, capture); 47118} 47119function updateDOMListeners(oldVnode, vnode) { 47120 if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) { 47121 return; 47122 } 47123 const on = vnode.data.on || {}; 47124 const oldOn = oldVnode.data.on || {}; 47125 // vnode is empty when removing all listeners, 47126 // and use old vnode dom element 47127 target = vnode.elm || oldVnode.elm; 47128 normalizeEvents(on); 47129 updateListeners(on, oldOn, add, remove, createOnceHandler, vnode.context); 47130 target = undefined; 47131} 47132var events = { 47133 create: updateDOMListeners, 47134 update: updateDOMListeners, 47135 // @ts-expect-error emptyNode has actually data 47136 destroy: (vnode) => updateDOMListeners(vnode, emptyNode) 47137}; 47138 47139let svgContainer; 47140function updateDOMProps(oldVnode, vnode) { 47141 if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) { 47142 return; 47143 } 47144 let key, cur; 47145 const elm = vnode.elm; 47146 const oldProps = oldVnode.data.domProps || {}; 47147 let props = vnode.data.domProps || {}; 47148 // clone observed objects, as the user probably wants to mutate it 47149 if (isDef(props.__ob__) || isTrue(props._v_attr_proxy)) { 47150 props = vnode.data.domProps = extend({}, props); 47151 } 47152 for (key in oldProps) { 47153 if (!(key in props)) { 47154 elm[key] = ''; 47155 } 47156 } 47157 for (key in props) { 47158 cur = props[key]; 47159 // ignore children if the node has textContent or innerHTML, 47160 // as these will throw away existing DOM nodes and cause removal errors 47161 // on subsequent patches (#3360) 47162 if (key === 'textContent' || key === 'innerHTML') { 47163 if (vnode.children) 47164 vnode.children.length = 0; 47165 if (cur === oldProps[key]) 47166 continue; 47167 // #6601 work around Chrome version <= 55 bug where single textNode 47168 // replaced by innerHTML/textContent retains its parentNode property 47169 if (elm.childNodes.length === 1) { 47170 elm.removeChild(elm.childNodes[0]); 47171 } 47172 } 47173 if (key === 'value' && elm.tagName !== 'PROGRESS') { 47174 // store value as _value as well since 47175 // non-string values will be stringified 47176 elm._value = cur; 47177 // avoid resetting cursor position when value is the same 47178 const strCur = isUndef(cur) ? '' : String(cur); 47179 if (shouldUpdateValue(elm, strCur)) { 47180 elm.value = strCur; 47181 } 47182 } 47183 else if (key === 'innerHTML' && 47184 isSVG(elm.tagName) && 47185 isUndef(elm.innerHTML)) { 47186 // IE doesn't support innerHTML for SVG elements 47187 svgContainer = svgContainer || document.createElement('div'); 47188 svgContainer.innerHTML = `<svg>${cur}</svg>`; 47189 const svg = svgContainer.firstChild; 47190 while (elm.firstChild) { 47191 elm.removeChild(elm.firstChild); 47192 } 47193 while (svg.firstChild) { 47194 elm.appendChild(svg.firstChild); 47195 } 47196 } 47197 else if ( 47198 // skip the update if old and new VDOM state is the same. 47199 // `value` is handled separately because the DOM value may be temporarily 47200 // out of sync with VDOM state due to focus, composition and modifiers. 47201 // This #4521 by skipping the unnecessary `checked` update. 47202 cur !== oldProps[key]) { 47203 // some property updates can throw 47204 // e.g. `value` on <progress> w/ non-finite value 47205 try { 47206 elm[key] = cur; 47207 } 47208 catch (e) { } 47209 } 47210 } 47211} 47212function shouldUpdateValue(elm, checkVal) { 47213 return ( 47214 //@ts-expect-error 47215 !elm.composing && 47216 (elm.tagName === 'OPTION' || 47217 isNotInFocusAndDirty(elm, checkVal) || 47218 isDirtyWithModifiers(elm, checkVal))); 47219} 47220function isNotInFocusAndDirty(elm, checkVal) { 47221 // return true when textbox (.number and .trim) loses focus and its value is 47222 // not equal to the updated value 47223 let notInFocus = true; 47224 // #6157 47225 // work around IE bug when accessing document.activeElement in an iframe 47226 try { 47227 notInFocus = document.activeElement !== elm; 47228 } 47229 catch (e) { } 47230 return notInFocus && elm.value !== checkVal; 47231} 47232function isDirtyWithModifiers(elm, newVal) { 47233 const value = elm.value; 47234 const modifiers = elm._vModifiers; // injected by v-model runtime 47235 if (isDef(modifiers)) { 47236 if (modifiers.number) { 47237 return toNumber(value) !== toNumber(newVal); 47238 } 47239 if (modifiers.trim) { 47240 return value.trim() !== newVal.trim(); 47241 } 47242 } 47243 return value !== newVal; 47244} 47245var domProps = { 47246 create: updateDOMProps, 47247 update: updateDOMProps 47248}; 47249 47250const parseStyleText = cached(function (cssText) { 47251 const res = {}; 47252 const listDelimiter = /;(?![^(]*\))/g; 47253 const propertyDelimiter = /:(.+)/; 47254 cssText.split(listDelimiter).forEach(function (item) { 47255 if (item) { 47256 const tmp = item.split(propertyDelimiter); 47257 tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim()); 47258 } 47259 }); 47260 return res; 47261}); 47262// merge static and dynamic style data on the same vnode 47263function normalizeStyleData(data) { 47264 const style = normalizeStyleBinding(data.style); 47265 // static style is pre-processed into an object during compilation 47266 // and is always a fresh object, so it's safe to merge into it 47267 return data.staticStyle ? extend(data.staticStyle, style) : style; 47268} 47269// normalize possible array / string values into Object 47270function normalizeStyleBinding(bindingStyle) { 47271 if (Array.isArray(bindingStyle)) { 47272 return toObject(bindingStyle); 47273 } 47274 if (typeof bindingStyle === 'string') { 47275 return parseStyleText(bindingStyle); 47276 } 47277 return bindingStyle; 47278} 47279/** 47280 * parent component style should be after child's 47281 * so that parent component's style could override it 47282 */ 47283function getStyle(vnode, checkChild) { 47284 const res = {}; 47285 let styleData; 47286 if (checkChild) { 47287 let childNode = vnode; 47288 while (childNode.componentInstance) { 47289 childNode = childNode.componentInstance._vnode; 47290 if (childNode && 47291 childNode.data && 47292 (styleData = normalizeStyleData(childNode.data))) { 47293 extend(res, styleData); 47294 } 47295 } 47296 } 47297 if ((styleData = normalizeStyleData(vnode.data))) { 47298 extend(res, styleData); 47299 } 47300 let parentNode = vnode; 47301 // @ts-expect-error parentNode.parent not VNodeWithData 47302 while ((parentNode = parentNode.parent)) { 47303 if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) { 47304 extend(res, styleData); 47305 } 47306 } 47307 return res; 47308} 47309 47310const cssVarRE = /^--/; 47311const importantRE = /\s*!important$/; 47312const setProp = (el, name, val) => { 47313 /* istanbul ignore if */ 47314 if (cssVarRE.test(name)) { 47315 el.style.setProperty(name, val); 47316 } 47317 else if (importantRE.test(val)) { 47318 el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important'); 47319 } 47320 else { 47321 const normalizedName = normalize(name); 47322 if (Array.isArray(val)) { 47323 // Support values array created by autoprefixer, e.g. 47324 // {display: ["-webkit-box", "-ms-flexbox", "flex"]} 47325 // Set them one by one, and the browser will only set those it can recognize 47326 for (let i = 0, len = val.length; i < len; i++) { 47327 el.style[normalizedName] = val[i]; 47328 } 47329 } 47330 else { 47331 el.style[normalizedName] = val; 47332 } 47333 } 47334}; 47335const vendorNames = ['Webkit', 'Moz', 'ms']; 47336let emptyStyle; 47337const normalize = cached(function (prop) { 47338 emptyStyle = emptyStyle || document.createElement('div').style; 47339 prop = camelize(prop); 47340 if (prop !== 'filter' && prop in emptyStyle) { 47341 return prop; 47342 } 47343 const capName = prop.charAt(0).toUpperCase() + prop.slice(1); 47344 for (let i = 0; i < vendorNames.length; i++) { 47345 const name = vendorNames[i] + capName; 47346 if (name in emptyStyle) { 47347 return name; 47348 } 47349 } 47350}); 47351function updateStyle(oldVnode, vnode) { 47352 const data = vnode.data; 47353 const oldData = oldVnode.data; 47354 if (isUndef(data.staticStyle) && 47355 isUndef(data.style) && 47356 isUndef(oldData.staticStyle) && 47357 isUndef(oldData.style)) { 47358 return; 47359 } 47360 let cur, name; 47361 const el = vnode.elm; 47362 const oldStaticStyle = oldData.staticStyle; 47363 const oldStyleBinding = oldData.normalizedStyle || oldData.style || {}; 47364 // if static style exists, stylebinding already merged into it when doing normalizeStyleData 47365 const oldStyle = oldStaticStyle || oldStyleBinding; 47366 const style = normalizeStyleBinding(vnode.data.style) || {}; 47367 // store normalized style under a different key for next diff 47368 // make sure to clone it if it's reactive, since the user likely wants 47369 // to mutate it. 47370 vnode.data.normalizedStyle = isDef(style.__ob__) ? extend({}, style) : style; 47371 const newStyle = getStyle(vnode, true); 47372 for (name in oldStyle) { 47373 if (isUndef(newStyle[name])) { 47374 setProp(el, name, ''); 47375 } 47376 } 47377 for (name in newStyle) { 47378 cur = newStyle[name]; 47379 // ie9 setting to null has no effect, must use empty string 47380 setProp(el, name, cur == null ? '' : cur); 47381 } 47382} 47383var style = { 47384 create: updateStyle, 47385 update: updateStyle 47386}; 47387 47388const whitespaceRE = /\s+/; 47389/** 47390 * Add class with compatibility for SVG since classList is not supported on 47391 * SVG elements in IE 47392 */ 47393function addClass(el, cls) { 47394 /* istanbul ignore if */ 47395 if (!cls || !(cls = cls.trim())) { 47396 return; 47397 } 47398 /* istanbul ignore else */ 47399 if (el.classList) { 47400 if (cls.indexOf(' ') > -1) { 47401 cls.split(whitespaceRE).forEach(c => el.classList.add(c)); 47402 } 47403 else { 47404 el.classList.add(cls); 47405 } 47406 } 47407 else { 47408 const cur = ` ${el.getAttribute('class') || ''} `; 47409 if (cur.indexOf(' ' + cls + ' ') < 0) { 47410 el.setAttribute('class', (cur + cls).trim()); 47411 } 47412 } 47413} 47414/** 47415 * Remove class with compatibility for SVG since classList is not supported on 47416 * SVG elements in IE 47417 */ 47418function removeClass(el, cls) { 47419 /* istanbul ignore if */ 47420 if (!cls || !(cls = cls.trim())) { 47421 return; 47422 } 47423 /* istanbul ignore else */ 47424 if (el.classList) { 47425 if (cls.indexOf(' ') > -1) { 47426 cls.split(whitespaceRE).forEach(c => el.classList.remove(c)); 47427 } 47428 else { 47429 el.classList.remove(cls); 47430 } 47431 if (!el.classList.length) { 47432 el.removeAttribute('class'); 47433 } 47434 } 47435 else { 47436 let cur = ` ${el.getAttribute('class') || ''} `; 47437 const tar = ' ' + cls + ' '; 47438 while (cur.indexOf(tar) >= 0) { 47439 cur = cur.replace(tar, ' '); 47440 } 47441 cur = cur.trim(); 47442 if (cur) { 47443 el.setAttribute('class', cur); 47444 } 47445 else { 47446 el.removeAttribute('class'); 47447 } 47448 } 47449} 47450 47451function resolveTransition(def) { 47452 if (!def) { 47453 return; 47454 } 47455 /* istanbul ignore else */ 47456 if (typeof def === 'object') { 47457 const res = {}; 47458 if (def.css !== false) { 47459 extend(res, autoCssTransition(def.name || 'v')); 47460 } 47461 extend(res, def); 47462 return res; 47463 } 47464 else if (typeof def === 'string') { 47465 return autoCssTransition(def); 47466 } 47467} 47468const autoCssTransition = cached(name => { 47469 return { 47470 enterClass: `${name}-enter`, 47471 enterToClass: `${name}-enter-to`, 47472 enterActiveClass: `${name}-enter-active`, 47473 leaveClass: `${name}-leave`, 47474 leaveToClass: `${name}-leave-to`, 47475 leaveActiveClass: `${name}-leave-active` 47476 }; 47477}); 47478const hasTransition = inBrowser && !isIE9; 47479const TRANSITION = 'transition'; 47480const ANIMATION = 'animation'; 47481// Transition property/event sniffing 47482let transitionProp = 'transition'; 47483let transitionEndEvent = 'transitionend'; 47484let animationProp = 'animation'; 47485let animationEndEvent = 'animationend'; 47486if (hasTransition) { 47487 /* istanbul ignore if */ 47488 if (window.ontransitionend === undefined && 47489 window.onwebkittransitionend !== undefined) { 47490 transitionProp = 'WebkitTransition'; 47491 transitionEndEvent = 'webkitTransitionEnd'; 47492 } 47493 if (window.onanimationend === undefined && 47494 window.onwebkitanimationend !== undefined) { 47495 animationProp = 'WebkitAnimation'; 47496 animationEndEvent = 'webkitAnimationEnd'; 47497 } 47498} 47499// binding to window is necessary to make hot reload work in IE in strict mode 47500const raf = inBrowser 47501 ? window.requestAnimationFrame 47502 ? window.requestAnimationFrame.bind(window) 47503 : setTimeout 47504 : /* istanbul ignore next */ /* istanbul ignore next */ fn => fn(); 47505function nextFrame(fn) { 47506 raf(() => { 47507 // @ts-expect-error 47508 raf(fn); 47509 }); 47510} 47511function addTransitionClass(el, cls) { 47512 const transitionClasses = el._transitionClasses || (el._transitionClasses = []); 47513 if (transitionClasses.indexOf(cls) < 0) { 47514 transitionClasses.push(cls); 47515 addClass(el, cls); 47516 } 47517} 47518function removeTransitionClass(el, cls) { 47519 if (el._transitionClasses) { 47520 remove$2(el._transitionClasses, cls); 47521 } 47522 removeClass(el, cls); 47523} 47524function whenTransitionEnds(el, expectedType, cb) { 47525 const { type, timeout, propCount } = getTransitionInfo(el, expectedType); 47526 if (!type) 47527 return cb(); 47528 const event = type === TRANSITION ? transitionEndEvent : animationEndEvent; 47529 let ended = 0; 47530 const end = () => { 47531 el.removeEventListener(event, onEnd); 47532 cb(); 47533 }; 47534 const onEnd = e => { 47535 if (e.target === el) { 47536 if (++ended >= propCount) { 47537 end(); 47538 } 47539 } 47540 }; 47541 setTimeout(() => { 47542 if (ended < propCount) { 47543 end(); 47544 } 47545 }, timeout + 1); 47546 el.addEventListener(event, onEnd); 47547} 47548const transformRE = /\b(transform|all)(,|$)/; 47549function getTransitionInfo(el, expectedType) { 47550 const styles = window.getComputedStyle(el); 47551 // JSDOM may return undefined for transition properties 47552 const transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', '); 47553 const transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', '); 47554 const transitionTimeout = getTimeout(transitionDelays, transitionDurations); 47555 const animationDelays = (styles[animationProp + 'Delay'] || '').split(', '); 47556 const animationDurations = (styles[animationProp + 'Duration'] || '').split(', '); 47557 const animationTimeout = getTimeout(animationDelays, animationDurations); 47558 let type; 47559 let timeout = 0; 47560 let propCount = 0; 47561 /* istanbul ignore if */ 47562 if (expectedType === TRANSITION) { 47563 if (transitionTimeout > 0) { 47564 type = TRANSITION; 47565 timeout = transitionTimeout; 47566 propCount = transitionDurations.length; 47567 } 47568 } 47569 else if (expectedType === ANIMATION) { 47570 if (animationTimeout > 0) { 47571 type = ANIMATION; 47572 timeout = animationTimeout; 47573 propCount = animationDurations.length; 47574 } 47575 } 47576 else { 47577 timeout = Math.max(transitionTimeout, animationTimeout); 47578 type = 47579 timeout > 0 47580 ? transitionTimeout > animationTimeout 47581 ? TRANSITION 47582 : ANIMATION 47583 : null; 47584 propCount = type 47585 ? type === TRANSITION 47586 ? transitionDurations.length 47587 : animationDurations.length 47588 : 0; 47589 } 47590 const hasTransform = type === TRANSITION && transformRE.test(styles[transitionProp + 'Property']); 47591 return { 47592 type, 47593 timeout, 47594 propCount, 47595 hasTransform 47596 }; 47597} 47598function getTimeout(delays, durations) { 47599 /* istanbul ignore next */ 47600 while (delays.length < durations.length) { 47601 delays = delays.concat(delays); 47602 } 47603 return Math.max.apply(null, durations.map((d, i) => { 47604 return toMs(d) + toMs(delays[i]); 47605 })); 47606} 47607// Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers 47608// in a locale-dependent way, using a comma instead of a dot. 47609// If comma is not replaced with a dot, the input will be rounded down (i.e. acting 47610// as a floor function) causing unexpected behaviors 47611function toMs(s) { 47612 return Number(s.slice(0, -1).replace(',', '.')) * 1000; 47613} 47614 47615function enter(vnode, toggleDisplay) { 47616 const el = vnode.elm; 47617 // call leave callback now 47618 if (isDef(el._leaveCb)) { 47619 el._leaveCb.cancelled = true; 47620 el._leaveCb(); 47621 } 47622 const data = resolveTransition(vnode.data.transition); 47623 if (isUndef(data)) { 47624 return; 47625 } 47626 /* istanbul ignore if */ 47627 if (isDef(el._enterCb) || el.nodeType !== 1) { 47628 return; 47629 } 47630 const { css, type, enterClass, enterToClass, enterActiveClass, appearClass, appearToClass, appearActiveClass, beforeEnter, enter, afterEnter, enterCancelled, beforeAppear, appear, afterAppear, appearCancelled, duration } = data; 47631 // activeInstance will always be the <transition> component managing this 47632 // transition. One edge case to check is when the <transition> is placed 47633 // as the root node of a child component. In that case we need to check 47634 // <transition>'s parent for appear check. 47635 let context = activeInstance; 47636 let transitionNode = activeInstance.$vnode; 47637 while (transitionNode && transitionNode.parent) { 47638 context = transitionNode.context; 47639 transitionNode = transitionNode.parent; 47640 } 47641 const isAppear = !context._isMounted || !vnode.isRootInsert; 47642 if (isAppear && !appear && appear !== '') { 47643 return; 47644 } 47645 const startClass = isAppear && appearClass ? appearClass : enterClass; 47646 const activeClass = isAppear && appearActiveClass ? appearActiveClass : enterActiveClass; 47647 const toClass = isAppear && appearToClass ? appearToClass : enterToClass; 47648 const beforeEnterHook = isAppear ? beforeAppear || beforeEnter : beforeEnter; 47649 const enterHook = isAppear ? (isFunction(appear) ? appear : enter) : enter; 47650 const afterEnterHook = isAppear ? afterAppear || afterEnter : afterEnter; 47651 const enterCancelledHook = isAppear 47652 ? appearCancelled || enterCancelled 47653 : enterCancelled; 47654 const explicitEnterDuration = toNumber(isObject(duration) ? duration.enter : duration); 47655 if (explicitEnterDuration != null) { 47656 checkDuration(explicitEnterDuration, 'enter', vnode); 47657 } 47658 const expectsCSS = css !== false && !isIE9; 47659 const userWantsControl = getHookArgumentsLength(enterHook); 47660 const cb = (el._enterCb = once(() => { 47661 if (expectsCSS) { 47662 removeTransitionClass(el, toClass); 47663 removeTransitionClass(el, activeClass); 47664 } 47665 // @ts-expect-error 47666 if (cb.cancelled) { 47667 if (expectsCSS) { 47668 removeTransitionClass(el, startClass); 47669 } 47670 enterCancelledHook && enterCancelledHook(el); 47671 } 47672 else { 47673 afterEnterHook && afterEnterHook(el); 47674 } 47675 el._enterCb = null; 47676 })); 47677 if (!vnode.data.show) { 47678 // remove pending leave element on enter by injecting an insert hook 47679 mergeVNodeHook(vnode, 'insert', () => { 47680 const parent = el.parentNode; 47681 const pendingNode = parent && parent._pending && parent._pending[vnode.key]; 47682 if (pendingNode && 47683 pendingNode.tag === vnode.tag && 47684 pendingNode.elm._leaveCb) { 47685 pendingNode.elm._leaveCb(); 47686 } 47687 enterHook && enterHook(el, cb); 47688 }); 47689 } 47690 // start enter transition 47691 beforeEnterHook && beforeEnterHook(el); 47692 if (expectsCSS) { 47693 addTransitionClass(el, startClass); 47694 addTransitionClass(el, activeClass); 47695 nextFrame(() => { 47696 removeTransitionClass(el, startClass); 47697 // @ts-expect-error 47698 if (!cb.cancelled) { 47699 addTransitionClass(el, toClass); 47700 if (!userWantsControl) { 47701 if (isValidDuration(explicitEnterDuration)) { 47702 setTimeout(cb, explicitEnterDuration); 47703 } 47704 else { 47705 whenTransitionEnds(el, type, cb); 47706 } 47707 } 47708 } 47709 }); 47710 } 47711 if (vnode.data.show) { 47712 toggleDisplay && toggleDisplay(); 47713 enterHook && enterHook(el, cb); 47714 } 47715 if (!expectsCSS && !userWantsControl) { 47716 cb(); 47717 } 47718} 47719function leave(vnode, rm) { 47720 const el = vnode.elm; 47721 // call enter callback now 47722 if (isDef(el._enterCb)) { 47723 el._enterCb.cancelled = true; 47724 el._enterCb(); 47725 } 47726 const data = resolveTransition(vnode.data.transition); 47727 if (isUndef(data) || el.nodeType !== 1) { 47728 return rm(); 47729 } 47730 /* istanbul ignore if */ 47731 if (isDef(el._leaveCb)) { 47732 return; 47733 } 47734 const { css, type, leaveClass, leaveToClass, leaveActiveClass, beforeLeave, leave, afterLeave, leaveCancelled, delayLeave, duration } = data; 47735 const expectsCSS = css !== false && !isIE9; 47736 const userWantsControl = getHookArgumentsLength(leave); 47737 const explicitLeaveDuration = toNumber(isObject(duration) ? duration.leave : duration); 47738 if (isDef(explicitLeaveDuration)) { 47739 checkDuration(explicitLeaveDuration, 'leave', vnode); 47740 } 47741 const cb = (el._leaveCb = once(() => { 47742 if (el.parentNode && el.parentNode._pending) { 47743 el.parentNode._pending[vnode.key] = null; 47744 } 47745 if (expectsCSS) { 47746 removeTransitionClass(el, leaveToClass); 47747 removeTransitionClass(el, leaveActiveClass); 47748 } 47749 // @ts-expect-error 47750 if (cb.cancelled) { 47751 if (expectsCSS) { 47752 removeTransitionClass(el, leaveClass); 47753 } 47754 leaveCancelled && leaveCancelled(el); 47755 } 47756 else { 47757 rm(); 47758 afterLeave && afterLeave(el); 47759 } 47760 el._leaveCb = null; 47761 })); 47762 if (delayLeave) { 47763 delayLeave(performLeave); 47764 } 47765 else { 47766 performLeave(); 47767 } 47768 function performLeave() { 47769 // the delayed leave may have already been cancelled 47770 // @ts-expect-error 47771 if (cb.cancelled) { 47772 return; 47773 } 47774 // record leaving element 47775 if (!vnode.data.show && el.parentNode) { 47776 (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] = 47777 vnode; 47778 } 47779 beforeLeave && beforeLeave(el); 47780 if (expectsCSS) { 47781 addTransitionClass(el, leaveClass); 47782 addTransitionClass(el, leaveActiveClass); 47783 nextFrame(() => { 47784 removeTransitionClass(el, leaveClass); 47785 // @ts-expect-error 47786 if (!cb.cancelled) { 47787 addTransitionClass(el, leaveToClass); 47788 if (!userWantsControl) { 47789 if (isValidDuration(explicitLeaveDuration)) { 47790 setTimeout(cb, explicitLeaveDuration); 47791 } 47792 else { 47793 whenTransitionEnds(el, type, cb); 47794 } 47795 } 47796 } 47797 }); 47798 } 47799 leave && leave(el, cb); 47800 if (!expectsCSS && !userWantsControl) { 47801 cb(); 47802 } 47803 } 47804} 47805// only used in dev mode 47806function checkDuration(val, name, vnode) { 47807 if (typeof val !== 'number') { 47808 warn(`<transition> explicit ${name} duration is not a valid number - ` + 47809 `got ${JSON.stringify(val)}.`, vnode.context); 47810 } 47811 else if (isNaN(val)) { 47812 warn(`<transition> explicit ${name} duration is NaN - ` + 47813 'the duration expression might be incorrect.', vnode.context); 47814 } 47815} 47816function isValidDuration(val) { 47817 return typeof val === 'number' && !isNaN(val); 47818} 47819/** 47820 * Normalize a transition hook's argument length. The hook may be: 47821 * - a merged hook (invoker) with the original in .fns 47822 * - a wrapped component method (check ._length) 47823 * - a plain function (.length) 47824 */ 47825function getHookArgumentsLength(fn) { 47826 if (isUndef(fn)) { 47827 return false; 47828 } 47829 // @ts-expect-error 47830 const invokerFns = fn.fns; 47831 if (isDef(invokerFns)) { 47832 // invoker 47833 return getHookArgumentsLength(Array.isArray(invokerFns) ? invokerFns[0] : invokerFns); 47834 } 47835 else { 47836 // @ts-expect-error 47837 return (fn._length || fn.length) > 1; 47838 } 47839} 47840function _enter(_, vnode) { 47841 if (vnode.data.show !== true) { 47842 enter(vnode); 47843 } 47844} 47845var transition = inBrowser 47846 ? { 47847 create: _enter, 47848 activate: _enter, 47849 remove(vnode, rm) { 47850 /* istanbul ignore else */ 47851 if (vnode.data.show !== true) { 47852 // @ts-expect-error 47853 leave(vnode, rm); 47854 } 47855 else { 47856 rm(); 47857 } 47858 } 47859 } 47860 : {}; 47861 47862var platformModules = [attrs, klass, events, domProps, style, transition]; 47863 47864// the directive module should be applied last, after all 47865// built-in modules have been applied. 47866const modules = platformModules.concat(baseModules); 47867const patch = createPatchFunction({ nodeOps, modules }); 47868 47869/** 47870 * Not type checking this file because flow doesn't like attaching 47871 * properties to Elements. 47872 */ 47873/* istanbul ignore if */ 47874if (isIE9) { 47875 // http://www.matts411.com/post/internet-explorer-9-oninput/ 47876 document.addEventListener('selectionchange', () => { 47877 const el = document.activeElement; 47878 // @ts-expect-error 47879 if (el && el.vmodel) { 47880 trigger(el, 'input'); 47881 } 47882 }); 47883} 47884const directive = { 47885 inserted(el, binding, vnode, oldVnode) { 47886 if (vnode.tag === 'select') { 47887 // #6903 47888 if (oldVnode.elm && !oldVnode.elm._vOptions) { 47889 mergeVNodeHook(vnode, 'postpatch', () => { 47890 directive.componentUpdated(el, binding, vnode); 47891 }); 47892 } 47893 else { 47894 setSelected(el, binding, vnode.context); 47895 } 47896 el._vOptions = [].map.call(el.options, getValue); 47897 } 47898 else if (vnode.tag === 'textarea' || isTextInputType(el.type)) { 47899 el._vModifiers = binding.modifiers; 47900 if (!binding.modifiers.lazy) { 47901 el.addEventListener('compositionstart', onCompositionStart); 47902 el.addEventListener('compositionend', onCompositionEnd); 47903 // Safari < 10.2 & UIWebView doesn't fire compositionend when 47904 // switching focus before confirming composition choice 47905 // this also fixes the issue where some browsers e.g. iOS Chrome 47906 // fires "change" instead of "input" on autocomplete. 47907 el.addEventListener('change', onCompositionEnd); 47908 /* istanbul ignore if */ 47909 if (isIE9) { 47910 el.vmodel = true; 47911 } 47912 } 47913 } 47914 }, 47915 componentUpdated(el, binding, vnode) { 47916 if (vnode.tag === 'select') { 47917 setSelected(el, binding, vnode.context); 47918 // in case the options rendered by v-for have changed, 47919 // it's possible that the value is out-of-sync with the rendered options. 47920 // detect such cases and filter out values that no longer has a matching 47921 // option in the DOM. 47922 const prevOptions = el._vOptions; 47923 const curOptions = (el._vOptions = [].map.call(el.options, getValue)); 47924 if (curOptions.some((o, i) => !looseEqual(o, prevOptions[i]))) { 47925 // trigger change event if 47926 // no matching option found for at least one value 47927 const needReset = el.multiple 47928 ? binding.value.some(v => hasNoMatchingOption(v, curOptions)) 47929 : binding.value !== binding.oldValue && 47930 hasNoMatchingOption(binding.value, curOptions); 47931 if (needReset) { 47932 trigger(el, 'change'); 47933 } 47934 } 47935 } 47936 } 47937}; 47938function setSelected(el, binding, vm) { 47939 actuallySetSelected(el, binding, vm); 47940 /* istanbul ignore if */ 47941 if (isIE || isEdge) { 47942 setTimeout(() => { 47943 actuallySetSelected(el, binding, vm); 47944 }, 0); 47945 } 47946} 47947function actuallySetSelected(el, binding, vm) { 47948 const value = binding.value; 47949 const isMultiple = el.multiple; 47950 if (isMultiple && !Array.isArray(value)) { 47951 warn(`<select multiple v-model="${binding.expression}"> ` + 47952 `expects an Array value for its binding, but got ${Object.prototype.toString 47953 .call(value) 47954 .slice(8, -1)}`, vm); 47955 return; 47956 } 47957 let selected, option; 47958 for (let i = 0, l = el.options.length; i < l; i++) { 47959 option = el.options[i]; 47960 if (isMultiple) { 47961 selected = looseIndexOf(value, getValue(option)) > -1; 47962 if (option.selected !== selected) { 47963 option.selected = selected; 47964 } 47965 } 47966 else { 47967 if (looseEqual(getValue(option), value)) { 47968 if (el.selectedIndex !== i) { 47969 el.selectedIndex = i; 47970 } 47971 return; 47972 } 47973 } 47974 } 47975 if (!isMultiple) { 47976 el.selectedIndex = -1; 47977 } 47978} 47979function hasNoMatchingOption(value, options) { 47980 return options.every(o => !looseEqual(o, value)); 47981} 47982function getValue(option) { 47983 return '_value' in option ? option._value : option.value; 47984} 47985function onCompositionStart(e) { 47986 e.target.composing = true; 47987} 47988function onCompositionEnd(e) { 47989 // prevent triggering an input event for no reason 47990 if (!e.target.composing) 47991 return; 47992 e.target.composing = false; 47993 trigger(e.target, 'input'); 47994} 47995function trigger(el, type) { 47996 const e = document.createEvent('HTMLEvents'); 47997 e.initEvent(type, true, true); 47998 el.dispatchEvent(e); 47999} 48000 48001// recursively search for possible transition defined inside the component root 48002function locateNode(vnode) { 48003 // @ts-expect-error 48004 return vnode.componentInstance && (!vnode.data || !vnode.data.transition) 48005 ? locateNode(vnode.componentInstance._vnode) 48006 : vnode; 48007} 48008var show = { 48009 bind(el, { value }, vnode) { 48010 vnode = locateNode(vnode); 48011 const transition = vnode.data && vnode.data.transition; 48012 const originalDisplay = (el.__vOriginalDisplay = 48013 el.style.display === 'none' ? '' : el.style.display); 48014 if (value && transition) { 48015 vnode.data.show = true; 48016 enter(vnode, () => { 48017 el.style.display = originalDisplay; 48018 }); 48019 } 48020 else { 48021 el.style.display = value ? originalDisplay : 'none'; 48022 } 48023 }, 48024 update(el, { value, oldValue }, vnode) { 48025 /* istanbul ignore if */ 48026 if (!value === !oldValue) 48027 return; 48028 vnode = locateNode(vnode); 48029 const transition = vnode.data && vnode.data.transition; 48030 if (transition) { 48031 vnode.data.show = true; 48032 if (value) { 48033 enter(vnode, () => { 48034 el.style.display = el.__vOriginalDisplay; 48035 }); 48036 } 48037 else { 48038 leave(vnode, () => { 48039 el.style.display = 'none'; 48040 }); 48041 } 48042 } 48043 else { 48044 el.style.display = value ? el.__vOriginalDisplay : 'none'; 48045 } 48046 }, 48047 unbind(el, binding, vnode, oldVnode, isDestroy) { 48048 if (!isDestroy) { 48049 el.style.display = el.__vOriginalDisplay; 48050 } 48051 } 48052}; 48053 48054var platformDirectives = { 48055 model: directive, 48056 show 48057}; 48058 48059// Provides transition support for a single element/component. 48060const transitionProps = { 48061 name: String, 48062 appear: Boolean, 48063 css: Boolean, 48064 mode: String, 48065 type: String, 48066 enterClass: String, 48067 leaveClass: String, 48068 enterToClass: String, 48069 leaveToClass: String, 48070 enterActiveClass: String, 48071 leaveActiveClass: String, 48072 appearClass: String, 48073 appearActiveClass: String, 48074 appearToClass: String, 48075 duration: [Number, String, Object] 48076}; 48077// in case the child is also an abstract component, e.g. <keep-alive> 48078// we want to recursively retrieve the real component to be rendered 48079function getRealChild(vnode) { 48080 const compOptions = vnode && vnode.componentOptions; 48081 if (compOptions && compOptions.Ctor.options.abstract) { 48082 return getRealChild(getFirstComponentChild(compOptions.children)); 48083 } 48084 else { 48085 return vnode; 48086 } 48087} 48088function extractTransitionData(comp) { 48089 const data = {}; 48090 const options = comp.$options; 48091 // props 48092 for (const key in options.propsData) { 48093 data[key] = comp[key]; 48094 } 48095 // events. 48096 // extract listeners and pass them directly to the transition methods 48097 const listeners = options._parentListeners; 48098 for (const key in listeners) { 48099 data[camelize(key)] = listeners[key]; 48100 } 48101 return data; 48102} 48103function placeholder(h, rawChild) { 48104 // @ts-expect-error 48105 if (/\d-keep-alive$/.test(rawChild.tag)) { 48106 return h('keep-alive', { 48107 props: rawChild.componentOptions.propsData 48108 }); 48109 } 48110} 48111function hasParentTransition(vnode) { 48112 while ((vnode = vnode.parent)) { 48113 if (vnode.data.transition) { 48114 return true; 48115 } 48116 } 48117} 48118function isSameChild(child, oldChild) { 48119 return oldChild.key === child.key && oldChild.tag === child.tag; 48120} 48121const isNotTextNode = (c) => c.tag || isAsyncPlaceholder(c); 48122const isVShowDirective = d => d.name === 'show'; 48123var Transition = { 48124 name: 'transition', 48125 props: transitionProps, 48126 abstract: true, 48127 render(h) { 48128 let children = this.$slots.default; 48129 if (!children) { 48130 return; 48131 } 48132 // filter out text nodes (possible whitespaces) 48133 children = children.filter(isNotTextNode); 48134 /* istanbul ignore if */ 48135 if (!children.length) { 48136 return; 48137 } 48138 // warn multiple elements 48139 if (children.length > 1) { 48140 warn('<transition> can only be used on a single element. Use ' + 48141 '<transition-group> for lists.', this.$parent); 48142 } 48143 const mode = this.mode; 48144 // warn invalid mode 48145 if (mode && mode !== 'in-out' && mode !== 'out-in') { 48146 warn('invalid <transition> mode: ' + mode, this.$parent); 48147 } 48148 const rawChild = children[0]; 48149 // if this is a component root node and the component's 48150 // parent container node also has transition, skip. 48151 if (hasParentTransition(this.$vnode)) { 48152 return rawChild; 48153 } 48154 // apply transition data to child 48155 // use getRealChild() to ignore abstract components e.g. keep-alive 48156 const child = getRealChild(rawChild); 48157 /* istanbul ignore if */ 48158 if (!child) { 48159 return rawChild; 48160 } 48161 if (this._leaving) { 48162 return placeholder(h, rawChild); 48163 } 48164 // ensure a key that is unique to the vnode type and to this transition 48165 // component instance. This key will be used to remove pending leaving nodes 48166 // during entering. 48167 const id = `__transition-${this._uid}-`; 48168 child.key = 48169 child.key == null 48170 ? child.isComment 48171 ? id + 'comment' 48172 : id + child.tag 48173 : isPrimitive(child.key) 48174 ? String(child.key).indexOf(id) === 0 48175 ? child.key 48176 : id + child.key 48177 : child.key; 48178 const data = ((child.data || (child.data = {})).transition = 48179 extractTransitionData(this)); 48180 const oldRawChild = this._vnode; 48181 const oldChild = getRealChild(oldRawChild); 48182 // mark v-show 48183 // so that the transition module can hand over the control to the directive 48184 if (child.data.directives && child.data.directives.some(isVShowDirective)) { 48185 child.data.show = true; 48186 } 48187 if (oldChild && 48188 oldChild.data && 48189 !isSameChild(child, oldChild) && 48190 !isAsyncPlaceholder(oldChild) && 48191 // #6687 component root is a comment node 48192 !(oldChild.componentInstance && 48193 oldChild.componentInstance._vnode.isComment)) { 48194 // replace old child transition data with fresh one 48195 // important for dynamic transitions! 48196 const oldData = (oldChild.data.transition = extend({}, data)); 48197 // handle transition mode 48198 if (mode === 'out-in') { 48199 // return placeholder node and queue update when leave finishes 48200 this._leaving = true; 48201 mergeVNodeHook(oldData, 'afterLeave', () => { 48202 this._leaving = false; 48203 this.$forceUpdate(); 48204 }); 48205 return placeholder(h, rawChild); 48206 } 48207 else if (mode === 'in-out') { 48208 if (isAsyncPlaceholder(child)) { 48209 return oldRawChild; 48210 } 48211 let delayedLeave; 48212 const performLeave = () => { 48213 delayedLeave(); 48214 }; 48215 mergeVNodeHook(data, 'afterEnter', performLeave); 48216 mergeVNodeHook(data, 'enterCancelled', performLeave); 48217 mergeVNodeHook(oldData, 'delayLeave', leave => { 48218 delayedLeave = leave; 48219 }); 48220 } 48221 } 48222 return rawChild; 48223 } 48224}; 48225 48226// Provides transition support for list items. 48227const props = extend({ 48228 tag: String, 48229 moveClass: String 48230}, transitionProps); 48231delete props.mode; 48232var TransitionGroup = { 48233 props, 48234 beforeMount() { 48235 const update = this._update; 48236 this._update = (vnode, hydrating) => { 48237 const restoreActiveInstance = setActiveInstance(this); 48238 // force removing pass 48239 this.__patch__(this._vnode, this.kept, false, // hydrating 48240 true // removeOnly (!important, avoids unnecessary moves) 48241 ); 48242 this._vnode = this.kept; 48243 restoreActiveInstance(); 48244 update.call(this, vnode, hydrating); 48245 }; 48246 }, 48247 render(h) { 48248 const tag = this.tag || this.$vnode.data.tag || 'span'; 48249 const map = Object.create(null); 48250 const prevChildren = (this.prevChildren = this.children); 48251 const rawChildren = this.$slots.default || []; 48252 const children = (this.children = []); 48253 const transitionData = extractTransitionData(this); 48254 for (let i = 0; i < rawChildren.length; i++) { 48255 const c = rawChildren[i]; 48256 if (c.tag) { 48257 if (c.key != null && String(c.key).indexOf('__vlist') !== 0) { 48258 children.push(c); 48259 map[c.key] = c; 48260 (c.data || (c.data = {})).transition = transitionData; 48261 } 48262 else { 48263 const opts = c.componentOptions; 48264 const name = opts 48265 ? getComponentName(opts.Ctor.options) || opts.tag || '' 48266 : c.tag; 48267 warn(`<transition-group> children must be keyed: <${name}>`); 48268 } 48269 } 48270 } 48271 if (prevChildren) { 48272 const kept = []; 48273 const removed = []; 48274 for (let i = 0; i < prevChildren.length; i++) { 48275 const c = prevChildren[i]; 48276 c.data.transition = transitionData; 48277 // @ts-expect-error .getBoundingClientRect is not typed in Node 48278 c.data.pos = c.elm.getBoundingClientRect(); 48279 if (map[c.key]) { 48280 kept.push(c); 48281 } 48282 else { 48283 removed.push(c); 48284 } 48285 } 48286 this.kept = h(tag, null, kept); 48287 this.removed = removed; 48288 } 48289 return h(tag, null, children); 48290 }, 48291 updated() { 48292 const children = this.prevChildren; 48293 const moveClass = this.moveClass || (this.name || 'v') + '-move'; 48294 if (!children.length || !this.hasMove(children[0].elm, moveClass)) { 48295 return; 48296 } 48297 // we divide the work into three loops to avoid mixing DOM reads and writes 48298 // in each iteration - which helps prevent layout thrashing. 48299 children.forEach(callPendingCbs); 48300 children.forEach(recordPosition); 48301 children.forEach(applyTranslation); 48302 // force reflow to put everything in position 48303 // assign to this to avoid being removed in tree-shaking 48304 // $flow-disable-line 48305 this._reflow = document.body.offsetHeight; 48306 children.forEach((c) => { 48307 if (c.data.moved) { 48308 const el = c.elm; 48309 const s = el.style; 48310 addTransitionClass(el, moveClass); 48311 s.transform = s.WebkitTransform = s.transitionDuration = ''; 48312 el.addEventListener(transitionEndEvent, (el._moveCb = function cb(e) { 48313 if (e && e.target !== el) { 48314 return; 48315 } 48316 if (!e || /transform$/.test(e.propertyName)) { 48317 el.removeEventListener(transitionEndEvent, cb); 48318 el._moveCb = null; 48319 removeTransitionClass(el, moveClass); 48320 } 48321 })); 48322 } 48323 }); 48324 }, 48325 methods: { 48326 hasMove(el, moveClass) { 48327 /* istanbul ignore if */ 48328 if (!hasTransition) { 48329 return false; 48330 } 48331 /* istanbul ignore if */ 48332 if (this._hasMove) { 48333 return this._hasMove; 48334 } 48335 // Detect whether an element with the move class applied has 48336 // CSS transitions. Since the element may be inside an entering 48337 // transition at this very moment, we make a clone of it and remove 48338 // all other transition classes applied to ensure only the move class 48339 // is applied. 48340 const clone = el.cloneNode(); 48341 if (el._transitionClasses) { 48342 el._transitionClasses.forEach((cls) => { 48343 removeClass(clone, cls); 48344 }); 48345 } 48346 addClass(clone, moveClass); 48347 clone.style.display = 'none'; 48348 this.$el.appendChild(clone); 48349 const info = getTransitionInfo(clone); 48350 this.$el.removeChild(clone); 48351 return (this._hasMove = info.hasTransform); 48352 } 48353 } 48354}; 48355function callPendingCbs(c) { 48356 /* istanbul ignore if */ 48357 if (c.elm._moveCb) { 48358 c.elm._moveCb(); 48359 } 48360 /* istanbul ignore if */ 48361 if (c.elm._enterCb) { 48362 c.elm._enterCb(); 48363 } 48364} 48365function recordPosition(c) { 48366 c.data.newPos = c.elm.getBoundingClientRect(); 48367} 48368function applyTranslation(c) { 48369 const oldPos = c.data.pos; 48370 const newPos = c.data.newPos; 48371 const dx = oldPos.left - newPos.left; 48372 const dy = oldPos.top - newPos.top; 48373 if (dx || dy) { 48374 c.data.moved = true; 48375 const s = c.elm.style; 48376 s.transform = s.WebkitTransform = `translate(${dx}px,${dy}px)`; 48377 s.transitionDuration = '0s'; 48378 } 48379} 48380 48381var platformComponents = { 48382 Transition, 48383 TransitionGroup 48384}; 48385 48386// install platform specific utils 48387Vue.config.mustUseProp = mustUseProp; 48388Vue.config.isReservedTag = isReservedTag; 48389Vue.config.isReservedAttr = isReservedAttr; 48390Vue.config.getTagNamespace = getTagNamespace; 48391Vue.config.isUnknownElement = isUnknownElement; 48392// install platform runtime directives & components 48393extend(Vue.options.directives, platformDirectives); 48394extend(Vue.options.components, platformComponents); 48395// install platform patch function 48396Vue.prototype.__patch__ = inBrowser ? patch : noop; 48397// public mount method 48398Vue.prototype.$mount = function (el, hydrating) { 48399 el = el && inBrowser ? query(el) : undefined; 48400 return mountComponent(this, el, hydrating); 48401}; 48402// devtools global hook 48403/* istanbul ignore next */ 48404if (inBrowser) { 48405 setTimeout(() => { 48406 if (config.devtools) { 48407 if (devtools) { 48408 devtools.emit('init', Vue); 48409 } 48410 else { 48411 // @ts-expect-error 48412 console[console.info ? 'info' : 'log']('Download the Vue Devtools extension for a better development experience:\n' + 48413 'https://github.com/vuejs/vue-devtools'); 48414 } 48415 } 48416 if (config.productionTip !== false && 48417 typeof console !== 'undefined') { 48418 // @ts-expect-error 48419 console[console.info ? 'info' : 'log'](`You are running Vue in development mode.\n` + 48420 `Make sure to turn on production mode when deploying for production.\n` + 48421 `See more tips at https://vuejs.org/guide/deployment.html`); 48422 } 48423 }, 0); 48424} 48425 48426extend(Vue, vca); 48427 48428module.exports = Vue; 48429 48430 48431/***/ }), 48432
vendor: 463 bytes, lines 48433-48445
48433/***/ "./node_modules/vue/dist/vue.runtime.common.js": 48434/*!*****************************************************!*\ 48435 !*** ./node_modules/vue/dist/vue.runtime.common.js ***! 48436 \*****************************************************/ 48437/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 48438 48439if (false) {} else { 48440 module.exports = __webpack_require__(/*! ./vue.runtime.common.dev.js */ "./node_modules/vue/dist/vue.runtime.common.dev.js") 48441} 48442 48443 48444/***/ }), 48445
vendor: 97,112 bytes, lines 48446-52179
48446/***/ "./node_modules/axios/dist/browser/axios.cjs": 48447/*!***************************************************!*\ 48448 !*** ./node_modules/axios/dist/browser/axios.cjs ***! 48449 \***************************************************/ 48450/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 48451 48452"use strict"; 48453/* provided dependency */ var process = __webpack_require__(/*! process/browser.js */ "./node_modules/process/browser.js"); 48454/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"]; 48455// Axios v1.7.9 Copyright (c) 2024 Matt Zabriskie and contributors 48456 48457 48458function bind(fn, thisArg) { 48459 return function wrap() { 48460 return fn.apply(thisArg, arguments); 48461 }; 48462} 48463 48464// utils is a library of generic helper functions non-specific to axios 48465 48466const {toString} = Object.prototype; 48467const {getPrototypeOf} = Object; 48468 48469const kindOf = (cache => thing => { 48470 const str = toString.call(thing); 48471 return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); 48472})(Object.create(null)); 48473 48474const kindOfTest = (type) => { 48475 type = type.toLowerCase(); 48476 return (thing) => kindOf(thing) === type 48477}; 48478 48479const typeOfTest = type => thing => typeof thing === type; 48480 48481/** 48482 * Determine if a value is an Array 48483 * 48484 * @param {Object} val The value to test 48485 * 48486 * @returns {boolean} True if value is an Array, otherwise false 48487 */ 48488const {isArray} = Array; 48489 48490/** 48491 * Determine if a value is undefined 48492 * 48493 * @param {*} val The value to test 48494 * 48495 * @returns {boolean} True if the value is undefined, otherwise false 48496 */ 48497const isUndefined = typeOfTest('undefined'); 48498 48499/** 48500 * Determine if a value is a Buffer 48501 * 48502 * @param {*} val The value to test 48503 * 48504 * @returns {boolean} True if value is a Buffer, otherwise false 48505 */ 48506function isBuffer(val) { 48507 return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) 48508 && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val); 48509} 48510 48511/** 48512 * Determine if a value is an ArrayBuffer 48513 * 48514 * @param {*} val The value to test 48515 * 48516 * @returns {boolean} True if value is an ArrayBuffer, otherwise false 48517 */ 48518const isArrayBuffer = kindOfTest('ArrayBuffer'); 48519 48520 48521/** 48522 * Determine if a value is a view on an ArrayBuffer 48523 * 48524 * @param {*} val The value to test 48525 * 48526 * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false 48527 */ 48528function isArrayBufferView(val) { 48529 let result; 48530 if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { 48531 result = ArrayBuffer.isView(val); 48532 } else { 48533 result = (val) && (val.buffer) && (isArrayBuffer(val.buffer)); 48534 } 48535 return result; 48536} 48537 48538/** 48539 * Determine if a value is a String 48540 * 48541 * @param {*} val The value to test 48542 * 48543 * @returns {boolean} True if value is a String, otherwise false 48544 */ 48545const isString = typeOfTest('string'); 48546 48547/** 48548 * Determine if a value is a Function 48549 * 48550 * @param {*} val The value to test 48551 * @returns {boolean} True if value is a Function, otherwise false 48552 */ 48553const isFunction = typeOfTest('function'); 48554 48555/** 48556 * Determine if a value is a Number 48557 * 48558 * @param {*} val The value to test 48559 * 48560 * @returns {boolean} True if value is a Number, otherwise false 48561 */ 48562const isNumber = typeOfTest('number'); 48563 48564/** 48565 * Determine if a value is an Object 48566 * 48567 * @param {*} thing The value to test 48568 * 48569 * @returns {boolean} True if value is an Object, otherwise false 48570 */ 48571const isObject = (thing) => thing !== null && typeof thing === 'object'; 48572 48573/** 48574 * Determine if a value is a Boolean 48575 * 48576 * @param {*} thing The value to test 48577 * @returns {boolean} True if value is a Boolean, otherwise false 48578 */ 48579const isBoolean = thing => thing === true || thing === false; 48580 48581/** 48582 * Determine if a value is a plain Object 48583 * 48584 * @param {*} val The value to test 48585 * 48586 * @returns {boolean} True if value is a plain Object, otherwise false 48587 */ 48588const isPlainObject = (val) => { 48589 if (kindOf(val) !== 'object') { 48590 return false; 48591 } 48592 48593 const prototype = getPrototypeOf(val); 48594 return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val); 48595}; 48596 48597/** 48598 * Determine if a value is a Date 48599 * 48600 * @param {*} val The value to test 48601 * 48602 * @returns {boolean} True if value is a Date, otherwise false 48603 */ 48604const isDate = kindOfTest('Date'); 48605 48606/** 48607 * Determine if a value is a File 48608 * 48609 * @param {*} val The value to test 48610 * 48611 * @returns {boolean} True if value is a File, otherwise false 48612 */ 48613const isFile = kindOfTest('File'); 48614 48615/** 48616 * Determine if a value is a Blob 48617 * 48618 * @param {*} val The value to test 48619 * 48620 * @returns {boolean} True if value is a Blob, otherwise false 48621 */ 48622const isBlob = kindOfTest('Blob'); 48623 48624/** 48625 * Determine if a value is a FileList 48626 * 48627 * @param {*} val The value to test 48628 * 48629 * @returns {boolean} True if value is a File, otherwise false 48630 */ 48631const isFileList = kindOfTest('FileList'); 48632 48633/** 48634 * Determine if a value is a Stream 48635 * 48636 * @param {*} val The value to test 48637 * 48638 * @returns {boolean} True if value is a Stream, otherwise false 48639 */ 48640const isStream = (val) => isObject(val) && isFunction(val.pipe); 48641 48642/** 48643 * Determine if a value is a FormData 48644 * 48645 * @param {*} thing The value to test 48646 * 48647 * @returns {boolean} True if value is an FormData, otherwise false 48648 */ 48649const isFormData = (thing) => { 48650 let kind; 48651 return thing && ( 48652 (typeof FormData === 'function' && thing instanceof FormData) || ( 48653 isFunction(thing.append) && ( 48654 (kind = kindOf(thing)) === 'formdata' || 48655 // detect form-data instance 48656 (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]') 48657 ) 48658 ) 48659 ) 48660}; 48661 48662/** 48663 * Determine if a value is a URLSearchParams object 48664 * 48665 * @param {*} val The value to test 48666 * 48667 * @returns {boolean} True if value is a URLSearchParams object, otherwise false 48668 */ 48669const isURLSearchParams = kindOfTest('URLSearchParams'); 48670 48671const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest); 48672 48673/** 48674 * Trim excess whitespace off the beginning and end of a string 48675 * 48676 * @param {String} str The String to trim 48677 * 48678 * @returns {String} The String freed of excess whitespace 48679 */ 48680const trim = (str) => str.trim ? 48681 str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); 48682 48683/** 48684 * Iterate over an Array or an Object invoking a function for each item. 48685 * 48686 * If `obj` is an Array callback will be called passing 48687 * the value, index, and complete array for each item. 48688 * 48689 * If 'obj' is an Object callback will be called passing 48690 * the value, key, and complete object for each property. 48691 * 48692 * @param {Object|Array} obj The object to iterate 48693 * @param {Function} fn The callback to invoke for each item 48694 * 48695 * @param {Boolean} [allOwnKeys = false] 48696 * @returns {any} 48697 */ 48698function forEach(obj, fn, {allOwnKeys = false} = {}) { 48699 // Don't bother if no value provided 48700 if (obj === null || typeof obj === 'undefined') { 48701 return; 48702 } 48703 48704 let i; 48705 let l; 48706 48707 // Force an array if not already something iterable 48708 if (typeof obj !== 'object') { 48709 /*eslint no-param-reassign:0*/ 48710 obj = [obj]; 48711 } 48712 48713 if (isArray(obj)) { 48714 // Iterate over array values 48715 for (i = 0, l = obj.length; i < l; i++) { 48716 fn.call(null, obj[i], i, obj); 48717 } 48718 } else { 48719 // Iterate over object keys 48720 const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj); 48721 const len = keys.length; 48722 let key; 48723 48724 for (i = 0; i < len; i++) { 48725 key = keys[i]; 48726 fn.call(null, obj[key], key, obj); 48727 } 48728 } 48729} 48730 48731function findKey(obj, key) { 48732 key = key.toLowerCase(); 48733 const keys = Object.keys(obj); 48734 let i = keys.length; 48735 let _key; 48736 while (i-- > 0) { 48737 _key = keys[i]; 48738 if (key === _key.toLowerCase()) { 48739 return _key; 48740 } 48741 } 48742 return null; 48743} 48744 48745const _global = (() => { 48746 /*eslint no-undef:0*/ 48747 if (typeof globalThis !== "undefined") return globalThis; 48748 return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : __webpack_require__.g) 48749})(); 48750 48751const isContextDefined = (context) => !isUndefined(context) && context !== _global; 48752 48753/** 48754 * Accepts varargs expecting each argument to be an object, then 48755 * immutably merges the properties of each object and returns result. 48756 * 48757 * When multiple objects contain the same key the later object in 48758 * the arguments list will take precedence. 48759 * 48760 * Example: 48761 * 48762 * ```js 48763 * var result = merge({foo: 123}, {foo: 456}); 48764 * console.log(result.foo); // outputs 456 48765 * ``` 48766 * 48767 * @param {Object} obj1 Object to merge 48768 * 48769 * @returns {Object} Result of all merge properties 48770 */ 48771function merge(/* obj1, obj2, obj3, ... */) { 48772 const {caseless} = isContextDefined(this) && this || {}; 48773 const result = {}; 48774 const assignValue = (val, key) => { 48775 const targetKey = caseless && findKey(result, key) || key; 48776 if (isPlainObject(result[targetKey]) && isPlainObject(val)) { 48777 result[targetKey] = merge(result[targetKey], val); 48778 } else if (isPlainObject(val)) { 48779 result[targetKey] = merge({}, val); 48780 } else if (isArray(val)) { 48781 result[targetKey] = val.slice(); 48782 } else { 48783 result[targetKey] = val; 48784 } 48785 }; 48786 48787 for (let i = 0, l = arguments.length; i < l; i++) { 48788 arguments[i] && forEach(arguments[i], assignValue); 48789 } 48790 return result; 48791} 48792 48793/** 48794 * Extends object a by mutably adding to it the properties of object b. 48795 * 48796 * @param {Object} a The object to be extended 48797 * @param {Object} b The object to copy properties from 48798 * @param {Object} thisArg The object to bind function to 48799 * 48800 * @param {Boolean} [allOwnKeys] 48801 * @returns {Object} The resulting value of object a 48802 */ 48803const extend = (a, b, thisArg, {allOwnKeys}= {}) => { 48804 forEach(b, (val, key) => { 48805 if (thisArg && isFunction(val)) { 48806 a[key] = bind(val, thisArg); 48807 } else { 48808 a[key] = val; 48809 } 48810 }, {allOwnKeys}); 48811 return a; 48812}; 48813 48814/** 48815 * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) 48816 * 48817 * @param {string} content with BOM 48818 * 48819 * @returns {string} content value without BOM 48820 */ 48821const stripBOM = (content) => { 48822 if (content.charCodeAt(0) === 0xFEFF) { 48823 content = content.slice(1); 48824 } 48825 return content; 48826}; 48827 48828/** 48829 * Inherit the prototype methods from one constructor into another 48830 * @param {function} constructor 48831 * @param {function} superConstructor 48832 * @param {object} [props] 48833 * @param {object} [descriptors] 48834 * 48835 * @returns {void} 48836 */ 48837const inherits = (constructor, superConstructor, props, descriptors) => { 48838 constructor.prototype = Object.create(superConstructor.prototype, descriptors); 48839 constructor.prototype.constructor = constructor; 48840 Object.defineProperty(constructor, 'super', { 48841 value: superConstructor.prototype 48842 }); 48843 props && Object.assign(constructor.prototype, props); 48844}; 48845 48846/** 48847 * Resolve object with deep prototype chain to a flat object 48848 * @param {Object} sourceObj source object 48849 * @param {Object} [destObj] 48850 * @param {Function|Boolean} [filter] 48851 * @param {Function} [propFilter] 48852 * 48853 * @returns {Object} 48854 */ 48855const toFlatObject = (sourceObj, destObj, filter, propFilter) => { 48856 let props; 48857 let i; 48858 let prop; 48859 const merged = {}; 48860 48861 destObj = destObj || {}; 48862 // eslint-disable-next-line no-eq-null,eqeqeq 48863 if (sourceObj == null) return destObj; 48864 48865 do { 48866 props = Object.getOwnPropertyNames(sourceObj); 48867 i = props.length; 48868 while (i-- > 0) { 48869 prop = props[i]; 48870 if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) { 48871 destObj[prop] = sourceObj[prop]; 48872 merged[prop] = true; 48873 } 48874 } 48875 sourceObj = filter !== false && getPrototypeOf(sourceObj); 48876 } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); 48877 48878 return destObj; 48879}; 48880 48881/** 48882 * Determines whether a string ends with the characters of a specified string 48883 * 48884 * @param {String} str 48885 * @param {String} searchString 48886 * @param {Number} [position= 0] 48887 * 48888 * @returns {boolean} 48889 */ 48890const endsWith = (str, searchString, position) => { 48891 str = String(str); 48892 if (position === undefined || position > str.length) { 48893 position = str.length; 48894 } 48895 position -= searchString.length; 48896 const lastIndex = str.indexOf(searchString, position); 48897 return lastIndex !== -1 && lastIndex === position; 48898}; 48899 48900 48901/** 48902 * Returns new array from array like object or null if failed 48903 * 48904 * @param {*} [thing] 48905 * 48906 * @returns {?Array} 48907 */ 48908const toArray = (thing) => { 48909 if (!thing) return null; 48910 if (isArray(thing)) return thing; 48911 let i = thing.length; 48912 if (!isNumber(i)) return null; 48913 const arr = new Array(i); 48914 while (i-- > 0) { 48915 arr[i] = thing[i]; 48916 } 48917 return arr; 48918}; 48919 48920/** 48921 * Checking if the Uint8Array exists and if it does, it returns a function that checks if the 48922 * thing passed in is an instance of Uint8Array 48923 * 48924 * @param {TypedArray} 48925 * 48926 * @returns {Array} 48927 */ 48928// eslint-disable-next-line func-names 48929const isTypedArray = (TypedArray => { 48930 // eslint-disable-next-line func-names 48931 return thing => { 48932 return TypedArray && thing instanceof TypedArray; 48933 }; 48934})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array)); 48935 48936/** 48937 * For each entry in the object, call the function with the key and value. 48938 * 48939 * @param {Object<any, any>} obj - The object to iterate over. 48940 * @param {Function} fn - The function to call for each entry. 48941 * 48942 * @returns {void} 48943 */ 48944const forEachEntry = (obj, fn) => { 48945 const generator = obj && obj[Symbol.iterator]; 48946 48947 const iterator = generator.call(obj); 48948 48949 let result; 48950 48951 while ((result = iterator.next()) && !result.done) { 48952 const pair = result.value; 48953 fn.call(obj, pair[0], pair[1]); 48954 } 48955}; 48956 48957/** 48958 * It takes a regular expression and a string, and returns an array of all the matches 48959 * 48960 * @param {string} regExp - The regular expression to match against. 48961 * @param {string} str - The string to search. 48962 * 48963 * @returns {Array<boolean>} 48964 */ 48965const matchAll = (regExp, str) => { 48966 let matches; 48967 const arr = []; 48968 48969 while ((matches = regExp.exec(str)) !== null) { 48970 arr.push(matches); 48971 } 48972 48973 return arr; 48974}; 48975 48976/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */ 48977const isHTMLForm = kindOfTest('HTMLFormElement'); 48978 48979const toCamelCase = str => { 48980 return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, 48981 function replacer(m, p1, p2) { 48982 return p1.toUpperCase() + p2; 48983 } 48984 ); 48985}; 48986 48987/* Creating a function that will check if an object has a property. */ 48988const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype); 48989 48990/** 48991 * Determine if a value is a RegExp object 48992 * 48993 * @param {*} val The value to test 48994 * 48995 * @returns {boolean} True if value is a RegExp object, otherwise false 48996 */ 48997const isRegExp = kindOfTest('RegExp'); 48998 48999const reduceDescriptors = (obj, reducer) => { 49000 const descriptors = Object.getOwnPropertyDescriptors(obj); 49001 const reducedDescriptors = {}; 49002 49003 forEach(descriptors, (descriptor, name) => { 49004 let ret; 49005 if ((ret = reducer(descriptor, name, obj)) !== false) { 49006 reducedDescriptors[name] = ret || descriptor; 49007 } 49008 }); 49009 49010 Object.defineProperties(obj, reducedDescriptors); 49011}; 49012 49013/** 49014 * Makes all methods read-only 49015 * @param {Object} obj 49016 */ 49017 49018const freezeMethods = (obj) => { 49019 reduceDescriptors(obj, (descriptor, name) => { 49020 // skip restricted props in strict mode 49021 if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) { 49022 return false; 49023 } 49024 49025 const value = obj[name]; 49026 49027 if (!isFunction(value)) return; 49028 49029 descriptor.enumerable = false; 49030 49031 if ('writable' in descriptor) { 49032 descriptor.writable = false; 49033 return; 49034 } 49035 49036 if (!descriptor.set) { 49037 descriptor.set = () => { 49038 throw Error('Can not rewrite read-only method \'' + name + '\''); 49039 }; 49040 } 49041 }); 49042}; 49043 49044const toObjectSet = (arrayOrString, delimiter) => { 49045 const obj = {}; 49046 49047 const define = (arr) => { 49048 arr.forEach(value => { 49049 obj[value] = true; 49050 }); 49051 }; 49052 49053 isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter)); 49054 49055 return obj; 49056}; 49057 49058const noop = () => {}; 49059 49060const toFiniteNumber = (value, defaultValue) => { 49061 return value != null && Number.isFinite(value = +value) ? value : defaultValue; 49062}; 49063 49064const ALPHA = 'abcdefghijklmnopqrstuvwxyz'; 49065 49066const DIGIT = '0123456789'; 49067 49068const ALPHABET = { 49069 DIGIT, 49070 ALPHA, 49071 ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT 49072}; 49073 49074const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => { 49075 let str = ''; 49076 const {length} = alphabet; 49077 while (size--) { 49078 str += alphabet[Math.random() * length|0]; 49079 } 49080 49081 return str; 49082}; 49083 49084/** 49085 * If the thing is a FormData object, return true, otherwise return false. 49086 * 49087 * @param {unknown} thing - The thing to check. 49088 * 49089 * @returns {boolean} 49090 */ 49091function isSpecCompliantForm(thing) { 49092 return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]); 49093} 49094 49095const toJSONObject = (obj) => { 49096 const stack = new Array(10); 49097 49098 const visit = (source, i) => { 49099 49100 if (isObject(source)) { 49101 if (stack.indexOf(source) >= 0) { 49102 return; 49103 } 49104 49105 if(!('toJSON' in source)) { 49106 stack[i] = source; 49107 const target = isArray(source) ? [] : {}; 49108 49109 forEach(source, (value, key) => { 49110 const reducedValue = visit(value, i + 1); 49111 !isUndefined(reducedValue) && (target[key] = reducedValue); 49112 }); 49113 49114 stack[i] = undefined; 49115 49116 return target; 49117 } 49118 } 49119 49120 return source; 49121 }; 49122 49123 return visit(obj, 0); 49124}; 49125 49126const isAsyncFn = kindOfTest('AsyncFunction'); 49127 49128const isThenable = (thing) => 49129 thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch); 49130 49131// original code 49132// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34 49133 49134const _setImmediate = ((setImmediateSupported, postMessageSupported) => { 49135 if (setImmediateSupported) { 49136 return setImmediate; 49137 } 49138 49139 return postMessageSupported ? ((token, callbacks) => { 49140 _global.addEventListener("message", ({source, data}) => { 49141 if (source === _global && data === token) { 49142 callbacks.length && callbacks.shift()(); 49143 } 49144 }, false); 49145 49146 return (cb) => { 49147 callbacks.push(cb); 49148 _global.postMessage(token, "*"); 49149 } 49150 })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb); 49151})( 49152 typeof setImmediate === 'function', 49153 isFunction(_global.postMessage) 49154); 49155 49156const asap = typeof queueMicrotask !== 'undefined' ? 49157 queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate); 49158 49159// ********************* 49160 49161var utils$1 = { 49162 isArray, 49163 isArrayBuffer, 49164 isBuffer, 49165 isFormData, 49166 isArrayBufferView, 49167 isString, 49168 isNumber, 49169 isBoolean, 49170 isObject, 49171 isPlainObject, 49172 isReadableStream, 49173 isRequest, 49174 isResponse, 49175 isHeaders, 49176 isUndefined, 49177 isDate, 49178 isFile, 49179 isBlob, 49180 isRegExp, 49181 isFunction, 49182 isStream, 49183 isURLSearchParams, 49184 isTypedArray, 49185 isFileList, 49186 forEach, 49187 merge, 49188 extend, 49189 trim, 49190 stripBOM, 49191 inherits, 49192 toFlatObject, 49193 kindOf, 49194 kindOfTest, 49195 endsWith, 49196 toArray, 49197 forEachEntry, 49198 matchAll, 49199 isHTMLForm, 49200 hasOwnProperty, 49201 hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection 49202 reduceDescriptors, 49203 freezeMethods, 49204 toObjectSet, 49205 toCamelCase, 49206 noop, 49207 toFiniteNumber, 49208 findKey, 49209 global: _global, 49210 isContextDefined, 49211 ALPHABET, 49212 generateString, 49213 isSpecCompliantForm, 49214 toJSONObject, 49215 isAsyncFn, 49216 isThenable, 49217 setImmediate: _setImmediate, 49218 asap 49219}; 49220 49221/** 49222 * Create an Error with the specified message, config, error code, request and response. 49223 * 49224 * @param {string} message The error message. 49225 * @param {string} [code] The error code (for example, 'ECONNABORTED'). 49226 * @param {Object} [config] The config. 49227 * @param {Object} [request] The request. 49228 * @param {Object} [response] The response. 49229 * 49230 * @returns {Error} The created error. 49231 */ 49232function AxiosError(message, code, config, request, response) { 49233 Error.call(this); 49234 49235 if (Error.captureStackTrace) { 49236 Error.captureStackTrace(this, this.constructor); 49237 } else { 49238 this.stack = (new Error()).stack; 49239 } 49240 49241 this.message = message; 49242 this.name = 'AxiosError'; 49243 code && (this.code = code); 49244 config && (this.config = config); 49245 request && (this.request = request); 49246 if (response) { 49247 this.response = response; 49248 this.status = response.status ? response.status : null; 49249 } 49250} 49251 49252utils$1.inherits(AxiosError, Error, { 49253 toJSON: function toJSON() { 49254 return { 49255 // Standard 49256 message: this.message, 49257 name: this.name, 49258 // Microsoft 49259 description: this.description, 49260 number: this.number, 49261 // Mozilla 49262 fileName: this.fileName, 49263 lineNumber: this.lineNumber, 49264 columnNumber: this.columnNumber, 49265 stack: this.stack, 49266 // Axios 49267 config: utils$1.toJSONObject(this.config), 49268 code: this.code, 49269 status: this.status 49270 }; 49271 } 49272}); 49273 49274const prototype$1 = AxiosError.prototype; 49275const descriptors = {}; 49276 49277[ 49278 'ERR_BAD_OPTION_VALUE', 49279 'ERR_BAD_OPTION', 49280 'ECONNABORTED', 49281 'ETIMEDOUT', 49282 'ERR_NETWORK', 49283 'ERR_FR_TOO_MANY_REDIRECTS', 49284 'ERR_DEPRECATED', 49285 'ERR_BAD_RESPONSE', 49286 'ERR_BAD_REQUEST', 49287 'ERR_CANCELED', 49288 'ERR_NOT_SUPPORT', 49289 'ERR_INVALID_URL' 49290// eslint-disable-next-line func-names 49291].forEach(code => { 49292 descriptors[code] = {value: code}; 49293}); 49294 49295Object.defineProperties(AxiosError, descriptors); 49296Object.defineProperty(prototype$1, 'isAxiosError', {value: true}); 49297 49298// eslint-disable-next-line func-names 49299AxiosError.from = (error, code, config, request, response, customProps) => { 49300 const axiosError = Object.create(prototype$1); 49301 49302 utils$1.toFlatObject(error, axiosError, function filter(obj) { 49303 return obj !== Error.prototype; 49304 }, prop => { 49305 return prop !== 'isAxiosError'; 49306 }); 49307 49308 AxiosError.call(axiosError, error.message, code, config, request, response); 49309 49310 axiosError.cause = error; 49311 49312 axiosError.name = error.name; 49313 49314 customProps && Object.assign(axiosError, customProps); 49315 49316 return axiosError; 49317}; 49318 49319// eslint-disable-next-line strict 49320var httpAdapter = null; 49321 49322/** 49323 * Determines if the given thing is a array or js object. 49324 * 49325 * @param {string} thing - The object or array to be visited. 49326 * 49327 * @returns {boolean} 49328 */ 49329function isVisitable(thing) { 49330 return utils$1.isPlainObject(thing) || utils$1.isArray(thing); 49331} 49332 49333/** 49334 * It removes the brackets from the end of a string 49335 * 49336 * @param {string} key - The key of the parameter. 49337 * 49338 * @returns {string} the key without the brackets. 49339 */ 49340function removeBrackets(key) { 49341 return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key; 49342} 49343 49344/** 49345 * It takes a path, a key, and a boolean, and returns a string 49346 * 49347 * @param {string} path - The path to the current key. 49348 * @param {string} key - The key of the current object being iterated over. 49349 * @param {string} dots - If true, the key will be rendered with dots instead of brackets. 49350 * 49351 * @returns {string} The path to the current key. 49352 */ 49353function renderKey(path, key, dots) { 49354 if (!path) return key; 49355 return path.concat(key).map(function each(token, i) { 49356 // eslint-disable-next-line no-param-reassign 49357 token = removeBrackets(token); 49358 return !dots && i ? '[' + token + ']' : token; 49359 }).join(dots ? '.' : ''); 49360} 49361 49362/** 49363 * If the array is an array and none of its elements are visitable, then it's a flat array. 49364 * 49365 * @param {Array<any>} arr - The array to check 49366 * 49367 * @returns {boolean} 49368 */ 49369function isFlatArray(arr) { 49370 return utils$1.isArray(arr) && !arr.some(isVisitable); 49371} 49372 49373const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) { 49374 return /^is[A-Z]/.test(prop); 49375}); 49376 49377/** 49378 * Convert a data object to FormData 49379 * 49380 * @param {Object} obj 49381 * @param {?Object} [formData] 49382 * @param {?Object} [options] 49383 * @param {Function} [options.visitor] 49384 * @param {Boolean} [options.metaTokens = true] 49385 * @param {Boolean} [options.dots = false] 49386 * @param {?Boolean} [options.indexes = false] 49387 * 49388 * @returns {Object} 49389 **/ 49390 49391/** 49392 * It converts an object into a FormData object 49393 * 49394 * @param {Object<any, any>} obj - The object to convert to form data. 49395 * @param {string} formData - The FormData object to append to. 49396 * @param {Object<string, any>} options 49397 * 49398 * @returns 49399 */ 49400function toFormData(obj, formData, options) { 49401 if (!utils$1.isObject(obj)) { 49402 throw new TypeError('target must be an object'); 49403 } 49404 49405 // eslint-disable-next-line no-param-reassign 49406 formData = formData || new (FormData)(); 49407 49408 // eslint-disable-next-line no-param-reassign 49409 options = utils$1.toFlatObject(options, { 49410 metaTokens: true, 49411 dots: false, 49412 indexes: false 49413 }, false, function defined(option, source) { 49414 // eslint-disable-next-line no-eq-null,eqeqeq 49415 return !utils$1.isUndefined(source[option]); 49416 }); 49417 49418 const metaTokens = options.metaTokens; 49419 // eslint-disable-next-line no-use-before-define 49420 const visitor = options.visitor || defaultVisitor; 49421 const dots = options.dots; 49422 const indexes = options.indexes; 49423 const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob; 49424 const useBlob = _Blob && utils$1.isSpecCompliantForm(formData); 49425 49426 if (!utils$1.isFunction(visitor)) { 49427 throw new TypeError('visitor must be a function'); 49428 } 49429 49430 function convertValue(value) { 49431 if (value === null) return ''; 49432 49433 if (utils$1.isDate(value)) { 49434 return value.toISOString(); 49435 } 49436 49437 if (!useBlob && utils$1.isBlob(value)) { 49438 throw new AxiosError('Blob is not supported. Use a Buffer instead.'); 49439 } 49440 49441 if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) { 49442 return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value); 49443 } 49444 49445 return value; 49446 } 49447 49448 /** 49449 * Default visitor. 49450 * 49451 * @param {*} value 49452 * @param {String|Number} key 49453 * @param {Array<String|Number>} path 49454 * @this {FormData} 49455 * 49456 * @returns {boolean} return true to visit the each prop of the value recursively 49457 */ 49458 function defaultVisitor(value, key, path) { 49459 let arr = value; 49460 49461 if (value && !path && typeof value === 'object') { 49462 if (utils$1.endsWith(key, '{}')) { 49463 // eslint-disable-next-line no-param-reassign 49464 key = metaTokens ? key : key.slice(0, -2); 49465 // eslint-disable-next-line no-param-reassign 49466 value = JSON.stringify(value); 49467 } else if ( 49468 (utils$1.isArray(value) && isFlatArray(value)) || 49469 ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)) 49470 )) { 49471 // eslint-disable-next-line no-param-reassign 49472 key = removeBrackets(key); 49473 49474 arr.forEach(function each(el, index) { 49475 !(utils$1.isUndefined(el) || el === null) && formData.append( 49476 // eslint-disable-next-line no-nested-ternary 49477 indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'), 49478 convertValue(el) 49479 ); 49480 }); 49481 return false; 49482 } 49483 } 49484 49485 if (isVisitable(value)) { 49486 return true; 49487 } 49488 49489 formData.append(renderKey(path, key, dots), convertValue(value)); 49490 49491 return false; 49492 } 49493 49494 const stack = []; 49495 49496 const exposedHelpers = Object.assign(predicates, { 49497 defaultVisitor, 49498 convertValue, 49499 isVisitable 49500 }); 49501 49502 function build(value, path) { 49503 if (utils$1.isUndefined(value)) return; 49504 49505 if (stack.indexOf(value) !== -1) { 49506 throw Error('Circular reference detected in ' + path.join('.')); 49507 } 49508 49509 stack.push(value); 49510 49511 utils$1.forEach(value, function each(el, key) { 49512 const result = !(utils$1.isUndefined(el) || el === null) && visitor.call( 49513 formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers 49514 ); 49515 49516 if (result === true) { 49517 build(el, path ? path.concat(key) : [key]); 49518 } 49519 }); 49520 49521 stack.pop(); 49522 } 49523 49524 if (!utils$1.isObject(obj)) { 49525 throw new TypeError('data must be an object'); 49526 } 49527 49528 build(obj); 49529 49530 return formData; 49531} 49532 49533/** 49534 * It encodes a string by replacing all characters that are not in the unreserved set with 49535 * their percent-encoded equivalents 49536 * 49537 * @param {string} str - The string to encode. 49538 * 49539 * @returns {string} The encoded string. 49540 */ 49541function encode$1(str) { 49542 const charMap = { 49543 '!': '%21', 49544 "'": '%27', 49545 '(': '%28', 49546 ')': '%29', 49547 '~': '%7E', 49548 '%20': '+', 49549 '%00': '\x00' 49550 }; 49551 return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) { 49552 return charMap[match]; 49553 }); 49554} 49555 49556/** 49557 * It takes a params object and converts it to a FormData object 49558 * 49559 * @param {Object<string, any>} params - The parameters to be converted to a FormData object. 49560 * @param {Object<string, any>} options - The options object passed to the Axios constructor. 49561 * 49562 * @returns {void} 49563 */ 49564function AxiosURLSearchParams(params, options) { 49565 this._pairs = []; 49566 49567 params && toFormData(params, this, options); 49568} 49569 49570const prototype = AxiosURLSearchParams.prototype; 49571 49572prototype.append = function append(name, value) { 49573 this._pairs.push([name, value]); 49574}; 49575 49576prototype.toString = function toString(encoder) { 49577 const _encode = encoder ? function(value) { 49578 return encoder.call(this, value, encode$1); 49579 } : encode$1; 49580 49581 return this._pairs.map(function each(pair) { 49582 return _encode(pair[0]) + '=' + _encode(pair[1]); 49583 }, '').join('&'); 49584}; 49585 49586/** 49587 * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their 49588 * URI encoded counterparts 49589 * 49590 * @param {string} val The value to be encoded. 49591 * 49592 * @returns {string} The encoded value. 49593 */ 49594function encode(val) { 49595 return encodeURIComponent(val). 49596 replace(/%3A/gi, ':'). 49597 replace(/%24/g, '$'). 49598 replace(/%2C/gi, ','). 49599 replace(/%20/g, '+'). 49600 replace(/%5B/gi, '['). 49601 replace(/%5D/gi, ']'); 49602} 49603 49604/** 49605 * Build a URL by appending params to the end 49606 * 49607 * @param {string} url The base of the url (e.g., http://www.google.com) 49608 * @param {object} [params] The params to be appended 49609 * @param {?(object|Function)} options 49610 * 49611 * @returns {string} The formatted url 49612 */ 49613function buildURL(url, params, options) { 49614 /*eslint no-param-reassign:0*/ 49615 if (!params) { 49616 return url; 49617 } 49618 49619 const _encode = options && options.encode || encode; 49620 49621 if (utils$1.isFunction(options)) { 49622 options = { 49623 serialize: options 49624 }; 49625 } 49626 49627 const serializeFn = options && options.serialize; 49628 49629 let serializedParams; 49630 49631 if (serializeFn) { 49632 serializedParams = serializeFn(params, options); 49633 } else { 49634 serializedParams = utils$1.isURLSearchParams(params) ? 49635 params.toString() : 49636 new AxiosURLSearchParams(params, options).toString(_encode); 49637 } 49638 49639 if (serializedParams) { 49640 const hashmarkIndex = url.indexOf("#"); 49641 49642 if (hashmarkIndex !== -1) { 49643 url = url.slice(0, hashmarkIndex); 49644 } 49645 url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; 49646 } 49647 49648 return url; 49649} 49650 49651class InterceptorManager { 49652 constructor() { 49653 this.handlers = []; 49654 } 49655 49656 /** 49657 * Add a new interceptor to the stack 49658 * 49659 * @param {Function} fulfilled The function to handle `then` for a `Promise` 49660 * @param {Function} rejected The function to handle `reject` for a `Promise` 49661 * 49662 * @return {Number} An ID used to remove interceptor later 49663 */ 49664 use(fulfilled, rejected, options) { 49665 this.handlers.push({ 49666 fulfilled, 49667 rejected, 49668 synchronous: options ? options.synchronous : false, 49669 runWhen: options ? options.runWhen : null 49670 }); 49671 return this.handlers.length - 1; 49672 } 49673 49674 /** 49675 * Remove an interceptor from the stack 49676 * 49677 * @param {Number} id The ID that was returned by `use` 49678 * 49679 * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise 49680 */ 49681 eject(id) { 49682 if (this.handlers[id]) { 49683 this.handlers[id] = null; 49684 } 49685 } 49686 49687 /** 49688 * Clear all interceptors from the stack 49689 * 49690 * @returns {void} 49691 */ 49692 clear() { 49693 if (this.handlers) { 49694 this.handlers = []; 49695 } 49696 } 49697 49698 /** 49699 * Iterate over all the registered interceptors 49700 * 49701 * This method is particularly useful for skipping over any 49702 * interceptors that may have become `null` calling `eject`. 49703 * 49704 * @param {Function} fn The function to call for each interceptor 49705 * 49706 * @returns {void} 49707 */ 49708 forEach(fn) { 49709 utils$1.forEach(this.handlers, function forEachHandler(h) { 49710 if (h !== null) { 49711 fn(h); 49712 } 49713 }); 49714 } 49715} 49716 49717var InterceptorManager$1 = InterceptorManager; 49718 49719var transitionalDefaults = { 49720 silentJSONParsing: true, 49721 forcedJSONParsing: true, 49722 clarifyTimeoutError: false 49723}; 49724 49725var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams; 49726 49727var FormData$1 = typeof FormData !== 'undefined' ? FormData : null; 49728 49729var Blob$1 = typeof Blob !== 'undefined' ? Blob : null; 49730 49731var platform$1 = { 49732 isBrowser: true, 49733 classes: { 49734 URLSearchParams: URLSearchParams$1, 49735 FormData: FormData$1, 49736 Blob: Blob$1 49737 }, 49738 protocols: ['http', 'https', 'file', 'blob', 'url', 'data'] 49739}; 49740 49741const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined'; 49742 49743const _navigator = typeof navigator === 'object' && navigator || undefined; 49744 49745/** 49746 * Determine if we're running in a standard browser environment 49747 * 49748 * This allows axios to run in a web worker, and react-native. 49749 * Both environments support XMLHttpRequest, but not fully standard globals. 49750 * 49751 * web workers: 49752 * typeof window -> undefined 49753 * typeof document -> undefined 49754 * 49755 * react-native: 49756 * navigator.product -> 'ReactNative' 49757 * nativescript 49758 * navigator.product -> 'NativeScript' or 'NS' 49759 * 49760 * @returns {boolean} 49761 */ 49762const hasStandardBrowserEnv = hasBrowserEnv && 49763 (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0); 49764 49765/** 49766 * Determine if we're running in a standard browser webWorker environment 49767 * 49768 * Although the `isStandardBrowserEnv` method indicates that 49769 * `allows axios to run in a web worker`, the WebWorker will still be 49770 * filtered out due to its judgment standard 49771 * `typeof window !== 'undefined' && typeof document !== 'undefined'`. 49772 * This leads to a problem when axios post `FormData` in webWorker 49773 */ 49774const hasStandardBrowserWebWorkerEnv = (() => { 49775 return ( 49776 typeof WorkerGlobalScope !== 'undefined' && 49777 // eslint-disable-next-line no-undef 49778 self instanceof WorkerGlobalScope && 49779 typeof self.importScripts === 'function' 49780 ); 49781})(); 49782 49783const origin = hasBrowserEnv && window.location.href || 'http://localhost'; 49784 49785var utils = /*#__PURE__*/Object.freeze({ 49786 __proto__: null, 49787 hasBrowserEnv: hasBrowserEnv, 49788 hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv, 49789 hasStandardBrowserEnv: hasStandardBrowserEnv, 49790 navigator: _navigator, 49791 origin: origin 49792}); 49793 49794var platform = { 49795 ...utils, 49796 ...platform$1 49797}; 49798 49799function toURLEncodedForm(data, options) { 49800 return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({ 49801 visitor: function(value, key, path, helpers) { 49802 if (platform.isNode && utils$1.isBuffer(value)) { 49803 this.append(key, value.toString('base64')); 49804 return false; 49805 } 49806 49807 return helpers.defaultVisitor.apply(this, arguments); 49808 } 49809 }, options)); 49810} 49811 49812/** 49813 * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z'] 49814 * 49815 * @param {string} name - The name of the property to get. 49816 * 49817 * @returns An array of strings. 49818 */ 49819function parsePropPath(name) { 49820 // foo[x][y][z] 49821 // foo.x.y.z 49822 // foo-x-y-z 49823 // foo x y z 49824 return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => { 49825 return match[0] === '[]' ? '' : match[1] || match[0]; 49826 }); 49827} 49828 49829/** 49830 * Convert an array to an object. 49831 * 49832 * @param {Array<any>} arr - The array to convert to an object. 49833 * 49834 * @returns An object with the same keys and values as the array. 49835 */ 49836function arrayToObject(arr) { 49837 const obj = {}; 49838 const keys = Object.keys(arr); 49839 let i; 49840 const len = keys.length; 49841 let key; 49842 for (i = 0; i < len; i++) { 49843 key = keys[i]; 49844 obj[key] = arr[key]; 49845 } 49846 return obj; 49847} 49848 49849/** 49850 * It takes a FormData object and returns a JavaScript object 49851 * 49852 * @param {string} formData The FormData object to convert to JSON. 49853 * 49854 * @returns {Object<string, any> | null} The converted object. 49855 */ 49856function formDataToJSON(formData) { 49857 function buildPath(path, value, target, index) { 49858 let name = path[index++]; 49859 49860 if (name === '__proto__') return true; 49861 49862 const isNumericKey = Number.isFinite(+name); 49863 const isLast = index >= path.length; 49864 name = !name && utils$1.isArray(target) ? target.length : name; 49865 49866 if (isLast) { 49867 if (utils$1.hasOwnProp(target, name)) { 49868 target[name] = [target[name], value]; 49869 } else { 49870 target[name] = value; 49871 } 49872 49873 return !isNumericKey; 49874 } 49875 49876 if (!target[name] || !utils$1.isObject(target[name])) { 49877 target[name] = []; 49878 } 49879 49880 const result = buildPath(path, value, target[name], index); 49881 49882 if (result && utils$1.isArray(target[name])) { 49883 target[name] = arrayToObject(target[name]); 49884 } 49885 49886 return !isNumericKey; 49887 } 49888 49889 if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) { 49890 const obj = {}; 49891 49892 utils$1.forEachEntry(formData, (name, value) => { 49893 buildPath(parsePropPath(name), value, obj, 0); 49894 }); 49895 49896 return obj; 49897 } 49898 49899 return null; 49900} 49901 49902/** 49903 * It takes a string, tries to parse it, and if it fails, it returns the stringified version 49904 * of the input 49905 * 49906 * @param {any} rawValue - The value to be stringified. 49907 * @param {Function} parser - A function that parses a string into a JavaScript object. 49908 * @param {Function} encoder - A function that takes a value and returns a string. 49909 * 49910 * @returns {string} A stringified version of the rawValue. 49911 */ 49912function stringifySafely(rawValue, parser, encoder) { 49913 if (utils$1.isString(rawValue)) { 49914 try { 49915 (parser || JSON.parse)(rawValue); 49916 return utils$1.trim(rawValue); 49917 } catch (e) { 49918 if (e.name !== 'SyntaxError') { 49919 throw e; 49920 } 49921 } 49922 } 49923 49924 return (encoder || JSON.stringify)(rawValue); 49925} 49926 49927const defaults = { 49928 49929 transitional: transitionalDefaults, 49930 49931 adapter: ['xhr', 'http', 'fetch'], 49932 49933 transformRequest: [function transformRequest(data, headers) { 49934 const contentType = headers.getContentType() || ''; 49935 const hasJSONContentType = contentType.indexOf('application/json') > -1; 49936 const isObjectPayload = utils$1.isObject(data); 49937 49938 if (isObjectPayload && utils$1.isHTMLForm(data)) { 49939 data = new FormData(data); 49940 } 49941 49942 const isFormData = utils$1.isFormData(data); 49943 49944 if (isFormData) { 49945 return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data; 49946 } 49947 49948 if (utils$1.isArrayBuffer(data) || 49949 utils$1.isBuffer(data) || 49950 utils$1.isStream(data) || 49951 utils$1.isFile(data) || 49952 utils$1.isBlob(data) || 49953 utils$1.isReadableStream(data) 49954 ) { 49955 return data; 49956 } 49957 if (utils$1.isArrayBufferView(data)) { 49958 return data.buffer; 49959 } 49960 if (utils$1.isURLSearchParams(data)) { 49961 headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false); 49962 return data.toString(); 49963 } 49964 49965 let isFileList; 49966 49967 if (isObjectPayload) { 49968 if (contentType.indexOf('application/x-www-form-urlencoded') > -1) { 49969 return toURLEncodedForm(data, this.formSerializer).toString(); 49970 } 49971 49972 if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) { 49973 const _FormData = this.env && this.env.FormData; 49974 49975 return toFormData( 49976 isFileList ? {'files[]': data} : data, 49977 _FormData && new _FormData(), 49978 this.formSerializer 49979 ); 49980 } 49981 } 49982 49983 if (isObjectPayload || hasJSONContentType ) { 49984 headers.setContentType('application/json', false); 49985 return stringifySafely(data); 49986 } 49987 49988 return data; 49989 }], 49990 49991 transformResponse: [function transformResponse(data) { 49992 const transitional = this.transitional || defaults.transitional; 49993 const forcedJSONParsing = transitional && transitional.forcedJSONParsing; 49994 const JSONRequested = this.responseType === 'json'; 49995 49996 if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) { 49997 return data; 49998 } 49999 50000 if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) { 50001 const silentJSONParsing = transitional && transitional.silentJSONParsing; 50002 const strictJSONParsing = !silentJSONParsing && JSONRequested; 50003 50004 try { 50005 return JSON.parse(data); 50006 } catch (e) { 50007 if (strictJSONParsing) { 50008 if (e.name === 'SyntaxError') { 50009 throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response); 50010 } 50011 throw e; 50012 } 50013 } 50014 } 50015 50016 return data; 50017 }], 50018 50019 /** 50020 * A timeout in milliseconds to abort a request. If set to 0 (default) a 50021 * timeout is not created. 50022 */ 50023 timeout: 0, 50024 50025 xsrfCookieName: 'XSRF-TOKEN', 50026 xsrfHeaderName: 'X-XSRF-TOKEN', 50027 50028 maxContentLength: -1, 50029 maxBodyLength: -1, 50030 50031 env: { 50032 FormData: platform.classes.FormData, 50033 Blob: platform.classes.Blob 50034 }, 50035 50036 validateStatus: function validateStatus(status) { 50037 return status >= 200 && status < 300; 50038 }, 50039 50040 headers: { 50041 common: { 50042 'Accept': 'application/json, text/plain, */*', 50043 'Content-Type': undefined 50044 } 50045 } 50046}; 50047 50048utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => { 50049 defaults.headers[method] = {}; 50050}); 50051 50052var defaults$1 = defaults; 50053 50054// RawAxiosHeaders whose duplicates are ignored by node 50055// c.f. https://nodejs.org/api/http.html#http_message_headers 50056const ignoreDuplicateOf = utils$1.toObjectSet([ 50057 'age', 'authorization', 'content-length', 'content-type', 'etag', 50058 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 50059 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 50060 'referer', 'retry-after', 'user-agent' 50061]); 50062 50063/** 50064 * Parse headers into an object 50065 * 50066 * ``` 50067 * Date: Wed, 27 Aug 2014 08:58:49 GMT 50068 * Content-Type: application/json 50069 * Connection: keep-alive 50070 * Transfer-Encoding: chunked 50071 * ``` 50072 * 50073 * @param {String} rawHeaders Headers needing to be parsed 50074 * 50075 * @returns {Object} Headers parsed into an object 50076 */ 50077var parseHeaders = rawHeaders => { 50078 const parsed = {}; 50079 let key; 50080 let val; 50081 let i; 50082 50083 rawHeaders && rawHeaders.split('\n').forEach(function parser(line) { 50084 i = line.indexOf(':'); 50085 key = line.substring(0, i).trim().toLowerCase(); 50086 val = line.substring(i + 1).trim(); 50087 50088 if (!key || (parsed[key] && ignoreDuplicateOf[key])) { 50089 return; 50090 } 50091 50092 if (key === 'set-cookie') { 50093 if (parsed[key]) { 50094 parsed[key].push(val); 50095 } else { 50096 parsed[key] = [val]; 50097 } 50098 } else { 50099 parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; 50100 } 50101 }); 50102 50103 return parsed; 50104}; 50105 50106const $internals = Symbol('internals'); 50107 50108function normalizeHeader(header) { 50109 return header && String(header).trim().toLowerCase(); 50110} 50111 50112function normalizeValue(value) { 50113 if (value === false || value == null) { 50114 return value; 50115 } 50116 50117 return utils$1.isArray(value) ? value.map(normalizeValue) : String(value); 50118} 50119 50120function parseTokens(str) { 50121 const tokens = Object.create(null); 50122 const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; 50123 let match; 50124 50125 while ((match = tokensRE.exec(str))) { 50126 tokens[match[1]] = match[2]; 50127 } 50128 50129 return tokens; 50130} 50131 50132const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim()); 50133 50134function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) { 50135 if (utils$1.isFunction(filter)) { 50136 return filter.call(this, value, header); 50137 } 50138 50139 if (isHeaderNameFilter) { 50140 value = header; 50141 } 50142 50143 if (!utils$1.isString(value)) return; 50144 50145 if (utils$1.isString(filter)) { 50146 return value.indexOf(filter) !== -1; 50147 } 50148 50149 if (utils$1.isRegExp(filter)) { 50150 return filter.test(value); 50151 } 50152} 50153 50154function formatHeader(header) { 50155 return header.trim() 50156 .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => { 50157 return char.toUpperCase() + str; 50158 }); 50159} 50160 50161function buildAccessors(obj, header) { 50162 const accessorName = utils$1.toCamelCase(' ' + header); 50163 50164 ['get', 'set', 'has'].forEach(methodName => { 50165 Object.defineProperty(obj, methodName + accessorName, { 50166 value: function(arg1, arg2, arg3) { 50167 return this[methodName].call(this, header, arg1, arg2, arg3); 50168 }, 50169 configurable: true 50170 }); 50171 }); 50172} 50173 50174class AxiosHeaders { 50175 constructor(headers) { 50176 headers && this.set(headers); 50177 } 50178 50179 set(header, valueOrRewrite, rewrite) { 50180 const self = this; 50181 50182 function setHeader(_value, _header, _rewrite) { 50183 const lHeader = normalizeHeader(_header); 50184 50185 if (!lHeader) { 50186 throw new Error('header name must be a non-empty string'); 50187 } 50188 50189 const key = utils$1.findKey(self, lHeader); 50190 50191 if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) { 50192 self[key || _header] = normalizeValue(_value); 50193 } 50194 } 50195 50196 const setHeaders = (headers, _rewrite) => 50197 utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite)); 50198 50199 if (utils$1.isPlainObject(header) || header instanceof this.constructor) { 50200 setHeaders(header, valueOrRewrite); 50201 } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) { 50202 setHeaders(parseHeaders(header), valueOrRewrite); 50203 } else if (utils$1.isHeaders(header)) { 50204 for (const [key, value] of header.entries()) { 50205 setHeader(value, key, rewrite); 50206 } 50207 } else { 50208 header != null && setHeader(valueOrRewrite, header, rewrite); 50209 } 50210 50211 return this; 50212 } 50213 50214 get(header, parser) { 50215 header = normalizeHeader(header); 50216 50217 if (header) { 50218 const key = utils$1.findKey(this, header); 50219 50220 if (key) { 50221 const value = this[key]; 50222 50223 if (!parser) { 50224 return value; 50225 } 50226 50227 if (parser === true) { 50228 return parseTokens(value); 50229 } 50230 50231 if (utils$1.isFunction(parser)) { 50232 return parser.call(this, value, key); 50233 } 50234 50235 if (utils$1.isRegExp(parser)) { 50236 return parser.exec(value); 50237 } 50238 50239 throw new TypeError('parser must be boolean|regexp|function'); 50240 } 50241 } 50242 } 50243 50244 has(header, matcher) { 50245 header = normalizeHeader(header); 50246 50247 if (header) { 50248 const key = utils$1.findKey(this, header); 50249 50250 return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher))); 50251 } 50252 50253 return false; 50254 } 50255 50256 delete(header, matcher) { 50257 const self = this; 50258 let deleted = false; 50259 50260 function deleteHeader(_header) { 50261 _header = normalizeHeader(_header); 50262 50263 if (_header) { 50264 const key = utils$1.findKey(self, _header); 50265 50266 if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) { 50267 delete self[key]; 50268 50269 deleted = true; 50270 } 50271 } 50272 } 50273 50274 if (utils$1.isArray(header)) { 50275 header.forEach(deleteHeader); 50276 } else { 50277 deleteHeader(header); 50278 } 50279 50280 return deleted; 50281 } 50282 50283 clear(matcher) { 50284 const keys = Object.keys(this); 50285 let i = keys.length; 50286 let deleted = false; 50287 50288 while (i--) { 50289 const key = keys[i]; 50290 if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) { 50291 delete this[key]; 50292 deleted = true; 50293 } 50294 } 50295 50296 return deleted; 50297 } 50298 50299 normalize(format) { 50300 const self = this; 50301 const headers = {}; 50302 50303 utils$1.forEach(this, (value, header) => { 50304 const key = utils$1.findKey(headers, header); 50305 50306 if (key) { 50307 self[key] = normalizeValue(value); 50308 delete self[header]; 50309 return; 50310 } 50311 50312 const normalized = format ? formatHeader(header) : String(header).trim(); 50313 50314 if (normalized !== header) { 50315 delete self[header]; 50316 } 50317 50318 self[normalized] = normalizeValue(value); 50319 50320 headers[normalized] = true; 50321 }); 50322 50323 return this; 50324 } 50325 50326 concat(...targets) { 50327 return this.constructor.concat(this, ...targets); 50328 } 50329 50330 toJSON(asStrings) { 50331 const obj = Object.create(null); 50332 50333 utils$1.forEach(this, (value, header) => { 50334 value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value); 50335 }); 50336 50337 return obj; 50338 } 50339 50340 [Symbol.iterator]() { 50341 return Object.entries(this.toJSON())[Symbol.iterator](); 50342 } 50343 50344 toString() { 50345 return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n'); 50346 } 50347 50348 get [Symbol.toStringTag]() { 50349 return 'AxiosHeaders'; 50350 } 50351 50352 static from(thing) { 50353 return thing instanceof this ? thing : new this(thing); 50354 } 50355 50356 static concat(first, ...targets) { 50357 const computed = new this(first); 50358 50359 targets.forEach((target) => computed.set(target)); 50360 50361 return computed; 50362 } 50363 50364 static accessor(header) { 50365 const internals = this[$internals] = (this[$internals] = { 50366 accessors: {} 50367 }); 50368 50369 const accessors = internals.accessors; 50370 const prototype = this.prototype; 50371 50372 function defineAccessor(_header) { 50373 const lHeader = normalizeHeader(_header); 50374 50375 if (!accessors[lHeader]) { 50376 buildAccessors(prototype, _header); 50377 accessors[lHeader] = true; 50378 } 50379 } 50380 50381 utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header); 50382 50383 return this; 50384 } 50385} 50386 50387AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']); 50388 50389// reserved names hotfix 50390utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => { 50391 let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set` 50392 return { 50393 get: () => value, 50394 set(headerValue) { 50395 this[mapped] = headerValue; 50396 } 50397 } 50398}); 50399 50400utils$1.freezeMethods(AxiosHeaders); 50401 50402var AxiosHeaders$1 = AxiosHeaders; 50403 50404/** 50405 * Transform the data for a request or a response 50406 * 50407 * @param {Array|Function} fns A single function or Array of functions 50408 * @param {?Object} response The response object 50409 * 50410 * @returns {*} The resulting transformed data 50411 */ 50412function transformData(fns, response) { 50413 const config = this || defaults$1; 50414 const context = response || config; 50415 const headers = AxiosHeaders$1.from(context.headers); 50416 let data = context.data; 50417 50418 utils$1.forEach(fns, function transform(fn) { 50419 data = fn.call(config, data, headers.normalize(), response ? response.status : undefined); 50420 }); 50421 50422 headers.normalize(); 50423 50424 return data; 50425} 50426 50427function isCancel(value) { 50428 return !!(value && value.__CANCEL__); 50429} 50430 50431/** 50432 * A `CanceledError` is an object that is thrown when an operation is canceled. 50433 * 50434 * @param {string=} message The message. 50435 * @param {Object=} config The config. 50436 * @param {Object=} request The request. 50437 * 50438 * @returns {CanceledError} The created error. 50439 */ 50440function CanceledError(message, config, request) { 50441 // eslint-disable-next-line no-eq-null,eqeqeq 50442 AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request); 50443 this.name = 'CanceledError'; 50444} 50445 50446utils$1.inherits(CanceledError, AxiosError, { 50447 __CANCEL__: true 50448}); 50449 50450/** 50451 * Resolve or reject a Promise based on response status. 50452 * 50453 * @param {Function} resolve A function that resolves the promise. 50454 * @param {Function} reject A function that rejects the promise. 50455 * @param {object} response The response. 50456 * 50457 * @returns {object} The response. 50458 */ 50459function settle(resolve, reject, response) { 50460 const validateStatus = response.config.validateStatus; 50461 if (!response.status || !validateStatus || validateStatus(response.status)) { 50462 resolve(response); 50463 } else { 50464 reject(new AxiosError( 50465 'Request failed with status code ' + response.status, 50466 [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], 50467 response.config, 50468 response.request, 50469 response 50470 )); 50471 } 50472} 50473 50474function parseProtocol(url) { 50475 const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); 50476 return match && match[1] || ''; 50477} 50478 50479/** 50480 * Calculate data maxRate 50481 * @param {Number} [samplesCount= 10] 50482 * @param {Number} [min= 1000] 50483 * @returns {Function} 50484 */ 50485function speedometer(samplesCount, min) { 50486 samplesCount = samplesCount || 10; 50487 const bytes = new Array(samplesCount); 50488 const timestamps = new Array(samplesCount); 50489 let head = 0; 50490 let tail = 0; 50491 let firstSampleTS; 50492 50493 min = min !== undefined ? min : 1000; 50494 50495 return function push(chunkLength) { 50496 const now = Date.now(); 50497 50498 const startedAt = timestamps[tail]; 50499 50500 if (!firstSampleTS) { 50501 firstSampleTS = now; 50502 } 50503 50504 bytes[head] = chunkLength; 50505 timestamps[head] = now; 50506 50507 let i = tail; 50508 let bytesCount = 0; 50509 50510 while (i !== head) { 50511 bytesCount += bytes[i++]; 50512 i = i % samplesCount; 50513 } 50514 50515 head = (head + 1) % samplesCount; 50516 50517 if (head === tail) { 50518 tail = (tail + 1) % samplesCount; 50519 } 50520 50521 if (now - firstSampleTS < min) { 50522 return; 50523 } 50524 50525 const passed = startedAt && now - startedAt; 50526 50527 return passed ? Math.round(bytesCount * 1000 / passed) : undefined; 50528 }; 50529} 50530 50531/** 50532 * Throttle decorator 50533 * @param {Function} fn 50534 * @param {Number} freq 50535 * @return {Function} 50536 */ 50537function throttle(fn, freq) { 50538 let timestamp = 0; 50539 let threshold = 1000 / freq; 50540 let lastArgs; 50541 let timer; 50542 50543 const invoke = (args, now = Date.now()) => { 50544 timestamp = now; 50545 lastArgs = null; 50546 if (timer) { 50547 clearTimeout(timer); 50548 timer = null; 50549 } 50550 fn.apply(null, args); 50551 }; 50552 50553 const throttled = (...args) => { 50554 const now = Date.now(); 50555 const passed = now - timestamp; 50556 if ( passed >= threshold) { 50557 invoke(args, now); 50558 } else { 50559 lastArgs = args; 50560 if (!timer) { 50561 timer = setTimeout(() => { 50562 timer = null; 50563 invoke(lastArgs); 50564 }, threshold - passed); 50565 } 50566 } 50567 }; 50568 50569 const flush = () => lastArgs && invoke(lastArgs); 50570 50571 return [throttled, flush]; 50572} 50573 50574const progressEventReducer = (listener, isDownloadStream, freq = 3) => { 50575 let bytesNotified = 0; 50576 const _speedometer = speedometer(50, 250); 50577 50578 return throttle(e => { 50579 const loaded = e.loaded; 50580 const total = e.lengthComputable ? e.total : undefined; 50581 const progressBytes = loaded - bytesNotified; 50582 const rate = _speedometer(progressBytes); 50583 const inRange = loaded <= total; 50584 50585 bytesNotified = loaded; 50586 50587 const data = { 50588 loaded, 50589 total, 50590 progress: total ? (loaded / total) : undefined, 50591 bytes: progressBytes, 50592 rate: rate ? rate : undefined, 50593 estimated: rate && total && inRange ? (total - loaded) / rate : undefined, 50594 event: e, 50595 lengthComputable: total != null, 50596 [isDownloadStream ? 'download' : 'upload']: true 50597 }; 50598 50599 listener(data); 50600 }, freq); 50601}; 50602 50603const progressEventDecorator = (total, throttled) => { 50604 const lengthComputable = total != null; 50605 50606 return [(loaded) => throttled[0]({ 50607 lengthComputable, 50608 total, 50609 loaded 50610 }), throttled[1]]; 50611}; 50612 50613const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args)); 50614 50615var isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => { 50616 url = new URL(url, platform.origin); 50617 50618 return ( 50619 origin.protocol === url.protocol && 50620 origin.host === url.host && 50621 (isMSIE || origin.port === url.port) 50622 ); 50623})( 50624 new URL(platform.origin), 50625 platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent) 50626) : () => true; 50627 50628var cookies = platform.hasStandardBrowserEnv ? 50629 50630 // Standard browser envs support document.cookie 50631 { 50632 write(name, value, expires, path, domain, secure) { 50633 const cookie = [name + '=' + encodeURIComponent(value)]; 50634 50635 utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString()); 50636 50637 utils$1.isString(path) && cookie.push('path=' + path); 50638 50639 utils$1.isString(domain) && cookie.push('domain=' + domain); 50640 50641 secure === true && cookie.push('secure'); 50642 50643 document.cookie = cookie.join('; '); 50644 }, 50645 50646 read(name) { 50647 const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); 50648 return (match ? decodeURIComponent(match[3]) : null); 50649 }, 50650 50651 remove(name) { 50652 this.write(name, '', Date.now() - 86400000); 50653 } 50654 } 50655 50656 : 50657 50658 // Non-standard browser env (web workers, react-native) lack needed support. 50659 { 50660 write() {}, 50661 read() { 50662 return null; 50663 }, 50664 remove() {} 50665 }; 50666 50667/** 50668 * Determines whether the specified URL is absolute 50669 * 50670 * @param {string} url The URL to test 50671 * 50672 * @returns {boolean} True if the specified URL is absolute, otherwise false 50673 */ 50674function isAbsoluteURL(url) { 50675 // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL). 50676 // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed 50677 // by any combination of letters, digits, plus, period, or hyphen. 50678 return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); 50679} 50680 50681/** 50682 * Creates a new URL by combining the specified URLs 50683 * 50684 * @param {string} baseURL The base URL 50685 * @param {string} relativeURL The relative URL 50686 * 50687 * @returns {string} The combined URL 50688 */ 50689function combineURLs(baseURL, relativeURL) { 50690 return relativeURL 50691 ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') 50692 : baseURL; 50693} 50694 50695/** 50696 * Creates a new URL by combining the baseURL with the requestedURL, 50697 * only when the requestedURL is not already an absolute URL. 50698 * If the requestURL is absolute, this function returns the requestedURL untouched. 50699 * 50700 * @param {string} baseURL The base URL 50701 * @param {string} requestedURL Absolute or relative URL to combine 50702 * 50703 * @returns {string} The combined full path 50704 */ 50705function buildFullPath(baseURL, requestedURL) { 50706 if (baseURL && !isAbsoluteURL(requestedURL)) { 50707 return combineURLs(baseURL, requestedURL); 50708 } 50709 return requestedURL; 50710} 50711 50712const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing; 50713 50714/** 50715 * Config-specific merge-function which creates a new config-object 50716 * by merging two configuration objects together. 50717 * 50718 * @param {Object} config1 50719 * @param {Object} config2 50720 * 50721 * @returns {Object} New object resulting from merging config2 to config1 50722 */ 50723function mergeConfig(config1, config2) { 50724 // eslint-disable-next-line no-param-reassign 50725 config2 = config2 || {}; 50726 const config = {}; 50727 50728 function getMergedValue(target, source, prop, caseless) { 50729 if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) { 50730 return utils$1.merge.call({caseless}, target, source); 50731 } else if (utils$1.isPlainObject(source)) { 50732 return utils$1.merge({}, source); 50733 } else if (utils$1.isArray(source)) { 50734 return source.slice(); 50735 } 50736 return source; 50737 } 50738 50739 // eslint-disable-next-line consistent-return 50740 function mergeDeepProperties(a, b, prop , caseless) { 50741 if (!utils$1.isUndefined(b)) { 50742 return getMergedValue(a, b, prop , caseless); 50743 } else if (!utils$1.isUndefined(a)) { 50744 return getMergedValue(undefined, a, prop , caseless); 50745 } 50746 } 50747 50748 // eslint-disable-next-line consistent-return 50749 function valueFromConfig2(a, b) { 50750 if (!utils$1.isUndefined(b)) { 50751 return getMergedValue(undefined, b); 50752 } 50753 } 50754 50755 // eslint-disable-next-line consistent-return 50756 function defaultToConfig2(a, b) { 50757 if (!utils$1.isUndefined(b)) { 50758 return getMergedValue(undefined, b); 50759 } else if (!utils$1.isUndefined(a)) { 50760 return getMergedValue(undefined, a); 50761 } 50762 } 50763 50764 // eslint-disable-next-line consistent-return 50765 function mergeDirectKeys(a, b, prop) { 50766 if (prop in config2) { 50767 return getMergedValue(a, b); 50768 } else if (prop in config1) { 50769 return getMergedValue(undefined, a); 50770 } 50771 } 50772 50773 const mergeMap = { 50774 url: valueFromConfig2, 50775 method: valueFromConfig2, 50776 data: valueFromConfig2, 50777 baseURL: defaultToConfig2, 50778 transformRequest: defaultToConfig2, 50779 transformResponse: defaultToConfig2, 50780 paramsSerializer: defaultToConfig2, 50781 timeout: defaultToConfig2, 50782 timeoutMessage: defaultToConfig2, 50783 withCredentials: defaultToConfig2, 50784 withXSRFToken: defaultToConfig2, 50785 adapter: defaultToConfig2, 50786 responseType: defaultToConfig2, 50787 xsrfCookieName: defaultToConfig2, 50788 xsrfHeaderName: defaultToConfig2, 50789 onUploadProgress: defaultToConfig2, 50790 onDownloadProgress: defaultToConfig2, 50791 decompress: defaultToConfig2, 50792 maxContentLength: defaultToConfig2, 50793 maxBodyLength: defaultToConfig2, 50794 beforeRedirect: defaultToConfig2, 50795 transport: defaultToConfig2, 50796 httpAgent: defaultToConfig2, 50797 httpsAgent: defaultToConfig2, 50798 cancelToken: defaultToConfig2, 50799 socketPath: defaultToConfig2, 50800 responseEncoding: defaultToConfig2, 50801 validateStatus: mergeDirectKeys, 50802 headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true) 50803 }; 50804 50805 utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) { 50806 const merge = mergeMap[prop] || mergeDeepProperties; 50807 const configValue = merge(config1[prop], config2[prop], prop); 50808 (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue); 50809 }); 50810 50811 return config; 50812} 50813 50814var resolveConfig = (config) => { 50815 const newConfig = mergeConfig({}, config); 50816 50817 let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig; 50818 50819 newConfig.headers = headers = AxiosHeaders$1.from(headers); 50820 50821 newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer); 50822 50823 // HTTP basic authentication 50824 if (auth) { 50825 headers.set('Authorization', 'Basic ' + 50826 btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')) 50827 ); 50828 } 50829 50830 let contentType; 50831 50832 if (utils$1.isFormData(data)) { 50833 if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) { 50834 headers.setContentType(undefined); // Let the browser set it 50835 } else if ((contentType = headers.getContentType()) !== false) { 50836 // fix semicolon duplication issue for ReactNative FormData implementation 50837 const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : []; 50838 headers.setContentType([type || 'multipart/form-data', ...tokens].join('; ')); 50839 } 50840 } 50841 50842 // Add xsrf header 50843 // This is only done if running in a standard browser environment. 50844 // Specifically not if we're in a web worker, or react-native. 50845 50846 if (platform.hasStandardBrowserEnv) { 50847 withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig)); 50848 50849 if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) { 50850 // Add xsrf header 50851 const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName); 50852 50853 if (xsrfValue) { 50854 headers.set(xsrfHeaderName, xsrfValue); 50855 } 50856 } 50857 } 50858 50859 return newConfig; 50860}; 50861 50862const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined'; 50863 50864var xhrAdapter = isXHRAdapterSupported && function (config) { 50865 return new Promise(function dispatchXhrRequest(resolve, reject) { 50866 const _config = resolveConfig(config); 50867 let requestData = _config.data; 50868 const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize(); 50869 let {responseType, onUploadProgress, onDownloadProgress} = _config; 50870 let onCanceled; 50871 let uploadThrottled, downloadThrottled; 50872 let flushUpload, flushDownload; 50873 50874 function done() { 50875 flushUpload && flushUpload(); // flush events 50876 flushDownload && flushDownload(); // flush events 50877 50878 _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled); 50879 50880 _config.signal && _config.signal.removeEventListener('abort', onCanceled); 50881 } 50882 50883 let request = new XMLHttpRequest(); 50884 50885 request.open(_config.method.toUpperCase(), _config.url, true); 50886 50887 // Set the request timeout in MS 50888 request.timeout = _config.timeout; 50889 50890 function onloadend() { 50891 if (!request) { 50892 return; 50893 } 50894 // Prepare the response 50895 const responseHeaders = AxiosHeaders$1.from( 50896 'getAllResponseHeaders' in request && request.getAllResponseHeaders() 50897 ); 50898 const responseData = !responseType || responseType === 'text' || responseType === 'json' ? 50899 request.responseText : request.response; 50900 const response = { 50901 data: responseData, 50902 status: request.status, 50903 statusText: request.statusText, 50904 headers: responseHeaders, 50905 config, 50906 request 50907 }; 50908 50909 settle(function _resolve(value) { 50910 resolve(value); 50911 done(); 50912 }, function _reject(err) { 50913 reject(err); 50914 done(); 50915 }, response); 50916 50917 // Clean up request 50918 request = null; 50919 } 50920 50921 if ('onloadend' in request) { 50922 // Use onloadend if available 50923 request.onloadend = onloadend; 50924 } else { 50925 // Listen for ready state to emulate onloadend 50926 request.onreadystatechange = function handleLoad() { 50927 if (!request || request.readyState !== 4) { 50928 return; 50929 } 50930 50931 // The request errored out and we didn't get a response, this will be 50932 // handled by onerror instead 50933 // With one exception: request that using file: protocol, most browsers 50934 // will return status as 0 even though it's a successful request 50935 if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { 50936 return; 50937 } 50938 // readystate handler is calling before onerror or ontimeout handlers, 50939 // so we should call onloadend on the next 'tick' 50940 setTimeout(onloadend); 50941 }; 50942 } 50943 50944 // Handle browser request cancellation (as opposed to a manual cancellation) 50945 request.onabort = function handleAbort() { 50946 if (!request) { 50947 return; 50948 } 50949 50950 reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request)); 50951 50952 // Clean up request 50953 request = null; 50954 }; 50955 50956 // Handle low level network errors 50957 request.onerror = function handleError() { 50958 // Real errors are hidden from us by the browser 50959 // onerror should only fire if it's a network error 50960 reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request)); 50961 50962 // Clean up request 50963 request = null; 50964 }; 50965 50966 // Handle timeout 50967 request.ontimeout = function handleTimeout() { 50968 let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded'; 50969 const transitional = _config.transitional || transitionalDefaults; 50970 if (_config.timeoutErrorMessage) { 50971 timeoutErrorMessage = _config.timeoutErrorMessage; 50972 } 50973 reject(new AxiosError( 50974 timeoutErrorMessage, 50975 transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, 50976 config, 50977 request)); 50978 50979 // Clean up request 50980 request = null; 50981 }; 50982 50983 // Remove Content-Type if data is undefined 50984 requestData === undefined && requestHeaders.setContentType(null); 50985 50986 // Add headers to the request 50987 if ('setRequestHeader' in request) { 50988 utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) { 50989 request.setRequestHeader(key, val); 50990 }); 50991 } 50992 50993 // Add withCredentials to request if needed 50994 if (!utils$1.isUndefined(_config.withCredentials)) { 50995 request.withCredentials = !!_config.withCredentials; 50996 } 50997 50998 // Add responseType to request if needed 50999 if (responseType && responseType !== 'json') { 51000 request.responseType = _config.responseType; 51001 } 51002 51003 // Handle progress if needed 51004 if (onDownloadProgress) { 51005 ([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true)); 51006 request.addEventListener('progress', downloadThrottled); 51007 } 51008 51009 // Not all browsers support upload events 51010 if (onUploadProgress && request.upload) { 51011 ([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress)); 51012 51013 request.upload.addEventListener('progress', uploadThrottled); 51014 51015 request.upload.addEventListener('loadend', flushUpload); 51016 } 51017 51018 if (_config.cancelToken || _config.signal) { 51019 // Handle cancellation 51020 // eslint-disable-next-line func-names 51021 onCanceled = cancel => { 51022 if (!request) { 51023 return; 51024 } 51025 reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel); 51026 request.abort(); 51027 request = null; 51028 }; 51029 51030 _config.cancelToken && _config.cancelToken.subscribe(onCanceled); 51031 if (_config.signal) { 51032 _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled); 51033 } 51034 } 51035 51036 const protocol = parseProtocol(_config.url); 51037 51038 if (protocol && platform.protocols.indexOf(protocol) === -1) { 51039 reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config)); 51040 return; 51041 } 51042 51043 51044 // Send the request 51045 request.send(requestData || null); 51046 }); 51047}; 51048 51049const composeSignals = (signals, timeout) => { 51050 const {length} = (signals = signals ? signals.filter(Boolean) : []); 51051 51052 if (timeout || length) { 51053 let controller = new AbortController(); 51054 51055 let aborted; 51056 51057 const onabort = function (reason) { 51058 if (!aborted) { 51059 aborted = true; 51060 unsubscribe(); 51061 const err = reason instanceof Error ? reason : this.reason; 51062 controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err)); 51063 } 51064 }; 51065 51066 let timer = timeout && setTimeout(() => { 51067 timer = null; 51068 onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT)); 51069 }, timeout); 51070 51071 const unsubscribe = () => { 51072 if (signals) { 51073 timer && clearTimeout(timer); 51074 timer = null; 51075 signals.forEach(signal => { 51076 signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort); 51077 }); 51078 signals = null; 51079 } 51080 }; 51081 51082 signals.forEach((signal) => signal.addEventListener('abort', onabort)); 51083 51084 const {signal} = controller; 51085 51086 signal.unsubscribe = () => utils$1.asap(unsubscribe); 51087 51088 return signal; 51089 } 51090}; 51091 51092var composeSignals$1 = composeSignals; 51093 51094const streamChunk = function* (chunk, chunkSize) { 51095 let len = chunk.byteLength; 51096 51097 if (!chunkSize || len < chunkSize) { 51098 yield chunk; 51099 return; 51100 } 51101 51102 let pos = 0; 51103 let end; 51104 51105 while (pos < len) { 51106 end = pos + chunkSize; 51107 yield chunk.slice(pos, end); 51108 pos = end; 51109 } 51110}; 51111 51112const readBytes = async function* (iterable, chunkSize) { 51113 for await (const chunk of readStream(iterable)) { 51114 yield* streamChunk(chunk, chunkSize); 51115 } 51116}; 51117 51118const readStream = async function* (stream) { 51119 if (stream[Symbol.asyncIterator]) { 51120 yield* stream; 51121 return; 51122 } 51123 51124 const reader = stream.getReader(); 51125 try { 51126 for (;;) { 51127 const {done, value} = await reader.read(); 51128 if (done) { 51129 break; 51130 } 51131 yield value; 51132 } 51133 } finally { 51134 await reader.cancel(); 51135 } 51136}; 51137 51138const trackStream = (stream, chunkSize, onProgress, onFinish) => { 51139 const iterator = readBytes(stream, chunkSize); 51140 51141 let bytes = 0; 51142 let done; 51143 let _onFinish = (e) => { 51144 if (!done) { 51145 done = true; 51146 onFinish && onFinish(e); 51147 } 51148 }; 51149 51150 return new ReadableStream({ 51151 async pull(controller) { 51152 try { 51153 const {done, value} = await iterator.next(); 51154 51155 if (done) { 51156 _onFinish(); 51157 controller.close(); 51158 return; 51159 } 51160 51161 let len = value.byteLength; 51162 if (onProgress) { 51163 let loadedBytes = bytes += len; 51164 onProgress(loadedBytes); 51165 } 51166 controller.enqueue(new Uint8Array(value)); 51167 } catch (err) { 51168 _onFinish(err); 51169 throw err; 51170 } 51171 }, 51172 cancel(reason) { 51173 _onFinish(reason); 51174 return iterator.return(); 51175 } 51176 }, { 51177 highWaterMark: 2 51178 }) 51179}; 51180 51181const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function'; 51182const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function'; 51183 51184// used only inside the fetch adapter 51185const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? 51186 ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : 51187 async (str) => new Uint8Array(await new Response(str).arrayBuffer()) 51188); 51189 51190const test = (fn, ...args) => { 51191 try { 51192 return !!fn(...args); 51193 } catch (e) { 51194 return false 51195 } 51196}; 51197 51198const supportsRequestStream = isReadableStreamSupported && test(() => { 51199 let duplexAccessed = false; 51200 51201 const hasContentType = new Request(platform.origin, { 51202 body: new ReadableStream(), 51203 method: 'POST', 51204 get duplex() { 51205 duplexAccessed = true; 51206 return 'half'; 51207 }, 51208 }).headers.has('Content-Type'); 51209 51210 return duplexAccessed && !hasContentType; 51211}); 51212 51213const DEFAULT_CHUNK_SIZE = 64 * 1024; 51214 51215const supportsResponseStream = isReadableStreamSupported && 51216 test(() => utils$1.isReadableStream(new Response('').body)); 51217 51218 51219const resolvers = { 51220 stream: supportsResponseStream && ((res) => res.body) 51221}; 51222 51223isFetchSupported && (((res) => { 51224 ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => { 51225 !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() : 51226 (_, config) => { 51227 throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config); 51228 }); 51229 }); 51230})(new Response)); 51231 51232const getBodyLength = async (body) => { 51233 if (body == null) { 51234 return 0; 51235 } 51236 51237 if(utils$1.isBlob(body)) { 51238 return body.size; 51239 } 51240 51241 if(utils$1.isSpecCompliantForm(body)) { 51242 const _request = new Request(platform.origin, { 51243 method: 'POST', 51244 body, 51245 }); 51246 return (await _request.arrayBuffer()).byteLength; 51247 } 51248 51249 if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) { 51250 return body.byteLength; 51251 } 51252 51253 if(utils$1.isURLSearchParams(body)) { 51254 body = body + ''; 51255 } 51256 51257 if(utils$1.isString(body)) { 51258 return (await encodeText(body)).byteLength; 51259 } 51260}; 51261 51262const resolveBodyLength = async (headers, body) => { 51263 const length = utils$1.toFiniteNumber(headers.getContentLength()); 51264 51265 return length == null ? getBodyLength(body) : length; 51266}; 51267 51268var fetchAdapter = isFetchSupported && (async (config) => { 51269 let { 51270 url, 51271 method, 51272 data, 51273 signal, 51274 cancelToken, 51275 timeout, 51276 onDownloadProgress, 51277 onUploadProgress, 51278 responseType, 51279 headers, 51280 withCredentials = 'same-origin', 51281 fetchOptions 51282 } = resolveConfig(config); 51283 51284 responseType = responseType ? (responseType + '').toLowerCase() : 'text'; 51285 51286 let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout); 51287 51288 let request; 51289 51290 const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => { 51291 composedSignal.unsubscribe(); 51292 }); 51293 51294 let requestContentLength; 51295 51296 try { 51297 if ( 51298 onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' && 51299 (requestContentLength = await resolveBodyLength(headers, data)) !== 0 51300 ) { 51301 let _request = new Request(url, { 51302 method: 'POST', 51303 body: data, 51304 duplex: "half" 51305 }); 51306 51307 let contentTypeHeader; 51308 51309 if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) { 51310 headers.setContentType(contentTypeHeader); 51311 } 51312 51313 if (_request.body) { 51314 const [onProgress, flush] = progressEventDecorator( 51315 requestContentLength, 51316 progressEventReducer(asyncDecorator(onUploadProgress)) 51317 ); 51318 51319 data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush); 51320 } 51321 } 51322 51323 if (!utils$1.isString(withCredentials)) { 51324 withCredentials = withCredentials ? 'include' : 'omit'; 51325 } 51326 51327 // Cloudflare Workers throws when credentials are defined 51328 // see https://github.com/cloudflare/workerd/issues/902 51329 const isCredentialsSupported = "credentials" in Request.prototype; 51330 request = new Request(url, { 51331 ...fetchOptions, 51332 signal: composedSignal, 51333 method: method.toUpperCase(), 51334 headers: headers.normalize().toJSON(), 51335 body: data, 51336 duplex: "half", 51337 credentials: isCredentialsSupported ? withCredentials : undefined 51338 }); 51339 51340 let response = await fetch(request); 51341 51342 const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response'); 51343 51344 if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) { 51345 const options = {}; 51346 51347 ['status', 'statusText', 'headers'].forEach(prop => { 51348 options[prop] = response[prop]; 51349 }); 51350 51351 const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length')); 51352 51353 const [onProgress, flush] = onDownloadProgress && progressEventDecorator( 51354 responseContentLength, 51355 progressEventReducer(asyncDecorator(onDownloadProgress), true) 51356 ) || []; 51357 51358 response = new Response( 51359 trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => { 51360 flush && flush(); 51361 unsubscribe && unsubscribe(); 51362 }), 51363 options 51364 ); 51365 } 51366 51367 responseType = responseType || 'text'; 51368 51369 let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config); 51370 51371 !isStreamResponse && unsubscribe && unsubscribe(); 51372 51373 return await new Promise((resolve, reject) => { 51374 settle(resolve, reject, { 51375 data: responseData, 51376 headers: AxiosHeaders$1.from(response.headers), 51377 status: response.status, 51378 statusText: response.statusText, 51379 config, 51380 request 51381 }); 51382 }) 51383 } catch (err) { 51384 unsubscribe && unsubscribe(); 51385 51386 if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) { 51387 throw Object.assign( 51388 new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), 51389 { 51390 cause: err.cause || err 51391 } 51392 ) 51393 } 51394 51395 throw AxiosError.from(err, err && err.code, config, request); 51396 } 51397}); 51398 51399const knownAdapters = { 51400 http: httpAdapter, 51401 xhr: xhrAdapter, 51402 fetch: fetchAdapter 51403}; 51404 51405utils$1.forEach(knownAdapters, (fn, value) => { 51406 if (fn) { 51407 try { 51408 Object.defineProperty(fn, 'name', {value}); 51409 } catch (e) { 51410 // eslint-disable-next-line no-empty 51411 } 51412 Object.defineProperty(fn, 'adapterName', {value}); 51413 } 51414}); 51415 51416const renderReason = (reason) => `- ${reason}`; 51417 51418const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false; 51419 51420var adapters = { 51421 getAdapter: (adapters) => { 51422 adapters = utils$1.isArray(adapters) ? adapters : [adapters]; 51423 51424 const {length} = adapters; 51425 let nameOrAdapter; 51426 let adapter; 51427 51428 const rejectedReasons = {}; 51429 51430 for (let i = 0; i < length; i++) { 51431 nameOrAdapter = adapters[i]; 51432 let id; 51433 51434 adapter = nameOrAdapter; 51435 51436 if (!isResolvedHandle(nameOrAdapter)) { 51437 adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()]; 51438 51439 if (adapter === undefined) { 51440 throw new AxiosError(`Unknown adapter '${id}'`); 51441 } 51442 } 51443 51444 if (adapter) { 51445 break; 51446 } 51447 51448 rejectedReasons[id || '#' + i] = adapter; 51449 } 51450 51451 if (!adapter) { 51452 51453 const reasons = Object.entries(rejectedReasons) 51454 .map(([id, state]) => `adapter ${id} ` + 51455 (state === false ? 'is not supported by the environment' : 'is not available in the build') 51456 ); 51457 51458 let s = length ? 51459 (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) : 51460 'as no adapter specified'; 51461 51462 throw new AxiosError( 51463 `There is no suitable adapter to dispatch the request ` + s, 51464 'ERR_NOT_SUPPORT' 51465 ); 51466 } 51467 51468 return adapter; 51469 }, 51470 adapters: knownAdapters 51471}; 51472 51473/** 51474 * Throws a `CanceledError` if cancellation has been requested. 51475 * 51476 * @param {Object} config The config that is to be used for the request 51477 * 51478 * @returns {void} 51479 */ 51480function throwIfCancellationRequested(config) { 51481 if (config.cancelToken) { 51482 config.cancelToken.throwIfRequested(); 51483 } 51484 51485 if (config.signal && config.signal.aborted) { 51486 throw new CanceledError(null, config); 51487 } 51488} 51489 51490/** 51491 * Dispatch a request to the server using the configured adapter. 51492 * 51493 * @param {object} config The config that is to be used for the request 51494 * 51495 * @returns {Promise} The Promise to be fulfilled 51496 */ 51497function dispatchRequest(config) { 51498 throwIfCancellationRequested(config); 51499 51500 config.headers = AxiosHeaders$1.from(config.headers); 51501 51502 // Transform request data 51503 config.data = transformData.call( 51504 config, 51505 config.transformRequest 51506 ); 51507 51508 if (['post', 'put', 'patch'].indexOf(config.method) !== -1) { 51509 config.headers.setContentType('application/x-www-form-urlencoded', false); 51510 } 51511 51512 const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter); 51513 51514 return adapter(config).then(function onAdapterResolution(response) { 51515 throwIfCancellationRequested(config); 51516 51517 // Transform response data 51518 response.data = transformData.call( 51519 config, 51520 config.transformResponse, 51521 response 51522 ); 51523 51524 response.headers = AxiosHeaders$1.from(response.headers); 51525 51526 return response; 51527 }, function onAdapterRejection(reason) { 51528 if (!isCancel(reason)) { 51529 throwIfCancellationRequested(config); 51530 51531 // Transform response data 51532 if (reason && reason.response) { 51533 reason.response.data = transformData.call( 51534 config, 51535 config.transformResponse, 51536 reason.response 51537 ); 51538 reason.response.headers = AxiosHeaders$1.from(reason.response.headers); 51539 } 51540 } 51541 51542 return Promise.reject(reason); 51543 }); 51544} 51545 51546const VERSION = "1.7.9"; 51547 51548const validators$1 = {}; 51549 51550// eslint-disable-next-line func-names 51551['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => { 51552 validators$1[type] = function validator(thing) { 51553 return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; 51554 }; 51555}); 51556 51557const deprecatedWarnings = {}; 51558 51559/** 51560 * Transitional option validator 51561 * 51562 * @param {function|boolean?} validator - set to false if the transitional option has been removed 51563 * @param {string?} version - deprecated version / removed since version 51564 * @param {string?} message - some message with additional info 51565 * 51566 * @returns {function} 51567 */ 51568validators$1.transitional = function transitional(validator, version, message) { 51569 function formatMessage(opt, desc) { 51570 return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); 51571 } 51572 51573 // eslint-disable-next-line func-names 51574 return (value, opt, opts) => { 51575 if (validator === false) { 51576 throw new AxiosError( 51577 formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), 51578 AxiosError.ERR_DEPRECATED 51579 ); 51580 } 51581 51582 if (version && !deprecatedWarnings[opt]) { 51583 deprecatedWarnings[opt] = true; 51584 // eslint-disable-next-line no-console 51585 console.warn( 51586 formatMessage( 51587 opt, 51588 ' has been deprecated since v' + version + ' and will be removed in the near future' 51589 ) 51590 ); 51591 } 51592 51593 return validator ? validator(value, opt, opts) : true; 51594 }; 51595}; 51596 51597validators$1.spelling = function spelling(correctSpelling) { 51598 return (value, opt) => { 51599 // eslint-disable-next-line no-console 51600 console.warn(`${opt} is likely a misspelling of ${correctSpelling}`); 51601 return true; 51602 } 51603}; 51604 51605/** 51606 * Assert object's properties type 51607 * 51608 * @param {object} options 51609 * @param {object} schema 51610 * @param {boolean?} allowUnknown 51611 * 51612 * @returns {object} 51613 */ 51614 51615function assertOptions(options, schema, allowUnknown) { 51616 if (typeof options !== 'object') { 51617 throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE); 51618 } 51619 const keys = Object.keys(options); 51620 let i = keys.length; 51621 while (i-- > 0) { 51622 const opt = keys[i]; 51623 const validator = schema[opt]; 51624 if (validator) { 51625 const value = options[opt]; 51626 const result = value === undefined || validator(value, opt, options); 51627 if (result !== true) { 51628 throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE); 51629 } 51630 continue; 51631 } 51632 if (allowUnknown !== true) { 51633 throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION); 51634 } 51635 } 51636} 51637 51638var validator = { 51639 assertOptions, 51640 validators: validators$1 51641}; 51642 51643const validators = validator.validators; 51644 51645/** 51646 * Create a new instance of Axios 51647 * 51648 * @param {Object} instanceConfig The default config for the instance 51649 * 51650 * @return {Axios} A new instance of Axios 51651 */ 51652class Axios { 51653 constructor(instanceConfig) { 51654 this.defaults = instanceConfig; 51655 this.interceptors = { 51656 request: new InterceptorManager$1(), 51657 response: new InterceptorManager$1() 51658 }; 51659 } 51660 51661 /** 51662 * Dispatch a request 51663 * 51664 * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) 51665 * @param {?Object} config 51666 * 51667 * @returns {Promise} The Promise to be fulfilled 51668 */ 51669 async request(configOrUrl, config) { 51670 try { 51671 return await this._request(configOrUrl, config); 51672 } catch (err) { 51673 if (err instanceof Error) { 51674 let dummy = {}; 51675 51676 Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error()); 51677 51678 // slice off the Error: ... line 51679 const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : ''; 51680 try { 51681 if (!err.stack) { 51682 err.stack = stack; 51683 // match without the 2 top stack lines 51684 } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) { 51685 err.stack += '\n' + stack; 51686 } 51687 } catch (e) { 51688 // ignore the case where "stack" is an un-writable property 51689 } 51690 } 51691 51692 throw err; 51693 } 51694 } 51695 51696 _request(configOrUrl, config) { 51697 /*eslint no-param-reassign:0*/ 51698 // Allow for axios('example/url'[, config]) a la fetch API 51699 if (typeof configOrUrl === 'string') { 51700 config = config || {}; 51701 config.url = configOrUrl; 51702 } else { 51703 config = configOrUrl || {}; 51704 } 51705 51706 config = mergeConfig(this.defaults, config); 51707 51708 const {transitional, paramsSerializer, headers} = config; 51709 51710 if (transitional !== undefined) { 51711 validator.assertOptions(transitional, { 51712 silentJSONParsing: validators.transitional(validators.boolean), 51713 forcedJSONParsing: validators.transitional(validators.boolean), 51714 clarifyTimeoutError: validators.transitional(validators.boolean) 51715 }, false); 51716 } 51717 51718 if (paramsSerializer != null) { 51719 if (utils$1.isFunction(paramsSerializer)) { 51720 config.paramsSerializer = { 51721 serialize: paramsSerializer 51722 }; 51723 } else { 51724 validator.assertOptions(paramsSerializer, { 51725 encode: validators.function, 51726 serialize: validators.function 51727 }, true); 51728 } 51729 } 51730 51731 validator.assertOptions(config, { 51732 baseUrl: validators.spelling('baseURL'), 51733 withXsrfToken: validators.spelling('withXSRFToken') 51734 }, true); 51735 51736 // Set config.method 51737 config.method = (config.method || this.defaults.method || 'get').toLowerCase(); 51738 51739 // Flatten headers 51740 let contextHeaders = headers && utils$1.merge( 51741 headers.common, 51742 headers[config.method] 51743 ); 51744 51745 headers && utils$1.forEach( 51746 ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], 51747 (method) => { 51748 delete headers[method]; 51749 } 51750 ); 51751 51752 config.headers = AxiosHeaders$1.concat(contextHeaders, headers); 51753 51754 // filter out skipped interceptors 51755 const requestInterceptorChain = []; 51756 let synchronousRequestInterceptors = true; 51757 this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { 51758 if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { 51759 return; 51760 } 51761 51762 synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; 51763 51764 requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); 51765 }); 51766 51767 const responseInterceptorChain = []; 51768 this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { 51769 responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); 51770 }); 51771 51772 let promise; 51773 let i = 0; 51774 let len; 51775 51776 if (!synchronousRequestInterceptors) { 51777 const chain = [dispatchRequest.bind(this), undefined]; 51778 chain.unshift.apply(chain, requestInterceptorChain); 51779 chain.push.apply(chain, responseInterceptorChain); 51780 len = chain.length; 51781 51782 promise = Promise.resolve(config); 51783 51784 while (i < len) { 51785 promise = promise.then(chain[i++], chain[i++]); 51786 } 51787 51788 return promise; 51789 } 51790 51791 len = requestInterceptorChain.length; 51792 51793 let newConfig = config; 51794 51795 i = 0; 51796 51797 while (i < len) { 51798 const onFulfilled = requestInterceptorChain[i++]; 51799 const onRejected = requestInterceptorChain[i++]; 51800 try { 51801 newConfig = onFulfilled(newConfig); 51802 } catch (error) { 51803 onRejected.call(this, error); 51804 break; 51805 } 51806 } 51807 51808 try { 51809 promise = dispatchRequest.call(this, newConfig); 51810 } catch (error) { 51811 return Promise.reject(error); 51812 } 51813 51814 i = 0; 51815 len = responseInterceptorChain.length; 51816 51817 while (i < len) { 51818 promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]); 51819 } 51820 51821 return promise; 51822 } 51823 51824 getUri(config) { 51825 config = mergeConfig(this.defaults, config); 51826 const fullPath = buildFullPath(config.baseURL, config.url); 51827 return buildURL(fullPath, config.params, config.paramsSerializer); 51828 } 51829} 51830 51831// Provide aliases for supported request methods 51832utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { 51833 /*eslint func-names:0*/ 51834 Axios.prototype[method] = function(url, config) { 51835 return this.request(mergeConfig(config || {}, { 51836 method, 51837 url, 51838 data: (config || {}).data 51839 })); 51840 }; 51841}); 51842 51843utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { 51844 /*eslint func-names:0*/ 51845 51846 function generateHTTPMethod(isForm) { 51847 return function httpMethod(url, data, config) { 51848 return this.request(mergeConfig(config || {}, { 51849 method, 51850 headers: isForm ? { 51851 'Content-Type': 'multipart/form-data' 51852 } : {}, 51853 url, 51854 data 51855 })); 51856 }; 51857 } 51858 51859 Axios.prototype[method] = generateHTTPMethod(); 51860 51861 Axios.prototype[method + 'Form'] = generateHTTPMethod(true); 51862}); 51863 51864var Axios$1 = Axios; 51865 51866/** 51867 * A `CancelToken` is an object that can be used to request cancellation of an operation. 51868 * 51869 * @param {Function} executor The executor function. 51870 * 51871 * @returns {CancelToken} 51872 */ 51873class CancelToken { 51874 constructor(executor) { 51875 if (typeof executor !== 'function') { 51876 throw new TypeError('executor must be a function.'); 51877 } 51878 51879 let resolvePromise; 51880 51881 this.promise = new Promise(function promiseExecutor(resolve) { 51882 resolvePromise = resolve; 51883 }); 51884 51885 const token = this; 51886 51887 // eslint-disable-next-line func-names 51888 this.promise.then(cancel => { 51889 if (!token._listeners) return; 51890 51891 let i = token._listeners.length; 51892 51893 while (i-- > 0) { 51894 token._listeners[i](cancel); 51895 } 51896 token._listeners = null; 51897 }); 51898 51899 // eslint-disable-next-line func-names 51900 this.promise.then = onfulfilled => { 51901 let _resolve; 51902 // eslint-disable-next-line func-names 51903 const promise = new Promise(resolve => { 51904 token.subscribe(resolve); 51905 _resolve = resolve; 51906 }).then(onfulfilled); 51907 51908 promise.cancel = function reject() { 51909 token.unsubscribe(_resolve); 51910 }; 51911 51912 return promise; 51913 }; 51914 51915 executor(function cancel(message, config, request) { 51916 if (token.reason) { 51917 // Cancellation has already been requested 51918 return; 51919 } 51920 51921 token.reason = new CanceledError(message, config, request); 51922 resolvePromise(token.reason); 51923 }); 51924 } 51925 51926 /** 51927 * Throws a `CanceledError` if cancellation has been requested. 51928 */ 51929 throwIfRequested() { 51930 if (this.reason) { 51931 throw this.reason; 51932 } 51933 } 51934 51935 /** 51936 * Subscribe to the cancel signal 51937 */ 51938 51939 subscribe(listener) { 51940 if (this.reason) { 51941 listener(this.reason); 51942 return; 51943 } 51944 51945 if (this._listeners) { 51946 this._listeners.push(listener); 51947 } else { 51948 this._listeners = [listener]; 51949 } 51950 } 51951 51952 /** 51953 * Unsubscribe from the cancel signal 51954 */ 51955 51956 unsubscribe(listener) { 51957 if (!this._listeners) { 51958 return; 51959 } 51960 const index = this._listeners.indexOf(listener); 51961 if (index !== -1) { 51962 this._listeners.splice(index, 1); 51963 } 51964 } 51965 51966 toAbortSignal() { 51967 const controller = new AbortController(); 51968 51969 const abort = (err) => { 51970 controller.abort(err); 51971 }; 51972 51973 this.subscribe(abort); 51974 51975 controller.signal.unsubscribe = () => this.unsubscribe(abort); 51976 51977 return controller.signal; 51978 } 51979 51980 /** 51981 * Returns an object that contains a new `CancelToken` and a function that, when called, 51982 * cancels the `CancelToken`. 51983 */ 51984 static source() { 51985 let cancel; 51986 const token = new CancelToken(function executor(c) { 51987 cancel = c; 51988 }); 51989 return { 51990 token, 51991 cancel 51992 }; 51993 } 51994} 51995 51996var CancelToken$1 = CancelToken; 51997 51998/** 51999 * Syntactic sugar for invoking a function and expanding an array for arguments. 52000 * 52001 * Common use case would be to use `Function.prototype.apply`. 52002 * 52003 * ```js 52004 * function f(x, y, z) {} 52005 * var args = [1, 2, 3]; 52006 * f.apply(null, args); 52007 * ``` 52008 * 52009 * With `spread` this example can be re-written. 52010 * 52011 * ```js 52012 * spread(function(x, y, z) {})([1, 2, 3]); 52013 * ``` 52014 * 52015 * @param {Function} callback 52016 * 52017 * @returns {Function} 52018 */ 52019function spread(callback) { 52020 return function wrap(arr) { 52021 return callback.apply(null, arr); 52022 }; 52023} 52024 52025/** 52026 * Determines whether the payload is an error thrown by Axios 52027 * 52028 * @param {*} payload The value to test 52029 * 52030 * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false 52031 */ 52032function isAxiosError(payload) { 52033 return utils$1.isObject(payload) && (payload.isAxiosError === true); 52034} 52035 52036const HttpStatusCode = { 52037 Continue: 100, 52038 SwitchingProtocols: 101, 52039 Processing: 102, 52040 EarlyHints: 103, 52041 Ok: 200, 52042 Created: 201, 52043 Accepted: 202, 52044 NonAuthoritativeInformation: 203, 52045 NoContent: 204, 52046 ResetContent: 205, 52047 PartialContent: 206, 52048 MultiStatus: 207, 52049 AlreadyReported: 208, 52050 ImUsed: 226, 52051 MultipleChoices: 300, 52052 MovedPermanently: 301, 52053 Found: 302, 52054 SeeOther: 303, 52055 NotModified: 304, 52056 UseProxy: 305, 52057 Unused: 306, 52058 TemporaryRedirect: 307, 52059 PermanentRedirect: 308, 52060 BadRequest: 400, 52061 Unauthorized: 401, 52062 PaymentRequired: 402, 52063 Forbidden: 403, 52064 NotFound: 404, 52065 MethodNotAllowed: 405, 52066 NotAcceptable: 406, 52067 ProxyAuthenticationRequired: 407, 52068 RequestTimeout: 408, 52069 Conflict: 409, 52070 Gone: 410, 52071 LengthRequired: 411, 52072 PreconditionFailed: 412, 52073 PayloadTooLarge: 413, 52074 UriTooLong: 414, 52075 UnsupportedMediaType: 415, 52076 RangeNotSatisfiable: 416, 52077 ExpectationFailed: 417, 52078 ImATeapot: 418, 52079 MisdirectedRequest: 421, 52080 UnprocessableEntity: 422, 52081 Locked: 423, 52082 FailedDependency: 424, 52083 TooEarly: 425, 52084 UpgradeRequired: 426, 52085 PreconditionRequired: 428, 52086 TooManyRequests: 429, 52087 RequestHeaderFieldsTooLarge: 431, 52088 UnavailableForLegalReasons: 451, 52089 InternalServerError: 500, 52090 NotImplemented: 501, 52091 BadGateway: 502, 52092 ServiceUnavailable: 503, 52093 GatewayTimeout: 504, 52094 HttpVersionNotSupported: 505, 52095 VariantAlsoNegotiates: 506, 52096 InsufficientStorage: 507, 52097 LoopDetected: 508, 52098 NotExtended: 510, 52099 NetworkAuthenticationRequired: 511, 52100}; 52101 52102Object.entries(HttpStatusCode).forEach(([key, value]) => { 52103 HttpStatusCode[value] = key; 52104}); 52105 52106var HttpStatusCode$1 = HttpStatusCode; 52107 52108/** 52109 * Create an instance of Axios 52110 * 52111 * @param {Object} defaultConfig The default config for the instance 52112 * 52113 * @returns {Axios} A new instance of Axios 52114 */ 52115function createInstance(defaultConfig) { 52116 const context = new Axios$1(defaultConfig); 52117 const instance = bind(Axios$1.prototype.request, context); 52118 52119 // Copy axios.prototype to instance 52120 utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true}); 52121 52122 // Copy context to instance 52123 utils$1.extend(instance, context, null, {allOwnKeys: true}); 52124 52125 // Factory for creating new instances 52126 instance.create = function create(instanceConfig) { 52127 return createInstance(mergeConfig(defaultConfig, instanceConfig)); 52128 }; 52129 52130 return instance; 52131} 52132 52133// Create the default instance to be exported 52134const axios = createInstance(defaults$1); 52135 52136// Expose Axios class to allow class inheritance 52137axios.Axios = Axios$1; 52138 52139// Expose Cancel & CancelToken 52140axios.CanceledError = CanceledError; 52141axios.CancelToken = CancelToken$1; 52142axios.isCancel = isCancel; 52143axios.VERSION = VERSION; 52144axios.toFormData = toFormData; 52145 52146// Expose AxiosError class 52147axios.AxiosError = AxiosError; 52148 52149// alias for CanceledError for backward compatibility 52150axios.Cancel = axios.CanceledError; 52151 52152// Expose all/spread 52153axios.all = function all(promises) { 52154 return Promise.all(promises); 52155}; 52156 52157axios.spread = spread; 52158 52159// Expose isAxiosError 52160axios.isAxiosError = isAxiosError; 52161 52162// Expose mergeConfig 52163axios.mergeConfig = mergeConfig; 52164 52165axios.AxiosHeaders = AxiosHeaders$1; 52166 52167axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing); 52168 52169axios.getAdapter = adapters.getAdapter; 52170 52171axios.HttpStatusCode = HttpStatusCode$1; 52172 52173axios.default = axios; 52174 52175module.exports = axios; 52176//# sourceMappingURL=axios.cjs.map 52177 52178 52179/***/ })
vendor: 7,647 bytes, lines 52179-52371
52179 52180 52181/******/ }); 52182/************************************************************************/ 52183/******/ // The module cache 52184/******/ var __webpack_module_cache__ = {}; 52185/******/ 52186/******/ // The require function 52187/******/ function __webpack_require__(moduleId) { 52188/******/ // Check if module is in cache 52189/******/ var cachedModule = __webpack_module_cache__[moduleId]; 52190/******/ if (cachedModule !== undefined) { 52191/******/ return cachedModule.exports; 52192/******/ } 52193/******/ // Create a new module (and put it into the cache) 52194/******/ var module = __webpack_module_cache__[moduleId] = { 52195/******/ id: moduleId, 52196/******/ loaded: false, 52197/******/ exports: {} 52198/******/ }; 52199/******/ 52200/******/ // Execute the module function 52201/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); 52202/******/ 52203/******/ // Flag the module as loaded 52204/******/ module.loaded = true; 52205/******/ 52206/******/ // Return the exports of the module 52207/******/ return module.exports; 52208/******/ } 52209/******/ 52210/******/ // expose the modules object (__webpack_modules__) 52211/******/ __webpack_require__.m = __webpack_modules__; 52212/******/ 52213/************************************************************************/ 52214/******/ /* webpack/runtime/chunk loaded */ 52215/******/ (() => { 52216/******/ var deferred = []; 52217/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => { 52218/******/ if(chunkIds) { 52219/******/ priority = priority || 0; 52220/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; 52221/******/ deferred[i] = [chunkIds, fn, priority]; 52222/******/ return; 52223/******/ } 52224/******/ var notFulfilled = Infinity; 52225/******/ for (var i = 0; i < deferred.length; i++) { 52226/******/ var [chunkIds, fn, priority] = deferred[i]; 52227/******/ var fulfilled = true; 52228/******/ for (var j = 0; j < chunkIds.length; j++) { 52229/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) { 52230/******/ chunkIds.splice(j--, 1); 52231/******/ } else { 52232/******/ fulfilled = false; 52233/******/ if(priority < notFulfilled) notFulfilled = priority; 52234/******/ } 52235/******/ } 52236/******/ if(fulfilled) { 52237/******/ deferred.splice(i--, 1) 52238/******/ var r = fn(); 52239/******/ if (r !== undefined) result = r; 52240/******/ } 52241/******/ } 52242/******/ return result; 52243/******/ }; 52244/******/ })(); 52245/******/ 52246/******/ /* webpack/runtime/compat get default export */ 52247/******/ (() => { 52248/******/ // getDefaultExport function for compatibility with non-harmony modules 52249/******/ __webpack_require__.n = (module) => { 52250/******/ var getter = module && module.__esModule ? 52251/******/ () => (module['default']) : 52252/******/ () => (module); 52253/******/ __webpack_require__.d(getter, { a: getter }); 52254/******/ return getter; 52255/******/ }; 52256/******/ })(); 52257/******/ 52258/******/ /* webpack/runtime/define property getters */ 52259/******/ (() => { 52260/******/ // define getter functions for harmony exports 52261/******/ __webpack_require__.d = (exports, definition) => { 52262/******/ for(var key in definition) { 52263/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 52264/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 52265/******/ } 52266/******/ } 52267/******/ }; 52268/******/ })(); 52269/******/ 52270/******/ /* webpack/runtime/global */ 52271/******/ (() => { 52272/******/ __webpack_require__.g = (function() { 52273/******/ if (typeof globalThis === 'object') return globalThis; 52274/******/ try { 52275/******/ return this || new Function('return this')(); 52276/******/ } catch (e) { 52277/******/ if (typeof window === 'object') return window; 52278/******/ } 52279/******/ })(); 52280/******/ })(); 52281/******/ 52282/******/ /* webpack/runtime/hasOwnProperty shorthand */ 52283/******/ (() => { 52284/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 52285/******/ })(); 52286/******/ 52287/******/ /* webpack/runtime/make namespace object */ 52288/******/ (() => { 52289/******/ // define __esModule on exports 52290/******/ __webpack_require__.r = (exports) => { 52291/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 52292/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 52293/******/ } 52294/******/ Object.defineProperty(exports, '__esModule', { value: true }); 52295/******/ }; 52296/******/ })(); 52297/******/ 52298/******/ /* webpack/runtime/node module decorator */ 52299/******/ (() => { 52300/******/ __webpack_require__.nmd = (module) => { 52301/******/ module.paths = []; 52302/******/ if (!module.children) module.children = []; 52303/******/ return module; 52304/******/ }; 52305/******/ })(); 52306/******/ 52307/******/ /* webpack/runtime/jsonp chunk loading */ 52308/******/ (() => { 52309/******/ // no baseURI 52310/******/ 52311/******/ // object to store loaded and loading chunks 52312/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched 52313/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded 52314/******/ var installedChunks = { 52315/******/ "/js/app": 0, 52316/******/ "css/app": 0 52317/******/ }; 52318/******/ 52319/******/ // no chunk on demand loading 52320/******/ 52321/******/ // no prefetching 52322/******/ 52323/******/ // no preloaded 52324/******/ 52325/******/ // no HMR 52326/******/ 52327/******/ // no HMR manifest 52328/******/ 52329/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0); 52330/******/ 52331/******/ // install a JSONP callback for chunk loading 52332/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { 52333/******/ var [chunkIds, moreModules, runtime] = data; 52334/******/ // add "moreModules" to the modules object, 52335/******/ // then flag all "chunkIds" as loaded and fire callback 52336/******/ var moduleId, chunkId, i = 0; 52337/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { 52338/******/ for(moduleId in moreModules) { 52339/******/ if(__webpack_require__.o(moreModules, moduleId)) { 52340/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; 52341/******/ } 52342/******/ } 52343/******/ if(runtime) var result = runtime(__webpack_require__); 52344/******/ } 52345/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); 52346/******/ for(;i < chunkIds.length; i++) { 52347/******/ chunkId = chunkIds[i]; 52348/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { 52349/******/ installedChunks[chunkId][0](); 52350/******/ } 52351/******/ installedChunks[chunkId] = 0; 52352/******/ } 52353/******/ return __webpack_require__.O(result); 52354/******/ } 52355/******/ 52356/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || []; 52357/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); 52358/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); 52359/******/ })(); 52360/******/ 52361/************************************************************************/ 52362/******/ 52363/******/ // startup 52364/******/ // Load entry module and return exports 52365/******/ // This entry module depends on other loaded chunks and execution need to be delayed 52366/******/ __webpack_require__.O(undefined, ["css/app"], () => (__webpack_require__("./resources/assets/js/app.js"))) 52367/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["css/app"], () => (__webpack_require__("./resources/assets/sass/app.scss"))) 52368/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); 52369/******/ 52370/******/ })() 52371;
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.