vendor: 87 bytes, lines 1-4
1/******/ (() => { // webpackBootstrap 2/******/ var __webpack_modules__ = ({ 3 4/***/ "./
4assets/images/search-icon.svg": 5/*!***************************************!*\ 6 !*** ./assets/images/search-icon.svg ***! 7 \***************************************/ 8/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 9 10"use strict"; 11module.exports = __webpack_require__.p + "921bc78bd52339637bcb.svg"; 12 13/***/ }), 14
15/***/ "./images/search-cross.png": 16/*!*********************************!*\ 17 !*** ./images/search-cross.png ***! 18 \*********************************/ 19/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 20 21"use strict"; 22module.exports = __webpack_require__.p + "ce043b9053070957d753.png"; 23 24/***/ }), 25
26/***/ "./js/src/API/AxiosServices.js": 27/*!*************************************!*\ 28 !*** ./js/src/API/AxiosServices.js ***! 29 \*************************************/ 30/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 31 32"use strict"; 33__webpack_require__.r(__webpack_exports__); 34/* harmony export */ __webpack_require__.d(__webpack_exports__, { 35/* harmony export */ AxiosService: () => (/* binding */ AxiosService), 36/* harmony export */ replaceStringWithParams: () => (/* binding */ replaceStringWithParams), 37/* harmony export */ serialize: () => (/* binding */ serialize) 38/* harmony export */ }); 39/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! axios */ "./node_modules/axios/index.js"); 40/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_0__); 41 42var serialize = function serialize(obj) { 43 var str = []; 44 Object.keys(obj).forEach(function (p) { 45 str.push("".concat(encodeURIComponent(p), "=").concat(encodeURIComponent(obj[p]))); 46 }); 47 return str.join('&'); 48}; 49var replaceStringWithParams = function replaceStringWithParams(str, obj) { 50 Object.keys(obj).forEach(function (j) { 51 var regExp = new RegExp(j, 'g'); 52 str = str.replace(regExp, obj[j]); 53 }); 54 return str; 55}; 56function AxiosService(obj) { 57 var _that = this; 58 (function __construct(obj) { 59 _that.headers = obj.headers; 60 _that.params = obj.params || {}; 61 _that.method = obj.method.toLowerCase(); 62 _that.url = obj.url; 63 _that.isSerialize = obj.isSerialize || null; 64 })(obj); 65 this.setHeaders = setHeaders; 66 this.setParams = setParams; 67 this.get = handleGet; 68 this.post = handlePost; 69 this.all = handleAll; 70 this.doAjax = doAjax; 71 this.doAjaxPost = doAjaxPost; 72 var CancelToken = (axios__WEBPACK_IMPORTED_MODULE_0___default().CancelToken); 73 var source = CancelToken.source(); 74 if (!window.axios_source) { 75 window.axios_source = []; 76 }
77 window.axios_source.push(source); 78 function doAjax() { 79 try { 80 delete _that.params.catalog_tag_filter; 81 } catch (e) { 82 console.log('tatasky_B2BPortal api service'); 83 } 84 var data = _that.params; 85 var convertParamsToUpdateUrl = {}; 86 Object.keys(data).forEach(function (i) { 87 convertParamsToUpdateUrl["{".concat(i, "}")] = data[i]; 88 }); 89 var url = replaceStringWithParams(_that.url, convertParamsToUpdateUrl); 90 /* 91 * No Serialization required here, I have handled it in interceptor, please look src/app.js 92 * Serialization will be handled based on request headers if request Header is 93 * Content-Type == GlobalConfig.getHeaders(['URL_ENCODED'])['Content-Type']; 94 * then only request will be serialized otherwise json will be send to server. 95 * */ 96 if (_that.method === 'get') { 97 if (_that.params && Object.keys(_that.params).length > 0) { 98 url += "?".concat(serialize(_that.params)); 99 } 100 } 101 return axios__WEBPACK_IMPORTED_MODULE_0___default()({ 102 method: _that.method, 103 url: url, 104 headers: Object.assign({}, _that.headers), 105 // weired cannot directly pass _that.headers as it doesn't reflect, need to figure it out later. 106 data: data, 107 cancelToken: source.token 108 }); 109 } 110 function doAjaxPost(responseType) { 111 return axios__WEBPACK_IMPORTED_MODULE_0___default()({ 112 method: _that.method, 113 url: _that.url, 114 responseType: responseType, 115 headers: Object.assign({}, _that.headers), 116 // weired cannot directly pass _that.headers as it doesn't reflect, need to figure it out later. 117 data: _that.params, 118 cancelToken: source.token 119 }); 120 } 121 function setParams(obj) { 122 var _this = this; 123 if (obj) { 124 Object.keys(obj).forEach(function (i) { 125 _this.params[i] = obj[i]; 126 }); 127 } 128 } 129 function setHeaders(key, val) { 130 this.headers[key] = val; 131 } 132 function handleGet() { 133 this.doAjax('get'); 134 } 135 function handlePost() { 136 this.doAjax('post'); 137 } 138 function handleAll(promises) { 139 // promises will be promise objects array e.g. [axios.get('/user'), axios.get('/comments')] 140 return axios__WEBPACK_IMPORTED_MODULE_0___default().all(promises); 141 } 142} 143 144/***/ }), 145
146/***/ "./js/src/API/GlobalConfig/apiPath.js": 147/*!********************************************!*\ 148 !*** ./js/src/API/GlobalConfig/apiPath.js ***! 149 \********************************************/ 150/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 151 152"use strict"; 153__webpack_require__.r(__webpack_exports__); 154/* harmony export */ __webpack_require__.d(__webpack_exports__, { 155/* harmony export */ API_PATH: () => (/* binding */ API_PATH), 156/* harmony export */ API_PATH_FB: () => (/* binding */ API_PATH_FB), 157/* harmony export */ ENVIRONMENTS: () => (/* binding */ ENVIRONMENTS), 158/* harmony export */ baseUrlDrupal: () => (/* binding */ baseUrlDrupal), 159/* harmony export */ bisValidationUrl: () => (/* binding */ bisValidationUrl), 160/* harmony export */ docUrl: () => (/* binding */ docUrl), 161/* harmony export */ dotValidationUrl: () => (/* binding */ dotValidationUrl), 162/* harmony export */ sihValidationUrl: () => (/* binding */ sihValidationUrl) 163/* harmony export */ }); 164var API_PATH = { 165 production: { 166 API_ROOT: "".concat(window.location.origin, "/gateway/") 167 // S3_API_ROOT: `${window.location.origin}`, 168 }, 169 development: { 170 // API_ROOT: 'https://qa-nsws.investindia.gov.in/gateway/', //QA URL 171 // API_ROOT: "https://dev-nsws.investindia.gov.in/gateway/", //Dev URL 172 API_ROOT: 'https://uat-nsws.investindia.gov.in/gateway/' //UAT URL 173 // API_ROOT: 'https://mpf-nsws.investindia.gov.in/gateway/', //MPF URL 174 // API_ROOT: 'https://www.demo.nsws.gov.in/gateway/', //demo PPE-stage URL 175 // S3_API_ROOT: '', 176 } 177}; 178 179//form-builder seperate gateway 180var API_PATH_FB = { 181 production: { 182 API_ROOT_FB: "".concat(window.location.origin, "/gateway-sec/") 183 // S3_API_ROOT: `${window.location.origin}`, 184 }, 185 development: { 186 // API_ROOT: 'https://qa-nsws.investindia.gov.in/gateway/', //QA URL 187 // API_ROOT: "https://dev-nsws.investindia.gov.in/gateway/", //Dev URL 188 API_ROOT_FB: 'https://uat-nsws.investindia.gov.in/gateway-sec/' //UAT URL 189 // API_ROOT: 'https://mpf-nsws.investindia.gov.in/gateway/', //MPF URL 190 // API_ROOT: 'https://www.demo.nsws.gov.in/gateway/', //demo PPE-stage URL 191 // S3_API_ROOT: '', 192 } 193}; 194 195// export const logoLink = ''; 196var docUrl = function docUrl(origin) { 197 switch (origin) { 198 case "https://www.ppe.nsws.gov.in": 199 return 'https://www.ppe-nodal-authority.nsws.gov.in/'; 200 case "https://www.nsws.gov.in": 201 return "https://www.nodal-authority.nsws.gov.in/"; 202 case "https://www.demo.nsws.gov.in": 203 return "https://www.demo-nodal-authority.nsws.gov.in/"; 204 default: 205 return "https://uat-nsws-mnstrportal.investindia.gov.in/"; 206 } 207}; 208var bisValidationUrl = function bisValidationUrl(origin) { 209 switch (origin) { 210 case "https://www.ppe.nsws.gov.in": 211 return 'https://www.ppe-nodal-authority.nsws.gov.in/'; 212 case "https://www.nsws.gov.in": 213 return "https://www.nodal-authority.nsws.gov.in/"; 214 case "https://www.demo.nsws.gov.in": 215 return "https://www.demo-nodal-authority.nsws.gov.in/"; 216 default: 217 return "https://uat-nsws-mnstrportal.investindia.gov.in/"; 218 } 219}; 220var dotValidationUrl = function dotValidationUrl(origin) { 221 switch (origin) { 222 case "https://www.ppe.nsws.gov.in": 223 return 'https://www.ppe-nodal-authority.nsws.gov.in/'; 224 case "https://www.nsws.gov.in": 225 return "https://www.nodal-authority.nsws.gov.in/"; 226 case "https://www.demo.nsws.gov.in": 227 return "https://www.demo-nodal-authority.nsws.gov.in/"; 228 default: 229 return "https://uat-nsws-mnstrportal.investindia.gov.in/"; 230 } 231}; 232var sihValidationUrl = function sihValidationUrl(origin) { 233 switch (origin) { 234 case "https://www.nsws.gov.in": 235 return "https://api.startupindia.gov.in/"; 236 default: 237 return "https://api-uat.startupindia.gov.in/"; 238 } 239}; 240 241//drupal image api path 242var baseUrlDrupal = function baseUrlDrupal() { 243 var origin = window.location.origin; 244 switch (origin) { 245 case "https://dev-nsws.investindia.gov.in": 246 return 'https://dev-nsws.investindia.gov.in'; 247 case "https://mpf-nsws.investindia.gov.in": 248 return 'https://mpf-nsws.investindia.gov.in'; 249 case "https://qa-nsws.investindia.gov.in": 250 return "https://qa-nsws.investindia.gov.in"; 251 case "https://uat-nsws.investindia.gov.in": 252 return "https://uat-nsws.investindia.gov.in"; 253 case "https://www.ppe.nsws.gov.in": 254 return "https://www.ppe.nsws.gov.in"; 255 case "https://www.nsws.gov.in": 256 return "https://www.nsws.gov.in"; 257 case "https://www.demo.nsws.gov.in": 258 return "https://www.demo.nsws.gov.in"; 259 default: 260 return "https://uat-nsws.investindia.gov.in"; 261 } 262}; 263var ENVIRONMENTS = { 264 'http://localhost:3000': 'mpf', 265 'https://mpf-nsws.investindia.gov.in': 'mpf', 266 'https://qa-nsws.investindia.gov.in': 'qa', 267 'https://uat-nsws.investindia.gov.in': 'uat', 268 'https://www.ppe.nsws.gov.in': 'ppe', 269 'https://www.demo.nsws.gov.in': 'demo', 270 'https://www.nsws.gov.in': 'prod' 271}; 272 273/***/ }), 274
275/***/ "./js/src/API/GlobalConfig/globalConfig.js": 276/*!*************************************************!*\ 277 !*** ./js/src/API/GlobalConfig/globalConfig.js ***! 278 \*************************************************/ 279/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 280 281"use strict"; 282__webpack_require__.r(__webpack_exports__); 283/* harmony export */ __webpack_require__.d(__webpack_exports__, { 284/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 285/* harmony export */ }); 286/* harmony import */ var _apiPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./apiPath */ "./js/src/API/GlobalConfig/apiPath.js"); 287 288var APP_VERSION = 1.0; 289var API_ENV = false ? 0 : 'development'; 290console.log("xzfsdfsfsdf", window.location.origin); 291var Settings = { 292 APP_VERSION: APP_VERSION, 293 API_ROOT: _apiPath__WEBPACK_IMPORTED_MODULE_0__.API_PATH[API_ENV].API_ROOT, 294 API_ROOT_FB: _apiPath__WEBPACK_IMPORTED_MODULE_0__.API_PATH_FB[API_ENV].API_ROOT_FB, 295 S3_API_ROOT: _apiPath__WEBPACK_IMPORTED_MODULE_0__.API_PATH[API_ENV].S3_API_ROOT, 296 PaymentTxnStatusCallBackTime: false ? 0 : 3000, 297 PaymentTxnStatusCallBackIteration: false ? 0 : 36, 298 API_ERROR: 0, 299 API_SUCCESS: 1, 300 MESSAGES_TYPES: { 301 TRUE: true, 302 FALSE: false, 303 SUCCESS: 'SUCCESS', 304 PENDING: 'PENDING', 305 IN_PROGRESS: 'INPROGRESS', 306 FAIL: 'FAIL' 307 }, 308 UAT_URL: window.location.origin == 'https://uat-nsws.investindia.gov.in/' ? 'https://uat-nsws-mnstrportal.investindia.gov.in/' : window.location.origin == 'https://www.ppe.nsws.gov.in/' ? 'https://www.ppe-nodal-authority.nsws.gov.in/' : window.location.origin == 'https://www.demo.nsws.gov.in' ? 'https://www.demo-nodal-authority.nsws.gov.in/' : window.location.origin == 'https://www.nsws.gov.in' ? 'https://www.nodal-authority.nsws.gov.in/' : 'https://uat-nsws-mnstrportal.investindia.gov.in/', 309 PAYMENT_FSSAI_URL: "https://uat-nsws.investindia.gov.in/", 310 serverError: 'Something went wrong. Please try again later', 311 DEFAULT_DATE_FORMAT: 'DD MMM YYYY', 312 getHeaders: function getHeaders(headers) { 313 var HEADERS = { 314 JSON: { 315 'Content-Type': 'application/json' 316 }, 317 URL_ENCODED: { 318 'Content-Type': 'application/x-www-form-urlencoded' 319 }, 320 MULTIPART_FORM_DATA: { 321 'Content-Type': 'multipart/form-data' 322 }, 323 TEXT_HTML: { 324 'Content-Type': 'text/html' 325 }, 326 P2FORM: { 327 'Content-Type': 'application/json', 328 'access-id': 'MIN_TEST_0', 329 'access-secret': 'MintesT@1234', 330 'api-key': 'ApiKeyLicense#19', 331 'Cookie': 'JSESSIONID=A99AE92D87D9C1D6565B17A63B34B2CD' 332 }, 333 DIGIACCESSTOKEN: { 334 'access-id': 'MIN_TEST_0', 335 'access-secret': 'MintesT@1234', 336 'api-key': 'ApiKeydigiAccessToken@06', 337 'Content-Type': 'application/json', 338 'Cookie': 'JSESSIONID=8F25E2CDC70B62BC13EB9CD5491B9373; JSESSIONID=07DD236597ED6DE051121EA301847DFB' 339 }, 340 GST: { 341 'api-key': 'ApiKeyGST@88', 342 'Content-Type': 'application/json', 343 'access-secret': 'MintesT@1234', 344 'Cookie': 'JSESSIONID=07DE836585976E631B5A05F8E30EFCF4; JSESSIONID=585BEF7E3B12C850FF851D14E78A8A25', 345 'access-id': 'MIN_TEST_0' 346 }, 347 DIGIDOC: { 348 'access-id': 'MIN_TEST_0', 349 'access-secret': 'MintesT@1234', 350 'api-key': 'ApiKeydigiIssuedDocuments@07', 351 'Content-Type': 'application/json', 352 Cookie: 'JSESSIONID=8F25E2CDC70B62BC13EB9CD5491B9373; JSESSIONID=07DD236597ED6DE051121EA301847DFB' 353 }, 354 DIGIPANDATA: { 355 'access-id': 'MIN_TEST_0', 356 'access-secret': 'MintesT@1234', 357 'api-key': 'ApiKeydigiPanData@08', 358 'Content-Type': 'application/json', 359 Cookie: 'JSESSIONID=8F25E2CDC70B62BC13EB9CD5491B9373; JSESSIONID=07DD236597ED6DE051121EA301847DFB' 360 }, 361 DIGIDATA: { 362 'access-id': 'MIN_TEST_0', 363 'access-secret': 'MintesT@1234', 364 'api-key': 'ApiKeygetDigiPanData@09', 365 'Content-Type': 'application/json', 366 Cookie: 'JSESSIONID=8F25E2CDC70B62BC13EB9CD5491B9373; JSESSIONID=06607F772D40F9A7EFE4AF07CB399A45' 367 } 368 }; 369 function getHeaders() { 370 var headerObj = [];
371 Object.keys(headers).forEach(function (key) { 372 var header = HEADERS[headers[key]]; 373 headerObj = Object.assign(headerObj, header); 374 }); 375 return headerObj; 376 } 377 return getHeaders(); 378 } 379}; 380/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Settings); 381 382/***/ }), 383
384/***/ "./js/src/API/repository.js": 385/*!**********************************!*\ 386 !*** ./js/src/API/repository.js ***! 387 \**********************************/ 388/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 389 390"use strict"; 391__webpack_require__.r(__webpack_exports__); 392/* harmony export */ __webpack_require__.d(__webpack_exports__, { 393/* harmony export */ baseUrlHomePageSearch: () => (/* binding */ baseUrlHomePageSearch), 394/* harmony export */ searchAllSchemeDataApi: () => (/* binding */ searchAllSchemeDataApi), 395/* harmony export */ searchDataApi: () => (/* binding */ searchDataApi), 396/* harmony export */ searchStateDataApi: () => (/* binding */ searchStateDataApi) 397/* harmony export */ }); 398/* harmony import */ var _GlobalConfig_globalConfig__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./GlobalConfig/globalConfig */ "./js/src/API/GlobalConfig/globalConfig.js"); 399 400var baseUrlHomePageSearch = function baseUrlHomePageSearch() { 401 var origin = window.location.origin; 402 switch (origin) { 403 case "https://dev-nsws.investindia.gov.in": 404 return 'https://dev-nsws.investindia.gov.in'; 405 case "https://mpf-nsws.investindia.gov.in": 406 return 'https://mpf-nsws.investindia.gov.in'; 407 case "https://qa-nsws.investindia.gov.in": 408 return "https://qa-nsws.investindia.gov.in"; 409 case "https://uat-nsws.investindia.gov.in": 410 return "https://uat-nsws.investindia.gov.in"; 411 case "https://www.ppe.nsws.gov.in": 412 return "https://www.ppe.nsws.gov.in"; 413 case "https://www.nsws.gov.in": 414 return "https://www.nsws.gov.in"; 415 case "https://www.demo.nsws.gov.in": 416 return "https://www.demo.nsws.gov.in"; 417 default: 418 return "https://uat-nsws.investindia.gov.in"; 419 } 420}; 421var searchDataApi = { 422 method: 'POST', 423 url: "".concat(baseUrlHomePageSearch(), "/gateway-sec/form-builder-sec/marketplace/license-summary-unified-list"), 424 headers: _GlobalConfig_globalConfig__WEBPACK_IMPORTED_MODULE_0__["default"].getHeaders(['JSON']) 425}; 426var searchStateDataApi = { 427 method: 'POST', 428 url: "".concat(baseUrlHomePageSearch(), "/gateway-sec/form-builder-sec/marketplace/state-license-summary-list"), 429 headers: _GlobalConfig_globalConfig__WEBPACK_IMPORTED_MODULE_0__["default"].getHeaders(['JSON']) 430}; 431var searchAllSchemeDataApi = { 432 method: 'GET', 433 headers: _GlobalConfig_globalConfig__WEBPACK_IMPORTED_MODULE_0__["default"].getHeaders(['JSON']) 434}; 435 436/***/ }), 437
438/***/ "./js/src/API/services.js": 439/*!********************************!*\ 440 !*** ./js/src/API/services.js ***! 441 \********************************/ 442/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 443 444"use strict"; 445__webpack_require__.r(__webpack_exports__); 446/* harmony export */ __webpack_require__.d(__webpack_exports__, { 447/* harmony export */ baseUrlDrupal: () => (/* binding */ baseUrlDrupal), 448/* harmony export */ commonService: () => (/* binding */ commonService) 449/* harmony export */ }); 450/* harmony import */ var _AxiosServices__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AxiosServices */ "./js/src/API/AxiosServices.js"); 451/* harmony import */ var _GlobalConfig_globalConfig__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GlobalConfig/globalConfig */ "./js/src/API/GlobalConfig/globalConfig.js"); 452/* harmony import */ var _repository__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./repository */ "./js/src/API/repository.js"); 453/* harmony import */ var _GlobalConfig_apiPath__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./GlobalConfig/apiPath */ "./js/src/API/GlobalConfig/apiPath.js"); 454function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 455function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 456function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 457function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 458function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 459function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 460 461 462 463 464var baseUrlDrupal = function baseUrlDrupal() { 465 var origin = window.location.origin; 466 switch (origin) { 467 case "https://dev-nsws.investindia.gov.in": 468 return 'https://dev-nsws.investindia.gov.in'; 469 case "https://mpf-nsws.investindia.gov.in": 470 return 'https://mpf-nsws.investindia.gov.in'; 471 case "https://qa-nsws.investindia.gov.in": 472 return "https://qa-nsws.investindia.gov.in"; 473 case "https://uat-nsws.investindia.gov.in": 474 return "https://uat-nsws.investindia.gov.in"; 475 case "https://www.ppe.nsws.gov.in": 476 return "https://www.ppe.nsws.gov.in"; 477 case "https://www.nsws.gov.in": 478 return "https://www.nsws.gov.in"; 479 case "https://www.demo.nsws.gov.in": 480 return "https://www.demo.nsws.gov.in"; 481 default: 482 return "https://uat-nsws.investindia.gov.in"; 483 } 484}; 485var CommonService = /*#__PURE__*/function () { 486 function CommonService() { 487 _classCallCheck(this, CommonService); 488 } 489 return _createClass(CommonService, [{ 490 key: "globalSearchData", 491 value: function globalSearchData(param) { 492 _repository__WEBPACK_IMPORTED_MODULE_2__.searchDataApi.params = param; 493 var api = new _AxiosServices__WEBPACK_IMPORTED_MODULE_0__.AxiosService(_repository__WEBPACK_IMPORTED_MODULE_2__.searchDataApi); 494 return api.doAjax(); 495 } 496 }, { 497 key: "globalSearchStateData", 498 value: function globalSearchStateData(param) { 499 _repository__WEBPACK_IMPORTED_MODULE_2__.searchStateDataApi.params = param; 500 var api = new _AxiosServices__WEBPACK_IMPORTED_MODULE_0__.AxiosService(_repository__WEBPACK_IMPORTED_MODULE_2__.searchStateDataApi); 501 return api.doAjax(); 502 } 503 }, { 504 key: "globalSearchAllSchemeData", 505 value: function globalSearchAllSchemeData(param) { 506 _repository__WEBPACK_IMPORTED_MODULE_2__.searchAllSchemeDataApi.url = "".concat(baseUrlDrupal(), "/policies?title=").concat(param); 507 var api = new _AxiosServices__WEBPACK_IMPORTED_MODULE_0__.AxiosService(_repository__WEBPACK_IMPORTED_MODULE_2__.searchAllSchemeDataApi); 508 return api.doAjax(); 509 } 510 }]); 511}(); 512var commonService = new CommonService(); 513 514/***/ }), 515
vendor: 5,898 bytes, lines 516-540
516/***/ "./js/src/GlobalSearch.jsx": 517/*!*********************************!*\ 518 !*** ./js/src/GlobalSearch.jsx ***! 519 \*********************************/ 520/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 521 522"use strict"; 523__webpack_require__.r(__webpack_exports__); 524/* harmony export */ __webpack_require__.d(__webpack_exports__, { 525/* harmony export */ HIDDEN_APPROVALS_LIST: () => (/* binding */ HIDDEN_APPROVALS_LIST), 526/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 527/* harmony export */ }); 528/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 529/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js"); 530/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__); 531/* harmony import */ var _API_services__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./API/services */ "./js/src/API/services.js"); 532/* harmony import */ var _API_GlobalConfig_globalConfig__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./API/GlobalConfig/globalConfig */ "./js/src/API/GlobalConfig/globalConfig.js"); 533/* harmony import */ var react_select__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-select */ "./node_modules/react-select/dist/react-select.esm.js"); 534function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 535function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); } 536function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); } 537function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); } 538function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } 539function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); } 540function _nonIterableRest() { throw new TypeError("Invalid attempt to de
540structure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 541function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } 542function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } 543function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } 544function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } 545function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } 546function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } 547function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } 548function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 549function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 550 551 552 553 554 555var HIDDEN_APPROVALS_LIST = ["M029_D001_A001", "M029_D001_A002", "M029_D001_A003", "M029_D001_A006", "M029_D001_A007", "M029_D001_A008", "M029_D001_A009", "M029_D001_A010", "M029_D001_A011"]; 556var options = [{ 557 value: 'allApprovals', 558 label: 'All Approvals' 559} 560// { value: 'stateApprovals', label: 'State Approval' }, 561// { value: 'allSchemes', label: 'Scheme Approvals' } 562]; 563var customStyles = { 564 singleValue: function singleValue(provided) { 565 return _objectSpread(_objectSpread({}, provided), {}, { 566 color: "black" // selected value text 567 }); 568 }, 569 option: function option(provided, state) { 570 return _objectSpread(_objectSpread({}, provided), {}, { 571 backgroundColor: state.isFocused ? "#FEF7EF" : "#fff", 572 // optional hover effect 573 // color: state.isFocused ? "#F2943B" : "black", // option text 574 textAlign: "left", 575 cursor: "pointer", 576 fontSize: "0.875rem", 577 lineHeight: "1.4", 578 color: state.isFocused ? "#F2943B" : "rgb(0, 0, 0)", 579 transition: "0.3s", 580 padding: "12px 20px !important", 581 margin: "0px !important", 582 fontFamily: "RobotoRegular, sans-serif" 583 }); 584 }, 585 input: function input(provided) { 586 return _objectSpread(_objectSpread({}, provided), {}, { 587 color: "black" // typing text 588 }); 589 }, 590 placeholder: function placeholder(provided) { 591 return _objectSpread(_objectSpread({}, provided), {}, { 592 color: "black" // placeholder text 593 }); 594 }, 595 menu: function menu(provided) { 596 return _objectSpread(_objectSpread({}, provided), {}, { 597 width: 300, 598 // ð set fixed width (px, %, or rem) 599 minWidth: "100%", 600 // makes sure itâs not smaller than control 601 textAlign: "left" 602 }); 603 } 604}; 605var GlobalSearch = function GlobalSearch(props) { 606 var _searchValue$global_s; 607 var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)({}), 608 _useState2 = _slicedToArray(_useState, 2), 609 searchValue = _useState2[0], 610 setSearchValue = _useState2[1]; 611 var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]), 612 _useState4 = _slicedToArray(_useState3, 2), 613 searchResult = _useState4[0], 614 setSearchResult = _useState4[1]; 615 var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]), 616 _useState6 = _slicedToArray(_useState5, 2), 617 approvalList = _useState6[0], 618 setApprovalList = _useState6[1]; 619 var _useState7 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)('centralApprovals'), 620 _useState8 = _slicedToArray(_useState7, 2), 621 selectValue = _useState8[0], 622 setSelectValue = _useState8[1]; 623 var _useState9 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false), 624 _useState0 = _slicedToArray(_useState9, 2), 625 showSearchControl = _useState0[0], 626 setShowSearchControl = _useState0[1]; 627 var ref = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(); 628 var exploreURL = { 629 "centralApprovals": "/portal/approvalsandregistrations" 630 // "stateApprovals": "/state-list", 631 // "allSchemes": "/government-schemes" 632 }; 633 (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () { 634 getSearchResult(); 635 }, [selectValue]); 636 (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () { 637 var handleClickOutside = function handleClickOutside(event) { 638 if (ref.current && !ref.current.contains(event.target)) { 639 setSearchValue({}); 640 setSearchResult([]); 641 } 642 }; 643 document.addEventListener("mousedown", handleClickOutside); 644 return function () { 645 document.removeEventListener("mousedown", handleClickOutside); 646 }; 647 }, []); 648 var closeNav = function closeNav() { 649 setShowSearchControl(!showSearchControl); 650 setSearchValue(""); 651 }; 652 var CloseNav = function CloseNav(e) { 653 if (e.which === 13) { 654 closeNav(); 655 } 656 }; 657 var CloseSearchbar = function CloseSearchbar(e) { 658 closeNav(); 659 }; 660 var getSearchResult = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() { 661 var requestParam, response, responseData, _t; 662 return _regenerator().w(function (_context) { 663 while (1) switch (_context.p = _context.n) { 664 case 0: 665 requestParam = { 666 "start": 0, 667 "length": 10000, 668 "sortBy": "", 669 "searchTag": searchValue.global_search || '', 670 "filters": { 671 "ministry_id": [], 672 "department_id": [] 673 } 674 }; 675 if (!(selectValue === "centralApprovals")) { 676 _context.n = 4; 677 break; 678 } 679 _context.p = 1; 680 _context.n = 2; 681 return _API_services__WEBPACK_IMPORTED_MODULE_2__.commonService.globalSearchData(requestParam); 682 case 2: 683 response = _context.v; 684 responseData = response.data; 685 if (responseData.status === _API_GlobalConfig_globalConfig__WEBPACK_IMPORTED_MODULE_3__["default"].MESSAGES_TYPES.TRUE) { 686 setSearchResult(responseData.data); 687 setApprovalList(responseData.data); 688 } 689 _context.n = 4; 690 break; 691 case 3: 692 _context.p = 3; 693 _t = _context.v; 694 console.log('Error occurred in Central License List'); 695 case 4: 696 return _context.a(2); 697 } 698 }, _callee, null, [[1, 3]]); 699 })), [searchValue, selectValue]); 700 var handleChange = function handleChange(e) { 701 setSelectValue(e.target.value); 702 setSearchValue({}); 703 }; 704 705 // const handleChange = (selectedOption) => { 706 // if (!selectedOption) return; 707 708 // setSelectValue(selectedOption?.value); 709 // setSearchValue({}); 710 // }; 711 712 var searchHandler = function searchHandler(e) { 713 e.persist(); 714 setSearchValue(function (previousValue) { 715 return _objectSpread(_objectSpread({}, previousValue), {}, _defineProperty({}, e.target.name, e.target.value)); 716 }); 717 var _searchValue = e.target.value; 718 var _filterArray = approvalList.filter(function (item) { 719 return item.licenseName.toLowerCase().includes(_searchValue.toLowerCase()); 720 }); 721 setSearchResult(_filterArray); 722 }; 723 var searchDetails = function searchDetails(ministryUrl, deptUrl, approvalName, licenseId, schemeUrl, id) { 724 if (selectValue === "allSchemes") { 725 window.open(schemeUrl, '_blank'); 726 } else { 727 localStorage.setItem('approvalsId', licenseId); 728 window.open("/portal/approval-details".concat("/", ministryUrl, "/").concat(deptUrl, "/").concat(approvalName), '_blank'); 729 } 730 }; 731 var SearchDetails = function SearchDetails(e, ministryUrl, deptUrl, approvalName, licenseId, schemeUrl, id) { 732 if (e.which === 13) { 733 searchDetails(ministryUrl, deptUrl, approvalName, licenseId, schemeUrl, id); 734 } 735 }; 736 var removeApproval = function removeApproval(searchResult) { 737 var result = searchResult && searchResult.filter(function (searchItem) { 738 return HIDDEN_APPROVALS_LIST.includes(searchItem === null || searchItem === void 0 ? void 0 : searchItem.referenceId); 739 }); 740 if (!(0,lodash__WEBPACK_IMPORTED_MODULE_1__.isEmpty)(result) || (searchResult === null || searchResult === void 0 ? void 0 : searchResult.length) === 0) { 741 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("li", { 742 className: "no-data-react" 743 }, "No data found."); 744 } else { 745 return searchResult && searchResult.map(function (searchItem, index) { 746 return HIDDEN_APPROVALS_LIST.includes(searchItem === null || searchItem === void 0 ? void 0 : searchItem.referenceId) ? null : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("li", { 747 tabIndex: "0", 748 key: index, 749 onClick: function onClick() { 750 return searchDetails((searchItem === null || searchItem === void 0 ? void 0 : searchItem.ministryUrlTitle) || (searchItem === null || searchItem === void 0 ? void 0 : searchItem.stateUrlTitle), (searchItem === null || searchItem === void 0 ? void 0 : searchItem.departmentUrlTitle) || (searchItem === null || searchItem === void 0 ? void 0 : searchItem.authorityUrlTitle), searchItem === null || searchItem === void 0 ? void 0 : searchItem.urlTitle, searchItem === null || searchItem === void 0 ? void 0 : searchItem.licenseId, searchItem === null || searchItem === void 0 ? void 0 : searchItem.schemeUrl, searchItem.licenseId); 751 }, 752 onKeyDown: function onKeyDown(e) { 753 return SearchDetails(e, (searchItem === null || searchItem === void 0 ? void 0 : searchItem.ministryUrlTitle) || (searchItem === null || searchItem === void 0 ? void 0 : searchItem.stateUrlTitle), (searchItem === null || searchItem === void 0 ? void 0 : searchItem.departmentUrlTitle) || (searchItem === null || searchItem === void 0 ? void 0 : searchItem.authorityUrlTitle), searchItem === null || searchItem === void 0 ? void 0 : searchItem.urlTitle, searchItem === null || searchItem === void 0 ? void 0 : searchItem.licenseId, searchItem === null || searchItem === void 0 ? void 0 : searchItem.schemeUrl, searchItem.licenseId); 754 } 755 }, (searchItem === null || searchItem === void 0 ? void 0 : searchItem.policyName) || searchItem.licenseName); 756 }); 757 } 758 }; 759 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { 760 className: "search-container-react", 761 ref: ref 762 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { 763 className: "search-icon-react", 764 tabIndex: "0", 765 onKeyDown: function onKeyDown(e) { 766 return CloseNav(e); 767 }, 768 onClick: closeNav 769 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("i", null, !showSearchControl && !props.CenterSearch ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg", { 770 xmlns: "http://www.w3.org/2000/svg", 771 width: "20", 772 height: "20",
773 viewBox: "0 0 13 13.001" 774 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("g", { 775 id: "Group_832", 776 transform: "translate(-1197 -58.508)" 777 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { 778 id: "Op_component_1", 779 d: "M1044.725 71.508a5.726 5.726 0 1 0 5.725 5.725 5.732 5.732 0 0 0-5.725-5.725zm0 10.394a4.669 4.669 0 1 1 4.668-4.669 4.674 4.674 0 0 1-4.668 4.667z", 780 className: "cls-1", 781 transform: "translate(158 -13)" 782 }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", { 783 id: "Op_component_2", 784 d: "M1051.845 83.607l-3.03-3.03a.528.528 0 1 0-.747.747l3.03 3.03a.528.528 0 1 0 .747-.747z", 785 className: "cls-1", 786 transform: "translate(158 -13)" 787 }))) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", { 788 className: "search-close-react" 789 }))), (showSearchControl || (props === null || props === void 0 ? void 0 : props.CenterSearch)) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { 790 className: props !== null && props !== void 0 && props.CenterSearch ? "search-box-react" : "header-search-box-react" 791 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { 792 className: props !== null && props !== void 0 && props.CenterSearch ? "search-filter-react" : "header-search-filter-react" 793 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { 794 className: "homepage-approvals-search-react" 795 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react_select__WEBPACK_IMPORTED_MODULE_4__["default"], { 796 options: options, 797 value: options[0], 798 isSearchable: false, 799 menuIsOpen: false // Prevent dropdown opening 800 , 801 styles: customStyles 802 }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { 803 className: "search-form-container-react" 804 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("input", { 805 placeholder: "Search Approvals", 806 className: "search-input-control-react approvals-search-box-react", 807 name: "global_search", 808 value: searchValue.global_search || '', 809 onChange: searchHandler, 810 autoComplete: "off", 811 autoFocus: true 812 }), (searchValue === null || searchValue === void 0 || (_searchValue$global_s = searchValue.global_search) === null || _searchValue$global_s === void 0 ? void 0 : _searchValue$global_s.length) > 0 && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("ul", { 813 className: "search-list-container-react" 814 }, removeApproval(searchResult)))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("a", { 815 href: exploreURL[selectValue], 816 target: "_blank", 817 className: "button-green-react", 818 tabIndex: "0", 819 onKeyDown: function onKeyDown(e) { 820 return CloseSearchbar(e); 821 } 822 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", null, "Explore All"))))); 823}; 824/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (GlobalSearch); 825 826/***/ }), 827
vendor: 5,330 bytes, lines 828-880
828/***/ "./js/src/commonSearch.css": 829/*!*********************************!*\ 830 !*** ./js/src/commonSearch.css ***! 831 \*********************************/ 832/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 833 834"use strict"; 835__webpack_require__.r(__webpack_exports__); 836/* harmony export */ __webpack_require__.d(__webpack_exports__, { 837/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 838/* harmony export */ }); 839/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! !../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js */ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"); 840/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__); 841/* harmony import */ var _node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! !../../node_modules/style-loader/dist/runtime/styleDomAPI.js */ "./node_modules/style-loader/dist/runtime/styleDomAPI.js"); 842/* harmony import */ var _node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__); 843/* harmony import */ var _node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../node_modules/style-loader/dist/runtime/insertBySelector.js */ "./node_modules/style-loader/dist/runtime/insertBySelector.js"); 844/* harmony import */ var _node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__); 845/* harmony import */ var _node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! !../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js */ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"); 846/* harmony import */ var _node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__); 847/* harmony import */ var _node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! !../../node_modules/style-loader/dist/runtime/insertStyleElement.js */ "./node_modules/style-loader/dist/runtime/insertStyleElement.js"); 848/* harmony import */ var _node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__); 849/* harmony import */ var _node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! !../../node_modules/style-loader/dist/runtime/styleTagTransform.js */ "./node_modules/style-loader/dist/runtime/styleTagTransform.js"); 850/* harmony import */ var _node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__); 851/* harmony import */ var _node_modules_css_loader_dist_cjs_js_commonSearch_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! !!../../node_modules/css-loader/dist/cjs.js!./commonSearch.css */ "./node_modules/css-loader/dist/cjs.js!./js/src/commonSearch.css"); 852 853 854 855 856 857 858 859 860 861 862 863var options = {}; 864 865options.styleTagTransform = (_node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default()); 866options.setAttributes = (_node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default()); 867options.insert = _node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default().bind(null, "head"); 868options.domAPI = (_node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default()); 869options.insertStyleElement = (_node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default()); 870 871var update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_node_modules_css_loader_dist_cjs_js_commonSearch_css__WEBPACK_IMPORTED_MODULE_6__["default"], options); 872 873 874 875 876 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_css_loader_dist_cjs_js_commonSearch_css__WEBPACK_IMPORTED_MODULE_6__["default"] && _node_modules_css_loader_dist_cjs_js_commonSearch_css__WEBPACK_IMPORTED_MODULE_6__["default"].locals ? _node_modules_css_loader_dist_cjs_js_commonSearch_css__WEBPACK_IMPORTED_MODULE_6__["default"].locals : undefined); 877 878 879/***/ }), 880
vendor: 779 bytes, lines 881-900
881/***/ "./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js": 882/*!*********************************************************************!*\ 883 !*** ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js ***! 884 \*********************************************************************/ 885/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 886 887"use strict"; 888__webpack_require__.r(__webpack_exports__); 889/* harmony export */ __webpack_require__.d(__webpack_exports__, { 890/* harmony export */ "default": () => (/* binding */ _arrayLikeToArray) 891/* harmony export */ }); 892function _arrayLikeToArray(r, a) { 893 (null == a || a > r.length) && (a = r.length); 894 for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; 895 return n; 896} 897 898 899/***/ }), 900
vendor: 680 bytes, lines 901-918
901/***/ "./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js": 902/*!*******************************************************************!*\ 903 !*** ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js ***! 904 \*******************************************************************/ 905/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 906 907"use strict"; 908__webpack_require__.r(__webpack_exports__); 909/* harmony export */ __webpack_require__.d(__webpack_exports__, { 910/* harmony export */ "default": () => (/* binding */ _arrayWithHoles) 911/* harmony export */ }); 912function _arrayWithHoles(r) { 913 if (Array.isArray(r)) return r; 914} 915 916 917/***/ }), 918
vendor: 957 bytes, lines 919-938
919/***/ "./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js": 920/*!**********************************************************************!*\ 921 !*** ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js ***! 922 \**********************************************************************/ 923/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 924 925"use strict"; 926__webpack_require__.r(__webpack_exports__); 927/* harmony export */ __webpack_require__.d(__webpack_exports__, { 928/* harmony export */ "default": () => (/* binding */ _arrayWithoutHoles) 929/* harmony export */ }); 930/* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js"); 931 932function _arrayWithoutHoles(r) { 933 if (Array.isArray(r)) return (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r); 934} 935 936 937/***/ }), 938
vendor: 807 bytes, lines 939-957
939/***/ "./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js": 940/*!**************************************************************************!*\ 941 !*** ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js ***! 942 \**************************************************************************/ 943/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 944 945"use strict"; 946__webpack_require__.r(__webpack_exports__); 947/* harmony export */ __webpack_require__.d(__webpack_exports__, { 948/* harmony export */ "default": () => (/* binding */ _assertThisInitialized) 949/* harmony export */ }); 950function _assertThisInitialized(e) { 951 if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 952 return e; 953} 954 955 956/***/ }), 957
vendor: 732 bytes, lines 958-975
958/***/ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js": 959/*!*******************************************************************!*\ 960 !*** ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js ***! 961 \*******************************************************************/ 962/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 963 964"use strict"; 965__webpack_require__.r(__webpack_exports__); 966/* harmony export */ __webpack_require__.d(__webpack_exports__, { 967/* harmony export */ "default": () => (/* binding */ _classCallCheck) 968/* harmony export */ }); 969function _classCallCheck(a, n) { 970 if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); 971} 972 973 974/***/ }), 975
vendor: 1,255 bytes, lines 976-1003
976/***/ "./node_modules/@babel/runtime/helpers/esm/createClass.js": 977/*!****************************************************************!*\ 978 !*** ./node_modules/@babel/runtime/helpers/esm/createClass.js ***! 979 \****************************************************************/ 980/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 981 982"use strict"; 983__webpack_require__.r(__webpack_exports__); 984/* harmony export */ __webpack_require__.d(__webpack_exports__, { 985/* harmony export */ "default": () => (/* binding */ _createClass) 986/* harmony export */ }); 987/* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toPropertyKey.js */ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js"); 988 989function _defineProperties(e, r) { 990 for (var t = 0; t < r.length; t++) { 991 var o = r[t]; 992 o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, (0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__["default"])(o.key), o); 993 } 994} 995function _createClass(e, r, t) { 996 return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { 997 writable: !1 998 }), e; 999} 1000 1001 1002/***/ }), 1003
vendor: 1,745 bytes, lines 1004-1036
1004/***/ "./node_modules/@babel/runtime/helpers/esm/createSuper.js": 1005/*!****************************************************************!*\ 1006 !*** ./node_modules/@babel/runtime/helpers/esm/createSuper.js ***! 1007 \****************************************************************/ 1008/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1009 1010"use strict"; 1011__webpack_require__.r(__webpack_exports__); 1012/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1013/* harmony export */ "default": () => (/* binding */ _createSuper) 1014/* harmony export */ }); 1015/* harmony import */ var _getPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getPrototypeOf.js */ "./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js"); 1016/* harmony import */ var _isNativeReflectConstruct_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isNativeReflectConstruct.js */ "./node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js"); 1017/* harmony import */ var _possibleConstructorReturn_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./possibleConstructorReturn.js */ "./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js"); 1018 1019 1020 1021function _createSuper(t) { 1022 var r = (0,_isNativeReflectConstruct_js__WEBPACK_IMPORTED_MODULE_1__["default"])(); 1023 return function () { 1024 var e, 1025 o = (0,_getPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__["default"])(t); 1026 if (r) { 1027 var s = (0,_getPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__["default"])(this).constructor; 1028 e = Reflect.construct(o, arguments, s); 1029 } else e = o.apply(this, arguments); 1030 return (0,_possibleConstructorReturn_js__WEBPACK_IMPORTED_MODULE_2__["default"])(this, e); 1031 }; 1032} 1033 1034 1035/***/ }), 1036
vendor: 1,046 bytes, lines 1037-1061
1037/***/ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js": 1038/*!*******************************************************************!*\ 1039 !*** ./node_modules/@babel/runtime/helpers/esm/defineProperty.js ***! 1040 \*******************************************************************/ 1041/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1042 1043"use strict"; 1044__webpack_require__.r(__webpack_exports__); 1045/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1046/* harmony export */ "default": () => (/* binding */ _defineProperty) 1047/* harmony export */ }); 1048/* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toPropertyKey.js */ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js"); 1049 1050function _defineProperty(e, r, t) { 1051 return (r = (0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r)) in e ? Object.defineProperty(e, r, { 1052 value: t, 1053 enumerable: !0, 1054 configurable: !0, 1055 writable: !0 1056 }) : e[r] = t, e; 1057} 1058 1059 1060/***/ }), 1061
vendor: 884 bytes, lines 1062-1085
1062/***/ "./node_modules/@babel/runtime/helpers/esm/extends.js": 1063/*!************************************************************!*\ 1064 !*** ./node_modules/@babel/runtime/helpers/esm/extends.js ***! 1065 \************************************************************/ 1066/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1067 1068"use strict"; 1069__webpack_require__.r(__webpack_exports__); 1070/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1071/* harmony export */ "default": () => (/* binding */ _extends) 1072/* harmony export */ }); 1073function _extends() { 1074 return _extends = Object.assign ? Object.assign.bind() : function (n) { 1075 for (var e = 1; e < arguments.length; e++) { 1076 var t = arguments[e]; 1077 for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); 1078 } 1079 return n; 1080 }, _extends.apply(null, arguments); 1081} 1082 1083 1084/***/ }), 1085
vendor: 820 bytes, lines 1086-1105
1086/***/ "./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js": 1087/*!*******************************************************************!*\ 1088 !*** ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js ***! 1089 \*******************************************************************/ 1090/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1091 1092"use strict"; 1093__webpack_require__.r(__webpack_exports__); 1094/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1095/* harmony export */ "default": () => (/* binding */ _getPrototypeOf) 1096/* harmony export */ }); 1097function _getPrototypeOf(t) { 1098 return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { 1099 return t.__proto__ || Object.getPrototypeOf(t); 1100 }, _getPrototypeOf(t); 1101} 1102 1103 1104/***/ }), 1105
vendor: 1,197 bytes, lines 1106-1134
1106/***/ "./node_modules/@babel/runtime/helpers/esm/inherits.js": 1107/*!*************************************************************!*\ 1108 !*** ./node_modules/@babel/runtime/helpers/esm/inherits.js ***! 1109 \*************************************************************/ 1110/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1111 1112"use strict"; 1113__webpack_require__.r(__webpack_exports__); 1114/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1115/* harmony export */ "default": () => (/* binding */ _inherits) 1116/* harmony export */ }); 1117/* harmony import */ var _setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setPrototypeOf.js */ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js"); 1118 1119function _inherits(t, e) { 1120 if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); 1121 t.prototype = Object.create(e && e.prototype, { 1122 constructor: { 1123 value: t, 1124 writable: !0, 1125 configurable: !0 1126 } 1127 }), Object.defineProperty(t, "prototype", { 1128 writable: !1 1129 }), e && (0,_setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__["default"])(t, e); 1130} 1131 1132 1133/***/ }), 1134
vendor: 924 bytes, lines 1135-1157
1135/***/ "./node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js": 1136/*!*****************************************************************************!*\ 1137 !*** ./node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js ***! 1138 \*****************************************************************************/ 1139/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1140 1141"use strict"; 1142__webpack_require__.r(__webpack_exports__); 1143/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1144/* harmony export */ "default": () => (/* binding */ _isNativeReflectConstruct) 1145/* harmony export */ }); 1146function _isNativeReflectConstruct() { 1147 try { 1148 var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); 1149 } catch (t) {} 1150 return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { 1151 return !!t; 1152 })(); 1153} 1154 1155 1156/***/ }), 1157
vendor: 767 bytes, lines 1158-1175
1158/***/ "./node_modules/@babel/runtime/helpers/esm/iterableToArray.js": 1159/*!********************************************************************!*\ 1160 !*** ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js ***! 1161 \********************************************************************/ 1162/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1163 1164"use strict"; 1165__webpack_require__.r(__webpack_exports__); 1166/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1167/* harmony export */ "default": () => (/* binding */ _iterableToArray) 1168/* harmony export */ }); 1169function _iterableToArray(r) { 1170 if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); 1171} 1172 1173 1174/***/ }), 1175
vendor: 1,317 bytes, lines 1176-1217
1176/***/ "./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js": 1177/*!*************************************************************************!*\ 1178 !*** ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js ***! 1179 \*************************************************************************/ 1180/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1181 1182"use strict"; 1183__webpack_require__.r(__webpack_exports__); 1184/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1185/* harmony export */ "default": () => (/* binding */ _iterableToArrayLimit) 1186/* harmony export */ }); 1187function _iterableToArrayLimit(r, l) { 1188 var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; 1189 if (null != t) { 1190 var e, 1191 n, 1192 i, 1193 u, 1194 a = [], 1195 f = !0, 1196 o = !1; 1197 try { 1198 if (i = (t = t.call(r)).next, 0 === l) { 1199 if (Object(t) !== t) return; 1200 f = !1; 1201 } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); 1202 } catch (r) { 1203 o = !0, n = r; 1204 } finally { 1205 try { 1206 if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; 1207 } finally { 1208 if (o) throw n; 1209 } 1210 } 1211 return a; 1212 } 1213} 1214 1215 1216/***/ }), 1217
vendor: 815 bytes, lines 1218-1235
1218/***/ "./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js": 1219/*!********************************************************************!*\ 1220 !*** ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js ***! 1221 \********************************************************************/ 1222/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1223 1224"use strict"; 1225__webpack_require__.r(__webpack_exports__); 1226/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1227/* harmony export */ "default": () => (/* binding */ _nonIterableRest) 1228/* harmony export */ }); 1229function _nonIterableRest() { 1230 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 1231} 1232 1233 1234/***/ }), 1235
vendor: 822 bytes, lines 1236-1253
1236/***/ "./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js": 1237/*!**********************************************************************!*\ 1238 !*** ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js ***! 1239 \**********************************************************************/ 1240/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1241 1242"use strict"; 1243__webpack_require__.r(__webpack_exports__); 1244/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1245/* harmony export */ "default": () => (/* binding */ _nonIterableSpread) 1246/* harmony export */ }); 1247function _nonIterableSpread() { 1248 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 1249} 1250 1251 1252/***/ }), 1253
vendor: 1,600 bytes, lines 1254-1291
1254/***/ "./node_modules/@babel/runtime/helpers/esm/objectSpread2.js": 1255/*!******************************************************************!*\ 1256 !*** ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js ***! 1257 \******************************************************************/ 1258/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1259 1260"use strict"; 1261__webpack_require__.r(__webpack_exports__); 1262/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1263/* harmony export */ "default": () => (/* binding */ _objectSpread2) 1264/* harmony export */ }); 1265/* harmony import */ var _defineProperty_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defineProperty.js */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js"); 1266 1267function ownKeys(e, r) { 1268 var t = Object.keys(e); 1269 if (Object.getOwnPropertySymbols) { 1270 var o = Object.getOwnPropertySymbols(e); 1271 r && (o = o.filter(function (r) { 1272 return Object.getOwnPropertyDescriptor(e, r).enumerable; 1273 })), t.push.apply(t, o); 1274 } 1275 return t; 1276} 1277function _objectSpread2(e) { 1278 for (var r = 1; r < arguments.length; r++) { 1279 var t = null != arguments[r] ? arguments[r] : {}; 1280 r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { 1281 (0,_defineProperty_js__WEBPACK_IMPORTED_MODULE_0__["default"])(e, r, t[r]); 1282 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { 1283 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); 1284 }); 1285 } 1286 return e; 1287} 1288 1289 1290/***/ }), 1291
vendor: 1,288 bytes, lines 1292-1319
1292/***/ "./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js": 1293/*!****************************************************************************!*\ 1294 !*** ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js ***! 1295 \****************************************************************************/ 1296/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1297 1298"use strict"; 1299__webpack_require__.r(__webpack_exports__); 1300/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1301/* harmony export */ "default": () => (/* binding */ _objectWithoutProperties) 1302/* harmony export */ }); 1303/* harmony import */ var _objectWithoutPropertiesLoose_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./objectWithoutPropertiesLoose.js */ "./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js"); 1304 1305function _objectWithoutProperties(e, t) { 1306 if (null == e) return {}; 1307 var o, 1308 r, 1309 i = (0,_objectWithoutPropertiesLoose_js__WEBPACK_IMPORTED_MODULE_0__["default"])(e, t); 1310 if (Object.getOwnPropertySymbols) { 1311 var n = Object.getOwnPropertySymbols(e); 1312 for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); 1313 } 1314 return i; 1315} 1316 1317 1318/***/ }), 1319
vendor: 902 bytes, lines 1320-1343
1320/***/ "./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js": 1321/*!*********************************************************************************!*\ 1322 !*** ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js ***! 1323 \*********************************************************************************/ 1324/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1325 1326"use strict"; 1327__webpack_require__.r(__webpack_exports__); 1328/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1329/* harmony export */ "default": () => (/* binding */ _objectWithoutPropertiesLoose) 1330/* harmony export */ }); 1331function _objectWithoutPropertiesLoose(r, e) { 1332 if (null == r) return {}; 1333 var t = {}; 1334 for (var n in r) if ({}.hasOwnProperty.call(r, n)) { 1335 if (-1 !== e.indexOf(n)) continue; 1336 t[n] = r[n]; 1337 } 1338 return t; 1339} 1340 1341 1342/***/ }), 1343
vendor: 1,390 bytes, lines 1344-1367
1344/***/ "./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js": 1345/*!******************************************************************************!*\ 1346 !*** ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js ***! 1347 \******************************************************************************/ 1348/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1349 1350"use strict"; 1351__webpack_require__.r(__webpack_exports__); 1352/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1353/* harmony export */ "default": () => (/* binding */ _possibleConstructorReturn) 1354/* harmony export */ }); 1355/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/esm/typeof.js"); 1356/* harmony import */ var _assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assertThisInitialized.js */ "./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js"); 1357 1358 1359function _possibleConstructorReturn(t, e) { 1360 if (e && ("object" == (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(e) || "function" == typeof e)) return e; 1361 if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); 1362 return (0,_assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_1__["default"])(t); 1363} 1364 1365 1366/***/ }), 1367
vendor: 808 bytes, lines 1368-1387
1368/***/ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js": 1369/*!*******************************************************************!*\ 1370 !*** ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js ***! 1371 \*******************************************************************/ 1372/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1373 1374"use strict"; 1375__webpack_require__.r(__webpack_exports__); 1376/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1377/* harmony export */ "default": () => (/* binding */ _setPrototypeOf) 1378/* harmony export */ }); 1379function _setPrototypeOf(t, e) { 1380 return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { 1381 return t.__proto__ = e, t; 1382 }, _setPrototypeOf(t, e); 1383} 1384 1385 1386/***/ }), 1387
vendor: 1,755 bytes, lines 1388-1413
1388/***/ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js": 1389/*!******************************************************************!*\ 1390 !*** ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js ***! 1391 \******************************************************************/ 1392/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1393 1394"use strict"; 1395__webpack_require__.r(__webpack_exports__); 1396/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1397/* harmony export */ "default": () => (/* binding */ _slicedToArray) 1398/* harmony export */ }); 1399/* harmony import */ var _arrayWithHoles_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayWithHoles.js */ "./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js"); 1400/* harmony import */ var _iterableToArrayLimit_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./iterableToArrayLimit.js */ "./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js"); 1401/* harmony import */ var _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js"); 1402/* harmony import */ var _nonIterableRest_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./nonIterableRest.js */ "./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js"); 1403 1404 1405 1406 1407function _slicedToArray(r, e) { 1408 return (0,_arrayWithHoles_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r) || (0,_iterableToArrayLimit_js__WEBPACK_IMPORTED_MODULE_1__["default"])(r, e) || (0,_unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__["default"])(r, e) || (0,_nonIterableRest_js__WEBPACK_IMPORTED_MODULE_3__["default"])(); 1409} 1410 1411 1412/***/ }), 1413
vendor: 820 bytes, lines 1414-1435
1414/***/ "./node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js": 1415/*!**************************************************************************!*\ 1416 !*** ./node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js ***! 1417 \**************************************************************************/ 1418/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1419 1420"use strict"; 1421__webpack_require__.r(__webpack_exports__); 1422/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1423/* harmony export */ "default": () => (/* binding */ _taggedTemplateLiteral) 1424/* harmony export */ }); 1425function _taggedTemplateLiteral(e, t) { 1426 return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { 1427 raw: { 1428 value: Object.freeze(t) 1429 } 1430 })); 1431} 1432 1433 1434/***/ }), 1435
vendor: 1,770 bytes, lines 1436-1461
1436/***/ "./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js": 1437/*!**********************************************************************!*\ 1438 !*** ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js ***! 1439 \**********************************************************************/ 1440/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1441 1442"use strict"; 1443__webpack_require__.r(__webpack_exports__); 1444/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1445/* harmony export */ "default": () => (/* binding */ _toConsumableArray) 1446/* harmony export */ }); 1447/* harmony import */ var _arrayWithoutHoles_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayWithoutHoles.js */ "./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js"); 1448/* harmony import */ var _iterableToArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./iterableToArray.js */ "./node_modules/@babel/runtime/helpers/esm/iterableToArray.js"); 1449/* harmony import */ var _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js"); 1450/* harmony import */ var _nonIterableSpread_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./nonIterableSpread.js */ "./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js"); 1451 1452 1453 1454 1455function _toConsumableArray(r) { 1456 return (0,_arrayWithoutHoles_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r) || (0,_iterableToArray_js__WEBPACK_IMPORTED_MODULE_1__["default"])(r) || (0,_unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__["default"])(r) || (0,_nonIterableSpread_js__WEBPACK_IMPORTED_MODULE_3__["default"])(); 1457} 1458 1459 1460/***/ }), 1461
vendor: 1,193 bytes, lines 1462-1488
1462/***/ "./node_modules/@babel/runtime/helpers/esm/toPrimitive.js": 1463/*!****************************************************************!*\ 1464 !*** ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js ***! 1465 \****************************************************************/ 1466/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1467 1468"use strict"; 1469__webpack_require__.r(__webpack_exports__); 1470/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1471/* harmony export */ "default": () => (/* binding */ toPrimitive) 1472/* harmony export */ }); 1473/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/esm/typeof.js"); 1474 1475function toPrimitive(t, r) { 1476 if ("object" != (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(t) || !t) return t; 1477 var e = t[Symbol.toPrimitive]; 1478 if (void 0 !== e) { 1479 var i = e.call(t, r || "default"); 1480 if ("object" != (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(i)) return i; 1481 throw new TypeError("@@toPrimitive must return a primitive value."); 1482 } 1483 return ("string" === r ? String : Number)(t); 1484} 1485 1486 1487/***/ }), 1488
vendor: 1,156 bytes, lines 1489-1511
1489/***/ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js": 1490/*!******************************************************************!*\ 1491 !*** ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js ***! 1492 \******************************************************************/ 1493/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1494 1495"use strict"; 1496__webpack_require__.r(__webpack_exports__); 1497/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1498/* harmony export */ "default": () => (/* binding */ toPropertyKey) 1499/* harmony export */ }); 1500/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/esm/typeof.js"); 1501/* harmony import */ var _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toPrimitive.js */ "./node_modules/@babel/runtime/helpers/esm/toPrimitive.js"); 1502 1503 1504function toPropertyKey(t) { 1505 var i = (0,_toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__["default"])(t, "string"); 1506 return "symbol" == (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(i) ? i : i + ""; 1507} 1508 1509 1510/***/ }), 1511
vendor: 910 bytes, lines 1512-1535
1512/***/ "./node_modules/@babel/runtime/helpers/esm/typeof.js": 1513/*!***********************************************************!*\ 1514 !*** ./node_modules/@babel/runtime/helpers/esm/typeof.js ***! 1515 \***********************************************************/ 1516/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1517 1518"use strict"; 1519__webpack_require__.r(__webpack_exports__); 1520/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1521/* harmony export */ "default": () => (/* binding */ _typeof) 1522/* harmony export */ }); 1523function _typeof(o) { 1524 "@babel/helpers - typeof"; 1525 1526 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { 1527 return typeof o; 1528 } : function (o) { 1529 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 1530 }, _typeof(o); 1531} 1532 1533 1534/***/ }), 1535
vendor: 1,356 bytes, lines 1536-1559
1536/***/ "./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js": 1537/*!*******************************************************************************!*\ 1538 !*** ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js ***! 1539 \*******************************************************************************/ 1540/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 1541 1542"use strict"; 1543__webpack_require__.r(__webpack_exports__); 1544/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1545/* harmony export */ "default": () => (/* binding */ _unsupportedIterableToArray) 1546/* harmony export */ }); 1547/* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js"); 1548 1549function _unsupportedIterableToArray(r, a) { 1550 if (r) { 1551 if ("string" == typeof r) return (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r, a); 1552 var t = {}.toString.call(r).slice(8, -1); 1553 return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r, a) : void 0; 1554 } 1555} 1556 1557 1558/***/ }), 1559
vendor: 25,261 bytes, lines 1560-2179
1560/***/ "./node_modules/@emotion/cache/dist/emotion-cache.browser.development.esm.js": 1561/*!***********************************************************************************!*\ 1562 !*** ./node_modules/@emotion/cache/dist/emotion-cache.browser.development.esm.js ***! 1563 \***********************************************************************************/ 1564/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 1565 1566"use strict"; 1567__webpack_require__.r(__webpack_exports__); 1568/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1569/* harmony export */ "default": () => (/* binding */ createCache) 1570/* harmony export */ }); 1571/* harmony import */ var _emotion_sheet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @emotion/sheet */ "./node_modules/@emotion/sheet/dist/emotion-sheet.development.esm.js"); 1572/* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! stylis */ "./node_modules/stylis/src/Enum.js"); 1573/* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! stylis */ "./node_modules/stylis/src/Utility.js"); 1574/* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! stylis */ "./node_modules/stylis/src/Parser.js"); 1575/* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! stylis */ "./node_modules/stylis/src/Tokenizer.js"); 1576/* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! stylis */ "./node_modules/stylis/src/Serializer.js"); 1577/* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! stylis */ "./node_modules/stylis/src/Middleware.js"); 1578/* harmony import */ var _emotion_weak_memoize__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @emotion/weak-memoize */ "./node_modules/@emotion/weak-memoize/dist/emotion-weak-memoize.esm.js"); 1579/* harmony import */ var _emotion_memoize__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @emotion/memoize */ "./node_modules/@emotion/memoize/dist/emotion-memoize.esm.js"); 1580 1581 1582 1583 1584 1585var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) { 1586 var previous = 0; 1587 var character = 0; 1588 1589 while (true) { 1590 previous = character; 1591 character = (0,stylis__WEBPACK_IMPORTED_MODULE_4__.peek)(); // &\f 1592 1593 if (previous === 38 && character === 12) { 1594 points[index] = 1; 1595 } 1596 1597 if ((0,stylis__WEBPACK_IMPORTED_MODULE_4__.token)(character)) { 1598 break; 1599 } 1600 1601 (0,stylis__WEBPACK_IMPORTED_MODULE_4__.next)(); 1602 } 1603 1604 return (0,stylis__WEBPACK_IMPORTED_MODULE_4__.slice)(begin, stylis__WEBPACK_IMPORTED_MODULE_4__.position); 1605}; 1606 1607var toRules = function toRules(parsed, points) { 1608 // pretend we've started with a comma 1609 var index = -1; 1610 var character = 44; 1611 1612 do { 1613 switch ((0,stylis__WEBPACK_IMPORTED_MODULE_4__.token)(character)) { 1614 case 0: 1615 // &\f 1616 if (character === 38 && (0,stylis__WEBPACK_IMPORTED_MODULE_4__.peek)() === 12) { 1617 // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings 1618 // stylis inserts \f after & to know when & where it should replace this sequence with the context selector 1619 // and when it should just concatenate the outer and inner selectors 1620 // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here 1621 points[index] = 1; 1622 } 1623 1624 parsed[index] += identifierWithPointTracking(stylis__WEBPACK_IMPORTED_MODULE_4__.position - 1, points, index); 1625 break; 1626 1627 case 2: 1628 parsed[index] += (0,stylis__WEBPACK_IMPORTED_MODULE_4__.delimit)(character); 1629 break; 1630 1631 case 4: 1632 // comma 1633 if (character === 44) { 1634 // colon 1635 parsed[++index] = (0,stylis__WEBPACK_IMPORTED_MODULE_4__.peek)() === 58 ? '&\f' : ''; 1636 points[index] = parsed[index].length; 1637 break; 1638 } 1639 1640 // fallthrough 1641 1642 default: 1643 parsed[index] += (0,stylis__WEBPACK_IMPORTED_MODULE_2__.from)(character); 1644 } 1645 } while (character = (0,stylis__WEBPACK_IMPORTED_MODULE_4__.next)()); 1646 1647 return parsed; 1648}; 1649 1650var getRules = function getRules(value, points) { 1651 return (0,stylis__WEBPACK_IMPORTED_MODULE_4__.dealloc)(toRules((0,stylis__WEBPACK_IMPORTED_MODULE_4__.alloc)(value), points)); 1652}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11 1653 1654 1655var fixedElements = /* #__PURE__ */new WeakMap(); 1656var compat = function compat(element) { 1657 if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo 1658 // negative .length indicates that this rule has been already prefixed 1659 element.length < 1) { 1660 return; 1661 } 1662 1663 var value = element.value; 1664 var parent = element.parent; 1665 var isImplicitRule = element.column === parent.column && element.line === parent.line; 1666 1667 while (parent.type !== 'rule') { 1668 parent = parent.parent; 1669 if (!parent) return; 1670 } // short-circuit for the simplest case 1671 1672 1673 if (element.props.length === 1 && value.charCodeAt(0) !== 58 1674 /* colon */ 1675 && !fixedElements.get(parent)) { 1676 return; 1677 } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level) 1678 // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent" 1679 1680 1681 if (isImplicitRule) { 1682 return; 1683 } 1684 1685 fixedElements.set(element, true); 1686 var points = []; 1687 var rules = getRules(value, points); 1688 var parentRules = parent.props; 1689 1690 for (var i = 0, k = 0; i < rules.length; i++) { 1691 for (var j = 0; j < parentRules.length; j++, k++) { 1692 element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i]; 1693 } 1694 } 1695}; 1696var removeLabel = function removeLabel(element) { 1697 if (element.type === 'decl') { 1698 var value = element.value; 1699 1700 if ( // charcode for l 1701 value.charCodeAt(0) === 108 && // charcode for b 1702 value.charCodeAt(2) === 98) { 1703 // this ignores label 1704 element["return"] = ''; 1705 element.value = ''; 1706 } 1707 } 1708}; 1709var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason'; 1710 1711var isIgnoringComment = function isIgnoringComment(element) { 1712 return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1; 1713}; 1714 1715var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) { 1716 return function (element, index, children) { 1717 if (element.type !== 'rule' || cache.compat) return; 1718 var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g); 1719 1720 if (unsafePseudoClasses) { 1721 var isNested = !!element.parent; // in nested rules comments become children of the "auto-inserted" rule and that's always the `element.parent` 1722 // 1723 // considering this input: 1724 // .a { 1725 // .b /* comm */ {} 1726 // color: hotpink; 1727 // } 1728 // we get output corresponding to this: 1729 // .a { 1730 // & { 1731 // /* comm */ 1732 // color: hotpink; 1733 // } 1734 // .b {} 1735 // } 1736 1737 var commentContainer = isNested ? element.parent.children : // global rule at the root level 1738 children; 1739 1740 for (var i = commentContainer.length - 1; i >= 0; i--) { 1741 var node = commentContainer[i]; 1742 1743 if (node.line < element.line) { 1744 break; 1745 } // it is quite weird but comments are *usually* put at `column: element.column - 1` 1746 // so we seek *from the end* for the node that is earlier than the rule's `element` and check that 1747 // this will also match inputs like this: 1748 // .a { 1749 // /* comm */ 1750 // .b {} 1751 // } 1752 // 1753 // but that is fine 1754 // 1755 // it would be the easiest to change the placement of the comment to be the first child of the rule: 1756 // .a { 1757 // .b { /* comm */ } 1758 // } 1759 // with such inputs we wouldn't have to search for the comment at all 1760 // TODO: consider changing this comment placement in the next major version 1761 1762 1763 if (node.column < element.column) { 1764 if (isIgnoringComment(node)) { 1765 return; 1766 } 1767 1768 break; 1769 } 1770 } 1771 1772 unsafePseudoClasses.forEach(function (unsafePseudoClass) { 1773 console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\"."); 1774 }); 1775 } 1776 }; 1777}; 1778 1779var isImportRule = function isImportRule(element) { 1780 return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64; 1781}; 1782 1783var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) { 1784 for (var i = index - 1; i >= 0; i--) { 1785 if (!isImportRule(children[i])) { 1786 return true; 1787 } 1788 } 1789 1790 return false; 1791}; // use this to remove incorrect elements from further processing 1792// so they don't get handed to the `sheet` (or anything else) 1793// as that could potentially lead to additional logs which in turn could be overhelming to the user 1794 1795 1796var nullifyElement = function nullifyElement(element) { 1797 element.type = ''; 1798 element.value = ''; 1799 element["return"] = ''; 1800 element.children = ''; 1801 element.props = ''; 1802}; 1803 1804var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) { 1805 if (!isImportRule(element)) { 1806 return; 1807 } 1808 1809 if (element.parent) { 1810 console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles."); 1811 nullifyElement(element); 1812 } else if (isPrependedWithRegularRules(index, children)) { 1813 console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules."); 1814 nullifyElement(element); 1815 } 1816}; 1817 1818/* eslint-disable no-fallthrough */ 1819 1820function prefix(value, length) { 1821 switch ((0,stylis__WEBPACK_IMPORTED_MODULE_2__.hash)(value, length)) { 1822 // color-adjust 1823 case 5103: 1824 return stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + 'print-' + value + value; 1825 // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function) 1826 1827 case 5737: 1828 case 4201: 1829 case 3177: 1830 case 3433: 1831 case 1641: 1832 case 4457: 1833 case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break 1834 1835 case 5572: 1836 case 6356: 1837 case 5844: 1838 case 3191: 1839 case 6645: 1840 case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite, 1841 1842 case 6391: 1843 case 5879: 1844 case 5623: 1845 case 6135: 1846 case 4599: 1847 case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width) 1848 1849 case 4215: 1850 case 6389: 1851 case 5109: 1852 case 5365: 1853 case 5621: 1854 case 3829: 1855 return stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + value; 1856 // appearance, user-select, transform, hyphens, text-size-adjust 1857 1858 case 5349: 1859 case 4246: 1860 case 4810: 1861 case 6968: 1862 case 2756: 1863 return stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_1__.MOZ + value + stylis__WEBPACK_IMPORTED_MODULE_1__.MS + value + value; 1864 // flex, flex-direction 1865 1866 case 6828: 1867 case 4268: 1868 return stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_1__.MS + value + value; 1869 // order 1870 1871 case 6165: 1872 return stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_1__.MS + 'flex-' + value + value; 1873 // align-items 1874 1875 case 5187: 1876 return stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + (0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, /(\w+).+(:[^]+)/, stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + 'box-$1$2' + stylis__WEBPACK_IMPORTED_MODULE_1__.MS + 'flex-$1$2') + value; 1877 // align-self 1878 1879 case 5443: 1880 return stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_1__.MS + 'flex-item-' + (0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, /flex-|-self/, '') + value; 1881 // align-content 1882 1883 case 4675: 1884 return stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_1__.MS + 'flex-line-pack' + (0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, /align-content|flex-|-self/, '') + value; 1885 // flex-shrink 1886 1887 case 5548: 1888 return stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_1__.MS + (0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, 'shrink', 'negative') + value; 1889 // flex-basis 1890 1891 case 5292: 1892 return stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_1__.MS + (0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, 'basis', 'preferred-size') + value; 1893 // flex-grow 1894 1895 case 6060: 1896 return stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + 'box-' + (0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, '-grow', '') + stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_1__.MS + (0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, 'grow', 'positive') + value; 1897 // transition 1898 1899 case 4554: 1900 return stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + (0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, /([^-])(transform)/g, '$1' + stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + '$2') + value; 1901 // cursor 1902 1903 case 6187: 1904 return (0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)((0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)((0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, /(zoom-|grab)/, stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + '$1'), /(image-set)/, stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + '$1'), value, '') + value; 1905 // background, background-image 1906 1907 case 5495: 1908 case 3959: 1909 return (0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, /(image-set\([^]*)/, stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + '$1' + '$`$1'); 1910 // justify-content 1911 1912 case 4968: 1913 return (0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)((0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, /(.+:)(flex-)?(.*)/, stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + 'box-pack:$3' + stylis__WEBPACK_IMPORTED_MODULE_1__.MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + value; 1914 // (margin|padding)-inline-(start|end) 1915 1916 case 4095: 1917 case 3583: 1918 case 4068: 1919 case 2532: 1920 return (0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, /(.+)-inline(.+)/, stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + '$1$2') + value; 1921 // (min|max)?(width|height|inline-size|block-size) 1922 1923 case 8116: 1924 case 7059: 1925 case 5753: 1926 case 5535: 1927 case 5445: 1928 case 5701: 1929 case 4933: 1930 case 4677: 1931 case 5533: 1932 case 5789: 1933 case 5021: 1934 case 4765: 1935 // stretch, max-content, min-content, fill-available 1936 if ((0,stylis__WEBPACK_IMPORTED_MODULE_2__.strlen)(value) - 1 - length > 6) switch ((0,stylis__WEBPACK_IMPORTED_MODULE_2__.charat)(value, length + 1)) { 1937 // (m)ax-content, (m)in-content 1938 case 109: 1939 // - 1940 if ((0,stylis__WEBPACK_IMPORTED_MODULE_2__.charat)(value, length + 4) !== 45) break; 1941 // (f)ill-available, (f)it-content 1942 1943 case 102: 1944 return (0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, /(.+:)(.+)-([^]+)/, '$1' + stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + '$2-$3' + '$1' + stylis__WEBPACK_IMPORTED_MODULE_1__.MOZ + ((0,stylis__WEBPACK_IMPORTED_MODULE_2__.charat)(value, length + 3) == 108 ? '$3' : '$2-$3')) + value; 1945 // (s)tretch 1946 1947 case 115: 1948 return ~(0,stylis__WEBPACK_IMPORTED_MODULE_2__.indexof)(value, 'stretch') ? prefix((0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, 'stretch', 'fill-available'), length) + value : value; 1949 } 1950 break; 1951 // position: sticky 1952 1953 case 4949: 1954 // (s)ticky? 1955 if ((0,stylis__WEBPACK_IMPORTED_MODULE_2__.charat)(value, length + 1) !== 115) break; 1956 // display: (flex|inline-flex) 1957 1958 case 6444: 1959 switch ((0,stylis__WEBPACK_IMPORTED_MODULE_2__.charat)(value, (0,stylis__WEBPACK_IMPORTED_MODULE_2__.strlen)(value) - 3 - (~(0,stylis__WEBPACK_IMPORTED_MODULE_2__.indexof)(value, '!important') && 10))) { 1960 // stic(k)y 1961 case 107: 1962 return (0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, ':', ':' + stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT) + value; 1963 // (inline-)?fl(e)x 1964 1965 case 101: 1966 return (0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + ((0,stylis__WEBPACK_IMPORTED_MODULE_2__.charat)(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + '$2$3' + '$1' + stylis__WEBPACK_IMPORTED_MODULE_1__.MS + '$2box$3') + value; 1967 } 1968 1969 break; 1970 // writing-mode 1971 1972 case 5936: 1973 switch ((0,stylis__WEBPACK_IMPORTED_MODULE_2__.charat)(value, length + 11)) { 1974 // vertical-l(r) 1975 case 114: 1976 return stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_1__.MS + (0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, /[svh]\w+-[tblr]{2}/, 'tb') + value; 1977 // vertical-r(l) 1978 1979 case 108: 1980 return stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_1__.MS + (0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value; 1981 // horizontal(-)tb 1982 1983 case 45: 1984 return stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_1__.MS + (0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, /[svh]\w+-[tblr]{2}/, 'lr') + value; 1985 } 1986 1987 return stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + value + stylis__WEBPACK_IMPORTED_MODULE_1__.MS + value + value; 1988 } 1989 1990 return value; 1991} 1992 1993var prefixer = function prefixer(element, index, children, callback) { 1994 if (element.length > -1) if (!element["return"]) switch (element.type) { 1995 case stylis__WEBPACK_IMPORTED_MODULE_1__.DECLARATION: 1996 element["return"] = prefix(element.value, element.length); 1997 break; 1998 1999 case stylis__WEBPACK_IMPORTED_MODULE_1__.KEYFRAMES: 2000 return (0,stylis__WEBPACK_IMPORTED_MODULE_5__.serialize)([(0,stylis__WEBPACK_IMPORTED_MODULE_4__.copy)(element, { 2001 value: (0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(element.value, '@', '@' + stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT) 2002 })], callback); 2003 2004 case stylis__WEBPACK_IMPORTED_MODULE_1__.RULESET: 2005 if (element.length) return (0,stylis__WEBPACK_IMPORTED_MODULE_2__.combine)(element.props, function (value) { 2006 switch ((0,stylis__WEBPACK_IMPORTED_MODULE_2__.match)(value, /(::plac\w+|:read-\w+)/)) { 2007 // :read-(only|write) 2008 case ':read-only': 2009 case ':read-write': 2010 return (0,stylis__WEBPACK_IMPORTED_MODULE_5__.serialize)([(0,stylis__WEBPACK_IMPORTED_MODULE_4__.copy)(element, { 2011 props: [(0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, /:(read-\w+)/, ':' + stylis__WEBPACK_IMPORTED_MODULE_1__.MOZ + '$1')] 2012 })], callback); 2013 // :placeholder 2014 2015 case '::placeholder': 2016 return (0,stylis__WEBPACK_IMPORTED_MODULE_5__.serialize)([(0,stylis__WEBPACK_IMPORTED_MODULE_4__.copy)(element, { 2017 props: [(0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, /:(plac\w+)/, ':' + stylis__WEBPACK_IMPORTED_MODULE_1__.WEBKIT + 'input-$1')] 2018 }), (0,stylis__WEBPACK_IMPORTED_MODULE_4__.copy)(element, { 2019 props: [(0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, /:(plac\w+)/, ':' + stylis__WEBPACK_IMPORTED_MODULE_1__.MOZ + '$1')] 2020 }), (0,stylis__WEBPACK_IMPORTED_MODULE_4__.copy)(element, { 2021 props: [(0,stylis__WEBPACK_IMPORTED_MODULE_2__.replace)(value, /:(plac\w+)/, stylis__WEBPACK_IMPORTED_MODULE_1__.MS + 'input-$1')] 2022 })], callback); 2023 } 2024 2025 return ''; 2026 }); 2027 } 2028}; 2029 2030var defaultStylisPlugins = [prefixer]; 2031var getSourceMap; 2032 2033{ 2034 var sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g; 2035 2036 getSourceMap = function getSourceMap(styles) { 2037 var matches = styles.match(sourceMapPattern); 2038 if (!matches) return; 2039 return matches[matches.length - 1]; 2040 }; 2041} 2042 2043var createCache = function createCache(options) { 2044 var key = options.key; 2045 2046 if (!key) { 2047 throw new Error("You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\n" + "If multiple caches share the same key they might \"fight\" for each other's style elements."); 2048 } 2049 2050 if (key === 'css') { 2051 var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration 2052 // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be) 2053 // note this very very intentionally targets all style elements regardless of the key to ensure 2054 // that creating a cache works inside of render of a React component 2055 2056 Array.prototype.forEach.call(ssrStyles, function (node) { 2057 // we want to only move elements which have a space in the data-emotion attribute value 2058 // because that indicates that it is an Emotion 11 server-side rendered style elements 2059 // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector 2060 // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes) 2061 // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles 2062 // will not result in the Emotion 10 styles being destroyed 2063 var dataEmotionAttribute = node.getAttribute('data-emotion'); 2064 2065 if (dataEmotionAttribute.indexOf(' ') === -1) { 2066 return; 2067 } 2068 2069 document.head.appendChild(node); 2070 node.setAttribute('data-s', ''); 2071 }); 2072 } 2073 2074 var stylisPlugins = options.stylisPlugins || defaultStylisPlugins; 2075 2076 { 2077 if (/[^a-z-]/.test(key)) { 2078 throw new Error("Emotion key must only contain lower case alphabetical characters and - but \"" + key + "\" was passed"); 2079 } 2080 } 2081 2082 var inserted = {}; 2083 var container; 2084 var nodesToHydrate = []; 2085 2086 { 2087 container = options.container || document.head; 2088 Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which 2089 // means that the style elements we're looking at are only Emotion 11 server-rendered style elements 2090 document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) { 2091 var attrib = node.getAttribute("data-emotion").split(' '); 2092 2093 for (var i = 1; i < attrib.length; i++) { 2094 inserted[attrib[i]] = true; 2095 } 2096 2097 nodesToHydrate.push(node); 2098 }); 2099 } 2100 2101 var _insert; 2102 2103 var omnipresentPlugins = [compat, removeLabel]; 2104 2105 { 2106 omnipresentPlugins.push(createUnsafeSelectorsAlarm({ 2107 get compat() { 2108 return cache.compat; 2109 } 2110 2111 }), incorrectImportAlarm); 2112 } 2113 2114 { 2115 var currentSheet; 2116 var finalizingPlugins = [stylis__WEBPACK_IMPORTED_MODULE_5__.stringify, function (element) { 2117 if (!element.root) { 2118 if (element["return"]) { 2119 currentSheet.insert(element["return"]); 2120 } else if (element.value && element.type !== stylis__WEBPACK_IMPORTED_MODULE_1__.COMMENT) { 2121 // insert empty rule in non-production environments 2122 // so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet 2123 currentSheet.insert(element.value + "{}"); 2124 } 2125 } 2126 } ]; 2127 var serializer = (0,stylis__WEBPACK_IMPORTED_MODULE_6__.middleware)(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins)); 2128 2129 var stylis = function stylis(styles) { 2130 return (0,stylis__WEBPACK_IMPORTED_MODULE_5__.serialize)((0,stylis__WEBPACK_IMPORTED_MODULE_3__.compile)(styles), serializer); 2131 }; 2132 2133 _insert = function insert(selector, serialized, sheet, shouldCache) { 2134 currentSheet = sheet; 2135 2136 if (getSourceMap) { 2137 var sourceMap = getSourceMap(serialized.styles); 2138 2139 if (sourceMap) { 2140 currentSheet = { 2141 insert: function insert(rule) { 2142 sheet.insert(rule + sourceMap); 2143 } 2144 }; 2145 } 2146 } 2147 2148 stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles); 2149 2150 if (shouldCache) { 2151 cache.inserted[serialized.name] = true; 2152 } 2153 }; 2154 } 2155 2156 var cache = { 2157 key: key, 2158 sheet: new _emotion_sheet__WEBPACK_IMPORTED_MODULE_0__.StyleSheet({ 2159 key: key, 2160 container: container, 2161 nonce: options.nonce, 2162 speedy: options.speedy, 2163 prepend: options.prepend, 2164 insertionPoint: options.insertionPoint 2165 }), 2166 nonce: options.nonce, 2167 inserted: inserted, 2168 registered: {}, 2169 insert: _insert 2170 }; 2171 cache.sheet.hydrate(nodesToHydrate); 2172 return cache; 2173}; 2174 2175 2176 2177 2178/***/ }), 2179
vendor: 2,195 bytes, lines 2180-2249
2180/***/ "./node_modules/@emotion/hash/dist/emotion-hash.esm.js": 2181/*!*************************************************************!*\ 2182 !*** ./node_modules/@emotion/hash/dist/emotion-hash.esm.js ***! 2183 \*************************************************************/ 2184/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 2185 2186"use strict"; 2187__webpack_require__.r(__webpack_exports__); 2188/* harmony export */ __webpack_require__.d(__webpack_exports__, { 2189/* harmony export */ "default": () => (/* binding */ murmur2) 2190/* harmony export */ }); 2191/* eslint-disable */ 2192// Inspired by https://github.com/garycourt/murmurhash-js 2193// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86 2194function murmur2(str) { 2195 // 'm' and 'r' are mixing constants generated offline. 2196 // They're not really 'magic', they just happen to work well. 2197 // const m = 0x5bd1e995; 2198 // const r = 24; 2199 // Initialize the hash 2200 var h = 0; // Mix 4 bytes at a time into the hash 2201 2202 var k, 2203 i = 0, 2204 len = str.length; 2205 2206 for (; len >= 4; ++i, len -= 4) { 2207 k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24; 2208 k = 2209 /* Math.imul(k, m): */ 2210 (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16); 2211 k ^= 2212 /* k >>> r: */ 2213 k >>> 24; 2214 h = 2215 /* Math.imul(k, m): */ 2216 (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^ 2217 /* Math.imul(h, m): */ 2218 (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); 2219 } // Handle the last few bytes of the input array 2220 2221 2222 switch (len) { 2223 case 3: 2224 h ^= (str.charCodeAt(i + 2) & 0xff) << 16; 2225 2226 case 2: 2227 h ^= (str.charCodeAt(i + 1) & 0xff) << 8; 2228 2229 case 1: 2230 h ^= str.charCodeAt(i) & 0xff; 2231 h = 2232 /* Math.imul(h, m): */ 2233 (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); 2234 } // Do a few final mixes of the hash to ensure the last few 2235 // bytes are well-incorporated. 2236 2237 2238 h ^= h >>> 13; 2239 h = 2240 /* Math.imul(h, m): */ 2241 (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); 2242 return ((h ^ h >>> 15) >>> 0).toString(36); 2243} 2244 2245 2246 2247 2248/***/ }), 2249
vendor: 766 bytes, lines 2250-2273
2250/***/ "./node_modules/@emotion/memoize/dist/emotion-memoize.esm.js": 2251/*!*******************************************************************!*\ 2252 !*** ./node_modules/@emotion/memoize/dist/emotion-memoize.esm.js ***! 2253 \*******************************************************************/ 2254/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 2255 2256"use strict"; 2257__webpack_require__.r(__webpack_exports__); 2258/* harmony export */ __webpack_require__.d(__webpack_exports__, { 2259/* harmony export */ "default": () => (/* binding */ memoize) 2260/* harmony export */ }); 2261function memoize(fn) { 2262 var cache = Object.create(null); 2263 return function (arg) { 2264 if (cache[arg] === undefined) cache[arg] = fn(arg); 2265 return cache[arg]; 2266 }; 2267} 2268 2269 2270 2271 2272/***/ }), 2273
vendor: 1,574 bytes, lines 2274-2301
2274/***/ "./node_modules/@emotion/react/_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.development.esm.js": 2275/*!*****************************************************************************************************************!*\ 2276 !*** ./node_modules/@emotion/react/_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.development.esm.js ***! 2277 \*****************************************************************************************************************/ 2278/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 2279 2280"use strict"; 2281__webpack_require__.r(__webpack_exports__); 2282/* harmony export */ __webpack_require__.d(__webpack_exports__, { 2283/* harmony export */ "default": () => (/* binding */ hoistNonReactStatics) 2284/* harmony export */ }); 2285/* harmony import */ var hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! hoist-non-react-statics */ "./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js"); 2286/* harmony import */ var hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_0__); 2287 2288 2289// this file isolates this package that is not tree-shakeable 2290// and if this module doesn't actually contain any logic of its own 2291// then Rollup just use 'hoist-non-react-statics' directly in other chunks 2292 2293var hoistNonReactStatics = (function (targetComponent, sourceComponent) { 2294 return hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_0___default()(targetComponent, sourceComponent); 2295}); 2296 2297 2298 2299 2300/***/ }), 2301
vendor: 12,146 bytes, lines 2302-2573
2302/***/ "./node_modules/@emotion/react/dist/emotion-element-489459f2.browser.development.esm.js": 2303/*!**********************************************************************************************!*\ 2304 !*** ./node_modules/@emotion/react/dist/emotion-element-489459f2.browser.development.esm.js ***! 2305 \**********************************************************************************************/ 2306/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 2307 2308"use strict"; 2309__webpack_require__.r(__webpack_exports__); 2310/* harmony export */ __webpack_require__.d(__webpack_exports__, { 2311/* harmony export */ C: () => (/* binding */ CacheProvider), 2312/* harmony export */ E: () => (/* binding */ Emotion$1), 2313/* harmony export */ T: () => (/* binding */ ThemeContext), 2314/* harmony export */ _: () => (/* binding */ __unsafe_useEmotionCache), 2315/* harmony export */ a: () => (/* binding */ ThemeProvider), 2316/* harmony export */ b: () => (/* binding */ withTheme), 2317/* harmony export */ c: () => (/* binding */ createEmotionProps), 2318/* harmony export */ h: () => (/* binding */ hasOwn), 2319/* harmony export */ u: () => (/* binding */ useTheme), 2320/* harmony export */ w: () => (/* binding */ withEmotionCache) 2321/* harmony export */ }); 2322/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 2323/* harmony import */ var _emotion_cache__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @emotion/cache */ "./node_modules/@emotion/cache/dist/emotion-cache.browser.development.esm.js"); 2324/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./node_modules/@babel/runtime/helpers/esm/extends.js"); 2325/* harmony import */ var _emotion_weak_memoize__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @emotion/weak-memoize */ "./node_modules/@emotion/weak-memoize/dist/emotion-weak-memoize.esm.js"); 2326/* harmony import */ var _isolated_hnrs_dist_emotion_react_isolated_hnrs_browser_development_esm_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.development.esm.js */ "./node_modules/@emotion/react/_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.development.esm.js"); 2327/* harmony import */ var _emotion_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @emotion/utils */ "./node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js"); 2328/* harmony import */ var _emotion_serialize__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @emotion/serialize */ "./node_modules/@emotion/serialize/dist/emotion-serialize.development.esm.js"); 2329/* harmony import */ var _emotion_use_insertion_effect_with_fallbacks__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @emotion/use-insertion-effect-with-fallbacks */ "./node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js"); 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340var EmotionCacheContext = /* #__PURE__ */react__WEBPACK_IMPORTED_MODULE_0__.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case 2341// because this module is primarily intended for the browser and node 2342// but it's also required in react native and similar environments sometimes 2343// and we could have a special build just for that 2344// but this is much easier and the native packages 2345// might use a different theme context in the future anyway 2346typeof HTMLElement !== 'undefined' ? /* #__PURE__ */(0,_emotion_cache__WEBPACK_IMPORTED_MODULE_1__["default"])({ 2347 key: 'css' 2348}) : null); 2349 2350{ 2351 EmotionCacheContext.displayName = 'EmotionCacheContext'; 2352} 2353 2354var CacheProvider = EmotionCacheContext.Provider; 2355var __unsafe_useEmotionCache = function useEmotionCache() { 2356 return (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(EmotionCacheContext); 2357}; 2358 2359var withEmotionCache = function withEmotionCache(func) { 2360 return /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function (props, ref) { 2361 // the cache will never be null in the browser 2362 var cache = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(EmotionCacheContext); 2363 return func(props, cache, ref); 2364 }); 2365}; 2366 2367var ThemeContext = /* #__PURE__ */react__WEBPACK_IMPORTED_MODULE_0__.createContext({}); 2368 2369{ 2370 ThemeContext.displayName = 'EmotionThemeContext'; 2371} 2372 2373var useTheme = function useTheme() { 2374 return react__WEBPACK_IMPORTED_MODULE_0__.useContext(ThemeContext); 2375}; 2376 2377var getTheme = function getTheme(outerTheme, theme) { 2378 if (typeof theme === 'function') { 2379 var mergedTheme = theme(outerTheme); 2380 2381 if ((mergedTheme == null || typeof mergedTheme !== 'object' || Array.isArray(mergedTheme))) { 2382 throw new Error('[ThemeProvider] Please return an object from your theme function, i.e. theme={() => ({})}!'); 2383 } 2384 2385 return mergedTheme; 2386 } 2387 2388 if ((theme == null || typeof theme !== 'object' || Array.isArray(theme))) { 2389 throw new Error('[ThemeProvider] Please make your theme prop a plain object'); 2390 } 2391 2392 return (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_2__["default"])({}, outerTheme, theme); 2393}; 2394 2395var createCacheWithTheme = /* #__PURE__ */(0,_emotion_weak_memoize__WEBPACK_IMPORTED_MODULE_3__["default"])(function (outerTheme) { 2396 return (0,_emotion_weak_memoize__WEBPACK_IMPORTED_MODULE_3__["default"])(function (theme) { 2397 return getTheme(outerTheme, theme); 2398 }); 2399}); 2400var ThemeProvider = function ThemeProvider(props) { 2401 var theme = react__WEBPACK_IMPORTED_MODULE_0__.useContext(ThemeContext); 2402 2403 if (props.theme !== theme) { 2404 theme = createCacheWithTheme(theme)(props.theme); 2405 } 2406 2407 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ThemeContext.Provider, { 2408 value: theme 2409 }, props.children); 2410}; 2411function withTheme(Component) { 2412 var componentName = Component.displayName || Component.name || 'Component'; 2413 var WithTheme = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(function render(props, ref) { 2414 var theme = react__WEBPACK_IMPORTED_MODULE_0__.useContext(ThemeContext); 2415 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Component, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_2__["default"])({ 2416 theme: theme, 2417 ref: ref 2418 }, props)); 2419 }); 2420 WithTheme.displayName = "WithTheme(" + componentName + ")"; 2421 return (0,_isolated_hnrs_dist_emotion_react_isolated_hnrs_browser_development_esm_js__WEBPACK_IMPORTED_MODULE_4__["default"])(WithTheme, Component); 2422} 2423 2424var hasOwn = {}.hasOwnProperty; 2425 2426var getLastPart = function getLastPart(functionName) { 2427 // The match may be something like 'Object.createEmotionProps' or 2428 // 'Loader.prototype.render' 2429 var parts = functionName.split('.'); 2430 return parts[parts.length - 1]; 2431}; 2432 2433var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine(line) { 2434 // V8 2435 var match = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line); 2436 if (match) return getLastPart(match[1]); // Safari / Firefox 2437 2438 match = /^([A-Za-z0-9$.]+)@/.exec(line); 2439 if (match) return getLastPart(match[1]); 2440 return undefined; 2441}; 2442 2443var internalReactFunctionNames = /* #__PURE__ */new Set(['renderWithHooks', 'processChild', 'finishClassComponent', 'renderToString']); // These identifiers come from error stacks, so they have to be valid JS 2444// identifiers, thus we only need to replace what is a valid character for JS, 2445// but not for CSS. 2446 2447var sanitizeIdentifier = function sanitizeIdentifier(identifier) { 2448 return identifier.replace(/\$/g, '-'); 2449}; 2450 2451var getLabelFromStackTrace = function getLabelFromStackTrace(stackTrace) { 2452 if (!stackTrace) return undefined; 2453 var lines = stackTrace.split('\n'); 2454 2455 for (var i = 0; i < lines.length; i++) { 2456 var functionName = getFunctionNameFromStackTraceLine(lines[i]); // The first line of V8 stack traces is just "Error" 2457 2458 if (!functionName) continue; // If we reach one of these, we have gone too far and should quit 2459 2460 if (internalReactFunctionNames.has(functionName)) break; // The component name is the first function in the stack that starts with an 2461 // uppercase letter 2462 2463 if (/^[A-Z]/.test(functionName)) return sanitizeIdentifier(functionName); 2464 } 2465 2466 return undefined; 2467}; 2468 2469var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__'; 2470var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__'; 2471var createEmotionProps = function createEmotionProps(type, props) { 2472 if (typeof props.css === 'string' && // check if there is a css declaration 2473 props.css.indexOf(':') !== -1) { 2474 throw new Error("Strings are not allowed as css prop values, please wrap it in a css template literal from '@emotion/react' like this: css`" + props.css + "`"); 2475 } 2476 2477 var newProps = {}; 2478 2479 for (var _key in props) { 2480 if (hasOwn.call(props, _key)) { 2481 newProps[_key] = props[_key]; 2482 } 2483 } 2484 2485 newProps[typePropName] = type; // Runtime labeling is an opt-in feature because: 2486 // - It causes hydration warnings when using Safari and SSR 2487 // - It can degrade performance if there are a huge number of elements 2488 // 2489 // Even if the flag is set, we still don't compute the label if it has already 2490 // been determined by the Babel plugin. 2491 2492 if (typeof globalThis !== 'undefined' && !!globalThis.EMOTION_RUNTIME_AUTO_LABEL && !!props.css && (typeof props.css !== 'object' || !('name' in props.css) || typeof props.css.name !== 'string' || props.css.name.indexOf('-') === -1)) { 2493 var label = getLabelFromStackTrace(new Error().stack); 2494 if (label) newProps[labelPropName] = label; 2495 } 2496 2497 return newProps; 2498}; 2499 2500var Insertion = function Insertion(_ref) { 2501 var cache = _ref.cache, 2502 serialized = _ref.serialized, 2503 isStringTag = _ref.isStringTag; 2504 (0,_emotion_utils__WEBPACK_IMPORTED_MODULE_5__.registerStyles)(cache, serialized, isStringTag); 2505 (0,_emotion_use_insertion_effect_with_fallbacks__WEBPACK_IMPORTED_MODULE_7__.useInsertionEffectAlwaysWithSyncFallback)(function () { 2506 return (0,_emotion_utils__WEBPACK_IMPORTED_MODULE_5__.insertStyles)(cache, serialized, isStringTag); 2507 }); 2508 2509 return null; 2510}; 2511 2512var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) { 2513 var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works 2514 // not passing the registered cache to serializeStyles because it would 2515 // make certain babel optimisations not possible 2516 2517 if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) { 2518 cssProp = cache.registered[cssProp]; 2519 } 2520 2521 var WrappedComponent = props[typePropName]; 2522 var registeredStyles = [cssProp]; 2523 var className = ''; 2524 2525 if (typeof props.className === 'string') { 2526 className = (0,_emotion_utils__WEBPACK_IMPORTED_MODULE_5__.getRegisteredStyles)(cache.registered, registeredStyles, props.className); 2527 } else if (props.className != null) { 2528 className = props.className + " "; 2529 } 2530 2531 var serialized = (0,_emotion_serialize__WEBPACK_IMPORTED_MODULE_6__.serializeStyles)(registeredStyles, undefined, react__WEBPACK_IMPORTED_MODULE_0__.useContext(ThemeContext)); 2532 2533 if (serialized.name.indexOf('-') === -1) { 2534 var labelFromStack = props[labelPropName]; 2535 2536 if (labelFromStack) { 2537 serialized = (0,_emotion_serialize__WEBPACK_IMPORTED_MODULE_6__.serializeStyles)([serialized, 'label:' + labelFromStack + ';']); 2538 } 2539 } 2540 2541 className += cache.key + "-" + serialized.name; 2542 var newProps = {}; 2543 2544 for (var _key2 in props) { 2545 if (hasOwn.call(props, _key2) && _key2 !== 'css' && _key2 !== typePropName && (_key2 !== labelPropName)) { 2546 newProps[_key2] = props[_key2]; 2547 } 2548 } 2549 2550 newProps.className = className; 2551 2552 if (ref) { 2553 newProps.ref = ref; 2554 } 2555 2556 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Insertion, { 2557 cache: cache, 2558 serialized: serialized, 2559 isStringTag: typeof WrappedComponent === 'string' 2560 }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(WrappedComponent, newProps)); 2561}); 2562 2563{ 2564 Emotion.displayName = 'EmotionCssPropInternal'; 2565} 2566 2567var Emotion$1 = Emotion; 2568 2569 2570 2571 2572/***/ }), 2573
vendor: 27,136 bytes, lines 2574-3215
2574/***/ "./node_modules/@emotion/react/dist/emotion-react.browser.development.esm.js": 2575/*!***********************************************************************************!*\ 2576 !*** ./node_modules/@emotion/react/dist/emotion-react.browser.development.esm.js ***! 2577 \***********************************************************************************/ 2578/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 2579 2580"use strict"; 2581__webpack_require__.r(__webpack_exports__); 2582/* harmony export */ __webpack_require__.d(__webpack_exports__, { 2583/* harmony export */ CacheProvider: () => (/* reexport safe */ _emotion_element_489459f2_browser_development_esm_js__WEBPACK_IMPORTED_MODULE_0__.C), 2584/* harmony export */ ClassNames: () => (/* binding */ ClassNames), 2585/* harmony export */ Global: () => (/* binding */ Global), 2586/* harmony export */ ThemeContext: () => (/* reexport safe */ _emotion_element_489459f2_browser_development_esm_js__WEBPACK_IMPORTED_MODULE_0__.T), 2587/* harmony export */ ThemeProvider: () => (/* reexport safe */ _emotion_element_489459f2_browser_development_esm_js__WEBPACK_IMPORTED_MODULE_0__.a), 2588/* harmony export */ __unsafe_useEmotionCache: () => (/* reexport safe */ _emotion_element_489459f2_browser_development_esm_js__WEBPACK_IMPORTED_MODULE_0__._), 2589/* harmony export */ createElement: () => (/* binding */ jsx), 2590/* harmony export */ css: () => (/* binding */ css), 2591/* harmony export */ jsx: () => (/* binding */ jsx), 2592/* harmony export */ keyframes: () => (/* binding */ keyframes), 2593/* harmony export */ useTheme: () => (/* reexport safe */ _emotion_element_489459f2_browser_development_esm_js__WEBPACK_IMPORTED_MODULE_0__.u), 2594/* harmony export */ withEmotionCache: () => (/* reexport safe */ _emotion_element_489459f2_browser_development_esm_js__WEBPACK_IMPORTED_MODULE_0__.w), 2595/* harmony export */ withTheme: () => (/* reexport safe */ _emotion_element_489459f2_browser_development_esm_js__WEBPACK_IMPORTED_MODULE_0__.b) 2596/* harmony export */ }); 2597/* harmony import */ var _emotion_element_489459f2_browser_development_esm_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./emotion-element-489459f2.browser.development.esm.js */ "./node_modules/@emotion/react/dist/emotion-element-489459f2.browser.development.esm.js"); 2598/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 2599/* harmony import */ var _emotion_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @emotion/utils */ "./node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js"); 2600/* harmony import */ var _emotion_use_insertion_effect_with_fallbacks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @emotion/use-insertion-effect-with-fallbacks */ "./node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js"); 2601/* harmony import */ var _emotion_serialize__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @emotion/serialize */ "./node_modules/@emotion/serialize/dist/emotion-serialize.development.esm.js"); 2602/* harmony import */ var _emotion_cache__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @emotion/cache */ "./node_modules/@emotion/cache/dist/emotion-cache.browser.development.esm.js"); 2603/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/extends */ "./node_modules/@babel/runtime/helpers/esm/extends.js"); 2604/* harmony import */ var _emotion_weak_memoize__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @emotion/weak-memoize */ "./node_modules/@emotion/weak-memoize/dist/emotion-weak-memoize.esm.js"); 2605/* harmony import */ var hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! hoist-non-react-statics */ "./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js"); 2606/* harmony import */ var hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_8__); 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619var isDevelopment = true; 2620 2621var pkg = { 2622 name: "@emotion/react", 2623 version: "11.14.0", 2624 main: "dist/emotion-react.cjs.js", 2625 module: "dist/emotion-react.esm.js", 2626 types: "dist/emotion-react.cjs.d.ts", 2627 exports: { 2628 ".": { 2629 types: { 2630 "import": "./dist/emotion-react.cjs.mjs", 2631 "default": "./dist/emotion-react.cjs.js" 2632 }, 2633 development: { 2634 "edge-light": { 2635 module: "./dist/emotion-react.development.edge-light.esm.js", 2636 "import": "./dist/emotion-react.development.edge-light.cjs.mjs", 2637 "default": "./dist/emotion-react.development.edge-light.cjs.js" 2638 }, 2639 worker: { 2640 module: "./dist/emotion-react.development.edge-light.esm.js", 2641 "import": "./dist/emotion-react.development.edge-light.cjs.mjs", 2642 "default": "./dist/emotion-react.development.edge-light.cjs.js" 2643 }, 2644 workerd: { 2645 module: "./dist/emotion-react.development.edge-light.esm.js", 2646 "import": "./dist/emotion-react.development.edge-light.cjs.mjs", 2647 "default": "./dist/emotion-react.development.edge-light.cjs.js" 2648 }, 2649 browser: { 2650 module: "./dist/emotion-react.browser.development.esm.js", 2651 "import": "./dist/emotion-react.browser.development.cjs.mjs", 2652 "default": "./dist/emotion-react.browser.development.cjs.js" 2653 }, 2654 module: "./dist/emotion-react.development.esm.js", 2655 "import": "./dist/emotion-react.development.cjs.mjs", 2656 "default": "./dist/emotion-react.development.cjs.js" 2657 }, 2658 "edge-light": { 2659 module: "./dist/emotion-react.edge-light.esm.js", 2660 "import": "./dist/emotion-react.edge-light.cjs.mjs", 2661 "default": "./dist/emotion-react.edge-light.cjs.js" 2662 }, 2663 worker: { 2664 module: "./dist/emotion-react.edge-light.esm.js", 2665 "import": "./dist/emotion-react.edge-light.cjs.mjs", 2666 "default": "./dist/emotion-react.edge-light.cjs.js" 2667 }, 2668 workerd: { 2669 module: "./dist/emotion-react.edge-light.esm.js", 2670 "import": "./dist/emotion-react.edge-light.cjs.mjs", 2671 "default": "./dist/emotion-react.edge-light.cjs.js" 2672 }, 2673 browser: { 2674 module: "./dist/emotion-react.browser.esm.js", 2675 "import": "./dist/emotion-react.browser.cjs.mjs", 2676 "default": "./dist/emotion-react.browser.cjs.js" 2677 }, 2678 module: "./dist/emotion-react.esm.js", 2679 "import": "./dist/emotion-react.cjs.mjs", 2680 "default": "./dist/emotion-react.cjs.js" 2681 }, 2682 "./jsx-runtime": { 2683 types: { 2684 "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.mjs", 2685 "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.js" 2686 }, 2687 development: { 2688 "edge-light": { 2689 module: "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.esm.js", 2690 "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.cjs.mjs", 2691 "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.cjs.js" 2692 }, 2693 worker: { 2694 module: "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.esm.js", 2695 "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.cjs.mjs", 2696 "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.cjs.js" 2697 }, 2698 workerd: { 2699 module: "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.esm.js", 2700 "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.cjs.mjs", 2701 "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.edge-light.cjs.js" 2702 }, 2703 browser: { 2704 module: "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.development.esm.js", 2705 "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.development.cjs.mjs", 2706 "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.development.cjs.js" 2707 }, 2708 module: "./jsx-runtime/dist/emotion-react-jsx-runtime.development.esm.js", 2709 "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.cjs.mjs", 2710 "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.development.cjs.js" 2711 }, 2712 "edge-light": { 2713 module: "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.esm.js", 2714 "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.cjs.mjs", 2715 "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.cjs.js" 2716 }, 2717 worker: { 2718 module: "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.esm.js", 2719 "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.cjs.mjs", 2720 "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.cjs.js" 2721 }, 2722 workerd: { 2723 module: "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.esm.js", 2724 "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.cjs.mjs", 2725 "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.edge-light.cjs.js" 2726 }, 2727 browser: { 2728 module: "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js", 2729 "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.cjs.mjs", 2730 "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.cjs.js" 2731 }, 2732 module: "./jsx-runtime/dist/emotion-react-jsx-runtime.esm.js", 2733 "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.mjs", 2734 "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.js" 2735 }, 2736 "./_isolated-hnrs": { 2737 types: { 2738 "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.mjs", 2739 "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.js" 2740 }, 2741 development: { 2742 "edge-light": { 2743 module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.esm.js", 2744 "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.mjs", 2745 "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.js" 2746 }, 2747 worker: { 2748 module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.esm.js", 2749 "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.mjs", 2750 "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.js" 2751 }, 2752 workerd: { 2753 module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.esm.js", 2754 "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.mjs", 2755 "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.edge-light.cjs.js" 2756 }, 2757 browser: { 2758 module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.development.esm.js", 2759 "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.development.cjs.mjs", 2760 "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.development.cjs.js" 2761 }, 2762 module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.esm.js", 2763 "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.cjs.mjs", 2764 "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.development.cjs.js" 2765 }, 2766 "edge-light": { 2767 module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.esm.js", 2768 "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.mjs", 2769 "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.js" 2770 }, 2771 worker: { 2772 module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.esm.js", 2773 "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.mjs", 2774 "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.js" 2775 }, 2776 workerd: { 2777 module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.esm.js", 2778 "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.mjs", 2779 "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.edge-light.cjs.js" 2780 }, 2781 browser: { 2782 module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js", 2783 "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.cjs.mjs", 2784 "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.cjs.js" 2785 }, 2786 module: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.js", 2787 "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.mjs", 2788 "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.js" 2789 }, 2790 "./jsx-dev-runtime": { 2791 types: { 2792 "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.mjs", 2793 "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.js" 2794 }, 2795 development: { 2796 "edge-light": { 2797 module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.esm.js", 2798 "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.cjs.mjs", 2799 "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.cjs.js" 2800 }, 2801 worker: { 2802 module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.esm.js", 2803 "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.cjs.mjs", 2804 "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.cjs.js" 2805 }, 2806 workerd: { 2807 module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.esm.js", 2808 "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.cjs.mjs", 2809 "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.edge-light.cjs.js" 2810 }, 2811 browser: { 2812 module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.development.esm.js", 2813 "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.development.cjs.mjs", 2814 "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.development.cjs.js" 2815 }, 2816 module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.esm.js", 2817 "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.cjs.mjs", 2818 "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.development.cjs.js" 2819 }, 2820 "edge-light": { 2821 module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.esm.js", 2822 "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.cjs.mjs", 2823 "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.cjs.js" 2824 }, 2825 worker: { 2826 module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.esm.js", 2827 "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.cjs.mjs", 2828 "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.cjs.js" 2829 }, 2830 workerd: { 2831 module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.esm.js", 2832 "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.cjs.mjs", 2833 "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.edge-light.cjs.js" 2834 }, 2835 browser: { 2836 module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.esm.js", 2837 "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.cjs.mjs", 2838 "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.cjs.js" 2839 }, 2840 module: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.esm.js", 2841 "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.mjs", 2842 "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.js" 2843 }, 2844 "./package.json": "./package.json", 2845 "./types/css-prop": "./types/css-prop.d.ts", 2846 "./macro": { 2847 types: { 2848 "import": "./macro.d.mts", 2849 "default": "./macro.d.ts" 2850 }, 2851 "default": "./macro.js" 2852 } 2853 }, 2854 imports: { 2855 "#is-development": { 2856 development: "./src/conditions/true.ts", 2857 "default": "./src/conditions/false.ts" 2858 }, 2859 "#is-browser": { 2860 "edge-light": "./src/conditions/false.ts", 2861 workerd: "./src/conditions/false.ts", 2862 worker: "./src/conditions/false.ts", 2863 browser: "./src/conditions/true.ts", 2864 "default": "./src/conditions/is-browser.ts" 2865 } 2866 }, 2867 files: [ 2868 "src", 2869 "dist", 2870 "jsx-runtime", 2871 "jsx-dev-runtime", 2872 "_isolated-hnrs", 2873 "types/css-prop.d.ts", 2874 "macro.*" 2875 ], 2876 sideEffects: false, 2877 author: "Emotion Contributors", 2878 license: "MIT", 2879 scripts: { 2880 "test:typescript": "dtslint types" 2881 }, 2882 dependencies: { 2883 "@babel/runtime": "^7.18.3", 2884 "@emotion/babel-plugin": "^11.13.5", 2885 "@emotion/cache": "^11.14.0", 2886 "@emotion/serialize": "^1.3.3", 2887 "@emotion/use-insertion-effect-with-fallbacks": "^1.2.0", 2888 "@emotion/utils": "^1.4.2", 2889 "@emotion/weak-memoize": "^0.4.0", 2890 "hoist-non-react-statics": "^3.3.1" 2891 }, 2892 peerDependencies: { 2893 react: ">=16.8.0" 2894 }, 2895 peerDependenciesMeta: { 2896 "@types/react": { 2897 optional: true 2898 } 2899 }, 2900 devDependencies: { 2901 "@definitelytyped/dtslint": "0.0.112", 2902 "@emotion/css": "11.13.5", 2903 "@emotion/css-prettifier": "1.2.0", 2904 "@emotion/server": "11.11.0", 2905 "@emotion/styled": "11.14.0", 2906 "@types/hoist-non-react-statics": "^3.3.5", 2907 "html-tag-names": "^1.1.2", 2908 react: "16.14.0", 2909 "svg-tag-names": "^1.1.1", 2910 typescript: "^5.4.5" 2911 }, 2912 repository: "https://github.com/emotion-js/emotion/tree/main/packages/react", 2913 publishConfig: { 2914 access: "public" 2915 }, 2916 "umd:main": "dist/emotion-react.umd.min.js", 2917 preconstruct: { 2918 entrypoints: [ 2919 "./index.ts", 2920 "./jsx-runtime.ts", 2921 "./jsx-dev-runtime.ts", 2922 "./_isolated-hnrs.ts" 2923 ], 2924 umdName: "emotionReact", 2925 exports: { 2926 extra: { 2927 "./types/css-prop": "./types/css-prop.d.ts", 2928 "./macro": { 2929 types: { 2930 "import": "./macro.d.mts", 2931 "default": "./macro.d.ts" 2932 }, 2933 "default": "./macro.js" 2934 } 2935 } 2936 } 2937 } 2938}; 2939 2940var jsx = function jsx(type, props) { 2941 // eslint-disable-next-line prefer-rest-params 2942 var args = arguments; 2943 2944 if (props == null || !_emotion_element_489459f2_browser_development_esm_js__WEBPACK_IMPORTED_MODULE_0__.h.call(props, 'css')) { 2945 return react__WEBPACK_IMPORTED_MODULE_1__.createElement.apply(undefined, args); 2946 } 2947 2948 var argsLength = args.length; 2949 var createElementArgArray = new Array(argsLength); 2950 createElementArgArray[0] = _emotion_element_489459f2_browser_development_esm_js__WEBPACK_IMPORTED_MODULE_0__.E; 2951 createElementArgArray[1] = (0,_emotion_element_489459f2_browser_development_esm_js__WEBPACK_IMPORTED_MODULE_0__.c)(type, props); 2952 2953 for (var i = 2; i < argsLength; i++) { 2954 createElementArgArray[i] = args[i]; 2955 } 2956 2957 return react__WEBPACK_IMPORTED_MODULE_1__.createElement.apply(null, createElementArgArray); 2958}; 2959 2960(function (_jsx) { 2961 var JSX; 2962 2963 (function (_JSX) {})(JSX || (JSX = _jsx.JSX || (_jsx.JSX = {}))); 2964})(jsx || (jsx = {})); 2965 2966var warnedAboutCssPropForGlobal = false; // maintain place over rerenders. 2967// initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild 2968// initial client-side render from SSR, use place of hydrating tag 2969 2970var Global = /* #__PURE__ */(0,_emotion_element_489459f2_browser_development_esm_js__WEBPACK_IMPORTED_MODULE_0__.w)(function (props, cache) { 2971 if (!warnedAboutCssPropForGlobal && ( // check for className as well since the user is 2972 // probably using the custom createElement which 2973 // means it will be turned into a className prop 2974 // I don't really want to add it to the type since it shouldn't be used 2975 'className' in props && props.className || 'css' in props && props.css)) { 2976 console.error("It looks like you're using the css prop on Global, did you mean to use the styles prop instead?"); 2977 warnedAboutCssPropForGlobal = true; 2978 } 2979 2980 var styles = props.styles; 2981 var serialized = (0,_emotion_serialize__WEBPACK_IMPORTED_MODULE_4__.serializeStyles)([styles], undefined, react__WEBPACK_IMPORTED_MODULE_1__.useContext(_emotion_element_489459f2_browser_development_esm_js__WEBPACK_IMPORTED_MODULE_0__.T)); 2982 // but it is based on a constant that will never change at runtime 2983 // it's effectively like having two implementations and switching them out 2984 // so it's not actually breaking anything 2985 2986 2987 var sheetRef = react__WEBPACK_IMPORTED_MODULE_1__.useRef(); 2988 (0,_emotion_use_insertion_effect_with_fallbacks__WEBPACK_IMPORTED_MODULE_3__.useInsertionEffectWithLayoutFallback)(function () { 2989 var key = cache.key + "-global"; // use case of https://github.com/emotion-js/emotion/issues/2675 2990 2991 var sheet = new cache.sheet.constructor({ 2992 key: key, 2993 nonce: cache.sheet.nonce, 2994 container: cache.sheet.container, 2995 speedy: cache.sheet.isSpeedy 2996 }); 2997 var rehydrating = false; 2998 var node = document.querySelector("style[data-emotion=\"" + key + " " + serialized.name + "\"]"); 2999 3000 if (cache.sheet.tags.length) { 3001 sheet.before = cache.sheet.tags[0]; 3002 } 3003 3004 if (node !== null) { 3005 rehydrating = true; // clear the hash so this node won't be recognizable as rehydratable by other <Global/>s 3006 3007 node.setAttribute('data-emotion', key); 3008 sheet.hydrate([node]); 3009 } 3010 3011 sheetRef.current = [sheet, rehydrating]; 3012 return function () { 3013 sheet.flush(); 3014 }; 3015 }, [cache]); 3016 (0,_emotion_use_insertion_effect_with_fallbacks__WEBPACK_IMPORTED_MODULE_3__.useInsertionEffectWithLayoutFallback)(function () { 3017 var sheetRefCurrent = sheetRef.current; 3018 var sheet = sheetRefCurrent[0], 3019 rehydrating = sheetRefCurrent[1]; 3020 3021 if (rehydrating) { 3022 sheetRefCurrent[1] = false; 3023 return; 3024 } 3025 3026 if (serialized.next !== undefined) { 3027 // insert keyframes 3028 (0,_emotion_utils__WEBPACK_IMPORTED_MODULE_2__.insertStyles)(cache, serialized.next, true); 3029 } 3030 3031 if (sheet.tags.length) { 3032 // if this doesn't exist then it will be null so the style element will be appended 3033 var element = sheet.tags[sheet.tags.length - 1].nextElementSibling; 3034 sheet.before = element; 3035 sheet.flush(); 3036 } 3037 3038 cache.insert("", serialized, sheet, false); 3039 }, [cache, serialized.name]); 3040 return null; 3041}); 3042 3043{ 3044 Global.displayName = 'EmotionGlobal'; 3045} 3046 3047function css() { 3048 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 3049 args[_key] = arguments[_key]; 3050 } 3051 3052 return (0,_emotion_serialize__WEBPACK_IMPORTED_MODULE_4__.serializeStyles)(args); 3053} 3054 3055function keyframes() { 3056 var insertable = css.apply(void 0, arguments); 3057 var name = "animation-" + insertable.name; 3058 return { 3059 name: name, 3060 styles: "@keyframes " + name + "{" + insertable.styles + "}", 3061 anim: 1, 3062 toString: function toString() { 3063 return "_EMO_" + this.name + "_" + this.styles + "_EMO_"; 3064 } 3065 }; 3066} 3067 3068var classnames = function classnames(args) { 3069 var len = args.length; 3070 var i = 0; 3071 var cls = ''; 3072 3073 for (; i < len; i++) { 3074 var arg = args[i]; 3075 if (arg == null) continue; 3076 var toAdd = void 0; 3077 3078 switch (typeof arg) { 3079 case 'boolean': 3080 break; 3081 3082 case 'object': 3083 { 3084 if (Array.isArray(arg)) { 3085 toAdd = classnames(arg); 3086 } else { 3087 if (arg.styles !== undefined && arg.name !== undefined) { 3088 console.error('You have passed styles created with `css` from `@emotion/react` package to the `cx`.\n' + '`cx` is meant to compose class names (strings) so you should convert those styles to a class name by passing them to the `css` received from <ClassNames/> component.'); 3089 } 3090 3091 toAdd = ''; 3092 3093 for (var k in arg) { 3094 if (arg[k] && k) { 3095 toAdd && (toAdd += ' '); 3096 toAdd += k; 3097 } 3098 } 3099 } 3100 3101 break; 3102 } 3103 3104 default: 3105 { 3106 toAdd = arg; 3107 } 3108 } 3109 3110 if (toAdd) { 3111 cls && (cls += ' '); 3112 cls += toAdd; 3113 } 3114 } 3115 3116 return cls; 3117}; 3118 3119function merge(registered, css, className) { 3120 var registeredStyles = []; 3121 var rawClassName = (0,_emotion_utils__WEBPACK_IMPORTED_MODULE_2__.getRegisteredStyles)(registered, registeredStyles, className); 3122 3123 if (registeredStyles.length < 2) { 3124 return className; 3125 } 3126 3127 return rawClassName + css(registeredStyles); 3128} 3129 3130var Insertion = function Insertion(_ref) { 3131 var cache = _ref.cache, 3132 serializedArr = _ref.serializedArr; 3133 (0,_emotion_use_insertion_effect_with_fallbacks__WEBPACK_IMPORTED_MODULE_3__.useInsertionEffectAlwaysWithSyncFallback)(function () { 3134 3135 for (var i = 0; i < serializedArr.length; i++) { 3136 (0,_emotion_utils__WEBPACK_IMPORTED_MODULE_2__.insertStyles)(cache, serializedArr[i], false); 3137 } 3138 }); 3139 3140 return null; 3141}; 3142 3143var ClassNames = /* #__PURE__ */(0,_emotion_element_489459f2_browser_development_esm_js__WEBPACK_IMPORTED_MODULE_0__.w)(function (props, cache) { 3144 var hasRendered = false; 3145 var serializedArr = []; 3146 3147 var css = function css() { 3148 if (hasRendered && isDevelopment) { 3149 throw new Error('css can only be used during render'); 3150 } 3151 3152 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 3153 args[_key] = arguments[_key]; 3154 } 3155 3156 var serialized = (0,_emotion_serialize__WEBPACK_IMPORTED_MODULE_4__.serializeStyles)(args, cache.registered); 3157 serializedArr.push(serialized); // registration has to happen here as the result of this might get consumed by `cx` 3158 3159 (0,_emotion_utils__WEBPACK_IMPORTED_MODULE_2__.registerStyles)(cache, serialized, false); 3160 return cache.key + "-" + serialized.name; 3161 }; 3162 3163 var cx = function cx() { 3164 if (hasRendered && isDevelopment) { 3165 throw new Error('cx can only be used during render'); 3166 } 3167 3168 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 3169 args[_key2] = arguments[_key2]; 3170 } 3171 3172 return merge(cache.registered, css, classnames(args)); 3173 }; 3174 3175 var content = { 3176 css: css, 3177 cx: cx, 3178 theme: react__WEBPACK_IMPORTED_MODULE_1__.useContext(_emotion_element_489459f2_browser_development_esm_js__WEBPACK_IMPORTED_MODULE_0__.T) 3179 }; 3180 var ele = props.children(content); 3181 hasRendered = true; 3182 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__.createElement(react__WEBPACK_IMPORTED_MODULE_1__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1__.createElement(Insertion, { 3183 cache: cache, 3184 serializedArr: serializedArr 3185 }), ele); 3186}); 3187 3188{ 3189 ClassNames.displayName = 'EmotionClassNames'; 3190} 3191 3192{ 3193 var isBrowser = typeof document !== 'undefined'; // #1727, #2905 for some reason Jest and Vitest evaluate modules twice if some consuming module gets mocked 3194 3195 var isTestEnv = typeof jest !== 'undefined' || typeof vi !== 'undefined'; 3196 3197 if (isBrowser && !isTestEnv) { 3198 // globalThis has wide browser support - https://caniuse.com/?search=globalThis, Node.js 12 and later 3199 var globalContext = typeof globalThis !== 'undefined' ? globalThis // eslint-disable-line no-undef 3200 : isBrowser ? window : __webpack_require__.g; 3201 var globalKey = "__EMOTION_REACT_" + pkg.version.split('.')[0] + "__"; 3202 3203 if (globalContext[globalKey]) { 3204 console.warn('You are loading @emotion/react when it is already loaded. Running ' + 'multiple instances may cause problems. This can happen if multiple ' + 'versions are used, or if multiple builds of the same version are ' + 'used.'); 3205 } 3206 3207 globalContext[globalKey] = true; 3208 } 3209} 3210 3211 3212 3213 3214/***/ }), 3215
vendor: 11,556 bytes, lines 3216-3537
3216/***/ "./node_modules/@emotion/serialize/dist/emotion-serialize.development.esm.js": 3217/*!***********************************************************************************!*\ 3218 !*** ./node_modules/@emotion/serialize/dist/emotion-serialize.development.esm.js ***! 3219 \***********************************************************************************/ 3220/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 3221 3222"use strict"; 3223__webpack_require__.r(__webpack_exports__); 3224/* harmony export */ __webpack_require__.d(__webpack_exports__, { 3225/* harmony export */ serializeStyles: () => (/* binding */ serializeStyles) 3226/* harmony export */ }); 3227/* harmony import */ var _emotion_hash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @emotion/hash */ "./node_modules/@emotion/hash/dist/emotion-hash.esm.js"); 3228/* harmony import */ var _emotion_unitless__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @emotion/unitless */ "./node_modules/@emotion/unitless/dist/emotion-unitless.esm.js"); 3229/* harmony import */ var _emotion_memoize__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @emotion/memoize */ "./node_modules/@emotion/memoize/dist/emotion-memoize.esm.js"); 3230 3231 3232 3233 3234var isDevelopment = true; 3235 3236var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences"; 3237var UNDEFINED_AS_OBJECT_KEY_ERROR = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key)."; 3238var hyphenateRegex = /[A-Z]|^ms/g; 3239var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g; 3240 3241var isCustomProperty = function isCustomProperty(property) { 3242 return property.charCodeAt(1) === 45; 3243}; 3244 3245var isProcessableValue = function isProcessableValue(value) { 3246 return value != null && typeof value !== 'boolean'; 3247}; 3248 3249var processStyleName = /* #__PURE__ */(0,_emotion_memoize__WEBPACK_IMPORTED_MODULE_2__["default"])(function (styleName) { 3250 return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase(); 3251}); 3252 3253var processStyleValue = function processStyleValue(key, value) { 3254 switch (key) { 3255 case 'animation': 3256 case 'animationName': 3257 { 3258 if (typeof value === 'string') { 3259 return value.replace(animationRegex, function (match, p1, p2) { 3260 cursor = { 3261 name: p1, 3262 styles: p2, 3263 next: cursor 3264 }; 3265 return p1; 3266 }); 3267 } 3268 } 3269 } 3270 3271 if (_emotion_unitless__WEBPACK_IMPORTED_MODULE_1__["default"][key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) { 3272 return value + 'px'; 3273 } 3274 3275 return value; 3276}; 3277 3278{ 3279 var contentValuePattern = /(var|attr|counters?|url|element|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/; 3280 var contentValues = ['normal', 'none', 'initial', 'inherit', 'unset']; 3281 var oldProcessStyleValue = processStyleValue; 3282 var msPattern = /^-ms-/; 3283 var hyphenPattern = /-(.)/g; 3284 var hyphenatedCache = {}; 3285 3286 processStyleValue = function processStyleValue(key, value) { 3287 if (key === 'content') { 3288 if (typeof value !== 'string' || contentValues.indexOf(value) === -1 && !contentValuePattern.test(value) && (value.charAt(0) !== value.charAt(value.length - 1) || value.charAt(0) !== '"' && value.charAt(0) !== "'")) { 3289 throw new Error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`"); 3290 } 3291 } 3292 3293 var processed = oldProcessStyleValue(key, value); 3294 3295 if (processed !== '' && !isCustomProperty(key) && key.indexOf('-') !== -1 && hyphenatedCache[key] === undefined) { 3296 hyphenatedCache[key] = true; 3297 console.error("Using kebab-case for css properties in objects is not supported. Did you mean " + key.replace(msPattern, 'ms-').replace(hyphenPattern, function (str, _char) { 3298 return _char.toUpperCase(); 3299 }) + "?"); 3300 } 3301 3302 return processed; 3303 }; 3304} 3305 3306var noComponentSelectorMessage = 'Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.'; 3307 3308function handleInterpolation(mergedProps, registered, interpolation) { 3309 if (interpolation == null) { 3310 return ''; 3311 } 3312 3313 var componentSelector = interpolation; 3314 3315 if (componentSelector.__emotion_styles !== undefined) { 3316 if (String(componentSelector) === 'NO_COMPONENT_SELECTOR') { 3317 throw new Error(noComponentSelectorMessage); 3318 } 3319 3320 return componentSelector; 3321 } 3322 3323 switch (typeof interpolation) { 3324 case 'boolean': 3325 { 3326 return ''; 3327 } 3328 3329 case 'object': 3330 { 3331 var keyframes = interpolation; 3332 3333 if (keyframes.anim === 1) { 3334 cursor = { 3335 name: keyframes.name, 3336 styles: keyframes.styles, 3337 next: cursor 3338 }; 3339 return keyframes.name; 3340 } 3341 3342 var serializedStyles = interpolation; 3343 3344 if (serializedStyles.styles !== undefined) { 3345 var next = serializedStyles.next; 3346 3347 if (next !== undefined) { 3348 // not the most efficient thing ever but this is a pretty rare case 3349 // and there will be very few iterations of this generally 3350 while (next !== undefined) { 3351 cursor = { 3352 name: next.name, 3353 styles: next.styles, 3354 next: cursor 3355 }; 3356 next = next.next; 3357 } 3358 } 3359 3360 var styles = serializedStyles.styles + ";"; 3361 return styles; 3362 } 3363 3364 return createStringFromObject(mergedProps, registered, interpolation); 3365 } 3366 3367 case 'function': 3368 { 3369 if (mergedProps !== undefined) { 3370 var previousCursor = cursor; 3371 var result = interpolation(mergedProps); 3372 cursor = previousCursor; 3373 return handleInterpolation(mergedProps, registered, result); 3374 } else { 3375 console.error('Functions that are interpolated in css calls will be stringified.\n' + 'If you want to have a css call based on props, create a function that returns a css call like this\n' + 'let dynamicStyle = (props) => css`color: ${props.color}`\n' + 'It can be called directly with props or interpolated in a styled call like this\n' + "let SomeComponent = styled('div')`${dynamicStyle}`"); 3376 } 3377 3378 break; 3379 } 3380 3381 case 'string': 3382 { 3383 var matched = []; 3384 var replaced = interpolation.replace(animationRegex, function (_match, _p1, p2) { 3385 var fakeVarName = "animation" + matched.length; 3386 matched.push("const " + fakeVarName + " = keyframes`" + p2.replace(/^@keyframes animation-\w+/, '') + "`"); 3387 return "${" + fakeVarName + "}"; 3388 }); 3389 3390 if (matched.length) { 3391 console.error("`keyframes` output got interpolated into plain string, please wrap it with `css`.\n\nInstead of doing this:\n\n" + [].concat(matched, ["`" + replaced + "`"]).join('\n') + "\n\nYou should wrap it with `css` like this:\n\ncss`" + replaced + "`"); 3392 } 3393 } 3394 3395 break; 3396 } // finalize string values (regular strings and functions interpolated into css calls) 3397 3398 3399 var asString = interpolation; 3400 3401 if (registered == null) { 3402 return asString; 3403 } 3404 3405 var cached = registered[asString]; 3406 return cached !== undefined ? cached : asString; 3407} 3408 3409function createStringFromObject(mergedProps, registered, obj) { 3410 var string = ''; 3411 3412 if (Array.isArray(obj)) { 3413 for (var i = 0; i < obj.length; i++) { 3414 string += handleInterpolation(mergedProps, registered, obj[i]) + ";"; 3415 } 3416 } else { 3417 for (var key in obj) { 3418 var value = obj[key]; 3419 3420 if (typeof value !== 'object') { 3421 var asString = value; 3422 3423 if (registered != null && registered[asString] !== undefined) { 3424 string += key + "{" + registered[asString] + "}"; 3425 } else if (isProcessableValue(asString)) { 3426 string += processStyleName(key) + ":" + processStyleValue(key, asString) + ";"; 3427 } 3428 } else { 3429 if (key === 'NO_COMPONENT_SELECTOR' && isDevelopment) { 3430 throw new Error(noComponentSelectorMessage); 3431 } 3432 3433 if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) { 3434 for (var _i = 0; _i < value.length; _i++) { 3435 if (isProcessableValue(value[_i])) { 3436 string += processStyleName(key) + ":" + processStyleValue(key, value[_i]) + ";"; 3437 } 3438 } 3439 } else { 3440 var interpolated = handleInterpolation(mergedProps, registered, value); 3441 3442 switch (key) { 3443 case 'animation': 3444 case 'animationName': 3445 { 3446 string += processStyleName(key) + ":" + interpolated + ";"; 3447 break; 3448 } 3449 3450 default: 3451 { 3452 if (key === 'undefined') { 3453 console.error(UNDEFINED_AS_OBJECT_KEY_ERROR); 3454 } 3455 3456 string += key + "{" + interpolated + "}"; 3457 } 3458 } 3459 } 3460 } 3461 } 3462 } 3463 3464 return string; 3465} 3466 3467var labelPattern = /label:\s*([^\s;{]+)\s*(;|$)/g; // this is the cursor for keyframes 3468// keyframes are stored on the SerializedStyles object as a linked list 3469 3470var cursor; 3471function serializeStyles(args, registered, mergedProps) { 3472 if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) { 3473 return args[0]; 3474 } 3475 3476 var stringMode = true; 3477 var styles = ''; 3478 cursor = undefined; 3479 var strings = args[0]; 3480 3481 if (strings == null || strings.raw === undefined) { 3482 stringMode = false; 3483 styles += handleInterpolation(mergedProps, registered, strings); 3484 } else { 3485 var asTemplateStringsArr = strings; 3486 3487 if (asTemplateStringsArr[0] === undefined) { 3488 console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR); 3489 } 3490 3491 styles += asTemplateStringsArr[0]; 3492 } // we start at 1 since we've already handled the first arg 3493 3494 3495 for (var i = 1; i < args.length; i++) { 3496 styles += handleInterpolation(mergedProps, registered, args[i]); 3497 3498 if (stringMode) { 3499 var templateStringsArr = strings; 3500 3501 if (templateStringsArr[i] === undefined) { 3502 console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR); 3503 } 3504 3505 styles += templateStringsArr[i]; 3506 } 3507 } // using a global regex with .exec is stateful so lastIndex has to be reset each time 3508 3509 3510 labelPattern.lastIndex = 0; 3511 var identifierName = ''; 3512 var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5 3513 3514 while ((match = labelPattern.exec(styles)) !== null) { 3515 identifierName += '-' + match[1]; 3516 } 3517 3518 var name = (0,_emotion_hash__WEBPACK_IMPORTED_MODULE_0__["default"])(styles) + identifierName; 3519 3520 { 3521 var devStyles = { 3522 name: name, 3523 styles: styles, 3524 next: cursor, 3525 toString: function toString() { 3526 return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; 3527 } 3528 }; 3529 return devStyles; 3530 } 3531} 3532 3533 3534 3535 3536/***/ }), 3537
vendor: 5,402 bytes, lines 3538-3712
3538/***/ "./node_modules/@emotion/sheet/dist/emotion-sheet.development.esm.js": 3539/*!***************************************************************************!*\ 3540 !*** ./node_modules/@emotion/sheet/dist/emotion-sheet.development.esm.js ***! 3541 \***************************************************************************/ 3542/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 3543 3544"use strict"; 3545__webpack_require__.r(__webpack_exports__); 3546/* harmony export */ __webpack_require__.d(__webpack_exports__, { 3547/* harmony export */ StyleSheet: () => (/* binding */ StyleSheet) 3548/* harmony export */ }); 3549var isDevelopment = true; 3550 3551/* 3552 3553Based off glamor's StyleSheet, thanks Sunil â¤ï¸ 3554 3555high performance StyleSheet for css-in-js systems 3556 3557- uses multiple style tags behind the scenes for millions of rules 3558- uses `insertRule` for appending in production for *much* faster performance 3559 3560// usage 3561 3562import { StyleSheet } from '@emotion/sheet' 3563 3564let styleSheet = new StyleSheet({ key: '', container: document.head }) 3565 3566styleSheet.insert('#box { border: 1px solid red; }') 3567- appends a css rule into the stylesheet 3568 3569styleSheet.flush() 3570- empties the stylesheet of all its contents 3571 3572*/ 3573 3574function sheetForTag(tag) { 3575 if (tag.sheet) { 3576 return tag.sheet; 3577 } // this weirdness brought to you by firefox 3578 3579 /* istanbul ignore next */ 3580 3581 3582 for (var i = 0; i < document.styleSheets.length; i++) { 3583 if (document.styleSheets[i].ownerNode === tag) { 3584 return document.styleSheets[i]; 3585 } 3586 } // this function should always return with a value 3587 // TS can't understand it though so we make it stop complaining here 3588 3589 3590 return undefined; 3591} 3592 3593function createStyleElement(options) { 3594 var tag = document.createElement('style'); 3595 tag.setAttribute('data-emotion', options.key); 3596 3597 if (options.nonce !== undefined) { 3598 tag.setAttribute('nonce', options.nonce); 3599 } 3600 3601 tag.appendChild(document.createTextNode('')); 3602 tag.setAttribute('data-s', ''); 3603 return tag; 3604} 3605 3606var StyleSheet = /*#__PURE__*/function () { 3607 // Using Node instead of HTMLElement since container may be a ShadowRoot 3608 function StyleSheet(options) { 3609 var _this = this; 3610 3611 this._insertTag = function (tag) { 3612 var before; 3613 3614 if (_this.tags.length === 0) { 3615 if (_this.insertionPoint) { 3616 before = _this.insertionPoint.nextSibling; 3617 } else if (_this.prepend) { 3618 before = _this.container.firstChild; 3619 } else { 3620 before = _this.before; 3621 } 3622 } else { 3623 before = _this.tags[_this.tags.length - 1].nextSibling; 3624 } 3625 3626 _this.container.insertBefore(tag, before); 3627 3628 _this.tags.push(tag); 3629 }; 3630 3631 this.isSpeedy = options.speedy === undefined ? !isDevelopment : options.speedy; 3632 this.tags = []; 3633 this.ctr = 0; 3634 this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets 3635 3636 this.key = options.key; 3637 this.container = options.container; 3638 this.prepend = options.prepend; 3639 this.insertionPoint = options.insertionPoint; 3640 this.before = null; 3641 } 3642 3643 var _proto = StyleSheet.prototype; 3644 3645 _proto.hydrate = function hydrate(nodes) { 3646 nodes.forEach(this._insertTag); 3647 }; 3648 3649 _proto.insert = function insert(rule) { 3650 // the max length is how many rules we have per style tag, it's 65000 in speedy mode 3651 // it's 1 in dev because we insert source maps that map a single rule to a location 3652 // and you can only have one source map per style tag 3653 if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) { 3654 this._insertTag(createStyleElement(this)); 3655 } 3656 3657 var tag = this.tags[this.tags.length - 1]; 3658 3659 { 3660 var isImportRule = rule.charCodeAt(0) === 64 && rule.charCodeAt(1) === 105; 3661 3662 if (isImportRule && this._alreadyInsertedOrderInsensitiveRule) { 3663 // this would only cause problem in speedy mode 3664 // but we don't want enabling speedy to affect the observable behavior 3665 // so we report this error at all times 3666 console.error("You're attempting to insert the following rule:\n" + rule + '\n\n`@import` rules must be before all other types of rules in a stylesheet but other rules have already been inserted. Please ensure that `@import` rules are before all other rules.'); 3667 } 3668 3669 this._alreadyInsertedOrderInsensitiveRule = this._alreadyInsertedOrderInsensitiveRule || !isImportRule; 3670 } 3671 3672 if (this.isSpeedy) { 3673 var sheet = sheetForTag(tag); 3674 3675 try { 3676 // this is the ultrafast version, works across browsers 3677 // the big drawback is that the css won't be editable in devtools 3678 sheet.insertRule(rule, sheet.cssRules.length); 3679 } catch (e) { 3680 if (!/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear|-ms-expand|-ms-reveal){/.test(rule)) { 3681 console.error("There was a problem inserting the following rule: \"" + rule + "\"", e); 3682 } 3683 } 3684 } else { 3685 tag.appendChild(document.createTextNode(rule)); 3686 } 3687 3688 this.ctr++; 3689 }; 3690 3691 _proto.flush = function flush() { 3692 this.tags.forEach(function (tag) { 3693 var _tag$parentNode; 3694 3695 return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag); 3696 }); 3697 this.tags = []; 3698 this.ctr = 0; 3699 3700 { 3701 this._alreadyInsertedOrderInsensitiveRule = false; 3702 } 3703 }; 3704 3705 return StyleSheet; 3706}(); 3707 3708 3709 3710 3711/***/ }), 3712
vendor: 1,508 bytes, lines 3713-3779
3713/***/ "./node_modules/@emotion/unitless/dist/emotion-unitless.esm.js": 3714/*!*********************************************************************!*\ 3715 !*** ./node_modules/@emotion/unitless/dist/emotion-unitless.esm.js ***! 3716 \*********************************************************************/ 3717/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 3718 3719"use strict"; 3720__webpack_require__.r(__webpack_exports__); 3721/* harmony export */ __webpack_require__.d(__webpack_exports__, { 3722/* harmony export */ "default": () => (/* binding */ unitlessKeys) 3723/* harmony export */ }); 3724var unitlessKeys = { 3725 animationIterationCount: 1, 3726 aspectRatio: 1, 3727 borderImageOutset: 1, 3728 borderImageSlice: 1, 3729 borderImageWidth: 1, 3730 boxFlex: 1, 3731 boxFlexGroup: 1, 3732 boxOrdinalGroup: 1, 3733 columnCount: 1, 3734 columns: 1, 3735 flex: 1, 3736 flexGrow: 1, 3737 flexPositive: 1, 3738 flexShrink: 1, 3739 flexNegative: 1, 3740 flexOrder: 1, 3741 gridRow: 1, 3742 gridRowEnd: 1, 3743 gridRowSpan: 1, 3744 gridRowStart: 1, 3745 gridColumn: 1, 3746 gridColumnEnd: 1, 3747 gridColumnSpan: 1, 3748 gridColumnStart: 1, 3749 msGridRow: 1, 3750 msGridRowSpan: 1, 3751 msGridColumn: 1, 3752 msGridColumnSpan: 1, 3753 fontWeight: 1, 3754 lineHeight: 1, 3755 opacity: 1, 3756 order: 1, 3757 orphans: 1, 3758 scale: 1, 3759 tabSize: 1, 3760 widows: 1, 3761 zIndex: 1, 3762 zoom: 1, 3763 WebkitLineClamp: 1, 3764 // SVG-related properties 3765 fillOpacity: 1, 3766 floodOpacity: 1, 3767 stopOpacity: 1, 3768 strokeDasharray: 1, 3769 strokeDashoffset: 1, 3770 strokeMiterlimit: 1, 3771 strokeOpacity: 1, 3772 strokeWidth: 1 3773}; 3774 3775 3776 3777 3778/***/ }), 3779
vendor: 1,960 bytes, lines 3780-3808
3780/***/ "./node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js": 3781/*!***********************************************************************************************************************************!*\ 3782 !*** ./node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js ***! 3783 \***********************************************************************************************************************************/ 3784/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 3785 3786"use strict"; 3787var react__WEBPACK_IMPORTED_MODULE_0___namespace_cache; 3788__webpack_require__.r(__webpack_exports__); 3789/* harmony export */ __webpack_require__.d(__webpack_exports__, { 3790/* harmony export */ useInsertionEffectAlwaysWithSyncFallback: () => (/* binding */ useInsertionEffectAlwaysWithSyncFallback), 3791/* harmony export */ useInsertionEffectWithLayoutFallback: () => (/* binding */ useInsertionEffectWithLayoutFallback) 3792/* harmony export */ }); 3793/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 3794 3795 3796var syncFallback = function syncFallback(create) { 3797 return create(); 3798}; 3799 3800var useInsertionEffect = /*#__PURE__*/ (react__WEBPACK_IMPORTED_MODULE_0___namespace_cache || (react__WEBPACK_IMPORTED_MODULE_0___namespace_cache = __webpack_require__.t(react__WEBPACK_IMPORTED_MODULE_0__, 2)))['useInsertion' + 'Effect'] ? /*#__PURE__*/ (react__WEBPACK_IMPORTED_MODULE_0___namespace_cache || (react__WEBPACK_IMPORTED_MODULE_0___namespace_cache = __webpack_require__.t(react__WEBPACK_IMPORTED_MODULE_0__, 2)))['useInsertion' + 'Effect'] : false; 3801var useInsertionEffectAlwaysWithSyncFallback = useInsertionEffect || syncFallback; 3802var useInsertionEffectWithLayoutFallback = useInsertionEffect || react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect; 3803 3804 3805 3806 3807/***/ }), 3808
vendor: 2,480 bytes, lines 3809-3870
3809/***/ "./node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js": 3810/*!***********************************************************************!*\ 3811 !*** ./node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js ***! 3812 \***********************************************************************/ 3813/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 3814 3815"use strict"; 3816__webpack_require__.r(__webpack_exports__); 3817/* harmony export */ __webpack_require__.d(__webpack_exports__, { 3818/* harmony export */ getRegisteredStyles: () => (/* binding */ getRegisteredStyles), 3819/* harmony export */ insertStyles: () => (/* binding */ insertStyles), 3820/* harmony export */ registerStyles: () => (/* binding */ registerStyles) 3821/* harmony export */ }); 3822var isBrowser = true; 3823 3824function getRegisteredStyles(registered, registeredStyles, classNames) { 3825 var rawClassName = ''; 3826 classNames.split(' ').forEach(function (className) { 3827 if (registered[className] !== undefined) { 3828 registeredStyles.push(registered[className] + ";"); 3829 } else if (className) { 3830 rawClassName += className + " "; 3831 } 3832 }); 3833 return rawClassName; 3834} 3835var registerStyles = function registerStyles(cache, serialized, isStringTag) { 3836 var className = cache.key + "-" + serialized.name; 3837 3838 if ( // we only need to add the styles to the registered cache if the 3839 // class name could be used further down 3840 // the tree but if it's a string tag, we know it won't 3841 // so we don't have to add it to registered cache. 3842 // this improves memory usage since we can avoid storing the whole style string 3843 (isStringTag === false || // we need to always store it if we're in compat mode and 3844 // in node since emotion-server relies on whether a style is in 3845 // the registered cache to know whether a style is global or not 3846 // also, note that this check will be dead code eliminated in the browser 3847 isBrowser === false ) && cache.registered[className] === undefined) { 3848 cache.registered[className] = serialized.styles; 3849 } 3850}; 3851var insertStyles = function insertStyles(cache, serialized, isStringTag) { 3852 registerStyles(cache, serialized, isStringTag); 3853 var className = cache.key + "-" + serialized.name; 3854 3855 if (cache.inserted[serialized.name] === undefined) { 3856 var current = serialized; 3857 3858 do { 3859 cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true); 3860 3861 current = current.next; 3862 } while (current !== undefined); 3863 } 3864}; 3865 3866 3867 3868 3869/***/ }), 3870
vendor: 1,026 bytes, lines 3871-3901
3871/***/ "./node_modules/@emotion/weak-memoize/dist/emotion-weak-memoize.esm.js": 3872/*!*****************************************************************************!*\ 3873 !*** ./node_modules/@emotion/weak-memoize/dist/emotion-weak-memoize.esm.js ***! 3874 \*****************************************************************************/ 3875/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 3876 3877"use strict"; 3878__webpack_require__.r(__webpack_exports__); 3879/* harmony export */ __webpack_require__.d(__webpack_exports__, { 3880/* harmony export */ "default": () => (/* binding */ weakMemoize) 3881/* harmony export */ }); 3882var weakMemoize = function weakMemoize(func) { 3883 var cache = new WeakMap(); 3884 return function (arg) { 3885 if (cache.has(arg)) { 3886 // Use non-null assertion because we just checked that the cache `has` it 3887 // This allows us to remove `undefined` from the return value 3888 return cache.get(arg); 3889 } 3890 3891 var ret = func(arg); 3892 cache.set(arg, ret); 3893 return ret; 3894 }; 3895}; 3896 3897 3898 3899 3900/***/ }), 3901
vendor: 41,490 bytes, lines 3902-4977
3902/***/ "./node_modules/@floating-ui/core/dist/floating-ui.core.mjs": 3903/*!******************************************************************!*\ 3904 !*** ./node_modules/@floating-ui/core/dist/floating-ui.core.mjs ***! 3905 \******************************************************************/ 3906/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 3907 3908"use strict"; 3909__webpack_require__.r(__webpack_exports__); 3910/* harmony export */ __webpack_require__.d(__webpack_exports__, { 3911/* harmony export */ arrow: () => (/* binding */ arrow), 3912/* harmony export */ autoPlacement: () => (/* binding */ autoPlacement), 3913/* harmony export */ computePosition: () => (/* binding */ computePosition), 3914/* harmony export */ detectOverflow: () => (/* binding */ detectOverflow), 3915/* harmony export */ flip: () => (/* binding */ flip), 3916/* harmony export */ hide: () => (/* binding */ hide), 3917/* harmony export */ inline: () => (/* binding */ inline), 3918/* harmony export */ limitShift: () => (/* binding */ limitShift), 3919/* harmony export */ offset: () => (/* binding */ offset), 3920/* harmony export */ rectToClientRect: () => (/* reexport safe */ _floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.rectToClientRect), 3921/* harmony export */ shift: () => (/* binding */ shift), 3922/* harmony export */ size: () => (/* binding */ size) 3923/* harmony export */ }); 3924/* harmony import */ var _floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @floating-ui/utils */ "./node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs"); 3925 3926 3927 3928function computeCoordsFromPlacement(_ref, placement, rtl) { 3929 let { 3930 reference, 3931 floating 3932 } = _ref; 3933 const sideAxis = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSideAxis)(placement); 3934 const alignmentAxis = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignmentAxis)(placement); 3935 const alignLength = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAxisLength)(alignmentAxis); 3936 const side = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(placement); 3937 const isVertical = sideAxis === 'y'; 3938 const commonX = reference.x + reference.width / 2 - floating.width / 2; 3939 const commonY = reference.y + reference.height / 2 - floating.height / 2; 3940 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; 3941 let coords; 3942 switch (side) { 3943 case 'top': 3944 coords = { 3945 x: commonX, 3946 y: reference.y - floating.height 3947 }; 3948 break; 3949 case 'bottom': 3950 coords = { 3951 x: commonX, 3952 y: reference.y + reference.height 3953 }; 3954 break; 3955 case 'right': 3956 coords = { 3957 x: reference.x + reference.width, 3958 y: commonY 3959 }; 3960 break; 3961 case 'left': 3962 coords = { 3963 x: reference.x - floating.width, 3964 y: commonY 3965 }; 3966 break; 3967 default: 3968 coords = { 3969 x: reference.x, 3970 y: reference.y 3971 }; 3972 } 3973 switch ((0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignment)(placement)) { 3974 case 'start': 3975 coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); 3976 break; 3977 case 'end': 3978 coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); 3979 break; 3980 } 3981 return coords; 3982} 3983 3984/** 3985 * Computes the `x` and `y` coordinates that will place the floating element 3986 * next to a given reference element. 3987 * 3988 * This export does not have any `platform` interface logic. You will need to 3989 * write one for the platform you are using Floating UI with. 3990 */ 3991const computePosition = async (reference, floating, config) => { 3992 const { 3993 placement = 'bottom', 3994 strategy = 'absolute', 3995 middleware = [], 3996 platform 3997 } = config; 3998 const validMiddleware = middleware.filter(Boolean); 3999 const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating)); 4000 let rects = await platform.getElementRects({ 4001 reference, 4002 floating, 4003 strategy 4004 }); 4005 let { 4006 x, 4007 y 4008 } = computeCoordsFromPlacement(rects, placement, rtl); 4009 let statefulPlacement = placement; 4010 let middlewareData = {}; 4011 let resetCount = 0; 4012 for (let i = 0; i < validMiddleware.length; i++) { 4013 const { 4014 name, 4015 fn 4016 } = validMiddleware[i]; 4017 const { 4018 x: nextX, 4019 y: nextY, 4020 data, 4021 reset 4022 } = await fn({ 4023 x, 4024 y, 4025 initialPlacement: placement, 4026 placement: statefulPlacement, 4027 strategy, 4028 middlewareData, 4029 rects, 4030 platform, 4031 elements: { 4032 reference, 4033 floating 4034 } 4035 }); 4036 x = nextX != null ? nextX : x; 4037 y = nextY != null ? nextY : y; 4038 middlewareData = { 4039 ...middlewareData, 4040 [name]: { 4041 ...middlewareData[name], 4042 ...data 4043 } 4044 }; 4045 if (reset && resetCount <= 50) { 4046 resetCount++; 4047 if (typeof reset === 'object') { 4048 if (reset.placement) { 4049 statefulPlacement = reset.placement; 4050 } 4051 if (reset.rects) { 4052 rects = reset.rects === true ? await platform.getElementRects({ 4053 reference, 4054 floating, 4055 strategy 4056 }) : reset.rects; 4057 } 4058 ({ 4059 x, 4060 y 4061 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); 4062 } 4063 i = -1; 4064 } 4065 } 4066 return { 4067 x, 4068 y, 4069 placement: statefulPlacement, 4070 strategy, 4071 middlewareData 4072 }; 4073}; 4074 4075/** 4076 * Resolves with an object of overflow side offsets that determine how much the 4077 * element is overflowing a given clipping boundary on each side. 4078 * - positive = overflowing the boundary by that number of pixels 4079 * - negative = how many pixels left before it will overflow 4080 * - 0 = lies flush with the boundary 4081 * @see https://floating-ui.com/docs/detectOverflow 4082 */ 4083async function detectOverflow(state, options) { 4084 var _await$platform$isEle; 4085 if (options === void 0) { 4086 options = {}; 4087 } 4088 const { 4089 x, 4090 y, 4091 platform, 4092 rects, 4093 elements, 4094 strategy 4095 } = state; 4096 const { 4097 boundary = 'clippingAncestors', 4098 rootBoundary = 'viewport', 4099 elementContext = 'floating', 4100 altBoundary = false, 4101 padding = 0 4102 } = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(options, state); 4103 const paddingObject = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getPaddingObject)(padding); 4104 const altContext = elementContext === 'floating' ? 'reference' : 'floating'; 4105 const element = elements[altBoundary ? altContext : elementContext]; 4106 const clippingClientRect = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.rectToClientRect)(await platform.getClippingRect({ 4107 element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))), 4108 boundary, 4109 rootBoundary, 4110 strategy 4111 })); 4112 const rect = elementContext === 'floating' ? { 4113 x, 4114 y, 4115 width: rects.floating.width, 4116 height: rects.floating.height 4117 } : rects.reference; 4118 const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)); 4119 const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || { 4120 x: 1, 4121 y: 1 4122 } : { 4123 x: 1, 4124 y: 1 4125 }; 4126 const elementClientRect = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.rectToClientRect)(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({ 4127 elements, 4128 rect, 4129 offsetParent, 4130 strategy 4131 }) : rect); 4132 return { 4133 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, 4134 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, 4135 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, 4136 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x 4137 }; 4138} 4139 4140/** 4141 * Provides data to position an inner element of the floating element so that it 4142 * appears centered to the reference element. 4143 * @see https://floating-ui.com/docs/arrow 4144 */ 4145const arrow = options => ({ 4146 name: 'arrow', 4147 options, 4148 async fn(state) { 4149 const { 4150 x, 4151 y, 4152 placement, 4153 rects, 4154 platform, 4155 elements, 4156 middlewareData 4157 } = state; 4158 // Since `element` is required, we don't Partial<> the type. 4159 const { 4160 element, 4161 padding = 0 4162 } = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(options, state) || {}; 4163 if (element == null) { 4164 return {}; 4165 } 4166 const paddingObject = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getPaddingObject)(padding); 4167 const coords = { 4168 x, 4169 y 4170 }; 4171 const axis = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignmentAxis)(placement); 4172 const length = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAxisLength)(axis); 4173 const arrowDimensions = await platform.getDimensions(element); 4174 const isYAxis = axis === 'y'; 4175 const minProp = isYAxis ? 'top' : 'left'; 4176 const maxProp = isYAxis ? 'bottom' : 'right'; 4177 const clientProp = isYAxis ? 'clientHeight' : 'clientWidth'; 4178 const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; 4179 const startDiff = coords[axis] - rects.reference[axis]; 4180 const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element)); 4181 let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0; 4182 4183 // DOM platform can return `window` as the `offsetParent`. 4184 if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) { 4185 clientSize = elements.floating[clientProp] || rects.floating[length]; 4186 } 4187 const centerToReference = endDiff / 2 - startDiff / 2; 4188 4189 // If the padding is large enough that it causes the arrow to no longer be 4190 // centered, modify the padding so that it is centered. 4191 const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; 4192 const minPadding = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.min)(paddingObject[minProp], largestPossiblePadding); 4193 const maxPadding = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.min)(paddingObject[maxProp], largestPossiblePadding); 4194 4195 // Make sure the arrow doesn't overflow the floating element if the center 4196 // point is outside the floating element's bounds. 4197 const min$1 = minPadding; 4198 const max = clientSize - arrowDimensions[length] - maxPadding; 4199 const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; 4200 const offset = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.clamp)(min$1, center, max); 4201 4202 // If the reference is small enough that the arrow's padding causes it to 4203 // to point to nothing for an aligned placement, adjust the offset of the 4204 // floating element itself. To ensure `shift()` continues to take action, 4205 // a single reset is performed when this is true. 4206 const shouldAddOffset = !middlewareData.arrow && (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignment)(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; 4207 const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0; 4208 return { 4209 [axis]: coords[axis] + alignmentOffset, 4210 data: { 4211 [axis]: offset, 4212 centerOffset: center - offset - alignmentOffset, 4213 ...(shouldAddOffset && { 4214 alignmentOffset 4215 }) 4216 }, 4217 reset: shouldAddOffset 4218 }; 4219 } 4220}); 4221 4222function getPlacementList(alignment, autoAlignment, allowedPlacements) { 4223 const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignment)(placement) === alignment), ...allowedPlacements.filter(placement => (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignment)(placement) !== alignment)] : allowedPlacements.filter(placement => (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(placement) === placement); 4224 return allowedPlacementsSortedByAlignment.filter(placement => { 4225 if (alignment) { 4226 return (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignment)(placement) === alignment || (autoAlignment ? (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getOppositeAlignmentPlacement)(placement) !== placement : false); 4227 } 4228 return true; 4229 }); 4230} 4231/** 4232 * Optimizes the visibility of the floating element by choosing the placement 4233 * that has the most space available automatically, without needing to specify a 4234 * preferred placement. Alternative to `flip`. 4235 * @see https://floating-ui.com/docs/autoPlacement 4236 */ 4237const autoPlacement = function (options) { 4238 if (options === void 0) { 4239 options = {}; 4240 } 4241 return { 4242 name: 'autoPlacement', 4243 options, 4244 async fn(state) { 4245 var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE; 4246 const { 4247 rects, 4248 middlewareData, 4249 placement, 4250 platform, 4251 elements 4252 } = state; 4253 const { 4254 crossAxis = false, 4255 alignment, 4256 allowedPlacements = _floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.placements, 4257 autoAlignment = true, 4258 ...detectOverflowOptions 4259 } = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(options, state); 4260 const placements$1 = alignment !== undefined || allowedPlacements === _floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements; 4261 const overflow = await detectOverflow(state, detectOverflowOptions); 4262 const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0; 4263 const currentPlacement = placements$1[currentIndex]; 4264 if (currentPlacement == null) { 4265 return {}; 4266 } 4267 const alignmentSides = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignmentSides)(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))); 4268 4269 // Make `computeCoords` start from the right place. 4270 if (placement !== currentPlacement) { 4271 return { 4272 reset: { 4273 placement: placements$1[0] 4274 } 4275 }; 4276 } 4277 const currentOverflows = [overflow[(0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]]; 4278 const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), { 4279 placement: currentPlacement, 4280 overflows: currentOverflows 4281 }]; 4282 const nextPlacement = placements$1[currentIndex + 1]; 4283 4284 // There are more placements to check. 4285 if (nextPlacement) { 4286 return { 4287 data: { 4288 index: currentIndex + 1, 4289 overflows: allOverflows 4290 }, 4291 reset: { 4292 placement: nextPlacement 4293 } 4294 }; 4295 } 4296 const placementsSortedByMostSpace = allOverflows.map(d => { 4297 const alignment = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignment)(d.placement); 4298 return [d.placement, alignment && crossAxis ? 4299 // Check along the mainAxis and main crossAxis side. 4300 d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) : 4301 // Check only the mainAxis. 4302 d.overflows[0], d.overflows]; 4303 }).sort((a, b) => a[1] - b[1]); 4304 const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0, 4305 // Aligned placements should not check their opposite crossAxis 4306 // side. 4307 (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignment)(d[0]) ? 2 : 3).every(v => v <= 0)); 4308 const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0]; 4309 if (resetPlacement !== placement) { 4310 return { 4311 data: { 4312 index: currentIndex + 1, 4313 overflows: allOverflows 4314 }, 4315 reset: { 4316 placement: resetPlacement 4317 } 4318 }; 4319 } 4320 return {}; 4321 } 4322 }; 4323}; 4324 4325/** 4326 * Optimizes the visibility of the floating element by flipping the `placement` 4327 * in order to keep it in view when the preferred placement(s) will overflow the 4328 * clipping boundary. Alternative to `autoPlacement`. 4329 * @see https://floating-ui.com/docs/flip 4330 */ 4331const flip = function (options) { 4332 if (options === void 0) { 4333 options = {}; 4334 } 4335 return { 4336 name: 'flip', 4337 options, 4338 async fn(state) { 4339 var _middlewareData$arrow, _middlewareData$flip; 4340 const { 4341 placement, 4342 middlewareData, 4343 rects, 4344 initialPlacement, 4345 platform, 4346 elements 4347 } = state; 4348 const { 4349 mainAxis: checkMainAxis = true, 4350 crossAxis: checkCrossAxis = true, 4351 fallbackPlacements: specifiedFallbackPlacements, 4352 fallbackStrategy = 'bestFit', 4353 fallbackAxisSideDirection = 'none', 4354 flipAlignment = true, 4355 ...detectOverflowOptions 4356 } = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(options, state); 4357 4358 // If a reset by the arrow was caused due to an alignment offset being 4359 // added, we should skip any logic now since `flip()` has already done its 4360 // work. 4361 // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643 4362 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 4363 return {}; 4364 } 4365 const side = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(placement); 4366 const initialSideAxis = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSideAxis)(initialPlacement); 4367 const isBasePlacement = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(initialPlacement) === initialPlacement; 4368 const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)); 4369 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [(0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getOppositePlacement)(initialPlacement)] : (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getExpandedPlacements)(initialPlacement)); 4370 const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none'; 4371 if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { 4372 fallbackPlacements.push(...(0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getOppositeAxisPlacements)(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); 4373 } 4374 const placements = [initialPlacement, ...fallbackPlacements]; 4375 const overflow = await detectOverflow(state, detectOverflowOptions); 4376 const overflows = []; 4377 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; 4378 if (checkMainAxis) { 4379 overflows.push(overflow[side]); 4380 } 4381 if (checkCrossAxis) { 4382 const sides = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignmentSides)(placement, rects, rtl); 4383 overflows.push(overflow[sides[0]], overflow[sides[1]]); 4384 } 4385 overflowsData = [...overflowsData, { 4386 placement, 4387 overflows 4388 }]; 4389 4390 // One or more sides is overflowing. 4391 if (!overflows.every(side => side <= 0)) { 4392 var _middlewareData$flip2, _overflowsData$filter; 4393 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; 4394 const nextPlacement = placements[nextIndex]; 4395 if (nextPlacement) { 4396 const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSideAxis)(nextPlacement) : false; 4397 if (!ignoreCrossAxisOverflow || 4398 // We leave the current main axis only if every placement on that axis 4399 // overflows the main axis. 4400 overflowsData.every(d => (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSideAxis)(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) { 4401 // Try next placement and re-run the lifecycle. 4402 return { 4403 data: { 4404 index: nextIndex, 4405 overflows: overflowsData 4406 }, 4407 reset: { 4408 placement: nextPlacement 4409 } 4410 }; 4411 } 4412 } 4413 4414 // First, find the candidates that fit on the mainAxis side of overflow, 4415 // then find the placement that fits the best on the main crossAxis side. 4416 let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement; 4417 4418 // Otherwise fallback. 4419 if (!resetPlacement) { 4420 switch (fallbackStrategy) { 4421 case 'bestFit': 4422 { 4423 var _overflowsData$filter2; 4424 const placement = (_overflowsData$filter2 = overflowsData.filter(d => { 4425 if (hasFallbackAxisSideDirection) { 4426 const currentSideAxis = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSideAxis)(d.placement); 4427 return currentSideAxis === initialSideAxis || 4428 // Create a bias to the `y` side axis due to horizontal 4429 // reading directions favoring greater width. 4430 currentSideAxis === 'y'; 4431 } 4432 return true; 4433 }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0]; 4434 if (placement) { 4435 resetPlacement = placement; 4436 } 4437 break; 4438 } 4439 case 'initialPlacement': 4440 resetPlacement = initialPlacement; 4441 break; 4442 } 4443 } 4444 if (placement !== resetPlacement) { 4445 return { 4446 reset: { 4447 placement: resetPlacement 4448 } 4449 }; 4450 } 4451 } 4452 return {}; 4453 } 4454 }; 4455}; 4456 4457function getSideOffsets(overflow, rect) { 4458 return { 4459 top: overflow.top - rect.height, 4460 right: overflow.right - rect.width, 4461 bottom: overflow.bottom - rect.height, 4462 left: overflow.left - rect.width 4463 }; 4464} 4465function isAnySideFullyClipped(overflow) { 4466 return _floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.sides.some(side => overflow[side] >= 0); 4467} 4468/** 4469 * Provides data to hide the floating element in applicable situations, such as 4470 * when it is not in the same clipping context as the reference element. 4471 * @see https://floating-ui.com/docs/hide 4472 */ 4473const hide = function (options) { 4474 if (options === void 0) { 4475 options = {}; 4476 } 4477 return { 4478 name: 'hide', 4479 options, 4480 async fn(state) { 4481 const { 4482 rects 4483 } = state; 4484 const { 4485 strategy = 'referenceHidden', 4486 ...detectOverflowOptions 4487 } = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(options, state); 4488 switch (strategy) { 4489 case 'referenceHidden': 4490 { 4491 const overflow = await detectOverflow(state, { 4492 ...detectOverflowOptions, 4493 elementContext: 'reference' 4494 }); 4495 const offsets = getSideOffsets(overflow, rects.reference); 4496 return { 4497 data: { 4498 referenceHiddenOffsets: offsets, 4499 referenceHidden: isAnySideFullyClipped(offsets) 4500 } 4501 }; 4502 } 4503 case 'escaped': 4504 { 4505 const overflow = await detectOverflow(state, { 4506 ...detectOverflowOptions, 4507 altBoundary: true 4508 }); 4509 const offsets = getSideOffsets(overflow, rects.floating); 4510 return { 4511 data: { 4512 escapedOffsets: offsets, 4513 escaped: isAnySideFullyClipped(offsets) 4514 } 4515 }; 4516 } 4517 default: 4518 { 4519 return {}; 4520 } 4521 } 4522 } 4523 }; 4524}; 4525 4526function getBoundingRect(rects) { 4527 const minX = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.min)(...rects.map(rect => rect.left)); 4528 const minY = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.min)(...rects.map(rect => rect.top)); 4529 const maxX = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.max)(...rects.map(rect => rect.right)); 4530 const maxY = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.max)(...rects.map(rect => rect.bottom)); 4531 return { 4532 x: minX, 4533 y: minY, 4534 width: maxX - minX, 4535 height: maxY - minY 4536 }; 4537} 4538function getRectsByLine(rects) { 4539 const sortedRects = rects.slice().sort((a, b) => a.y - b.y); 4540 const groups = []; 4541 let prevRect = null; 4542 for (let i = 0; i < sortedRects.length; i++) { 4543 const rect = sortedRects[i]; 4544 if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) { 4545 groups.push([rect]); 4546 } else { 4547 groups[groups.length - 1].push(rect); 4548 } 4549 prevRect = rect; 4550 } 4551 return groups.map(rect => (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.rectToClientRect)(getBoundingRect(rect))); 4552} 4553/** 4554 * Provides improved positioning for inline reference elements that can span 4555 * over multiple lines, such as hyperlinks or range selections. 4556 * @see https://floating-ui.com/docs/inline 4557 */ 4558const inline = function (options) { 4559 if (options === void 0) { 4560 options = {}; 4561 } 4562 return { 4563 name: 'inline', 4564 options, 4565 async fn(state) { 4566 const { 4567 placement, 4568 elements, 4569 rects, 4570 platform, 4571 strategy 4572 } = state; 4573 // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a 4574 // ClientRect's bounds, despite the event listener being triggered. A 4575 // padding of 2 seems to handle this issue. 4576 const { 4577 padding = 2, 4578 x, 4579 y 4580 } = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(options, state); 4581 const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []); 4582 const clientRects = getRectsByLine(nativeClientRects); 4583 const fallback = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.rectToClientRect)(getBoundingRect(nativeClientRects)); 4584 const paddingObject = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getPaddingObject)(padding); 4585 function getBoundingClientRect() { 4586 // There are two rects and they are disjoined. 4587 if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) { 4588 // Find the first rect in which the point is fully inside. 4589 return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback; 4590 } 4591 4592 // There are 2 or more connected rects. 4593 if (clientRects.length >= 2) { 4594 if ((0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSideAxis)(placement) === 'y') { 4595 const firstRect = clientRects[0]; 4596 const lastRect = clientRects[clientRects.length - 1]; 4597 const isTop = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(placement) === 'top'; 4598 const top = firstRect.top; 4599 const bottom = lastRect.bottom; 4600 const left = isTop ? firstRect.left : lastRect.left; 4601 const right = isTop ? firstRect.right : lastRect.right; 4602 const width = right - left; 4603 const height = bottom - top; 4604 return { 4605 top, 4606 bottom, 4607 left, 4608 right, 4609 width, 4610 height, 4611 x: left, 4612 y: top 4613 }; 4614 } 4615 const isLeftSide = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(placement) === 'left'; 4616 const maxRight = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.max)(...clientRects.map(rect => rect.right)); 4617 const minLeft = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.min)(...clientRects.map(rect => rect.left)); 4618 const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight); 4619 const top = measureRects[0].top; 4620 const bottom = measureRects[measureRects.length - 1].bottom; 4621 const left = minLeft; 4622 const right = maxRight; 4623 const width = right - left; 4624 const height = bottom - top; 4625 return { 4626 top, 4627 bottom, 4628 left, 4629 right, 4630 width, 4631 height, 4632 x: left, 4633 y: top 4634 }; 4635 } 4636 return fallback; 4637 } 4638 const resetRects = await platform.getElementRects({ 4639 reference: { 4640 getBoundingClientRect 4641 }, 4642 floating: elements.floating, 4643 strategy 4644 }); 4645 if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) { 4646 return { 4647 reset: { 4648 rects: resetRects 4649 } 4650 }; 4651 } 4652 return {}; 4653 } 4654 }; 4655}; 4656 4657const originSides = /*#__PURE__*/new Set(['left', 'top']); 4658 4659// For type backwards-compatibility, the `OffsetOptions` type was also 4660// Derivable. 4661 4662async function convertValueToCoords(state, options) { 4663 const { 4664 placement, 4665 platform, 4666 elements 4667 } = state; 4668 const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)); 4669 const side = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(placement); 4670 const alignment = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignment)(placement); 4671 const isVertical = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSideAxis)(placement) === 'y'; 4672 const mainAxisMulti = originSides.has(side) ? -1 : 1; 4673 const crossAxisMulti = rtl && isVertical ? -1 : 1; 4674 const rawValue = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(options, state); 4675 4676 // eslint-disable-next-line prefer-const 4677 let { 4678 mainAxis, 4679 crossAxis, 4680 alignmentAxis 4681 } = typeof rawValue === 'number' ? { 4682 mainAxis: rawValue, 4683 crossAxis: 0, 4684 alignmentAxis: null 4685 } : { 4686 mainAxis: rawValue.mainAxis || 0, 4687 crossAxis: rawValue.crossAxis || 0, 4688 alignmentAxis: rawValue.alignmentAxis 4689 }; 4690 if (alignment && typeof alignmentAxis === 'number') { 4691 crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis; 4692 } 4693 return isVertical ? { 4694 x: crossAxis * crossAxisMulti, 4695 y: mainAxis * mainAxisMulti 4696 } : { 4697 x: mainAxis * mainAxisMulti, 4698 y: crossAxis * crossAxisMulti 4699 }; 4700} 4701 4702/** 4703 * Modifies the placement by translating the floating element along the 4704 * specified axes. 4705 * A number (shorthand for `mainAxis` or distance), or an axes configuration 4706 * object may be passed. 4707 * @see https://floating-ui.com/docs/offset 4708 */ 4709const offset = function (options) { 4710 if (options === void 0) { 4711 options = 0; 4712 } 4713 return { 4714 name: 'offset', 4715 options, 4716 async fn(state) { 4717 var _middlewareData$offse, _middlewareData$arrow; 4718 const { 4719 x, 4720 y, 4721 placement, 4722 middlewareData 4723 } = state; 4724 const diffCoords = await convertValueToCoords(state, options); 4725 4726 // If the placement is the same and the arrow caused an alignment offset 4727 // then we don't need to change the positioning coordinates. 4728 if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 4729 return {}; 4730 } 4731 return { 4732 x: x + diffCoords.x, 4733 y: y + diffCoords.y, 4734 data: { 4735 ...diffCoords, 4736 placement 4737 } 4738 }; 4739 } 4740 }; 4741}; 4742 4743/** 4744 * Optimizes the visibility of the floating element by shifting it in order to 4745 * keep it in view when it will overflow the clipping boundary. 4746 * @see https://floating-ui.com/docs/shift 4747 */ 4748const shift = function (options) { 4749 if (options === void 0) { 4750 options = {}; 4751 } 4752 return { 4753 name: 'shift', 4754 options, 4755 async fn(state) { 4756 const { 4757 x, 4758 y, 4759 placement 4760 } = state; 4761 const { 4762 mainAxis: checkMainAxis = true, 4763 crossAxis: checkCrossAxis = false, 4764 limiter = { 4765 fn: _ref => { 4766 let { 4767 x, 4768 y 4769 } = _ref; 4770 return { 4771 x, 4772 y 4773 }; 4774 } 4775 }, 4776 ...detectOverflowOptions 4777 } = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(options, state); 4778 const coords = { 4779 x, 4780 y 4781 }; 4782 const overflow = await detectOverflow(state, detectOverflowOptions); 4783 const crossAxis = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSideAxis)((0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(placement)); 4784 const mainAxis = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getOppositeAxis)(crossAxis); 4785 let mainAxisCoord = coords[mainAxis]; 4786 let crossAxisCoord = coords[crossAxis]; 4787 if (checkMainAxis) { 4788 const minSide = mainAxis === 'y' ? 'top' : 'left'; 4789 const maxSide = mainAxis === 'y' ? 'bottom' : 'right'; 4790 const min = mainAxisCoord + overflow[minSide]; 4791 const max = mainAxisCoord - overflow[maxSide]; 4792 mainAxisCoord = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.clamp)(min, mainAxisCoord, max); 4793 } 4794 if (checkCrossAxis) { 4795 const minSide = crossAxis === 'y' ? 'top' : 'left'; 4796 const maxSide = crossAxis === 'y' ? 'bottom' : 'right'; 4797 const min = crossAxisCoord + overflow[minSide]; 4798 const max = crossAxisCoord - overflow[maxSide]; 4799 crossAxisCoord = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.clamp)(min, crossAxisCoord, max); 4800 } 4801 const limitedCoords = limiter.fn({ 4802 ...state, 4803 [mainAxis]: mainAxisCoord, 4804 [crossAxis]: crossAxisCoord 4805 }); 4806 return { 4807 ...limitedCoords, 4808 data: { 4809 x: limitedCoords.x - x, 4810 y: limitedCoords.y - y, 4811 enabled: { 4812 [mainAxis]: checkMainAxis, 4813 [crossAxis]: checkCrossAxis 4814 } 4815 } 4816 }; 4817 } 4818 }; 4819}; 4820/** 4821 * Built-in `limiter` that will stop `shift()` at a certain point. 4822 */ 4823const limitShift = function (options) { 4824 if (options === void 0) { 4825 options = {}; 4826 } 4827 return { 4828 options, 4829 fn(state) { 4830 const { 4831 x, 4832 y, 4833 placement, 4834 rects, 4835 middlewareData 4836 } = state; 4837 const { 4838 offset = 0, 4839 mainAxis: checkMainAxis = true, 4840 crossAxis: checkCrossAxis = true 4841 } = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(options, state); 4842 const coords = { 4843 x, 4844 y 4845 }; 4846 const crossAxis = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSideAxis)(placement); 4847 const mainAxis = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getOppositeAxis)(crossAxis); 4848 let mainAxisCoord = coords[mainAxis]; 4849 let crossAxisCoord = coords[crossAxis]; 4850 const rawOffset = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(offset, state); 4851 const computedOffset = typeof rawOffset === 'number' ? { 4852 mainAxis: rawOffset, 4853 crossAxis: 0 4854 } : { 4855 mainAxis: 0, 4856 crossAxis: 0, 4857 ...rawOffset 4858 }; 4859 if (checkMainAxis) { 4860 const len = mainAxis === 'y' ? 'height' : 'width'; 4861 const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; 4862 const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; 4863 if (mainAxisCoord < limitMin) { 4864 mainAxisCoord = limitMin; 4865 } else if (mainAxisCoord > limitMax) { 4866 mainAxisCoord = limitMax; 4867 } 4868 } 4869 if (checkCrossAxis) { 4870 var _middlewareData$offse, _middlewareData$offse2; 4871 const len = mainAxis === 'y' ? 'width' : 'height'; 4872 const isOriginSide = originSides.has((0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(placement)); 4873 const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis); 4874 const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0); 4875 if (crossAxisCoord < limitMin) { 4876 crossAxisCoord = limitMin; 4877 } else if (crossAxisCoord > limitMax) { 4878 crossAxisCoord = limitMax; 4879 } 4880 } 4881 return { 4882 [mainAxis]: mainAxisCoord, 4883 [crossAxis]: crossAxisCoord 4884 }; 4885 } 4886 }; 4887}; 4888 4889/** 4890 * Provides data that allows you to change the size of the floating element â 4891 * for instance, prevent it from overflowing the clipping boundary or match the 4892 * width of the reference element. 4893 * @see https://floating-ui.com/docs/size 4894 */ 4895const size = function (options) { 4896 if (options === void 0) { 4897 options = {}; 4898 } 4899 return { 4900 name: 'size', 4901 options, 4902 async fn(state) { 4903 var _state$middlewareData, _state$middlewareData2; 4904 const { 4905 placement, 4906 rects, 4907 platform, 4908 elements 4909 } = state; 4910 const { 4911 apply = () => {}, 4912 ...detectOverflowOptions 4913 } = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.evaluate)(options, state); 4914 const overflow = await detectOverflow(state, detectOverflowOptions); 4915 const side = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSide)(placement); 4916 const alignment = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getAlignment)(placement); 4917 const isYAxis = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.getSideAxis)(placement) === 'y'; 4918 const { 4919 width, 4920 height 4921 } = rects.floating; 4922 let heightSide; 4923 let widthSide; 4924 if (side === 'top' || side === 'bottom') { 4925 heightSide = side; 4926 widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right'; 4927 } else { 4928 widthSide = side; 4929 heightSide = alignment === 'end' ? 'top' : 'bottom'; 4930 } 4931 const maximumClippingHeight = height - overflow.top - overflow.bottom; 4932 const maximumClippingWidth = width - overflow.left - overflow.right; 4933 const overflowAvailableHeight = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.min)(height - overflow[heightSide], maximumClippingHeight); 4934 const overflowAvailableWidth = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.min)(width - overflow[widthSide], maximumClippingWidth); 4935 const noShift = !state.middlewareData.shift; 4936 let availableHeight = overflowAvailableHeight; 4937 let availableWidth = overflowAvailableWidth; 4938 if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) { 4939 availableWidth = maximumClippingWidth; 4940 } 4941 if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) { 4942 availableHeight = maximumClippingHeight; 4943 } 4944 if (noShift && !alignment) { 4945 const xMin = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.max)(overflow.left, 0); 4946 const xMax = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.max)(overflow.right, 0); 4947 const yMin = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.max)(overflow.top, 0); 4948 const yMax = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.max)(overflow.bottom, 0); 4949 if (isYAxis) { 4950 availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.max)(overflow.left, overflow.right)); 4951 } else { 4952 availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_0__.max)(overflow.top, overflow.bottom)); 4953 } 4954 } 4955 await apply({ 4956 ...state, 4957 availableWidth, 4958 availableHeight 4959 }); 4960 const nextDimensions = await platform.getDimensions(elements.floating); 4961 if (width !== nextDimensions.width || height !== nextDimensions.height) { 4962 return { 4963 reset: { 4964 rects: true 4965 } 4966 }; 4967 } 4968 return {}; 4969 } 4970 }; 4971}; 4972 4973 4974 4975 4976/***/ }), 4977
vendor: 34,840 bytes, lines 4978-5785
4978/***/ "./node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs": 4979/*!****************************************************************!*\ 4980 !*** ./node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs ***! 4981 \****************************************************************/ 4982/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 4983 4984"use strict"; 4985__webpack_require__.r(__webpack_exports__); 4986/* harmony export */ __webpack_require__.d(__webpack_exports__, { 4987/* harmony export */ arrow: () => (/* binding */ arrow), 4988/* harmony export */ autoPlacement: () => (/* binding */ autoPlacement), 4989/* harmony export */ autoUpdate: () => (/* binding */ autoUpdate), 4990/* harmony export */ computePosition: () => (/* binding */ computePosition), 4991/* harmony export */ detectOverflow: () => (/* binding */ detectOverflow), 4992/* harmony export */ flip: () => (/* binding */ flip), 4993/* harmony export */ getOverflowAncestors: () => (/* reexport safe */ _floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getOverflowAncestors), 4994/* harmony export */ hide: () => (/* binding */ hide), 4995/* harmony export */ inline: () => (/* binding */ inline), 4996/* harmony export */ limitShift: () => (/* binding */ limitShift), 4997/* harmony export */ offset: () => (/* binding */ offset), 4998/* harmony export */ platform: () => (/* binding */ platform), 4999/* harmony export */ shift: () => (/* binding */ shift), 5000/* harmony export */ size: () => (/* binding */ size) 5001/* harmony export */ }); 5002/* harmony import */ var _floating_ui_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @floating-ui/utils */ "./node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs"); 5003/* harmony import */ var _floating_ui_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @floating-ui/core */ "./node_modules/@floating-ui/core/dist/floating-ui.core.mjs"); 5004/* harmony import */ var _floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @floating-ui/utils/dom */ "./node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs"); 5005 5006 5007 5008 5009 5010function getCssDimensions(element) { 5011 const css = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getComputedStyle)(element); 5012 // In testing environments, the `width` and `height` properties are empty 5013 // strings for SVG elements, returning NaN. Fallback to `0` in this case. 5014 let width = parseFloat(css.width) || 0; 5015 let height = parseFloat(css.height) || 0; 5016 const hasOffset = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(element); 5017 const offsetWidth = hasOffset ? element.offsetWidth : width; 5018 const offsetHeight = hasOffset ? element.offsetHeight : height; 5019 const shouldFallback = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.round)(width) !== offsetWidth || (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.round)(height) !== offsetHeight; 5020 if (shouldFallback) { 5021 width = offsetWidth; 5022 height = offsetHeight; 5023 } 5024 return { 5025 width, 5026 height, 5027 $: shouldFallback 5028 }; 5029} 5030 5031function unwrapElement(element) { 5032 return !(0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isElement)(element) ? element.contextElement : element; 5033} 5034 5035function getScale(element) { 5036 const domElement = unwrapElement(element); 5037 if (!(0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(domElement)) { 5038 return (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.createCoords)(1); 5039 } 5040 const rect = domElement.getBoundingClientRect(); 5041 const { 5042 width, 5043 height, 5044 $ 5045 } = getCssDimensions(domElement); 5046 let x = ($ ? (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.round)(rect.width) : rect.width) / width; 5047 let y = ($ ? (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.round)(rect.height) : rect.height) / height; 5048 5049 // 0, NaN, or Infinity should always fallback to 1. 5050 5051 if (!x || !Number.isFinite(x)) { 5052 x = 1; 5053 } 5054 if (!y || !Number.isFinite(y)) { 5055 y = 1; 5056 } 5057 return { 5058 x, 5059 y 5060 }; 5061} 5062 5063const noOffsets = /*#__PURE__*/(0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.createCoords)(0); 5064function getVisualOffsets(element) { 5065 const win = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getWindow)(element); 5066 if (!(0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isWebKit)() || !win.visualViewport) { 5067 return noOffsets; 5068 } 5069 return { 5070 x: win.visualViewport.offsetLeft, 5071 y: win.visualViewport.offsetTop 5072 }; 5073} 5074function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { 5075 if (isFixed === void 0) { 5076 isFixed = false; 5077 } 5078 if (!floatingOffsetParent || isFixed && floatingOffsetParent !== (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getWindow)(element)) { 5079 return false; 5080 } 5081 return isFixed; 5082} 5083 5084function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { 5085 if (includeScale === void 0) { 5086 includeScale = false; 5087 } 5088 if (isFixedStrategy === void 0) { 5089 isFixedStrategy = false; 5090 } 5091 const clientRect = element.getBoundingClientRect(); 5092 const domElement = unwrapElement(element); 5093 let scale = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.createCoords)(1); 5094 if (includeScale) { 5095 if (offsetParent) { 5096 if ((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isElement)(offsetParent)) { 5097 scale = getScale(offsetParent); 5098 } 5099 } else { 5100 scale = getScale(element); 5101 } 5102 } 5103 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.createCoords)(0); 5104 let x = (clientRect.left + visualOffsets.x) / scale.x; 5105 let y = (clientRect.top + visualOffsets.y) / scale.y; 5106 let width = clientRect.width / scale.x; 5107 let height = clientRect.height / scale.y; 5108 if (domElement) { 5109 const win = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getWindow)(domElement); 5110 const offsetWin = offsetParent && (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isElement)(offsetParent) ? (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getWindow)(offsetParent) : offsetParent; 5111 let currentWin = win; 5112 let currentIFrame = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getFrameElement)(currentWin); 5113 while (currentIFrame && offsetParent && offsetWin !== currentWin) { 5114 const iframeScale = getScale(currentIFrame); 5115 const iframeRect = currentIFrame.getBoundingClientRect(); 5116 const css = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getComputedStyle)(currentIFrame); 5117 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; 5118 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; 5119 x *= iframeScale.x; 5120 y *= iframeScale.y; 5121 width *= iframeScale.x; 5122 height *= iframeScale.y; 5123 x += left; 5124 y += top; 5125 currentWin = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getWindow)(currentIFrame); 5126 currentIFrame = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getFrameElement)(currentWin); 5127 } 5128 } 5129 return (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.rectToClientRect)({ 5130 width, 5131 height, 5132 x, 5133 y 5134 }); 5135} 5136 5137// If <html> has a CSS width greater than the viewport, then this will be 5138// incorrect for RTL. 5139function getWindowScrollBarX(element, rect) { 5140 const leftScroll = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getNodeScroll)(element).scrollLeft; 5141 if (!rect) { 5142 return getBoundingClientRect((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getDocumentElement)(element)).left + leftScroll; 5143 } 5144 return rect.left + leftScroll; 5145} 5146 5147function getHTMLOffset(documentElement, scroll) { 5148 const htmlRect = documentElement.getBoundingClientRect(); 5149 const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect); 5150 const y = htmlRect.top + scroll.scrollTop; 5151 return { 5152 x, 5153 y 5154 }; 5155} 5156 5157function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { 5158 let { 5159 elements, 5160 rect, 5161 offsetParent, 5162 strategy 5163 } = _ref; 5164 const isFixed = strategy === 'fixed'; 5165 const documentElement = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getDocumentElement)(offsetParent); 5166 const topLayer = elements ? (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isTopLayer)(elements.floating) : false; 5167 if (offsetParent === documentElement || topLayer && isFixed) { 5168 return rect; 5169 } 5170 let scroll = { 5171 scrollLeft: 0, 5172 scrollTop: 0 5173 }; 5174 let scale = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.createCoords)(1); 5175 const offsets = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.createCoords)(0); 5176 const isOffsetParentAnElement = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(offsetParent); 5177 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 5178 if ((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getNodeName)(offsetParent) !== 'body' || (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isOverflowElement)(documentElement)) { 5179 scroll = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getNodeScroll)(offsetParent); 5180 } 5181 if ((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(offsetParent)) { 5182 const offsetRect = getBoundingClientRect(offsetParent); 5183 scale = getScale(offsetParent); 5184 offsets.x = offsetRect.x + offsetParent.clientLeft; 5185 offsets.y = offsetRect.y + offsetParent.clientTop; 5186 } 5187 } 5188 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.createCoords)(0); 5189 return { 5190 width: rect.width * scale.x, 5191 height: rect.height * scale.y, 5192 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, 5193 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y 5194 }; 5195} 5196 5197function getClientRects(element) { 5198 return Array.from(element.getClientRects()); 5199} 5200 5201// Gets the entire size of the scrollable document area, even extending outside 5202// of the `<html>` and `<body>` rect bounds if horizontally scrollable. 5203function getDocumentRect(element) { 5204 const html = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getDocumentElement)(element); 5205 const scroll = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getNodeScroll)(element); 5206 const body = element.ownerDocument.body; 5207 const width = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.max)(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); 5208 const height = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.max)(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); 5209 let x = -scroll.scrollLeft + getWindowScrollBarX(element); 5210 const y = -scroll.scrollTop; 5211 if ((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getComputedStyle)(body).direction === 'rtl') { 5212 x += (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.max)(html.clientWidth, body.clientWidth) - width; 5213 } 5214 return { 5215 width, 5216 height, 5217 x, 5218 y 5219 }; 5220} 5221 5222// Safety check: ensure the scrollbar space is reasonable in case this 5223// calculation is affected by unusual styles. 5224// Most scrollbars leave 15-18px of space. 5225const SCROLLBAR_MAX = 25; 5226function getViewportRect(element, strategy) { 5227 const win = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getWindow)(element); 5228 const html = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getDocumentElement)(element); 5229 const visualViewport = win.visualViewport; 5230 let width = html.clientWidth; 5231 let height = html.clientHeight; 5232 let x = 0; 5233 let y = 0; 5234 if (visualViewport) { 5235 width = visualViewport.width; 5236 height = visualViewport.height; 5237 const visualViewportBased = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isWebKit)(); 5238 if (!visualViewportBased || visualViewportBased && strategy === 'fixed') { 5239 x = visualViewport.offsetLeft; 5240 y = visualViewport.offsetTop; 5241 } 5242 } 5243 const windowScrollbarX = getWindowScrollBarX(html); 5244 // <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the 5245 // visual width of the <html> but this is not considered in the size 5246 // of `html.clientWidth`. 5247 if (windowScrollbarX <= 0) { 5248 const doc = html.ownerDocument; 5249 const body = doc.body; 5250 const bodyStyles = getComputedStyle(body); 5251 const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0; 5252 const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline); 5253 if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) { 5254 width -= clippingStableScrollbarWidth; 5255 } 5256 } else if (windowScrollbarX <= SCROLLBAR_MAX) { 5257 // If the <body> scrollbar is on the left, the width needs to be extended 5258 // by the scrollbar amount so there isn't extra space on the right. 5259 width += windowScrollbarX; 5260 } 5261 return { 5262 width, 5263 height, 5264 x, 5265 y 5266 }; 5267} 5268 5269const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']); 5270// Returns the inner client rect, subtracting scrollbars if present. 5271function getInnerBoundingClientRect(element, strategy) { 5272 const clientRect = getBoundingClientRect(element, true, strategy === 'fixed'); 5273 const top = clientRect.top + element.clientTop; 5274 const left = clientRect.left + element.clientLeft; 5275 const scale = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(element) ? getScale(element) : (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.createCoords)(1); 5276 const width = element.clientWidth * scale.x; 5277 const height = element.clientHeight * scale.y; 5278 const x = left * scale.x; 5279 const y = top * scale.y; 5280 return { 5281 width, 5282 height, 5283 x, 5284 y 5285 }; 5286} 5287function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { 5288 let rect; 5289 if (clippingAncestor === 'viewport') { 5290 rect = getViewportRect(element, strategy); 5291 } else if (clippingAncestor === 'document') { 5292 rect = getDocumentRect((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getDocumentElement)(element)); 5293 } else if ((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isElement)(clippingAncestor)) { 5294 rect = getInnerBoundingClientRect(clippingAncestor, strategy); 5295 } else { 5296 const visualOffsets = getVisualOffsets(element); 5297 rect = { 5298 x: clippingAncestor.x - visualOffsets.x, 5299 y: clippingAncestor.y - visualOffsets.y, 5300 width: clippingAncestor.width, 5301 height: clippingAncestor.height 5302 }; 5303 } 5304 return (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.rectToClientRect)(rect); 5305} 5306function hasFixedPositionAncestor(element, stopNode) { 5307 const parentNode = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getParentNode)(element); 5308 if (parentNode === stopNode || !(0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isElement)(parentNode) || (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isLastTraversableNode)(parentNode)) { 5309 return false; 5310 } 5311 return (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getComputedStyle)(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode); 5312} 5313 5314// A "clipping ancestor" is an `overflow` element with the characteristic of 5315// clipping (or hiding) child elements. This returns all clipping ancestors 5316// of the given element up the tree. 5317function getClippingElementAncestors(element, cache) { 5318 const cachedResult = cache.get(element); 5319 if (cachedResult) { 5320 return cachedResult; 5321 } 5322 let result = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getOverflowAncestors)(element, [], false).filter(el => (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isElement)(el) && (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getNodeName)(el) !== 'body'); 5323 let currentContainingBlockComputedStyle = null; 5324 const elementIsFixed = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getComputedStyle)(element).position === 'fixed'; 5325 let currentNode = elementIsFixed ? (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getParentNode)(element) : element; 5326 5327 // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block 5328 while ((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isElement)(currentNode) && !(0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isLastTraversableNode)(currentNode)) { 5329 const computedStyle = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getComputedStyle)(currentNode); 5330 const currentNodeIsContaining = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isContainingBlock)(currentNode); 5331 if (!currentNodeIsContaining && computedStyle.position === 'fixed') { 5332 currentContainingBlockComputedStyle = null; 5333 } 5334 const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isOverflowElement)(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode); 5335 if (shouldDropCurrentNode) { 5336 // Drop non-containing blocks. 5337 result = result.filter(ancestor => ancestor !== currentNode); 5338 } else { 5339 // Record last containing block for next iteration. 5340 currentContainingBlockComputedStyle = computedStyle; 5341 } 5342 currentNode = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getParentNode)(currentNode); 5343 } 5344 cache.set(element, result); 5345 return result; 5346} 5347 5348// Gets the maximum area that the element is visible in due to any number of 5349// clipping ancestors. 5350function getClippingRect(_ref) { 5351 let { 5352 element, 5353 boundary, 5354 rootBoundary, 5355 strategy 5356 } = _ref; 5357 const elementClippingAncestors = boundary === 'clippingAncestors' ? (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isTopLayer)(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary); 5358 const clippingAncestors = [...elementClippingAncestors, rootBoundary]; 5359 const firstClippingAncestor = clippingAncestors[0]; 5360 const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => { 5361 const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy); 5362 accRect.top = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.max)(rect.top, accRect.top); 5363 accRect.right = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.min)(rect.right, accRect.right); 5364 accRect.bottom = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.min)(rect.bottom, accRect.bottom); 5365 accRect.left = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.max)(rect.left, accRect.left); 5366 return accRect; 5367 }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy)); 5368 return { 5369 width: clippingRect.right - clippingRect.left, 5370 height: clippingRect.bottom - clippingRect.top, 5371 x: clippingRect.left, 5372 y: clippingRect.top 5373 }; 5374} 5375 5376function getDimensions(element) { 5377 const { 5378 width, 5379 height 5380 } = getCssDimensions(element); 5381 return { 5382 width, 5383 height 5384 }; 5385} 5386 5387function getRectRelativeToOffsetParent(element, offsetParent, strategy) { 5388 const isOffsetParentAnElement = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(offsetParent); 5389 const documentElement = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getDocumentElement)(offsetParent); 5390 const isFixed = strategy === 'fixed'; 5391 const rect = getBoundingClientRect(element, true, isFixed, offsetParent); 5392 let scroll = { 5393 scrollLeft: 0, 5394 scrollTop: 0 5395 }; 5396 const offsets = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.createCoords)(0); 5397 5398 // If the <body> scrollbar appears on the left (e.g. RTL systems). Use 5399 // Firefox with layout.scrollbar.side = 3 in about:config to test this. 5400 function setLeftRTLScrollbarOffset() { 5401 offsets.x = getWindowScrollBarX(documentElement); 5402 } 5403 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 5404 if ((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getNodeName)(offsetParent) !== 'body' || (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isOverflowElement)(documentElement)) { 5405 scroll = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getNodeScroll)(offsetParent); 5406 } 5407 if (isOffsetParentAnElement) { 5408 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); 5409 offsets.x = offsetRect.x + offsetParent.clientLeft; 5410 offsets.y = offsetRect.y + offsetParent.clientTop; 5411 } else if (documentElement) { 5412 setLeftRTLScrollbarOffset(); 5413 } 5414 } 5415 if (isFixed && !isOffsetParentAnElement && documentElement) { 5416 setLeftRTLScrollbarOffset(); 5417 } 5418 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.createCoords)(0); 5419 const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x; 5420 const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y; 5421 return { 5422 x, 5423 y, 5424 width: rect.width, 5425 height: rect.height 5426 }; 5427} 5428 5429function isStaticPositioned(element) { 5430 return (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getComputedStyle)(element).position === 'static'; 5431} 5432 5433function getTrueOffsetParent(element, polyfill) { 5434 if (!(0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(element) || (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getComputedStyle)(element).position === 'fixed') { 5435 return null; 5436 } 5437 if (polyfill) { 5438 return polyfill(element); 5439 } 5440 let rawOffsetParent = element.offsetParent; 5441 5442 // Firefox returns the <html> element as the offsetParent if it's non-static, 5443 // while Chrome and Safari return the <body> element. The <body> element must 5444 // be used to perform the correct calculations even if the <html> element is 5445 // non-static. 5446 if ((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getDocumentElement)(element) === rawOffsetParent) { 5447 rawOffsetParent = rawOffsetParent.ownerDocument.body; 5448 } 5449 return rawOffsetParent; 5450} 5451 5452// Gets the closest ancestor positioned element. Handles some edge cases, 5453// such as table ancestors and cross browser bugs. 5454function getOffsetParent(element, polyfill) { 5455 const win = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getWindow)(element); 5456 if ((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isTopLayer)(element)) { 5457 return win; 5458 } 5459 if (!(0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isHTMLElement)(element)) { 5460 let svgOffsetParent = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getParentNode)(element); 5461 while (svgOffsetParent && !(0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isLastTraversableNode)(svgOffsetParent)) { 5462 if ((0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isElement)(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { 5463 return svgOffsetParent; 5464 } 5465 svgOffsetParent = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getParentNode)(svgOffsetParent); 5466 } 5467 return win; 5468 } 5469 let offsetParent = getTrueOffsetParent(element, polyfill); 5470 while (offsetParent && (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isTableElement)(offsetParent) && isStaticPositioned(offsetParent)) { 5471 offsetParent = getTrueOffsetParent(offsetParent, polyfill); 5472 } 5473 if (offsetParent && (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isLastTraversableNode)(offsetParent) && isStaticPositioned(offsetParent) && !(0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isContainingBlock)(offsetParent)) { 5474 return win; 5475 } 5476 return offsetParent || (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getContainingBlock)(element) || win; 5477} 5478 5479const getElementRects = async function (data) { 5480 const getOffsetParentFn = this.getOffsetParent || getOffsetParent; 5481 const getDimensionsFn = this.getDimensions; 5482 const floatingDimensions = await getDimensionsFn(data.floating); 5483 return { 5484 reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), 5485 floating: { 5486 x: 0, 5487 y: 0, 5488 width: floatingDimensions.width, 5489 height: floatingDimensions.height 5490 } 5491 }; 5492}; 5493 5494function isRTL(element) { 5495 return (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getComputedStyle)(element).direction === 'rtl'; 5496} 5497 5498const platform = { 5499 convertOffsetParentRelativeRectToViewportRelativeRect, 5500 getDocumentElement: _floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getDocumentElement, 5501 getClippingRect, 5502 getOffsetParent, 5503 getElementRects, 5504 getClientRects, 5505 getDimensions, 5506 getScale, 5507 isElement: _floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.isElement, 5508 isRTL 5509}; 5510 5511function rectsAreEqual(a, b) { 5512 return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; 5513} 5514 5515// https://samthor.au/2021/observing-dom/ 5516function observeMove(element, onMove) { 5517 let io = null; 5518 let timeoutId; 5519 const root = (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getDocumentElement)(element); 5520 function cleanup() { 5521 var _io; 5522 clearTimeout(timeoutId); 5523 (_io = io) == null || _io.disconnect(); 5524 io = null; 5525 } 5526 function refresh(skip, threshold) { 5527 if (skip === void 0) { 5528 skip = false; 5529 } 5530 if (threshold === void 0) { 5531 threshold = 1; 5532 } 5533 cleanup(); 5534 const elementRectForRootMargin = element.getBoundingClientRect(); 5535 const { 5536 left, 5537 top, 5538 width, 5539 height 5540 } = elementRectForRootMargin; 5541 if (!skip) { 5542 onMove(); 5543 } 5544 if (!width || !height) { 5545 return; 5546 } 5547 const insetTop = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.floor)(top); 5548 const insetRight = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.floor)(root.clientWidth - (left + width)); 5549 const insetBottom = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.floor)(root.clientHeight - (top + height)); 5550 const insetLeft = (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.floor)(left); 5551 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; 5552 const options = { 5553 rootMargin, 5554 threshold: (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.max)(0, (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_0__.min)(1, threshold)) || 1 5555 }; 5556 let isFirstUpdate = true; 5557 function handleObserve(entries) { 5558 const ratio = entries[0].intersectionRatio; 5559 if (ratio !== threshold) { 5560 if (!isFirstUpdate) { 5561 return refresh(); 5562 } 5563 if (!ratio) { 5564 // If the reference is clipped, the ratio is 0. Throttle the refresh 5565 // to prevent an infinite loop of updates. 5566 timeoutId = setTimeout(() => { 5567 refresh(false, 1e-7); 5568 }, 1000); 5569 } else { 5570 refresh(false, ratio); 5571 } 5572 } 5573 if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) { 5574 // It's possible that even though the ratio is reported as 1, the 5575 // element is not actually fully within the IntersectionObserver's root 5576 // area anymore. This can happen under performance constraints. This may 5577 // be a bug in the browser's IntersectionObserver implementation. To 5578 // work around this, we compare the element's bounding rect now with 5579 // what it was at the time we created the IntersectionObserver. If they 5580 // are not equal then the element moved, so we refresh. 5581 refresh(); 5582 } 5583 isFirstUpdate = false; 5584 } 5585 5586 // Older browsers don't support a `document` as the root and will throw an 5587 // error. 5588 try { 5589 io = new IntersectionObserver(handleObserve, { 5590 ...options, 5591 // Handle <iframe>s 5592 root: root.ownerDocument 5593 }); 5594 } catch (_e) { 5595 io = new IntersectionObserver(handleObserve, options); 5596 } 5597 io.observe(element); 5598 } 5599 refresh(true); 5600 return cleanup; 5601} 5602 5603/** 5604 * Automatically updates the position of the floating element when necessary. 5605 * Should only be called when the floating element is mounted on the DOM or 5606 * visible on the screen. 5607 * @returns cleanup function that should be invoked when the floating element is 5608 * removed from the DOM or hidden from the screen. 5609 * @see https://floating-ui.com/docs/autoUpdate 5610 */ 5611function autoUpdate(reference, floating, update, options) { 5612 if (options === void 0) { 5613 options = {}; 5614 } 5615 const { 5616 ancestorScroll = true, 5617 ancestorResize = true, 5618 elementResize = typeof ResizeObserver === 'function', 5619 layoutShift = typeof IntersectionObserver === 'function', 5620 animationFrame = false 5621 } = options; 5622 const referenceEl = unwrapElement(reference); 5623 const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? (0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getOverflowAncestors)(referenceEl) : []), ...(0,_floating_ui_utils_dom__WEBPACK_IMPORTED_MODULE_2__.getOverflowAncestors)(floating)] : []; 5624 ancestors.forEach(ancestor => { 5625 ancestorScroll && ancestor.addEventListener('scroll', update, { 5626 passive: true 5627 }); 5628 ancestorResize && ancestor.addEventListener('resize', update); 5629 }); 5630 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null; 5631 let reobserveFrame = -1; 5632 let resizeObserver = null; 5633 if (elementResize) { 5634 resizeObserver = new ResizeObserver(_ref => { 5635 let [firstEntry] = _ref; 5636 if (firstEntry && firstEntry.target === referenceEl && resizeObserver) { 5637 // Prevent update loops when using the `size` middleware. 5638 // https://github.com/floating-ui/floating-ui/issues/1740 5639 resizeObserver.unobserve(floating); 5640 cancelAnimationFrame(reobserveFrame); 5641 reobserveFrame = requestAnimationFrame(() => { 5642 var _resizeObserver; 5643 (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); 5644 }); 5645 } 5646 update(); 5647 }); 5648 if (referenceEl && !animationFrame) { 5649 resizeObserver.observe(referenceEl); 5650 } 5651 resizeObserver.observe(floating); 5652 } 5653 let frameId; 5654 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; 5655 if (animationFrame) { 5656 frameLoop(); 5657 } 5658 function frameLoop() { 5659 const nextRefRect = getBoundingClientRect(reference); 5660 if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) { 5661 update(); 5662 } 5663 prevRefRect = nextRefRect; 5664 frameId = requestAnimationFrame(frameLoop); 5665 } 5666 update(); 5667 return () => { 5668 var _resizeObserver2; 5669 ancestors.forEach(ancestor => { 5670 ancestorScroll && ancestor.removeEventListener('scroll', update); 5671 ancestorResize && ancestor.removeEventListener('resize', update); 5672 }); 5673 cleanupIo == null || cleanupIo(); 5674 (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); 5675 resizeObserver = null; 5676 if (animationFrame) { 5677 cancelAnimationFrame(frameId); 5678 } 5679 }; 5680} 5681 5682/** 5683 * Resolves with an object of overflow side offsets that determine how much the 5684 * element is overflowing a given clipping boundary on each side. 5685 * - positive = overflowing the boundary by that number of pixels 5686 * - negative = how many pixels left before it will overflow 5687 * - 0 = lies flush with the boundary 5688 * @see https://floating-ui.com/docs/detectOverflow 5689 */ 5690const detectOverflow = _floating_ui_core__WEBPACK_IMPORTED_MODULE_1__.detectOverflow; 5691 5692/** 5693 * Modifies the placement by translating the floating element along the 5694 * specified axes. 5695 * A number (shorthand for `mainAxis` or distance), or an axes configuration 5696 * object may be passed. 5697 * @see https://floating-ui.com/docs/offset 5698 */ 5699const offset = _floating_ui_core__WEBPACK_IMPORTED_MODULE_1__.offset; 5700 5701/** 5702 * Optimizes the visibility of the floating element by choosing the placement 5703 * that has the most space available automatically, without needing to specify a 5704 * preferred placement. Alternative to `flip`. 5705 * @see https://floating-ui.com/docs/autoPlacement 5706 */ 5707const autoPlacement = _floating_ui_core__WEBPACK_IMPORTED_MODULE_1__.autoPlacement; 5708 5709/** 5710 * Optimizes the visibility of the floating element by shifting it in order to 5711 * keep it in view when it will overflow the clipping boundary. 5712 * @see https://floating-ui.com/docs/shift 5713 */ 5714const shift = _floating_ui_core__WEBPACK_IMPORTED_MODULE_1__.shift; 5715 5716/** 5717 * Optimizes the visibility of the floating element by flipping the `placement` 5718 * in order to keep it in view when the preferred placement(s) will overflow the 5719 * clipping boundary. Alternative to `autoPlacement`. 5720 * @see https://floating-ui.com/docs/flip 5721 */ 5722const flip = _floating_ui_core__WEBPACK_IMPORTED_MODULE_1__.flip; 5723 5724/** 5725 * Provides data that allows you to change the size of the floating element â 5726 * for instance, prevent it from overflowing the clipping boundary or match the 5727 * width of the reference element. 5728 * @see https://floating-ui.com/docs/size 5729 */ 5730const size = _floating_ui_core__WEBPACK_IMPORTED_MODULE_1__.size; 5731 5732/** 5733 * Provides data to hide the floating element in applicable situations, such as 5734 * when it is not in the same clipping context as the reference element. 5735 * @see https://floating-ui.com/docs/hide 5736 */ 5737const hide = _floating_ui_core__WEBPACK_IMPORTED_MODULE_1__.hide; 5738 5739/** 5740 * Provides data to position an inner element of the floating element so that it 5741 * appears centered to the reference element. 5742 * @see https://floating-ui.com/docs/arrow 5743 */ 5744const arrow = _floating_ui_core__WEBPACK_IMPORTED_MODULE_1__.arrow; 5745 5746/** 5747 * Provides improved positioning for inline reference elements that can span 5748 * over multiple lines, such as hyperlinks or range selections. 5749 * @see https://floating-ui.com/docs/inline 5750 */ 5751const inline = _floating_ui_core__WEBPACK_IMPORTED_MODULE_1__.inline; 5752 5753/** 5754 * Built-in `limiter` that will stop `shift()` at a certain point. 5755 */ 5756const limitShift = _floating_ui_core__WEBPACK_IMPORTED_MODULE_1__.limitShift; 5757 5758/** 5759 * Computes the `x` and `y` coordinates that will place the floating element 5760 * next to a given reference element. 5761 */ 5762const computePosition = (reference, floating, options) => { 5763 // This caches the expensive `getClippingElementAncestors` function so that 5764 // multiple lifecycle resets re-use the same result. It only lives for a 5765 // single call. If other functions become expensive, we can add them as well. 5766 const cache = new Map(); 5767 const mergedOptions = { 5768 platform, 5769 ...options 5770 }; 5771 const platformWithCache = { 5772 ...mergedOptions.platform, 5773 _c: cache 5774 }; 5775 return (0,_floating_ui_core__WEBPACK_IMPORTED_MODULE_1__.computePosition)(reference, floating, { 5776 ...mergedOptions, 5777 platform: platformWithCache 5778 }); 5779}; 5780 5781 5782 5783 5784/***/ }), 5785
vendor: 7,996 bytes, lines 5786-5980
5786/***/ "./node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs": 5787/*!************************************************************************!*\ 5788 !*** ./node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs ***! 5789 \************************************************************************/ 5790/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 5791 5792"use strict"; 5793__webpack_require__.r(__webpack_exports__); 5794/* harmony export */ __webpack_require__.d(__webpack_exports__, { 5795/* harmony export */ getComputedStyle: () => (/* binding */ getComputedStyle), 5796/* harmony export */ getContainingBlock: () => (/* binding */ getContainingBlock), 5797/* harmony export */ getDocumentElement: () => (/* binding */ getDocumentElement), 5798/* harmony export */ getFrameElement: () => (/* binding */ getFrameElement), 5799/* harmony export */ getNearestOverflowAncestor: () => (/* binding */ getNearestOverflowAncestor), 5800/* harmony export */ getNodeName: () => (/* binding */ getNodeName), 5801/* harmony export */ getNodeScroll: () => (/* binding */ getNodeScroll), 5802/* harmony export */ getOverflowAncestors: () => (/* binding */ getOverflowAncestors), 5803/* harmony export */ getParentNode: () => (/* binding */ getParentNode), 5804/* harmony export */ getWindow: () => (/* binding */ getWindow), 5805/* harmony export */ isContainingBlock: () => (/* binding */ isContainingBlock), 5806/* harmony export */ isElement: () => (/* binding */ isElement), 5807/* harmony export */ isHTMLElement: () => (/* binding */ isHTMLElement), 5808/* harmony export */ isLastTraversableNode: () => (/* binding */ isLastTraversableNode), 5809/* harmony export */ isNode: () => (/* binding */ isNode), 5810/* harmony export */ isOverflowElement: () => (/* binding */ isOverflowElement), 5811/* harmony export */ isShadowRoot: () => (/* binding */ isShadowRoot), 5812/* harmony export */ isTableElement: () => (/* binding */ isTableElement), 5813/* harmony export */ isTopLayer: () => (/* binding */ isTopLayer), 5814/* harmony export */ isWebKit: () => (/* binding */ isWebKit) 5815/* harmony export */ }); 5816function hasWindow() { 5817 return typeof window !== 'undefined'; 5818} 5819function getNodeName(node) { 5820 if (isNode(node)) { 5821 return (node.nodeName || '').toLowerCase(); 5822 } 5823 // Mocked nodes in testing environments may not be instances of Node. By 5824 // returning `#document` an infinite loop won't occur. 5825 // https://github.com/floating-ui/floating-ui/issues/2317 5826 return '#document'; 5827} 5828function getWindow(node) { 5829 var _node$ownerDocument; 5830 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; 5831} 5832function getDocumentElement(node) { 5833 var _ref; 5834 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; 5835} 5836function isNode(value) { 5837 if (!hasWindow()) { 5838 return false; 5839 } 5840 return value instanceof Node || value instanceof getWindow(value).Node; 5841} 5842function isElement(value) { 5843 if (!hasWindow()) { 5844 return false; 5845 } 5846 return value instanceof Element || value instanceof getWindow(value).Element; 5847} 5848function isHTMLElement(value) { 5849 if (!hasWindow()) { 5850 return false; 5851 } 5852 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; 5853} 5854function isShadowRoot(value) { 5855 if (!hasWindow() || typeof ShadowRoot === 'undefined') { 5856 return false; 5857 } 5858 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; 5859} 5860const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']); 5861function isOverflowElement(element) { 5862 const { 5863 overflow, 5864 overflowX, 5865 overflowY, 5866 display 5867 } = getComputedStyle(element); 5868 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display); 5869} 5870const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']); 5871function isTableElement(element) { 5872 return tableElements.has(getNodeName(element)); 5873} 5874const topLayerSelectors = [':popover-open', ':modal']; 5875function isTopLayer(element) { 5876 return topLayerSelectors.some(selector => { 5877 try { 5878 return element.matches(selector); 5879 } catch (_e) { 5880 return false; 5881 } 5882 }); 5883} 5884const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective']; 5885const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter']; 5886const containValues = ['paint', 'layout', 'strict', 'content']; 5887function isContainingBlock(elementOrCss) { 5888 const webkit = isWebKit(); 5889 const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss; 5890 5891 // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block 5892 // https://drafts.csswg.org/css-transforms-2/#individual-transforms 5893 return transformProperties.some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || willChangeValues.some(value => (css.willChange || '').includes(value)) || containValues.some(value => (css.contain || '').includes(value)); 5894} 5895function getContainingBlock(element) { 5896 let currentNode = getParentNode(element); 5897 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { 5898 if (isContainingBlock(currentNode)) { 5899 return currentNode; 5900 } else if (isTopLayer(currentNode)) { 5901 return null; 5902 } 5903 currentNode = getParentNode(currentNode); 5904 } 5905 return null; 5906} 5907function isWebKit() { 5908 if (typeof CSS === 'undefined' || !CSS.supports) return false; 5909 return CSS.supports('-webkit-backdrop-filter', 'none'); 5910} 5911const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']); 5912function isLastTraversableNode(node) { 5913 return lastTraversableNodeNames.has(getNodeName(node)); 5914} 5915function getComputedStyle(element) { 5916 return getWindow(element).getComputedStyle(element); 5917} 5918function getNodeScroll(element) { 5919 if (isElement(element)) { 5920 return { 5921 scrollLeft: element.scrollLeft, 5922 scrollTop: element.scrollTop 5923 }; 5924 } 5925 return { 5926 scrollLeft: element.scrollX, 5927 scrollTop: element.scrollY 5928 }; 5929} 5930function getParentNode(node) { 5931 if (getNodeName(node) === 'html') { 5932 return node; 5933 } 5934 const result = 5935 // Step into the shadow DOM of the parent of a slotted node. 5936 node.assignedSlot || 5937 // DOM Element detected. 5938 node.parentNode || 5939 // ShadowRoot detected. 5940 isShadowRoot(node) && node.host || 5941 // Fallback. 5942 getDocumentElement(node); 5943 return isShadowRoot(result) ? result.host : result; 5944} 5945function getNearestOverflowAncestor(node) { 5946 const parentNode = getParentNode(node); 5947 if (isLastTraversableNode(parentNode)) { 5948 return node.ownerDocument ? node.ownerDocument.body : node.body; 5949 } 5950 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { 5951 return parentNode; 5952 } 5953 return getNearestOverflowAncestor(parentNode); 5954} 5955function getOverflowAncestors(node, list, traverseIframes) { 5956 var _node$ownerDocument2; 5957 if (list === void 0) { 5958 list = []; 5959 } 5960 if (traverseIframes === void 0) { 5961 traverseIframes = true; 5962 } 5963 const scrollableAncestor = getNearestOverflowAncestor(node); 5964 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); 5965 const win = getWindow(scrollableAncestor); 5966 if (isBody) { 5967 const frameElement = getFrameElement(win); 5968 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); 5969 } 5970 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); 5971} 5972function getFrameElement(win) { 5973 return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; 5974} 5975 5976 5977 5978 5979/***/ }), 5980
vendor: 6,167 bytes, lines 5981-6157
5981/***/ "./node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs": 5982/*!********************************************************************!*\ 5983 !*** ./node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs ***! 5984 \********************************************************************/ 5985/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 5986 5987"use strict"; 5988__webpack_require__.r(__webpack_exports__); 5989/* harmony export */ __webpack_require__.d(__webpack_exports__, { 5990/* harmony export */ alignments: () => (/* binding */ alignments), 5991/* harmony export */ clamp: () => (/* binding */ clamp), 5992/* harmony export */ createCoords: () => (/* binding */ createCoords), 5993/* harmony export */ evaluate: () => (/* binding */ evaluate), 5994/* harmony export */ expandPaddingObject: () => (/* binding */ expandPaddingObject), 5995/* harmony export */ floor: () => (/* binding */ floor), 5996/* harmony export */ getAlignment: () => (/* binding */ getAlignment), 5997/* harmony export */ getAlignmentAxis: () => (/* binding */ getAlignmentAxis), 5998/* harmony export */ getAlignmentSides: () => (/* binding */ getAlignmentSides), 5999/* harmony export */ getAxisLength: () => (/* binding */ getAxisLength), 6000/* harmony export */ getExpandedPlacements: () => (/* binding */ getExpandedPlacements), 6001/* harmony export */ getOppositeAlignmentPlacement: () => (/* binding */ getOppositeAlignmentPlacement), 6002/* harmony export */ getOppositeAxis: () => (/* binding */ getOppositeAxis), 6003/* harmony export */ getOppositeAxisPlacements: () => (/* binding */ getOppositeAxisPlacements), 6004/* harmony export */ getOppositePlacement: () => (/* binding */ getOppositePlacement), 6005/* harmony export */ getPaddingObject: () => (/* binding */ getPaddingObject), 6006/* harmony export */ getSide: () => (/* binding */ getSide), 6007/* harmony export */ getSideAxis: () => (/* binding */ getSideAxis), 6008/* harmony export */ max: () => (/* binding */ max), 6009/* harmony export */ min: () => (/* binding */ min), 6010/* harmony export */ placements: () => (/* binding */ placements), 6011/* harmony export */ rectToClientRect: () => (/* binding */ rectToClientRect), 6012/* harmony export */ round: () => (/* binding */ round), 6013/* harmony export */ sides: () => (/* binding */ sides) 6014/* harmony export */ }); 6015/** 6016 * Custom positioning reference element. 6017 * @see https://floating-ui.com/docs/virtual-elements 6018 */ 6019 6020const sides = ['top', 'right', 'bottom', 'left']; 6021const alignments = ['start', 'end']; 6022const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []); 6023const min = Math.min; 6024const max = Math.max; 6025const round = Math.round; 6026const floor = Math.floor; 6027const createCoords = v => ({ 6028 x: v, 6029 y: v 6030}); 6031const oppositeSideMap = { 6032 left: 'right', 6033 right: 'left', 6034 bottom: 'top', 6035 top: 'bottom' 6036}; 6037const oppositeAlignmentMap = { 6038 start: 'end', 6039 end: 'start' 6040}; 6041function clamp(start, value, end) { 6042 return max(start, min(value, end)); 6043} 6044function evaluate(value, param) { 6045 return typeof value === 'function' ? value(param) : value; 6046} 6047function getSide(placement) { 6048 return placement.split('-')[0]; 6049} 6050function getAlignment(placement) { 6051 return placement.split('-')[1]; 6052} 6053function getOppositeAxis(axis) { 6054 return axis === 'x' ? 'y' : 'x'; 6055} 6056function getAxisLength(axis) { 6057 return axis === 'y' ? 'height' : 'width'; 6058} 6059const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']); 6060function getSideAxis(placement) { 6061 return yAxisSides.has(getSide(placement)) ? 'y' : 'x'; 6062} 6063function getAlignmentAxis(placement) { 6064 return getOppositeAxis(getSideAxis(placement)); 6065} 6066function getAlignmentSides(placement, rects, rtl) { 6067 if (rtl === void 0) { 6068 rtl = false; 6069 } 6070 const alignment = getAlignment(placement); 6071 const alignmentAxis = getAlignmentAxis(placement); 6072 const length = getAxisLength(alignmentAxis); 6073 let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top'; 6074 if (rects.reference[length] > rects.floating[length]) { 6075 mainAlignmentSide = getOppositePlacement(mainAlignmentSide); 6076 } 6077 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; 6078} 6079function getExpandedPlacements(placement) { 6080 const oppositePlacement = getOppositePlacement(placement); 6081 return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; 6082} 6083function getOppositeAlignmentPlacement(placement) { 6084 return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]); 6085} 6086const lrPlacement = ['left', 'right']; 6087const rlPlacement = ['right', 'left']; 6088const tbPlacement = ['top', 'bottom']; 6089const btPlacement = ['bottom', 'top']; 6090function getSideList(side, isStart, rtl) { 6091 switch (side) { 6092 case 'top': 6093 case 'bottom': 6094 if (rtl) return isStart ? rlPlacement : lrPlacement; 6095 return isStart ? lrPlacement : rlPlacement; 6096 case 'left': 6097 case 'right': 6098 return isStart ? tbPlacement : btPlacement; 6099 default: 6100 return []; 6101 } 6102} 6103function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { 6104 const alignment = getAlignment(placement); 6105 let list = getSideList(getSide(placement), direction === 'start', rtl); 6106 if (alignment) { 6107 list = list.map(side => side + "-" + alignment); 6108 if (flipAlignment) { 6109 list = list.concat(list.map(getOppositeAlignmentPlacement)); 6110 } 6111 } 6112 return list; 6113} 6114function getOppositePlacement(placement) { 6115 return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]); 6116} 6117function expandPaddingObject(padding) { 6118 return { 6119 top: 0, 6120 right: 0, 6121 bottom: 0, 6122 left: 0, 6123 ...padding 6124 }; 6125} 6126function getPaddingObject(padding) { 6127 return typeof padding !== 'number' ? expandPaddingObject(padding) : { 6128 top: padding, 6129 right: padding, 6130 bottom: padding, 6131 left: padding 6132 }; 6133} 6134function rectToClientRect(rect) { 6135 const { 6136 x, 6137 y, 6138 width, 6139 height 6140 } = rect; 6141 return { 6142 width, 6143 height, 6144 top: y, 6145 left: x, 6146 right: x + width, 6147 bottom: y + height, 6148 x, 6149 y 6150 }; 6151} 6152 6153 6154 6155 6156/***/ }), 6157
vendor: 342 bytes, lines 6158-6167
6158/***/ "./node_modules/axios/index.js": 6159/*!*************************************!*\ 6160 !*** ./node_modules/axios/index.js ***! 6161 \*************************************/ 6162/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 6163 6164module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js"); 6165 6166/***/ }), 6167
vendor: 6,833 bytes, lines 6168-6364
6168/***/ "./node_modules/axios/lib/adapters/xhr.js": 6169/*!************************************************!*\ 6170 !*** ./node_modules/axios/lib/adapters/xhr.js ***! 6171 \************************************************/ 6172/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 6173 6174"use strict"; 6175 6176 6177var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 6178var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js"); 6179var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js"); 6180var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js"); 6181var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js"); 6182var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js"); 6183var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js"); 6184var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js"); 6185 6186module.exports = function xhrAdapter(config) { 6187 return new Promise(function dispatchXhrRequest(resolve, reject) { 6188 var requestData = config.data; 6189 var requestHeaders = config.headers; 6190 6191 if (utils.isFormData(requestData)) { 6192 delete requestHeaders['Content-Type']; // Let the browser set it 6193 } 6194 6195 if ( 6196 (utils.isBlob(requestData) || utils.isFile(requestData)) && 6197 requestData.type 6198 ) { 6199 delete requestHeaders['Content-Type']; // Let the browser set it 6200 } 6201 6202 var request = new XMLHttpRequest(); 6203 6204 // HTTP basic authentication 6205 if (config.auth) { 6206 var username = config.auth.username || ''; 6207 var password = unescape(encodeURIComponent(config.auth.password)) || ''; 6208 requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); 6209 } 6210 6211 var fullPath = buildFullPath(config.baseURL, config.url); 6212 request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); 6213 6214 // Set the request timeout in MS 6215 request.timeout = config.timeout; 6216 6217 // Listen for ready state 6218 request.onreadystatechange = function handleLoad() { 6219 if (!request || request.readyState !== 4) { 6220 return; 6221 } 6222 6223 // The request errored out and we didn't get a response, this will be 6224 // handled by onerror instead 6225 // With one exception: request that using file: protocol, most browsers 6226 // will return status as 0 even though it's a successful request 6227 if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { 6228 return; 6229 } 6230 6231 // Prepare the response 6232 var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; 6233 var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response; 6234 var response = { 6235 data: responseData, 6236 status: request.status, 6237 statusText: request.statusText, 6238 headers: responseHeaders, 6239 config: config, 6240 request: request 6241 }; 6242 6243 settle(resolve, reject, response); 6244 6245 // Clean up request 6246 request = null; 6247 }; 6248 6249 // Handle browser request cancellation (as opposed to a manual cancellation) 6250 request.onabort = function handleAbort() { 6251 if (!request) { 6252 return; 6253 } 6254 6255 reject(createError('Request aborted', config, 'ECONNABORTED', request)); 6256 6257 // Clean up request 6258 request = null; 6259 }; 6260 6261 // Handle low level network errors 6262 request.onerror = function handleError() { 6263 // Real errors are hidden from us by the browser 6264 // onerror should only fire if it's a network error 6265 reject(createError('Network Error', config, null, request)); 6266 6267 // Clean up request 6268 request = null; 6269 }; 6270 6271 // Handle timeout 6272 request.ontimeout = function handleTimeout() { 6273 var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded'; 6274 if (config.timeoutErrorMessage) { 6275 timeoutErrorMessage = config.timeoutErrorMessage; 6276 } 6277 reject(createError(timeoutErrorMessage, config, 'ECONNABORTED', 6278 request)); 6279 6280 // Clean up request 6281 request = null; 6282 }; 6283 6284 // Add xsrf header 6285 // This is only done if running in a standard browser environment. 6286 // Specifically not if we're in a web worker, or react-native. 6287 if (utils.isStandardBrowserEnv()) { 6288 // Add xsrf header 6289 var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? 6290 cookies.read(config.xsrfCookieName) : 6291 undefined; 6292 6293 if (xsrfValue) { 6294 requestHeaders[config.xsrfHeaderName] = xsrfValue; 6295 } 6296 } 6297 6298 // Add headers to the request 6299 if ('setRequestHeader' in request) { 6300 utils.forEach(requestHeaders, function setRequestHeader(val, key) { 6301 if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { 6302 // Remove Content-Type if data is undefined 6303 delete requestHeaders[key]; 6304 } else { 6305 // Otherwise add header to the request 6306 request.setRequestHeader(key, val); 6307 } 6308 }); 6309 } 6310 6311 // Add withCredentials to request if needed 6312 if (!utils.isUndefined(config.withCredentials)) { 6313 request.withCredentials = !!config.withCredentials; 6314 } 6315 6316 // Add responseType to request if needed 6317 if (config.responseType) { 6318 try { 6319 request.responseType = config.responseType; 6320 } catch (e) { 6321 // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2. 6322 // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function. 6323 if (config.responseType !== 'json') { 6324 throw e; 6325 } 6326 } 6327 } 6328 6329 // Handle progress if needed 6330 if (typeof config.onDownloadProgress === 'function') { 6331 request.addEventListener('progress', config.onDownloadProgress); 6332 } 6333 6334 // Not all browsers support upload events 6335 if (typeof config.onUploadProgress === 'function' && request.upload) { 6336 request.upload.addEventListener('progress', config.onUploadProgress); 6337 } 6338 6339 if (config.cancelToken) { 6340 // Handle cancellation 6341 config.cancelToken.promise.then(function onCanceled(cancel) { 6342 if (!request) { 6343 return; 6344 } 6345 6346 request.abort(); 6347 reject(cancel); 6348 // Clean up request 6349 request = null; 6350 }); 6351 } 6352 6353 if (!requestData) { 6354 requestData = null; 6355 } 6356 6357 // Send the request 6358 request.send(requestData); 6359 }); 6360}; 6361 6362 6363/***/ }), 6364
vendor: 2,235 bytes, lines 6365-6428
6365/***/ "./node_modules/axios/lib/axios.js": 6366/*!*****************************************!*\ 6367 !*** ./node_modules/axios/lib/axios.js ***! 6368 \*****************************************/ 6369/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 6370 6371"use strict"; 6372 6373 6374var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js"); 6375var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js"); 6376var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js"); 6377var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js"); 6378var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js"); 6379 6380/** 6381 * Create an instance of Axios 6382 * 6383 * @param {Object} defaultConfig The default config for the instance 6384 * @return {Axios} A new instance of Axios 6385 */ 6386function createInstance(defaultConfig) { 6387 var context = new Axios(defaultConfig); 6388 var instance = bind(Axios.prototype.request, context); 6389 6390 // Copy axios.prototype to instance 6391 utils.extend(instance, Axios.prototype, context); 6392 6393 // Copy context to instance 6394 utils.extend(instance, context); 6395 6396 return instance; 6397} 6398 6399// Create the default instance to be exported 6400var axios = createInstance(defaults); 6401 6402// Expose Axios class to allow class inheritance 6403axios.Axios = Axios; 6404 6405// Factory for creating new instances 6406axios.create = function create(instanceConfig) { 6407 return createInstance(mergeConfig(axios.defaults, instanceConfig)); 6408}; 6409 6410// Expose Cancel & CancelToken 6411axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js"); 6412axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js"); 6413axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js"); 6414 6415// Expose all/spread 6416axios.all = function all(promises) { 6417 return Promise.all(promises); 6418}; 6419axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js"); 6420 6421module.exports = axios; 6422 6423// Allow use of default import syntax in TypeScript 6424module.exports["default"] = axios; 6425 6426 6427/***/ }), 6428
vendor: 636 bytes, lines 6429-6458
6429/***/ "./node_modules/axios/lib/cancel/Cancel.js": 6430/*!*************************************************!*\ 6431 !*** ./node_modules/axios/lib/cancel/Cancel.js ***! 6432 \*************************************************/ 6433/***/ ((module) => { 6434 6435"use strict"; 6436 6437 6438/** 6439 * A `Cancel` is an object that is thrown when an operation is canceled. 6440 * 6441 * @class 6442 * @param {string=} message The message. 6443 */ 6444function Cancel(message) { 6445 this.message = message; 6446} 6447 6448Cancel.prototype.toString = function toString() { 6449 return 'Cancel' + (this.message ? ': ' + this.message : ''); 6450}; 6451 6452Cancel.prototype.__CANCEL__ = true; 6453 6454module.exports = Cancel; 6455 6456 6457/***/ }), 6458
vendor: 1,619 bytes, lines 6459-6526
6459/***/ "./node_modules/axios/lib/cancel/CancelToken.js": 6460/*!******************************************************!*\ 6461 !*** ./node_modules/axios/lib/cancel/CancelToken.js ***! 6462 \******************************************************/ 6463/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 6464 6465"use strict"; 6466 6467 6468var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js"); 6469 6470/** 6471 * A `CancelToken` is an object that can be used to request cancellation of an operation. 6472 * 6473 * @class 6474 * @param {Function} executor The executor function. 6475 */ 6476function CancelToken(executor) { 6477 if (typeof executor !== 'function') { 6478 throw new TypeError('executor must be a function.'); 6479 } 6480 6481 var resolvePromise; 6482 this.promise = new Promise(function promiseExecutor(resolve) { 6483 resolvePromise = resolve; 6484 }); 6485 6486 var token = this; 6487 executor(function cancel(message) { 6488 if (token.reason) { 6489 // Cancellation has already been requested 6490 return; 6491 } 6492 6493 token.reason = new Cancel(message); 6494 resolvePromise(token.reason); 6495 }); 6496} 6497 6498/** 6499 * Throws a `Cancel` if cancellation has been requested. 6500 */ 6501CancelToken.prototype.throwIfRequested = function throwIfRequested() { 6502 if (this.reason) { 6503 throw this.reason; 6504 } 6505}; 6506 6507/** 6508 * Returns an object that contains a new `CancelToken` and a function that, when called, 6509 * cancels the `CancelToken`. 6510 */ 6511CancelToken.source = function source() { 6512 var cancel; 6513 var token = new CancelToken(function executor(c) { 6514 cancel = c; 6515 }); 6516 return { 6517 token: token, 6518 cancel: cancel 6519 }; 6520}; 6521 6522module.exports = CancelToken; 6523 6524 6525/***/ }), 6526
vendor: 361 bytes, lines 6527-6542
6527/***/ "./node_modules/axios/lib/cancel/isCancel.js": 6528/*!***************************************************!*\ 6529 !*** ./node_modules/axios/lib/cancel/isCancel.js ***! 6530 \***************************************************/ 6531/***/ ((module) => { 6532 6533"use strict"; 6534 6535 6536module.exports = function isCancel(value) { 6537 return !!(value && value.__CANCEL__); 6538}; 6539 6540 6541/***/ }), 6542
vendor: 3,221 bytes, lines 6543-6647
6543/***/ "./node_modules/axios/lib/core/Axios.js": 6544/*!**********************************************!*\ 6545 !*** ./node_modules/axios/lib/core/Axios.js ***! 6546 \**********************************************/ 6547/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 6548 6549"use strict"; 6550 6551 6552var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 6553var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js"); 6554var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js"); 6555var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js"); 6556var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js"); 6557 6558/** 6559 * Create a new instance of Axios 6560 * 6561 * @param {Object} instanceConfig The default config for the instance 6562 */ 6563function Axios(instanceConfig) { 6564 this.defaults = instanceConfig; 6565 this.interceptors = { 6566 request: new InterceptorManager(), 6567 response: new InterceptorManager() 6568 }; 6569} 6570 6571/** 6572 * Dispatch a request 6573 * 6574 * @param {Object} config The config specific for this request (merged with this.defaults) 6575 */ 6576Axios.prototype.request = function request(config) { 6577 /*eslint no-param-reassign:0*/ 6578 // Allow for axios('example/url'[, config]) a la fetch API 6579 if (typeof config === 'string') { 6580 config = arguments[1] || {}; 6581 config.url = arguments[0]; 6582 } else { 6583 config = config || {}; 6584 } 6585 6586 config = mergeConfig(this.defaults, config); 6587 6588 // Set config.method 6589 if (config.method) { 6590 config.method = config.method.toLowerCase(); 6591 } else if (this.defaults.method) { 6592 config.method = this.defaults.method.toLowerCase(); 6593 } else { 6594 config.method = 'get'; 6595 } 6596 6597 // Hook up interceptors middleware 6598 var chain = [dispatchRequest, undefined]; 6599 var promise = Promise.resolve(config); 6600 6601 this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { 6602 chain.unshift(interceptor.fulfilled, interceptor.rejected); 6603 }); 6604 6605 this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { 6606 chain.push(interceptor.fulfilled, interceptor.rejected); 6607 }); 6608 6609 while (chain.length) { 6610 promise = promise.then(chain.shift(), chain.shift()); 6611 } 6612 6613 return promise; 6614}; 6615 6616Axios.prototype.getUri = function getUri(config) { 6617 config = mergeConfig(this.defaults, config); 6618 return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, ''); 6619}; 6620 6621// Provide aliases for supported request methods 6622utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { 6623 /*eslint func-names:0*/ 6624 Axios.prototype[method] = function(url, config) { 6625 return this.request(mergeConfig(config || {}, { 6626 method: method, 6627 url: url 6628 })); 6629 }; 6630}); 6631 6632utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { 6633 /*eslint func-names:0*/ 6634 Axios.prototype[method] = function(url, data, config) { 6635 return this.request(mergeConfig(config || {}, { 6636 method: method, 6637 url: url, 6638 data: data 6639 })); 6640 }; 6641}); 6642 6643module.exports = Axios; 6644 6645 6646/***/ }), 6647
vendor: 1,642 bytes, lines 6648-6710
6648/***/ "./node_modules/axios/lib/core/InterceptorManager.js": 6649/*!***********************************************************!*\ 6650 !*** ./node_modules/axios/lib/core/InterceptorManager.js ***! 6651 \***********************************************************/ 6652/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 6653 6654"use strict"; 6655 6656 6657var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 6658 6659function InterceptorManager() { 6660 this.handlers = []; 6661} 6662 6663/** 6664 * Add a new interceptor to the stack 6665 * 6666 * @param {Function} fulfilled The function to handle `then` for a `Promise` 6667 * @param {Function} rejected The function to handle `reject` for a `Promise` 6668 * 6669 * @return {Number} An ID used to remove interceptor later 6670 */ 6671InterceptorManager.prototype.use = function use(fulfilled, rejected) { 6672 this.handlers.push({ 6673 fulfilled: fulfilled, 6674 rejected: rejected 6675 }); 6676 return this.handlers.length - 1; 6677}; 6678 6679/** 6680 * Remove an interceptor from the stack 6681 * 6682 * @param {Number} id The ID that was returned by `use` 6683 */ 6684InterceptorManager.prototype.eject = function eject(id) { 6685 if (this.handlers[id]) { 6686 this.handlers[id] = null; 6687 } 6688}; 6689 6690/** 6691 * Iterate over all the registered interceptors 6692 * 6693 * This method is particularly useful for skipping over any 6694 * interceptors that may have become `null` calling `eject`. 6695 * 6696 * @param {Function} fn The function to call for each interceptor 6697 */ 6698InterceptorManager.prototype.forEach = function forEach(fn) { 6699 utils.forEach(this.handlers, function forEachHandler(h) { 6700 if (h !== null) { 6701 fn(h); 6702 } 6703 }); 6704}; 6705 6706module.exports = InterceptorManager; 6707 6708 6709/***/ }), 6710
vendor: 1,149 bytes, lines 6711-6741
6711/***/ "./node_modules/axios/lib/core/buildFullPath.js": 6712/*!******************************************************!*\ 6713 !*** ./node_modules/axios/lib/core/buildFullPath.js ***! 6714 \******************************************************/ 6715/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 6716 6717"use strict"; 6718 6719 6720var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js"); 6721var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js"); 6722 6723/** 6724 * Creates a new URL by combining the baseURL with the requestedURL, 6725 * only when the requestedURL is not already an absolute URL. 6726 * If the requestURL is absolute, this function returns the requestedURL untouched. 6727 * 6728 * @param {string} baseURL The base URL 6729 * @param {string} requestedURL Absolute or relative URL to combine 6730 * @returns {string} The combined full path 6731 */ 6732module.exports = function buildFullPath(baseURL, requestedURL) { 6733 if (baseURL && !isAbsoluteURL(requestedURL)) { 6734 return combineURLs(baseURL, requestedURL); 6735 } 6736 return requestedURL; 6737}; 6738 6739 6740/***/ }), 6741
vendor: 1,000 bytes, lines 6742-6770
6742/***/ "./node_modules/axios/lib/core/createError.js": 6743/*!****************************************************!*\ 6744 !*** ./node_modules/axios/lib/core/createError.js ***! 6745 \****************************************************/ 6746/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 6747 6748"use strict"; 6749 6750 6751var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js"); 6752 6753/** 6754 * Create an Error with the specified message, config, error code, request and response. 6755 * 6756 * @param {string} message The error message. 6757 * @param {Object} config The config. 6758 * @param {string} [code] The error code (for example, 'ECONNABORTED'). 6759 * @param {Object} [request] The request. 6760 * @param {Object} [response] The response. 6761 * @returns {Error} The created error. 6762 */ 6763module.exports = function createError(message, config, code, request, response) { 6764 var error = new Error(message); 6765 return enhanceError(error, config, code, request, response); 6766}; 6767 6768 6769/***/ }), 6770
vendor: 2,498 bytes, lines 6771-6860
6771/***/ "./node_modules/axios/lib/core/dispatchRequest.js": 6772/*!********************************************************!*\ 6773 !*** ./node_modules/axios/lib/core/dispatchRequest.js ***! 6774 \********************************************************/ 6775/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 6776 6777"use strict"; 6778 6779 6780var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 6781var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js"); 6782var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js"); 6783var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js"); 6784 6785/** 6786 * Throws a `Cancel` if cancellation has been requested. 6787 */ 6788function throwIfCancellationRequested(config) { 6789 if (config.cancelToken) { 6790 config.cancelToken.throwIfRequested(); 6791 } 6792} 6793 6794/** 6795 * Dispatch a request to the server using the configured adapter. 6796 * 6797 * @param {object} config The config that is to be used for the request 6798 * @returns {Promise} The Promise to be fulfilled 6799 */ 6800module.exports = function dispatchRequest(config) { 6801 throwIfCancellationRequested(config); 6802 6803 // Ensure headers exist 6804 config.headers = config.headers || {}; 6805 6806 // Transform request data 6807 config.data = transformData( 6808 config.data, 6809 config.headers, 6810 config.transformRequest 6811 ); 6812 6813 // Flatten headers 6814 config.headers = utils.merge( 6815 config.headers.common || {}, 6816 config.headers[config.method] || {}, 6817 config.headers 6818 ); 6819 6820 utils.forEach( 6821 ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], 6822 function cleanHeaderConfig(method) { 6823 delete config.headers[method]; 6824 } 6825 ); 6826 6827 var adapter = config.adapter || defaults.adapter; 6828 6829 return adapter(config).then(function onAdapterResolution(response) { 6830 throwIfCancellationRequested(config); 6831 6832 // Transform response data 6833 response.data = transformData( 6834 response.data, 6835 response.headers, 6836 config.transformResponse 6837 ); 6838 6839 return response; 6840 }, function onAdapterRejection(reason) { 6841 if (!isCancel(reason)) { 6842 throwIfCancellationRequested(config); 6843 6844 // Transform response data 6845 if (reason && reason.response) { 6846 reason.response.data = transformData( 6847 reason.response.data, 6848 reason.response.headers, 6849 config.transformResponse 6850 ); 6851 } 6852 } 6853 6854 return Promise.reject(reason); 6855 }); 6856}; 6857 6858 6859/***/ }), 6860
vendor: 1,316 bytes, lines 6861-6913
6861/***/ "./node_modules/axios/lib/core/enhanceError.js": 6862/*!*****************************************************!*\ 6863 !*** ./node_modules/axios/lib/core/enhanceError.js ***! 6864 \*****************************************************/ 6865/***/ ((module) => { 6866 6867"use strict"; 6868 6869 6870/** 6871 * Update an Error with the specified config, error code, and response. 6872 * 6873 * @param {Error} error The error to update. 6874 * @param {Object} config The config. 6875 * @param {string} [code] The error code (for example, 'ECONNABORTED'). 6876 * @param {Object} [request] The request. 6877 * @param {Object} [response] The response. 6878 * @returns {Error} The error. 6879 */ 6880module.exports = function enhanceError(error, config, code, request, response) { 6881 error.config = config; 6882 if (code) { 6883 error.code = code; 6884 } 6885 6886 error.request = request; 6887 error.response = response; 6888 error.isAxiosError = true; 6889 6890 error.toJSON = function toJSON() { 6891 return { 6892 // Standard 6893 message: this.message, 6894 name: this.name, 6895 // Microsoft 6896 description: this.description, 6897 number: this.number, 6898 // Mozilla 6899 fileName: this.fileName, 6900 lineNumber: this.lineNumber, 6901 columnNumber: this.columnNumber, 6902 stack: this.stack, 6903 // Axios 6904 config: this.config, 6905 code: this.code 6906 }; 6907 }; 6908 return error; 6909}; 6910 6911 6912/***/ }), 6913
vendor: 3,258 bytes, lines 6914-7011
6914/***/ "./node_modules/axios/lib/core/mergeConfig.js": 6915/*!****************************************************!*\ 6916 !*** ./node_modules/axios/lib/core/mergeConfig.js ***! 6917 \****************************************************/ 6918/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 6919 6920"use strict"; 6921 6922 6923var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js"); 6924 6925/** 6926 * Config-specific merge-function which creates a new config-object 6927 * by merging two configuration objects together. 6928 * 6929 * @param {Object} config1 6930 * @param {Object} config2 6931 * @returns {Object} New object resulting from merging config2 to config1 6932 */ 6933module.exports = function mergeConfig(config1, config2) { 6934 // eslint-disable-next-line no-param-reassign 6935 config2 = config2 || {}; 6936 var config = {}; 6937 6938 var valueFromConfig2Keys = ['url', 'method', 'data']; 6939 var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params']; 6940 var defaultToConfig2Keys = [ 6941 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer', 6942 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', 6943 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress', 6944 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent', 6945 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding' 6946 ]; 6947 var directMergeKeys = ['validateStatus']; 6948 6949 function getMergedValue(target, source) { 6950 if (utils.isPlainObject(target) && utils.isPlainObject(source)) { 6951 return utils.merge(target, source); 6952 } else if (utils.isPlainObject(source)) { 6953 return utils.merge({}, source); 6954 } else if (utils.isArray(source)) { 6955 return source.slice(); 6956 } 6957 return source; 6958 } 6959 6960 function mergeDeepProperties(prop) { 6961 if (!utils.isUndefined(config2[prop])) { 6962 config[prop] = getMergedValue(config1[prop], config2[prop]); 6963 } else if (!utils.isUndefined(config1[prop])) { 6964 config[prop] = getMergedValue(undefined, config1[prop]); 6965 } 6966 } 6967 6968 utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) { 6969 if (!utils.isUndefined(config2[prop])) { 6970 config[prop] = getMergedValue(undefined, config2[prop]); 6971 } 6972 }); 6973 6974 utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties); 6975 6976 utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) { 6977 if (!utils.isUndefined(config2[prop])) { 6978 config[prop] = getMergedValue(undefined, config2[prop]); 6979 } else if (!utils.isUndefined(config1[prop])) { 6980 config[prop] = getMergedValue(undefined, config1[prop]); 6981 } 6982 }); 6983 6984 utils.forEach(directMergeKeys, function merge(prop) { 6985 if (prop in config2) { 6986 config[prop] = getMergedValue(config1[prop], config2[prop]); 6987 } else if (prop in config1) { 6988 config[prop] = getMergedValue(undefined, config1[prop]); 6989 } 6990 }); 6991 6992 var axiosKeys = valueFromConfig2Keys 6993 .concat(mergeDeepPropertiesKeys) 6994 .concat(defaultToConfig2Keys) 6995 .concat(directMergeKeys); 6996 6997 var otherKeys = Object 6998 .keys(config1) 6999 .concat(Object.keys(config2)) 7000 .filter(function filterAxiosKeys(key) { 7001 return axiosKeys.indexOf(key) === -1; 7002 }); 7003 7004 utils.forEach(otherKeys, mergeDeepProperties); 7005 7006 return config; 7007}; 7008 7009 7010/***/ }), 7011
vendor: 1,060 bytes, lines 7012-7047
7012/***/ "./node_modules/axios/lib/core/settle.js": 7013/*!***********************************************!*\ 7014 !*** ./node_modules/axios/lib/core/settle.js ***! 7015 \***********************************************/ 7016/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 7017 7018"use strict"; 7019 7020 7021var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js"); 7022 7023/** 7024 * Resolve or reject a Promise based on response status. 7025 * 7026 * @param {Function} resolve A function that resolves the promise. 7027 * @param {Function} reject A function that rejects the promise. 7028 * @param {object} response The response. 7029 */ 7030module.exports = function settle(resolve, reject, response) { 7031 var validateStatus = response.config.validateStatus; 7032 if (!response.status || !validateStatus || validateStatus(response.status)) { 7033 resolve(response); 7034 } else { 7035 reject(createError( 7036 'Request failed with status code ' + response.status, 7037 response.config, 7038 null, 7039 response.request, 7040 response 7041 )); 7042 } 7043}; 7044 7045 7046/***/ }), 7047
vendor: 921 bytes, lines 7048-7078
7048/***/ "./node_modules/axios/lib/core/transformData.js": 7049/*!******************************************************!*\ 7050 !*** ./node_modules/axios/lib/core/transformData.js ***! 7051 \******************************************************/ 7052/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 7053 7054"use strict"; 7055 7056 7057var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 7058 7059/** 7060 * Transform the data for a request or a response 7061 * 7062 * @param {Object|String} data The data to be transformed 7063 * @param {Array} headers The headers for the request or response 7064 * @param {Array|Function} fns A single function or Array of functions 7065 * @returns {*} The resulting transformed data 7066 */ 7067module.exports = function transformData(data, headers, fns) { 7068 /*eslint no-param-reassign:0*/ 7069 utils.forEach(fns, function transform(fn) { 7070 data = fn(data, headers); 7071 }); 7072 7073 return data; 7074}; 7075 7076 7077/***/ }), 7078
vendor: 3,089 bytes, lines 7079-7187
7079/***/ "./node_modules/axios/lib/defaults.js": 7080/*!********************************************!*\ 7081 !*** ./node_modules/axios/lib/defaults.js ***! 7082 \********************************************/ 7083/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 7084 7085"use strict"; 7086 7087 7088var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js"); 7089var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js"); 7090 7091var DEFAULT_CONTENT_TYPE = { 7092 'Content-Type': 'application/x-www-form-urlencoded' 7093}; 7094 7095function setContentTypeIfUnset(headers, value) { 7096 if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { 7097 headers['Content-Type'] = value; 7098 } 7099} 7100 7101function getDefaultAdapter() { 7102 var adapter; 7103 if (typeof XMLHttpRequest !== 'undefined') { 7104 // For browsers use XHR adapter 7105 adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js"); 7106 } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') { 7107 // For node use HTTP adapter 7108 adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js"); 7109 } 7110 return adapter; 7111} 7112 7113var defaults = { 7114 adapter: getDefaultAdapter(), 7115 7116 transformRequest: [function transformRequest(data, headers) { 7117 normalizeHeaderName(headers, 'Accept'); 7118 normalizeHeaderName(headers, 'Content-Type'); 7119 if (utils.isFormData(data) || 7120 utils.isArrayBuffer(data) || 7121 utils.isBuffer(data) || 7122 utils.isStream(data) || 7123 utils.isFile(data) || 7124 utils.isBlob(data) 7125 ) { 7126 return data; 7127 } 7128 if (utils.isArrayBufferView(data)) { 7129 return data.buffer; 7130 } 7131 if (utils.isURLSearchParams(data)) { 7132 setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); 7133 return data.toString(); 7134 } 7135 if (utils.isObject(data)) { 7136 setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); 7137 return JSON.stringify(data); 7138 } 7139 return data; 7140 }], 7141 7142 transformResponse: [function transformResponse(data) { 7143 /*eslint no-param-reassign:0*/ 7144 if (typeof data === 'string') { 7145 try { 7146 data = JSON.parse(data); 7147 } catch (e) { /* Ignore */ } 7148 } 7149 return data; 7150 }], 7151 7152 /** 7153 * A timeout in milliseconds to abort a request. If set to 0 (default) a 7154 * timeout is not created. 7155 */ 7156 timeout: 0, 7157 7158 xsrfCookieName: 'XSRF-TOKEN', 7159 xsrfHeaderName: 'X-XSRF-TOKEN', 7160 7161 maxContentLength: -1, 7162 maxBodyLength: -1, 7163 7164 validateStatus: function validateStatus(status) { 7165 return status >= 200 && status < 300; 7166 } 7167}; 7168 7169defaults.headers = { 7170 common: { 7171 'Accept': 'application/json, text/plain, */*' 7172 } 7173}; 7174 7175utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { 7176 defaults.headers[method] = {}; 7177}); 7178 7179utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { 7180 defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); 7181}); 7182 7183module.exports = defaults; 7184 7185 7186/***/ }), 7187
vendor: 503 bytes, lines 7188-7209
7188/***/ "./node_modules/axios/lib/helpers/bind.js": 7189/*!************************************************!*\ 7190 !*** ./node_modules/axios/lib/helpers/bind.js ***! 7191 \************************************************/ 7192/***/ ((module) => { 7193 7194"use strict"; 7195 7196 7197module.exports = function bind(fn, thisArg) { 7198 return function wrap() { 7199 var args = new Array(arguments.length); 7200 for (var i = 0; i < args.length; i++) { 7201 args[i] = arguments[i]; 7202 } 7203 return fn.apply(thisArg, args); 7204 }; 7205}; 7206 7207 7208/***/ }), 7209
vendor: 2,007 bytes, lines 7210-7290
7210/***/ "./node_modules/axios/lib/helpers/buildURL.js": 7211/*!****************************************************!*\ 7212 !*** ./node_modules/axios/lib/helpers/buildURL.js ***! 7213 \****************************************************/ 7214/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 7215 7216"use strict"; 7217 7218 7219var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 7220 7221function encode(val) { 7222 return encodeURIComponent(val). 7223 replace(/%3A/gi, ':'). 7224 replace(/%24/g, '$'). 7225 replace(/%2C/gi, ','). 7226 replace(/%20/g, '+'). 7227 replace(/%5B/gi, '['). 7228 replace(/%5D/gi, ']'); 7229} 7230 7231/** 7232 * Build a URL by appending params to the end 7233 * 7234 * @param {string} url The base of the url (e.g., http://www.google.com) 7235 * @param {object} [params] The params to be appended 7236 * @returns {string} The formatted url 7237 */ 7238module.exports = function buildURL(url, params, paramsSerializer) { 7239 /*eslint no-param-reassign:0*/ 7240 if (!params) { 7241 return url; 7242 } 7243 7244 var serializedParams; 7245 if (paramsSerializer) { 7246 serializedParams = paramsSerializer(params); 7247 } else if (utils.isURLSearchParams(params)) { 7248 serializedParams = params.toString(); 7249 } else { 7250 var parts = []; 7251 7252 utils.forEach(params, function serialize(val, key) { 7253 if (val === null || typeof val === 'undefined') { 7254 return; 7255 } 7256 7257 if (utils.isArray(val)) { 7258 key = key + '[]'; 7259 } else { 7260 val = [val]; 7261 } 7262 7263 utils.forEach(val, function parseValue(v) { 7264 if (utils.isDate(v)) { 7265 v = v.toISOString(); 7266 } else if (utils.isObject(v)) { 7267 v = JSON.stringify(v); 7268 } 7269 parts.push(encode(key) + '=' + encode(v)); 7270 }); 7271 }); 7272 7273 serializedParams = parts.join('&'); 7274 } 7275 7276 if (serializedParams) { 7277 var hashmarkIndex = url.indexOf('#'); 7278 if (hashmarkIndex !== -1) { 7279 url = url.slice(0, hashmarkIndex); 7280 } 7281 7282 url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; 7283 } 7284 7285 return url; 7286}; 7287 7288 7289/***/ }), 7290
vendor: 655 bytes, lines 7291-7315
7291/***/ "./node_modules/axios/lib/helpers/combineURLs.js": 7292/*!*******************************************************!*\ 7293 !*** ./node_modules/axios/lib/helpers/combineURLs.js ***! 7294 \*******************************************************/ 7295/***/ ((module) => { 7296 7297"use strict"; 7298 7299 7300/** 7301 * Creates a new URL by combining the specified URLs 7302 * 7303 * @param {string} baseURL The base URL 7304 * @param {string} relativeURL The relative URL 7305 * @returns {string} The combined URL 7306 */ 7307module.exports = function combineURLs(baseURL, relativeURL) { 7308 return relativeURL 7309 ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') 7310 : baseURL; 7311}; 7312 7313 7314/***/ }), 7315
vendor: 1,794 bytes, lines 7316-7379
7316/***/ "./node_modules/axios/lib/helpers/cookies.js": 7317/*!***************************************************!*\ 7318 !*** ./node_modules/axios/lib/helpers/cookies.js ***! 7319 \***************************************************/ 7320/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 7321 7322"use strict"; 7323 7324 7325var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 7326 7327module.exports = ( 7328 utils.isStandardBrowserEnv() ? 7329 7330 // Standard browser envs support document.cookie 7331 (function standardBrowserEnv() { 7332 return { 7333 write: function write(name, value, expires, path, domain, secure) { 7334 var cookie = []; 7335 cookie.push(name + '=' + encodeURIComponent(value)); 7336 7337 if (utils.isNumber(expires)) { 7338 cookie.push('expires=' + new Date(expires).toGMTString()); 7339 } 7340 7341 if (utils.isString(path)) { 7342 cookie.push('path=' + path); 7343 } 7344 7345 if (utils.isString(domain)) { 7346 cookie.push('domain=' + domain); 7347 } 7348 7349 if (secure === true) { 7350 cookie.push('secure'); 7351 } 7352 7353 document.cookie = cookie.join('; '); 7354 }, 7355 7356 read: function read(name) { 7357 var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); 7358 return (match ? decodeURIComponent(match[3]) : null); 7359 }, 7360 7361 remove: function remove(name) { 7362 this.write(name, '', Date.now() - 86400000); 7363 } 7364 }; 7365 })() : 7366 7367 // Non standard browser env (web workers, react-native) lack needed support. 7368 (function nonStandardBrowserEnv() { 7369 return { 7370 write: function write() {}, 7371 read: function read() { return null; }, 7372 remove: function remove() {} 7373 }; 7374 })() 7375); 7376 7377 7378/***/ }), 7379
vendor: 846 bytes, lines 7380-7404
7380/***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js": 7381/*!*********************************************************!*\ 7382 !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***! 7383 \*********************************************************/ 7384/***/ ((module) => { 7385 7386"use strict"; 7387 7388 7389/** 7390 * Determines whether the specified URL is absolute 7391 * 7392 * @param {string} url The URL to test 7393 * @returns {boolean} True if the specified URL is absolute, otherwise false 7394 */ 7395module.exports = function isAbsoluteURL(url) { 7396 // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL). 7397 // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed 7398 // by any combination of letters, digits, plus, period, or hyphen. 7399 return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); 7400}; 7401 7402 7403/***/ }), 7404
vendor: 2,696 bytes, lines 7405-7483
7405/***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js": 7406/*!***********************************************************!*\ 7407 !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***! 7408 \***********************************************************/ 7409/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 7410 7411"use strict"; 7412 7413 7414var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 7415 7416module.exports = ( 7417 utils.isStandardBrowserEnv() ? 7418 7419 // Standard browser envs have full support of the APIs needed to test 7420 // whether the request URL is of the same origin as current location. 7421 (function standardBrowserEnv() { 7422 var msie = /(msie|trident)/i.test(navigator.userAgent); 7423 var urlParsingNode = document.createElement('a'); 7424 var originURL; 7425 7426 /** 7427 * Parse a URL to discover it's components 7428 * 7429 * @param {String} url The URL to be parsed 7430 * @returns {Object} 7431 */ 7432 function resolveURL(url) { 7433 var href = url; 7434 7435 if (msie) { 7436 // IE needs attribute set twice to normalize properties 7437 urlParsingNode.setAttribute('href', href); 7438 href = urlParsingNode.href; 7439 } 7440 7441 urlParsingNode.setAttribute('href', href); 7442 7443 // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils 7444 return { 7445 href: urlParsingNode.href, 7446 protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', 7447 host: urlParsingNode.host, 7448 search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', 7449 hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', 7450 hostname: urlParsingNode.hostname, 7451 port: urlParsingNode.port, 7452 pathname: (urlParsingNode.pathname.charAt(0) === '/') ? 7453 urlParsingNode.pathname : 7454 '/' + urlParsingNode.pathname 7455 }; 7456 } 7457 7458 originURL = resolveURL(window.location.href); 7459 7460 /** 7461 * Determine if a URL shares the same origin as the current location 7462 * 7463 * @param {String} requestURL The URL to test 7464 * @returns {boolean} True if URL shares the same origin, otherwise false 7465 */ 7466 return function isURLSameOrigin(requestURL) { 7467 var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; 7468 return (parsed.protocol === originURL.protocol && 7469 parsed.host === originURL.host); 7470 }; 7471 })() : 7472 7473 // Non standard browser envs (web workers, react-native) lack needed support. 7474 (function nonStandardBrowserEnv() { 7475 return function isURLSameOrigin() { 7476 return true; 7477 }; 7478 })() 7479); 7480 7481 7482/***/ }), 7483
vendor: 764 bytes, lines 7484-7506
7484/***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js": 7485/*!***************************************************************!*\ 7486 !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***! 7487 \***************************************************************/ 7488/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 7489 7490"use strict"; 7491 7492 7493var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js"); 7494 7495module.exports = function normalizeHeaderName(headers, normalizedName) { 7496 utils.forEach(headers, function processHeader(value, name) { 7497 if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { 7498 headers[normalizedName] = value; 7499 delete headers[name]; 7500 } 7501 }); 7502}; 7503 7504 7505/***/ }), 7506
vendor: 1,772 bytes, lines 7507-7570
7507/***/ "./node_modules/axios/lib/helpers/parseHeaders.js": 7508/*!********************************************************!*\ 7509 !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***! 7510 \********************************************************/ 7511/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 7512 7513"use strict"; 7514 7515 7516var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 7517 7518// Headers whose duplicates are ignored by node 7519// c.f. https://nodejs.org/api/http.html#http_message_headers 7520var ignoreDuplicateOf = [ 7521 'age', 'authorization', 'content-length', 'content-type', 'etag', 7522 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 7523 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 7524 'referer', 'retry-after', 'user-agent' 7525]; 7526 7527/** 7528 * Parse headers into an object 7529 * 7530 * ``` 7531 * Date: Wed, 27 Aug 2014 08:58:49 GMT 7532 * Content-Type: application/json 7533 * Connection: keep-alive 7534 * Transfer-Encoding: chunked 7535 * ``` 7536 * 7537 * @param {String} headers Headers needing to be parsed 7538 * @returns {Object} Headers parsed into an object 7539 */ 7540module.exports = function parseHeaders(headers) { 7541 var parsed = {}; 7542 var key; 7543 var val; 7544 var i; 7545 7546 if (!headers) { return parsed; } 7547 7548 utils.forEach(headers.split('\n'), function parser(line) { 7549 i = line.indexOf(':'); 7550 key = utils.trim(line.substr(0, i)).toLowerCase(); 7551 val = utils.trim(line.substr(i + 1)); 7552 7553 if (key) { 7554 if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { 7555 return; 7556 } 7557 if (key === 'set-cookie') { 7558 parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); 7559 } else { 7560 parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; 7561 } 7562 } 7563 }); 7564 7565 return parsed; 7566}; 7567 7568 7569/***/ }), 7570
vendor: 819 bytes, lines 7571-7608
7571/***/ "./node_modules/axios/lib/helpers/spread.js": 7572/*!**************************************************!*\ 7573 !*** ./node_modules/axios/lib/helpers/spread.js ***! 7574 \**************************************************/ 7575/***/ ((module) => { 7576 7577"use strict"; 7578 7579 7580/** 7581 * Syntactic sugar for invoking a function and expanding an array for arguments. 7582 * 7583 * Common use case would be to use `Function.prototype.apply`. 7584 * 7585 * ```js 7586 * function f(x, y, z) {} 7587 * var args = [1, 2, 3]; 7588 * f.apply(null, args); 7589 * ``` 7590 * 7591 * With `spread` this example can be re-written. 7592 * 7593 * ```js 7594 * spread(function(x, y, z) {})([1, 2, 3]); 7595 * ``` 7596 * 7597 * @param {Function} callback 7598 * @returns {Function} 7599 */ 7600module.exports = function spread(callback) { 7601 return function wrap(arr) { 7602 return callback.apply(null, arr); 7603 }; 7604}; 7605 7606 7607/***/ }), 7608
vendor: 26,817 bytes, lines 7609-8270
7609/***/ "./node_modules/axios/lib/utils.js": 7610/*!*****************************************!*\ 7611 !*** ./node_modules/axios/lib/utils.js ***! 7612 \*****************************************/ 7613/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 7614 7615"use strict"; 7616 7617 7618var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js"); 7619 7620/*global toString:true*/ 7621 7622// utils is a library of generic helper functions non-specific to axios 7623 7624var toString = Object.prototype.toString; 7625 7626/** 7627 * Determine if a value is an Array 7628 * 7629 * @param {Object} val The value to test 7630 * @returns {boolean} True if value is an Array, otherwise false 7631 */ 7632function isArray(val) { 7633 return toString.call(val) === '[object Array]'; 7634} 7635 7636/** 7637 * Determine if a value is undefined 7638 * 7639 * @param {Object} val The value to test 7640 * @returns {boolean} True if the value is undefined, otherwise false 7641 */ 7642function isUndefined(val) { 7643 return typeof val === 'undefined'; 7644} 7645 7646/** 7647 * Determine if a value is a Buffer 7648 * 7649 * @param {Object} val The value to test 7650 * @returns {boolean} True if value is a Buffer, otherwise false 7651 */ 7652function isBuffer(val) { 7653 return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) 7654 && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val); 7655} 7656 7657/** 7658 * Determine if a value is an ArrayBuffer 7659 * 7660 * @param {Object} val The value to test 7661 * @returns {boolean} True if value is an ArrayBuffer, otherwise false 7662 */ 7663function isArrayBuffer(val) { 7664 return toString.call(val) === '[object ArrayBuffer]'; 7665} 7666 7667/** 7668 * Determine if a value is a FormData 7669 * 7670 * @param {Object} val The value to test 7671 * @returns {boolean} True if value is an FormData, otherwise false 7672 */ 7673function isFormData(val) { 7674 return (typeof FormData !== 'undefined') && (val instanceof FormData); 7675} 7676 7677/** 7678 * Determine if a value is a view on an ArrayBuffer 7679 * 7680 * @param {Object} val The value to test 7681 * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false 7682 */ 7683function isArrayBufferView(val) { 7684 var result; 7685 if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { 7686 result = ArrayBuffer.isView(val); 7687 } else { 7688 result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); 7689 } 7690 return result; 7691} 7692 7693/** 7694 * Determine if a value is a String 7695 * 7696 * @param {Object} val The value to test 7697 * @returns {boolean} True if value is a String, otherwise false 7698 */ 7699function isString(val) { 7700 return typeof val === 'string'; 7701} 7702 7703/** 7704 * Determine if a value is a Number 7705 * 7706 * @param {Object} val The value to test 7707 * @returns {boolean} True if value is a Number, otherwise false 7708 */ 7709function isNumber(val) { 7710 return typeof val === 'number'; 7711} 7712 7713/** 7714 * Determine if a value is an Object 7715 * 7716 * @param {Object} val The value to test 7717 * @returns {boolean} True if value is an Object, otherwise false 7718 */ 7719function isObject(val) { 7720 return val !== null && typeof val === 'object'; 7721} 7722 7723/** 7724 * Determine if a value is a plain Object 7725 * 7726 * @param {Object} val The value to test 7727 * @return {boolean} True if value is a plain Object, otherwise false 7728 */ 7729function isPlainObject(val) { 7730 if (toString.call(val) !== '[object Object]') { 7731 return false; 7732 } 7733 7734 var prototype = Object.getPrototypeOf(val); 7735 return prototype === null || prototype === Object.prototype; 7736} 7737 7738/** 7739 * Determine if a value is a Date 7740 * 7741 * @param {Object} val The value to test 7742 * @returns {boolean} True if value is a Date, otherwise false 7743 */ 7744function isDate(val) { 7745 return toString.call(val) === '[object Date]'; 7746} 7747 7748/** 7749 * Determine if a value is a File 7750 * 7751 * @param {Object} val The value to test 7752 * @returns {boolean} True if value is a File, otherwise false 7753 */ 7754function isFile(val) { 7755 return toString.call(val) === '[object File]'; 7756} 7757 7758/** 7759 * Determine if a value is a Blob 7760 * 7761 * @param {Object} val The value to test 7762 * @returns {boolean} True if value is a Blob, otherwise false 7763 */ 7764function isBlob(val) { 7765 return toString.call(val) === '[object Blob]'; 7766} 7767 7768/** 7769 * Determine if a value is a Function 7770 * 7771 * @param {Object} val The value to test 7772 * @returns {boolean} True if value is a Function, otherwise false 7773 */ 7774function isFunction(val) { 7775 return toString.call(val) === '[object Function]'; 7776} 7777 7778/** 7779 * Determine if a value is a Stream 7780 * 7781 * @param {Object} val The value to test 7782 * @returns {boolean} True if value is a Stream, otherwise false 7783 */ 7784function isStream(val) { 7785 return isObject(val) && isFunction(val.pipe); 7786} 7787 7788/** 7789 * Determine if a value is a URLSearchParams object 7790 * 7791 * @param {Object} val The value to test 7792 * @returns {boolean} True if value is a URLSearchParams object, otherwise false 7793 */ 7794function isURLSearchParams(val) { 7795 return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; 7796} 7797 7798/** 7799 * Trim excess whitespace off the beginning and end of a string 7800 * 7801 * @param {String} str The String to trim 7802 * @returns {String} The String freed of excess whitespace 7803 */ 7804function trim(str) { 7805 return str.replace(/^\s*/, '').replace(/\s*$/, ''); 7806} 7807 7808/** 7809 * Determine if we're running in a standard browser environment 7810 * 7811 * This allows axios to run in a web worker, and react-native. 7812 * Both environments support XMLHttpRequest, but not fully standard globals. 7813 * 7814 * web workers: 7815 * typeof window -> undefined 7816 * typeof document -> undefined 7817 * 7818 * react-native: 7819 * navigator.product -> 'ReactNative' 7820 * nativescript 7821 * navigator.product -> 'NativeScript' or 'NS' 7822 */ 7823function isStandardBrowserEnv() { 7824 if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || 7825 navigator.product === 'NativeScript' || 7826 navigator.product === 'NS')) { 7827 return false; 7828 } 7829 return ( 7830 typeof window !== 'undefined' && 7831 typeof document !== 'undefined' 7832 ); 7833} 7834 7835/** 7836 * Iterate over an Array or an Object invoking a function for each item. 7837 * 7838 * If `obj` is an Array callback will be called passing 7839 * the value, index, and complete array for each item. 7840 * 7841 * If 'obj' is an Object callback will be called passing 7842 * the value, key, and complete object for each property. 7843 * 7844 * @param {Object|Array} obj The object to iterate 7845 * @param {Function} fn The callback to invoke for each item 7846 */ 7847function forEach(obj, fn) { 7848 // Don't bother if no value provided 7849 if (obj === null || typeof obj === 'undefined') { 7850 return; 7851 } 7852 7853 // Force an array if not already something iterable 7854 if (typeof obj !== 'object') { 7855 /*eslint no-param-reassign:0*/ 7856 obj = [obj]; 7857 } 7858 7859 if (isArray(obj)) { 7860 // Iterate over array values 7861 for (var i = 0, l = obj.length; i < l; i++) { 7862 fn.call(null, obj[i], i, obj); 7863 } 7864 } else { 7865 // Iterate over object keys 7866 for (var key in obj) { 7867 if (Object.prototype.hasOwnProperty.call(obj, key)) { 7868 fn.call(null, obj[key], key, obj); 7869 } 7870 } 7871 } 7872} 7873 7874/** 7875 * Accepts varargs expecting each argument to be an object, then 7876 * immutably merges the properties of each object and returns result. 7877 * 7878 * When multiple objects contain the same key the later object in 7879 * the arguments list will take precedence. 7880 * 7881 * Example: 7882 * 7883 * ```js 7884 * var result = merge({foo: 123}, {foo: 456}); 7885 * console.log(result.foo); // outputs 456 7886 * ``` 7887 * 7888 * @param {Object} obj1 Object to merge 7889 * @returns {Object} Result of all merge properties 7890 */ 7891function merge(/* obj1, obj2, obj3, ... */) { 7892 var result = {}; 7893 function assignValue(val, key) { 7894 if (isPlainObject(result[key]) && isPlainObject(val)) { 7895 result[key] = merge(result[key], val); 7896 } else if (isPlainObject(val)) { 7897 result[key] = merge({}, val); 7898 } else if (isArray(val)) { 7899 result[key] = val.slice(); 7900 } else { 7901 result[key] = val; 7902 } 7903 } 7904 7905 for (var i = 0, l = arguments.length; i < l; i++) { 7906 forEach(arguments[i], assignValue); 7907 } 7908 return result; 7909} 7910 7911/** 7912 * Extends object a by mutably adding to it the properties of object b. 7913 * 7914 * @param {Object} a The object to be extended 7915 * @param {Object} b The object to copy properties from 7916 * @param {Object} thisArg The object to bind function to 7917 * @return {Object} The resulting value of object a 7918 */ 7919function extend(a, b, thisArg) { 7920 forEach(b, function assignValue(val, key) { 7921 if (thisArg && typeof val === 'function') { 7922 a[key] = bind(val, thisArg); 7923 } else { 7924 a[key] = val; 7925 } 7926 }); 7927 return a; 7928} 7929 7930/** 7931 * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) 7932 * 7933 * @param {string} content with BOM 7934 * @return {string} content value without BOM 7935 */ 7936function stripBOM(content) { 7937 if (content.charCodeAt(0) === 0xFEFF) { 7938 content = content.slice(1); 7939 } 7940 return content; 7941} 7942 7943module.exports = { 7944 isArray: isArray, 7945 isArrayBuffer: isArrayBuffer, 7946 isBuffer: isBuffer, 7947 isFormData: isFormData, 7948 isArrayBufferView: isArrayBufferView, 7949 isString: isString, 7950 isNumber: isNumber, 7951 isObject: isObject, 7952 isPlainObject: isPlainObject, 7953 isUndefined: isUndefined, 7954 isDate: isDate, 7955 isFile: isFile, 7956 isBlob: isBlob, 7957 isFunction: isFunction, 7958 isStream: isStream, 7959 isURLSearchParams: isURLSearchParams, 7960 isStandardBrowserEnv: isStandardBrowserEnv, 7961 forEach: forEach, 7962 merge: merge, 7963 extend: extend, 7964 trim: trim, 7965 stripBOM: stripBOM 7966}; 7967 7968 7969/***/ }), 7970 7971/***/ "./node_modules/css-loader/dist/cjs.js!./js/src/commonSearch.css": 7972/*!***********************************************************************!*\ 7973 !*** ./node_modules/css-loader/dist/cjs.js!./js/src/commonSearch.css ***! 7974 \***********************************************************************/ 7975/***/ ((module, __webpack_exports__, __webpack_require__) => { 7976 7977"use strict"; 7978__webpack_require__.r(__webpack_exports__); 7979/* harmony export */ __webpack_require__.d(__webpack_exports__, { 7980/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 7981/* harmony export */ }); 7982/* harmony import */ var _node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../node_modules/css-loader/dist/runtime/sourceMaps.js */ "./node_modules/css-loader/dist/runtime/sourceMaps.js"); 7983/* harmony import */ var _node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__); 7984/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../node_modules/css-loader/dist/runtime/api.js */ "./node_modules/css-loader/dist/runtime/api.js"); 7985/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__); 7986/* harmony import */ var _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../node_modules/css-loader/dist/runtime/getUrl.js */ "./node_modules/css-loader/dist/runtime/getUrl.js"); 7987/* harmony import */ var _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2__); 7988// Imports 7989 7990 7991 7992var ___CSS_LOADER_URL_IMPORT_0___ = new URL(/* asset import */ __webpack_require__(/*! ../../images/search-cross.png */ "./images/search-cross.png"), __webpack_require__.b); 7993var ___CSS_LOADER_URL_IMPORT_1___ = new URL(/* asset import */ __webpack_require__(/*! ../../assets/images/search-icon.svg */ "./assets/images/search-icon.svg"), __webpack_require__.b); 7994var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default())); 7995var ___CSS_LOADER_URL_REPLACEMENT_0___ = _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2___default()(___CSS_LOADER_URL_IMPORT_0___); 7996var ___CSS_LOADER_URL_REPLACEMENT_1___ = _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2___default()(___CSS_LOADER_URL_IMPORT_1___); 7997// Module 7998___CSS_LOADER_EXPORT___.push([module.id, `.search-icon-react { 7999 cursor: pointer; 8000 line-height: 1; 8001 margin-left: 5px; 8002 margin-right: 5px; 8003 padding-right: 10px; 8004 padding-left: 10px; 8005 position: relative; 8006 margin-top: 15px; 8007} 8008 8009.search-icon-react .search-close-react:after { 8010 width: 20px; 8011 height: 20px; 8012 position: static; 8013 display: inline-block; 8014 background: url(${___CSS_LOADER_URL_REPLACEMENT_0___}) no-repeat center center; 8015 background-size: 18px; 8016 filter: brightness(0) invert(1); 8017} 8018 8019.search-container-react { 8020 position: relative; 8021 display: block; 8022 margin-bottom: 20px; 8023} 8024 8025.search-icon-react svg { 8026 fill: #fff; 8027 margin-left: 30px; 8028} 8029 8030.search-icon-react:hover svg path{ 8031 fill: #eda105 8032} 8033 8034.search-icon-react:hover:before { 8035 position: absolute; 8036 font-family: RobotoRegular, sans-serif; 8037 font-style: normal; 8038 z-index: 1; 8039 color: #ecf2fc; 8040 background-color: #292929; 8041 padding: 5px 10px; 8042 font-size: 0.875rem; 8043 top: 30px; 8044 left: 50%; 8045 transform: translateX(-50%); 8046 border-radius: 2px; 8047 border: 1px solid #6a6a6a; 8048 width: max-content; 8049} 8050 8051.search-icon-react:hover:after { 8052 border-left: solid transparent 4px; 8053 border-right: solid transparent 4px; 8054 border-bottom: solid #6a6a6a 7px; 8055 top: 23px; 8056 height: 0; 8057 left: 50%; 8058 transform: translateX(-50%); 8059 position: absolute; 8060 width: 0; 8061} 8062 8063.search-close-react { 8064 transform: scale(1.5); 8065 width: 20px; 8066 height: 20px; 8067 position: static; 8068 display: inline-block; 8069 /* background: url(../../images/search-cross.png) no-repeat center center; */ 8070 background-size: 18px; 8071 filter: brightness(0) invert(1); 8072} 8073 8074.search-close-react:hover { 8075 8076 filter: none; 8077} 8078 8079.search-form-container-react:after { 8080 /* background: url("./../../images/ic-search.svg") no-repeat; */ 8081 background-size: 15px; 8082 height: 15px; 8083 position: absolute; 8084 top: 12px; 8085 left: 10px; 8086 width: 15px; 8087 z-index: 99; 8088} 8089 8090.search-box-react { 8091 top: -9px; 8092 z-index: 2; 8093 right: 0px; 8094 position: absolute; 8095 width: 44rem; 8096 padding: 0; 8097 display: block !important; 8098} 8099 8100.search-filter-react { 8101 padding: 0; 8102 margin: 0; 8103 height: 60px; 8104 display: flex; 8105} 8106 8107.header-search-box-react { 8108 top: -9px; 8109 z-index: 2; 8110 right: 50px; 8111 position: absolute; 8112 width: 700px; 8113 padding: 0; 8114 display: block !important; 8115} 8116 8117.header-search-filter-react { 8118 padding: 0; 8119 margin: 0; 8120 height: 45px; 8121 display: flex; 8122} 8123 8124.homepage-approvals-search-react { 8125 margin: 0; 8126 display: flex; 8127 width: 100%; 8128} 8129 8130.search-form-container-react { 8131 width: 100%; 8132} 8133 8134.search-list-container-react { 8135 margin: 0; 8136 padding: 0; 8137 position: absolute; 8138 z-index: 98; 8139 background: #fff; 8140 overflow: auto; 8141 -webkit-overflow-scrolling: touch !important; 8142 margin-top: 3px !important; 8143 box-shadow: 2px 10px 19px 0 rgba(95, 94, 95, 0.56); 8144 border-radius: 5px; 8145 min-height: 10vh; 8146 max-height: 42vh; 8147 min-width: 502px; 8148 transition: none; 8149 max-width: calc(100% - 30px); 8150} 8151 8152.search-list-container-react ul { 8153 z-index: 99999999; 8154 background-color: #6AC977; 8155} 8156 8157 8158.search-list-container-react li { 8159 border: none; 8160 display: block; 8161 padding: 12px 20px !important; 8162 cursor: pointer; 8163 font-size: 0.875rem; 8164 line-height: 1.4; 8165 color: black; 8166 -webkit-transition: 0.3s all ease; 8167 transition: 0.3s all ease; 8168 margin: 0 !important; 8169 text-align: left; 8170 width: 533px; 8171 font-family: RobotoRegular, sans-serif; 8172} 8173 8174.search-list-container-react li:hover { 8175 color: #F2943B !important; 8176 background-color: #FEF7EF !important; 8177} 8178 8179.search-list-container-react li.no-data-react { 8180 font-family: RobotoBold, sans-serif; 8181} 8182 8183.search-list-container-react li:last-child { 8184 border-bottom: 0; 8185} 8186 8187.approvals-search-box-react { 8188 border: none; 8189 width: 100%; 8190 height: 100%; 8191 padding-left: 38px; 8192 background-image: url(${___CSS_LOADER_URL_REPLACEMENT_1___}); 8193 background-repeat: no-repeat; 8194 background-position: 10px center; 8195 font-family: KhandRegular, sans-serif; 8196 line-height: 1; 8197 font-size: 1.063rem; 8198} 8199 8200/******Green button********/ 8201/* .button-green-react { 8202 align-items: center; 8203 border-top-right-radius: 2.5px; 8204 border-bottom-right-radius: 2.5px; 8205 background-color: #6AC977; 8206 border: 1px solid #6AC977; 8207 box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.09); 8208 color: #fff; 8209 cursor: pointer; 8210 display: inline-flex; 8211 font-size: 1rem; 8212 justify-content: center; 8213 min-width: 131px; 8214 padding-right: 15px; 8215 padding-left: 15px; 8216 font-family: 'Khand-bold', sans-serif; 8217 text-shadow: 0px 1px 0 #3d9249; 8218 font-weight: bold; 8219 text-transform: uppercase; 8220 text-decoration: none; 8221 -webkit-print-color-adjust: exact; 8222} */ 8223 8224.css-13cymwt-control, .css-t3ipsp-control { 8225 height: 100% !important; 8226 width: max-content; 8227 border-radius: 0 !important; 8228} 8229 8230a:focus-visible,input:focus-visible ,select:focus-visible,button:focus-visible,textarea:focus-visible{ 8231 border: 0px !important; 8232} 8233 8234.button-green-react { 8235 display: inline-flex; 8236 align-items: center; 8237 gap: 10px; 8238 padding: 31px 30px; 8239 background: #16a34a; 8240 color: #ffffff; 8241 text-decoration: none; 8242 border-radius: 0px; 8243 font-weight: 700; 8244 font-size: 14px; 8245 letter-spacing: 0.3px; 8246 text-transform: uppercase; 8247 transition: background 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease; 8248 box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3); 8249} 8250 8251.button-green-react::after { 8252 content: "â"; 8253 transition: transform 0.25s ease; 8254} 8255 8256.button-green-react:hover { 8257 background: #15803d; 8258 transform: translateY(-2px); 8259 box-shadow: 0 8px 20px rgba(22, 163, 74, 0.4); 8260} 8261 8262.button-green-react:hover::after { 8263 transform: translateX(5px); 8264}`, "",{"version":3,"sources":["webpack://./js/src/commonSearch.css"],"names":[],"mappings":"AAAA;IACI,eAAe;IACf,cAAc;IACd,gBAAgB;IAChB,iBAAiB;IACjB,mBAAmB;IACnB,kBAAkB;IAClB,kBAAkB;IAClB,gBAAgB;AACpB;;AAEA;EACE,WAAW;EACX,YAAY;EACZ,gBAAgB;EAChB,qBAAqB;EACrB,2EAAsE;EACtE,qBAAqB;EACrB,+BAA+B;AACjC;;AAEA;IACI,kBAAkB;IAClB,cAAc;IACd,mBAAmB;AACvB;;AAEA;IACI,UAAU;IACV,iBAAiB;AACrB;;AAEA;GACG;AACH;;AAEA;IACI,kBAAkB;IAClB,sCAAsC;IACtC,kBAAkB;IAClB,UAAU;IACV,cAAc;IACd,yBAAyB;IACzB,iBAAiB;IACjB,mBAAmB;IACnB,SAAS;IACT,SAAS;IACT,2BAA2B;IAC3B,kBAAkB;IAClB,yBAAyB;IACzB,kBAAkB;AACtB;;AAEA;IACI,kCAAkC;IAClC,mCAAmC;IACnC,gCAAgC;IAChC,SAAS;IACT,SAAS;IACT,SAAS;IACT,2BAA2B;IAC3B,kBAAkB;IAClB,QAAQ;AACZ;;AAEA;EACE,qBAAqB;EACrB,WAAW;EACX,YAAY;EACZ,gBAAgB;EAChB,qBAAqB;EACrB,4EAA4E;EAC5E,qBAAqB;EACrB,+BAA+B;AACjC;;AAEA;;IAEI,YAAY;AAChB;;AAEA;IACI,+DAA+D;IAC/D,qBAAqB;IACrB,YAAY;IACZ,kBAAkB;IAClB,SAAS;IACT,UAAU;IACV,WAAW;IACX,WAAW;AACf;;AAEA;IACI,SAAS;IACT,UAAU;IACV,UAAU;IACV,kBAAkB;IAClB,YAAY;IACZ,UAAU;IACV,yBAAyB;AAC7B;;AAEA;IACI,UAAU;IACV,SAAS;IACT,YAAY;IACZ,aAAa;AACjB;;AAEA;IACI,SAAS;IACT,UAAU;IACV,WAAW;IACX,kBAAkB;IAClB,YAAY;IACZ,UAAU;IACV,yBAAyB;AAC7B;;AAEA;IACI,UAAU;IACV,SAAS;IACT,YAAY;IACZ,aAAa;AACjB;;AAEA;IACI,SAAS;IACT,aAAa;IACb,WAAW;AACf;;AAEA;IACI,WAAW;AACf;;AAEA;EACE,SAAS;EACT,UAAU;EACV,kBAAkB;EAClB,WAAW;EACX,gBAAgB;EAChB,cAAc;EACd,4CAA4C;EAC5C,0BAA0B;EAC1B,kDAAkD;EAClD,kBAAkB;EAClB,gBAAgB;EAChB,gBAAgB;EAChB,gBAAgB;EAChB,gBAAgB;EAChB,4BAA4B;AAC9B;;AAEA;IACI,iBAAiB;IACjB,yBAAyB;AAC7B;;;AAGA;IACI,YAAY;IACZ,cAAc;IACd,6BAA6B;IAC7B,eAAe;IACf,mBAAmB;IACnB,gBAAgB;IAChB,YAAY;IACZ,iCAAiC;IACjC,yBAAyB;IACzB,oBAAoB;IACpB,gBAAgB;IAChB,YAAY;IACZ,sCAAsC;AAC1C;;AAEA;IACI,yBAAyB;IACzB,oCAAoC;AACxC;;AAEA;IACI,mCAAmC;AACvC;;AAEA;IACI,gBAAgB;AACpB;;AAEA;IACI,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,kBAAkB;IAClB,yDAA4D;IAC5D,4BAA4B;IAC5B,gCAAgC;IAChC,qCAAqC;IACrC,cAAc;IACd,mBAAmB;AACvB;;AAEA,2BAA2B;AAC3B;;;;;;;;;;;;;;;;;;;;;GAqBG;;AAEH;IACI,uBAAuB;IACvB,kBAAkB;IAClB,2BAA2B;AAC/B;;AAEA;EACE,sBAAsB;AACxB;;AAEA;EACE,oBAAoB;EACpB,mBAAmB;EACnB,SAAS;EACT,kBAAkB;EAClB,mBAAmB;EACnB,cAAc;EACd,qBAAqB;EACrB,kBAAkB;EAClB,gBAAgB;EAChB,eAAe;EACf,qBAAqB;EACrB,yBAAyB;EACzB,6EAA6E;EAC7E,6CAA6C;AAC/C;;AAEA;EACE,YAAY;EACZ,gCAAgC;AAClC;;AAEA;EACE,mBAAmB;EACnB,2BAA2B;EAC3B,6CAA6C;AAC/C;;AAEA;EACE,0BAA0B;AAC5B","sourcesContent":[".search-icon-react {\r\n cursor: pointer;\r\n line-height: 1;\r\n margin-left: 5px;\r\n margin-right: 5px;\r\n padding-right: 10px;\r\n padding-left: 10px;\r\n position: relative;\r\n margin-top: 15px;\r\n}\r\n\r\n.search-icon-react .search-close-react:after {\r\n width: 20px;\r\n height: 20px;\r\n position: static;\r\n display: inline-block;\r\n background: url(../../images/search-cross.png) no-repeat center center;\r\n background-size: 18px;\r\n filter: brightness(0) invert(1);\r\n}\r\n\r\n.search-container-react {\r\n position: relative;\r\n display: block;\r\n margin-bottom: 20px;\r\n}\r\n\r\n.search-icon-react svg {\r\n fill: #fff;\r\n margin-left: 30px;\r\n}\r\n\r\n.search-icon-react:hover svg path{\r\n fill: #eda105\r\n}\r\n\r\n.search-icon-react:hover:before {\r\n position: absolute;\r\n font-family: RobotoRegular, sans-serif;\r\n font-style: normal;\r\n z-index: 1;\r\n color: #ecf2fc;\r\n background-color: #292929;\r\n padding: 5px 10px;\r\n font-size: 0.875rem;\r\n top: 30px;\r\n left: 50%;\r\n transform: translateX(-50%);\r\n border-radius: 2px;\r\n border: 1px solid #6a6a6a;\r\n width: max-content;\r\n}\r\n\r\n.search-icon-react:hover:after {\r\n border-left: solid transparent 4px;\r\n border-right: solid transparent 4px;\r\n border-bottom: solid #6a6a6a 7px;\r\n top: 23px;\r\n height: 0;\r\n left: 50%;\r\n transform: translateX(-50%);\r\n position: absolute;\r\n width: 0;\r\n}\r\n\r\n.search-close-react {\r\n transform: scale(1.5);\r\n width: 20px;\r\n height: 20px;\r\n position: static;\r\n display: inline-block;\r\n /* background: url(../../images/search-cross.png) no-repeat center center; */\r\n background-size: 18px;\r\n filter: brightness(0) invert(1);\r\n}\r\n\r\n.search-close-react:hover {\r\n \r\n filter: none;\r\n}\r\n\r\n.search-form-container-react:after {\r\n /* background: url(\"./../../images/ic-search.svg\") no-repeat; */\r\n background-size: 15px;\r\n height: 15px;\r\n position: absolute;\r\n top: 12px;\r\n left: 10px;\r\n width: 15px;\r\n z-index: 99;\r\n}\r\n\r\n.search-box-react {\r\n top: -9px;\r\n z-index: 2;\r\n right: 0px;\r\n position: absolute;\r\n width: 44rem;\r\n padding: 0;\r\n display: block !important;\r\n}\r\n\r\n.search-filter-react {\r\n padding: 0;\r\n margin: 0;\r\n height: 60px;\r\n display: flex;\r\n}\r\n\r\n.header-search-box-react {\r\n top: -9px;\r\n z-index: 2;\r\n right: 50px;\r\n position: absolute;\r\n width: 700px;\r\n padding: 0;\r\n display: block !important;\r\n}\r\n\r\n.header-search-filter-react {\r\n padding: 0;\r\n margin: 0;\r\n height: 45px;\r\n display: flex;\r\n}\r\n\r\n.homepage-approvals-search-react {\r\n margin: 0;\r\n display: flex;\r\n width: 100%;\r\n}\r\n\r\n.search-form-container-react {\r\n width: 100%;\r\n}\r\n\r\n.search-list-container-react {\r\n margin: 0;\r\n padding: 0;\r\n position: absolute;\r\n z-index: 98;\r\n background: #fff;\r\n overflow: auto;\r\n -webkit-overflow-scrolling: touch !important;\r\n margin-top: 3px !important;\r\n box-shadow: 2px 10px 19px 0 rgba(95, 94, 95, 0.56);\r\n border-radius: 5px;\r\n min-height: 10vh;\r\n max-height: 42vh;\r\n min-width: 502px;\r\n transition: none;\r\n max-width: calc(100% - 30px);\r\n}\r\n\r\n.search-list-container-react ul {\r\n z-index: 99999999;\r\n background-color: #6AC977;\r\n}\r\n\r\n\r\n.search-list-container-react li {\r\n border: none;\r\n display: block;\r\n padding: 12px 20px !important;\r\n cursor: pointer;\r\n font-size: 0.875rem;\r\n line-height: 1.4;\r\n color: black;\r\n -webkit-transition: 0.3s all ease;\r\n transition: 0.3s all ease;\r\n margin: 0 !important;\r\n text-align: left;\r\n width: 533px;\r\n font-family: RobotoRegular, sans-serif;\r\n}\r\n\r\n.search-list-container-react li:hover {\r\n color: #F2943B !important;\r\n background-color: #FEF7EF !important;\r\n}\r\n\r\n.search-list-container-react li.no-data-react {\r\n font-family: RobotoBold, sans-serif;\r\n}\r\n\r\n.search-list-container-react li:last-child {\r\n border-bottom: 0;\r\n}\r\n\r\n.approvals-search-box-react {\r\n border: none;\r\n width: 100%;\r\n height: 100%;\r\n padding-left: 38px;\r\n background-image: url(\"../../assets/images/search-icon.svg\");\r\n background-repeat: no-repeat;\r\n background-position: 10px center;\r\n font-family: KhandRegular, sans-serif;\r\n line-height: 1;\r\n font-size: 1.063rem;\r\n}\r\n\r\n/******Green button********/\r\n/* .button-green-react {\r\n align-items: center;\r\n border-top-right-radius: 2.5px;\r\n border-bottom-right-radius: 2.5px;\r\n background-color: #6AC977;\r\n border: 1px solid #6AC977;\r\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.09);\r\n color: #fff;\r\n cursor: pointer;\r\n display: inline-flex;\r\n font-size: 1rem;\r\n justify-content: center;\r\n min-width: 131px;\r\n padding-right: 15px;\r\n padding-left: 15px;\r\n font-family: 'Khand-bold', sans-serif;\r\n text-shadow: 0px 1px 0 #3d9249;\r\n font-weight: bold;\r\n text-transform: uppercase;\r\n text-decoration: none;\r\n -webkit-print-color-adjust: exact;\r\n} */\r\n\r\n.css-13cymwt-control, .css-t3ipsp-control {\r\n height: 100% !important;\r\n width: max-content;\r\n border-radius: 0 !important;\r\n}\r\n\r\na:focus-visible,input:focus-visible ,select:focus-visible,button:focus-visible,textarea:focus-visible{\r\n border: 0px !important;\r\n} \r\n\r\n.button-green-react {\r\n display: inline-flex;\r\n align-items: center;\r\n gap: 10px;\r\n padding: 31px 30px;\r\n background: #16a34a;\r\n color: #ffffff;\r\n text-decoration: none;\r\n border-radius: 0px;\r\n font-weight: 700;\r\n font-size: 14px;\r\n letter-spacing: 0.3px;\r\n text-transform: uppercase;\r\n transition: background 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;\r\n box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);\r\n}\r\n\r\n.button-green-react::after {\r\n content: \"â\";\r\n transition: transform 0.25s ease;\r\n}\r\n\r\n.button-green-react:hover {\r\n background: #15803d;\r\n transform: translateY(-2px);\r\n box-shadow: 0 8px 20px rgba(22, 163, 74, 0.4);\r\n}\r\n\r\n.button-green-react:hover::after {\r\n transform: translateX(5px);\r\n}"],"sourceRoot":""}]); 8265// Exports 8266/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___); 8267 8268 8269/***/ }), 8270
vendor: 2,570 bytes, lines 8271-8365
8271/***/ "./node_modules/css-loader/dist/runtime/api.js": 8272/*!*****************************************************!*\ 8273 !*** ./node_modules/css-loader/dist/runtime/api.js ***! 8274 \*****************************************************/ 8275/***/ ((module) => { 8276 8277"use strict"; 8278 8279 8280/* 8281 MIT License http://www.opensource.org/licenses/mit-license.php 8282 Author Tobias Koppers @sokra 8283*/ 8284module.exports = function (cssWithMappingToString) { 8285 var list = []; 8286 8287 // return the list of modules as css string 8288 list.toString = function toString() { 8289 return this.map(function (item) { 8290 var content = ""; 8291 var needLayer = typeof item[5] !== "undefined"; 8292 if (item[4]) { 8293 content += "@supports (".concat(item[4], ") {"); 8294 } 8295 if (item[2]) { 8296 content += "@media ".concat(item[2], " {"); 8297 } 8298 if (needLayer) { 8299 content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {"); 8300 } 8301 content += cssWithMappingToString(item); 8302 if (needLayer) { 8303 content += "}"; 8304 } 8305 if (item[2]) { 8306 content += "}"; 8307 } 8308 if (item[4]) { 8309 content += "}"; 8310 } 8311 return content; 8312 }).join(""); 8313 }; 8314 8315 // import a list of modules into the list 8316 list.i = function i(modules, media, dedupe, supports, layer) { 8317 if (typeof modules === "string") { 8318 modules = [[null, modules, undefined]]; 8319 } 8320 var alreadyImportedModules = {}; 8321 if (dedupe) { 8322 for (var k = 0; k < this.length; k++) { 8323 var id = this[k][0]; 8324 if (id != null) { 8325 alreadyImportedModules[id] = true; 8326 } 8327 } 8328 } 8329 for (var _k = 0; _k < modules.length; _k++) { 8330 var item = [].concat(modules[_k]); 8331 if (dedupe && alreadyImportedModules[item[0]]) { 8332 continue; 8333 } 8334 if (typeof layer !== "undefined") { 8335 if (typeof item[5] === "undefined") { 8336 item[5] = layer; 8337 } else { 8338 item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}"); 8339 item[5] = layer; 8340 } 8341 } 8342 if (media) { 8343 if (!item[2]) { 8344 item[2] = media; 8345 } else { 8346 item[1] = "@media ".concat(item[2], " {").concat(item[1], "}"); 8347 item[2] = media; 8348 } 8349 } 8350 if (supports) { 8351 if (!item[4]) { 8352 item[4] = "".concat(supports); 8353 } else { 8354 item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}"); 8355 item[4] = supports; 8356 } 8357 } 8358 list.push(item); 8359 } 8360 }; 8361 return list; 8362}; 8363 8364/***/ }), 8365
vendor: 876 bytes, lines 8366-8401
8366/***/ "./node_modules/css-loader/dist/runtime/getUrl.js": 8367/*!********************************************************!*\ 8368 !*** ./node_modules/css-loader/dist/runtime/getUrl.js ***! 8369 \********************************************************/ 8370/***/ ((module) => { 8371 8372"use strict"; 8373 8374 8375module.exports = function (url, options) { 8376 if (!options) { 8377 options = {}; 8378 } 8379 if (!url) { 8380 return url; 8381 } 8382 url = String(url.__esModule ? url.default : url); 8383 8384 // If url is already wrapped in quotes, remove them 8385 if (/^['"].*['"]$/.test(url)) { 8386 url = url.slice(1, -1); 8387 } 8388 if (options.hash) { 8389 url += options.hash; 8390 } 8391 8392 // Should url be wrapped? 8393 // See https://drafts.csswg.org/css-values-3/#urls 8394 if (/["'() \t\n]|(%20)/.test(url) || options.needQuotes) { 8395 return "\"".concat(url.replace(/"/g, '\\"').replace(/\n/g, "\\n"), "\""); 8396 } 8397 return url; 8398}; 8399 8400/***/ }), 8401
vendor: 800 bytes, lines 8402-8427
8402/***/ "./node_modules/css-loader/dist/runtime/sourceMaps.js": 8403/*!************************************************************!*\ 8404 !*** ./node_modules/css-loader/dist/runtime/sourceMaps.js ***! 8405 \************************************************************/ 8406/***/ ((module) => { 8407 8408"use strict"; 8409 8410 8411module.exports = function (item) { 8412 var content = item[1]; 8413 var cssMapping = item[3]; 8414 if (!cssMapping) { 8415 return content; 8416 } 8417 if (typeof btoa === "function") { 8418 var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping)))); 8419 var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64); 8420 var sourceMapping = "/*# ".concat(data, " */"); 8421 return [content].concat([sourceMapping]).join("\n"); 8422 } 8423 return [content].join("\n"); 8424}; 8425 8426/***/ }), 8427
vendor: 3,225 bytes, lines 8428-8541
8428/***/ "./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js": 8429/*!**********************************************************************************!*\ 8430 !*** ./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js ***! 8431 \**********************************************************************************/ 8432/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 8433 8434"use strict"; 8435 8436 8437var reactIs = __webpack_require__(/*! react-is */ "./node_modules/react-is/index.js"); 8438 8439/** 8440 * Copyright 2015, Yahoo! Inc. 8441 * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. 8442 */ 8443var REACT_STATICS = { 8444 childContextTypes: true, 8445 contextType: true, 8446 contextTypes: true, 8447 defaultProps: true, 8448 displayName: true, 8449 getDefaultProps: true, 8450 getDerivedStateFromError: true, 8451 getDerivedStateFromProps: true, 8452 mixins: true, 8453 propTypes: true, 8454 type: true 8455}; 8456var KNOWN_STATICS = { 8457 name: true, 8458 length: true, 8459 prototype: true, 8460 caller: true, 8461 callee: true, 8462 arguments: true, 8463 arity: true 8464}; 8465var FORWARD_REF_STATICS = { 8466 '$$typeof': true, 8467 render: true, 8468 defaultProps: true, 8469 displayName: true, 8470 propTypes: true 8471}; 8472var MEMO_STATICS = { 8473 '$$typeof': true, 8474 compare: true, 8475 defaultProps: true, 8476 displayName: true, 8477 propTypes: true, 8478 type: true 8479}; 8480var TYPE_STATICS = {}; 8481TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS; 8482TYPE_STATICS[reactIs.Memo] = MEMO_STATICS; 8483 8484function getStatics(component) { 8485 // React v16.11 and below 8486 if (reactIs.isMemo(component)) { 8487 return MEMO_STATICS; 8488 } // React v16.12 and above 8489 8490 8491 return TYPE_STATICS[component['$$typeof']] || REACT_STATICS; 8492} 8493 8494var defineProperty = Object.defineProperty; 8495var getOwnPropertyNames = Object.getOwnPropertyNames; 8496var getOwnPropertySymbols = Object.getOwnPropertySymbols; 8497var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; 8498var getPrototypeOf = Object.getPrototypeOf; 8499var objectPrototype = Object.prototype; 8500function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { 8501 if (typeof sourceComponent !== 'string') { 8502 // don't hoist over string (html) components 8503 if (objectPrototype) { 8504 var inheritedComponent = getPrototypeOf(sourceComponent); 8505 8506 if (inheritedComponent && inheritedComponent !== objectPrototype) { 8507 hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); 8508 } 8509 } 8510 8511 var keys = getOwnPropertyNames(sourceComponent); 8512 8513 if (getOwnPropertySymbols) { 8514 keys = keys.concat(getOwnPropertySymbols(sourceComponent)); 8515 } 8516 8517 var targetStatics = getStatics(targetComponent); 8518 var sourceStatics = getStatics(sourceComponent); 8519 8520 for (var i = 0; i < keys.length; ++i) { 8521 var key = keys[i]; 8522 8523 if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) { 8524 var descriptor = getOwnPropertyDescriptor(sourceComponent, key); 8525 8526 try { 8527 // Avoid failures from read-only properties 8528 defineProperty(targetComponent, key, descriptor); 8529 } catch (e) {} 8530 } 8531 } 8532 } 8533 8534 return targetComponent; 8535} 8536 8537module.exports = hoistNonReactStatics; 8538 8539 8540/***/ }), 8541
vendor: 544,412 bytes, lines 8542-25754
8542/***/ "./node_modules/lodash/lodash.js": 8543/*!***************************************!*\ 8544 !*** ./node_modules/lodash/lodash.js ***! 8545 \***************************************/ 8546/***/ (function(module, exports, __webpack_require__) { 8547 8548/* module decorator */ module = __webpack_require__.nmd(module); 8549var __WEBPACK_AMD_DEFINE_RESULT__;/** 8550 * @license 8551 * Lodash <https://lodash.com/> 8552 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/> 8553 * Released under MIT license <https://lodash.com/license> 8554 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 8555 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 8556 */ 8557;(function() { 8558 8559 /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 8560 var undefined; 8561 8562 /** Used as the semantic version number. */ 8563 var VERSION = '4.17.21'; 8564 8565 /** Used as the size to enable large array optimizations. */ 8566 var LARGE_ARRAY_SIZE = 200; 8567 8568 /** Error message constants. */ 8569 var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', 8570 FUNC_ERROR_TEXT = 'Expected a function', 8571 INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`'; 8572 8573 /** Used to stand-in for `undefined` hash values. */ 8574 var HASH_UNDEFINED = '__lodash_hash_undefined__'; 8575 8576 /** Used as the maximum memoize cache size. */ 8577 var MAX_MEMOIZE_SIZE = 500; 8578 8579 /** Used as the internal argument placeholder. */ 8580 var PLACEHOLDER = '__lodash_placeholder__'; 8581 8582 /** Used to compose bitmasks for cloning. */ 8583 var CLONE_DEEP_FLAG = 1, 8584 CLONE_FLAT_FLAG = 2, 8585 CLONE_SYMBOLS_FLAG = 4; 8586 8587 /** Used to compose bitmasks for value comparisons. */ 8588 var COMPARE_PARTIAL_FLAG = 1, 8589 COMPARE_UNORDERED_FLAG = 2; 8590 8591 /** Used to compose bitmasks for function metadata. */ 8592 var WRAP_BIND_FLAG = 1, 8593 WRAP_BIND_KEY_FLAG = 2, 8594 WRAP_CURRY_BOUND_FLAG = 4, 8595 WRAP_CURRY_FLAG = 8, 8596 WRAP_CURRY_RIGHT_FLAG = 16, 8597 WRAP_PARTIAL_FLAG = 32, 8598 WRAP_PARTIAL_RIGHT_FLAG = 64, 8599 WRAP_ARY_FLAG = 128, 8600 WRAP_REARG_FLAG = 256, 8601 WRAP_FLIP_FLAG = 512; 8602 8603 /** Used as default options for `_.truncate`. */ 8604 var DEFAULT_TRUNC_LENGTH = 30, 8605 DEFAULT_TRUNC_OMISSION = '...'; 8606 8607 /** Used to detect hot functions by number of calls within a span of milliseconds. */ 8608 var HOT_COUNT = 800, 8609 HOT_SPAN = 16; 8610 8611 /** Used to indicate the type of lazy iteratees. */ 8612 var LAZY_FILTER_FLAG = 1, 8613 LAZY_MAP_FLAG = 2, 8614 LAZY_WHILE_FLAG = 3; 8615 8616 /** Used as references for various `Number` constants. */ 8617 var INFINITY = 1 / 0, 8618 MAX_SAFE_INTEGER = 9007199254740991, 8619 MAX_INTEGER = 1.7976931348623157e+308, 8620 NAN = 0 / 0; 8621 8622 /** Used as references for the maximum length and index of an array. */ 8623 var MAX_ARRAY_LENGTH = 4294967295, 8624 MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, 8625 HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; 8626 8627 /** Used to associate wrap methods with their bit flags. */ 8628 var wrapFlags = [ 8629 ['ary', WRAP_ARY_FLAG], 8630 ['bind', WRAP_BIND_FLAG], 8631 ['bindKey', WRAP_BIND_KEY_FLAG], 8632 ['curry', WRAP_CURRY_FLAG], 8633 ['curryRight', WRAP_CURRY_RIGHT_FLAG], 8634 ['flip', WRAP_FLIP_FLAG], 8635 ['partial', WRAP_PARTIAL_FLAG], 8636 ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], 8637 ['rearg', WRAP_REARG_FLAG] 8638 ]; 8639 8640 /** `Object#toString` result references. */ 8641 var argsTag = '[object Arguments]', 8642 arrayTag = '[object Array]', 8643 asyncTag = '[object AsyncFunction]', 8644 boolTag = '[object Boolean]', 8645 dateTag = '[object Date]', 8646 domExcTag = '[object DOMException]', 8647 errorTag = '[object Error]', 8648 funcTag = '[object Function]', 8649 genTag = '[object GeneratorFunction]', 8650 mapTag = '[object Map]', 8651 numberTag = '[object Number]', 8652 nullTag = '[object Null]', 8653 objectTag = '[object Object]', 8654 promiseTag = '[object Promise]', 8655 proxyTag = '[object Proxy]', 8656 regexpTag = '[object RegExp]', 8657 setTag = '[object Set]', 8658 stringTag = '[object String]', 8659 symbolTag = '[object Symbol]', 8660 undefinedTag = '[object Undefined]', 8661 weakMapTag = '[object WeakMap]', 8662 weakSetTag = '[object WeakSet]'; 8663 8664 var arrayBufferTag = '[object ArrayBuffer]', 8665 dataViewTag = '[object DataView]', 8666 float32Tag = '[object Float32Array]', 8667 float64Tag = '[object Float64Array]', 8668 int8Tag = '[object Int8Array]', 8669 int16Tag = '[object Int16Array]', 8670 int32Tag = '[object Int32Array]', 8671 uint8Tag = '[object Uint8Array]', 8672 uint8ClampedTag = '[object Uint8ClampedArray]', 8673 uint16Tag = '[object Uint16Array]', 8674 uint32Tag = '[object Uint32Array]'; 8675 8676 /** Used to match empty string literals in compiled template source. */ 8677 var reEmptyStringLeading = /\b__p \+= '';/g, 8678 reEmptyStringMiddle = /\b(__p \+=) '' \+/g, 8679 reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; 8680 8681 /** Used to match HTML entities and HTML characters. */ 8682 var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, 8683 reUnescapedHtml = /[&<>"']/g, 8684 reHasEscapedHtml = RegExp(reEscapedHtml.source), 8685 reHasUnescapedHtml = RegExp(reUnescapedHtml.source); 8686 8687 /** Used to match template delimiters. */ 8688 var reEscape = /<%-([\s\S]+?)%>/g, 8689 reEvaluate = /<%([\s\S]+?)%>/g, 8690 reInterpolate = /<%=([\s\S]+?)%>/g; 8691 8692 /** Used to match property names within property paths. */ 8693 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, 8694 reIsPlainProp = /^\w*$/, 8695 rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; 8696 8697 /** 8698 * Used to match `RegExp` 8699 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). 8700 */ 8701 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, 8702 reHasRegExpChar = RegExp(reRegExpChar.source); 8703 8704 /** Used to match leading whitespace. */ 8705 var reTrimStart = /^\s+/; 8706 8707 /** Used to match a single whitespace character. */ 8708 var reWhitespace = /\s/; 8709 8710 /** Used to match wrap detail comments. */ 8711 var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, 8712 reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, 8713 reSplitDetails = /,? & /; 8714 8715 /** Used to match words composed of alphanumeric characters. */ 8716 var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; 8717 8718 /** 8719 * Used to validate the `validate` option in `_.template` variable. 8720 * 8721 * Forbids characters which could potentially change the meaning of the function argument definition: 8722 * - "()," (modification of function parameters) 8723 * - "=" (default value) 8724 * - "[]{}" (destructuring of function parameters) 8725 * - "/" (beginning of a comment) 8726 * - whitespace 8727 */ 8728 var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; 8729 8730 /** Used to match backslashes in property paths. */ 8731 var reEscapeChar = /\\(\\)?/g; 8732 8733 /** 8734 * Used to match 8735 * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). 8736 */ 8737 var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; 8738 8739 /** Used to match `RegExp` flags from their coerced string values. */ 8740 var reFlags = /\w*$/; 8741 8742 /** Used to detect bad signed hexadecimal string values. */ 8743 var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; 8744 8745 /** Used to detect binary string values. */ 8746 var reIsBinary = /^0b[01]+$/i; 8747 8748 /** Used to detect host constructors (Safari). */ 8749 var reIsHostCtor = /^\[object .+?Constructor\]$/; 8750 8751 /** Used to detect octal string values. */ 8752 var reIsOctal = /^0o[0-7]+$/i; 8753 8754 /** Used to detect unsigned integer values. */ 8755 var reIsUint = /^(?:0|[1-9]\d*)$/; 8756 8757 /** Used to match Latin Unicode letters (excluding mathematical operators). */ 8758 var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; 8759 8760 /** Used to ensure capturing order of template delimiters. */ 8761 var reNoMatch = /($^)/; 8762 8763 /** Used to match unescaped characters in compiled string literals. */ 8764 var reUnescapedString = /['\n\r\u2028\u2029\\]/g; 8765 8766 /** Used to compose unicode character classes. */ 8767 var rsAstralRange = '\\ud800-\\udfff', 8768 rsComboMarksRange = '\\u0300-\\u036f', 8769 reComboHalfMarksRange = '\\ufe20-\\ufe2f', 8770 rsComboSymbolsRange = '\\u20d0-\\u20ff', 8771 rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, 8772 rsDingbatRange = '\\u2700-\\u27bf', 8773 rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', 8774 rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', 8775 rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', 8776 rsPunctuationRange = '\\u2000-\\u206f', 8777 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', 8778 rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', 8779 rsVarRange = '\\ufe0e\\ufe0f', 8780 rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; 8781 8782 /** Used to compose unicode capture groups. */ 8783 var rsApos = "['\u2019]", 8784 rsAstral = '[' + rsAstralRange + ']', 8785 rsBreak = '[' + rsBreakRange + ']', 8786 rsCombo = '[' + rsComboRange + ']', 8787 rsDigits = '\\d+', 8788 rsDingbat = '[' + rsDingbatRange + ']', 8789 rsLower = '[' + rsLowerRange + ']', 8790 rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', 8791 rsFitz = '\\ud83c[\\udffb-\\udfff]', 8792 rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', 8793 rsNonAstral = '[^' + rsAstralRange + ']', 8794 rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', 8795 rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', 8796 rsUpper = '[' + rsUpperRange + ']', 8797 rsZWJ = '\\u200d'; 8798 8799 /** Used to compose unicode regexes. */ 8800 var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', 8801 rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', 8802 rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', 8803 rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', 8804 reOptMod = rsModifier + '?', 8805 rsOptVar = '[' + rsVarRange + ']?', 8806 rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', 8807 rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', 8808 rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', 8809 rsSeq = rsOptVar + reOptMod + rsOptJoin, 8810 rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, 8811 rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; 8812 8813 /** Used to match apostrophes. */ 8814 var reApos = RegExp(rsApos, 'g'); 8815 8816 /** 8817 * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and 8818 * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). 8819 */ 8820 var reComboMark = RegExp(rsCombo, 'g'); 8821 8822 /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ 8823 var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); 8824 8825 /** Used to match complex or compound words. */ 8826 var reUnicodeWord = RegExp([ 8827 rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', 8828 rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', 8829 rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, 8830 rsUpper + '+' + rsOptContrUpper, 8831 rsOrdUpper, 8832 rsOrdLower, 8833 rsDigits, 8834 rsEmoji 8835 ].join('|'), 'g'); 8836 8837 /** 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/). */ 8838 var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); 8839 8840 /** Used to detect strings that need a more robust regexp to match words. */ 8841 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 ]/; 8842 8843 /** Used to assign default `context` object properties. */ 8844 var contextProps = [ 8845 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', 8846 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', 8847 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', 8848 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', 8849 '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' 8850 ]; 8851 8852 /** Used to make template sourceURLs easier to identify. */ 8853 var templateCounter = -1; 8854 8855 /** Used to identify `toStringTag` values of typed arrays. */ 8856 var typedArrayTags = {}; 8857 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = 8858 typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = 8859 typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = 8860 typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = 8861 typedArrayTags[uint32Tag] = true; 8862 typedArrayTags[argsTag] = typedArrayTags[arrayTag] = 8863 typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = 8864 typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = 8865 typedArrayTags[errorTag] = typedArrayTags[funcTag] = 8866 typedArrayTags[mapTag] = typedArrayTags[numberTag] = 8867 typedArrayTags[objectTag] = typedArrayTags[regexpTag] = 8868 typedArrayTags[setTag] = typedArrayTags[stringTag] = 8869 typedArrayTags[weakMapTag] = false; 8870 8871 /** Used to identify `toStringTag` values supported by `_.clone`. */ 8872 var cloneableTags = {}; 8873 cloneableTags[argsTag] = cloneableTags[arrayTag] = 8874 cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = 8875 cloneableTags[boolTag] = cloneableTags[dateTag] = 8876 cloneableTags[float32Tag] = cloneableTags[float64Tag] = 8877 cloneableTags[int8Tag] = cloneableTags[int16Tag] = 8878 cloneableTags[int32Tag] = cloneableTags[mapTag] = 8879 cloneableTags[numberTag] = cloneableTags[objectTag] = 8880 cloneableTags[regexpTag] = cloneableTags[setTag] = 8881 cloneableTags[stringTag] = cloneableTags[symbolTag] = 8882 cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = 8883 cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; 8884 cloneableTags[errorTag] = cloneableTags[funcTag] = 8885 cloneableTags[weakMapTag] = false; 8886 8887 /** Used to map Latin Unicode letters to basic Latin letters. */ 8888 var deburredLetters = { 8889 // Latin-1 Supplement block. 8890 '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', 8891 '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', 8892 '\xc7': 'C', '\xe7': 'c', 8893 '\xd0': 'D', '\xf0': 'd', 8894 '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', 8895 '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', 8896 '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', 8897 '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', 8898 '\xd1': 'N', '\xf1': 'n', 8899 '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', 8900 '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', 8901 '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', 8902 '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', 8903 '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', 8904 '\xc6': 'Ae', '\xe6': 'ae', 8905 '\xde': 'Th', '\xfe': 'th', 8906 '\xdf': 'ss', 8907 // Latin Extended-A block. 8908 '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', 8909 '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', 8910 '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', 8911 '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', 8912 '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', 8913 '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', 8914 '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', 8915 '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', 8916 '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', 8917 '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', 8918 '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', 8919 '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', 8920 '\u0134': 'J', '\u0135': 'j', 8921 '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', 8922 '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', 8923 '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', 8924 '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', 8925 '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', 8926 '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', 8927 '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', 8928 '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', 8929 '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', 8930 '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', 8931 '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', 8932 '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', 8933 '\u0163': 't', '\u0165': 't', '\u0167': 't', 8934 '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', 8935 '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', 8936 '\u0174': 'W', '\u0175': 'w', 8937 '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', 8938 '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', 8939 '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', 8940 '\u0132': 'IJ', '\u0133': 'ij', 8941 '\u0152': 'Oe', '\u0153': 'oe', 8942 '\u0149': "'n", '\u017f': 's' 8943 }; 8944 8945 /** Used to map characters to HTML entities. */ 8946 var htmlEscapes = { 8947 '&': '&', 8948 '<': '<', 8949 '>': '>', 8950 '"': '"', 8951 "'": ''' 8952 }; 8953 8954 /** Used to map HTML entities to characters. */ 8955 var htmlUnescapes = { 8956 '&': '&', 8957 '<': '<', 8958 '>': '>', 8959 '"': '"', 8960 ''': "'" 8961 }; 8962 8963 /** Used to escape characters for inclusion in compiled string literals. */ 8964 var stringEscapes = { 8965 '\\': '\\', 8966 "'": "'", 8967 '\n': 'n', 8968 '\r': 'r', 8969 '\u2028': 'u2028', 8970 '\u2029': 'u2029' 8971 }; 8972 8973 /** Built-in method references without a dependency on `root`. */ 8974 var freeParseFloat = parseFloat, 8975 freeParseInt = parseInt; 8976 8977 /** Detect free variable `global` from Node.js. */ 8978 var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g; 8979 8980 /** Detect free variable `self`. */ 8981 var freeSelf = typeof self == 'object' && self && self.Object === Object && self; 8982 8983 /** Used as a reference to the global object. */ 8984 var root = freeGlobal || freeSelf || Function('return this')(); 8985 8986 /** Detect free variable `exports`. */ 8987 var freeExports = true && exports && !exports.nodeType && exports; 8988 8989 /** Detect free variable `module`. */ 8990 var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module; 8991 8992 /** Detect the popular CommonJS extension `module.exports`. */ 8993 var moduleExports = freeModule && freeModule.exports === freeExports; 8994 8995 /** Detect free variable `process` from Node.js. */ 8996 var freeProcess = moduleExports && freeGlobal.process; 8997 8998 /** Used to access faster Node.js helpers. */ 8999 var nodeUtil = (function() { 9000 try { 9001 // Use `util.types` for Node.js 10+. 9002 var types = freeModule && freeModule.require && freeModule.require('util').types; 9003 9004 if (types) { 9005 return types; 9006 } 9007 9008 // Legacy `process.binding('util')` for Node.js < 10. 9009 return freeProcess && freeProcess.binding && freeProcess.binding('util'); 9010 } catch (e) {} 9011 }()); 9012 9013 /* Node.js helper references. */ 9014 var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, 9015 nodeIsDate = nodeUtil && nodeUtil.isDate, 9016 nodeIsMap = nodeUtil && nodeUtil.isMap, 9017 nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, 9018 nodeIsSet = nodeUtil && nodeUtil.isSet, 9019 nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; 9020 9021 /*--------------------------------------------------------------------------*/ 9022 9023 /** 9024 * A faster alternative to `Function#apply`, this function invokes `func` 9025 * with the `this` binding of `thisArg` and the arguments of `args`. 9026 * 9027 * @private 9028 * @param {Function} func The function to invoke. 9029 * @param {*} thisArg The `this` binding of `func`. 9030 * @param {Array} args The arguments to invoke `func` with. 9031 * @returns {*} Returns the result of `func`. 9032 */ 9033 function apply(func, thisArg, args) { 9034 switch (args.length) { 9035 case 0: return func.call(thisArg); 9036 case 1: return func.call(thisArg, args[0]); 9037 case 2: return func.call(thisArg, args[0], args[1]); 9038 case 3: return func.call(thisArg, args[0], args[1], args[2]); 9039 } 9040 return func.apply(thisArg, args); 9041 } 9042 9043 /** 9044 * A specialized version of `baseAggregator` for arrays. 9045 * 9046 * @private 9047 * @param {Array} [array] The array to iterate over. 9048 * @param {Function} setter The function to set `accumulator` values. 9049 * @param {Function} iteratee The iteratee to transform keys. 9050 * @param {Object} accumulator The initial aggregated object. 9051 * @returns {Function} Returns `accumulator`. 9052 */ 9053 function arrayAggregator(array, setter, iteratee, accumulator) { 9054 var index = -1, 9055 length = array == null ? 0 : array.length; 9056 9057 while (++index < length) { 9058 var value = array[index]; 9059 setter(accumulator, value, iteratee(value), array); 9060 } 9061 return accumulator; 9062 } 9063 9064 /** 9065 * A specialized version of `_.forEach` for arrays without support for 9066 * iteratee shorthands. 9067 * 9068 * @private 9069 * @param {Array} [array] The array to iterate over. 9070 * @param {Function} iteratee The function invoked per iteration. 9071 * @returns {Array} Returns `array`. 9072 */ 9073 function arrayEach(array, iteratee) { 9074 var index = -1, 9075 length = array == null ? 0 : array.length; 9076 9077 while (++index < length) { 9078 if (iteratee(array[index], index, array) === false) { 9079 break; 9080 } 9081 } 9082 return array; 9083 } 9084 9085 /** 9086 * A specialized version of `_.forEachRight` for arrays without support for 9087 * iteratee shorthands. 9088 * 9089 * @private 9090 * @param {Array} [array] The array to iterate over. 9091 * @param {Function} iteratee The function invoked per iteration. 9092 * @returns {Array} Returns `array`. 9093 */ 9094 function arrayEachRight(array, iteratee) { 9095 var length = array == null ? 0 : array.length; 9096 9097 while (length--) { 9098 if (iteratee(array[length], length, array) === false) { 9099 break; 9100 } 9101 } 9102 return array; 9103 } 9104 9105 /** 9106 * A specialized version of `_.every` for arrays without support for 9107 * iteratee shorthands. 9108 * 9109 * @private 9110 * @param {Array} [array] The array to iterate over. 9111 * @param {Function} predicate The function invoked per iteration. 9112 * @returns {boolean} Returns `true` if all elements pass the predicate check, 9113 * else `false`. 9114 */ 9115 function arrayEvery(array, predicate) { 9116 var index = -1, 9117 length = array == null ? 0 : array.length; 9118 9119 while (++index < length) { 9120 if (!predicate(array[index], index, array)) { 9121 return false; 9122 } 9123 } 9124 return true; 9125 } 9126 9127 /** 9128 * A specialized version of `_.filter` for arrays without support for 9129 * iteratee shorthands. 9130 * 9131 * @private 9132 * @param {Array} [array] The array to iterate over. 9133 * @param {Function} predicate The function invoked per iteration. 9134 * @returns {Array} Returns the new filtered array. 9135 */ 9136 function arrayFilter(array, predicate) { 9137 var index = -1, 9138 length = array == null ? 0 : array.length, 9139 resIndex = 0, 9140 result = []; 9141 9142 while (++index < length) { 9143 var value = array[index]; 9144 if (predicate(value, index, array)) { 9145 result[resIndex++] = value; 9146 } 9147 } 9148 return result; 9149 } 9150 9151 /** 9152 * A specialized version of `_.includes` for arrays without support for 9153 * specifying an index to search from. 9154 * 9155 * @private 9156 * @param {Array} [array] The array to inspect. 9157 * @param {*} target The value to search for. 9158 * @returns {boolean} Returns `true` if `target` is found, else `false`. 9159 */ 9160 function arrayIncludes(array, value) { 9161 var length = array == null ? 0 : array.length; 9162 return !!length && baseIndexOf(array, value, 0) > -1; 9163 } 9164 9165 /** 9166 * This function is like `arrayIncludes` except that it accepts a comparator. 9167 * 9168 * @private 9169 * @param {Array} [array] The array to inspect. 9170 * @param {*} target The value to search for. 9171 * @param {Function} comparator The comparator invoked per element. 9172 * @returns {boolean} Returns `true` if `target` is found, else `false`. 9173 */ 9174 function arrayIncludesWith(array, value, comparator) { 9175 var index = -1, 9176 length = array == null ? 0 : array.length; 9177 9178 while (++index < length) { 9179 if (comparator(value, array[index])) { 9180 return true; 9181 } 9182 } 9183 return false; 9184 } 9185 9186 /** 9187 * A specialized version of `_.map` for arrays without support for iteratee 9188 * shorthands. 9189 * 9190 * @private 9191 * @param {Array} [array] The array to iterate over. 9192 * @param {Function} iteratee The function invoked per iteration. 9193 * @returns {Array} Returns the new mapped array. 9194 */ 9195 function arrayMap(array, iteratee) { 9196 var index = -1, 9197 length = array == null ? 0 : array.length, 9198 result = Array(length); 9199 9200 while (++index < length) { 9201 result[index] = iteratee(array[index], index, array); 9202 } 9203 return result; 9204 } 9205 9206 /** 9207 * Appends the elements of `values` to `array`. 9208 * 9209 * @private 9210 * @param {Array} array The array to modify. 9211 * @param {Array} values The values to append. 9212 * @returns {Array} Returns `array`. 9213 */ 9214 function arrayPush(array, values) { 9215 var index = -1, 9216 length = values.length, 9217 offset = array.length; 9218 9219 while (++index < length) { 9220 array[offset + index] = values[index]; 9221 } 9222 return array; 9223 } 9224 9225 /** 9226 * A specialized version of `_.reduce` for arrays without support for 9227 * iteratee shorthands. 9228 * 9229 * @private 9230 * @param {Array} [array] The array to iterate over. 9231 * @param {Function} iteratee The function invoked per iteration. 9232 * @param {*} [accumulator] The initial value. 9233 * @param {boolean} [initAccum] Specify using the first element of `array` as 9234 * the initial value. 9235 * @returns {*} Returns the accumulated value. 9236 */ 9237 function arrayReduce(array, iteratee, accumulator, initAccum) { 9238 var index = -1, 9239 length = array == null ? 0 : array.length; 9240 9241 if (initAccum && length) { 9242 accumulator = array[++index]; 9243 } 9244 while (++index < length) { 9245 accumulator = iteratee(accumulator, array[index], index, array); 9246 } 9247 return accumulator; 9248 } 9249 9250 /** 9251 * A specialized version of `_.reduceRight` for arrays without support for 9252 * iteratee shorthands. 9253 * 9254 * @private 9255 * @param {Array} [array] The array to iterate over. 9256 * @param {Function} iteratee The function invoked per iteration. 9257 * @param {*} [accumulator] The initial value. 9258 * @param {boolean} [initAccum] Specify using the last element of `array` as 9259 * the initial value. 9260 * @returns {*} Returns the accumulated value. 9261 */ 9262 function arrayReduceRight(array, iteratee, accumulator, initAccum) { 9263 var length = array == null ? 0 : array.length; 9264 if (initAccum && length) { 9265 accumulator = array[--length]; 9266 } 9267 while (length--) { 9268 accumulator = iteratee(accumulator, array[length], length, array); 9269 } 9270 return accumulator; 9271 } 9272 9273 /** 9274 * A specialized version of `_.some` for arrays without support for iteratee 9275 * shorthands. 9276 * 9277 * @private 9278 * @param {Array} [array] The array to iterate over. 9279 * @param {Function} predicate The function invoked per iteration. 9280 * @returns {boolean} Returns `true` if any element passes the predicate check, 9281 * else `false`. 9282 */ 9283 function arraySome(array, predicate) { 9284 var index = -1, 9285 length = array == null ? 0 : array.length; 9286 9287 while (++index < length) { 9288 if (predicate(array[index], index, array)) { 9289 return true; 9290 } 9291 } 9292 return false; 9293 } 9294 9295 /** 9296 * Gets the size of an ASCII `string`. 9297 * 9298 * @private 9299 * @param {string} string The string inspect. 9300 * @returns {number} Returns the string size. 9301 */ 9302 var asciiSize = baseProperty('length'); 9303 9304 /** 9305 * Converts an ASCII `string` to an array. 9306 * 9307 * @private 9308 * @param {string} string The string to convert. 9309 * @returns {Array} Returns the converted array. 9310 */ 9311 function asciiToArray(string) { 9312 return string.split(''); 9313 } 9314 9315 /** 9316 * Splits an ASCII `string` into an array of its words. 9317 * 9318 * @private 9319 * @param {string} The string to inspect. 9320 * @returns {Array} Returns the words of `string`. 9321 */ 9322 function asciiWords(string) { 9323 return string.match(reAsciiWord) || []; 9324 } 9325 9326 /** 9327 * The base implementation of methods like `_.findKey` and `_.findLastKey`, 9328 * without support for iteratee shorthands, which iterates over `collection` 9329 * using `eachFunc`. 9330 * 9331 * @private 9332 * @param {Array|Object} collection The collection to inspect. 9333 * @param {Function} predicate The function invoked per iteration. 9334 * @param {Function} eachFunc The function to iterate over `collection`. 9335 * @returns {*} Returns the found element or its key, else `undefined`. 9336 */ 9337 function baseFindKey(collection, predicate, eachFunc) { 9338 var result; 9339 eachFunc(collection, function(value, key, collection) { 9340 if (predicate(value, key, collection)) { 9341 result = key; 9342 return false; 9343 } 9344 }); 9345 return result; 9346 } 9347 9348 /** 9349 * The base implementation of `_.findIndex` and `_.findLastIndex` without 9350 * support for iteratee shorthands. 9351 * 9352 * @private 9353 * @param {Array} array The array to inspect. 9354 * @param {Function} predicate The function invoked per iteration. 9355 * @param {number} fromIndex The index to search from. 9356 * @param {boolean} [fromRight] Specify iterating from right to left. 9357 * @returns {number} Returns the index of the matched value, else `-1`. 9358 */ 9359 function baseFindIndex(array, predicate, fromIndex, fromRight) { 9360 var length = array.length, 9361 index = fromIndex + (fromRight ? 1 : -1); 9362 9363 while ((fromRight ? index-- : ++index < length)) { 9364 if (predicate(array[index], index, array)) { 9365 return index; 9366 } 9367 } 9368 return -1; 9369 } 9370 9371 /** 9372 * The base implementation of `_.indexOf` without `fromIndex` bounds checks. 9373 * 9374 * @private 9375 * @param {Array} array The array to inspect. 9376 * @param {*} value The value to search for. 9377 * @param {number} fromIndex The index to search from. 9378 * @returns {number} Returns the index of the matched value, else `-1`. 9379 */ 9380 function baseIndexOf(array, value, fromIndex) { 9381 return value === value 9382 ? strictIndexOf(array, value, fromIndex) 9383 : baseFindIndex(array, baseIsNaN, fromIndex); 9384 } 9385 9386 /** 9387 * This function is like `baseIndexOf` except that it accepts a comparator. 9388 * 9389 * @private 9390 * @param {Array} array The array to inspect. 9391 * @param {*} value The value to search for. 9392 * @param {number} fromIndex The index to search from. 9393 * @param {Function} comparator The comparator invoked per element. 9394 * @returns {number} Returns the index of the matched value, else `-1`. 9395 */ 9396 function baseIndexOfWith(array, value, fromIndex, comparator) { 9397 var index = fromIndex - 1, 9398 length = array.length; 9399 9400 while (++index < length) { 9401 if (comparator(array[index], value)) { 9402 return index; 9403 } 9404 } 9405 return -1; 9406 } 9407 9408 /** 9409 * The base implementation of `_.isNaN` without support for number objects. 9410 * 9411 * @private 9412 * @param {*} value The value to check. 9413 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. 9414 */ 9415 function baseIsNaN(value) { 9416 return value !== value; 9417 } 9418 9419 /** 9420 * The base implementation of `_.mean` and `_.meanBy` without support for 9421 * iteratee shorthands. 9422 * 9423 * @private 9424 * @param {Array} array The array to iterate over. 9425 * @param {Function} iteratee The function invoked per iteration. 9426 * @returns {number} Returns the mean. 9427 */ 9428 function baseMean(array, iteratee) { 9429 var length = array == null ? 0 : array.length; 9430 return length ? (baseSum(array, iteratee) / length) : NAN; 9431 } 9432 9433 /** 9434 * The base implementation of `_.property` without support for deep paths. 9435 * 9436 * @private 9437 * @param {string} key The key of the property to get. 9438 * @returns {Function} Returns the new accessor function. 9439 */ 9440 function baseProperty(key) { 9441 return function(object) { 9442 return object == null ? undefined : object[key]; 9443 }; 9444 } 9445 9446 /** 9447 * The base implementation of `_.propertyOf` without support for deep paths. 9448 * 9449 * @private 9450 * @param {Object} object The object to query. 9451 * @returns {Function} Returns the new accessor function. 9452 */ 9453 function basePropertyOf(object) { 9454 return function(key) { 9455 return object == null ? undefined : object[key]; 9456 }; 9457 } 9458 9459 /** 9460 * The base implementation of `_.reduce` and `_.reduceRight`, without support 9461 * for iteratee shorthands, which iterates over `collection` using `eachFunc`. 9462 * 9463 * @private 9464 * @param {Array|Object} collection The collection to iterate over. 9465 * @param {Function} iteratee The function invoked per iteration. 9466 * @param {*} accumulator The initial value. 9467 * @param {boolean} initAccum Specify using the first or last element of 9468 * `collection` as the initial value. 9469 * @param {Function} eachFunc The function to iterate over `collection`. 9470 * @returns {*} Returns the accumulated value. 9471 */ 9472 function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { 9473 eachFunc(collection, function(value, index, collection) { 9474 accumulator = initAccum 9475 ? (initAccum = false, value) 9476 : iteratee(accumulator, value, index, collection); 9477 }); 9478 return accumulator; 9479 } 9480 9481 /** 9482 * The base implementation of `_.sortBy` which uses `comparer` to define the 9483 * sort order of `array` and replaces criteria objects with their corresponding 9484 * values. 9485 * 9486 * @private 9487 * @param {Array} array The array to sort. 9488 * @param {Function} comparer The function to define sort order. 9489 * @returns {Array} Returns `array`. 9490 */ 9491 function baseSortBy(array, comparer) { 9492 var length = array.length; 9493 9494 array.sort(comparer); 9495 while (length--) { 9496 array[length] = array[length].value; 9497 } 9498 return array; 9499 } 9500 9501 /** 9502 * The base implementation of `_.sum` and `_.sumBy` without support for 9503 * iteratee shorthands. 9504 * 9505 * @private 9506 * @param {Array} array The array to iterate over. 9507 * @param {Function} iteratee The function invoked per iteration. 9508 * @returns {number} Returns the sum. 9509 */ 9510 function baseSum(array, iteratee) { 9511 var result, 9512 index = -1, 9513 length = array.length; 9514 9515 while (++index < length) { 9516 var current = iteratee(array[index]); 9517 if (current !== undefined) { 9518 result = result === undefined ? current : (result + current); 9519 } 9520 } 9521 return result; 9522 } 9523 9524 /** 9525 * The base implementation of `_.times` without support for iteratee shorthands 9526 * or max array length checks. 9527 * 9528 * @private 9529 * @param {number} n The number of times to invoke `iteratee`. 9530 * @param {Function} iteratee The function invoked per iteration. 9531 * @returns {Array} Returns the array of results. 9532 */ 9533 function baseTimes(n, iteratee) { 9534 var index = -1, 9535 result = Array(n); 9536 9537 while (++index < n) { 9538 result[index] = iteratee(index); 9539 } 9540 return result; 9541 } 9542 9543 /** 9544 * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array 9545 * of key-value pairs for `object` corresponding to the property names of `props`. 9546 * 9547 * @private 9548 * @param {Object} object The object to query. 9549 * @param {Array} props The property names to get values for. 9550 * @returns {Object} Returns the key-value pairs. 9551 */ 9552 function baseToPairs(object, props) { 9553 return arrayMap(props, function(key) { 9554 return [key, object[key]]; 9555 }); 9556 } 9557 9558 /** 9559 * The base implementation of `_.trim`. 9560 * 9561 * @private 9562 * @param {string} string The string to trim. 9563 * @returns {string} Returns the trimmed string. 9564 */ 9565 function baseTrim(string) { 9566 return string 9567 ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') 9568 : string; 9569 } 9570 9571 /** 9572 * The base implementation of `_.unary` without support for storing metadata. 9573 * 9574 * @private 9575 * @param {Function} func The function to cap arguments for. 9576 * @returns {Function} Returns the new capped function. 9577 */ 9578 function baseUnary(func) { 9579 return function(value) { 9580 return func(value); 9581 }; 9582 } 9583 9584 /** 9585 * The base implementation of `_.values` and `_.valuesIn` which creates an 9586 * array of `object` property values corresponding to the property names 9587 * of `props`. 9588 * 9589 * @private 9590 * @param {Object} object The object to query. 9591 * @param {Array} props The property names to get values for. 9592 * @returns {Object} Returns the array of property values. 9593 */ 9594 function baseValues(object, props) { 9595 return arrayMap(props, function(key) { 9596 return object[key]; 9597 }); 9598 } 9599 9600 /** 9601 * Checks if a `cache` value for `key` exists. 9602 * 9603 * @private 9604 * @param {Object} cache The cache to query. 9605 * @param {string} key The key of the entry to check. 9606 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 9607 */ 9608 function cacheHas(cache, key) { 9609 return cache.has(key); 9610 } 9611 9612 /** 9613 * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol 9614 * that is not found in the character symbols. 9615 * 9616 * @private 9617 * @param {Array} strSymbols The string symbols to inspect. 9618 * @param {Array} chrSymbols The character symbols to find. 9619 * @returns {number} Returns the index of the first unmatched string symbol. 9620 */ 9621 function charsStartIndex(strSymbols, chrSymbols) { 9622 var index = -1, 9623 length = strSymbols.length; 9624 9625 while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} 9626 return index; 9627 } 9628 9629 /** 9630 * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol 9631 * that is not found in the character symbols. 9632 * 9633 * @private 9634 * @param {Array} strSymbols The string symbols to inspect. 9635 * @param {Array} chrSymbols The character symbols to find. 9636 * @returns {number} Returns the index of the last unmatched string symbol. 9637 */ 9638 function charsEndIndex(strSymbols, chrSymbols) { 9639 var index = strSymbols.length; 9640 9641 while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} 9642 return index; 9643 } 9644 9645 /** 9646 * Gets the number of `placeholder` occurrences in `array`. 9647 * 9648 * @private 9649 * @param {Array} array The array to inspect. 9650 * @param {*} placeholder The placeholder to search for. 9651 * @returns {number} Returns the placeholder count. 9652 */ 9653 function countHolders(array, placeholder) { 9654 var length = array.length, 9655 result = 0; 9656 9657 while (length--) { 9658 if (array[length] === placeholder) { 9659 ++result; 9660 } 9661 } 9662 return result; 9663 } 9664 9665 /** 9666 * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A 9667 * letters to basic Latin letters. 9668 * 9669 * @private 9670 * @param {string} letter The matched letter to deburr. 9671 * @returns {string} Returns the deburred letter. 9672 */ 9673 var deburrLetter = basePropertyOf(deburredLetters); 9674 9675 /** 9676 * Used by `_.escape` to convert characters to HTML entities. 9677 * 9678 * @private 9679 * @param {string} chr The matched character to escape. 9680 * @returns {string} Returns the escaped character. 9681 */ 9682 var escapeHtmlChar = basePropertyOf(htmlEscapes); 9683 9684 /** 9685 * Used by `_.template` to escape characters for inclusion in compiled string literals. 9686 * 9687 * @private 9688 * @param {string} chr The matched character to escape. 9689 * @returns {string} Returns the escaped character. 9690 */ 9691 function escapeStringChar(chr) { 9692 return '\\' + stringEscapes[chr]; 9693 } 9694 9695 /** 9696 * Gets the value at `key` of `object`. 9697 * 9698 * @private 9699 * @param {Object} [object] The object to query. 9700 * @param {string} key The key of the property to get. 9701 * @returns {*} Returns the property value. 9702 */ 9703 function getValue(object, key) { 9704 return object == null ? undefined : object[key]; 9705 } 9706 9707 /** 9708 * Checks if `string` contains Unicode symbols. 9709 * 9710 * @private 9711 * @param {string} string The string to inspect. 9712 * @returns {boolean} Returns `true` if a symbol is found, else `false`. 9713 */ 9714 function hasUnicode(string) { 9715 return reHasUnicode.test(string); 9716 } 9717 9718 /** 9719 * Checks if `string` contains a word composed of Unicode symbols. 9720 * 9721 * @private 9722 * @param {string} string The string to inspect. 9723 * @returns {boolean} Returns `true` if a word is found, else `false`. 9724 */ 9725 function hasUnicodeWord(string) { 9726 return reHasUnicodeWord.test(string); 9727 } 9728 9729 /** 9730 * Converts `iterator` to an array. 9731 * 9732 * @private 9733 * @param {Object} iterator The iterator to convert. 9734 * @returns {Array} Returns the converted array. 9735 */ 9736 function iteratorToArray(iterator) { 9737 var data, 9738 result = []; 9739 9740 while (!(data = iterator.next()).done) { 9741 result.push(data.value); 9742 } 9743 return result; 9744 } 9745 9746 /** 9747 * Converts `map` to its key-value pairs. 9748 * 9749 * @private 9750 * @param {Object} map The map to convert. 9751 * @returns {Array} Returns the key-value pairs. 9752 */ 9753 function mapToArray(map) { 9754 var index = -1, 9755 result = Array(map.size); 9756 9757 map.forEach(function(value, key) { 9758 result[++index] = [key, value]; 9759 }); 9760 return result; 9761 } 9762 9763 /** 9764 * Creates a unary function that invokes `func` with its argument transformed. 9765 * 9766 * @private 9767 * @param {Function} func The function to wrap. 9768 * @param {Function} transform The argument transform. 9769 * @returns {Function} Returns the new function. 9770 */ 9771 function overArg(func, transform) { 9772 return function(arg) { 9773 return func(transform(arg)); 9774 }; 9775 } 9776 9777 /** 9778 * Replaces all `placeholder` elements in `array` with an internal placeholder 9779 * and returns an array of their indexes. 9780 * 9781 * @private 9782 * @param {Array} array The array to modify. 9783 * @param {*} placeholder The placeholder to replace. 9784 * @returns {Array} Returns the new array of placeholder indexes. 9785 */ 9786 function replaceHolders(array, placeholder) { 9787 var index = -1, 9788 length = array.length, 9789 resIndex = 0, 9790 result = []; 9791 9792 while (++index < length) { 9793 var value = array[index]; 9794 if (value === placeholder || value === PLACEHOLDER) { 9795 array[index] = PLACEHOLDER; 9796 result[resIndex++] = index; 9797 } 9798 } 9799 return result; 9800 } 9801 9802 /** 9803 * Converts `set` to an array of its values. 9804 * 9805 * @private 9806 * @param {Object} set The set to convert. 9807 * @returns {Array} Returns the values. 9808 */ 9809 function setToArray(set) { 9810 var index = -1, 9811 result = Array(set.size); 9812 9813 set.forEach(function(value) { 9814 result[++index] = value; 9815 }); 9816 return result; 9817 } 9818 9819 /** 9820 * Converts `set` to its value-value pairs. 9821 * 9822 * @private 9823 * @param {Object} set The set to convert. 9824 * @returns {Array} Returns the value-value pairs. 9825 */ 9826 function setToPairs(set) { 9827 var index = -1, 9828 result = Array(set.size); 9829 9830 set.forEach(function(value) { 9831 result[++index] = [value, value]; 9832 }); 9833 return result; 9834 } 9835 9836 /** 9837 * A specialized version of `_.indexOf` which performs strict equality 9838 * comparisons of values, i.e. `===`. 9839 * 9840 * @private 9841 * @param {Array} array The array to inspect. 9842 * @param {*} value The value to search for. 9843 * @param {number} fromIndex The index to search from. 9844 * @returns {number} Returns the index of the matched value, else `-1`. 9845 */ 9846 function strictIndexOf(array, value, fromIndex) { 9847 var index = fromIndex - 1, 9848 length = array.length; 9849 9850 while (++index < length) { 9851 if (array[index] === value) { 9852 return index; 9853 } 9854 } 9855 return -1; 9856 } 9857 9858 /** 9859 * A specialized version of `_.lastIndexOf` which performs strict equality 9860 * comparisons of values, i.e. `===`. 9861 * 9862 * @private 9863 * @param {Array} array The array to inspect. 9864 * @param {*} value The value to search for. 9865 * @param {number} fromIndex The index to search from. 9866 * @returns {number} Returns the index of the matched value, else `-1`. 9867 */ 9868 function strictLastIndexOf(array, value, fromIndex) { 9869 var index = fromIndex + 1; 9870 while (index--) { 9871 if (array[index] === value) { 9872 return index; 9873 } 9874 } 9875 return index; 9876 } 9877 9878 /** 9879 * Gets the number of symbols in `string`. 9880 * 9881 * @private 9882 * @param {string} string The string to inspect. 9883 * @returns {number} Returns the string size. 9884 */ 9885 function stringSize(string) { 9886 return hasUnicode(string) 9887 ? unicodeSize(string) 9888 : asciiSize(string); 9889 } 9890 9891 /** 9892 * Converts `string` to an array. 9893 * 9894 * @private 9895 * @param {string} string The string to convert. 9896 * @returns {Array} Returns the converted array. 9897 */ 9898 function stringToArray(string) { 9899 return hasUnicode(string) 9900 ? unicodeToArray(string) 9901 : asciiToArray(string); 9902 } 9903 9904 /** 9905 * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace 9906 * character of `string`. 9907 * 9908 * @private 9909 * @param {string} string The string to inspect. 9910 * @returns {number} Returns the index of the last non-whitespace character. 9911 */ 9912 function trimmedEndIndex(string) { 9913 var index = string.length; 9914 9915 while (index-- && reWhitespace.test(string.charAt(index))) {} 9916 return index; 9917 } 9918 9919 /** 9920 * Used by `_.unescape` to convert HTML entities to characters. 9921 * 9922 * @private 9923 * @param {string} chr The matched character to unescape. 9924 * @returns {string} Returns the unescaped character. 9925 */ 9926 var unescapeHtmlChar = basePropertyOf(htmlUnescapes); 9927 9928 /** 9929 * Gets the size of a Unicode `string`. 9930 * 9931 * @private 9932 * @param {string} string The string inspect. 9933 * @returns {number} Returns the string size. 9934 */ 9935 function unicodeSize(string) { 9936 var result = reUnicode.lastIndex = 0; 9937 while (reUnicode.test(string)) { 9938 ++result; 9939 } 9940 return result; 9941 } 9942 9943 /** 9944 * Converts a Unicode `string` to an array. 9945 * 9946 * @private 9947 * @param {string} string The string to convert. 9948 * @returns {Array} Returns the converted array. 9949 */ 9950 function unicodeToArray(string) { 9951 return string.match(reUnicode) || []; 9952 } 9953 9954 /** 9955 * Splits a Unicode `string` into an array of its words. 9956 * 9957 * @private 9958 * @param {string} The string to inspect. 9959 * @returns {Array} Returns the words of `string`. 9960 */ 9961 function unicodeWords(string) { 9962 return string.match(reUnicodeWord) || []; 9963 } 9964 9965 /*--------------------------------------------------------------------------*/ 9966 9967 /** 9968 * Create a new pristine `lodash` function using the `context` object. 9969 * 9970 * @static 9971 * @memberOf _ 9972 * @since 1.1.0 9973 * @category Util 9974 * @param {Object} [context=root] The context object. 9975 * @returns {Function} Returns a new `lodash` function. 9976 * @example 9977 * 9978 * _.mixin({ 'foo': _.constant('foo') }); 9979 * 9980 * var lodash = _.runInContext(); 9981 * lodash.mixin({ 'bar': lodash.constant('bar') }); 9982 * 9983 * _.isFunction(_.foo); 9984 * // => true 9985 * _.isFunction(_.bar); 9986 * // => false 9987 * 9988 * lodash.isFunction(lodash.foo); 9989 * // => false 9990 * lodash.isFunction(lodash.bar); 9991 * // => true 9992 * 9993 * // Create a suped-up `defer` in Node.js. 9994 * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; 9995 */ 9996 var runInContext = (function runInContext(context) { 9997 context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); 9998 9999 /** Built-in constructor references. */ 10000 var Array = context.Array, 10001 Date = context.Date, 10002 Error = context.Error, 10003 Function = context.Function, 10004 Math = context.Math, 10005 Object = context.Object, 10006 RegExp = context.RegExp, 10007 String = context.String, 10008 TypeError = context.TypeError; 10009 10010 /** Used for built-in method references. */ 10011 var arrayProto = Array.prototype, 10012 funcProto = Function.prototype, 10013 objectProto = Object.prototype; 10014 10015 /** Used to detect overreaching core-js shims. */ 10016 var coreJsData = context['__core-js_shared__']; 10017 10018 /** Used to resolve the decompiled source of functions. */ 10019 var funcToString = funcProto.toString; 10020 10021 /** Used to check objects for own properties. */ 10022 var hasOwnProperty = objectProto.hasOwnProperty; 10023 10024 /** Used to generate unique IDs. */ 10025 var idCounter = 0; 10026 10027 /** Used to detect methods masquerading as native. */ 10028 var maskSrcKey = (function() { 10029 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); 10030 return uid ? ('Symbol(src)_1.' + uid) : ''; 10031 }()); 10032 10033 /** 10034 * Used to resolve the 10035 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) 10036 * of values. 10037 */ 10038 var nativeObjectToString = objectProto.toString; 10039 10040 /** Used to infer the `Object` constructor. */ 10041 var objectCtorString = funcToString.call(Object); 10042 10043 /** Used to restore the original `_` reference in `_.noConflict`. */ 10044 var oldDash = root._; 10045 10046 /** Used to detect if a method is native. */ 10047 var reIsNative = RegExp('^' + 10048 funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') 10049 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' 10050 ); 10051 10052 /** Built-in value references. */ 10053 var Buffer = moduleExports ? context.Buffer : undefined, 10054 Symbol = context.Symbol, 10055 Uint8Array = context.Uint8Array, 10056 allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined, 10057 getPrototype = overArg(Object.getPrototypeOf, Object), 10058 objectCreate = Object.create, 10059 propertyIsEnumerable = objectProto.propertyIsEnumerable, 10060 splice = arrayProto.splice, 10061 spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined, 10062 symIterator = Symbol ? Symbol.iterator : undefined, 10063 symToStringTag = Symbol ? Symbol.toStringTag : undefined; 10064 10065 var defineProperty = (function() { 10066 try { 10067 var func = getNative(Object, 'defineProperty'); 10068 func({}, '', {}); 10069 return func; 10070 } catch (e) {} 10071 }()); 10072 10073 /** Mocked built-ins. */ 10074 var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, 10075 ctxNow = Date && Date.now !== root.Date.now && Date.now, 10076 ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; 10077 10078 /* Built-in method references for those with the same name as other `lodash` methods. */ 10079 var nativeCeil = Math.ceil, 10080 nativeFloor = Math.floor, 10081 nativeGetSymbols = Object.getOwnPropertySymbols, 10082 nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, 10083 nativeIsFinite = context.isFinite, 10084 nativeJoin = arrayProto.join, 10085 nativeKeys = overArg(Object.keys, Object), 10086 nativeMax = Math.max, 10087 nativeMin = Math.min, 10088 nativeNow = Date.now, 10089 nativeParseInt = context.parseInt, 10090 nativeRandom = Math.random, 10091 nativeReverse = arrayProto.reverse; 10092 10093 /* Built-in method references that are verified to be native. */ 10094 var DataView = getNative(context, 'DataView'), 10095 Map = getNative(context, 'Map'), 10096 Promise = getNative(context, 'Promise'), 10097 Set = getNative(context, 'Set'), 10098 WeakMap = getNative(context, 'WeakMap'), 10099 nativeCreate = getNative(Object, 'create'); 10100 10101 /** Used to store function metadata. */ 10102 var metaMap = WeakMap && new WeakMap; 10103 10104 /** Used to lookup unminified function names. */ 10105 var realNames = {}; 10106 10107 /** Used to detect maps, sets, and weakmaps. */ 10108 var dataViewCtorString = toSource(DataView), 10109 mapCtorString = toSource(Map), 10110 promiseCtorString = toSource(Promise), 10111 setCtorString = toSource(Set), 10112 weakMapCtorString = toSource(WeakMap); 10113 10114 /** Used to convert symbols to primitives and strings. */ 10115 var symbolProto = Symbol ? Symbol.prototype : undefined, 10116 symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, 10117 symbolToString = symbolProto ? symbolProto.toString : undefined; 10118 10119 /*------------------------------------------------------------------------*/ 10120 10121 /** 10122 * Creates a `lodash` object which wraps `value` to enable implicit method 10123 * chain sequences. Methods that operate on and return arrays, collections, 10124 * and functions can be chained together. Methods that retrieve a single value 10125 * or may return a primitive value will automatically end the chain sequence 10126 * and return the unwrapped value. Otherwise, the value must be unwrapped 10127 * with `_#value`. 10128 * 10129 * Explicit chain sequences, which must be unwrapped with `_#value`, may be 10130 * enabled using `_.chain`. 10131 * 10132 * The execution of chained methods is lazy, that is, it's deferred until 10133 * `_#value` is implicitly or explicitly called. 10134 * 10135 * Lazy evaluation allows several methods to support shortcut fusion. 10136 * Shortcut fusion is an optimization to merge iteratee calls; this avoids 10137 * the creation of intermediate arrays and can greatly reduce the number of 10138 * iteratee executions. Sections of a chain sequence qualify for shortcut 10139 * fusion if the section is applied to an array and iteratees accept only 10140 * one argument. The heuristic for whether a section qualifies for shortcut 10141 * fusion is subject to change. 10142 * 10143 * Chaining is supported in custom builds as long as the `_#value` method is 10144 * directly or indirectly included in the build. 10145 * 10146 * In addition to lodash methods, wrappers have `Array` and `String` methods. 10147 * 10148 * The wrapper `Array` methods are: 10149 * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` 10150 * 10151 * The wrapper `String` methods are: 10152 * `replace` and `split` 10153 * 10154 * The wrapper methods that support shortcut fusion are: 10155 * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, 10156 * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, 10157 * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` 10158 * 10159 * The chainable wrapper methods are: 10160 * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, 10161 * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, 10162 * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, 10163 * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, 10164 * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, 10165 * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, 10166 * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, 10167 * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, 10168 * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, 10169 * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, 10170 * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, 10171 * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, 10172 * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, 10173 * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, 10174 * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, 10175 * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, 10176 * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, 10177 * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, 10178 * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, 10179 * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, 10180 * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, 10181 * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, 10182 * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, 10183 * `zipObject`, `zipObjectDeep`, and `zipWith` 10184 * 10185 * The wrapper methods that are **not** chainable by default are: 10186 * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, 10187 * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, 10188 * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, 10189 * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, 10190 * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, 10191 * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, 10192 * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, 10193 * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, 10194 * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, 10195 * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, 10196 * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, 10197 * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, 10198 * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, 10199 * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, 10200 * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, 10201 * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, 10202 * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, 10203 * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, 10204 * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, 10205 * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, 10206 * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, 10207 * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, 10208 * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, 10209 * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, 10210 * `upperFirst`, `value`, and `words` 10211 * 10212 * @name _ 10213 * @constructor 10214 * @category Seq 10215 * @param {*} value The value to wrap in a `lodash` instance. 10216 * @returns {Object} Returns the new `lodash` wrapper instance. 10217 * @example 10218 * 10219 * function square(n) { 10220 * return n * n; 10221 * } 10222 * 10223 * var wrapped = _([1, 2, 3]); 10224 * 10225 * // Returns an unwrapped value. 10226 * wrapped.reduce(_.add); 10227 * // => 6 10228 * 10229 * // Returns a wrapped value. 10230 * var squares = wrapped.map(square); 10231 * 10232 * _.isArray(squares); 10233 * // => false 10234 * 10235 * _.isArray(squares.value()); 10236 * // => true 10237 */ 10238 function lodash(value) { 10239 if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { 10240 if (value instanceof LodashWrapper) { 10241 return value; 10242 } 10243 if (hasOwnProperty.call(value, '__wrapped__')) { 10244 return wrapperClone(value); 10245 } 10246 } 10247 return new LodashWrapper(value); 10248 } 10249 10250 /** 10251 * The base implementation of `_.create` without support for assigning 10252 * properties to the created object. 10253 * 10254 * @private 10255 * @param {Object} proto The object to inherit from. 10256 * @returns {Object} Returns the new object. 10257 */ 10258 var baseCreate = (function() { 10259 function object() {} 10260 return function(proto) { 10261 if (!isObject(proto)) { 10262 return {}; 10263 } 10264 if (objectCreate) { 10265 return objectCreate(proto); 10266 } 10267 object.prototype = proto; 10268 var result = new object; 10269 object.prototype = undefined; 10270 return result; 10271 }; 10272 }()); 10273 10274 /** 10275 * The function whose prototype chain sequence wrappers inherit from. 10276 * 10277 * @private 10278 */ 10279 function baseLodash() { 10280 // No operation performed. 10281 } 10282 10283 /** 10284 * The base constructor for creating `lodash` wrapper objects. 10285 * 10286 * @private 10287 * @param {*} value The value to wrap. 10288 * @param {boolean} [chainAll] Enable explicit method chain sequences. 10289 */ 10290 function LodashWrapper(value, chainAll) { 10291 this.__wrapped__ = value; 10292 this.__actions__ = []; 10293 this.__chain__ = !!chainAll; 10294 this.__index__ = 0; 10295 this.__values__ = undefined; 10296 } 10297 10298 /** 10299 * By default, the template delimiters used by lodash are like those in 10300 * embedded Ruby (ERB) as well as ES2015 template strings. Change the 10301 * following template settings to use alternative delimiters. 10302 * 10303 * @static 10304 * @memberOf _ 10305 * @type {Object} 10306 */ 10307 lodash.templateSettings = { 10308 10309 /** 10310 * Used to detect `data` property values to be HTML-escaped. 10311 * 10312 * @memberOf _.templateSettings 10313 * @type {RegExp} 10314 */ 10315 'escape': reEscape, 10316 10317 /** 10318 * Used to detect code to be evaluated. 10319 * 10320 * @memberOf _.templateSettings 10321 * @type {RegExp} 10322 */ 10323 'evaluate': reEvaluate, 10324 10325 /** 10326 * Used to detect `data` property values to inject. 10327 * 10328 * @memberOf _.templateSettings 10329 * @type {RegExp} 10330 */ 10331 'interpolate': reInterpolate, 10332 10333 /** 10334 * Used to reference the data object in the template text. 10335 * 10336 * @memberOf _.templateSettings 10337 * @type {string} 10338 */ 10339 'variable': '', 10340 10341 /** 10342 * Used to import variables into the compiled template. 10343 * 10344 * @memberOf _.templateSettings 10345 * @type {Object} 10346 */ 10347 'imports': { 10348 10349 /** 10350 * A reference to the `lodash` function. 10351 * 10352 * @memberOf _.templateSettings.imports 10353 * @type {Function} 10354 */ 10355 '_': lodash 10356 } 10357 }; 10358 10359 // Ensure wrappers are instances of `baseLodash`. 10360 lodash.prototype = baseLodash.prototype; 10361 lodash.prototype.constructor = lodash; 10362 10363 LodashWrapper.prototype = baseCreate(baseLodash.prototype); 10364 LodashWrapper.prototype.constructor = LodashWrapper; 10365 10366 /*------------------------------------------------------------------------*/ 10367 10368 /** 10369 * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. 10370 * 10371 * @private 10372 * @constructor 10373 * @param {*} value The value to wrap. 10374 */ 10375 function LazyWrapper(value) { 10376 this.__wrapped__ = value; 10377 this.__actions__ = []; 10378 this.__dir__ = 1; 10379 this.__filtered__ = false; 10380 this.__iteratees__ = []; 10381 this.__takeCount__ = MAX_ARRAY_LENGTH; 10382 this.__views__ = []; 10383 } 10384 10385 /** 10386 * Creates a clone of the lazy wrapper object. 10387 * 10388 * @private 10389 * @name clone 10390 * @memberOf LazyWrapper 10391 * @returns {Object} Returns the cloned `LazyWrapper` object. 10392 */ 10393 function lazyClone() { 10394 var result = new LazyWrapper(this.__wrapped__); 10395 result.__actions__ = copyArray(this.__actions__); 10396 result.__dir__ = this.__dir__; 10397 result.__filtered__ = this.__filtered__; 10398 result.__iteratees__ = copyArray(this.__iteratees__); 10399 result.__takeCount__ = this.__takeCount__; 10400 result.__views__ = copyArray(this.__views__); 10401 return result; 10402 } 10403 10404 /** 10405 * Reverses the direction of lazy iteration. 10406 * 10407 * @private 10408 * @name reverse 10409 * @memberOf LazyWrapper 10410 * @returns {Object} Returns the new reversed `LazyWrapper` object. 10411 */ 10412 function lazyReverse() { 10413 if (this.__filtered__) { 10414 var result = new LazyWrapper(this); 10415 result.__dir__ = -1; 10416 result.__filtered__ = true; 10417 } else { 10418 result = this.clone(); 10419 result.__dir__ *= -1; 10420 } 10421 return result; 10422 } 10423 10424 /** 10425 * Extracts the unwrapped value from its lazy wrapper. 10426 * 10427 * @private 10428 * @name value 10429 * @memberOf LazyWrapper 10430 * @returns {*} Returns the unwrapped value. 10431 */ 10432 function lazyValue() { 10433 var array = this.__wrapped__.value(), 10434 dir = this.__dir__, 10435 isArr = isArray(array), 10436 isRight = dir < 0, 10437 arrLength = isArr ? array.length : 0, 10438 view = getView(0, arrLength, this.__views__), 10439 start = view.start, 10440 end = view.end, 10441 length = end - start, 10442 index = isRight ? end : (start - 1), 10443 iteratees = this.__iteratees__, 10444 iterLength = iteratees.length, 10445 resIndex = 0, 10446 takeCount = nativeMin(length, this.__takeCount__); 10447 10448 if (!isArr || (!isRight && arrLength == length && takeCount == length)) { 10449 return baseWrapperValue(array, this.__actions__); 10450 } 10451 var result = []; 10452 10453 outer: 10454 while (length-- && resIndex < takeCount) { 10455 index += dir; 10456 10457 var iterIndex = -1, 10458 value = array[index]; 10459 10460 while (++iterIndex < iterLength) { 10461 var data = iteratees[iterIndex], 10462 iteratee = data.iteratee, 10463 type = data.type, 10464 computed = iteratee(value); 10465 10466 if (type == LAZY_MAP_FLAG) { 10467 value = computed; 10468 } else if (!computed) { 10469 if (type == LAZY_FILTER_FLAG) { 10470 continue outer; 10471 } else { 10472 break outer; 10473 } 10474 } 10475 } 10476 result[resIndex++] = value; 10477 } 10478 return result; 10479 } 10480 10481 // Ensure `LazyWrapper` is an instance of `baseLodash`. 10482 LazyWrapper.prototype = baseCreate(baseLodash.prototype); 10483 LazyWrapper.prototype.constructor = LazyWrapper; 10484 10485 /*------------------------------------------------------------------------*/ 10486 10487 /** 10488 * Creates a hash object. 10489 * 10490 * @private 10491 * @constructor 10492 * @param {Array} [entries] The key-value pairs to cache. 10493 */ 10494 function Hash(entries) { 10495 var index = -1, 10496 length = entries == null ? 0 : entries.length; 10497 10498 this.clear(); 10499 while (++index < length) { 10500 var entry = entries[index]; 10501 this.set(entry[0], entry[1]); 10502 } 10503 } 10504 10505 /** 10506 * Removes all key-value entries from the hash. 10507 * 10508 * @private 10509 * @name clear 10510 * @memberOf Hash 10511 */ 10512 function hashClear() { 10513 this.__data__ = nativeCreate ? nativeCreate(null) : {}; 10514 this.size = 0; 10515 } 10516 10517 /** 10518 * Removes `key` and its value from the hash. 10519 * 10520 * @private 10521 * @name delete 10522 * @memberOf Hash 10523 * @param {Object} hash The hash to modify. 10524 * @param {string} key The key of the value to remove. 10525 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 10526 */ 10527 function hashDelete(key) { 10528 var result = this.has(key) && delete this.__data__[key]; 10529 this.size -= result ? 1 : 0; 10530 return result; 10531 } 10532 10533 /** 10534 * Gets the hash value for `key`. 10535 * 10536 * @private 10537 * @name get 10538 * @memberOf Hash 10539 * @param {string} key The key of the value to get. 10540 * @returns {*} Returns the entry value. 10541 */ 10542 function hashGet(key) { 10543 var data = this.__data__; 10544 if (nativeCreate) { 10545 var result = data[key]; 10546 return result === HASH_UNDEFINED ? undefined : result; 10547 } 10548 return hasOwnProperty.call(data, key) ? data[key] : undefined; 10549 } 10550 10551 /** 10552 * Checks if a hash value for `key` exists. 10553 * 10554 * @private 10555 * @name has 10556 * @memberOf Hash 10557 * @param {string} key The key of the entry to check. 10558 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 10559 */ 10560 function hashHas(key) { 10561 var data = this.__data__; 10562 return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); 10563 } 10564 10565 /** 10566 * Sets the hash `key` to `value`. 10567 * 10568 * @private 10569 * @name set 10570 * @memberOf Hash 10571 * @param {string} key The key of the value to set. 10572 * @param {*} value The value to set. 10573 * @returns {Object} Returns the hash instance. 10574 */ 10575 function hashSet(key, value) { 10576 var data = this.__data__; 10577 this.size += this.has(key) ? 0 : 1; 10578 data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; 10579 return this; 10580 } 10581 10582 // Add methods to `Hash`. 10583 Hash.prototype.clear = hashClear; 10584 Hash.prototype['delete'] = hashDelete; 10585 Hash.prototype.get = hashGet; 10586 Hash.prototype.has = hashHas; 10587 Hash.prototype.set = hashSet; 10588 10589 /*------------------------------------------------------------------------*/ 10590 10591 /** 10592 * Creates an list cache object. 10593 * 10594 * @private 10595 * @constructor 10596 * @param {Array} [entries] The key-value pairs to cache. 10597 */ 10598 function ListCache(entries) { 10599 var index = -1, 10600 length = entries == null ? 0 : entries.length; 10601 10602 this.clear(); 10603 while (++index < length) { 10604 var entry = entries[index]; 10605 this.set(entry[0], entry[1]); 10606 } 10607 } 10608 10609 /** 10610 * Removes all key-value entries from the list cache. 10611 * 10612 * @private 10613 * @name clear 10614 * @memberOf ListCache 10615 */ 10616 function listCacheClear() { 10617 this.__data__ = []; 10618 this.size = 0; 10619 } 10620 10621 /** 10622 * Removes `key` and its value from the list cache. 10623 * 10624 * @private 10625 * @name delete 10626 * @memberOf ListCache 10627 * @param {string} key The key of the value to remove. 10628 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 10629 */ 10630 function listCacheDelete(key) { 10631 var data = this.__data__, 10632 index = assocIndexOf(data, key); 10633 10634 if (index < 0) { 10635 return false; 10636 } 10637 var lastIndex = data.length - 1; 10638 if (index == lastIndex) { 10639 data.pop(); 10640 } else { 10641 splice.call(data, index, 1); 10642 } 10643 --this.size; 10644 return true; 10645 } 10646 10647 /** 10648 * Gets the list cache value for `key`. 10649 * 10650 * @private 10651 * @name get 10652 * @memberOf ListCache 10653 * @param {string} key The key of the value to get. 10654 * @returns {*} Returns the entry value. 10655 */ 10656 function listCacheGet(key) { 10657 var data = this.__data__, 10658 index = assocIndexOf(data, key); 10659 10660 return index < 0 ? undefined : data[index][1]; 10661 } 10662 10663 /** 10664 * Checks if a list cache value for `key` exists. 10665 * 10666 * @private 10667 * @name has 10668 * @memberOf ListCache 10669 * @param {string} key The key of the entry to check. 10670 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 10671 */ 10672 function listCacheHas(key) { 10673 return assocIndexOf(this.__data__, key) > -1; 10674 } 10675 10676 /** 10677 * Sets the list cache `key` to `value`. 10678 * 10679 * @private 10680 * @name set 10681 * @memberOf ListCache 10682 * @param {string} key The key of the value to set. 10683 * @param {*} value The value to set. 10684 * @returns {Object} Returns the list cache instance. 10685 */ 10686 function listCacheSet(key, value) { 10687 var data = this.__data__, 10688 index = assocIndexOf(data, key); 10689 10690 if (index < 0) { 10691 ++this.size; 10692 data.push([key, value]); 10693 } else { 10694 data[index][1] = value; 10695 } 10696 return this; 10697 } 10698 10699 // Add methods to `ListCache`. 10700 ListCache.prototype.clear = listCacheClear; 10701 ListCache.prototype['delete'] = listCacheDelete; 10702 ListCache.prototype.get = listCacheGet; 10703 ListCache.prototype.has = listCacheHas; 10704 ListCache.prototype.set = listCacheSet; 10705 10706 /*------------------------------------------------------------------------*/ 10707 10708 /** 10709 * Creates a map cache object to store key-value pairs. 10710 * 10711 * @private 10712 * @constructor 10713 * @param {Array} [entries] The key-value pairs to cache. 10714 */ 10715 function MapCache(entries) { 10716 var index = -1, 10717 length = entries == null ? 0 : entries.length; 10718 10719 this.clear(); 10720 while (++index < length) { 10721 var entry = entries[index]; 10722 this.set(entry[0], entry[1]); 10723 } 10724 } 10725 10726 /** 10727 * Removes all key-value entries from the map. 10728 * 10729 * @private 10730 * @name clear 10731 * @memberOf MapCache 10732 */ 10733 function mapCacheClear() { 10734 this.size = 0; 10735 this.__data__ = { 10736 'hash': new Hash, 10737 'map': new (Map || ListCache), 10738 'string': new Hash 10739 }; 10740 } 10741 10742 /** 10743 * Removes `key` and its value from the map. 10744 * 10745 * @private 10746 * @name delete 10747 * @memberOf MapCache 10748 * @param {string} key The key of the value to remove. 10749 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 10750 */ 10751 function mapCacheDelete(key) { 10752 var result = getMapData(this, key)['delete'](key); 10753 this.size -= result ? 1 : 0; 10754 return result; 10755 } 10756 10757 /** 10758 * Gets the map value for `key`. 10759 * 10760 * @private 10761 * @name get 10762 * @memberOf MapCache 10763 * @param {string} key The key of the value to get. 10764 * @returns {*} Returns the entry value. 10765 */ 10766 function mapCacheGet(key) { 10767 return getMapData(this, key).get(key); 10768 } 10769 10770 /** 10771 * Checks if a map value for `key` exists. 10772 * 10773 * @private 10774 * @name has 10775 * @memberOf MapCache 10776 * @param {string} key The key of the entry to check. 10777 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 10778 */ 10779 function mapCacheHas(key) { 10780 return getMapData(this, key).has(key); 10781 } 10782 10783 /** 10784 * Sets the map `key` to `value`. 10785 * 10786 * @private 10787 * @name set 10788 * @memberOf MapCache 10789 * @param {string} key The key of the value to set. 10790 * @param {*} value The value to set. 10791 * @returns {Object} Returns the map cache instance. 10792 */ 10793 function mapCacheSet(key, value) { 10794 var data = getMapData(this, key), 10795 size = data.size; 10796 10797 data.set(key, value); 10798 this.size += data.size == size ? 0 : 1; 10799 return this; 10800 } 10801 10802 // Add methods to `MapCache`. 10803 MapCache.prototype.clear = mapCacheClear; 10804 MapCache.prototype['delete'] = mapCacheDelete; 10805 MapCache.prototype.get = mapCacheGet; 10806 MapCache.prototype.has = mapCacheHas; 10807 MapCache.prototype.set = mapCacheSet; 10808 10809 /*------------------------------------------------------------------------*/ 10810 10811 /** 10812 * 10813 * Creates an array cache object to store unique values. 10814 * 10815 * @private 10816 * @constructor 10817 * @param {Array} [values] The values to cache. 10818 */ 10819 function SetCache(values) { 10820 var index = -1, 10821 length = values == null ? 0 : values.length; 10822 10823 this.__data__ = new MapCache; 10824 while (++index < length) { 10825 this.add(values[index]); 10826 } 10827 } 10828 10829 /** 10830 * Adds `value` to the array cache. 10831 * 10832 * @private 10833 * @name add 10834 * @memberOf SetCache 10835 * @alias push 10836 * @param {*} value The value to cache. 10837 * @returns {Object} Returns the cache instance. 10838 */ 10839 function setCacheAdd(value) { 10840 this.__data__.set(value, HASH_UNDEFINED); 10841 return this; 10842 } 10843 10844 /** 10845 * Checks if `value` is in the array cache. 10846 * 10847 * @private 10848 * @name has 10849 * @memberOf SetCache 10850 * @param {*} value The value to search for. 10851 * @returns {number} Returns `true` if `value` is found, else `false`. 10852 */ 10853 function setCacheHas(value) { 10854 return this.__data__.has(value); 10855 } 10856 10857 // Add methods to `SetCache`. 10858 SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; 10859 SetCache.prototype.has = setCacheHas; 10860 10861 /*------------------------------------------------------------------------*/ 10862 10863 /** 10864 * Creates a stack cache object to store key-value pairs. 10865 * 10866 * @private 10867 * @constructor 10868 * @param {Array} [entries] The key-value pairs to cache. 10869 */ 10870 function Stack(entries) { 10871 var data = this.__data__ = new ListCache(entries); 10872 this.size = data.size; 10873 } 10874 10875 /** 10876 * Removes all key-value entries from the stack. 10877 * 10878 * @private 10879 * @name clear 10880 * @memberOf Stack 10881 */ 10882 function stackClear() { 10883 this.__data__ = new ListCache; 10884 this.size = 0; 10885 } 10886 10887 /** 10888 * Removes `key` and its value from the stack. 10889 * 10890 * @private 10891 * @name delete 10892 * @memberOf Stack 10893 * @param {string} key The key of the value to remove. 10894 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 10895 */ 10896 function stackDelete(key) { 10897 var data = this.__data__, 10898 result = data['delete'](key); 10899 10900 this.size = data.size; 10901 return result; 10902 } 10903 10904 /** 10905 * Gets the stack value for `key`. 10906 * 10907 * @private 10908 * @name get 10909 * @memberOf Stack 10910 * @param {string} key The key of the value to get. 10911 * @returns {*} Returns the entry value. 10912 */ 10913 function stackGet(key) { 10914 return this.__data__.get(key); 10915 } 10916 10917 /** 10918 * Checks if a stack value for `key` exists. 10919 * 10920 * @private 10921 * @name has 10922 * @memberOf Stack 10923 * @param {string} key The key of the entry to check. 10924 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 10925 */ 10926 function stackHas(key) { 10927 return this.__data__.has(key); 10928 } 10929 10930 /** 10931 * Sets the stack `key` to `value`. 10932 * 10933 * @private 10934 * @name set 10935 * @memberOf Stack 10936 * @param {string} key The key of the value to set. 10937 * @param {*} value The value to set. 10938 * @returns {Object} Returns the stack cache instance. 10939 */ 10940 function stackSet(key, value) { 10941 var data = this.__data__; 10942 if (data instanceof ListCache) { 10943 var pairs = data.__data__; 10944 if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { 10945 pairs.push([key, value]); 10946 this.size = ++data.size; 10947 return this; 10948 } 10949 data = this.__data__ = new MapCache(pairs); 10950 } 10951 data.set(key, value); 10952 this.size = data.size; 10953 return this; 10954 } 10955 10956 // Add methods to `Stack`. 10957 Stack.prototype.clear = stackClear; 10958 Stack.prototype['delete'] = stackDelete; 10959 Stack.prototype.get = stackGet; 10960 Stack.prototype.has = stackHas; 10961 Stack.prototype.set = stackSet; 10962 10963 /*------------------------------------------------------------------------*/ 10964 10965 /** 10966 * Creates an array of the enumerable property names of the array-like `value`. 10967 * 10968 * @private 10969 * @param {*} value The value to query. 10970 * @param {boolean} inherited Specify returning inherited property names. 10971 * @returns {Array} Returns the array of property names. 10972 */ 10973 function arrayLikeKeys(value, inherited) { 10974 var isArr = isArray(value), 10975 isArg = !isArr && isArguments(value), 10976 isBuff = !isArr && !isArg && isBuffer(value), 10977 isType = !isArr && !isArg && !isBuff && isTypedArray(value), 10978 skipIndexes = isArr || isArg || isBuff || isType, 10979 result = skipIndexes ? baseTimes(value.length, String) : [], 10980 length = result.length; 10981 10982 for (var key in value) { 10983 if ((inherited || hasOwnProperty.call(value, key)) && 10984 !(skipIndexes && ( 10985 // Safari 9 has enumerable `arguments.length` in strict mode. 10986 key == 'length' || 10987 // Node.js 0.10 has enumerable non-index properties on buffers. 10988 (isBuff && (key == 'offset' || key == 'parent')) || 10989 // PhantomJS 2 has enumerable non-index properties on typed arrays. 10990 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || 10991 // Skip index properties. 10992 isIndex(key, length) 10993 ))) { 10994 result.push(key); 10995 } 10996 } 10997 return result; 10998 } 10999 11000 /** 11001 * A specialized version of `_.sample` for arrays. 11002 * 11003 * @private 11004 * @param {Array} array The array to sample. 11005 * @returns {*} Returns the random element. 11006 */ 11007 function arraySample(array) { 11008 var length = array.length; 11009 return length ? array[baseRandom(0, length - 1)] : undefined; 11010 } 11011 11012 /** 11013 * A specialized version of `_.sampleSize` for arrays. 11014 * 11015 * @private 11016 * @param {Array} array The array to sample. 11017 * @param {number} n The number of elements to sample. 11018 * @returns {Array} Returns the random elements. 11019 */ 11020 function arraySampleSize(array, n) { 11021 return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); 11022 } 11023 11024 /** 11025 * A specialized version of `_.shuffle` for arrays. 11026 * 11027 * @private 11028 * @param {Array} array The array to shuffle. 11029 * @returns {Array} Returns the new shuffled array. 11030 */ 11031 function arrayShuffle(array) { 11032 return shuffleSelf(copyArray(array)); 11033 } 11034 11035 /** 11036 * This function is like `assignValue` except that it doesn't assign 11037 * `undefined` values. 11038 * 11039 * @private 11040 * @param {Object} object The object to modify. 11041 * @param {string} key The key of the property to assign. 11042 * @param {*} value The value to assign. 11043 */ 11044 function assignMergeValue(object, key, value) { 11045 if ((value !== undefined && !eq(object[key], value)) || 11046 (value === undefined && !(key in object))) { 11047 baseAssignValue(object, key, value); 11048 } 11049 } 11050 11051 /** 11052 * Assigns `value` to `key` of `object` if the existing value is not equivalent 11053 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 11054 * for equality comparisons. 11055 * 11056 * @private 11057 * @param {Object} object The object to modify. 11058 * @param {string} key The key of the property to assign. 11059 * @param {*} value The value to assign. 11060 */ 11061 function assignValue(object, key, value) { 11062 var objValue = object[key]; 11063 if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || 11064 (value === undefined && !(key in object))) { 11065 baseAssignValue(object, key, value); 11066 } 11067 } 11068 11069 /** 11070 * Gets the index at which the `key` is found in `array` of key-value pairs. 11071 * 11072 * @private 11073 * @param {Array} array The array to inspect. 11074 * @param {*} key The key to search for. 11075 * @returns {number} Returns the index of the matched value, else `-1`. 11076 */ 11077 function assocIndexOf(array, key) { 11078 var length = array.length; 11079 while (length--) { 11080 if (eq(array[length][0], key)) { 11081 return length; 11082 } 11083 } 11084 return -1; 11085 } 11086 11087 /** 11088 * Aggregates elements of `collection` on `accumulator` with keys transformed 11089 * by `iteratee` and values set by `setter`. 11090 * 11091 * @private 11092 * @param {Array|Object} collection The collection to iterate over. 11093 * @param {Function} setter The function to set `accumulator` values. 11094 * @param {Function} iteratee The iteratee to transform keys. 11095 * @param {Object} accumulator The initial aggregated object. 11096 * @returns {Function} Returns `accumulator`. 11097 */ 11098 function baseAggregator(collection, setter, iteratee, accumulator) { 11099 baseEach(collection, function(value, key, collection) { 11100 setter(accumulator, value, iteratee(value), collection); 11101 }); 11102 return accumulator; 11103 } 11104 11105 /** 11106 * The base implementation of `_.assign` without support for multiple sources 11107 * or `customizer` functions. 11108 * 11109 * @private 11110 * @param {Object} object The destination object. 11111 * @param {Object} source The source object. 11112 * @returns {Object} Returns `object`. 11113 */ 11114 function baseAssign(object, source) { 11115 return object && copyObject(source, keys(source), object); 11116 } 11117 11118 /** 11119 * The base implementation of `_.assignIn` without support for multiple sources 11120 * or `customizer` functions. 11121 * 11122 * @private 11123 * @param {Object} object The destination object. 11124 * @param {Object} source The source object. 11125 * @returns {Object} Returns `object`. 11126 */ 11127 function baseAssignIn(object, source) { 11128 return object && copyObject(source, keysIn(source), object); 11129 } 11130 11131 /** 11132 * The base implementation of `assignValue` and `assignMergeValue` without 11133 * value checks. 11134 * 11135 * @private 11136 * @param {Object} object The object to modify. 11137 * @param {string} key The key of the property to assign. 11138 * @param {*} value The value to assign. 11139 */ 11140 function baseAssignValue(object, key, value) { 11141 if (key == '__proto__' && defineProperty) { 11142 defineProperty(object, key, { 11143 'configurable': true, 11144 'enumerable': true, 11145 'value': value, 11146 'writable': true 11147 }); 11148 } else { 11149 object[key] = value; 11150 } 11151 } 11152 11153 /** 11154 * The base implementation of `_.at` without support for individual paths. 11155 * 11156 * @private 11157 * @param {Object} object The object to iterate over. 11158 * @param {string[]} paths The property paths to pick. 11159 * @returns {Array} Returns the picked elements. 11160 */ 11161 function baseAt(object, paths) { 11162 var index = -1, 11163 length = paths.length, 11164 result = Array(length), 11165 skip = object == null; 11166 11167 while (++index < length) { 11168 result[index] = skip ? undefined : get(object, paths[index]); 11169 } 11170 return result; 11171 } 11172 11173 /** 11174 * The base implementation of `_.clamp` which doesn't coerce arguments. 11175 * 11176 * @private 11177 * @param {number} number The number to clamp. 11178 * @param {number} [lower] The lower bound. 11179 * @param {number} upper The upper bound. 11180 * @returns {number} Returns the clamped number. 11181 */ 11182 function baseClamp(number, lower, upper) { 11183 if (number === number) { 11184 if (upper !== undefined) { 11185 number = number <= upper ? number : upper; 11186 } 11187 if (lower !== undefined) { 11188 number = number >= lower ? number : lower; 11189 } 11190 } 11191 return number; 11192 } 11193 11194 /** 11195 * The base implementation of `_.clone` and `_.cloneDeep` which tracks 11196 * traversed objects. 11197 * 11198 * @private 11199 * @param {*} value The value to clone. 11200 * @param {boolean} bitmask The bitmask flags. 11201 * 1 - Deep clone 11202 * 2 - Flatten inherited properties 11203 * 4 - Clone symbols 11204 * @param {Function} [customizer] The function to customize cloning. 11205 * @param {string} [key] The key of `value`. 11206 * @param {Object} [object] The parent object of `value`. 11207 * @param {Object} [stack] Tracks traversed objects and their clone counterparts. 11208 * @returns {*} Returns the cloned value. 11209 */ 11210 function baseClone(value, bitmask, customizer, key, object, stack) { 11211 var result, 11212 isDeep = bitmask & CLONE_DEEP_FLAG, 11213 isFlat = bitmask & CLONE_FLAT_FLAG, 11214 isFull = bitmask & CLONE_SYMBOLS_FLAG; 11215 11216 if (customizer) { 11217 result = object ? customizer(value, key, object, stack) : customizer(value); 11218 } 11219 if (result !== undefined) { 11220 return result; 11221 } 11222 if (!isObject(value)) { 11223 return value; 11224 } 11225 var isArr = isArray(value); 11226 if (isArr) { 11227 result = initCloneArray(value); 11228 if (!isDeep) { 11229 return copyArray(value, result); 11230 } 11231 } else { 11232 var tag = getTag(value), 11233 isFunc = tag == funcTag || tag == genTag; 11234 11235 if (isBuffer(value)) { 11236 return cloneBuffer(value, isDeep); 11237 } 11238 if (tag == objectTag || tag == argsTag || (isFunc && !object)) { 11239 result = (isFlat || isFunc) ? {} : initCloneObject(value); 11240 if (!isDeep) { 11241 return isFlat 11242 ? copySymbolsIn(value, baseAssignIn(result, value)) 11243 : copySymbols(value, baseAssign(result, value)); 11244 } 11245 } else { 11246 if (!cloneableTags[tag]) { 11247 return object ? value : {}; 11248 } 11249 result = initCloneByTag(value, tag, isDeep); 11250 } 11251 } 11252 // Check for circular references and return its corresponding clone. 11253 stack || (stack = new Stack); 11254 var stacked = stack.get(value); 11255 if (stacked) { 11256 return stacked; 11257 } 11258 stack.set(value, result); 11259 11260 if (isSet(value)) { 11261 value.forEach(function(subValue) { 11262 result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); 11263 }); 11264 } else if (isMap(value)) { 11265 value.forEach(function(subValue, key) { 11266 result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); 11267 }); 11268 } 11269 11270 var keysFunc = isFull 11271 ? (isFlat ? getAllKeysIn : getAllKeys) 11272 : (isFlat ? keysIn : keys); 11273 11274 var props = isArr ? undefined : keysFunc(value); 11275 arrayEach(props || value, function(subValue, key) { 11276 if (props) { 11277 key = subValue; 11278 subValue = value[key]; 11279 } 11280 // Recursively populate clone (susceptible to call stack limits). 11281 assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); 11282 }); 11283 return result; 11284 } 11285 11286 /** 11287 * The base implementation of `_.conforms` which doesn't clone `source`. 11288 * 11289 * @private 11290 * @param {Object} source The object of property predicates to conform to. 11291 * @returns {Function} Returns the new spec function. 11292 */ 11293 function baseConforms(source) { 11294 var props = keys(source); 11295 return function(object) { 11296 return baseConformsTo(object, source, props); 11297 }; 11298 } 11299 11300 /** 11301 * The base implementation of `_.conformsTo` which accepts `props` to check. 11302 * 11303 * @private 11304 * @param {Object} object The object to inspect. 11305 * @param {Object} source The object of property predicates to conform to. 11306 * @returns {boolean} Returns `true` if `object` conforms, else `false`. 11307 */ 11308 function baseConformsTo(object, source, props) { 11309 var length = props.length; 11310 if (object == null) { 11311 return !length; 11312 } 11313 object = Object(object); 11314 while (length--) { 11315 var key = props[length], 11316 predicate = source[key], 11317 value = object[key]; 11318 11319 if ((value === undefined && !(key in object)) || !predicate(value)) { 11320 return false; 11321 } 11322 } 11323 return true; 11324 } 11325 11326 /** 11327 * The base implementation of `_.delay` and `_.defer` which accepts `args` 11328 * to provide to `func`. 11329 * 11330 * @private 11331 * @param {Function} func The function to delay. 11332 * @param {number} wait The number of milliseconds to delay invocation. 11333 * @param {Array} args The arguments to provide to `func`. 11334 * @returns {number|Object} Returns the timer id or timeout object. 11335 */ 11336 function baseDelay(func, wait, args) { 11337 if (typeof func != 'function') { 11338 throw new TypeError(FUNC_ERROR_TEXT); 11339 } 11340 return setTimeout(function() { func.apply(undefined, args); }, wait); 11341 } 11342 11343 /** 11344 * The base implementation of methods like `_.difference` without support 11345 * for excluding multiple arrays or iteratee shorthands. 11346 * 11347 * @private 11348 * @param {Array} array The array to inspect. 11349 * @param {Array} values The values to exclude. 11350 * @param {Function} [iteratee] The iteratee invoked per element. 11351 * @param {Function} [comparator] The comparator invoked per element. 11352 * @returns {Array} Returns the new array of filtered values. 11353 */ 11354 function baseDifference(array, values, iteratee, comparator) { 11355 var index = -1, 11356 includes = arrayIncludes, 11357 isCommon = true, 11358 length = array.length, 11359 result = [], 11360 valuesLength = values.length; 11361 11362 if (!length) { 11363 return result; 11364 } 11365 if (iteratee) { 11366 values = arrayMap(values, baseUnary(iteratee)); 11367 } 11368 if (comparator) { 11369 includes = arrayIncludesWith; 11370 isCommon = false; 11371 } 11372 else if (values.length >= LARGE_ARRAY_SIZE) { 11373 includes = cacheHas; 11374 isCommon = false; 11375 values = new SetCache(values); 11376 } 11377 outer: 11378 while (++index < length) { 11379 var value = array[index], 11380 computed = iteratee == null ? value : iteratee(value); 11381 11382 value = (comparator || value !== 0) ? value : 0; 11383 if (isCommon && computed === computed) { 11384 var valuesIndex = valuesLength; 11385 while (valuesIndex--) { 11386 if (values[valuesIndex] === computed) { 11387 continue outer; 11388 } 11389 } 11390 result.push(value); 11391 } 11392 else if (!includes(values, computed, comparator)) { 11393 result.push(value); 11394 } 11395 } 11396 return result; 11397 } 11398 11399 /** 11400 * The base implementation of `_.forEach` without support for iteratee shorthands. 11401 * 11402 * @private 11403 * @param {Array|Object} collection The collection to iterate over. 11404 * @param {Function} iteratee The function invoked per iteration. 11405 * @returns {Array|Object} Returns `collection`. 11406 */ 11407 var baseEach = createBaseEach(baseForOwn); 11408 11409 /** 11410 * The base implementation of `_.forEachRight` without support for iteratee shorthands. 11411 * 11412 * @private 11413 * @param {Array|Object} collection The collection to iterate over. 11414 * @param {Function} iteratee The function invoked per iteration. 11415 * @returns {Array|Object} Returns `collection`. 11416 */ 11417 var baseEachRight = createBaseEach(baseForOwnRight, true); 11418 11419 /** 11420 * The base implementation of `_.every` without support for iteratee shorthands. 11421 * 11422 * @private 11423 * @param {Array|Object} collection The collection to iterate over. 11424 * @param {Function} predicate The function invoked per iteration. 11425 * @returns {boolean} Returns `true` if all elements pass the predicate check, 11426 * else `false` 11427 */ 11428 function baseEvery(collection, predicate) { 11429 var result = true; 11430 baseEach(collection, function(value, index, collection) { 11431 result = !!predicate(value, index, collection); 11432 return result; 11433 }); 11434 return result; 11435 } 11436 11437 /** 11438 * The base implementation of methods like `_.max` and `_.min` which accepts a 11439 * `comparator` to determine the extremum value. 11440 * 11441 * @private 11442 * @param {Array} array The array to iterate over. 11443 * @param {Function} iteratee The iteratee invoked per iteration. 11444 * @param {Function} comparator The comparator used to compare values. 11445 * @returns {*} Returns the extremum value. 11446 */ 11447 function baseExtremum(array, iteratee, comparator) { 11448 var index = -1, 11449 length = array.length; 11450 11451 while (++index < length) { 11452 var value = array[index], 11453 current = iteratee(value); 11454 11455 if (current != null && (computed === undefined 11456 ? (current === current && !isSymbol(current)) 11457 : comparator(current, computed) 11458 )) { 11459 var computed = current, 11460 result = value; 11461 } 11462 } 11463 return result; 11464 } 11465 11466 /** 11467 * The base implementation of `_.fill` without an iteratee call guard. 11468 * 11469 * @private 11470 * @param {Array} array The array to fill. 11471 * @param {*} value The value to fill `array` with. 11472 * @param {number} [start=0] The start position. 11473 * @param {number} [end=array.length] The end position. 11474 * @returns {Array} Returns `array`. 11475 */ 11476 function baseFill(array, value, start, end) { 11477 var length = array.length; 11478 11479 start = toInteger(start); 11480 if (start < 0) { 11481 start = -start > length ? 0 : (length + start); 11482 } 11483 end = (end === undefined || end > length) ? length : toInteger(end); 11484 if (end < 0) { 11485 end += length; 11486 } 11487 end = start > end ? 0 : toLength(end); 11488 while (start < end) { 11489 array[start++] = value; 11490 } 11491 return array; 11492 } 11493 11494 /** 11495 * The base implementation of `_.filter` without support for iteratee shorthands. 11496 * 11497 * @private 11498 * @param {Array|Object} collection The collection to iterate over. 11499 * @param {Function} predicate The function invoked per iteration. 11500 * @returns {Array} Returns the new filtered array. 11501 */ 11502 function baseFilter(collection, predicate) { 11503 var result = []; 11504 baseEach(collection, function(value, index, collection) { 11505 if (predicate(value, index, collection)) { 11506 result.push(value); 11507 } 11508 }); 11509 return result; 11510 } 11511 11512 /** 11513 * The base implementation of `_.flatten` with support for restricting flattening. 11514 * 11515 * @private 11516 * @param {Array} array The array to flatten. 11517 * @param {number} depth The maximum recursion depth. 11518 * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. 11519 * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. 11520 * @param {Array} [result=[]] The initial result value. 11521 * @returns {Array} Returns the new flattened array. 11522 */ 11523 function baseFlatten(array, depth, predicate, isStrict, result) { 11524 var index = -1, 11525 length = array.length; 11526 11527 predicate || (predicate = isFlattenable); 11528 result || (result = []); 11529 11530 while (++index < length) { 11531 var value = array[index]; 11532 if (depth > 0 && predicate(value)) { 11533 if (depth > 1) { 11534 // Recursively flatten arrays (susceptible to call stack limits). 11535 baseFlatten(value, depth - 1, predicate, isStrict, result); 11536 } else { 11537 arrayPush(result, value); 11538 } 11539 } else if (!isStrict) { 11540 result[result.length] = value; 11541 } 11542 } 11543 return result; 11544 } 11545 11546 /** 11547 * The base implementation of `baseForOwn` which iterates over `object` 11548 * properties returned by `keysFunc` and invokes `iteratee` for each property. 11549 * Iteratee functions may exit iteration early by explicitly returning `false`. 11550 * 11551 * @private 11552 * @param {Object} object The object to iterate over. 11553 * @param {Function} iteratee The function invoked per iteration. 11554 * @param {Function} keysFunc The function to get the keys of `object`. 11555 * @returns {Object} Returns `object`. 11556 */ 11557 var baseFor = createBaseFor(); 11558 11559 /** 11560 * This function is like `baseFor` except that it iterates over properties 11561 * in the opposite order. 11562 * 11563 * @private 11564 * @param {Object} object The object to iterate over. 11565 * @param {Function} iteratee The function invoked per iteration. 11566 * @param {Function} keysFunc The function to get the keys of `object`. 11567 * @returns {Object} Returns `object`. 11568 */ 11569 var baseForRight = createBaseFor(true); 11570 11571 /** 11572 * The base implementation of `_.forOwn` without support for iteratee shorthands. 11573 * 11574 * @private 11575 * @param {Object} object The object to iterate over. 11576 * @param {Function} iteratee The function invoked per iteration. 11577 * @returns {Object} Returns `object`. 11578 */ 11579 function baseForOwn(object, iteratee) { 11580 return object && baseFor(object, iteratee, keys); 11581 } 11582 11583 /** 11584 * The base implementation of `_.forOwnRight` without support for iteratee shorthands. 11585 * 11586 * @private 11587 * @param {Object} object The object to iterate over. 11588 * @param {Function} iteratee The function invoked per iteration. 11589 * @returns {Object} Returns `object`. 11590 */ 11591 function baseForOwnRight(object, iteratee) { 11592 return object && baseForRight(object, iteratee, keys); 11593 } 11594 11595 /** 11596 * The base implementation of `_.functions` which creates an array of 11597 * `object` function property names filtered from `props`. 11598 * 11599 * @private 11600 * @param {Object} object The object to inspect. 11601 * @param {Array} props The property names to filter. 11602 * @returns {Array} Returns the function names. 11603 */ 11604 function baseFunctions(object, props) { 11605 return arrayFilter(props, function(key) { 11606 return isFunction(object[key]); 11607 }); 11608 } 11609 11610 /** 11611 * The base implementation of `_.get` without support for default values. 11612 * 11613 * @private 11614 * @param {Object} object The object to query. 11615 * @param {Array|string} path The path of the property to get. 11616 * @returns {*} Returns the resolved value. 11617 */ 11618 function baseGet(object, path) { 11619 path = castPath(path, object); 11620 11621 var index = 0, 11622 length = path.length; 11623 11624 while (object != null && index < length) { 11625 object = object[toKey(path[index++])]; 11626 } 11627 return (index && index == length) ? object : undefined; 11628 } 11629 11630 /** 11631 * The base implementation of `getAllKeys` and `getAllKeysIn` which uses 11632 * `keysFunc` and `symbolsFunc` to get the enumerable property names and 11633 * symbols of `object`. 11634 * 11635 * @private 11636 * @param {Object} object The object to query. 11637 * @param {Function} keysFunc The function to get the keys of `object`. 11638 * @param {Function} symbolsFunc The function to get the symbols of `object`. 11639 * @returns {Array} Returns the array of property names and symbols. 11640 */ 11641 function baseGetAllKeys(object, keysFunc, symbolsFunc) { 11642 var result = keysFunc(object); 11643 return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); 11644 } 11645 11646 /** 11647 * The base implementation of `getTag` without fallbacks for buggy environments. 11648 * 11649 * @private 11650 * @param {*} value The value to query. 11651 * @returns {string} Returns the `toStringTag`. 11652 */ 11653 function baseGetTag(value) { 11654 if (value == null) { 11655 return value === undefined ? undefinedTag : nullTag; 11656 } 11657 return (symToStringTag && symToStringTag in Object(value)) 11658 ? getRawTag(value) 11659 : objectToString(value); 11660 } 11661 11662 /** 11663 * The base implementation of `_.gt` which doesn't coerce arguments. 11664 * 11665 * @private 11666 * @param {*} value The value to compare. 11667 * @param {*} other The other value to compare. 11668 * @returns {boolean} Returns `true` if `value` is greater than `other`, 11669 * else `false`. 11670 */ 11671 function baseGt(value, other) { 11672 return value > other; 11673 } 11674 11675 /** 11676 * The base implementation of `_.has` without support for deep paths. 11677 * 11678 * @private 11679 * @param {Object} [object] The object to query. 11680 * @param {Array|string} key The key to check. 11681 * @returns {boolean} Returns `true` if `key` exists, else `false`. 11682 */ 11683 function baseHas(object, key) { 11684 return object != null && hasOwnProperty.call(object, key); 11685 } 11686 11687 /** 11688 * The base implementation of `_.hasIn` without support for deep paths. 11689 * 11690 * @private 11691 * @param {Object} [object] The object to query. 11692 * @param {Array|string} key The key to check. 11693 * @returns {boolean} Returns `true` if `key` exists, else `false`. 11694 */ 11695 function baseHasIn(object, key) { 11696 return object != null && key in Object(object); 11697 } 11698 11699 /** 11700 * The base implementation of `_.inRange` which doesn't coerce arguments. 11701 * 11702 * @private 11703 * @param {number} number The number to check. 11704 * @param {number} start The start of the range. 11705 * @param {number} end The end of the range. 11706 * @returns {boolean} Returns `true` if `number` is in the range, else `false`. 11707 */ 11708 function baseInRange(number, start, end) { 11709 return number >= nativeMin(start, end) && number < nativeMax(start, end); 11710 } 11711 11712 /** 11713 * The base implementation of methods like `_.intersection`, without support 11714 * for iteratee shorthands, that accepts an array of arrays to inspect. 11715 * 11716 * @private 11717 * @param {Array} arrays The arrays to inspect. 11718 * @param {Function} [iteratee] The iteratee invoked per element. 11719 * @param {Function} [comparator] The comparator invoked per element. 11720 * @returns {Array} Returns the new array of shared values. 11721 */ 11722 function baseIntersection(arrays, iteratee, comparator) { 11723 var includes = comparator ? arrayIncludesWith : arrayIncludes, 11724 length = arrays[0].length, 11725 othLength = arrays.length, 11726 othIndex = othLength, 11727 caches = Array(othLength), 11728 maxLength = Infinity, 11729 result = []; 11730 11731 while (othIndex--) { 11732 var array = arrays[othIndex]; 11733 if (othIndex && iteratee) { 11734 array = arrayMap(array, baseUnary(iteratee)); 11735 } 11736 maxLength = nativeMin(array.length, maxLength); 11737 caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) 11738 ? new SetCache(othIndex && array) 11739 : undefined; 11740 } 11741 array = arrays[0]; 11742 11743 var index = -1, 11744 seen = caches[0]; 11745 11746 outer: 11747 while (++index < length && result.length < maxLength) { 11748 var value = array[index], 11749 computed = iteratee ? iteratee(value) : value; 11750 11751 value = (comparator || value !== 0) ? value : 0; 11752 if (!(seen 11753 ? cacheHas(seen, computed) 11754 : includes(result, computed, comparator) 11755 )) { 11756 othIndex = othLength; 11757 while (--othIndex) { 11758 var cache = caches[othIndex]; 11759 if (!(cache 11760 ? cacheHas(cache, computed) 11761 : includes(arrays[othIndex], computed, comparator)) 11762 ) { 11763 continue outer; 11764 } 11765 } 11766 if (seen) { 11767 seen.push(computed); 11768 } 11769 result.push(value); 11770 } 11771 } 11772 return result; 11773 } 11774 11775 /** 11776 * The base implementation of `_.invert` and `_.invertBy` which inverts 11777 * `object` with values transformed by `iteratee` and set by `setter`. 11778 * 11779 * @private 11780 * @param {Object} object The object to iterate over. 11781 * @param {Function} setter The function to set `accumulator` values. 11782 * @param {Function} iteratee The iteratee to transform values. 11783 * @param {Object} accumulator The initial inverted object. 11784 * @returns {Function} Returns `accumulator`. 11785 */ 11786 function baseInverter(object, setter, iteratee, accumulator) { 11787 baseForOwn(object, function(value, key, object) { 11788 setter(accumulator, iteratee(value), key, object); 11789 }); 11790 return accumulator; 11791 } 11792 11793 /** 11794 * The base implementation of `_.invoke` without support for individual 11795 * method arguments. 11796 * 11797 * @private 11798 * @param {Object} object The object to query. 11799 * @param {Array|string} path The path of the method to invoke. 11800 * @param {Array} args The arguments to invoke the method with. 11801 * @returns {*} Returns the result of the invoked method. 11802 */ 11803 function baseInvoke(object, path, args) { 11804 path = castPath(path, object); 11805 object = parent(object, path); 11806 var func = object == null ? object : object[toKey(last(path))]; 11807 return func == null ? undefined : apply(func, object, args); 11808 } 11809 11810 /** 11811 * The base implementation of `_.isArguments`. 11812 * 11813 * @private 11814 * @param {*} value The value to check. 11815 * @returns {boolean} Returns `true` if `value` is an `arguments` object, 11816 */ 11817 function baseIsArguments(value) { 11818 return isObjectLike(value) && baseGetTag(value) == argsTag; 11819 } 11820 11821 /** 11822 * The base implementation of `_.isArrayBuffer` without Node.js optimizations. 11823 * 11824 * @private 11825 * @param {*} value The value to check. 11826 * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. 11827 */ 11828 function baseIsArrayBuffer(value) { 11829 return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; 11830 } 11831 11832 /** 11833 * The base implementation of `_.isDate` without Node.js optimizations. 11834 * 11835 * @private 11836 * @param {*} value The value to check. 11837 * @returns {boolean} Returns `true` if `value` is a date object, else `false`. 11838 */ 11839 function baseIsDate(value) { 11840 return isObjectLike(value) && baseGetTag(value) == dateTag; 11841 } 11842 11843 /** 11844 * The base implementation of `_.isEqual` which supports partial comparisons 11845 * and tracks traversed objects. 11846 * 11847 * @private 11848 * @param {*} value The value to compare. 11849 * @param {*} other The other value to compare. 11850 * @param {boolean} bitmask The bitmask flags. 11851 * 1 - Unordered comparison 11852 * 2 - Partial comparison 11853 * @param {Function} [customizer] The function to customize comparisons. 11854 * @param {Object} [stack] Tracks traversed `value` and `other` objects. 11855 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 11856 */ 11857 function baseIsEqual(value, other, bitmask, customizer, stack) { 11858 if (value === other) { 11859 return true; 11860 } 11861 if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { 11862 return value !== value && other !== other; 11863 } 11864 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); 11865 } 11866 11867 /** 11868 * A specialized version of `baseIsEqual` for arrays and objects which performs 11869 * deep comparisons and tracks traversed objects enabling objects with circular 11870 * references to be compared. 11871 * 11872 * @private 11873 * @param {Object} object The object to compare. 11874 * @param {Object} other The other object to compare. 11875 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 11876 * @param {Function} customizer The function to customize comparisons. 11877 * @param {Function} equalFunc The function to determine equivalents of values. 11878 * @param {Object} [stack] Tracks traversed `object` and `other` objects. 11879 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 11880 */ 11881 function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { 11882 var objIsArr = isArray(object), 11883 othIsArr = isArray(other), 11884 objTag = objIsArr ? arrayTag : getTag(object), 11885 othTag = othIsArr ? arrayTag : getTag(other); 11886 11887 objTag = objTag == argsTag ? objectTag : objTag; 11888 othTag = othTag == argsTag ? objectTag : othTag; 11889 11890 var objIsObj = objTag == objectTag, 11891 othIsObj = othTag == objectTag, 11892 isSameTag = objTag == othTag; 11893 11894 if (isSameTag && isBuffer(object)) { 11895 if (!isBuffer(other)) { 11896 return false; 11897 } 11898 objIsArr = true; 11899 objIsObj = false; 11900 } 11901 if (isSameTag && !objIsObj) { 11902 stack || (stack = new Stack); 11903 return (objIsArr || isTypedArray(object)) 11904 ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) 11905 : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); 11906 } 11907 if (!(bitmask & COMPARE_PARTIAL_FLAG)) { 11908 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), 11909 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); 11910 11911 if (objIsWrapped || othIsWrapped) { 11912 var objUnwrapped = objIsWrapped ? object.value() : object, 11913 othUnwrapped = othIsWrapped ? other.value() : other; 11914 11915 stack || (stack = new Stack); 11916 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); 11917 } 11918 } 11919 if (!isSameTag) { 11920 return false; 11921 } 11922 stack || (stack = new Stack); 11923 return equalObjects(object, other, bitmask, customizer, equalFunc, stack); 11924 } 11925 11926 /** 11927 * The base implementation of `_.isMap` without Node.js optimizations. 11928 * 11929 * @private 11930 * @param {*} value The value to check. 11931 * @returns {boolean} Returns `true` if `value` is a map, else `false`. 11932 */ 11933 function baseIsMap(value) { 11934 return isObjectLike(value) && getTag(value) == mapTag; 11935 } 11936 11937 /** 11938 * The base implementation of `_.isMatch` without support for iteratee shorthands. 11939 * 11940 * @private 11941 * @param {Object} object The object to inspect. 11942 * @param {Object} source The object of property values to match. 11943 * @param {Array} matchData The property names, values, and compare flags to match. 11944 * @param {Function} [customizer] The function to customize comparisons. 11945 * @returns {boolean} Returns `true` if `object` is a match, else `false`. 11946 */ 11947 function baseIsMatch(object, source, matchData, customizer) { 11948 var index = matchData.length, 11949 length = index, 11950 noCustomizer = !customizer; 11951 11952 if (object == null) { 11953 return !length; 11954 } 11955 object = Object(object); 11956 while (index--) { 11957 var data = matchData[index]; 11958 if ((noCustomizer && data[2]) 11959 ? data[1] !== object[data[0]] 11960 : !(data[0] in object) 11961 ) { 11962 return false; 11963 } 11964 } 11965 while (++index < length) { 11966 data = matchData[index]; 11967 var key = data[0], 11968 objValue = object[key], 11969 srcValue = data[1]; 11970 11971 if (noCustomizer && data[2]) { 11972 if (objValue === undefined && !(key in object)) { 11973 return false; 11974 } 11975 } else { 11976 var stack = new Stack; 11977 if (customizer) { 11978 var result = customizer(objValue, srcValue, key, object, source, stack); 11979 } 11980 if (!(result === undefined 11981 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) 11982 : result 11983 )) { 11984 return false; 11985 } 11986 } 11987 } 11988 return true; 11989 } 11990 11991 /** 11992 * The base implementation of `_.isNative` without bad shim checks. 11993 * 11994 * @private 11995 * @param {*} value The value to check. 11996 * @returns {boolean} Returns `true` if `value` is a native function, 11997 * else `false`. 11998 */ 11999 function baseIsNative(value) { 12000 if (!isObject(value) || isMasked(value)) { 12001 return false; 12002 } 12003 var pattern = isFunction(value) ? reIsNative : reIsHostCtor; 12004 return pattern.test(toSource(value)); 12005 } 12006 12007 /** 12008 * The base implementation of `_.isRegExp` without Node.js optimizations. 12009 * 12010 * @private 12011 * @param {*} value The value to check. 12012 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. 12013 */ 12014 function baseIsRegExp(value) { 12015 return isObjectLike(value) && baseGetTag(value) == regexpTag; 12016 } 12017 12018 /** 12019 * The base implementation of `_.isSet` without Node.js optimizations. 12020 * 12021 * @private 12022 * @param {*} value The value to check. 12023 * @returns {boolean} Returns `true` if `value` is a set, else `false`. 12024 */ 12025 function baseIsSet(value) { 12026 return isObjectLike(value) && getTag(value) == setTag; 12027 } 12028 12029 /** 12030 * The base implementation of `_.isTypedArray` without Node.js optimizations. 12031 * 12032 * @private 12033 * @param {*} value The value to check. 12034 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. 12035 */ 12036 function baseIsTypedArray(value) { 12037 return isObjectLike(value) && 12038 isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; 12039 } 12040 12041 /** 12042 * The base implementation of `_.iteratee`. 12043 * 12044 * @private 12045 * @param {*} [value=_.identity] The value to convert to an iteratee. 12046 * @returns {Function} Returns the iteratee. 12047 */ 12048 function baseIteratee(value) { 12049 // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. 12050 // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. 12051 if (typeof value == 'function') { 12052 return value; 12053 } 12054 if (value == null) { 12055 return identity; 12056 } 12057 if (typeof value == 'object') { 12058 return isArray(value) 12059 ? baseMatchesProperty(value[0], value[1]) 12060 : baseMatches(value); 12061 } 12062 return property(value); 12063 } 12064 12065 /** 12066 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. 12067 * 12068 * @private 12069 * @param {Object} object The object to query. 12070 * @returns {Array} Returns the array of property names. 12071 */ 12072 function baseKeys(object) { 12073 if (!isPrototype(object)) { 12074 return nativeKeys(object); 12075 } 12076 var result = []; 12077 for (var key in Object(object)) { 12078 if (hasOwnProperty.call(object, key) && key != 'constructor') { 12079 result.push(key); 12080 } 12081 } 12082 return result; 12083 } 12084 12085 /** 12086 * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. 12087 * 12088 * @private 12089 * @param {Object} object The object to query. 12090 * @returns {Array} Returns the array of property names. 12091 */ 12092 function baseKeysIn(object) { 12093 if (!isObject(object)) { 12094 return nativeKeysIn(object); 12095 } 12096 var isProto = isPrototype(object), 12097 result = []; 12098 12099 for (var key in object) { 12100 if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { 12101 result.push(key); 12102 } 12103 } 12104 return result; 12105 } 12106 12107 /** 12108 * The base implementation of `_.lt` which doesn't coerce arguments. 12109 * 12110 * @private 12111 * @param {*} value The value to compare. 12112 * @param {*} other The other value to compare. 12113 * @returns {boolean} Returns `true` if `value` is less than `other`, 12114 * else `false`. 12115 */ 12116 function baseLt(value, other) { 12117 return value < other; 12118 } 12119 12120 /** 12121 * The base implementation of `_.map` without support for iteratee shorthands. 12122 * 12123 * @private 12124 * @param {Array|Object} collection The collection to iterate over. 12125 * @param {Function} iteratee The function invoked per iteration. 12126 * @returns {Array} Returns the new mapped array. 12127 */ 12128 function baseMap(collection, iteratee) { 12129 var index = -1, 12130 result = isArrayLike(collection) ? Array(collection.length) : []; 12131 12132 baseEach(collection, function(value, key, collection) { 12133 result[++index] = iteratee(value, key, collection); 12134 }); 12135 return result; 12136 } 12137 12138 /** 12139 * The base implementation of `_.matches` which doesn't clone `source`. 12140 * 12141 * @private 12142 * @param {Object} source The object of property values to match. 12143 * @returns {Function} Returns the new spec function. 12144 */ 12145 function baseMatches(source) { 12146 var matchData = getMatchData(source); 12147 if (matchData.length == 1 && matchData[0][2]) { 12148 return matchesStrictComparable(matchData[0][0], matchData[0][1]); 12149 } 12150 return function(object) { 12151 return object === source || baseIsMatch(object, source, matchData); 12152 }; 12153 } 12154 12155 /** 12156 * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. 12157 * 12158 * @private 12159 * @param {string} path The path of the property to get. 12160 * @param {*} srcValue The value to match. 12161 * @returns {Function} Returns the new spec function. 12162 */ 12163 function baseMatchesProperty(path, srcValue) { 12164 if (isKey(path) && isStrictComparable(srcValue)) { 12165 return matchesStrictComparable(toKey(path), srcValue); 12166 } 12167 return function(object) { 12168 var objValue = get(object, path); 12169 return (objValue === undefined && objValue === srcValue) 12170 ? hasIn(object, path) 12171 : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); 12172 }; 12173 } 12174 12175 /** 12176 * The base implementation of `_.merge` without support for multiple sources. 12177 * 12178 * @private 12179 * @param {Object} object The destination object. 12180 * @param {Object} source The source object. 12181 * @param {number} srcIndex The index of `source`. 12182 * @param {Function} [customizer] The function to customize merged values. 12183 * @param {Object} [stack] Tracks traversed source values and their merged 12184 * counterparts. 12185 */ 12186 function baseMerge(object, source, srcIndex, customizer, stack) { 12187 if (object === source) { 12188 return; 12189 } 12190 baseFor(source, function(srcValue, key) { 12191 stack || (stack = new Stack); 12192 if (isObject(srcValue)) { 12193 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); 12194 } 12195 else { 12196 var newValue = customizer 12197 ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) 12198 : undefined; 12199 12200 if (newValue === undefined) { 12201 newValue = srcValue; 12202 } 12203 assignMergeValue(object, key, newValue); 12204 } 12205 }, keysIn); 12206 } 12207 12208 /** 12209 * A specialized version of `baseMerge` for arrays and objects which performs 12210 * deep merges and tracks traversed objects enabling objects with circular 12211 * references to be merged. 12212 * 12213 * @private 12214 * @param {Object} object The destination object. 12215 * @param {Object} source The source object. 12216 * @param {string} key The key of the value to merge. 12217 * @param {number} srcIndex The index of `source`. 12218 * @param {Function} mergeFunc The function to merge values. 12219 * @param {Function} [customizer] The function to customize assigned values. 12220 * @param {Object} [stack] Tracks traversed source values and their merged 12221 * counterparts. 12222 */ 12223 function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { 12224 var objValue = safeGet(object, key), 12225 srcValue = safeGet(source, key), 12226 stacked = stack.get(srcValue); 12227 12228 if (stacked) { 12229 assignMergeValue(object, key, stacked); 12230 return; 12231 } 12232 var newValue = customizer 12233 ? customizer(objValue, srcValue, (key + ''), object, source, stack) 12234 : undefined; 12235 12236 var isCommon = newValue === undefined; 12237 12238 if (isCommon) { 12239 var isArr = isArray(srcValue), 12240 isBuff = !isArr && isBuffer(srcValue), 12241 isTyped = !isArr && !isBuff && isTypedArray(srcValue); 12242 12243 newValue = srcValue; 12244 if (isArr || isBuff || isTyped) { 12245 if (isArray(objValue)) { 12246 newValue = objValue; 12247 } 12248 else if (isArrayLikeObject(objValue)) { 12249 newValue = copyArray(objValue); 12250 } 12251 else if (isBuff) { 12252 isCommon = false; 12253 newValue = cloneBuffer(srcValue, true); 12254 } 12255 else if (isTyped) { 12256 isCommon = false; 12257 newValue = cloneTypedArray(srcValue, true); 12258 } 12259 else { 12260 newValue = []; 12261 } 12262 } 12263 else if (isPlainObject(srcValue) || isArguments(srcValue)) { 12264 newValue = objValue; 12265 if (isArguments(objValue)) { 12266 newValue = toPlainObject(objValue); 12267 } 12268 else if (!isObject(objValue) || isFunction(objValue)) { 12269 newValue = initCloneObject(srcValue); 12270 } 12271 } 12272 else { 12273 isCommon = false; 12274 } 12275 } 12276 if (isCommon) { 12277 // Recursively merge objects and arrays (susceptible to call stack limits). 12278 stack.set(srcValue, newValue); 12279 mergeFunc(newValue, srcValue, srcIndex, customizer, stack); 12280 stack['delete'](srcValue); 12281 } 12282 assignMergeValue(object, key, newValue); 12283 } 12284 12285 /** 12286 * The base implementation of `_.nth` which doesn't coerce arguments. 12287 * 12288 * @private 12289 * @param {Array} array The array to query. 12290 * @param {number} n The index of the element to return. 12291 * @returns {*} Returns the nth element of `array`. 12292 */ 12293 function baseNth(array, n) { 12294 var length = array.length; 12295 if (!length) { 12296 return; 12297 } 12298 n += n < 0 ? length : 0; 12299 return isIndex(n, length) ? array[n] : undefined; 12300 } 12301 12302 /** 12303 * The base implementation of `_.orderBy` without param guards. 12304 * 12305 * @private 12306 * @param {Array|Object} collection The collection to iterate over. 12307 * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. 12308 * @param {string[]} orders The sort orders of `iteratees`. 12309 * @returns {Array} Returns the new sorted array. 12310 */ 12311 function baseOrderBy(collection, iteratees, orders) { 12312 if (iteratees.length) { 12313 iteratees = arrayMap(iteratees, function(iteratee) { 12314 if (isArray(iteratee)) { 12315 return function(value) { 12316 return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); 12317 } 12318 } 12319 return iteratee; 12320 }); 12321 } else { 12322 iteratees = [identity]; 12323 } 12324 12325 var index = -1; 12326 iteratees = arrayMap(iteratees, baseUnary(getIteratee())); 12327 12328 var result = baseMap(collection, function(value, key, collection) { 12329 var criteria = arrayMap(iteratees, function(iteratee) { 12330 return iteratee(value); 12331 }); 12332 return { 'criteria': criteria, 'index': ++index, 'value': value }; 12333 }); 12334 12335 return baseSortBy(result, function(object, other) { 12336 return compareMultiple(object, other, orders); 12337 }); 12338 } 12339 12340 /** 12341 * The base implementation of `_.pick` without support for individual 12342 * property identifiers. 12343 * 12344 * @private 12345 * @param {Object} object The source object. 12346 * @param {string[]} paths The property paths to pick. 12347 * @returns {Object} Returns the new object. 12348 */ 12349 function basePick(object, paths) { 12350 return basePickBy(object, paths, function(value, path) { 12351 return hasIn(object, path); 12352 }); 12353 } 12354 12355 /** 12356 * The base implementation of `_.pickBy` without support for iteratee shorthands. 12357 * 12358 * @private 12359 * @param {Object} object The source object. 12360 * @param {string[]} paths The property paths to pick. 12361 * @param {Function} predicate The function invoked per property. 12362 * @returns {Object} Returns the new object. 12363 */ 12364 function basePickBy(object, paths, predicate) { 12365 var index = -1, 12366 length = paths.length, 12367 result = {}; 12368 12369 while (++index < length) { 12370 var path = paths[index], 12371 value = baseGet(object, path); 12372 12373 if (predicate(value, path)) { 12374 baseSet(result, castPath(path, object), value); 12375 } 12376 } 12377 return result; 12378 } 12379 12380 /** 12381 * A specialized version of `baseProperty` which supports deep paths. 12382 * 12383 * @private 12384 * @param {Array|string} path The path of the property to get. 12385 * @returns {Function} Returns the new accessor function. 12386 */ 12387 function basePropertyDeep(path) { 12388 return function(object) { 12389 return baseGet(object, path); 12390 }; 12391 } 12392 12393 /** 12394 * The base implementation of `_.pullAllBy` without support for iteratee 12395 * shorthands. 12396 * 12397 * @private 12398 * @param {Array} array The array to modify. 12399 * @param {Array} values The values to remove. 12400 * @param {Function} [iteratee] The iteratee invoked per element. 12401 * @param {Function} [comparator] The comparator invoked per element. 12402 * @returns {Array} Returns `array`. 12403 */ 12404 function basePullAll(array, values, iteratee, comparator) { 12405 var indexOf = comparator ? baseIndexOfWith : baseIndexOf, 12406 index = -1, 12407 length = values.length, 12408 seen = array; 12409 12410 if (array === values) { 12411 values = copyArray(values); 12412 } 12413 if (iteratee) { 12414 seen = arrayMap(array, baseUnary(iteratee)); 12415 } 12416 while (++index < length) { 12417 var fromIndex = 0, 12418 value = values[index], 12419 computed = iteratee ? iteratee(value) : value; 12420 12421 while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { 12422 if (seen !== array) { 12423 splice.call(seen, fromIndex, 1); 12424 } 12425 splice.call(array, fromIndex, 1); 12426 } 12427 } 12428 return array; 12429 } 12430 12431 /** 12432 * The base implementation of `_.pullAt` without support for individual 12433 * indexes or capturing the removed elements. 12434 * 12435 * @private 12436 * @param {Array} array The array to modify. 12437 * @param {number[]} indexes The indexes of elements to remove. 12438 * @returns {Array} Returns `array`. 12439 */ 12440 function basePullAt(array, indexes) { 12441 var length = array ? indexes.length : 0, 12442 lastIndex = length - 1; 12443 12444 while (length--) { 12445 var index = indexes[length]; 12446 if (length == lastIndex || index !== previous) { 12447 var previous = index; 12448 if (isIndex(index)) { 12449 splice.call(array, index, 1); 12450 } else { 12451 baseUnset(array, index); 12452 } 12453 } 12454 } 12455 return array; 12456 } 12457 12458 /** 12459 * The base implementation of `_.random` without support for returning 12460 * floating-point numbers. 12461 * 12462 * @private 12463 * @param {number} lower The lower bound. 12464 * @param {number} upper The upper bound. 12465 * @returns {number} Returns the random number. 12466 */ 12467 function baseRandom(lower, upper) { 12468 return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); 12469 } 12470 12471 /** 12472 * The base implementation of `_.range` and `_.rangeRight` which doesn't 12473 * coerce arguments. 12474 * 12475 * @private 12476 * @param {number} start The start of the range. 12477 * @param {number} end The end of the range. 12478 * @param {number} step The value to increment or decrement by. 12479 * @param {boolean} [fromRight] Specify iterating from right to left. 12480 * @returns {Array} Returns the range of numbers. 12481 */ 12482 function baseRange(start, end, step, fromRight) { 12483 var index = -1, 12484 length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), 12485 result = Array(length); 12486 12487 while (length--) { 12488 result[fromRight ? length : ++index] = start; 12489 start += step; 12490 } 12491 return result; 12492 } 12493 12494 /** 12495 * The base implementation of `_.repeat` which doesn't coerce arguments. 12496 * 12497 * @private 12498 * @param {string} string The string to repeat. 12499 * @param {number} n The number of times to repeat the string. 12500 * @returns {string} Returns the repeated string. 12501 */ 12502 function baseRepeat(string, n) { 12503 var result = ''; 12504 if (!string || n < 1 || n > MAX_SAFE_INTEGER) { 12505 return result; 12506 } 12507 // Leverage the exponentiation by squaring algorithm for a faster repeat. 12508 // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. 12509 do { 12510 if (n % 2) { 12511 result += string; 12512 } 12513 n = nativeFloor(n / 2); 12514 if (n) { 12515 string += string; 12516 } 12517 } while (n); 12518 12519 return result; 12520 } 12521 12522 /** 12523 * The base implementation of `_.rest` which doesn't validate or coerce arguments. 12524 * 12525 * @private 12526 * @param {Function} func The function to apply a rest parameter to. 12527 * @param {number} [start=func.length-1] The start position of the rest parameter. 12528 * @returns {Function} Returns the new function. 12529 */ 12530 function baseRest(func, start) { 12531 return setToString(overRest(func, start, identity), func + ''); 12532 } 12533 12534 /** 12535 * The base implementation of `_.sample`. 12536 * 12537 * @private 12538 * @param {Array|Object} collection The collection to sample. 12539 * @returns {*} Returns the random element. 12540 */ 12541 function baseSample(collection) { 12542 return arraySample(values(collection)); 12543 } 12544 12545 /** 12546 * The base implementation of `_.sampleSize` without param guards. 12547 * 12548 * @private 12549 * @param {Array|Object} collection The collection to sample. 12550 * @param {number} n The number of elements to sample. 12551 * @returns {Array} Returns the random elements. 12552 */ 12553 function baseSampleSize(collection, n) { 12554 var array = values(collection); 12555 return shuffleSelf(array, baseClamp(n, 0, array.length)); 12556 } 12557 12558 /** 12559 * The base implementation of `_.set`. 12560 * 12561 * @private 12562 * @param {Object} object The object to modify. 12563 * @param {Array|string} path The path of the property to set. 12564 * @param {*} value The value to set. 12565 * @param {Function} [customizer] The function to customize path creation. 12566 * @returns {Object} Returns `object`. 12567 */ 12568 function baseSet(object, path, value, customizer) { 12569 if (!isObject(object)) { 12570 return object; 12571 } 12572 path = castPath(path, object); 12573 12574 var index = -1, 12575 length = path.length, 12576 lastIndex = length - 1, 12577 nested = object; 12578 12579 while (nested != null && ++index < length) { 12580 var key = toKey(path[index]), 12581 newValue = value; 12582 12583 if (key === '__proto__' || key === 'constructor' || key === 'prototype') { 12584 return object; 12585 } 12586 12587 if (index != lastIndex) { 12588 var objValue = nested[key]; 12589 newValue = customizer ? customizer(objValue, key, nested) : undefined; 12590 if (newValue === undefined) { 12591 newValue = isObject(objValue) 12592 ? objValue 12593 : (isIndex(path[index + 1]) ? [] : {}); 12594 } 12595 } 12596 assignValue(nested, key, newValue); 12597 nested = nested[key]; 12598 } 12599 return object; 12600 } 12601 12602 /** 12603 * The base implementation of `setData` without support for hot loop shorting. 12604 * 12605 * @private 12606 * @param {Function} func The function to associate metadata with. 12607 * @param {*} data The metadata. 12608 * @returns {Function} Returns `func`. 12609 */ 12610 var baseSetData = !metaMap ? identity : function(func, data) { 12611 metaMap.set(func, data); 12612 return func; 12613 }; 12614 12615 /** 12616 * The base implementation of `setToString` without support for hot loop shorting. 12617 * 12618 * @private 12619 * @param {Function} func The function to modify. 12620 * @param {Function} string The `toString` result. 12621 * @returns {Function} Returns `func`. 12622 */ 12623 var baseSetToString = !defineProperty ? identity : function(func, string) { 12624 return defineProperty(func, 'toString', { 12625 'configurable': true, 12626 'enumerable': false, 12627 'value': constant(string), 12628 'writable': true 12629 }); 12630 }; 12631 12632 /** 12633 * The base implementation of `_.shuffle`. 12634 * 12635 * @private 12636 * @param {Array|Object} collection The collection to shuffle. 12637 * @returns {Array} Returns the new shuffled array. 12638 */ 12639 function baseShuffle(collection) { 12640 return shuffleSelf(values(collection)); 12641 } 12642 12643 /** 12644 * The base implementation of `_.slice` without an iteratee call guard. 12645 * 12646 * @private 12647 * @param {Array} array The array to slice. 12648 * @param {number} [start=0] The start position. 12649 * @param {number} [end=array.length] The end position. 12650 * @returns {Array} Returns the slice of `array`. 12651 */ 12652 function baseSlice(array, start, end) { 12653 var index = -1, 12654 length = array.length; 12655 12656 if (start < 0) { 12657 start = -start > length ? 0 : (length + start); 12658 } 12659 end = end > length ? length : end; 12660 if (end < 0) { 12661 end += length; 12662 } 12663 length = start > end ? 0 : ((end - start) >>> 0); 12664 start >>>= 0; 12665 12666 var result = Array(length); 12667 while (++index < length) { 12668 result[index] = array[index + start]; 12669 } 12670 return result; 12671 } 12672 12673 /** 12674 * The base implementation of `_.some` without support for iteratee shorthands. 12675 * 12676 * @private 12677 * @param {Array|Object} collection The collection to iterate over. 12678 * @param {Function} predicate The function invoked per iteration. 12679 * @returns {boolean} Returns `true` if any element passes the predicate check, 12680 * else `false`. 12681 */ 12682 function baseSome(collection, predicate) { 12683 var result; 12684 12685 baseEach(collection, function(value, index, collection) { 12686 result = predicate(value, index, collection); 12687 return !result; 12688 }); 12689 return !!result; 12690 } 12691 12692 /** 12693 * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which 12694 * performs a binary search of `array` to determine the index at which `value` 12695 * should be inserted into `array` in order to maintain its sort order. 12696 * 12697 * @private 12698 * @param {Array} array The sorted array to inspect. 12699 * @param {*} value The value to evaluate. 12700 * @param {boolean} [retHighest] Specify returning the highest qualified index. 12701 * @returns {number} Returns the index at which `value` should be inserted 12702 * into `array`. 12703 */ 12704 function baseSortedIndex(array, value, retHighest) { 12705 var low = 0, 12706 high = array == null ? low : array.length; 12707 12708 if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { 12709 while (low < high) { 12710 var mid = (low + high) >>> 1, 12711 computed = array[mid]; 12712 12713 if (computed !== null && !isSymbol(computed) && 12714 (retHighest ? (computed <= value) : (computed < value))) { 12715 low = mid + 1; 12716 } else { 12717 high = mid; 12718 } 12719 } 12720 return high; 12721 } 12722 return baseSortedIndexBy(array, value, identity, retHighest); 12723 } 12724 12725 /** 12726 * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` 12727 * which invokes `iteratee` for `value` and each element of `array` to compute 12728 * their sort ranking. The iteratee is invoked with one argument; (value). 12729 * 12730 * @private 12731 * @param {Array} array The sorted array to inspect. 12732 * @param {*} value The value to evaluate. 12733 * @param {Function} iteratee The iteratee invoked per element. 12734 * @param {boolean} [retHighest] Specify returning the highest qualified index. 12735 * @returns {number} Returns the index at which `value` should be inserted 12736 * into `array`. 12737 */ 12738 function baseSortedIndexBy(array, value, iteratee, retHighest) { 12739 var low = 0, 12740 high = array == null ? 0 : array.length; 12741 if (high === 0) { 12742 return 0; 12743 } 12744 12745 value = iteratee(value); 12746 var valIsNaN = value !== value, 12747 valIsNull = value === null, 12748 valIsSymbol = isSymbol(value), 12749 valIsUndefined = value === undefined; 12750 12751 while (low < high) { 12752 var mid = nativeFloor((low + high) / 2), 12753 computed = iteratee(array[mid]), 12754 othIsDefined = computed !== undefined, 12755 othIsNull = computed === null, 12756 othIsReflexive = computed === computed, 12757 othIsSymbol = isSymbol(computed); 12758 12759 if (valIsNaN) { 12760 var setLow = retHighest || othIsReflexive; 12761 } else if (valIsUndefined) { 12762 setLow = othIsReflexive && (retHighest || othIsDefined); 12763 } else if (valIsNull) { 12764 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); 12765 } else if (valIsSymbol) { 12766 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); 12767 } else if (othIsNull || othIsSymbol) { 12768 setLow = false; 12769 } else { 12770 setLow = retHighest ? (computed <= value) : (computed < value); 12771 } 12772 if (setLow) { 12773 low = mid + 1; 12774 } else { 12775 high = mid; 12776 } 12777 } 12778 return nativeMin(high, MAX_ARRAY_INDEX); 12779 } 12780 12781 /** 12782 * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without 12783 * support for iteratee shorthands. 12784 * 12785 * @private 12786 * @param {Array} array The array to inspect. 12787 * @param {Function} [iteratee] The iteratee invoked per element. 12788 * @returns {Array} Returns the new duplicate free array. 12789 */ 12790 function baseSortedUniq(array, iteratee) { 12791 var index = -1, 12792 length = array.length, 12793 resIndex = 0, 12794 result = []; 12795 12796 while (++index < length) { 12797 var value = array[index], 12798 computed = iteratee ? iteratee(value) : value; 12799 12800 if (!index || !eq(computed, seen)) { 12801 var seen = computed; 12802 result[resIndex++] = value === 0 ? 0 : value; 12803 } 12804 } 12805 return result; 12806 } 12807 12808 /** 12809 * The base implementation of `_.toNumber` which doesn't ensure correct 12810 * conversions of binary, hexadecimal, or octal string values. 12811 * 12812 * @private 12813 * @param {*} value The value to process. 12814 * @returns {number} Returns the number. 12815 */ 12816 function baseToNumber(value) { 12817 if (typeof value == 'number') { 12818 return value; 12819 } 12820 if (isSymbol(value)) { 12821 return NAN; 12822 } 12823 return +value; 12824 } 12825 12826 /** 12827 * The base implementation of `_.toString` which doesn't convert nullish 12828 * values to empty strings. 12829 * 12830 * @private 12831 * @param {*} value The value to process. 12832 * @returns {string} Returns the string. 12833 */ 12834 function baseToString(value) { 12835 // Exit early for strings to avoid a performance hit in some environments. 12836 if (typeof value == 'string') { 12837 return value; 12838 } 12839 if (isArray(value)) { 12840 // Recursively convert values (susceptible to call stack limits). 12841 return arrayMap(value, baseToString) + ''; 12842 } 12843 if (isSymbol(value)) { 12844 return symbolToString ? symbolToString.call(value) : ''; 12845 } 12846 var result = (value + ''); 12847 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; 12848 } 12849 12850 /** 12851 * The base implementation of `_.uniqBy` without support for iteratee shorthands. 12852 * 12853 * @private 12854 * @param {Array} array The array to inspect. 12855 * @param {Function} [iteratee] The iteratee invoked per element. 12856 * @param {Function} [comparator] The comparator invoked per element. 12857 * @returns {Array} Returns the new duplicate free array. 12858 */ 12859 function baseUniq(array, iteratee, comparator) { 12860 var index = -1, 12861 includes = arrayIncludes, 12862 length = array.length, 12863 isCommon = true, 12864 result = [], 12865 seen = result; 12866 12867 if (comparator) { 12868 isCommon = false; 12869 includes = arrayIncludesWith; 12870 } 12871 else if (length >= LARGE_ARRAY_SIZE) { 12872 var set = iteratee ? null : createSet(array); 12873 if (set) { 12874 return setToArray(set); 12875 } 12876 isCommon = false; 12877 includes = cacheHas; 12878 seen = new SetCache; 12879 } 12880 else { 12881 seen = iteratee ? [] : result; 12882 } 12883 outer: 12884 while (++index < length) { 12885 var value = array[index], 12886 computed = iteratee ? iteratee(value) : value; 12887 12888 value = (comparator || value !== 0) ? value : 0; 12889 if (isCommon && computed === computed) { 12890 var seenIndex = seen.length; 12891 while (seenIndex--) { 12892 if (seen[seenIndex] === computed) { 12893 continue outer; 12894 } 12895 } 12896 if (iteratee) { 12897 seen.push(computed); 12898 } 12899 result.push(value); 12900 } 12901 else if (!includes(seen, computed, comparator)) { 12902 if (seen !== result) { 12903 seen.push(computed); 12904 } 12905 result.push(value); 12906 } 12907 } 12908 return result; 12909 } 12910 12911 /** 12912 * The base implementation of `_.unset`. 12913 * 12914 * @private 12915 * @param {Object} object The object to modify. 12916 * @param {Array|string} path The property path to unset. 12917 * @returns {boolean} Returns `true` if the property is deleted, else `false`. 12918 */ 12919 function baseUnset(object, path) { 12920 path = castPath(path, object); 12921 object = parent(object, path); 12922 return object == null || delete object[toKey(last(path))]; 12923 } 12924 12925 /** 12926 * The base implementation of `_.update`. 12927 * 12928 * @private 12929 * @param {Object} object The object to modify. 12930 * @param {Array|string} path The path of the property to update. 12931 * @param {Function} updater The function to produce the updated value. 12932 * @param {Function} [customizer] The function to customize path creation. 12933 * @returns {Object} Returns `object`. 12934 */ 12935 function baseUpdate(object, path, updater, customizer) { 12936 return baseSet(object, path, updater(baseGet(object, path)), customizer); 12937 } 12938 12939 /** 12940 * The base implementation of methods like `_.dropWhile` and `_.takeWhile` 12941 * without support for iteratee shorthands. 12942 * 12943 * @private 12944 * @param {Array} array The array to query. 12945 * @param {Function} predicate The function invoked per iteration. 12946 * @param {boolean} [isDrop] Specify dropping elements instead of taking them. 12947 * @param {boolean} [fromRight] Specify iterating from right to left. 12948 * @returns {Array} Returns the slice of `array`. 12949 */ 12950 function baseWhile(array, predicate, isDrop, fromRight) { 12951 var length = array.length, 12952 index = fromRight ? length : -1; 12953 12954 while ((fromRight ? index-- : ++index < length) && 12955 predicate(array[index], index, array)) {} 12956 12957 return isDrop 12958 ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) 12959 : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); 12960 } 12961 12962 /** 12963 * The base implementation of `wrapperValue` which returns the result of 12964 * performing a sequence of actions on the unwrapped `value`, where each 12965 * successive action is supplied the return value of the previous. 12966 * 12967 * @private 12968 * @param {*} value The unwrapped value. 12969 * @param {Array} actions Actions to perform to resolve the unwrapped value. 12970 * @returns {*} Returns the resolved value. 12971 */ 12972 function baseWrapperValue(value, actions) { 12973 var result = value; 12974 if (result instanceof LazyWrapper) { 12975 result = result.value(); 12976 } 12977 return arrayReduce(actions, function(result, action) { 12978 return action.func.apply(action.thisArg, arrayPush([result], action.args)); 12979 }, result); 12980 } 12981 12982 /** 12983 * The base implementation of methods like `_.xor`, without support for 12984 * iteratee shorthands, that accepts an array of arrays to inspect. 12985 * 12986 * @private 12987 * @param {Array} arrays The arrays to inspect. 12988 * @param {Function} [iteratee] The iteratee invoked per element. 12989 * @param {Function} [comparator] The comparator invoked per element. 12990 * @returns {Array} Returns the new array of values. 12991 */ 12992 function baseXor(arrays, iteratee, comparator) { 12993 var length = arrays.length; 12994 if (length < 2) { 12995 return length ? baseUniq(arrays[0]) : []; 12996 } 12997 var index = -1, 12998 result = Array(length); 12999 13000 while (++index < length) { 13001 var array = arrays[index], 13002 othIndex = -1; 13003 13004 while (++othIndex < length) { 13005 if (othIndex != index) { 13006 result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); 13007 } 13008 } 13009 } 13010 return baseUniq(baseFlatten(result, 1), iteratee, comparator); 13011 } 13012 13013 /** 13014 * This base implementation of `_.zipObject` which assigns values using `assignFunc`. 13015 * 13016 * @private 13017 * @param {Array} props The property identifiers. 13018 * @param {Array} values The property values. 13019 * @param {Function} assignFunc The function to assign values. 13020 * @returns {Object} Returns the new object. 13021 */ 13022 function baseZipObject(props, values, assignFunc) { 13023 var index = -1, 13024 length = props.length, 13025 valsLength = values.length, 13026 result = {}; 13027 13028 while (++index < length) { 13029 var value = index < valsLength ? values[index] : undefined; 13030 assignFunc(result, props[index], value); 13031 } 13032 return result; 13033 } 13034 13035 /** 13036 * Casts `value` to an empty array if it's not an array like object. 13037 * 13038 * @private 13039 * @param {*} value The value to inspect. 13040 * @returns {Array|Object} Returns the cast array-like object. 13041 */ 13042 function castArrayLikeObject(value) { 13043 return isArrayLikeObject(value) ? value : []; 13044 } 13045 13046 /** 13047 * Casts `value` to `identity` if it's not a function. 13048 * 13049 * @private 13050 * @param {*} value The value to inspect. 13051 * @returns {Function} Returns cast function. 13052 */ 13053 function castFunction(value) { 13054 return typeof value == 'function' ? value : identity; 13055 } 13056 13057 /** 13058 * Casts `value` to a path array if it's not one. 13059 * 13060 * @private 13061 * @param {*} value The value to inspect. 13062 * @param {Object} [object] The object to query keys on. 13063 * @returns {Array} Returns the cast property path array. 13064 */ 13065 function castPath(value, object) { 13066 if (isArray(value)) { 13067 return value; 13068 } 13069 return isKey(value, object) ? [value] : stringToPath(toString(value)); 13070 } 13071 13072 /** 13073 * A `baseRest` alias which can be replaced with `identity` by module 13074 * replacement plugins. 13075 * 13076 * @private 13077 * @type {Function} 13078 * @param {Function} func The function to apply a rest parameter to. 13079 * @returns {Function} Returns the new function. 13080 */ 13081 var castRest = baseRest; 13082 13083 /** 13084 * Casts `array` to a slice if it's needed. 13085 * 13086 * @private 13087 * @param {Array} array The array to inspect. 13088 * @param {number} start The start position. 13089 * @param {number} [end=array.length] The end position. 13090 * @returns {Array} Returns the cast slice. 13091 */ 13092 function castSlice(array, start, end) { 13093 var length = array.length; 13094 end = end === undefined ? length : end; 13095 return (!start && end >= length) ? array : baseSlice(array, start, end); 13096 } 13097 13098 /** 13099 * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout). 13100 * 13101 * @private 13102 * @param {number|Object} id The timer id or timeout object of the timer to clear. 13103 */ 13104 var clearTimeout = ctxClearTimeout || function(id) { 13105 return root.clearTimeout(id); 13106 }; 13107 13108 /** 13109 * Creates a clone of `buffer`. 13110 * 13111 * @private 13112 * @param {Buffer} buffer The buffer to clone. 13113 * @param {boolean} [isDeep] Specify a deep clone. 13114 * @returns {Buffer} Returns the cloned buffer. 13115 */ 13116 function cloneBuffer(buffer, isDeep) { 13117 if (isDeep) { 13118 return buffer.slice(); 13119 } 13120 var length = buffer.length, 13121 result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); 13122 13123 buffer.copy(result); 13124 return result; 13125 } 13126 13127 /** 13128 * Creates a clone of `arrayBuffer`. 13129 * 13130 * @private 13131 * @param {ArrayBuffer} arrayBuffer The array buffer to clone. 13132 * @returns {ArrayBuffer} Returns the cloned array buffer. 13133 */ 13134 function cloneArrayBuffer(arrayBuffer) { 13135 var result = new arrayBuffer.constructor(arrayBuffer.byteLength); 13136 new Uint8Array(result).set(new Uint8Array(arrayBuffer)); 13137 return result; 13138 } 13139 13140 /** 13141 * Creates a clone of `dataView`. 13142 * 13143 * @private 13144 * @param {Object} dataView The data view to clone. 13145 * @param {boolean} [isDeep] Specify a deep clone. 13146 * @returns {Object} Returns the cloned data view. 13147 */ 13148 function cloneDataView(dataView, isDeep) { 13149 var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; 13150 return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); 13151 } 13152 13153 /** 13154 * Creates a clone of `regexp`. 13155 * 13156 * @private 13157 * @param {Object} regexp The regexp to clone. 13158 * @returns {Object} Returns the cloned regexp. 13159 */ 13160 function cloneRegExp(regexp) { 13161 var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); 13162 result.lastIndex = regexp.lastIndex; 13163 return result; 13164 } 13165 13166 /** 13167 * Creates a clone of the `symbol` object. 13168 * 13169 * @private 13170 * @param {Object} symbol The symbol object to clone. 13171 * @returns {Object} Returns the cloned symbol object. 13172 */ 13173 function cloneSymbol(symbol) { 13174 return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; 13175 } 13176 13177 /** 13178 * Creates a clone of `typedArray`. 13179 * 13180 * @private 13181 * @param {Object} typedArray The typed array to clone. 13182 * @param {boolean} [isDeep] Specify a deep clone. 13183 * @returns {Object} Returns the cloned typed array. 13184 */ 13185 function cloneTypedArray(typedArray, isDeep) { 13186 var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; 13187 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); 13188 } 13189 13190 /** 13191 * Compares values to sort them in ascending order. 13192 * 13193 * @private 13194 * @param {*} value The value to compare. 13195 * @param {*} other The other value to compare. 13196 * @returns {number} Returns the sort order indicator for `value`. 13197 */ 13198 function compareAscending(value, other) { 13199 if (value !== other) { 13200 var valIsDefined = value !== undefined, 13201 valIsNull = value === null, 13202 valIsReflexive = value === value, 13203 valIsSymbol = isSymbol(value); 13204 13205 var othIsDefined = other !== undefined, 13206 othIsNull = other === null, 13207 othIsReflexive = other === other, 13208 othIsSymbol = isSymbol(other); 13209 13210 if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || 13211 (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || 13212 (valIsNull && othIsDefined && othIsReflexive) || 13213 (!valIsDefined && othIsReflexive) || 13214 !valIsReflexive) { 13215 return 1; 13216 } 13217 if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || 13218 (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || 13219 (othIsNull && valIsDefined && valIsReflexive) || 13220 (!othIsDefined && valIsReflexive) || 13221 !othIsReflexive) { 13222 return -1; 13223 } 13224 } 13225 return 0; 13226 } 13227 13228 /** 13229 * Used by `_.orderBy` to compare multiple properties of a value to another 13230 * and stable sort them. 13231 * 13232 * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, 13233 * specify an order of "desc" for descending or "asc" for ascending sort order 13234 * of corresponding values. 13235 * 13236 * @private 13237 * @param {Object} object The object to compare. 13238 * @param {Object} other The other object to compare. 13239 * @param {boolean[]|string[]} orders The order to sort by for each property. 13240 * @returns {number} Returns the sort order indicator for `object`. 13241 */ 13242 function compareMultiple(object, other, orders) { 13243 var index = -1, 13244 objCriteria = object.criteria, 13245 othCriteria = other.criteria, 13246 length = objCriteria.length, 13247 ordersLength = orders.length; 13248 13249 while (++index < length) { 13250 var result = compareAscending(objCriteria[index], othCriteria[index]); 13251 if (result) { 13252 if (index >= ordersLength) { 13253 return result; 13254 } 13255 var order = orders[index]; 13256 return result * (order == 'desc' ? -1 : 1); 13257 } 13258 } 13259 // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications 13260 // that causes it, under certain circumstances, to provide the same value for 13261 // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 13262 // for more details. 13263 // 13264 // This also ensures a stable sort in V8 and other engines. 13265 // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. 13266 return object.index - other.index; 13267 } 13268 13269 /** 13270 * Creates an array that is the composition of partially applied arguments, 13271 * placeholders, and provided arguments into a single array of arguments. 13272 * 13273 * @private 13274 * @param {Array} args The provided arguments. 13275 * @param {Array} partials The arguments to prepend to those provided. 13276 * @param {Array} holders The `partials` placeholder indexes. 13277 * @params {boolean} [isCurried] Specify composing for a curried function. 13278 * @returns {Array} Returns the new array of composed arguments. 13279 */ 13280 function composeArgs(args, partials, holders, isCurried) { 13281 var argsIndex = -1, 13282 argsLength = args.length, 13283 holdersLength = holders.length, 13284 leftIndex = -1, 13285 leftLength = partials.length, 13286 rangeLength = nativeMax(argsLength - holdersLength, 0), 13287 result = Array(leftLength + rangeLength), 13288 isUncurried = !isCurried; 13289 13290 while (++leftIndex < leftLength) { 13291 result[leftIndex] = partials[leftIndex]; 13292 } 13293 while (++argsIndex < holdersLength) { 13294 if (isUncurried || argsIndex < argsLength) { 13295 result[holders[argsIndex]] = args[argsIndex]; 13296 } 13297 } 13298 while (rangeLength--) { 13299 result[leftIndex++] = args[argsIndex++]; 13300 } 13301 return result; 13302 } 13303 13304 /** 13305 * This function is like `composeArgs` except that the arguments composition 13306 * is tailored for `_.partialRight`. 13307 * 13308 * @private 13309 * @param {Array} args The provided arguments. 13310 * @param {Array} partials The arguments to append to those provided. 13311 * @param {Array} holders The `partials` placeholder indexes. 13312 * @params {boolean} [isCurried] Specify composing for a curried function. 13313 * @returns {Array} Returns the new array of composed arguments. 13314 */ 13315 function composeArgsRight(args, partials, holders, isCurried) { 13316 var argsIndex = -1, 13317 argsLength = args.length, 13318 holdersIndex = -1, 13319 holdersLength = holders.length, 13320 rightIndex = -1, 13321 rightLength = partials.length, 13322 rangeLength = nativeMax(argsLength - holdersLength, 0), 13323 result = Array(rangeLength + rightLength), 13324 isUncurried = !isCurried; 13325 13326 while (++argsIndex < rangeLength) { 13327 result[argsIndex] = args[argsIndex]; 13328 } 13329 var offset = argsIndex; 13330 while (++rightIndex < rightLength) { 13331 result[offset + rightIndex] = partials[rightIndex]; 13332 } 13333 while (++holdersIndex < holdersLength) { 13334 if (isUncurried || argsIndex < argsLength) { 13335 result[offset + holders[holdersIndex]] = args[argsIndex++]; 13336 } 13337 } 13338 return result; 13339 } 13340 13341 /** 13342 * Copies the values of `source` to `array`. 13343 * 13344 * @private 13345 * @param {Array} source The array to copy values from. 13346 * @param {Array} [array=[]] The array to copy values to. 13347 * @returns {Array} Returns `array`. 13348 */ 13349 function copyArray(source, array) { 13350 var index = -1, 13351 length = source.length; 13352 13353 array || (array = Array(length)); 13354 while (++index < length) { 13355 array[index] = source[index]; 13356 } 13357 return array; 13358 } 13359 13360 /** 13361 * Copies properties of `source` to `object`. 13362 * 13363 * @private 13364 * @param {Object} source The object to copy properties from. 13365 * @param {Array} props The property identifiers to copy. 13366 * @param {Object} [object={}] The object to copy properties to. 13367 * @param {Function} [customizer] The function to customize copied values. 13368 * @returns {Object} Returns `object`. 13369 */ 13370 function copyObject(source, props, object, customizer) { 13371 var isNew = !object; 13372 object || (object = {}); 13373 13374 var index = -1, 13375 length = props.length; 13376 13377 while (++index < length) { 13378 var key = props[index]; 13379 13380 var newValue = customizer 13381 ? customizer(object[key], source[key], key, object, source) 13382 : undefined; 13383 13384 if (newValue === undefined) { 13385 newValue = source[key]; 13386 } 13387 if (isNew) { 13388 baseAssignValue(object, key, newValue); 13389 } else { 13390 assignValue(object, key, newValue); 13391 } 13392 } 13393 return object; 13394 } 13395 13396 /** 13397 * Copies own symbols of `source` to `object`. 13398 * 13399 * @private 13400 * @param {Object} source The object to copy symbols from. 13401 * @param {Object} [object={}] The object to copy symbols to. 13402 * @returns {Object} Returns `object`. 13403 */ 13404 function copySymbols(source, object) { 13405 return copyObject(source, getSymbols(source), object); 13406 } 13407 13408 /** 13409 * Copies own and inherited symbols of `source` to `object`. 13410 * 13411 * @private 13412 * @param {Object} source The object to copy symbols from. 13413 * @param {Object} [object={}] The object to copy symbols to. 13414 * @returns {Object} Returns `object`. 13415 */ 13416 function copySymbolsIn(source, object) { 13417 return copyObject(source, getSymbolsIn(source), object); 13418 } 13419 13420 /** 13421 * Creates a function like `_.groupBy`. 13422 * 13423 * @private 13424 * @param {Function} setter The function to set accumulator values. 13425 * @param {Function} [initializer] The accumulator object initializer. 13426 * @returns {Function} Returns the new aggregator function. 13427 */ 13428 function createAggregator(setter, initializer) { 13429 return function(collection, iteratee) { 13430 var func = isArray(collection) ? arrayAggregator : baseAggregator, 13431 accumulator = initializer ? initializer() : {}; 13432 13433 return func(collection, setter, getIteratee(iteratee, 2), accumulator); 13434 }; 13435 } 13436 13437 /** 13438 * Creates a function like `_.assign`. 13439 * 13440 * @private 13441 * @param {Function} assigner The function to assign values. 13442 * @returns {Function} Returns the new assigner function. 13443 */ 13444 function createAssigner(assigner) { 13445 return baseRest(function(object, sources) { 13446 var index = -1, 13447 length = sources.length, 13448 customizer = length > 1 ? sources[length - 1] : undefined, 13449 guard = length > 2 ? sources[2] : undefined; 13450 13451 customizer = (assigner.length > 3 && typeof customizer == 'function') 13452 ? (length--, customizer) 13453 : undefined; 13454 13455 if (guard && isIterateeCall(sources[0], sources[1], guard)) { 13456 customizer = length < 3 ? undefined : customizer; 13457 length = 1; 13458 } 13459 object = Object(object); 13460 while (++index < length) { 13461 var source = sources[index]; 13462 if (source) { 13463 assigner(object, source, index, customizer); 13464 } 13465 } 13466 return object; 13467 }); 13468 } 13469 13470 /** 13471 * Creates a `baseEach` or `baseEachRight` function. 13472 * 13473 * @private 13474 * @param {Function} eachFunc The function to iterate over a collection. 13475 * @param {boolean} [fromRight] Specify iterating from right to left. 13476 * @returns {Function} Returns the new base function. 13477 */ 13478 function createBaseEach(eachFunc, fromRight) { 13479 return function(collection, iteratee) { 13480 if (collection == null) { 13481 return collection; 13482 } 13483 if (!isArrayLike(collection)) { 13484 return eachFunc(collection, iteratee); 13485 } 13486 var length = collection.length, 13487 index = fromRight ? length : -1, 13488 iterable = Object(collection); 13489 13490 while ((fromRight ? index-- : ++index < length)) { 13491 if (iteratee(iterable[index], index, iterable) === false) { 13492 break; 13493 } 13494 } 13495 return collection; 13496 }; 13497 } 13498 13499 /** 13500 * Creates a base function for methods like `_.forIn` and `_.forOwn`. 13501 * 13502 * @private 13503 * @param {boolean} [fromRight] Specify iterating from right to left. 13504 * @returns {Function} Returns the new base function. 13505 */ 13506 function createBaseFor(fromRight) { 13507 return function(object, iteratee, keysFunc) { 13508 var index = -1, 13509 iterable = Object(object), 13510 props = keysFunc(object), 13511 length = props.length; 13512 13513 while (length--) { 13514 var key = props[fromRight ? length : ++index]; 13515 if (iteratee(iterable[key], key, iterable) === false) { 13516 break; 13517 } 13518 } 13519 return object; 13520 }; 13521 } 13522 13523 /** 13524 * Creates a function that wraps `func` to invoke it with the optional `this` 13525 * binding of `thisArg`. 13526 * 13527 * @private 13528 * @param {Function} func The function to wrap. 13529 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 13530 * @param {*} [thisArg] The `this` binding of `func`. 13531 * @returns {Function} Returns the new wrapped function. 13532 */ 13533 function createBind(func, bitmask, thisArg) { 13534 var isBind = bitmask & WRAP_BIND_FLAG, 13535 Ctor = createCtor(func); 13536 13537 function wrapper() { 13538 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 13539 return fn.apply(isBind ? thisArg : this, arguments); 13540 } 13541 return wrapper; 13542 } 13543 13544 /** 13545 * Creates a function like `_.lowerFirst`. 13546 * 13547 * @private 13548 * @param {string} methodName The name of the `String` case method to use. 13549 * @returns {Function} Returns the new case function. 13550 */ 13551 function createCaseFirst(methodName) { 13552 return function(string) { 13553 string = toString(string); 13554 13555 var strSymbols = hasUnicode(string) 13556 ? stringToArray(string) 13557 : undefined; 13558 13559 var chr = strSymbols 13560 ? strSymbols[0] 13561 : string.charAt(0); 13562 13563 var trailing = strSymbols 13564 ? castSlice(strSymbols, 1).join('') 13565 : string.slice(1); 13566 13567 return chr[methodName]() + trailing; 13568 }; 13569 } 13570 13571 /** 13572 * Creates a function like `_.camelCase`. 13573 * 13574 * @private 13575 * @param {Function} callback The function to combine each word. 13576 * @returns {Function} Returns the new compounder function. 13577 */ 13578 function createCompounder(callback) { 13579 return function(string) { 13580 return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); 13581 }; 13582 } 13583 13584 /** 13585 * Creates a function that produces an instance of `Ctor` regardless of 13586 * whether it was invoked as part of a `new` expression or by `call` or `apply`. 13587 * 13588 * @private 13589 * @param {Function} Ctor The constructor to wrap. 13590 * @returns {Function} Returns the new wrapped function. 13591 */ 13592 function createCtor(Ctor) { 13593 return function() { 13594 // Use a `switch` statement to work with class constructors. See 13595 // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist 13596 // for more details. 13597 var args = arguments; 13598 switch (args.length) { 13599 case 0: return new Ctor; 13600 case 1: return new Ctor(args[0]); 13601 case 2: return new Ctor(args[0], args[1]); 13602 case 3: return new Ctor(args[0], args[1], args[2]); 13603 case 4: return new Ctor(args[0], args[1], args[2], args[3]); 13604 case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); 13605 case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); 13606 case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); 13607 } 13608 var thisBinding = baseCreate(Ctor.prototype), 13609 result = Ctor.apply(thisBinding, args); 13610 13611 // Mimic the constructor's `return` behavior. 13612 // See https://es5.github.io/#x13.2.2 for more details. 13613 return isObject(result) ? result : thisBinding; 13614 }; 13615 } 13616 13617 /** 13618 * Creates a function that wraps `func` to enable currying. 13619 * 13620 * @private 13621 * @param {Function} func The function to wrap. 13622 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 13623 * @param {number} arity The arity of `func`. 13624 * @returns {Function} Returns the new wrapped function. 13625 */ 13626 function createCurry(func, bitmask, arity) { 13627 var Ctor = createCtor(func); 13628 13629 function wrapper() { 13630 var length = arguments.length, 13631 args = Array(length), 13632 index = length, 13633 placeholder = getHolder(wrapper); 13634 13635 while (index--) { 13636 args[index] = arguments[index]; 13637 } 13638 var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) 13639 ? [] 13640 : replaceHolders(args, placeholder); 13641 13642 length -= holders.length; 13643 if (length < arity) { 13644 return createRecurry( 13645 func, bitmask, createHybrid, wrapper.placeholder, undefined, 13646 args, holders, undefined, undefined, arity - length); 13647 } 13648 var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 13649 return apply(fn, this, args); 13650 } 13651 return wrapper; 13652 } 13653 13654 /** 13655 * Creates a `_.find` or `_.findLast` function. 13656 * 13657 * @private 13658 * @param {Function} findIndexFunc The function to find the collection index. 13659 * @returns {Function} Returns the new find function. 13660 */ 13661 function createFind(findIndexFunc) { 13662 return function(collection, predicate, fromIndex) { 13663 var iterable = Object(collection); 13664 if (!isArrayLike(collection)) { 13665 var iteratee = getIteratee(predicate, 3); 13666 collection = keys(collection); 13667 predicate = function(key) { return iteratee(iterable[key], key, iterable); }; 13668 } 13669 var index = findIndexFunc(collection, predicate, fromIndex); 13670 return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; 13671 }; 13672 } 13673 13674 /** 13675 * Creates a `_.flow` or `_.flowRight` function. 13676 * 13677 * @private 13678 * @param {boolean} [fromRight] Specify iterating from right to left. 13679 * @returns {Function} Returns the new flow function. 13680 */ 13681 function createFlow(fromRight) { 13682 return flatRest(function(funcs) { 13683 var length = funcs.length, 13684 index = length, 13685 prereq = LodashWrapper.prototype.thru; 13686 13687 if (fromRight) { 13688 funcs.reverse(); 13689 } 13690 while (index--) { 13691 var func = funcs[index]; 13692 if (typeof func != 'function') { 13693 throw new TypeError(FUNC_ERROR_TEXT); 13694 } 13695 if (prereq && !wrapper && getFuncName(func) == 'wrapper') { 13696 var wrapper = new LodashWrapper([], true); 13697 } 13698 } 13699 index = wrapper ? index : length; 13700 while (++index < length) { 13701 func = funcs[index]; 13702 13703 var funcName = getFuncName(func), 13704 data = funcName == 'wrapper' ? getData(func) : undefined; 13705 13706 if (data && isLaziable(data[0]) && 13707 data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && 13708 !data[4].length && data[9] == 1 13709 ) { 13710 wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); 13711 } else { 13712 wrapper = (func.length == 1 && isLaziable(func)) 13713 ? wrapper[funcName]() 13714 : wrapper.thru(func); 13715 } 13716 } 13717 return function() { 13718 var args = arguments, 13719 value = args[0]; 13720 13721 if (wrapper && args.length == 1 && isArray(value)) { 13722 return wrapper.plant(value).value(); 13723 } 13724 var index = 0, 13725 result = length ? funcs[index].apply(this, args) : value; 13726 13727 while (++index < length) { 13728 result = funcs[index].call(this, result); 13729 } 13730 return result; 13731 }; 13732 }); 13733 } 13734 13735 /** 13736 * Creates a function that wraps `func` to invoke it with optional `this` 13737 * binding of `thisArg`, partial application, and currying. 13738 * 13739 * @private 13740 * @param {Function|string} func The function or method name to wrap. 13741 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 13742 * @param {*} [thisArg] The `this` binding of `func`. 13743 * @param {Array} [partials] The arguments to prepend to those provided to 13744 * the new function. 13745 * @param {Array} [holders] The `partials` placeholder indexes. 13746 * @param {Array} [partialsRight] The arguments to append to those provided 13747 * to the new function. 13748 * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. 13749 * @param {Array} [argPos] The argument positions of the new function. 13750 * @param {number} [ary] The arity cap of `func`. 13751 * @param {number} [arity] The arity of `func`. 13752 * @returns {Function} Returns the new wrapped function. 13753 */ 13754 function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { 13755 var isAry = bitmask & WRAP_ARY_FLAG, 13756 isBind = bitmask & WRAP_BIND_FLAG, 13757 isBindKey = bitmask & WRAP_BIND_KEY_FLAG, 13758 isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), 13759 isFlip = bitmask & WRAP_FLIP_FLAG, 13760 Ctor = isBindKey ? undefined : createCtor(func); 13761 13762 function wrapper() { 13763 var length = arguments.length, 13764 args = Array(length), 13765 index = length; 13766 13767 while (index--) { 13768 args[index] = arguments[index]; 13769 } 13770 if (isCurried) { 13771 var placeholder = getHolder(wrapper), 13772 holdersCount = countHolders(args, placeholder); 13773 } 13774 if (partials) { 13775 args = composeArgs(args, partials, holders, isCurried); 13776 } 13777 if (partialsRight) { 13778 args = composeArgsRight(args, partialsRight, holdersRight, isCurried); 13779 } 13780 length -= holdersCount; 13781 if (isCurried && length < arity) { 13782 var newHolders = replaceHolders(args, placeholder); 13783 return createRecurry( 13784 func, bitmask, createHybrid, wrapper.placeholder, thisArg, 13785 args, newHolders, argPos, ary, arity - length 13786 ); 13787 } 13788 var thisBinding = isBind ? thisArg : this, 13789 fn = isBindKey ? thisBinding[func] : func; 13790 13791 length = args.length; 13792 if (argPos) { 13793 args = reorder(args, argPos); 13794 } else if (isFlip && length > 1) { 13795 args.reverse(); 13796 } 13797 if (isAry && ary < length) { 13798 args.length = ary; 13799 } 13800 if (this && this !== root && this instanceof wrapper) { 13801 fn = Ctor || createCtor(fn); 13802 } 13803 return fn.apply(thisBinding, args); 13804 } 13805 return wrapper; 13806 } 13807 13808 /** 13809 * Creates a function like `_.invertBy`. 13810 * 13811 * @private 13812 * @param {Function} setter The function to set accumulator values. 13813 * @param {Function} toIteratee The function to resolve iteratees. 13814 * @returns {Function} Returns the new inverter function. 13815 */ 13816 function createInverter(setter, toIteratee) { 13817 return function(object, iteratee) { 13818 return baseInverter(object, setter, toIteratee(iteratee), {}); 13819 }; 13820 } 13821 13822 /** 13823 * Creates a function that performs a mathematical operation on two values. 13824 * 13825 * @private 13826 * @param {Function} operator The function to perform the operation. 13827 * @param {number} [defaultValue] The value used for `undefined` arguments. 13828 * @returns {Function} Returns the new mathematical operation function. 13829 */ 13830 function createMathOperation(operator, defaultValue) { 13831 return function(value, other) { 13832 var result; 13833 if (value === undefined && other === undefined) { 13834 return defaultValue; 13835 } 13836 if (value !== undefined) { 13837 result = value; 13838 } 13839 if (other !== undefined) { 13840 if (result === undefined) { 13841 return other; 13842 } 13843 if (typeof value == 'string' || typeof other == 'string') { 13844 value = baseToString(value); 13845 other = baseToString(other); 13846 } else { 13847 value = baseToNumber(value); 13848 other = baseToNumber(other); 13849 } 13850 result = operator(value, other); 13851 } 13852 return result; 13853 }; 13854 } 13855 13856 /** 13857 * Creates a function like `_.over`. 13858 * 13859 * @private 13860 * @param {Function} arrayFunc The function to iterate over iteratees. 13861 * @returns {Function} Returns the new over function. 13862 */ 13863 function createOver(arrayFunc) { 13864 return flatRest(function(iteratees) { 13865 iteratees = arrayMap(iteratees, baseUnary(getIteratee())); 13866 return baseRest(function(args) { 13867 var thisArg = this; 13868 return arrayFunc(iteratees, function(iteratee) { 13869 return apply(iteratee, thisArg, args); 13870 }); 13871 }); 13872 }); 13873 } 13874 13875 /** 13876 * Creates the padding for `string` based on `length`. The `chars` string 13877 * is truncated if the number of characters exceeds `length`. 13878 * 13879 * @private 13880 * @param {number} length The padding length. 13881 * @param {string} [chars=' '] The string used as padding. 13882 * @returns {string} Returns the padding for `string`. 13883 */ 13884 function createPadding(length, chars) { 13885 chars = chars === undefined ? ' ' : baseToString(chars); 13886 13887 var charsLength = chars.length; 13888 if (charsLength < 2) { 13889 return charsLength ? baseRepeat(chars, length) : chars; 13890 } 13891 var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); 13892 return hasUnicode(chars) 13893 ? castSlice(stringToArray(result), 0, length).join('') 13894 : result.slice(0, length); 13895 } 13896 13897 /** 13898 * Creates a function that wraps `func` to invoke it with the `this` binding 13899 * of `thisArg` and `partials` prepended to the arguments it receives. 13900 * 13901 * @private 13902 * @param {Function} func The function to wrap. 13903 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 13904 * @param {*} thisArg The `this` binding of `func`. 13905 * @param {Array} partials The arguments to prepend to those provided to 13906 * the new function. 13907 * @returns {Function} Returns the new wrapped function. 13908 */ 13909 function createPartial(func, bitmask, thisArg, partials) { 13910 var isBind = bitmask & WRAP_BIND_FLAG, 13911 Ctor = createCtor(func); 13912 13913 function wrapper() { 13914 var argsIndex = -1, 13915 argsLength = arguments.length, 13916 leftIndex = -1, 13917 leftLength = partials.length, 13918 args = Array(leftLength + argsLength), 13919 fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 13920 13921 while (++leftIndex < leftLength) { 13922 args[leftIndex] = partials[leftIndex]; 13923 } 13924 while (argsLength--) { 13925 args[leftIndex++] = arguments[++argsIndex]; 13926 } 13927 return apply(fn, isBind ? thisArg : this, args); 13928 } 13929 return wrapper; 13930 } 13931 13932 /** 13933 * Creates a `_.range` or `_.rangeRight` function. 13934 * 13935 * @private 13936 * @param {boolean} [fromRight] Specify iterating from right to left. 13937 * @returns {Function} Returns the new range function. 13938 */ 13939 function createRange(fromRight) { 13940 return function(start, end, step) { 13941 if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { 13942 end = step = undefined; 13943 } 13944 // Ensure the sign of `-0` is preserved. 13945 start = toFinite(start); 13946 if (end === undefined) { 13947 end = start; 13948 start = 0; 13949 } else { 13950 end = toFinite(end); 13951 } 13952 step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); 13953 return baseRange(start, end, step, fromRight); 13954 }; 13955 } 13956 13957 /** 13958 * Creates a function that performs a relational operation on two values. 13959 * 13960 * @private 13961 * @param {Function} operator The function to perform the operation. 13962 * @returns {Function} Returns the new relational operation function. 13963 */ 13964 function createRelationalOperation(operator) { 13965 return function(value, other) { 13966 if (!(typeof value == 'string' && typeof other == 'string')) { 13967 value = toNumber(value); 13968 other = toNumber(other); 13969 } 13970 return operator(value, other); 13971 }; 13972 } 13973 13974 /** 13975 * Creates a function that wraps `func` to continue currying. 13976 * 13977 * @private 13978 * @param {Function} func The function to wrap. 13979 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 13980 * @param {Function} wrapFunc The function to create the `func` wrapper. 13981 * @param {*} placeholder The placeholder value. 13982 * @param {*} [thisArg] The `this` binding of `func`. 13983 * @param {Array} [partials] The arguments to prepend to those provided to 13984 * the new function. 13985 * @param {Array} [holders] The `partials` placeholder indexes. 13986 * @param {Array} [argPos] The argument positions of the new function. 13987 * @param {number} [ary] The arity cap of `func`. 13988 * @param {number} [arity] The arity of `func`. 13989 * @returns {Function} Returns the new wrapped function. 13990 */ 13991 function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { 13992 var isCurry = bitmask & WRAP_CURRY_FLAG, 13993 newHolders = isCurry ? holders : undefined, 13994 newHoldersRight = isCurry ? undefined : holders, 13995 newPartials = isCurry ? partials : undefined, 13996 newPartialsRight = isCurry ? undefined : partials; 13997 13998 bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); 13999 bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); 14000 14001 if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { 14002 bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); 14003 } 14004 var newData = [ 14005 func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, 14006 newHoldersRight, argPos, ary, arity 14007 ]; 14008 14009 var result = wrapFunc.apply(undefined, newData); 14010 if (isLaziable(func)) { 14011 setData(result, newData); 14012 } 14013 result.placeholder = placeholder; 14014 return setWrapToString(result, func, bitmask); 14015 } 14016 14017 /** 14018 * Creates a function like `_.round`. 14019 * 14020 * @private 14021 * @param {string} methodName The name of the `Math` method to use when rounding. 14022 * @returns {Function} Returns the new round function. 14023 */ 14024 function createRound(methodName) { 14025 var func = Math[methodName]; 14026 return function(number, precision) { 14027 number = toNumber(number); 14028 precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); 14029 if (precision && nativeIsFinite(number)) { 14030 // Shift with exponential notation to avoid floating-point issues. 14031 // See [MDN](https://mdn.io/round#Examples) for more details. 14032 var pair = (toString(number) + 'e').split('e'), 14033 value = func(pair[0] + 'e' + (+pair[1] + precision)); 14034 14035 pair = (toString(value) + 'e').split('e'); 14036 return +(pair[0] + 'e' + (+pair[1] - precision)); 14037 } 14038 return func(number); 14039 }; 14040 } 14041 14042 /** 14043 * Creates a set object of `values`. 14044 * 14045 * @private 14046 * @param {Array} values The values to add to the set. 14047 * @returns {Object} Returns the new set. 14048 */ 14049 var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { 14050 return new Set(values); 14051 }; 14052 14053 /** 14054 * Creates a `_.toPairs` or `_.toPairsIn` function. 14055 * 14056 * @private 14057 * @param {Function} keysFunc The function to get the keys of a given object. 14058 * @returns {Function} Returns the new pairs function. 14059 */ 14060 function createToPairs(keysFunc) { 14061 return function(object) { 14062 var tag = getTag(object); 14063 if (tag == mapTag) { 14064 return mapToArray(object); 14065 } 14066 if (tag == setTag) { 14067 return setToPairs(object); 14068 } 14069 return baseToPairs(object, keysFunc(object)); 14070 }; 14071 } 14072 14073 /** 14074 * Creates a function that either curries or invokes `func` with optional 14075 * `this` binding and partially applied arguments. 14076 * 14077 * @private 14078 * @param {Function|string} func The function or method name to wrap. 14079 * @param {number} bitmask The bitmask flags. 14080 * 1 - `_.bind` 14081 * 2 - `_.bindKey` 14082 * 4 - `_.curry` or `_.curryRight` of a bound function 14083 * 8 - `_.curry` 14084 * 16 - `_.curryRight` 14085 * 32 - `_.partial` 14086 * 64 - `_.partialRight` 14087 * 128 - `_.rearg` 14088 * 256 - `_.ary` 14089 * 512 - `_.flip` 14090 * @param {*} [thisArg] The `this` binding of `func`. 14091 * @param {Array} [partials] The arguments to be partially applied. 14092 * @param {Array} [holders] The `partials` placeholder indexes. 14093 * @param {Array} [argPos] The argument positions of the new function. 14094 * @param {number} [ary] The arity cap of `func`. 14095 * @param {number} [arity] The arity of `func`. 14096 * @returns {Function} Returns the new wrapped function. 14097 */ 14098 function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { 14099 var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; 14100 if (!isBindKey && typeof func != 'function') { 14101 throw new TypeError(FUNC_ERROR_TEXT); 14102 } 14103 var length = partials ? partials.length : 0; 14104 if (!length) { 14105 bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); 14106 partials = holders = undefined; 14107 } 14108 ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); 14109 arity = arity === undefined ? arity : toInteger(arity); 14110 length -= holders ? holders.length : 0; 14111 14112 if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { 14113 var partialsRight = partials, 14114 holdersRight = holders; 14115 14116 partials = holders = undefined; 14117 } 14118 var data = isBindKey ? undefined : getData(func); 14119 14120 var newData = [ 14121 func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, 14122 argPos, ary, arity 14123 ]; 14124 14125 if (data) { 14126 mergeData(newData, data); 14127 } 14128 func = newData[0]; 14129 bitmask = newData[1]; 14130 thisArg = newData[2]; 14131 partials = newData[3]; 14132 holders = newData[4]; 14133 arity = newData[9] = newData[9] === undefined 14134 ? (isBindKey ? 0 : func.length) 14135 : nativeMax(newData[9] - length, 0); 14136 14137 if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { 14138 bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); 14139 } 14140 if (!bitmask || bitmask == WRAP_BIND_FLAG) { 14141 var result = createBind(func, bitmask, thisArg); 14142 } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { 14143 result = createCurry(func, bitmask, arity); 14144 } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { 14145 result = createPartial(func, bitmask, thisArg, partials); 14146 } else { 14147 result = createHybrid.apply(undefined, newData); 14148 } 14149 var setter = data ? baseSetData : setData; 14150 return setWrapToString(setter(result, newData), func, bitmask); 14151 } 14152 14153 /** 14154 * Used by `_.defaults` to customize its `_.assignIn` use to assign properties 14155 * of source objects to the destination object for all destination properties 14156 * that resolve to `undefined`. 14157 * 14158 * @private 14159 * @param {*} objValue The destination value. 14160 * @param {*} srcValue The source value. 14161 * @param {string} key The key of the property to assign. 14162 * @param {Object} object The parent object of `objValue`. 14163 * @returns {*} Returns the value to assign. 14164 */ 14165 function customDefaultsAssignIn(objValue, srcValue, key, object) { 14166 if (objValue === undefined || 14167 (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { 14168 return srcValue; 14169 } 14170 return objValue; 14171 } 14172 14173 /** 14174 * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source 14175 * objects into destination objects that are passed thru. 14176 * 14177 * @private 14178 * @param {*} objValue The destination value. 14179 * @param {*} srcValue The source value. 14180 * @param {string} key The key of the property to merge. 14181 * @param {Object} object The parent object of `objValue`. 14182 * @param {Object} source The parent object of `srcValue`. 14183 * @param {Object} [stack] Tracks traversed source values and their merged 14184 * counterparts. 14185 * @returns {*} Returns the value to assign. 14186 */ 14187 function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { 14188 if (isObject(objValue) && isObject(srcValue)) { 14189 // Recursively merge objects and arrays (susceptible to call stack limits). 14190 stack.set(srcValue, objValue); 14191 baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); 14192 stack['delete'](srcValue); 14193 } 14194 return objValue; 14195 } 14196 14197 /** 14198 * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain 14199 * objects. 14200 * 14201 * @private 14202 * @param {*} value The value to inspect. 14203 * @param {string} key The key of the property to inspect. 14204 * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. 14205 */ 14206 function customOmitClone(value) { 14207 return isPlainObject(value) ? undefined : value; 14208 } 14209 14210 /** 14211 * A specialized version of `baseIsEqualDeep` for arrays with support for 14212 * partial deep comparisons. 14213 * 14214 * @private 14215 * @param {Array} array The array to compare. 14216 * @param {Array} other The other array to compare. 14217 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 14218 * @param {Function} customizer The function to customize comparisons. 14219 * @param {Function} equalFunc The function to determine equivalents of values. 14220 * @param {Object} stack Tracks traversed `array` and `other` objects. 14221 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. 14222 */ 14223 function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { 14224 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, 14225 arrLength = array.length, 14226 othLength = other.length; 14227 14228 if (arrLength != othLength && !(isPartial && othLength > arrLength)) { 14229 return false; 14230 } 14231 // Check that cyclic values are equal. 14232 var arrStacked = stack.get(array); 14233 var othStacked = stack.get(other); 14234 if (arrStacked && othStacked) { 14235 return arrStacked == other && othStacked == array; 14236 } 14237 var index = -1, 14238 result = true, 14239 seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; 14240 14241 stack.set(array, other); 14242 stack.set(other, array); 14243 14244 // Ignore non-index properties. 14245 while (++index < arrLength) { 14246 var arrValue = array[index], 14247 othValue = other[index]; 14248 14249 if (customizer) { 14250 var compared = isPartial 14251 ? customizer(othValue, arrValue, index, other, array, stack) 14252 : customizer(arrValue, othValue, index, array, other, stack); 14253 } 14254 if (compared !== undefined) { 14255 if (compared) { 14256 continue; 14257 } 14258 result = false; 14259 break; 14260 } 14261 // Recursively compare arrays (susceptible to call stack limits). 14262 if (seen) { 14263 if (!arraySome(other, function(othValue, othIndex) { 14264 if (!cacheHas(seen, othIndex) && 14265 (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { 14266 return seen.push(othIndex); 14267 } 14268 })) { 14269 result = false; 14270 break; 14271 } 14272 } else if (!( 14273 arrValue === othValue || 14274 equalFunc(arrValue, othValue, bitmask, customizer, stack) 14275 )) { 14276 result = false; 14277 break; 14278 } 14279 } 14280 stack['delete'](array); 14281 stack['delete'](other); 14282 return result; 14283 } 14284 14285 /** 14286 * A specialized version of `baseIsEqualDeep` for comparing objects of 14287 * the same `toStringTag`. 14288 * 14289 * **Note:** This function only supports comparing values with tags of 14290 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. 14291 * 14292 * @private 14293 * @param {Object} object The object to compare. 14294 * @param {Object} other The other object to compare. 14295 * @param {string} tag The `toStringTag` of the objects to compare. 14296 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 14297 * @param {Function} customizer The function to customize comparisons. 14298 * @param {Function} equalFunc The function to determine equivalents of values. 14299 * @param {Object} stack Tracks traversed `object` and `other` objects. 14300 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 14301 */ 14302 function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { 14303 switch (tag) { 14304 case dataViewTag: 14305 if ((object.byteLength != other.byteLength) || 14306 (object.byteOffset != other.byteOffset)) { 14307 return false; 14308 } 14309 object = object.buffer; 14310 other = other.buffer; 14311 14312 case arrayBufferTag: 14313 if ((object.byteLength != other.byteLength) || 14314 !equalFunc(new Uint8Array(object), new Uint8Array(other))) { 14315 return false; 14316 } 14317 return true; 14318 14319 case boolTag: 14320 case dateTag: 14321 case numberTag: 14322 // Coerce booleans to `1` or `0` and dates to milliseconds. 14323 // Invalid dates are coerced to `NaN`. 14324 return eq(+object, +other); 14325 14326 case errorTag: 14327 return object.name == other.name && object.message == other.message; 14328 14329 case regexpTag: 14330 case stringTag: 14331 // Coerce regexes to strings and treat strings, primitives and objects, 14332 // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring 14333 // for more details. 14334 return object == (other + ''); 14335 14336 case mapTag: 14337 var convert = mapToArray; 14338 14339 case setTag: 14340 var isPartial = bitmask & COMPARE_PARTIAL_FLAG; 14341 convert || (convert = setToArray); 14342 14343 if (object.size != other.size && !isPartial) { 14344 return false; 14345 } 14346 // Assume cyclic values are equal. 14347 var stacked = stack.get(object); 14348 if (stacked) { 14349 return stacked == other; 14350 } 14351 bitmask |= COMPARE_UNORDERED_FLAG; 14352 14353 // Recursively compare objects (susceptible to call stack limits). 14354 stack.set(object, other); 14355 var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); 14356 stack['delete'](object); 14357 return result; 14358 14359 case symbolTag: 14360 if (symbolValueOf) { 14361 return symbolValueOf.call(object) == symbolValueOf.call(other); 14362 } 14363 } 14364 return false; 14365 } 14366 14367 /** 14368 * A specialized version of `baseIsEqualDeep` for objects with support for 14369 * partial deep comparisons. 14370 * 14371 * @private 14372 * @param {Object} object The object to compare. 14373 * @param {Object} other The other object to compare. 14374 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. 14375 * @param {Function} customizer The function to customize comparisons. 14376 * @param {Function} equalFunc The function to determine equivalents of values. 14377 * @param {Object} stack Tracks traversed `object` and `other` objects. 14378 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. 14379 */ 14380 function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { 14381 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, 14382 objProps = getAllKeys(object), 14383 objLength = objProps.length, 14384 othProps = getAllKeys(other), 14385 othLength = othProps.length; 14386 14387 if (objLength != othLength && !isPartial) { 14388 return false; 14389 } 14390 var index = objLength; 14391 while (index--) { 14392 var key = objProps[index]; 14393 if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { 14394 return false; 14395 } 14396 } 14397 // Check that cyclic values are equal. 14398 var objStacked = stack.get(object); 14399 var othStacked = stack.get(other); 14400 if (objStacked && othStacked) { 14401 return objStacked == other && othStacked == object; 14402 } 14403 var result = true; 14404 stack.set(object, other); 14405 stack.set(other, object); 14406 14407 var skipCtor = isPartial; 14408 while (++index < objLength) { 14409 key = objProps[index]; 14410 var objValue = object[key], 14411 othValue = other[key]; 14412 14413 if (customizer) { 14414 var compared = isPartial 14415 ? customizer(othValue, objValue, key, other, object, stack) 14416 : customizer(objValue, othValue, key, object, other, stack); 14417 } 14418 // Recursively compare objects (susceptible to call stack limits). 14419 if (!(compared === undefined 14420 ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) 14421 : compared 14422 )) { 14423 result = false; 14424 break; 14425 } 14426 skipCtor || (skipCtor = key == 'constructor'); 14427 } 14428 if (result && !skipCtor) { 14429 var objCtor = object.constructor, 14430 othCtor = other.constructor; 14431 14432 // Non `Object` object instances with different constructors are not equal. 14433 if (objCtor != othCtor && 14434 ('constructor' in object && 'constructor' in other) && 14435 !(typeof objCtor == 'function' && objCtor instanceof objCtor && 14436 typeof othCtor == 'function' && othCtor instanceof othCtor)) { 14437 result = false; 14438 } 14439 } 14440 stack['delete'](object); 14441 stack['delete'](other); 14442 return result; 14443 } 14444 14445 /** 14446 * A specialized version of `baseRest` which flattens the rest array. 14447 * 14448 * @private 14449 * @param {Function} func The function to apply a rest parameter to. 14450 * @returns {Function} Returns the new function. 14451 */ 14452 function flatRest(func) { 14453 return setToString(overRest(func, undefined, flatten), func + ''); 14454 } 14455 14456 /** 14457 * Creates an array of own enumerable property names and symbols of `object`. 14458 * 14459 * @private 14460 * @param {Object} object The object to query. 14461 * @returns {Array} Returns the array of property names and symbols. 14462 */ 14463 function getAllKeys(object) { 14464 return baseGetAllKeys(object, keys, getSymbols); 14465 } 14466 14467 /** 14468 * Creates an array of own and inherited enumerable property names and 14469 * symbols of `object`. 14470 * 14471 * @private 14472 * @param {Object} object The object to query. 14473 * @returns {Array} Returns the array of property names and symbols. 14474 */ 14475 function getAllKeysIn(object) { 14476 return baseGetAllKeys(object, keysIn, getSymbolsIn); 14477 } 14478 14479 /** 14480 * Gets metadata for `func`. 14481 * 14482 * @private 14483 * @param {Function} func The function to query. 14484 * @returns {*} Returns the metadata for `func`. 14485 */ 14486 var getData = !metaMap ? noop : function(func) { 14487 return metaMap.get(func); 14488 }; 14489 14490 /** 14491 * Gets the name of `func`. 14492 * 14493 * @private 14494 * @param {Function} func The function to query. 14495 * @returns {string} Returns the function name. 14496 */ 14497 function getFuncName(func) { 14498 var result = (func.name + ''), 14499 array = realNames[result], 14500 length = hasOwnProperty.call(realNames, result) ? array.length : 0; 14501 14502 while (length--) { 14503 var data = array[length], 14504 otherFunc = data.func; 14505 if (otherFunc == null || otherFunc == func) { 14506 return data.name; 14507 } 14508 } 14509 return result; 14510 } 14511 14512 /** 14513 * Gets the argument placeholder value for `func`. 14514 * 14515 * @private 14516 * @param {Function} func The function to inspect. 14517 * @returns {*} Returns the placeholder value. 14518 */ 14519 function getHolder(func) { 14520 var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; 14521 return object.placeholder; 14522 } 14523 14524 /** 14525 * Gets the appropriate "iteratee" function. If `_.iteratee` is customized, 14526 * this function returns the custom method, otherwise it returns `baseIteratee`. 14527 * If arguments are provided, the chosen function is invoked with them and 14528 * its result is returned. 14529 * 14530 * @private 14531 * @param {*} [value] The value to convert to an iteratee. 14532 * @param {number} [arity] The arity of the created iteratee. 14533 * @returns {Function} Returns the chosen function or its result. 14534 */ 14535 function getIteratee() { 14536 var result = lodash.iteratee || iteratee; 14537 result = result === iteratee ? baseIteratee : result; 14538 return arguments.length ? result(arguments[0], arguments[1]) : result; 14539 } 14540 14541 /** 14542 * Gets the data for `map`. 14543 * 14544 * @private 14545 * @param {Object} map The map to query. 14546 * @param {string} key The reference key. 14547 * @returns {*} Returns the map data. 14548 */ 14549 function getMapData(map, key) { 14550 var data = map.__data__; 14551 return isKeyable(key) 14552 ? data[typeof key == 'string' ? 'string' : 'hash'] 14553 : data.map; 14554 } 14555 14556 /** 14557 * Gets the property names, values, and compare flags of `object`. 14558 * 14559 * @private 14560 * @param {Object} object The object to query. 14561 * @returns {Array} Returns the match data of `object`. 14562 */ 14563 function getMatchData(object) { 14564 var result = keys(object), 14565 length = result.length; 14566 14567 while (length--) { 14568 var key = result[length], 14569 value = object[key]; 14570 14571 result[length] = [key, value, isStrictComparable(value)]; 14572 } 14573 return result; 14574 } 14575 14576 /** 14577 * Gets the native function at `key` of `object`. 14578 * 14579 * @private 14580 * @param {Object} object The object to query. 14581 * @param {string} key The key of the method to get. 14582 * @returns {*} Returns the function if it's native, else `undefined`. 14583 */ 14584 function getNative(object, key) { 14585 var value = getValue(object, key); 14586 return baseIsNative(value) ? value : undefined; 14587 } 14588 14589 /** 14590 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. 14591 * 14592 * @private 14593 * @param {*} value The value to query. 14594 * @returns {string} Returns the raw `toStringTag`. 14595 */ 14596 function getRawTag(value) { 14597 var isOwn = hasOwnProperty.call(value, symToStringTag), 14598 tag = value[symToStringTag]; 14599 14600 try { 14601 value[symToStringTag] = undefined; 14602 var unmasked = true; 14603 } catch (e) {} 14604 14605 var result = nativeObjectToString.call(value); 14606 if (unmasked) { 14607 if (isOwn) { 14608 value[symToStringTag] = tag; 14609 } else { 14610 delete value[symToStringTag]; 14611 } 14612 } 14613 return result; 14614 } 14615 14616 /** 14617 * Creates an array of the own enumerable symbols of `object`. 14618 * 14619 * @private 14620 * @param {Object} object The object to query. 14621 * @returns {Array} Returns the array of symbols. 14622 */ 14623 var getSymbols = !nativeGetSymbols ? stubArray : function(object) { 14624 if (object == null) { 14625 return []; 14626 } 14627 object = Object(object); 14628 return arrayFilter(nativeGetSymbols(object), function(symbol) { 14629 return propertyIsEnumerable.call(object, symbol); 14630 }); 14631 }; 14632 14633 /** 14634 * Creates an array of the own and inherited enumerable symbols of `object`. 14635 * 14636 * @private 14637 * @param {Object} object The object to query. 14638 * @returns {Array} Returns the array of symbols. 14639 */ 14640 var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { 14641 var result = []; 14642 while (object) { 14643 arrayPush(result, getSymbols(object)); 14644 object = getPrototype(object); 14645 } 14646 return result; 14647 }; 14648 14649 /** 14650 * Gets the `toStringTag` of `value`. 14651 * 14652 * @private 14653 * @param {*} value The value to query. 14654 * @returns {string} Returns the `toStringTag`. 14655 */ 14656 var getTag = baseGetTag; 14657 14658 // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. 14659 if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || 14660 (Map && getTag(new Map) != mapTag) || 14661 (Promise && getTag(Promise.resolve()) != promiseTag) || 14662 (Set && getTag(new Set) != setTag) || 14663 (WeakMap && getTag(new WeakMap) != weakMapTag)) { 14664 getTag = function(value) { 14665 var result = baseGetTag(value), 14666 Ctor = result == objectTag ? value.constructor : undefined, 14667 ctorString = Ctor ? toSource(Ctor) : ''; 14668 14669 if (ctorString) { 14670 switch (ctorString) { 14671 case dataViewCtorString: return dataViewTag; 14672 case mapCtorString: return mapTag; 14673 case promiseCtorString: return promiseTag; 14674 case setCtorString: return setTag; 14675 case weakMapCtorString: return weakMapTag; 14676 } 14677 } 14678 return result; 14679 }; 14680 } 14681 14682 /** 14683 * Gets the view, applying any `transforms` to the `start` and `end` positions. 14684 * 14685 * @private 14686 * @param {number} start The start of the view. 14687 * @param {number} end The end of the view. 14688 * @param {Array} transforms The transformations to apply to the view. 14689 * @returns {Object} Returns an object containing the `start` and `end` 14690 * positions of the view. 14691 */ 14692 function getView(start, end, transforms) { 14693 var index = -1, 14694 length = transforms.length; 14695 14696 while (++index < length) { 14697 var data = transforms[index], 14698 size = data.size; 14699 14700 switch (data.type) { 14701 case 'drop': start += size; break; 14702 case 'dropRight': end -= size; break; 14703 case 'take': end = nativeMin(end, start + size); break; 14704 case 'takeRight': start = nativeMax(start, end - size); break; 14705 } 14706 } 14707 return { 'start': start, 'end': end }; 14708 } 14709 14710 /** 14711 * Extracts wrapper details from the `source` body comment. 14712 * 14713 * @private 14714 * @param {string} source The source to inspect. 14715 * @returns {Array} Returns the wrapper details. 14716 */ 14717 function getWrapDetails(source) { 14718 var match = source.match(reWrapDetails); 14719 return match ? match[1].split(reSplitDetails) : []; 14720 } 14721 14722 /** 14723 * Checks if `path` exists on `object`. 14724 * 14725 * @private 14726 * @param {Object} object The object to query. 14727 * @param {Array|string} path The path to check. 14728 * @param {Function} hasFunc The function to check properties. 14729 * @returns {boolean} Returns `true` if `path` exists, else `false`. 14730 */ 14731 function hasPath(object, path, hasFunc) { 14732 path = castPath(path, object); 14733 14734 var index = -1, 14735 length = path.length, 14736 result = false; 14737 14738 while (++index < length) { 14739 var key = toKey(path[index]); 14740 if (!(result = object != null && hasFunc(object, key))) { 14741 break; 14742 } 14743 object = object[key]; 14744 } 14745 if (result || ++index != length) { 14746 return result; 14747 } 14748 length = object == null ? 0 : object.length; 14749 return !!length && isLength(length) && isIndex(key, length) && 14750 (isArray(object) || isArguments(object)); 14751 } 14752 14753 /** 14754 * Initializes an array clone. 14755 * 14756 * @private 14757 * @param {Array} array The array to clone. 14758 * @returns {Array} Returns the initialized clone. 14759 */ 14760 function initCloneArray(array) { 14761 var length = array.length, 14762 result = new array.constructor(length); 14763 14764 // Add properties assigned by `RegExp#exec`. 14765 if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { 14766 result.index = array.index; 14767 result.input = array.input; 14768 } 14769 return result; 14770 } 14771 14772 /** 14773 * Initializes an object clone. 14774 * 14775 * @private 14776 * @param {Object} object The object to clone. 14777 * @returns {Object} Returns the initialized clone. 14778 */ 14779 function initCloneObject(object) { 14780 return (typeof object.constructor == 'function' && !isPrototype(object)) 14781 ? baseCreate(getPrototype(object)) 14782 : {}; 14783 } 14784 14785 /** 14786 * Initializes an object clone based on its `toStringTag`. 14787 * 14788 * **Note:** This function only supports cloning values with tags of 14789 * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. 14790 * 14791 * @private 14792 * @param {Object} object The object to clone. 14793 * @param {string} tag The `toStringTag` of the object to clone. 14794 * @param {boolean} [isDeep] Specify a deep clone. 14795 * @returns {Object} Returns the initialized clone. 14796 */ 14797 function initCloneByTag(object, tag, isDeep) { 14798 var Ctor = object.constructor; 14799 switch (tag) { 14800 case arrayBufferTag: 14801 return cloneArrayBuffer(object); 14802 14803 case boolTag: 14804 case dateTag: 14805 return new Ctor(+object); 14806 14807 case dataViewTag: 14808 return cloneDataView(object, isDeep); 14809 14810 case float32Tag: case float64Tag: 14811 case int8Tag: case int16Tag: case int32Tag: 14812 case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: 14813 return cloneTypedArray(object, isDeep); 14814 14815 case mapTag: 14816 return new Ctor; 14817 14818 case numberTag: 14819 case stringTag: 14820 return new Ctor(object); 14821 14822 case regexpTag: 14823 return cloneRegExp(object); 14824 14825 case setTag: 14826 return new Ctor; 14827 14828 case symbolTag: 14829 return cloneSymbol(object); 14830 } 14831 } 14832 14833 /** 14834 * Inserts wrapper `details` in a comment at the top of the `source` body. 14835 * 14836 * @private 14837 * @param {string} source The source to modify. 14838 * @returns {Array} details The details to insert. 14839 * @returns {string} Returns the modified source. 14840 */ 14841 function insertWrapDetails(source, details) { 14842 var length = details.length; 14843 if (!length) { 14844 return source; 14845 } 14846 var lastIndex = length - 1; 14847 details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; 14848 details = details.join(length > 2 ? ', ' : ' '); 14849 return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); 14850 } 14851 14852 /** 14853 * Checks if `value` is a flattenable `arguments` object or array. 14854 * 14855 * @private 14856 * @param {*} value The value to check. 14857 * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. 14858 */ 14859 function isFlattenable(value) { 14860 return isArray(value) || isArguments(value) || 14861 !!(spreadableSymbol && value && value[spreadableSymbol]); 14862 } 14863 14864 /** 14865 * Checks if `value` is a valid array-like index. 14866 * 14867 * @private 14868 * @param {*} value The value to check. 14869 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. 14870 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. 14871 */ 14872 function isIndex(value, length) { 14873 var type = typeof value; 14874 length = length == null ? MAX_SAFE_INTEGER : length; 14875 14876 return !!length && 14877 (type == 'number' || 14878 (type != 'symbol' && reIsUint.test(value))) && 14879 (value > -1 && value % 1 == 0 && value < length); 14880 } 14881 14882 /** 14883 * Checks if the given arguments are from an iteratee call. 14884 * 14885 * @private 14886 * @param {*} value The potential iteratee value argument. 14887 * @param {*} index The potential iteratee index or key argument. 14888 * @param {*} object The potential iteratee object argument. 14889 * @returns {boolean} Returns `true` if the arguments are from an iteratee call, 14890 * else `false`. 14891 */ 14892 function isIterateeCall(value, index, object) { 14893 if (!isObject(object)) { 14894 return false; 14895 } 14896 var type = typeof index; 14897 if (type == 'number' 14898 ? (isArrayLike(object) && isIndex(index, object.length)) 14899 : (type == 'string' && index in object) 14900 ) { 14901 return eq(object[index], value); 14902 } 14903 return false; 14904 } 14905 14906 /** 14907 * Checks if `value` is a property name and not a property path. 14908 * 14909 * @private 14910 * @param {*} value The value to check. 14911 * @param {Object} [object] The object to query keys on. 14912 * @returns {boolean} Returns `true` if `value` is a property name, else `false`. 14913 */ 14914 function isKey(value, object) { 14915 if (isArray(value)) { 14916 return false; 14917 } 14918 var type = typeof value; 14919 if (type == 'number' || type == 'symbol' || type == 'boolean' || 14920 value == null || isSymbol(value)) { 14921 return true; 14922 } 14923 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || 14924 (object != null && value in Object(object)); 14925 } 14926 14927 /** 14928 * Checks if `value` is suitable for use as unique object key. 14929 * 14930 * @private 14931 * @param {*} value The value to check. 14932 * @returns {boolean} Returns `true` if `value` is suitable, else `false`. 14933 */ 14934 function isKeyable(value) { 14935 var type = typeof value; 14936 return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') 14937 ? (value !== '__proto__') 14938 : (value === null); 14939 } 14940 14941 /** 14942 * Checks if `func` has a lazy counterpart. 14943 * 14944 * @private 14945 * @param {Function} func The function to check. 14946 * @returns {boolean} Returns `true` if `func` has a lazy counterpart, 14947 * else `false`. 14948 */ 14949 function isLaziable(func) { 14950 var funcName = getFuncName(func), 14951 other = lodash[funcName]; 14952 14953 if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { 14954 return false; 14955 } 14956 if (func === other) { 14957 return true; 14958 } 14959 var data = getData(other); 14960 return !!data && func === data[0]; 14961 } 14962 14963 /** 14964 * Checks if `func` has its source masked. 14965 * 14966 * @private 14967 * @param {Function} func The function to check. 14968 * @returns {boolean} Returns `true` if `func` is masked, else `false`. 14969 */ 14970 function isMasked(func) { 14971 return !!maskSrcKey && (maskSrcKey in func); 14972 } 14973 14974 /** 14975 * Checks if `func` is capable of being masked. 14976 * 14977 * @private 14978 * @param {*} value The value to check. 14979 * @returns {boolean} Returns `true` if `func` is maskable, else `false`. 14980 */ 14981 var isMaskable = coreJsData ? isFunction : stubFalse; 14982 14983 /** 14984 * Checks if `value` is likely a prototype object. 14985 * 14986 * @private 14987 * @param {*} value The value to check. 14988 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. 14989 */ 14990 function isPrototype(value) { 14991 var Ctor = value && value.constructor, 14992 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; 14993 14994 return value === proto; 14995 } 14996 14997 /** 14998 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. 14999 * 15000 * @private 15001 * @param {*} value The value to check. 15002 * @returns {boolean} Returns `true` if `value` if suitable for strict 15003 * equality comparisons, else `false`. 15004 */ 15005 function isStrictComparable(value) { 15006 return value === value && !isObject(value); 15007 } 15008 15009 /** 15010 * A specialized version of `matchesProperty` for source values suitable 15011 * for strict equality comparisons, i.e. `===`. 15012 * 15013 * @private 15014 * @param {string} key The key of the property to get. 15015 * @param {*} srcValue The value to match. 15016 * @returns {Function} Returns the new spec function. 15017 */ 15018 function matchesStrictComparable(key, srcValue) { 15019 return function(object) { 15020 if (object == null) { 15021 return false; 15022 } 15023 return object[key] === srcValue && 15024 (srcValue !== undefined || (key in Object(object))); 15025 }; 15026 } 15027 15028 /** 15029 * A specialized version of `_.memoize` which clears the memoized function's 15030 * cache when it exceeds `MAX_MEMOIZE_SIZE`. 15031 * 15032 * @private 15033 * @param {Function} func The function to have its output memoized. 15034 * @returns {Function} Returns the new memoized function. 15035 */ 15036 function memoizeCapped(func) { 15037 var result = memoize(func, function(key) { 15038 if (cache.size === MAX_MEMOIZE_SIZE) { 15039 cache.clear(); 15040 } 15041 return key; 15042 }); 15043 15044 var cache = result.cache; 15045 return result; 15046 } 15047 15048 /** 15049 * Merges the function metadata of `source` into `data`. 15050 * 15051 * Merging metadata reduces the number of wrappers used to invoke a function. 15052 * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` 15053 * may be applied regardless of execution order. Methods like `_.ary` and 15054 * `_.rearg` modify function arguments, making the order in which they are 15055 * executed important, preventing the merging of metadata. However, we make 15056 * an exception for a safe combined case where curried functions have `_.ary` 15057 * and or `_.rearg` applied. 15058 * 15059 * @private 15060 * @param {Array} data The destination metadata. 15061 * @param {Array} source The source metadata. 15062 * @returns {Array} Returns `data`. 15063 */ 15064 function mergeData(data, source) { 15065 var bitmask = data[1], 15066 srcBitmask = source[1], 15067 newBitmask = bitmask | srcBitmask, 15068 isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); 15069 15070 var isCombo = 15071 ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || 15072 ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || 15073 ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); 15074 15075 // Exit early if metadata can't be merged. 15076 if (!(isCommon || isCombo)) { 15077 return data; 15078 } 15079 // Use source `thisArg` if available. 15080 if (srcBitmask & WRAP_BIND_FLAG) { 15081 data[2] = source[2]; 15082 // Set when currying a bound function. 15083 newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; 15084 } 15085 // Compose partial arguments. 15086 var value = source[3]; 15087 if (value) { 15088 var partials = data[3]; 15089 data[3] = partials ? composeArgs(partials, value, source[4]) : value; 15090 data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; 15091 } 15092 // Compose partial right arguments. 15093 value = source[5]; 15094 if (value) { 15095 partials = data[5]; 15096 data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; 15097 data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; 15098 } 15099 // Use source `argPos` if available. 15100 value = source[7]; 15101 if (value) { 15102 data[7] = value; 15103 } 15104 // Use source `ary` if it's smaller. 15105 if (srcBitmask & WRAP_ARY_FLAG) { 15106 data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); 15107 } 15108 // Use source `arity` if one is not provided. 15109 if (data[9] == null) { 15110 data[9] = source[9]; 15111 } 15112 // Use source `func` and merge bitmasks. 15113 data[0] = source[0]; 15114 data[1] = newBitmask; 15115 15116 return data; 15117 } 15118 15119 /** 15120 * This function is like 15121 * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) 15122 * except that it includes inherited enumerable properties. 15123 * 15124 * @private 15125 * @param {Object} object The object to query. 15126 * @returns {Array} Returns the array of property names. 15127 */ 15128 function nativeKeysIn(object) { 15129 var result = []; 15130 if (object != null) { 15131 for (var key in Object(object)) { 15132 result.push(key); 15133 } 15134 } 15135 return result; 15136 } 15137 15138 /** 15139 * Converts `value` to a string using `Object.prototype.toString`. 15140 * 15141 * @private 15142 * @param {*} value The value to convert. 15143 * @returns {string} Returns the converted string. 15144 */ 15145 function objectToString(value) { 15146 return nativeObjectToString.call(value); 15147 } 15148 15149 /** 15150 * A specialized version of `baseRest` which transforms the rest array. 15151 * 15152 * @private 15153 * @param {Function} func The function to apply a rest parameter to. 15154 * @param {number} [start=func.length-1] The start position of the rest parameter. 15155 * @param {Function} transform The rest array transform. 15156 * @returns {Function} Returns the new function. 15157 */ 15158 function overRest(func, start, transform) { 15159 start = nativeMax(start === undefined ? (func.length - 1) : start, 0); 15160 return function() { 15161 var args = arguments, 15162 index = -1, 15163 length = nativeMax(args.length - start, 0), 15164 array = Array(length); 15165 15166 while (++index < length) { 15167 array[index] = args[start + index]; 15168 } 15169 index = -1; 15170 var otherArgs = Array(start + 1); 15171 while (++index < start) { 15172 otherArgs[index] = args[index]; 15173 } 15174 otherArgs[start] = transform(array); 15175 return apply(func, this, otherArgs); 15176 }; 15177 } 15178 15179 /** 15180 * Gets the parent value at `path` of `object`. 15181 * 15182 * @private 15183 * @param {Object} object The object to query. 15184 * @param {Array} path The path to get the parent value of. 15185 * @returns {*} Returns the parent value. 15186 */ 15187 function parent(object, path) { 15188 return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); 15189 } 15190 15191 /** 15192 * Reorder `array` according to the specified indexes where the element at 15193 * the first index is assigned as the first element, the element at 15194 * the second index is assigned as the second element, and so on. 15195 * 15196 * @private 15197 * @param {Array} array The array to reorder. 15198 * @param {Array} indexes The arranged array indexes. 15199 * @returns {Array} Returns `array`. 15200 */ 15201 function reorder(array, indexes) { 15202 var arrLength = array.length, 15203 length = nativeMin(indexes.length, arrLength), 15204 oldArray = copyArray(array); 15205 15206 while (length--) { 15207 var index = indexes[length]; 15208 array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; 15209 } 15210 return array; 15211 } 15212 15213 /** 15214 * Gets the value at `key`, unless `key` is "__proto__" or "constructor". 15215 * 15216 * @private 15217 * @param {Object} object The object to query. 15218 * @param {string} key The key of the property to get. 15219 * @returns {*} Returns the property value. 15220 */ 15221 function safeGet(object, key) { 15222 if (key === 'constructor' && typeof object[key] === 'function') { 15223 return; 15224 } 15225 15226 if (key == '__proto__') { 15227 return; 15228 } 15229 15230 return object[key]; 15231 } 15232 15233 /** 15234 * Sets metadata for `func`. 15235 * 15236 * **Note:** If this function becomes hot, i.e. is invoked a lot in a short 15237 * period of time, it will trip its breaker and transition to an identity 15238 * function to avoid garbage collection pauses in V8. See 15239 * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) 15240 * for more details. 15241 * 15242 * @private 15243 * @param {Function} func The function to associate metadata with. 15244 * @param {*} data The metadata. 15245 * @returns {Function} Returns `func`. 15246 */ 15247 var setData = shortOut(baseSetData); 15248 15249 /** 15250 * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout). 15251 * 15252 * @private 15253 * @param {Function} func The function to delay. 15254 * @param {number} wait The number of milliseconds to delay invocation. 15255 * @returns {number|Object} Returns the timer id or timeout object. 15256 */ 15257 var setTimeout = ctxSetTimeout || function(func, wait) { 15258 return root.setTimeout(func, wait); 15259 }; 15260 15261 /** 15262 * Sets the `toString` method of `func` to return `string`. 15263 * 15264 * @private 15265 * @param {Function} func The function to modify. 15266 * @param {Function} string The `toString` result. 15267 * @returns {Function} Returns `func`. 15268 */ 15269 var setToString = shortOut(baseSetToString); 15270 15271 /** 15272 * Sets the `toString` method of `wrapper` to mimic the source of `reference` 15273 * with wrapper details in a comment at the top of the source body. 15274 * 15275 * @private 15276 * @param {Function} wrapper The function to modify. 15277 * @param {Function} reference The reference function. 15278 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 15279 * @returns {Function} Returns `wrapper`. 15280 */ 15281 function setWrapToString(wrapper, reference, bitmask) { 15282 var source = (reference + ''); 15283 return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); 15284 } 15285 15286 /** 15287 * Creates a function that'll short out and invoke `identity` instead 15288 * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` 15289 * milliseconds. 15290 * 15291 * @private 15292 * @param {Function} func The function to restrict. 15293 * @returns {Function} Returns the new shortable function. 15294 */ 15295 function shortOut(func) { 15296 var count = 0, 15297 lastCalled = 0; 15298 15299 return function() { 15300 var stamp = nativeNow(), 15301 remaining = HOT_SPAN - (stamp - lastCalled); 15302 15303 lastCalled = stamp; 15304 if (remaining > 0) { 15305 if (++count >= HOT_COUNT) { 15306 return arguments[0]; 15307 } 15308 } else { 15309 count = 0; 15310 } 15311 return func.apply(undefined, arguments); 15312 }; 15313 } 15314 15315 /** 15316 * A specialized version of `_.shuffle` which mutates and sets the size of `array`. 15317 * 15318 * @private 15319 * @param {Array} array The array to shuffle. 15320 * @param {number} [size=array.length] The size of `array`. 15321 * @returns {Array} Returns `array`. 15322 */ 15323 function shuffleSelf(array, size) { 15324 var index = -1, 15325 length = array.length, 15326 lastIndex = length - 1; 15327 15328 size = size === undefined ? length : size; 15329 while (++index < size) { 15330 var rand = baseRandom(index, lastIndex), 15331 value = array[rand]; 15332 15333 array[rand] = array[index]; 15334 array[index] = value; 15335 } 15336 array.length = size; 15337 return array; 15338 } 15339 15340 /** 15341 * Converts `string` to a property path array. 15342 * 15343 * @private 15344 * @param {string} string The string to convert. 15345 * @returns {Array} Returns the property path array. 15346 */ 15347 var stringToPath = memoizeCapped(function(string) { 15348 var result = []; 15349 if (string.charCodeAt(0) === 46 /* . */) { 15350 result.push(''); 15351 } 15352 string.replace(rePropName, function(match, number, quote, subString) { 15353 result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); 15354 }); 15355 return result; 15356 }); 15357 15358 /** 15359 * Converts `value` to a string key if it's not a string or symbol. 15360 * 15361 * @private 15362 * @param {*} value The value to inspect. 15363 * @returns {string|symbol} Returns the key. 15364 */ 15365 function toKey(value) { 15366 if (typeof value == 'string' || isSymbol(value)) { 15367 return value; 15368 } 15369 var result = (value + ''); 15370 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; 15371 } 15372 15373 /** 15374 * Converts `func` to its source code. 15375 * 15376 * @private 15377 * @param {Function} func The function to convert. 15378 * @returns {string} Returns the source code. 15379 */ 15380 function toSource(func) { 15381 if (func != null) { 15382 try { 15383 return funcToString.call(func); 15384 } catch (e) {} 15385 try { 15386 return (func + ''); 15387 } catch (e) {} 15388 } 15389 return ''; 15390 } 15391 15392 /** 15393 * Updates wrapper `details` based on `bitmask` flags. 15394 * 15395 * @private 15396 * @returns {Array} details The details to modify. 15397 * @param {number} bitmask The bitmask flags. See `createWrap` for more details. 15398 * @returns {Array} Returns `details`. 15399 */ 15400 function updateWrapDetails(details, bitmask) { 15401 arrayEach(wrapFlags, function(pair) { 15402 var value = '_.' + pair[0]; 15403 if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { 15404 details.push(value); 15405 } 15406 }); 15407 return details.sort(); 15408 } 15409 15410 /** 15411 * Creates a clone of `wrapper`. 15412 * 15413 * @private 15414 * @param {Object} wrapper The wrapper to clone. 15415 * @returns {Object} Returns the cloned wrapper. 15416 */ 15417 function wrapperClone(wrapper) { 15418 if (wrapper instanceof LazyWrapper) { 15419 return wrapper.clone(); 15420 } 15421 var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); 15422 result.__actions__ = copyArray(wrapper.__actions__); 15423 result.__index__ = wrapper.__index__; 15424 result.__values__ = wrapper.__values__; 15425 return result; 15426 } 15427 15428 /*------------------------------------------------------------------------*/ 15429 15430 /** 15431 * Creates an array of elements split into groups the length of `size`. 15432 * If `array` can't be split evenly, the final chunk will be the remaining 15433 * elements. 15434 * 15435 * @static 15436 * @memberOf _ 15437 * @since 3.0.0 15438 * @category Array 15439 * @param {Array} array The array to process. 15440 * @param {number} [size=1] The length of each chunk 15441 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 15442 * @returns {Array} Returns the new array of chunks. 15443 * @example 15444 * 15445 * _.chunk(['a', 'b', 'c', 'd'], 2); 15446 * // => [['a', 'b'], ['c', 'd']] 15447 * 15448 * _.chunk(['a', 'b', 'c', 'd'], 3); 15449 * // => [['a', 'b', 'c'], ['d']] 15450 */ 15451 function chunk(array, size, guard) { 15452 if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { 15453 size = 1; 15454 } else { 15455 size = nativeMax(toInteger(size), 0); 15456 } 15457 var length = array == null ? 0 : array.length; 15458 if (!length || size < 1) { 15459 return []; 15460 } 15461 var index = 0, 15462 resIndex = 0, 15463 result = Array(nativeCeil(length / size)); 15464 15465 while (index < length) { 15466 result[resIndex++] = baseSlice(array, index, (index += size)); 15467 } 15468 return result; 15469 } 15470 15471 /** 15472 * Creates an array with all falsey values removed. The values `false`, `null`, 15473 * `0`, `""`, `undefined`, and `NaN` are falsey. 15474 * 15475 * @static 15476 * @memberOf _ 15477 * @since 0.1.0 15478 * @category Array 15479 * @param {Array} array The array to compact. 15480 * @returns {Array} Returns the new array of filtered values. 15481 * @example 15482 * 15483 * _.compact([0, 1, false, 2, '', 3]); 15484 * // => [1, 2, 3] 15485 */ 15486 function compact(array) { 15487 var index = -1, 15488 length = array == null ? 0 : array.length, 15489 resIndex = 0, 15490 result = []; 15491 15492 while (++index < length) { 15493 var value = array[index]; 15494 if (value) { 15495 result[resIndex++] = value; 15496 } 15497 } 15498 return result; 15499 } 15500 15501 /** 15502 * Creates a new array concatenating `array` with any additional arrays 15503 * and/or values. 15504 * 15505 * @static 15506 * @memberOf _ 15507 * @since 4.0.0 15508 * @category Array 15509 * @param {Array} array The array to concatenate. 15510 * @param {...*} [values] The values to concatenate. 15511 * @returns {Array} Returns the new concatenated array. 15512 * @example 15513 * 15514 * var array = [1]; 15515 * var other = _.concat(array, 2, [3], [[4]]); 15516 * 15517 * console.log(other); 15518 * // => [1, 2, 3, [4]] 15519 * 15520 * console.log(array); 15521 * // => [1] 15522 */ 15523 function concat() { 15524 var length = arguments.length; 15525 if (!length) { 15526 return []; 15527 } 15528 var args = Array(length - 1), 15529 array = arguments[0], 15530 index = length; 15531 15532 while (index--) { 15533 args[index - 1] = arguments[index]; 15534 } 15535 return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); 15536 } 15537 15538 /** 15539 * Creates an array of `array` values not included in the other given arrays 15540 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 15541 * for equality comparisons. The order and references of result values are 15542 * determined by the first array. 15543 * 15544 * **Note:** Unlike `_.pullAll`, this method returns a new array. 15545 * 15546 * @static 15547 * @memberOf _ 15548 * @since 0.1.0 15549 * @category Array 15550 * @param {Array} array The array to inspect. 15551 * @param {...Array} [values] The values to exclude. 15552 * @returns {Array} Returns the new array of filtered values. 15553 * @see _.without, _.xor 15554 * @example 15555 * 15556 * _.difference([2, 1], [2, 3]); 15557 * // => [1] 15558 */ 15559 var difference = baseRest(function(array, values) { 15560 return isArrayLikeObject(array) 15561 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) 15562 : []; 15563 }); 15564 15565 /** 15566 * This method is like `_.difference` except that it accepts `iteratee` which 15567 * is invoked for each element of `array` and `values` to generate the criterion 15568 * by which they're compared. The order and references of result values are 15569 * determined by the first array. The iteratee is invoked with one argument: 15570 * (value). 15571 * 15572 * **Note:** Unlike `_.pullAllBy`, this method returns a new array. 15573 * 15574 * @static 15575 * @memberOf _ 15576 * @since 4.0.0 15577 * @category Array 15578 * @param {Array} array The array to inspect. 15579 * @param {...Array} [values] The values to exclude. 15580 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 15581 * @returns {Array} Returns the new array of filtered values. 15582 * @example 15583 * 15584 * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); 15585 * // => [1.2] 15586 * 15587 * // The `_.property` iteratee shorthand. 15588 * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); 15589 * // => [{ 'x': 2 }] 15590 */ 15591 var differenceBy = baseRest(function(array, values) { 15592 var iteratee = last(values); 15593 if (isArrayLikeObject(iteratee)) { 15594 iteratee = undefined; 15595 } 15596 return isArrayLikeObject(array) 15597 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)) 15598 : []; 15599 }); 15600 15601 /** 15602 * This method is like `_.difference` except that it accepts `comparator` 15603 * which is invoked to compare elements of `array` to `values`. The order and 15604 * references of result values are determined by the first array. The comparator 15605 * is invoked with two arguments: (arrVal, othVal). 15606 * 15607 * **Note:** Unlike `_.pullAllWith`, this method returns a new array. 15608 * 15609 * @static 15610 * @memberOf _ 15611 * @since 4.0.0 15612 * @category Array 15613 * @param {Array} array The array to inspect. 15614 * @param {...Array} [values] The values to exclude. 15615 * @param {Function} [comparator] The comparator invoked per element. 15616 * @returns {Array} Returns the new array of filtered values. 15617 * @example 15618 * 15619 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 15620 * 15621 * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); 15622 * // => [{ 'x': 2, 'y': 1 }] 15623 */ 15624 var differenceWith = baseRest(function(array, values) { 15625 var comparator = last(values); 15626 if (isArrayLikeObject(comparator)) { 15627 comparator = undefined; 15628 } 15629 return isArrayLikeObject(array) 15630 ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) 15631 : []; 15632 }); 15633 15634 /** 15635 * Creates a slice of `array` with `n` elements dropped from the beginning. 15636 * 15637 * @static 15638 * @memberOf _ 15639 * @since 0.5.0 15640 * @category Array 15641 * @param {Array} array The array to query. 15642 * @param {number} [n=1] The number of elements to drop. 15643 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 15644 * @returns {Array} Returns the slice of `array`. 15645 * @example 15646 * 15647 * _.drop([1, 2, 3]); 15648 * // => [2, 3] 15649 * 15650 * _.drop([1, 2, 3], 2); 15651 * // => [3] 15652 * 15653 * _.drop([1, 2, 3], 5); 15654 * // => [] 15655 * 15656 * _.drop([1, 2, 3], 0); 15657 * // => [1, 2, 3] 15658 */ 15659 function drop(array, n, guard) { 15660 var length = array == null ? 0 : array.length; 15661 if (!length) { 15662 return []; 15663 } 15664 n = (guard || n === undefined) ? 1 : toInteger(n); 15665 return baseSlice(array, n < 0 ? 0 : n, length); 15666 } 15667 15668 /** 15669 * Creates a slice of `array` with `n` elements dropped from the end. 15670 * 15671 * @static 15672 * @memberOf _ 15673 * @since 3.0.0 15674 * @category Array 15675 * @param {Array} array The array to query. 15676 * @param {number} [n=1] The number of elements to drop. 15677 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 15678 * @returns {Array} Returns the slice of `array`. 15679 * @example 15680 * 15681 * _.dropRight([1, 2, 3]); 15682 * // => [1, 2] 15683 * 15684 * _.dropRight([1, 2, 3], 2); 15685 * // => [1] 15686 * 15687 * _.dropRight([1, 2, 3], 5); 15688 * // => [] 15689 * 15690 * _.dropRight([1, 2, 3], 0); 15691 * // => [1, 2, 3] 15692 */ 15693 function dropRight(array, n, guard) { 15694 var length = array == null ? 0 : array.length; 15695 if (!length) { 15696 return []; 15697 } 15698 n = (guard || n === undefined) ? 1 : toInteger(n); 15699 n = length - n; 15700 return baseSlice(array, 0, n < 0 ? 0 : n); 15701 } 15702 15703 /** 15704 * Creates a slice of `array` excluding elements dropped from the end. 15705 * Elements are dropped until `predicate` returns falsey. The predicate is 15706 * invoked with three arguments: (value, index, array). 15707 * 15708 * @static 15709 * @memberOf _ 15710 * @since 3.0.0 15711 * @category Array 15712 * @param {Array} array The array to query. 15713 * @param {Function} [predicate=_.identity] The function invoked per iteration. 15714 * @returns {Array} Returns the slice of `array`. 15715 * @example 15716 * 15717 * var users = [ 15718 * { 'user': 'barney', 'active': true }, 15719 * { 'user': 'fred', 'active': false }, 15720 * { 'user': 'pebbles', 'active': false } 15721 * ]; 15722 * 15723 * _.dropRightWhile(users, function(o) { return !o.active; }); 15724 * // => objects for ['barney'] 15725 * 15726 * // The `_.matches` iteratee shorthand. 15727 * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); 15728 * // => objects for ['barney', 'fred'] 15729 * 15730 * // The `_.matchesProperty` iteratee shorthand. 15731 * _.dropRightWhile(users, ['active', false]); 15732 * // => objects for ['barney'] 15733 * 15734 * // The `_.property` iteratee shorthand. 15735 * _.dropRightWhile(users, 'active'); 15736 * // => objects for ['barney', 'fred', 'pebbles'] 15737 */ 15738 function dropRightWhile(array, predicate) { 15739 return (array && array.length) 15740 ? baseWhile(array, getIteratee(predicate, 3), true, true) 15741 : []; 15742 } 15743 15744 /** 15745 * Creates a slice of `array` excluding elements dropped from the beginning. 15746 * Elements are dropped until `predicate` returns falsey. The predicate is 15747 * invoked with three arguments: (value, index, array). 15748 * 15749 * @static 15750 * @memberOf _ 15751 * @since 3.0.0 15752 * @category Array 15753 * @param {Array} array The array to query. 15754 * @param {Function} [predicate=_.identity] The function invoked per iteration. 15755 * @returns {Array} Returns the slice of `array`. 15756 * @example 15757 * 15758 * var users = [ 15759 * { 'user': 'barney', 'active': false }, 15760 * { 'user': 'fred', 'active': false }, 15761 * { 'user': 'pebbles', 'active': true } 15762 * ]; 15763 * 15764 * _.dropWhile(users, function(o) { return !o.active; }); 15765 * // => objects for ['pebbles'] 15766 * 15767 * // The `_.matches` iteratee shorthand. 15768 * _.dropWhile(users, { 'user': 'barney', 'active': false }); 15769 * // => objects for ['fred', 'pebbles'] 15770 * 15771 * // The `_.matchesProperty` iteratee shorthand. 15772 * _.dropWhile(users, ['active', false]); 15773 * // => objects for ['pebbles'] 15774 * 15775 * // The `_.property` iteratee shorthand. 15776 * _.dropWhile(users, 'active'); 15777 * // => objects for ['barney', 'fred', 'pebbles'] 15778 */ 15779 function dropWhile(array, predicate) { 15780 return (array && array.length) 15781 ? baseWhile(array, getIteratee(predicate, 3), true) 15782 : []; 15783 } 15784 15785 /** 15786 * Fills elements of `array` with `value` from `start` up to, but not 15787 * including, `end`. 15788 * 15789 * **Note:** This method mutates `array`. 15790 * 15791 * @static 15792 * @memberOf _ 15793 * @since 3.2.0 15794 * @category Array 15795 * @param {Array} array The array to fill. 15796 * @param {*} value The value to fill `array` with. 15797 * @param {number} [start=0] The start position. 15798 * @param {number} [end=array.length] The end position. 15799 * @returns {Array} Returns `array`. 15800 * @example 15801 * 15802 * var array = [1, 2, 3]; 15803 * 15804 * _.fill(array, 'a'); 15805 * console.log(array); 15806 * // => ['a', 'a', 'a'] 15807 * 15808 * _.fill(Array(3), 2); 15809 * // => [2, 2, 2] 15810 * 15811 * _.fill([4, 6, 8, 10], '*', 1, 3); 15812 * // => [4, '*', '*', 10] 15813 */ 15814 function fill(array, value, start, end) { 15815 var length = array == null ? 0 : array.length; 15816 if (!length) { 15817 return []; 15818 } 15819 if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { 15820 start = 0; 15821 end = length; 15822 } 15823 return baseFill(array, value, start, end); 15824 } 15825 15826 /** 15827 * This method is like `_.find` except that it returns the index of the first 15828 * element `predicate` returns truthy for instead of the element itself. 15829 * 15830 * @static 15831 * @memberOf _ 15832 * @since 1.1.0 15833 * @category Array 15834 * @param {Array} array The array to inspect. 15835 * @param {Function} [predicate=_.identity] The function invoked per iteration. 15836 * @param {number} [fromIndex=0] The index to search from. 15837 * @returns {number} Returns the index of the found element, else `-1`. 15838 * @example 15839 * 15840 * var users = [ 15841 * { 'user': 'barney', 'active': false }, 15842 * { 'user': 'fred', 'active': false }, 15843 * { 'user': 'pebbles', 'active': true } 15844 * ]; 15845 * 15846 * _.findIndex(users, function(o) { return o.user == 'barney'; }); 15847 * // => 0 15848 * 15849 * // The `_.matches` iteratee shorthand. 15850 * _.findIndex(users, { 'user': 'fred', 'active': false }); 15851 * // => 1 15852 * 15853 * // The `_.matchesProperty` iteratee shorthand. 15854 * _.findIndex(users, ['active', false]); 15855 * // => 0 15856 * 15857 * // The `_.property` iteratee shorthand. 15858 * _.findIndex(users, 'active'); 15859 * // => 2 15860 */ 15861 function findIndex(array, predicate, fromIndex) { 15862 var length = array == null ? 0 : array.length; 15863 if (!length) { 15864 return -1; 15865 } 15866 var index = fromIndex == null ? 0 : toInteger(fromIndex); 15867 if (index < 0) { 15868 index = nativeMax(length + index, 0); 15869 } 15870 return baseFindIndex(array, getIteratee(predicate, 3), index); 15871 } 15872 15873 /** 15874 * This method is like `_.findIndex` except that it iterates over elements 15875 * of `collection` from right to left. 15876 * 15877 * @static 15878 * @memberOf _ 15879 * @since 2.0.0 15880 * @category Array 15881 * @param {Array} array The array to inspect. 15882 * @param {Function} [predicate=_.identity] The function invoked per iteration. 15883 * @param {number} [fromIndex=array.length-1] The index to search from. 15884 * @returns {number} Returns the index of the found element, else `-1`. 15885 * @example 15886 * 15887 * var users = [ 15888 * { 'user': 'barney', 'active': true }, 15889 * { 'user': 'fred', 'active': false }, 15890 * { 'user': 'pebbles', 'active': false } 15891 * ]; 15892 * 15893 * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); 15894 * // => 2 15895 * 15896 * // The `_.matches` iteratee shorthand. 15897 * _.findLastIndex(users, { 'user': 'barney', 'active': true }); 15898 * // => 0 15899 * 15900 * // The `_.matchesProperty` iteratee shorthand. 15901 * _.findLastIndex(users, ['active', false]); 15902 * // => 2 15903 * 15904 * // The `_.property` iteratee shorthand. 15905 * _.findLastIndex(users, 'active'); 15906 * // => 0 15907 */ 15908 function findLastIndex(array, predicate, fromIndex) { 15909 var length = array == null ? 0 : array.length; 15910 if (!length) { 15911 return -1; 15912 } 15913 var index = length - 1; 15914 if (fromIndex !== undefined) { 15915 index = toInteger(fromIndex); 15916 index = fromIndex < 0 15917 ? nativeMax(length + index, 0) 15918 : nativeMin(index, length - 1); 15919 } 15920 return baseFindIndex(array, getIteratee(predicate, 3), index, true); 15921 } 15922 15923 /** 15924 * Flattens `array` a single level deep. 15925 * 15926 * @static 15927 * @memberOf _ 15928 * @since 0.1.0 15929 * @category Array 15930 * @param {Array} array The array to flatten. 15931 * @returns {Array} Returns the new flattened array. 15932 * @example 15933 * 15934 * _.flatten([1, [2, [3, [4]], 5]]); 15935 * // => [1, 2, [3, [4]], 5] 15936 */ 15937 function flatten(array) { 15938 var length = array == null ? 0 : array.length; 15939 return length ? baseFlatten(array, 1) : []; 15940 } 15941 15942 /** 15943 * Recursively flattens `array`. 15944 * 15945 * @static 15946 * @memberOf _ 15947 * @since 3.0.0 15948 * @category Array 15949 * @param {Array} array The array to flatten. 15950 * @returns {Array} Returns the new flattened array. 15951 * @example 15952 * 15953 * _.flattenDeep([1, [2, [3, [4]], 5]]); 15954 * // => [1, 2, 3, 4, 5] 15955 */ 15956 function flattenDeep(array) { 15957 var length = array == null ? 0 : array.length; 15958 return length ? baseFlatten(array, INFINITY) : []; 15959 } 15960 15961 /** 15962 * Recursively flatten `array` up to `depth` times. 15963 * 15964 * @static 15965 * @memberOf _ 15966 * @since 4.4.0 15967 * @category Array 15968 * @param {Array} array The array to flatten. 15969 * @param {number} [depth=1] The maximum recursion depth. 15970 * @returns {Array} Returns the new flattened array. 15971 * @example 15972 * 15973 * var array = [1, [2, [3, [4]], 5]]; 15974 * 15975 * _.flattenDepth(array, 1); 15976 * // => [1, 2, [3, [4]], 5] 15977 * 15978 * _.flattenDepth(array, 2); 15979 * // => [1, 2, 3, [4], 5] 15980 */ 15981 function flattenDepth(array, depth) { 15982 var length = array == null ? 0 : array.length; 15983 if (!length) { 15984 return []; 15985 } 15986 depth = depth === undefined ? 1 : toInteger(depth); 15987 return baseFlatten(array, depth); 15988 } 15989 15990 /** 15991 * The inverse of `_.toPairs`; this method returns an object composed 15992 * from key-value `pairs`. 15993 * 15994 * @static 15995 * @memberOf _ 15996 * @since 4.0.0 15997 * @category Array 15998 * @param {Array} pairs The key-value pairs. 15999 * @returns {Object} Returns the new object. 16000 * @example 16001 * 16002 * _.fromPairs([['a', 1], ['b', 2]]); 16003 * // => { 'a': 1, 'b': 2 } 16004 */ 16005 function fromPairs(pairs) { 16006 var index = -1, 16007 length = pairs == null ? 0 : pairs.length, 16008 result = {}; 16009 16010 while (++index < length) { 16011 var pair = pairs[index]; 16012 result[pair[0]] = pair[1]; 16013 } 16014 return result; 16015 } 16016 16017 /** 16018 * Gets the first element of `array`. 16019 * 16020 * @static 16021 * @memberOf _ 16022 * @since 0.1.0 16023 * @alias first 16024 * @category Array 16025 * @param {Array} array The array to query. 16026 * @returns {*} Returns the first element of `array`. 16027 * @example 16028 * 16029 * _.head([1, 2, 3]); 16030 * // => 1 16031 * 16032 * _.head([]); 16033 * // => undefined 16034 */ 16035 function head(array) { 16036 return (array && array.length) ? array[0] : undefined; 16037 } 16038 16039 /** 16040 * Gets the index at which the first occurrence of `value` is found in `array` 16041 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 16042 * for equality comparisons. If `fromIndex` is negative, it's used as the 16043 * offset from the end of `array`. 16044 * 16045 * @static 16046 * @memberOf _ 16047 * @since 0.1.0 16048 * @category Array 16049 * @param {Array} array The array to inspect. 16050 * @param {*} value The value to search for. 16051 * @param {number} [fromIndex=0] The index to search from. 16052 * @returns {number} Returns the index of the matched value, else `-1`. 16053 * @example 16054 * 16055 * _.indexOf([1, 2, 1, 2], 2); 16056 * // => 1 16057 * 16058 * // Search from the `fromIndex`. 16059 * _.indexOf([1, 2, 1, 2], 2, 2); 16060 * // => 3 16061 */ 16062 function indexOf(array, value, fromIndex) { 16063 var length = array == null ? 0 : array.length; 16064 if (!length) { 16065 return -1; 16066 } 16067 var index = fromIndex == null ? 0 : toInteger(fromIndex); 16068 if (index < 0) { 16069 index = nativeMax(length + index, 0); 16070 } 16071 return baseIndexOf(array, value, index); 16072 } 16073 16074 /** 16075 * Gets all but the last element of `array`. 16076 * 16077 * @static 16078 * @memberOf _ 16079 * @since 0.1.0 16080 * @category Array 16081 * @param {Array} array The array to query. 16082 * @returns {Array} Returns the slice of `array`. 16083 * @example 16084 * 16085 * _.initial([1, 2, 3]); 16086 * // => [1, 2] 16087 */ 16088 function initial(array) { 16089 var length = array == null ? 0 : array.length; 16090 return length ? baseSlice(array, 0, -1) : []; 16091 } 16092 16093 /** 16094 * Creates an array of unique values that are included in all given arrays 16095 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 16096 * for equality comparisons. The order and references of result values are 16097 * determined by the first array. 16098 * 16099 * @static 16100 * @memberOf _ 16101 * @since 0.1.0 16102 * @category Array 16103 * @param {...Array} [arrays] The arrays to inspect. 16104 * @returns {Array} Returns the new array of intersecting values. 16105 * @example 16106 * 16107 * _.intersection([2, 1], [2, 3]); 16108 * // => [2] 16109 */ 16110 var intersection = baseRest(function(arrays) { 16111 var mapped = arrayMap(arrays, castArrayLikeObject); 16112 return (mapped.length && mapped[0] === arrays[0]) 16113 ? baseIntersection(mapped) 16114 : []; 16115 }); 16116 16117 /** 16118 * This method is like `_.intersection` except that it accepts `iteratee` 16119 * which is invoked for each element of each `arrays` to generate the criterion 16120 * by which they're compared. The order and references of result values are 16121 * determined by the first array. The iteratee is invoked with one argument: 16122 * (value). 16123 * 16124 * @static 16125 * @memberOf _ 16126 * @since 4.0.0 16127 * @category Array 16128 * @param {...Array} [arrays] The arrays to inspect. 16129 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 16130 * @returns {Array} Returns the new array of intersecting values. 16131 * @example 16132 * 16133 * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); 16134 * // => [2.1] 16135 * 16136 * // The `_.property` iteratee shorthand. 16137 * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 16138 * // => [{ 'x': 1 }] 16139 */ 16140 var intersectionBy = baseRest(function(arrays) { 16141 var iteratee = last(arrays), 16142 mapped = arrayMap(arrays, castArrayLikeObject); 16143 16144 if (iteratee === last(mapped)) { 16145 iteratee = undefined; 16146 } else { 16147 mapped.pop(); 16148 } 16149 return (mapped.length && mapped[0] === arrays[0]) 16150 ? baseIntersection(mapped, getIteratee(iteratee, 2)) 16151 : []; 16152 }); 16153 16154 /** 16155 * This method is like `_.intersection` except that it accepts `comparator` 16156 * which is invoked to compare elements of `arrays`. The order and references 16157 * of result values are determined by the first array. The comparator is 16158 * invoked with two arguments: (arrVal, othVal). 16159 * 16160 * @static 16161 * @memberOf _ 16162 * @since 4.0.0 16163 * @category Array 16164 * @param {...Array} [arrays] The arrays to inspect. 16165 * @param {Function} [comparator] The comparator invoked per element. 16166 * @returns {Array} Returns the new array of intersecting values. 16167 * @example 16168 * 16169 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 16170 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 16171 * 16172 * _.intersectionWith(objects, others, _.isEqual); 16173 * // => [{ 'x': 1, 'y': 2 }] 16174 */ 16175 var intersectionWith = baseRest(function(arrays) { 16176 var comparator = last(arrays), 16177 mapped = arrayMap(arrays, castArrayLikeObject); 16178 16179 comparator = typeof comparator == 'function' ? comparator : undefined; 16180 if (comparator) { 16181 mapped.pop(); 16182 } 16183 return (mapped.length && mapped[0] === arrays[0]) 16184 ? baseIntersection(mapped, undefined, comparator) 16185 : []; 16186 }); 16187 16188 /** 16189 * Converts all elements in `array` into a string separated by `separator`. 16190 * 16191 * @static 16192 * @memberOf _ 16193 * @since 4.0.0 16194 * @category Array 16195 * @param {Array} array The array to convert. 16196 * @param {string} [separator=','] The element separator. 16197 * @returns {string} Returns the joined string. 16198 * @example 16199 * 16200 * _.join(['a', 'b', 'c'], '~'); 16201 * // => 'a~b~c' 16202 */ 16203 function join(array, separator) { 16204 return array == null ? '' : nativeJoin.call(array, separator); 16205 } 16206 16207 /** 16208 * Gets the last element of `array`. 16209 * 16210 * @static 16211 * @memberOf _ 16212 * @since 0.1.0 16213 * @category Array 16214 * @param {Array} array The array to query. 16215 * @returns {*} Returns the last element of `array`. 16216 * @example 16217 * 16218 * _.last([1, 2, 3]); 16219 * // => 3 16220 */ 16221 function last(array) { 16222 var length = array == null ? 0 : array.length; 16223 return length ? array[length - 1] : undefined; 16224 } 16225 16226 /** 16227 * This method is like `_.indexOf` except that it iterates over elements of 16228 * `array` from right to left. 16229 * 16230 * @static 16231 * @memberOf _ 16232 * @since 0.1.0 16233 * @category Array 16234 * @param {Array} array The array to inspect. 16235 * @param {*} value The value to search for. 16236 * @param {number} [fromIndex=array.length-1] The index to search from. 16237 * @returns {number} Returns the index of the matched value, else `-1`. 16238 * @example 16239 * 16240 * _.lastIndexOf([1, 2, 1, 2], 2); 16241 * // => 3 16242 * 16243 * // Search from the `fromIndex`. 16244 * _.lastIndexOf([1, 2, 1, 2], 2, 2); 16245 * // => 1 16246 */ 16247 function lastIndexOf(array, value, fromIndex) { 16248 var length = array == null ? 0 : array.length; 16249 if (!length) { 16250 return -1; 16251 } 16252 var index = length; 16253 if (fromIndex !== undefined) { 16254 index = toInteger(fromIndex); 16255 index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); 16256 } 16257 return value === value 16258 ? strictLastIndexOf(array, value, index) 16259 : baseFindIndex(array, baseIsNaN, index, true); 16260 } 16261 16262 /** 16263 * Gets the element at index `n` of `array`. If `n` is negative, the nth 16264 * element from the end is returned. 16265 * 16266 * @static 16267 * @memberOf _ 16268 * @since 4.11.0 16269 * @category Array 16270 * @param {Array} array The array to query. 16271 * @param {number} [n=0] The index of the element to return. 16272 * @returns {*} Returns the nth element of `array`. 16273 * @example 16274 * 16275 * var array = ['a', 'b', 'c', 'd']; 16276 * 16277 * _.nth(array, 1); 16278 * // => 'b' 16279 * 16280 * _.nth(array, -2); 16281 * // => 'c'; 16282 */ 16283 function nth(array, n) { 16284 return (array && array.length) ? baseNth(array, toInteger(n)) : undefined; 16285 } 16286 16287 /** 16288 * Removes all given values from `array` using 16289 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 16290 * for equality comparisons. 16291 * 16292 * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` 16293 * to remove elements from an array by predicate. 16294 * 16295 * @static 16296 * @memberOf _ 16297 * @since 2.0.0 16298 * @category Array 16299 * @param {Array} array The array to modify. 16300 * @param {...*} [values] The values to remove. 16301 * @returns {Array} Returns `array`. 16302 * @example 16303 * 16304 * var array = ['a', 'b', 'c', 'a', 'b', 'c']; 16305 * 16306 * _.pull(array, 'a', 'c'); 16307 * console.log(array); 16308 * // => ['b', 'b'] 16309 */ 16310 var pull = baseRest(pullAll); 16311 16312 /** 16313 * This method is like `_.pull` except that it accepts an array of values to remove. 16314 * 16315 * **Note:** Unlike `_.difference`, this method mutates `array`. 16316 * 16317 * @static 16318 * @memberOf _ 16319 * @since 4.0.0 16320 * @category Array 16321 * @param {Array} array The array to modify. 16322 * @param {Array} values The values to remove. 16323 * @returns {Array} Returns `array`. 16324 * @example 16325 * 16326 * var array = ['a', 'b', 'c', 'a', 'b', 'c']; 16327 * 16328 * _.pullAll(array, ['a', 'c']); 16329 * console.log(array); 16330 * // => ['b', 'b'] 16331 */ 16332 function pullAll(array, values) { 16333 return (array && array.length && values && values.length) 16334 ? basePullAll(array, values) 16335 : array; 16336 } 16337 16338 /** 16339 * This method is like `_.pullAll` except that it accepts `iteratee` which is 16340 * invoked for each element of `array` and `values` to generate the criterion 16341 * by which they're compared. The iteratee is invoked with one argument: (value). 16342 * 16343 * **Note:** Unlike `_.differenceBy`, this method mutates `array`. 16344 * 16345 * @static 16346 * @memberOf _ 16347 * @since 4.0.0 16348 * @category Array 16349 * @param {Array} array The array to modify. 16350 * @param {Array} values The values to remove. 16351 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 16352 * @returns {Array} Returns `array`. 16353 * @example 16354 * 16355 * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; 16356 * 16357 * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); 16358 * console.log(array); 16359 * // => [{ 'x': 2 }] 16360 */ 16361 function pullAllBy(array, values, iteratee) { 16362 return (array && array.length && values && values.length) 16363 ? basePullAll(array, values, getIteratee(iteratee, 2)) 16364 : array; 16365 } 16366 16367 /** 16368 * This method is like `_.pullAll` except that it accepts `comparator` which 16369 * is invoked to compare elements of `array` to `values`. The comparator is 16370 * invoked with two arguments: (arrVal, othVal). 16371 * 16372 * **Note:** Unlike `_.differenceWith`, this method mutates `array`. 16373 * 16374 * @static 16375 * @memberOf _ 16376 * @since 4.6.0 16377 * @category Array 16378 * @param {Array} array The array to modify. 16379 * @param {Array} values The values to remove. 16380 * @param {Function} [comparator] The comparator invoked per element. 16381 * @returns {Array} Returns `array`. 16382 * @example 16383 * 16384 * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; 16385 * 16386 * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); 16387 * console.log(array); 16388 * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] 16389 */ 16390 function pullAllWith(array, values, comparator) { 16391 return (array && array.length && values && values.length) 16392 ? basePullAll(array, values, undefined, comparator) 16393 : array; 16394 } 16395 16396 /** 16397 * Removes elements from `array` corresponding to `indexes` and returns an 16398 * array of removed elements. 16399 * 16400 * **Note:** Unlike `_.at`, this method mutates `array`. 16401 * 16402 * @static 16403 * @memberOf _ 16404 * @since 3.0.0 16405 * @category Array 16406 * @param {Array} array The array to modify. 16407 * @param {...(number|number[])} [indexes] The indexes of elements to remove. 16408 * @returns {Array} Returns the new array of removed elements. 16409 * @example 16410 * 16411 * var array = ['a', 'b', 'c', 'd']; 16412 * var pulled = _.pullAt(array, [1, 3]); 16413 * 16414 * console.log(array); 16415 * // => ['a', 'c'] 16416 * 16417 * console.log(pulled); 16418 * // => ['b', 'd'] 16419 */ 16420 var pullAt = flatRest(function(array, indexes) { 16421 var length = array == null ? 0 : array.length, 16422 result = baseAt(array, indexes); 16423 16424 basePullAt(array, arrayMap(indexes, function(index) { 16425 return isIndex(index, length) ? +index : index; 16426 }).sort(compareAscending)); 16427 16428 return result; 16429 }); 16430 16431 /** 16432 * Removes all elements from `array` that `predicate` returns truthy for 16433 * and returns an array of the removed elements. The predicate is invoked 16434 * with three arguments: (value, index, array). 16435 * 16436 * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` 16437 * to pull elements from an array by value. 16438 * 16439 * @static 16440 * @memberOf _ 16441 * @since 2.0.0 16442 * @category Array 16443 * @param {Array} array The array to modify. 16444 * @param {Function} [predicate=_.identity] The function invoked per iteration. 16445 * @returns {Array} Returns the new array of removed elements. 16446 * @example 16447 * 16448 * var array = [1, 2, 3, 4]; 16449 * var evens = _.remove(array, function(n) { 16450 * return n % 2 == 0; 16451 * }); 16452 * 16453 * console.log(array); 16454 * // => [1, 3] 16455 * 16456 * console.log(evens); 16457 * // => [2, 4] 16458 */ 16459 function remove(array, predicate) { 16460 var result = []; 16461 if (!(array && array.length)) { 16462 return result; 16463 } 16464 var index = -1, 16465 indexes = [], 16466 length = array.length; 16467 16468 predicate = getIteratee(predicate, 3); 16469 while (++index < length) { 16470 var value = array[index]; 16471 if (predicate(value, index, array)) { 16472 result.push(value); 16473 indexes.push(index); 16474 } 16475 } 16476 basePullAt(array, indexes); 16477 return result; 16478 } 16479 16480 /** 16481 * Reverses `array` so that the first element becomes the last, the second 16482 * element becomes the second to last, and so on. 16483 * 16484 * **Note:** This method mutates `array` and is based on 16485 * [`Array#reverse`](https://mdn.io/Array/reverse). 16486 * 16487 * @static 16488 * @memberOf _ 16489 * @since 4.0.0 16490 * @category Array 16491 * @param {Array} array The array to modify. 16492 * @returns {Array} Returns `array`. 16493 * @example 16494 * 16495 * var array = [1, 2, 3]; 16496 * 16497 * _.reverse(array); 16498 * // => [3, 2, 1] 16499 * 16500 * console.log(array); 16501 * // => [3, 2, 1] 16502 */ 16503 function reverse(array) { 16504 return array == null ? array : nativeReverse.call(array); 16505 } 16506 16507 /** 16508 * Creates a slice of `array` from `start` up to, but not including, `end`. 16509 * 16510 * **Note:** This method is used instead of 16511 * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are 16512 * returned. 16513 * 16514 * @static 16515 * @memberOf _ 16516 * @since 3.0.0 16517 * @category Array 16518 * @param {Array} array The array to slice. 16519 * @param {number} [start=0] The start position. 16520 * @param {number} [end=array.length] The end position. 16521 * @returns {Array} Returns the slice of `array`. 16522 */ 16523 function slice(array, start, end) { 16524 var length = array == null ? 0 : array.length; 16525 if (!length) { 16526 return []; 16527 } 16528 if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { 16529 start = 0; 16530 end = length; 16531 } 16532 else { 16533 start = start == null ? 0 : toInteger(start); 16534 end = end === undefined ? length : toInteger(end); 16535 } 16536 return baseSlice(array, start, end); 16537 } 16538 16539 /** 16540 * Uses a binary search to determine the lowest index at which `value` 16541 * should be inserted into `array` in order to maintain its sort order. 16542 * 16543 * @static 16544 * @memberOf _ 16545 * @since 0.1.0 16546 * @category Array 16547 * @param {Array} array The sorted array to inspect. 16548 * @param {*} value The value to evaluate. 16549 * @returns {number} Returns the index at which `value` should be inserted 16550 * into `array`. 16551 * @example 16552 * 16553 * _.sortedIndex([30, 50], 40); 16554 * // => 1 16555 */ 16556 function sortedIndex(array, value) { 16557 return baseSortedIndex(array, value); 16558 } 16559 16560 /** 16561 * This method is like `_.sortedIndex` except that it accepts `iteratee` 16562 * which is invoked for `value` and each element of `array` to compute their 16563 * sort ranking. The iteratee is invoked with one argument: (value). 16564 * 16565 * @static 16566 * @memberOf _ 16567 * @since 4.0.0 16568 * @category Array 16569 * @param {Array} array The sorted array to inspect. 16570 * @param {*} value The value to evaluate. 16571 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 16572 * @returns {number} Returns the index at which `value` should be inserted 16573 * into `array`. 16574 * @example 16575 * 16576 * var objects = [{ 'x': 4 }, { 'x': 5 }]; 16577 * 16578 * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); 16579 * // => 0 16580 * 16581 * // The `_.property` iteratee shorthand. 16582 * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); 16583 * // => 0 16584 */ 16585 function sortedIndexBy(array, value, iteratee) { 16586 return baseSortedIndexBy(array, value, getIteratee(iteratee, 2)); 16587 } 16588 16589 /** 16590 * This method is like `_.indexOf` except that it performs a binary 16591 * search on a sorted `array`. 16592 * 16593 * @static 16594 * @memberOf _ 16595 * @since 4.0.0 16596 * @category Array 16597 * @param {Array} array The array to inspect. 16598 * @param {*} value The value to search for. 16599 * @returns {number} Returns the index of the matched value, else `-1`. 16600 * @example 16601 * 16602 * _.sortedIndexOf([4, 5, 5, 5, 6], 5); 16603 * // => 1 16604 */ 16605 function sortedIndexOf(array, value) { 16606 var length = array == null ? 0 : array.length; 16607 if (length) { 16608 var index = baseSortedIndex(array, value); 16609 if (index < length && eq(array[index], value)) { 16610 return index; 16611 } 16612 } 16613 return -1; 16614 } 16615 16616 /** 16617 * This method is like `_.sortedIndex` except that it returns the highest 16618 * index at which `value` should be inserted into `array` in order to 16619 * maintain its sort order. 16620 * 16621 * @static 16622 * @memberOf _ 16623 * @since 3.0.0 16624 * @category Array 16625 * @param {Array} array The sorted array to inspect. 16626 * @param {*} value The value to evaluate. 16627 * @returns {number} Returns the index at which `value` should be inserted 16628 * into `array`. 16629 * @example 16630 * 16631 * _.sortedLastIndex([4, 5, 5, 5, 6], 5); 16632 * // => 4 16633 */ 16634 function sortedLastIndex(array, value) { 16635 return baseSortedIndex(array, value, true); 16636 } 16637 16638 /** 16639 * This method is like `_.sortedLastIndex` except that it accepts `iteratee` 16640 * which is invoked for `value` and each element of `array` to compute their 16641 * sort ranking. The iteratee is invoked with one argument: (value). 16642 * 16643 * @static 16644 * @memberOf _ 16645 * @since 4.0.0 16646 * @category Array 16647 * @param {Array} array The sorted array to inspect. 16648 * @param {*} value The value to evaluate. 16649 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 16650 * @returns {number} Returns the index at which `value` should be inserted 16651 * into `array`. 16652 * @example 16653 * 16654 * var objects = [{ 'x': 4 }, { 'x': 5 }]; 16655 * 16656 * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); 16657 * // => 1 16658 * 16659 * // The `_.property` iteratee shorthand. 16660 * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); 16661 * // => 1 16662 */ 16663 function sortedLastIndexBy(array, value, iteratee) { 16664 return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true); 16665 } 16666 16667 /** 16668 * This method is like `_.lastIndexOf` except that it performs a binary 16669 * search on a sorted `array`. 16670 * 16671 * @static 16672 * @memberOf _ 16673 * @since 4.0.0 16674 * @category Array 16675 * @param {Array} array The array to inspect. 16676 * @param {*} value The value to search for. 16677 * @returns {number} Returns the index of the matched value, else `-1`. 16678 * @example 16679 * 16680 * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); 16681 * // => 3 16682 */ 16683 function sortedLastIndexOf(array, value) { 16684 var length = array == null ? 0 : array.length; 16685 if (length) { 16686 var index = baseSortedIndex(array, value, true) - 1; 16687 if (eq(array[index], value)) { 16688 return index; 16689 } 16690 } 16691 return -1; 16692 } 16693 16694 /** 16695 * This method is like `_.uniq` except that it's designed and optimized 16696 * for sorted arrays. 16697 * 16698 * @static 16699 * @memberOf _ 16700 * @since 4.0.0 16701 * @category Array 16702 * @param {Array} array The array to inspect. 16703 * @returns {Array} Returns the new duplicate free array. 16704 * @example 16705 * 16706 * _.sortedUniq([1, 1, 2]); 16707 * // => [1, 2] 16708 */ 16709 function sortedUniq(array) { 16710 return (array && array.length) 16711 ? baseSortedUniq(array) 16712 : []; 16713 } 16714 16715 /** 16716 * This method is like `_.uniqBy` except that it's designed and optimized 16717 * for sorted arrays. 16718 * 16719 * @static 16720 * @memberOf _ 16721 * @since 4.0.0 16722 * @category Array 16723 * @param {Array} array The array to inspect. 16724 * @param {Function} [iteratee] The iteratee invoked per element. 16725 * @returns {Array} Returns the new duplicate free array. 16726 * @example 16727 * 16728 * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); 16729 * // => [1.1, 2.3] 16730 */ 16731 function sortedUniqBy(array, iteratee) { 16732 return (array && array.length) 16733 ? baseSortedUniq(array, getIteratee(iteratee, 2)) 16734 : []; 16735 } 16736 16737 /** 16738 * Gets all but the first element of `array`. 16739 * 16740 * @static 16741 * @memberOf _ 16742 * @since 4.0.0 16743 * @category Array 16744 * @param {Array} array The array to query. 16745 * @returns {Array} Returns the slice of `array`. 16746 * @example 16747 * 16748 * _.tail([1, 2, 3]); 16749 * // => [2, 3] 16750 */ 16751 function tail(array) { 16752 var length = array == null ? 0 : array.length; 16753 return length ? baseSlice(array, 1, length) : []; 16754 } 16755 16756 /** 16757 * Creates a slice of `array` with `n` elements taken from the beginning. 16758 * 16759 * @static 16760 * @memberOf _ 16761 * @since 0.1.0 16762 * @category Array 16763 * @param {Array} array The array to query. 16764 * @param {number} [n=1] The number of elements to take. 16765 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 16766 * @returns {Array} Returns the slice of `array`. 16767 * @example 16768 * 16769 * _.take([1, 2, 3]); 16770 * // => [1] 16771 * 16772 * _.take([1, 2, 3], 2); 16773 * // => [1, 2] 16774 * 16775 * _.take([1, 2, 3], 5); 16776 * // => [1, 2, 3] 16777 * 16778 * _.take([1, 2, 3], 0); 16779 * // => [] 16780 */ 16781 function take(array, n, guard) { 16782 if (!(array && array.length)) { 16783 return []; 16784 } 16785 n = (guard || n === undefined) ? 1 : toInteger(n); 16786 return baseSlice(array, 0, n < 0 ? 0 : n); 16787 } 16788 16789 /** 16790 * Creates a slice of `array` with `n` elements taken from the end. 16791 * 16792 * @static 16793 * @memberOf _ 16794 * @since 3.0.0 16795 * @category Array 16796 * @param {Array} array The array to query. 16797 * @param {number} [n=1] The number of elements to take. 16798 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 16799 * @returns {Array} Returns the slice of `array`. 16800 * @example 16801 * 16802 * _.takeRight([1, 2, 3]); 16803 * // => [3] 16804 * 16805 * _.takeRight([1, 2, 3], 2); 16806 * // => [2, 3] 16807 * 16808 * _.takeRight([1, 2, 3], 5); 16809 * // => [1, 2, 3] 16810 * 16811 * _.takeRight([1, 2, 3], 0); 16812 * // => [] 16813 */ 16814 function takeRight(array, n, guard) { 16815 var length = array == null ? 0 : array.length; 16816 if (!length) { 16817 return []; 16818 } 16819 n = (guard || n === undefined) ? 1 : toInteger(n); 16820 n = length - n; 16821 return baseSlice(array, n < 0 ? 0 : n, length); 16822 } 16823 16824 /** 16825 * Creates a slice of `array` with elements taken from the end. Elements are 16826 * taken until `predicate` returns falsey. The predicate is invoked with 16827 * three arguments: (value, index, array). 16828 * 16829 * @static 16830 * @memberOf _ 16831 * @since 3.0.0 16832 * @category Array 16833 * @param {Array} array The array to query. 16834 * @param {Function} [predicate=_.identity] The function invoked per iteration. 16835 * @returns {Array} Returns the slice of `array`. 16836 * @example 16837 * 16838 * var users = [ 16839 * { 'user': 'barney', 'active': true }, 16840 * { 'user': 'fred', 'active': false }, 16841 * { 'user': 'pebbles', 'active': false } 16842 * ]; 16843 * 16844 * _.takeRightWhile(users, function(o) { return !o.active; }); 16845 * // => objects for ['fred', 'pebbles'] 16846 * 16847 * // The `_.matches` iteratee shorthand. 16848 * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); 16849 * // => objects for ['pebbles'] 16850 * 16851 * // The `_.matchesProperty` iteratee shorthand. 16852 * _.takeRightWhile(users, ['active', false]); 16853 * // => objects for ['fred', 'pebbles'] 16854 * 16855 * // The `_.property` iteratee shorthand. 16856 * _.takeRightWhile(users, 'active'); 16857 * // => [] 16858 */ 16859 function takeRightWhile(array, predicate) { 16860 return (array && array.length) 16861 ? baseWhile(array, getIteratee(predicate, 3), false, true) 16862 : []; 16863 } 16864 16865 /** 16866 * Creates a slice of `array` with elements taken from the beginning. Elements 16867 * are taken until `predicate` returns falsey. The predicate is invoked with 16868 * three arguments: (value, index, array). 16869 * 16870 * @static 16871 * @memberOf _ 16872 * @since 3.0.0 16873 * @category Array 16874 * @param {Array} array The array to query. 16875 * @param {Function} [predicate=_.identity] The function invoked per iteration. 16876 * @returns {Array} Returns the slice of `array`. 16877 * @example 16878 * 16879 * var users = [ 16880 * { 'user': 'barney', 'active': false }, 16881 * { 'user': 'fred', 'active': false }, 16882 * { 'user': 'pebbles', 'active': true } 16883 * ]; 16884 * 16885 * _.takeWhile(users, function(o) { return !o.active; }); 16886 * // => objects for ['barney', 'fred'] 16887 * 16888 * // The `_.matches` iteratee shorthand. 16889 * _.takeWhile(users, { 'user': 'barney', 'active': false }); 16890 * // => objects for ['barney'] 16891 * 16892 * // The `_.matchesProperty` iteratee shorthand. 16893 * _.takeWhile(users, ['active', false]); 16894 * // => objects for ['barney', 'fred'] 16895 * 16896 * // The `_.property` iteratee shorthand. 16897 * _.takeWhile(users, 'active'); 16898 * // => [] 16899 */ 16900 function takeWhile(array, predicate) { 16901 return (array && array.length) 16902 ? baseWhile(array, getIteratee(predicate, 3)) 16903 : []; 16904 } 16905 16906 /** 16907 * Creates an array of unique values, in order, from all given arrays using 16908 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 16909 * for equality comparisons. 16910 * 16911 * @static 16912 * @memberOf _ 16913 * @since 0.1.0 16914 * @category Array 16915 * @param {...Array} [arrays] The arrays to inspect. 16916 * @returns {Array} Returns the new array of combined values. 16917 * @example 16918 * 16919 * _.union([2], [1, 2]); 16920 * // => [2, 1] 16921 */ 16922 var union = baseRest(function(arrays) { 16923 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); 16924 }); 16925 16926 /** 16927 * This method is like `_.union` except that it accepts `iteratee` which is 16928 * invoked for each element of each `arrays` to generate the criterion by 16929 * which uniqueness is computed. Result values are chosen from the first 16930 * array in which the value occurs. The iteratee is invoked with one argument: 16931 * (value). 16932 * 16933 * @static 16934 * @memberOf _ 16935 * @since 4.0.0 16936 * @category Array 16937 * @param {...Array} [arrays] The arrays to inspect. 16938 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 16939 * @returns {Array} Returns the new array of combined values. 16940 * @example 16941 * 16942 * _.unionBy([2.1], [1.2, 2.3], Math.floor); 16943 * // => [2.1, 1.2] 16944 * 16945 * // The `_.property` iteratee shorthand. 16946 * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 16947 * // => [{ 'x': 1 }, { 'x': 2 }] 16948 */ 16949 var unionBy = baseRest(function(arrays) { 16950 var iteratee = last(arrays); 16951 if (isArrayLikeObject(iteratee)) { 16952 iteratee = undefined; 16953 } 16954 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)); 16955 }); 16956 16957 /** 16958 * This method is like `_.union` except that it accepts `comparator` which 16959 * is invoked to compare elements of `arrays`. Result values are chosen from 16960 * the first array in which the value occurs. The comparator is invoked 16961 * with two arguments: (arrVal, othVal). 16962 * 16963 * @static 16964 * @memberOf _ 16965 * @since 4.0.0 16966 * @category Array 16967 * @param {...Array} [arrays] The arrays to inspect. 16968 * @param {Function} [comparator] The comparator invoked per element. 16969 * @returns {Array} Returns the new array of combined values. 16970 * @example 16971 * 16972 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 16973 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 16974 * 16975 * _.unionWith(objects, others, _.isEqual); 16976 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] 16977 */ 16978 var unionWith = baseRest(function(arrays) { 16979 var comparator = last(arrays); 16980 comparator = typeof comparator == 'function' ? comparator : undefined; 16981 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator); 16982 }); 16983 16984 /** 16985 * Creates a duplicate-free version of an array, using 16986 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 16987 * for equality comparisons, in which only the first occurrence of each element 16988 * is kept. The order of result values is determined by the order they occur 16989 * in the array. 16990 * 16991 * @static 16992 * @memberOf _ 16993 * @since 0.1.0 16994 * @category Array 16995 * @param {Array} array The array to inspect. 16996 * @returns {Array} Returns the new duplicate free array. 16997 * @example 16998 * 16999 * _.uniq([2, 1, 2]); 17000 * // => [2, 1] 17001 */ 17002 function uniq(array) { 17003 return (array && array.length) ? baseUniq(array) : []; 17004 } 17005 17006 /** 17007 * This method is like `_.uniq` except that it accepts `iteratee` which is 17008 * invoked for each element in `array` to generate the criterion by which 17009 * uniqueness is computed. The order of result values is determined by the 17010 * order they occur in the array. The iteratee is invoked with one argument: 17011 * (value). 17012 * 17013 * @static 17014 * @memberOf _ 17015 * @since 4.0.0 17016 * @category Array 17017 * @param {Array} array The array to inspect. 17018 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 17019 * @returns {Array} Returns the new duplicate free array. 17020 * @example 17021 * 17022 * _.uniqBy([2.1, 1.2, 2.3], Math.floor); 17023 * // => [2.1, 1.2] 17024 * 17025 * // The `_.property` iteratee shorthand. 17026 * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); 17027 * // => [{ 'x': 1 }, { 'x': 2 }] 17028 */ 17029 function uniqBy(array, iteratee) { 17030 return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : []; 17031 } 17032 17033 /** 17034 * This method is like `_.uniq` except that it accepts `comparator` which 17035 * is invoked to compare elements of `array`. The order of result values is 17036 * determined by the order they occur in the array.The comparator is invoked 17037 * with two arguments: (arrVal, othVal). 17038 * 17039 * @static 17040 * @memberOf _ 17041 * @since 4.0.0 17042 * @category Array 17043 * @param {Array} array The array to inspect. 17044 * @param {Function} [comparator] The comparator invoked per element. 17045 * @returns {Array} Returns the new duplicate free array. 17046 * @example 17047 * 17048 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; 17049 * 17050 * _.uniqWith(objects, _.isEqual); 17051 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] 17052 */ 17053 function uniqWith(array, comparator) { 17054 comparator = typeof comparator == 'function' ? comparator : undefined; 17055 return (array && array.length) ? baseUniq(array, undefined, comparator) : []; 17056 } 17057 17058 /** 17059 * This method is like `_.zip` except that it accepts an array of grouped 17060 * elements and creates an array regrouping the elements to their pre-zip 17061 * configuration. 17062 * 17063 * @static 17064 * @memberOf _ 17065 * @since 1.2.0 17066 * @category Array 17067 * @param {Array} array The array of grouped elements to process. 17068 * @returns {Array} Returns the new array of regrouped elements. 17069 * @example 17070 * 17071 * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]); 17072 * // => [['a', 1, true], ['b', 2, false]] 17073 * 17074 * _.unzip(zipped); 17075 * // => [['a', 'b'], [1, 2], [true, false]] 17076 */ 17077 function unzip(array) { 17078 if (!(array && array.length)) { 17079 return []; 17080 } 17081 var length = 0; 17082 array = arrayFilter(array, function(group) { 17083 if (isArrayLikeObject(group)) { 17084 length = nativeMax(group.length, length); 17085 return true; 17086 } 17087 }); 17088 return baseTimes(length, function(index) { 17089 return arrayMap(array, baseProperty(index)); 17090 }); 17091 } 17092 17093 /** 17094 * This method is like `_.unzip` except that it accepts `iteratee` to specify 17095 * how regrouped values should be combined. The iteratee is invoked with the 17096 * elements of each group: (...group). 17097 * 17098 * @static 17099 * @memberOf _ 17100 * @since 3.8.0 17101 * @category Array 17102 * @param {Array} array The array of grouped elements to process. 17103 * @param {Function} [iteratee=_.identity] The function to combine 17104 * regrouped values. 17105 * @returns {Array} Returns the new array of regrouped elements. 17106 * @example 17107 * 17108 * var zipped = _.zip([1, 2], [10, 20], [100, 200]); 17109 * // => [[1, 10, 100], [2, 20, 200]] 17110 * 17111 * _.unzipWith(zipped, _.add); 17112 * // => [3, 30, 300] 17113 */ 17114 function unzipWith(array, iteratee) { 17115 if (!(array && array.length)) { 17116 return []; 17117 } 17118 var result = unzip(array); 17119 if (iteratee == null) { 17120 return result; 17121 } 17122 return arrayMap(result, function(group) { 17123 return apply(iteratee, undefined, group); 17124 }); 17125 } 17126 17127 /** 17128 * Creates an array excluding all given values using 17129 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 17130 * for equality comparisons. 17131 * 17132 * **Note:** Unlike `_.pull`, this method returns a new array. 17133 * 17134 * @static 17135 * @memberOf _ 17136 * @since 0.1.0 17137 * @category Array 17138 * @param {Array} array The array to inspect. 17139 * @param {...*} [values] The values to exclude. 17140 * @returns {Array} Returns the new array of filtered values. 17141 * @see _.difference, _.xor 17142 * @example 17143 * 17144 * _.without([2, 1, 2, 3], 1, 2); 17145 * // => [3] 17146 */ 17147 var without = baseRest(function(array, values) { 17148 return isArrayLikeObject(array) 17149 ? baseDifference(array, values) 17150 : []; 17151 }); 17152 17153 /** 17154 * Creates an array of unique values that is the 17155 * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) 17156 * of the given arrays. The order of result values is determined by the order 17157 * they occur in the arrays. 17158 * 17159 * @static 17160 * @memberOf _ 17161 * @since 2.4.0 17162 * @category Array 17163 * @param {...Array} [arrays] The arrays to inspect. 17164 * @returns {Array} Returns the new array of filtered values. 17165 * @see _.difference, _.without 17166 * @example 17167 * 17168 * _.xor([2, 1], [2, 3]); 17169 * // => [1, 3] 17170 */ 17171 var xor = baseRest(function(arrays) { 17172 return baseXor(arrayFilter(arrays, isArrayLikeObject)); 17173 }); 17174 17175 /** 17176 * This method is like `_.xor` except that it accepts `iteratee` which is 17177 * invoked for each element of each `arrays` to generate the criterion by 17178 * which by which they're compared. The order of result values is determined 17179 * by the order they occur in the arrays. The iteratee is invoked with one 17180 * argument: (value). 17181 * 17182 * @static 17183 * @memberOf _ 17184 * @since 4.0.0 17185 * @category Array 17186 * @param {...Array} [arrays] The arrays to inspect. 17187 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 17188 * @returns {Array} Returns the new array of filtered values. 17189 * @example 17190 * 17191 * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); 17192 * // => [1.2, 3.4] 17193 * 17194 * // The `_.property` iteratee shorthand. 17195 * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); 17196 * // => [{ 'x': 2 }] 17197 */ 17198 var xorBy = baseRest(function(arrays) { 17199 var iteratee = last(arrays); 17200 if (isArrayLikeObject(iteratee)) { 17201 iteratee = undefined; 17202 } 17203 return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2)); 17204 }); 17205 17206 /** 17207 * This method is like `_.xor` except that it accepts `comparator` which is 17208 * invoked to compare elements of `arrays`. The order of result values is 17209 * determined by the order they occur in the arrays. The comparator is invoked 17210 * with two arguments: (arrVal, othVal). 17211 * 17212 * @static 17213 * @memberOf _ 17214 * @since 4.0.0 17215 * @category Array 17216 * @param {...Array} [arrays] The arrays to inspect. 17217 * @param {Function} [comparator] The comparator invoked per element. 17218 * @returns {Array} Returns the new array of filtered values. 17219 * @example 17220 * 17221 * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; 17222 * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; 17223 * 17224 * _.xorWith(objects, others, _.isEqual); 17225 * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] 17226 */ 17227 var xorWith = baseRest(function(arrays) { 17228 var comparator = last(arrays); 17229 comparator = typeof comparator == 'function' ? comparator : undefined; 17230 return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator); 17231 }); 17232 17233 /** 17234 * Creates an array of grouped elements, the first of which contains the 17235 * first elements of the given arrays, the second of which contains the 17236 * second elements of the given arrays, and so on. 17237 * 17238 * @static 17239 * @memberOf _ 17240 * @since 0.1.0 17241 * @category Array 17242 * @param {...Array} [arrays] The arrays to process. 17243 * @returns {Array} Returns the new array of grouped elements. 17244 * @example 17245 * 17246 * _.zip(['a', 'b'], [1, 2], [true, false]); 17247 * // => [['a', 1, true], ['b', 2, false]] 17248 */ 17249 var zip = baseRest(unzip); 17250 17251 /** 17252 * This method is like `_.fromPairs` except that it accepts two arrays, 17253 * one of property identifiers and one of corresponding values. 17254 * 17255 * @static 17256 * @memberOf _ 17257 * @since 0.4.0 17258 * @category Array 17259 * @param {Array} [props=[]] The property identifiers. 17260 * @param {Array} [values=[]] The property values. 17261 * @returns {Object} Returns the new object. 17262 * @example 17263 * 17264 * _.zipObject(['a', 'b'], [1, 2]); 17265 * // => { 'a': 1, 'b': 2 } 17266 */ 17267 function zipObject(props, values) { 17268 return baseZipObject(props || [], values || [], assignValue); 17269 } 17270 17271 /** 17272 * This method is like `_.zipObject` except that it supports property paths. 17273 * 17274 * @static 17275 * @memberOf _ 17276 * @since 4.1.0 17277 * @category Array 17278 * @param {Array} [props=[]] The property identifiers. 17279 * @param {Array} [values=[]] The property values. 17280 * @returns {Object} Returns the new object. 17281 * @example 17282 * 17283 * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); 17284 * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } 17285 */ 17286 function zipObjectDeep(props, values) { 17287 return baseZipObject(props || [], values || [], baseSet); 17288 } 17289 17290 /** 17291 * This method is like `_.zip` except that it accepts `iteratee` to specify 17292 * how grouped values should be combined. The iteratee is invoked with the 17293 * elements of each group: (...group). 17294 * 17295 * @static 17296 * @memberOf _ 17297 * @since 3.8.0 17298 * @category Array 17299 * @param {...Array} [arrays] The arrays to process. 17300 * @param {Function} [iteratee=_.identity] The function to combine 17301 * grouped values. 17302 * @returns {Array} Returns the new array of grouped elements. 17303 * @example 17304 * 17305 * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { 17306 * return a + b + c; 17307 * }); 17308 * // => [111, 222] 17309 */ 17310 var zipWith = baseRest(function(arrays) { 17311 var length = arrays.length, 17312 iteratee = length > 1 ? arrays[length - 1] : undefined; 17313 17314 iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; 17315 return unzipWith(arrays, iteratee); 17316 }); 17317 17318 /*------------------------------------------------------------------------*/ 17319 17320 /** 17321 * Creates a `lodash` wrapper instance that wraps `value` with explicit method 17322 * chain sequences enabled. The result of such sequences must be unwrapped 17323 * with `_#value`. 17324 * 17325 * @static 17326 * @memberOf _ 17327 * @since 1.3.0 17328 * @category Seq 17329 * @param {*} value The value to wrap. 17330 * @returns {Object} Returns the new `lodash` wrapper instance. 17331 * @example 17332 * 17333 * var users = [ 17334 * { 'user': 'barney', 'age': 36 }, 17335 * { 'user': 'fred', 'age': 40 }, 17336 * { 'user': 'pebbles', 'age': 1 } 17337 * ]; 17338 * 17339 * var youngest = _ 17340 * .chain(users) 17341 * .sortBy('age') 17342 * .map(function(o) { 17343 * return o.user + ' is ' + o.age; 17344 * }) 17345 * .head() 17346 * .value(); 17347 * // => 'pebbles is 1' 17348 */ 17349 function chain(value) { 17350 var result = lodash(value); 17351 result.__chain__ = true; 17352 return result; 17353 } 17354 17355 /** 17356 * This method invokes `interceptor` and returns `value`. The interceptor 17357 * is invoked with one argument; (value). The purpose of this method is to 17358 * "tap into" a method chain sequence in order to modify intermediate results. 17359 * 17360 * @static 17361 * @memberOf _ 17362 * @since 0.1.0 17363 * @category Seq 17364 * @param {*} value The value to provide to `interceptor`. 17365 * @param {Function} interceptor The function to invoke. 17366 * @returns {*} Returns `value`. 17367 * @example 17368 * 17369 * _([1, 2, 3]) 17370 * .tap(function(array) { 17371 * // Mutate input array. 17372 * array.pop(); 17373 * }) 17374 * .reverse() 17375 * .value(); 17376 * // => [2, 1] 17377 */ 17378 function tap(value, interceptor) { 17379 interceptor(value); 17380 return value; 17381 } 17382 17383 /** 17384 * This method is like `_.tap` except that it returns the result of `interceptor`. 17385 * The purpose of this method is to "pass thru" values replacing intermediate 17386 * results in a method chain sequence. 17387 * 17388 * @static 17389 * @memberOf _ 17390 * @since 3.0.0 17391 * @category Seq 17392 * @param {*} value The value to provide to `interceptor`. 17393 * @param {Function} interceptor The function to invoke. 17394 * @returns {*} Returns the result of `interceptor`. 17395 * @example 17396 * 17397 * _(' abc ') 17398 * .chain() 17399 * .trim() 17400 * .thru(function(value) { 17401 * return [value]; 17402 * }) 17403 * .value(); 17404 * // => ['abc'] 17405 */ 17406 function thru(value, interceptor) { 17407 return interceptor(value); 17408 } 17409 17410 /** 17411 * This method is the wrapper version of `_.at`. 17412 * 17413 * @name at 17414 * @memberOf _ 17415 * @since 1.0.0 17416 * @category Seq 17417 * @param {...(string|string[])} [paths] The property paths to pick. 17418 * @returns {Object} Returns the new `lodash` wrapper instance. 17419 * @example 17420 * 17421 * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; 17422 * 17423 * _(object).at(['a[0].b.c', 'a[1]']).value(); 17424 * // => [3, 4] 17425 */ 17426 var wrapperAt = flatRest(function(paths) { 17427 var length = paths.length, 17428 start = length ? paths[0] : 0, 17429 value = this.__wrapped__, 17430 interceptor = function(object) { return baseAt(object, paths); }; 17431 17432 if (length > 1 || this.__actions__.length || 17433 !(value instanceof LazyWrapper) || !isIndex(start)) { 17434 return this.thru(interceptor); 17435 } 17436 value = value.slice(start, +start + (length ? 1 : 0)); 17437 value.__actions__.push({ 17438 'func': thru, 17439 'args': [interceptor], 17440 'thisArg': undefined 17441 }); 17442 return new LodashWrapper(value, this.__chain__).thru(function(array) { 17443 if (length && !array.length) { 17444 array.push(undefined); 17445 } 17446 return array; 17447 }); 17448 }); 17449 17450 /** 17451 * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. 17452 * 17453 * @name chain 17454 * @memberOf _ 17455 * @since 0.1.0 17456 * @category Seq 17457 * @returns {Object} Returns the new `lodash` wrapper instance. 17458 * @example 17459 * 17460 * var users = [ 17461 * { 'user': 'barney', 'age': 36 }, 17462 * { 'user': 'fred', 'age': 40 } 17463 * ]; 17464 * 17465 * // A sequence without explicit chaining. 17466 * _(users).head(); 17467 * // => { 'user': 'barney', 'age': 36 } 17468 * 17469 * // A sequence with explicit chaining. 17470 * _(users) 17471 * .chain() 17472 * .head() 17473 * .pick('user') 17474 * .value(); 17475 * // => { 'user': 'barney' } 17476 */ 17477 function wrapperChain() { 17478 return chain(this); 17479 } 17480 17481 /** 17482 * Executes the chain sequence and returns the wrapped result. 17483 * 17484 * @name commit 17485 * @memberOf _ 17486 * @since 3.2.0 17487 * @category Seq 17488 * @returns {Object} Returns the new `lodash` wrapper instance. 17489 * @example 17490 * 17491 * var array = [1, 2]; 17492 * var wrapped = _(array).push(3); 17493 * 17494 * console.log(array); 17495 * // => [1, 2] 17496 * 17497 * wrapped = wrapped.commit(); 17498 * console.log(array); 17499 * // => [1, 2, 3] 17500 * 17501 * wrapped.last(); 17502 * // => 3 17503 * 17504 * console.log(array); 17505 * // => [1, 2, 3] 17506 */ 17507 function wrapperCommit() { 17508 return new LodashWrapper(this.value(), this.__chain__); 17509 } 17510 17511 /** 17512 * Gets the next value on a wrapped object following the 17513 * [iterator protocol](https://mdn.io/iteration_protocols#iterator). 17514 * 17515 * @name next 17516 * @memberOf _ 17517 * @since 4.0.0 17518 * @category Seq 17519 * @returns {Object} Returns the next iterator value. 17520 * @example 17521 * 17522 * var wrapped = _([1, 2]); 17523 * 17524 * wrapped.next(); 17525 * // => { 'done': false, 'value': 1 } 17526 * 17527 * wrapped.next(); 17528 * // => { 'done': false, 'value': 2 } 17529 * 17530 * wrapped.next(); 17531 * // => { 'done': true, 'value': undefined } 17532 */ 17533 function wrapperNext() { 17534 if (this.__values__ === undefined) { 17535 this.__values__ = toArray(this.value()); 17536 } 17537 var done = this.__index__ >= this.__values__.length, 17538 value = done ? undefined : this.__values__[this.__index__++]; 17539 17540 return { 'done': done, 'value': value }; 17541 } 17542 17543 /** 17544 * Enables the wrapper to be iterable. 17545 * 17546 * @name Symbol.iterator 17547 * @memberOf _ 17548 * @since 4.0.0 17549 * @category Seq 17550 * @returns {Object} Returns the wrapper object. 17551 * @example 17552 * 17553 * var wrapped = _([1, 2]); 17554 * 17555 * wrapped[Symbol.iterator]() === wrapped; 17556 * // => true 17557 * 17558 * Array.from(wrapped); 17559 * // => [1, 2] 17560 */ 17561 function wrapperToIterator() { 17562 return this; 17563 } 17564 17565 /** 17566 * Creates a clone of the chain sequence planting `value` as the wrapped value. 17567 * 17568 * @name plant 17569 * @memberOf _ 17570 * @since 3.2.0 17571 * @category Seq 17572 * @param {*} value The value to plant. 17573 * @returns {Object} Returns the new `lodash` wrapper instance. 17574 * @example 17575 * 17576 * function square(n) { 17577 * return n * n; 17578 * } 17579 * 17580 * var wrapped = _([1, 2]).map(square); 17581 * var other = wrapped.plant([3, 4]); 17582 * 17583 * other.value(); 17584 * // => [9, 16] 17585 * 17586 * wrapped.value(); 17587 * // => [1, 4] 17588 */ 17589 function wrapperPlant(value) { 17590 var result, 17591 parent = this; 17592 17593 while (parent instanceof baseLodash) { 17594 var clone = wrapperClone(parent); 17595 clone.__index__ = 0; 17596 clone.__values__ = undefined; 17597 if (result) { 17598 previous.__wrapped__ = clone; 17599 } else { 17600 result = clone; 17601 } 17602 var previous = clone; 17603 parent = parent.__wrapped__; 17604 } 17605 previous.__wrapped__ = value; 17606 return result; 17607 } 17608 17609 /** 17610 * This method is the wrapper version of `_.reverse`. 17611 * 17612 * **Note:** This method mutates the wrapped array. 17613 * 17614 * @name reverse 17615 * @memberOf _ 17616 * @since 0.1.0 17617 * @category Seq 17618 * @returns {Object} Returns the new `lodash` wrapper instance. 17619 * @example 17620 * 17621 * var array = [1, 2, 3]; 17622 * 17623 * _(array).reverse().value() 17624 * // => [3, 2, 1] 17625 * 17626 * console.log(array); 17627 * // => [3, 2, 1] 17628 */ 17629 function wrapperReverse() { 17630 var value = this.__wrapped__; 17631 if (value instanceof LazyWrapper) { 17632 var wrapped = value; 17633 if (this.__actions__.length) { 17634 wrapped = new LazyWrapper(this); 17635 } 17636 wrapped = wrapped.reverse(); 17637 wrapped.__actions__.push({ 17638 'func': thru, 17639 'args': [reverse], 17640 'thisArg': undefined 17641 }); 17642 return new LodashWrapper(wrapped, this.__chain__); 17643 } 17644 return this.thru(reverse); 17645 } 17646 17647 /** 17648 * Executes the chain sequence to resolve the unwrapped value. 17649 * 17650 * @name value 17651 * @memberOf _ 17652 * @since 0.1.0 17653 * @alias toJSON, valueOf 17654 * @category Seq 17655 * @returns {*} Returns the resolved unwrapped value. 17656 * @example 17657 * 17658 * _([1, 2, 3]).value(); 17659 * // => [1, 2, 3] 17660 */ 17661 function wrapperValue() { 17662 return baseWrapperValue(this.__wrapped__, this.__actions__); 17663 } 17664 17665 /*------------------------------------------------------------------------*/ 17666 17667 /** 17668 * Creates an object composed of keys generated from the results of running 17669 * each element of `collection` thru `iteratee`. The corresponding value of 17670 * each key is the number of times the key was returned by `iteratee`. The 17671 * iteratee is invoked with one argument: (value). 17672 * 17673 * @static 17674 * @memberOf _ 17675 * @since 0.5.0 17676 * @category Collection 17677 * @param {Array|Object} collection The collection to iterate over. 17678 * @param {Function} [iteratee=_.identity] The iteratee to transform keys. 17679 * @returns {Object} Returns the composed aggregate object. 17680 * @example 17681 * 17682 * _.countBy([6.1, 4.2, 6.3], Math.floor); 17683 * // => { '4': 1, '6': 2 } 17684 * 17685 * // The `_.property` iteratee shorthand. 17686 * _.countBy(['one', 'two', 'three'], 'length'); 17687 * // => { '3': 2, '5': 1 } 17688 */ 17689 var countBy = createAggregator(function(result, value, key) { 17690 if (hasOwnProperty.call(result, key)) { 17691 ++result[key]; 17692 } else { 17693 baseAssignValue(result, key, 1); 17694 } 17695 }); 17696 17697 /** 17698 * Checks if `predicate` returns truthy for **all** elements of `collection`. 17699 * Iteration is stopped once `predicate` returns falsey. The predicate is 17700 * invoked with three arguments: (value, index|key, collection). 17701 * 17702 * **Note:** This method returns `true` for 17703 * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because 17704 * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of 17705 * elements of empty collections. 17706 * 17707 * @static 17708 * @memberOf _ 17709 * @since 0.1.0 17710 * @category Collection 17711 * @param {Array|Object} collection The collection to iterate over. 17712 * @param {Function} [predicate=_.identity] The function invoked per iteration. 17713 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 17714 * @returns {boolean} Returns `true` if all elements pass the predicate check, 17715 * else `false`. 17716 * @example 17717 * 17718 * _.every([true, 1, null, 'yes'], Boolean); 17719 * // => false 17720 * 17721 * var users = [ 17722 * { 'user': 'barney', 'age': 36, 'active': false }, 17723 * { 'user': 'fred', 'age': 40, 'active': false } 17724 * ]; 17725 * 17726 * // The `_.matches` iteratee shorthand. 17727 * _.every(users, { 'user': 'barney', 'active': false }); 17728 * // => false 17729 * 17730 * // The `_.matchesProperty` iteratee shorthand. 17731 * _.every(users, ['active', false]); 17732 * // => true 17733 * 17734 * // The `_.property` iteratee shorthand. 17735 * _.every(users, 'active'); 17736 * // => false 17737 */ 17738 function every(collection, predicate, guard) { 17739 var func = isArray(collection) ? arrayEvery : baseEvery; 17740 if (guard && isIterateeCall(collection, predicate, guard)) { 17741 predicate = undefined; 17742 } 17743 return func(collection, getIteratee(predicate, 3)); 17744 } 17745 17746 /** 17747 * Iterates over elements of `collection`, returning an array of all elements 17748 * `predicate` returns truthy for. The predicate is invoked with three 17749 * arguments: (value, index|key, collection). 17750 * 17751 * **Note:** Unlike `_.remove`, this method returns a new array. 17752 * 17753 * @static 17754 * @memberOf _ 17755 * @since 0.1.0 17756 * @category Collection 17757 * @param {Array|Object} collection The collection to iterate over. 17758 * @param {Function} [predicate=_.identity] The function invoked per iteration. 17759 * @returns {Array} Returns the new filtered array. 17760 * @see _.reject 17761 * @example 17762 * 17763 * var users = [ 17764 * { 'user': 'barney', 'age': 36, 'active': true }, 17765 * { 'user': 'fred', 'age': 40, 'active': false } 17766 * ]; 17767 * 17768 * _.filter(users, function(o) { return !o.active; }); 17769 * // => objects for ['fred'] 17770 * 17771 * // The `_.matches` iteratee shorthand. 17772 * _.filter(users, { 'age': 36, 'active': true }); 17773 * // => objects for ['barney'] 17774 * 17775 * // The `_.matchesProperty` iteratee shorthand. 17776 * _.filter(users, ['active', false]); 17777 * // => objects for ['fred'] 17778 * 17779 * // The `_.property` iteratee shorthand. 17780 * _.filter(users, 'active'); 17781 * // => objects for ['barney'] 17782 * 17783 * // Combining several predicates using `_.overEvery` or `_.overSome`. 17784 * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); 17785 * // => objects for ['fred', 'barney'] 17786 */ 17787 function filter(collection, predicate) { 17788 var func = isArray(collection) ? arrayFilter : baseFilter; 17789 return func(collection, getIteratee(predicate, 3)); 17790 } 17791 17792 /** 17793 * Iterates over elements of `collection`, returning the first element 17794 * `predicate` returns truthy for. The predicate is invoked with three 17795 * arguments: (value, index|key, collection). 17796 * 17797 * @static 17798 * @memberOf _ 17799 * @since 0.1.0 17800 * @category Collection 17801 * @param {Array|Object} collection The collection to inspect. 17802 * @param {Function} [predicate=_.identity] The function invoked per iteration. 17803 * @param {number} [fromIndex=0] The index to search from. 17804 * @returns {*} Returns the matched element, else `undefined`. 17805 * @example 17806 * 17807 * var users = [ 17808 * { 'user': 'barney', 'age': 36, 'active': true }, 17809 * { 'user': 'fred', 'age': 40, 'active': false }, 17810 * { 'user': 'pebbles', 'age': 1, 'active': true } 17811 * ]; 17812 * 17813 * _.find(users, function(o) { return o.age < 40; }); 17814 * // => object for 'barney' 17815 * 17816 * // The `_.matches` iteratee shorthand. 17817 * _.find(users, { 'age': 1, 'active': true }); 17818 * // => object for 'pebbles' 17819 * 17820 * // The `_.matchesProperty` iteratee shorthand. 17821 * _.find(users, ['active', false]); 17822 * // => object for 'fred' 17823 * 17824 * // The `_.property` iteratee shorthand. 17825 * _.find(users, 'active'); 17826 * // => object for 'barney' 17827 */ 17828 var find = createFind(findIndex); 17829 17830 /** 17831 * This method is like `_.find` except that it iterates over elements of 17832 * `collection` from right to left. 17833 * 17834 * @static 17835 * @memberOf _ 17836 * @since 2.0.0 17837 * @category Collection 17838 * @param {Array|Object} collection The collection to inspect. 17839 * @param {Function} [predicate=_.identity] The function invoked per iteration. 17840 * @param {number} [fromIndex=collection.length-1] The index to search from. 17841 * @returns {*} Returns the matched element, else `undefined`. 17842 * @example 17843 * 17844 * _.findLast([1, 2, 3, 4], function(n) { 17845 * return n % 2 == 1; 17846 * }); 17847 * // => 3 17848 */ 17849 var findLast = createFind(findLastIndex); 17850 17851 /** 17852 * Creates a flattened array of values by running each element in `collection` 17853 * thru `iteratee` and flattening the mapped results. The iteratee is invoked 17854 * with three arguments: (value, index|key, collection). 17855 * 17856 * @static 17857 * @memberOf _ 17858 * @since 4.0.0 17859 * @category Collection 17860 * @param {Array|Object} collection The collection to iterate over. 17861 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 17862 * @returns {Array} Returns the new flattened array. 17863 * @example 17864 * 17865 * function duplicate(n) { 17866 * return [n, n]; 17867 * } 17868 * 17869 * _.flatMap([1, 2], duplicate); 17870 * // => [1, 1, 2, 2] 17871 */ 17872 function flatMap(collection, iteratee) { 17873 return baseFlatten(map(collection, iteratee), 1); 17874 } 17875 17876 /** 17877 * This method is like `_.flatMap` except that it recursively flattens the 17878 * mapped results. 17879 * 17880 * @static 17881 * @memberOf _ 17882 * @since 4.7.0 17883 * @category Collection 17884 * @param {Array|Object} collection The collection to iterate over. 17885 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 17886 * @returns {Array} Returns the new flattened array. 17887 * @example 17888 * 17889 * function duplicate(n) { 17890 * return [[[n, n]]]; 17891 * } 17892 * 17893 * _.flatMapDeep([1, 2], duplicate); 17894 * // => [1, 1, 2, 2] 17895 */ 17896 function flatMapDeep(collection, iteratee) { 17897 return baseFlatten(map(collection, iteratee), INFINITY); 17898 } 17899 17900 /** 17901 * This method is like `_.flatMap` except that it recursively flattens the 17902 * mapped results up to `depth` times. 17903 * 17904 * @static 17905 * @memberOf _ 17906 * @since 4.7.0 17907 * @category Collection 17908 * @param {Array|Object} collection The collection to iterate over. 17909 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 17910 * @param {number} [depth=1] The maximum recursion depth. 17911 * @returns {Array} Returns the new flattened array. 17912 * @example 17913 * 17914 * function duplicate(n) { 17915 * return [[[n, n]]]; 17916 * } 17917 * 17918 * _.flatMapDepth([1, 2], duplicate, 2); 17919 * // => [[1, 1], [2, 2]] 17920 */ 17921 function flatMapDepth(collection, iteratee, depth) { 17922 depth = depth === undefined ? 1 : toInteger(depth); 17923 return baseFlatten(map(collection, iteratee), depth); 17924 } 17925 17926 /** 17927 * Iterates over elements of `collection` and invokes `iteratee` for each element. 17928 * The iteratee is invoked with three arguments: (value, index|key, collection). 17929 * Iteratee functions may exit iteration early by explicitly returning `false`. 17930 * 17931 * **Note:** As with other "Collections" methods, objects with a "length" 17932 * property are iterated like arrays. To avoid this behavior use `_.forIn` 17933 * or `_.forOwn` for object iteration. 17934 * 17935 * @static 17936 * @memberOf _ 17937 * @since 0.1.0 17938 * @alias each 17939 * @category Collection 17940 * @param {Array|Object} collection The collection to iterate over. 17941 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 17942 * @returns {Array|Object} Returns `collection`. 17943 * @see _.forEachRight 17944 * @example 17945 * 17946 * _.forEach([1, 2], function(value) { 17947 * console.log(value); 17948 * }); 17949 * // => Logs `1` then `2`. 17950 * 17951 * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { 17952 * console.log(key); 17953 * }); 17954 * // => Logs 'a' then 'b' (iteration order is not guaranteed). 17955 */ 17956 function forEach(collection, iteratee) { 17957 var func = isArray(collection) ? arrayEach : baseEach; 17958 return func(collection, getIteratee(iteratee, 3)); 17959 } 17960 17961 /** 17962 * This method is like `_.forEach` except that it iterates over elements of 17963 * `collection` from right to left. 17964 * 17965 * @static 17966 * @memberOf _ 17967 * @since 2.0.0 17968 * @alias eachRight 17969 * @category Collection 17970 * @param {Array|Object} collection The collection to iterate over. 17971 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 17972 * @returns {Array|Object} Returns `collection`. 17973 * @see _.forEach 17974 * @example 17975 * 17976 * _.forEachRight([1, 2], function(value) { 17977 * console.log(value); 17978 * }); 17979 * // => Logs `2` then `1`. 17980 */ 17981 function forEachRight(collection, iteratee) { 17982 var func = isArray(collection) ? arrayEachRight : baseEachRight; 17983 return func(collection, getIteratee(iteratee, 3)); 17984 } 17985 17986 /** 17987 * Creates an object composed of keys generated from the results of running 17988 * each element of `collection` thru `iteratee`. The order of grouped values 17989 * is determined by the order they occur in `collection`. The corresponding 17990 * value of each key is an array of elements responsible for generating the 17991 * key. The iteratee is invoked with one argument: (value). 17992 * 17993 * @static 17994 * @memberOf _ 17995 * @since 0.1.0 17996 * @category Collection 17997 * @param {Array|Object} collection The collection to iterate over. 17998 * @param {Function} [iteratee=_.identity] The iteratee to transform keys. 17999 * @returns {Object} Returns the composed aggregate object. 18000 * @example 18001 * 18002 * _.groupBy([6.1, 4.2, 6.3], Math.floor); 18003 * // => { '4': [4.2], '6': [6.1, 6.3] } 18004 * 18005 * // The `_.property` iteratee shorthand. 18006 * _.groupBy(['one', 'two', 'three'], 'length'); 18007 * // => { '3': ['one', 'two'], '5': ['three'] } 18008 */ 18009 var groupBy = createAggregator(function(result, value, key) { 18010 if (hasOwnProperty.call(result, key)) { 18011 result[key].push(value); 18012 } else { 18013 baseAssignValue(result, key, [value]); 18014 } 18015 }); 18016 18017 /** 18018 * Checks if `value` is in `collection`. If `collection` is a string, it's 18019 * checked for a substring of `value`, otherwise 18020 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 18021 * is used for equality comparisons. If `fromIndex` is negative, it's used as 18022 * the offset from the end of `collection`. 18023 * 18024 * @static 18025 * @memberOf _ 18026 * @since 0.1.0 18027 * @category Collection 18028 * @param {Array|Object|string} collection The collection to inspect. 18029 * @param {*} value The value to search for. 18030 * @param {number} [fromIndex=0] The index to search from. 18031 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. 18032 * @returns {boolean} Returns `true` if `value` is found, else `false`. 18033 * @example 18034 * 18035 * _.includes([1, 2, 3], 1); 18036 * // => true 18037 * 18038 * _.includes([1, 2, 3], 1, 2); 18039 * // => false 18040 * 18041 * _.includes({ 'a': 1, 'b': 2 }, 1); 18042 * // => true 18043 * 18044 * _.includes('abcd', 'bc'); 18045 * // => true 18046 */ 18047 function includes(collection, value, fromIndex, guard) { 18048 collection = isArrayLike(collection) ? collection : values(collection); 18049 fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; 18050 18051 var length = collection.length; 18052 if (fromIndex < 0) { 18053 fromIndex = nativeMax(length + fromIndex, 0); 18054 } 18055 return isString(collection) 18056 ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) 18057 : (!!length && baseIndexOf(collection, value, fromIndex) > -1); 18058 } 18059 18060 /** 18061 * Invokes the method at `path` of each element in `collection`, returning 18062 * an array of the results of each invoked method. Any additional arguments 18063 * are provided to each invoked method. If `path` is a function, it's invoked 18064 * for, and `this` bound to, each element in `collection`. 18065 * 18066 * @static 18067 * @memberOf _ 18068 * @since 4.0.0 18069 * @category Collection 18070 * @param {Array|Object} collection The collection to iterate over. 18071 * @param {Array|Function|string} path The path of the method to invoke or 18072 * the function invoked per iteration. 18073 * @param {...*} [args] The arguments to invoke each method with. 18074 * @returns {Array} Returns the array of results. 18075 * @example 18076 * 18077 * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); 18078 * // => [[1, 5, 7], [1, 2, 3]] 18079 * 18080 * _.invokeMap([123, 456], String.prototype.split, ''); 18081 * // => [['1', '2', '3'], ['4', '5', '6']] 18082 */ 18083 var invokeMap = baseRest(function(collection, path, args) { 18084 var index = -1, 18085 isFunc = typeof path == 'function', 18086 result = isArrayLike(collection) ? Array(collection.length) : []; 18087 18088 baseEach(collection, function(value) { 18089 result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); 18090 }); 18091 return result; 18092 }); 18093 18094 /** 18095 * Creates an object composed of keys generated from the results of running 18096 * each element of `collection` thru `iteratee`. The corresponding value of 18097 * each key is the last element responsible for generating the key. The 18098 * iteratee is invoked with one argument: (value). 18099 * 18100 * @static 18101 * @memberOf _ 18102 * @since 4.0.0 18103 * @category Collection 18104 * @param {Array|Object} collection The collection to iterate over. 18105 * @param {Function} [iteratee=_.identity] The iteratee to transform keys. 18106 * @returns {Object} Returns the composed aggregate object. 18107 * @example 18108 * 18109 * var array = [ 18110 * { 'dir': 'left', 'code': 97 }, 18111 * { 'dir': 'right', 'code': 100 } 18112 * ]; 18113 * 18114 * _.keyBy(array, function(o) { 18115 * return String.fromCharCode(o.code); 18116 * }); 18117 * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } 18118 * 18119 * _.keyBy(array, 'dir'); 18120 * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } 18121 */ 18122 var keyBy = createAggregator(function(result, value, key) { 18123 baseAssignValue(result, key, value); 18124 }); 18125 18126 /** 18127 * Creates an array of values by running each element in `collection` thru 18128 * `iteratee`. The iteratee is invoked with three arguments: 18129 * (value, index|key, collection). 18130 * 18131 * Many lodash methods are guarded to work as iteratees for methods like 18132 * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. 18133 * 18134 * The guarded methods are: 18135 * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, 18136 * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, 18137 * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, 18138 * `template`, `trim`, `trimEnd`, `trimStart`, and `words` 18139 * 18140 * @static 18141 * @memberOf _ 18142 * @since 0.1.0 18143 * @category Collection 18144 * @param {Array|Object} collection The collection to iterate over. 18145 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 18146 * @returns {Array} Returns the new mapped array. 18147 * @example 18148 * 18149 * function square(n) { 18150 * return n * n; 18151 * } 18152 * 18153 * _.map([4, 8], square); 18154 * // => [16, 64] 18155 * 18156 * _.map({ 'a': 4, 'b': 8 }, square); 18157 * // => [16, 64] (iteration order is not guaranteed) 18158 * 18159 * var users = [ 18160 * { 'user': 'barney' }, 18161 * { 'user': 'fred' } 18162 * ]; 18163 * 18164 * // The `_.property` iteratee shorthand. 18165 * _.map(users, 'user'); 18166 * // => ['barney', 'fred'] 18167 */ 18168 function map(collection, iteratee) { 18169 var func = isArray(collection) ? arrayMap : baseMap; 18170 return func(collection, getIteratee(iteratee, 3)); 18171 } 18172 18173 /** 18174 * This method is like `_.sortBy` except that it allows specifying the sort 18175 * orders of the iteratees to sort by. If `orders` is unspecified, all values 18176 * are sorted in ascending order. Otherwise, specify an order of "desc" for 18177 * descending or "asc" for ascending sort order of corresponding values. 18178 * 18179 * @static 18180 * @memberOf _ 18181 * @since 4.0.0 18182 * @category Collection 18183 * @param {Array|Object} collection The collection to iterate over. 18184 * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] 18185 * The iteratees to sort by. 18186 * @param {string[]} [orders] The sort orders of `iteratees`. 18187 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. 18188 * @returns {Array} Returns the new sorted array. 18189 * @example 18190 * 18191 * var users = [ 18192 * { 'user': 'fred', 'age': 48 }, 18193 * { 'user': 'barney', 'age': 34 }, 18194 * { 'user': 'fred', 'age': 40 }, 18195 * { 'user': 'barney', 'age': 36 } 18196 * ]; 18197 * 18198 * // Sort by `user` in ascending order and by `age` in descending order. 18199 * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); 18200 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] 18201 */ 18202 function orderBy(collection, iteratees, orders, guard) { 18203 if (collection == null) { 18204 return []; 18205 } 18206 if (!isArray(iteratees)) { 18207 iteratees = iteratees == null ? [] : [iteratees]; 18208 } 18209 orders = guard ? undefined : orders; 18210 if (!isArray(orders)) { 18211 orders = orders == null ? [] : [orders]; 18212 } 18213 return baseOrderBy(collection, iteratees, orders); 18214 } 18215 18216 /** 18217 * Creates an array of elements split into two groups, the first of which 18218 * contains elements `predicate` returns truthy for, the second of which 18219 * contains elements `predicate` returns falsey for. The predicate is 18220 * invoked with one argument: (value). 18221 * 18222 * @static 18223 * @memberOf _ 18224 * @since 3.0.0 18225 * @category Collection 18226 * @param {Array|Object} collection The collection to iterate over. 18227 * @param {Function} [predicate=_.identity] The function invoked per iteration. 18228 * @returns {Array} Returns the array of grouped elements. 18229 * @example 18230 * 18231 * var users = [ 18232 * { 'user': 'barney', 'age': 36, 'active': false }, 18233 * { 'user': 'fred', 'age': 40, 'active': true }, 18234 * { 'user': 'pebbles', 'age': 1, 'active': false } 18235 * ]; 18236 * 18237 * _.partition(users, function(o) { return o.active; }); 18238 * // => objects for [['fred'], ['barney', 'pebbles']] 18239 * 18240 * // The `_.matches` iteratee shorthand. 18241 * _.partition(users, { 'age': 1, 'active': false }); 18242 * // => objects for [['pebbles'], ['barney', 'fred']] 18243 * 18244 * // The `_.matchesProperty` iteratee shorthand. 18245 * _.partition(users, ['active', false]); 18246 * // => objects for [['barney', 'pebbles'], ['fred']] 18247 * 18248 * // The `_.property` iteratee shorthand. 18249 * _.partition(users, 'active'); 18250 * // => objects for [['fred'], ['barney', 'pebbles']] 18251 */ 18252 var partition = createAggregator(function(result, value, key) { 18253 result[key ? 0 : 1].push(value); 18254 }, function() { return [[], []]; }); 18255 18256 /** 18257 * Reduces `collection` to a value which is the accumulated result of running 18258 * each element in `collection` thru `iteratee`, where each successive 18259 * invocation is supplied the return value of the previous. If `accumulator` 18260 * is not given, the first element of `collection` is used as the initial 18261 * value. The iteratee is invoked with four arguments: 18262 * (accumulator, value, index|key, collection). 18263 * 18264 * Many lodash methods are guarded to work as iteratees for methods like 18265 * `_.reduce`, `_.reduceRight`, and `_.transform`. 18266 * 18267 * The guarded methods are: 18268 * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, 18269 * and `sortBy` 18270 * 18271 * @static 18272 * @memberOf _ 18273 * @since 0.1.0 18274 * @category Collection 18275 * @param {Array|Object} collection The collection to iterate over. 18276 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 18277 * @param {*} [accumulator] The initial value. 18278 * @returns {*} Returns the accumulated value. 18279 * @see _.reduceRight 18280 * @example 18281 * 18282 * _.reduce([1, 2], function(sum, n) { 18283 * return sum + n; 18284 * }, 0); 18285 * // => 3 18286 * 18287 * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { 18288 * (result[value] || (result[value] = [])).push(key); 18289 * return result; 18290 * }, {}); 18291 * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) 18292 */ 18293 function reduce(collection, iteratee, accumulator) { 18294 var func = isArray(collection) ? arrayReduce : baseReduce, 18295 initAccum = arguments.length < 3; 18296 18297 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach); 18298 } 18299 18300 /** 18301 * This method is like `_.reduce` except that it iterates over elements of 18302 * `collection` from right to left. 18303 * 18304 * @static 18305 * @memberOf _ 18306 * @since 0.1.0 18307 * @category Collection 18308 * @param {Array|Object} collection The collection to iterate over. 18309 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 18310 * @param {*} [accumulator] The initial value. 18311 * @returns {*} Returns the accumulated value. 18312 * @see _.reduce 18313 * @example 18314 * 18315 * var array = [[0, 1], [2, 3], [4, 5]]; 18316 * 18317 * _.reduceRight(array, function(flattened, other) { 18318 * return flattened.concat(other); 18319 * }, []); 18320 * // => [4, 5, 2, 3, 0, 1] 18321 */ 18322 function reduceRight(collection, iteratee, accumulator) { 18323 var func = isArray(collection) ? arrayReduceRight : baseReduce, 18324 initAccum = arguments.length < 3; 18325 18326 return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); 18327 } 18328 18329 /** 18330 * The opposite of `_.filter`; this method returns the elements of `collection` 18331 * that `predicate` does **not** return truthy for. 18332 * 18333 * @static 18334 * @memberOf _ 18335 * @since 0.1.0 18336 * @category Collection 18337 * @param {Array|Object} collection The collection to iterate over. 18338 * @param {Function} [predicate=_.identity] The function invoked per iteration. 18339 * @returns {Array} Returns the new filtered array. 18340 * @see _.filter 18341 * @example 18342 * 18343 * var users = [ 18344 * { 'user': 'barney', 'age': 36, 'active': false }, 18345 * { 'user': 'fred', 'age': 40, 'active': true } 18346 * ]; 18347 * 18348 * _.reject(users, function(o) { return !o.active; }); 18349 * // => objects for ['fred'] 18350 * 18351 * // The `_.matches` iteratee shorthand. 18352 * _.reject(users, { 'age': 40, 'active': true }); 18353 * // => objects for ['barney'] 18354 * 18355 * // The `_.matchesProperty` iteratee shorthand. 18356 * _.reject(users, ['active', false]); 18357 * // => objects for ['fred'] 18358 * 18359 * // The `_.property` iteratee shorthand. 18360 * _.reject(users, 'active'); 18361 * // => objects for ['barney'] 18362 */ 18363 function reject(collection, predicate) { 18364 var func = isArray(collection) ? arrayFilter : baseFilter; 18365 return func(collection, negate(getIteratee(predicate, 3))); 18366 } 18367 18368 /** 18369 * Gets a random element from `collection`. 18370 * 18371 * @static 18372 * @memberOf _ 18373 * @since 2.0.0 18374 * @category Collection 18375 * @param {Array|Object} collection The collection to sample. 18376 * @returns {*} Returns the random element. 18377 * @example 18378 * 18379 * _.sample([1, 2, 3, 4]); 18380 * // => 2 18381 */ 18382 function sample(collection) { 18383 var func = isArray(collection) ? arraySample : baseSample; 18384 return func(collection); 18385 } 18386 18387 /** 18388 * Gets `n` random elements at unique keys from `collection` up to the 18389 * size of `collection`. 18390 * 18391 * @static 18392 * @memberOf _ 18393 * @since 4.0.0 18394 * @category Collection 18395 * @param {Array|Object} collection The collection to sample. 18396 * @param {number} [n=1] The number of elements to sample. 18397 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 18398 * @returns {Array} Returns the random elements. 18399 * @example 18400 * 18401 * _.sampleSize([1, 2, 3], 2); 18402 * // => [3, 1] 18403 * 18404 * _.sampleSize([1, 2, 3], 4); 18405 * // => [2, 3, 1] 18406 */ 18407 function sampleSize(collection, n, guard) { 18408 if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { 18409 n = 1; 18410 } else { 18411 n = toInteger(n); 18412 } 18413 var func = isArray(collection) ? arraySampleSize : baseSampleSize; 18414 return func(collection, n); 18415 } 18416 18417 /** 18418 * Creates an array of shuffled values, using a version of the 18419 * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). 18420 * 18421 * @static 18422 * @memberOf _ 18423 * @since 0.1.0 18424 * @category Collection 18425 * @param {Array|Object} collection The collection to shuffle. 18426 * @returns {Array} Returns the new shuffled array. 18427 * @example 18428 * 18429 * _.shuffle([1, 2, 3, 4]); 18430 * // => [4, 1, 3, 2] 18431 */ 18432 function shuffle(collection) { 18433 var func = isArray(collection) ? arrayShuffle : baseShuffle; 18434 return func(collection); 18435 } 18436 18437 /** 18438 * Gets the size of `collection` by returning its length for array-like 18439 * values or the number of own enumerable string keyed properties for objects. 18440 * 18441 * @static 18442 * @memberOf _ 18443 * @since 0.1.0 18444 * @category Collection 18445 * @param {Array|Object|string} collection The collection to inspect. 18446 * @returns {number} Returns the collection size. 18447 * @example 18448 * 18449 * _.size([1, 2, 3]); 18450 * // => 3 18451 * 18452 * _.size({ 'a': 1, 'b': 2 }); 18453 * // => 2 18454 * 18455 * _.size('pebbles'); 18456 * // => 7 18457 */ 18458 function size(collection) { 18459 if (collection == null) { 18460 return 0; 18461 } 18462 if (isArrayLike(collection)) { 18463 return isString(collection) ? stringSize(collection) : collection.length; 18464 } 18465 var tag = getTag(collection); 18466 if (tag == mapTag || tag == setTag) { 18467 return collection.size; 18468 } 18469 return baseKeys(collection).length; 18470 } 18471 18472 /** 18473 * Checks if `predicate` returns truthy for **any** element of `collection`. 18474 * Iteration is stopped once `predicate` returns truthy. The predicate is 18475 * invoked with three arguments: (value, index|key, collection). 18476 * 18477 * @static 18478 * @memberOf _ 18479 * @since 0.1.0 18480 * @category Collection 18481 * @param {Array|Object} collection The collection to iterate over. 18482 * @param {Function} [predicate=_.identity] The function invoked per iteration. 18483 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 18484 * @returns {boolean} Returns `true` if any element passes the predicate check, 18485 * else `false`. 18486 * @example 18487 * 18488 * _.some([null, 0, 'yes', false], Boolean); 18489 * // => true 18490 * 18491 * var users = [ 18492 * { 'user': 'barney', 'active': true }, 18493 * { 'user': 'fred', 'active': false } 18494 * ]; 18495 * 18496 * // The `_.matches` iteratee shorthand. 18497 * _.some(users, { 'user': 'barney', 'active': false }); 18498 * // => false 18499 * 18500 * // The `_.matchesProperty` iteratee shorthand. 18501 * _.some(users, ['active', false]); 18502 * // => true 18503 * 18504 * // The `_.property` iteratee shorthand. 18505 * _.some(users, 'active'); 18506 * // => true 18507 */ 18508 function some(collection, predicate, guard) { 18509 var func = isArray(collection) ? arraySome : baseSome; 18510 if (guard && isIterateeCall(collection, predicate, guard)) { 18511 predicate = undefined; 18512 } 18513 return func(collection, getIteratee(predicate, 3)); 18514 } 18515 18516 /** 18517 * Creates an array of elements, sorted in ascending order by the results of 18518 * running each element in a collection thru each iteratee. This method 18519 * performs a stable sort, that is, it preserves the original sort order of 18520 * equal elements. The iteratees are invoked with one argument: (value). 18521 * 18522 * @static 18523 * @memberOf _ 18524 * @since 0.1.0 18525 * @category Collection 18526 * @param {Array|Object} collection The collection to iterate over. 18527 * @param {...(Function|Function[])} [iteratees=[_.identity]] 18528 * The iteratees to sort by. 18529 * @returns {Array} Returns the new sorted array. 18530 * @example 18531 * 18532 * var users = [ 18533 * { 'user': 'fred', 'age': 48 }, 18534 * { 'user': 'barney', 'age': 36 }, 18535 * { 'user': 'fred', 'age': 30 }, 18536 * { 'user': 'barney', 'age': 34 } 18537 * ]; 18538 * 18539 * _.sortBy(users, [function(o) { return o.user; }]); 18540 * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] 18541 * 18542 * _.sortBy(users, ['user', 'age']); 18543 * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] 18544 */ 18545 var sortBy = baseRest(function(collection, iteratees) { 18546 if (collection == null) { 18547 return []; 18548 } 18549 var length = iteratees.length; 18550 if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { 18551 iteratees = []; 18552 } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { 18553 iteratees = [iteratees[0]]; 18554 } 18555 return baseOrderBy(collection, baseFlatten(iteratees, 1), []); 18556 }); 18557 18558 /*------------------------------------------------------------------------*/ 18559 18560 /** 18561 * Gets the timestamp of the number of milliseconds that have elapsed since 18562 * the Unix epoch (1 January 1970 00:00:00 UTC). 18563 * 18564 * @static 18565 * @memberOf _ 18566 * @since 2.4.0 18567 * @category Date 18568 * @returns {number} Returns the timestamp. 18569 * @example 18570 * 18571 * _.defer(function(stamp) { 18572 * console.log(_.now() - stamp); 18573 * }, _.now()); 18574 * // => Logs the number of milliseconds it took for the deferred invocation. 18575 */ 18576 var now = ctxNow || function() { 18577 return root.Date.now(); 18578 }; 18579 18580 /*------------------------------------------------------------------------*/ 18581 18582 /** 18583 * The opposite of `_.before`; this method creates a function that invokes 18584 * `func` once it's called `n` or more times. 18585 * 18586 * @static 18587 * @memberOf _ 18588 * @since 0.1.0 18589 * @category Function 18590 * @param {number} n The number of calls before `func` is invoked. 18591 * @param {Function} func The function to restrict. 18592 * @returns {Function} Returns the new restricted function. 18593 * @example 18594 * 18595 * var saves = ['profile', 'settings']; 18596 * 18597 * var done = _.after(saves.length, function() { 18598 * console.log('done saving!'); 18599 * }); 18600 * 18601 * _.forEach(saves, function(type) { 18602 * asyncSave({ 'type': type, 'complete': done }); 18603 * }); 18604 * // => Logs 'done saving!' after the two async saves have completed. 18605 */ 18606 function after(n, func) { 18607 if (typeof func != 'function') { 18608 throw new TypeError(FUNC_ERROR_TEXT); 18609 } 18610 n = toInteger(n); 18611 return function() { 18612 if (--n < 1) { 18613 return func.apply(this, arguments); 18614 } 18615 }; 18616 } 18617 18618 /** 18619 * Creates a function that invokes `func`, with up to `n` arguments, 18620 * ignoring any additional arguments. 18621 * 18622 * @static 18623 * @memberOf _ 18624 * @since 3.0.0 18625 * @category Function 18626 * @param {Function} func The function to cap arguments for. 18627 * @param {number} [n=func.length] The arity cap. 18628 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 18629 * @returns {Function} Returns the new capped function. 18630 * @example 18631 * 18632 * _.map(['6', '8', '10'], _.ary(parseInt, 1)); 18633 * // => [6, 8, 10] 18634 */ 18635 function ary(func, n, guard) { 18636 n = guard ? undefined : n; 18637 n = (func && n == null) ? func.length : n; 18638 return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n); 18639 } 18640 18641 /** 18642 * Creates a function that invokes `func`, with the `this` binding and arguments 18643 * of the created function, while it's called less than `n` times. Subsequent 18644 * calls to the created function return the result of the last `func` invocation. 18645 * 18646 * @static 18647 * @memberOf _ 18648 * @since 3.0.0 18649 * @category Function 18650 * @param {number} n The number of calls at which `func` is no longer invoked. 18651 * @param {Function} func The function to restrict. 18652 * @returns {Function} Returns the new restricted function. 18653 * @example 18654 * 18655 * jQuery(element).on('click', _.before(5, addContactToList)); 18656 * // => Allows adding up to 4 contacts to the list. 18657 */ 18658 function before(n, func) { 18659 var result; 18660 if (typeof func != 'function') { 18661 throw new TypeError(FUNC_ERROR_TEXT); 18662 } 18663 n = toInteger(n); 18664 return function() { 18665 if (--n > 0) { 18666 result = func.apply(this, arguments); 18667 } 18668 if (n <= 1) { 18669 func = undefined; 18670 } 18671 return result; 18672 }; 18673 } 18674 18675 /** 18676 * Creates a function that invokes `func` with the `this` binding of `thisArg` 18677 * and `partials` prepended to the arguments it receives. 18678 * 18679 * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, 18680 * may be used as a placeholder for partially applied arguments. 18681 * 18682 * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" 18683 * property of bound functions. 18684 * 18685 * @static 18686 * @memberOf _ 18687 * @since 0.1.0 18688 * @category Function 18689 * @param {Function} func The function to bind. 18690 * @param {*} thisArg The `this` binding of `func`. 18691 * @param {...*} [partials] The arguments to be partially applied. 18692 * @returns {Function} Returns the new bound function. 18693 * @example 18694 * 18695 * function greet(greeting, punctuation) { 18696 * return greeting + ' ' + this.user + punctuation; 18697 * } 18698 * 18699 * var object = { 'user': 'fred' }; 18700 * 18701 * var bound = _.bind(greet, object, 'hi'); 18702 * bound('!'); 18703 * // => 'hi fred!' 18704 * 18705 * // Bound with placeholders. 18706 * var bound = _.bind(greet, object, _, '!'); 18707 * bound('hi'); 18708 * // => 'hi fred!' 18709 */ 18710 var bind = baseRest(function(func, thisArg, partials) { 18711 var bitmask = WRAP_BIND_FLAG; 18712 if (partials.length) { 18713 var holders = replaceHolders(partials, getHolder(bind)); 18714 bitmask |= WRAP_PARTIAL_FLAG; 18715 } 18716 return createWrap(func, bitmask, thisArg, partials, holders); 18717 }); 18718 18719 /** 18720 * Creates a function that invokes the method at `object[key]` with `partials` 18721 * prepended to the arguments it receives. 18722 * 18723 * This method differs from `_.bind` by allowing bound functions to reference 18724 * methods that may be redefined or don't yet exist. See 18725 * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) 18726 * for more details. 18727 * 18728 * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic 18729 * builds, may be used as a placeholder for partially applied arguments. 18730 * 18731 * @static 18732 * @memberOf _ 18733 * @since 0.10.0 18734 * @category Function 18735 * @param {Object} object The object to invoke the method on. 18736 * @param {string} key The key of the method. 18737 * @param {...*} [partials] The arguments to be partially applied. 18738 * @returns {Function} Returns the new bound function. 18739 * @example 18740 * 18741 * var object = { 18742 * 'user': 'fred', 18743 * 'greet': function(greeting, punctuation) { 18744 * return greeting + ' ' + this.user + punctuation; 18745 * } 18746 * }; 18747 * 18748 * var bound = _.bindKey(object, 'greet', 'hi'); 18749 * bound('!'); 18750 * // => 'hi fred!' 18751 * 18752 * object.greet = function(greeting, punctuation) { 18753 * return greeting + 'ya ' + this.user + punctuation; 18754 * }; 18755 * 18756 * bound('!'); 18757 * // => 'hiya fred!' 18758 * 18759 * // Bound with placeholders. 18760 * var bound = _.bindKey(object, 'greet', _, '!'); 18761 * bound('hi'); 18762 * // => 'hiya fred!' 18763 */ 18764 var bindKey = baseRest(function(object, key, partials) { 18765 var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; 18766 if (partials.length) { 18767 var holders = replaceHolders(partials, getHolder(bindKey)); 18768 bitmask |= WRAP_PARTIAL_FLAG; 18769 } 18770 return createWrap(key, bitmask, object, partials, holders); 18771 }); 18772 18773 /** 18774 * Creates a function that accepts arguments of `func` and either invokes 18775 * `func` returning its result, if at least `arity` number of arguments have 18776 * been provided, or returns a function that accepts the remaining `func` 18777 * arguments, and so on. The arity of `func` may be specified if `func.length` 18778 * is not sufficient. 18779 * 18780 * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, 18781 * may be used as a placeholder for provided arguments. 18782 * 18783 * **Note:** This method doesn't set the "length" property of curried functions. 18784 * 18785 * @static 18786 * @memberOf _ 18787 * @since 2.0.0 18788 * @category Function 18789 * @param {Function} func The function to curry. 18790 * @param {number} [arity=func.length] The arity of `func`. 18791 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 18792 * @returns {Function} Returns the new curried function. 18793 * @example 18794 * 18795 * var abc = function(a, b, c) { 18796 * return [a, b, c]; 18797 * }; 18798 * 18799 * var curried = _.curry(abc); 18800 * 18801 * curried(1)(2)(3); 18802 * // => [1, 2, 3] 18803 * 18804 * curried(1, 2)(3); 18805 * // => [1, 2, 3] 18806 * 18807 * curried(1, 2, 3); 18808 * // => [1, 2, 3] 18809 * 18810 * // Curried with placeholders. 18811 * curried(1)(_, 3)(2); 18812 * // => [1, 2, 3] 18813 */ 18814 function curry(func, arity, guard) { 18815 arity = guard ? undefined : arity; 18816 var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); 18817 result.placeholder = curry.placeholder; 18818 return result; 18819 } 18820 18821 /** 18822 * This method is like `_.curry` except that arguments are applied to `func` 18823 * in the manner of `_.partialRight` instead of `_.partial`. 18824 * 18825 * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic 18826 * builds, may be used as a placeholder for provided arguments. 18827 * 18828 * **Note:** This method doesn't set the "length" property of curried functions. 18829 * 18830 * @static 18831 * @memberOf _ 18832 * @since 3.0.0 18833 * @category Function 18834 * @param {Function} func The function to curry. 18835 * @param {number} [arity=func.length] The arity of `func`. 18836 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 18837 * @returns {Function} Returns the new curried function. 18838 * @example 18839 * 18840 * var abc = function(a, b, c) { 18841 * return [a, b, c]; 18842 * }; 18843 * 18844 * var curried = _.curryRight(abc); 18845 * 18846 * curried(3)(2)(1); 18847 * // => [1, 2, 3] 18848 * 18849 * curried(2, 3)(1); 18850 * // => [1, 2, 3] 18851 * 18852 * curried(1, 2, 3); 18853 * // => [1, 2, 3] 18854 * 18855 * // Curried with placeholders. 18856 * curried(3)(1, _)(2); 18857 * // => [1, 2, 3] 18858 */ 18859 function curryRight(func, arity, guard) { 18860 arity = guard ? undefined : arity; 18861 var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); 18862 result.placeholder = curryRight.placeholder; 18863 return result; 18864 } 18865 18866 /** 18867 * Creates a debounced function that delays invoking `func` until after `wait` 18868 * milliseconds have elapsed since the last time the debounced function was 18869 * invoked. The debounced function comes with a `cancel` method to cancel 18870 * delayed `func` invocations and a `flush` method to immediately invoke them. 18871 * Provide `options` to indicate whether `func` should be invoked on the 18872 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked 18873 * with the last arguments provided to the debounced function. Subsequent 18874 * calls to the debounced function return the result of the last `func` 18875 * invocation. 18876 * 18877 * **Note:** If `leading` and `trailing` options are `true`, `func` is 18878 * invoked on the trailing edge of the timeout only if the debounced function 18879 * is invoked more than once during the `wait` timeout. 18880 * 18881 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 18882 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 18883 * 18884 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 18885 * for details over the differences between `_.debounce` and `_.throttle`. 18886 * 18887 * @static 18888 * @memberOf _ 18889 * @since 0.1.0 18890 * @category Function 18891 * @param {Function} func The function to debounce. 18892 * @param {number} [wait=0] The number of milliseconds to delay. 18893 * @param {Object} [options={}] The options object. 18894 * @param {boolean} [options.leading=false] 18895 * Specify invoking on the leading edge of the timeout. 18896 * @param {number} [options.maxWait] 18897 * The maximum time `func` is allowed to be delayed before it's invoked. 18898 * @param {boolean} [options.trailing=true] 18899 * Specify invoking on the trailing edge of the timeout. 18900 * @returns {Function} Returns the new debounced function. 18901 * @example 18902 * 18903 * // Avoid costly calculations while the window size is in flux. 18904 * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); 18905 * 18906 * // Invoke `sendMail` when clicked, debouncing subsequent calls. 18907 * jQuery(element).on('click', _.debounce(sendMail, 300, { 18908 * 'leading': true, 18909 * 'trailing': false 18910 * })); 18911 * 18912 * // Ensure `batchLog` is invoked once after 1 second of debounced calls. 18913 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); 18914 * var source = new EventSource('/stream'); 18915 * jQuery(source).on('message', debounced); 18916 * 18917 * // Cancel the trailing debounced invocation. 18918 * jQuery(window).on('popstate', debounced.cancel); 18919 */ 18920 function debounce(func, wait, options) { 18921 var lastArgs, 18922 lastThis, 18923 maxWait, 18924 result, 18925 timerId, 18926 lastCallTime, 18927 lastInvokeTime = 0, 18928 leading = false, 18929 maxing = false, 18930 trailing = true; 18931 18932 if (typeof func != 'function') { 18933 throw new TypeError(FUNC_ERROR_TEXT); 18934 } 18935 wait = toNumber(wait) || 0; 18936 if (isObject(options)) { 18937 leading = !!options.leading; 18938 maxing = 'maxWait' in options; 18939 maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; 18940 trailing = 'trailing' in options ? !!options.trailing : trailing; 18941 } 18942 18943 function invokeFunc(time) { 18944 var args = lastArgs, 18945 thisArg = lastThis; 18946 18947 lastArgs = lastThis = undefined; 18948 lastInvokeTime = time; 18949 result = func.apply(thisArg, args); 18950 return result; 18951 } 18952 18953 function leadingEdge(time) { 18954 // Reset any `maxWait` timer. 18955 lastInvokeTime = time; 18956 // Start the timer for the trailing edge. 18957 timerId = setTimeout(timerExpired, wait); 18958 // Invoke the leading edge. 18959 return leading ? invokeFunc(time) : result; 18960 } 18961 18962 function remainingWait(time) { 18963 var timeSinceLastCall = time - lastCallTime, 18964 timeSinceLastInvoke = time - lastInvokeTime, 18965 timeWaiting = wait - timeSinceLastCall; 18966 18967 return maxing 18968 ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) 18969 : timeWaiting; 18970 } 18971 18972 function shouldInvoke(time) { 18973 var timeSinceLastCall = time - lastCallTime, 18974 timeSinceLastInvoke = time - lastInvokeTime; 18975 18976 // Either this is the first call, activity has stopped and we're at the 18977 // trailing edge, the system time has gone backwards and we're treating 18978 // it as the trailing edge, or we've hit the `maxWait` limit. 18979 return (lastCallTime === undefined || (timeSinceLastCall >= wait) || 18980 (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); 18981 } 18982 18983 function timerExpired() { 18984 var time = now(); 18985 if (shouldInvoke(time)) { 18986 return trailingEdge(time); 18987 } 18988 // Restart the timer. 18989 timerId = setTimeout(timerExpired, remainingWait(time)); 18990 } 18991 18992 function trailingEdge(time) { 18993 timerId = undefined; 18994 18995 // Only invoke if we have `lastArgs` which means `func` has been 18996 // debounced at least once. 18997 if (trailing && lastArgs) { 18998 return invokeFunc(time); 18999 } 19000 lastArgs = lastThis = undefined; 19001 return result; 19002 } 19003 19004 function cancel() { 19005 if (timerId !== undefined) { 19006 clearTimeout(timerId); 19007 } 19008 lastInvokeTime = 0; 19009 lastArgs = lastCallTime = lastThis = timerId = undefined; 19010 } 19011 19012 function flush() { 19013 return timerId === undefined ? result : trailingEdge(now()); 19014 } 19015 19016 function debounced() { 19017 var time = now(), 19018 isInvoking = shouldInvoke(time); 19019 19020 lastArgs = arguments; 19021 lastThis = this; 19022 lastCallTime = time; 19023 19024 if (isInvoking) { 19025 if (timerId === undefined) { 19026 return leadingEdge(lastCallTime); 19027 } 19028 if (maxing) { 19029 // Handle invocations in a tight loop. 19030 clearTimeout(timerId); 19031 timerId = setTimeout(timerExpired, wait); 19032 return invokeFunc(lastCallTime); 19033 } 19034 } 19035 if (timerId === undefined) { 19036 timerId = setTimeout(timerExpired, wait); 19037 } 19038 return result; 19039 } 19040 debounced.cancel = cancel; 19041 debounced.flush = flush; 19042 return debounced; 19043 } 19044 19045 /** 19046 * Defers invoking the `func` until the current call stack has cleared. Any 19047 * additional arguments are provided to `func` when it's invoked. 19048 * 19049 * @static 19050 * @memberOf _ 19051 * @since 0.1.0 19052 * @category Function 19053 * @param {Function} func The function to defer. 19054 * @param {...*} [args] The arguments to invoke `func` with. 19055 * @returns {number} Returns the timer id. 19056 * @example 19057 * 19058 * _.defer(function(text) { 19059 * console.log(text); 19060 * }, 'deferred'); 19061 * // => Logs 'deferred' after one millisecond. 19062 */ 19063 var defer = baseRest(function(func, args) { 19064 return baseDelay(func, 1, args); 19065 }); 19066 19067 /** 19068 * Invokes `func` after `wait` milliseconds. Any additional arguments are 19069 * provided to `func` when it's invoked. 19070 * 19071 * @static 19072 * @memberOf _ 19073 * @since 0.1.0 19074 * @category Function 19075 * @param {Function} func The function to delay. 19076 * @param {number} wait The number of milliseconds to delay invocation. 19077 * @param {...*} [args] The arguments to invoke `func` with. 19078 * @returns {number} Returns the timer id. 19079 * @example 19080 * 19081 * _.delay(function(text) { 19082 * console.log(text); 19083 * }, 1000, 'later'); 19084 * // => Logs 'later' after one second. 19085 */ 19086 var delay = baseRest(function(func, wait, args) { 19087 return baseDelay(func, toNumber(wait) || 0, args); 19088 }); 19089 19090 /** 19091 * Creates a function that invokes `func` with arguments reversed. 19092 * 19093 * @static 19094 * @memberOf _ 19095 * @since 4.0.0 19096 * @category Function 19097 * @param {Function} func The function to flip arguments for. 19098 * @returns {Function} Returns the new flipped function. 19099 * @example 19100 * 19101 * var flipped = _.flip(function() { 19102 * return _.toArray(arguments); 19103 * }); 19104 * 19105 * flipped('a', 'b', 'c', 'd'); 19106 * // => ['d', 'c', 'b', 'a'] 19107 */ 19108 function flip(func) { 19109 return createWrap(func, WRAP_FLIP_FLAG); 19110 } 19111 19112 /** 19113 * Creates a function that memoizes the result of `func`. If `resolver` is 19114 * provided, it determines the cache key for storing the result based on the 19115 * arguments provided to the memoized function. By default, the first argument 19116 * provided to the memoized function is used as the map cache key. The `func` 19117 * is invoked with the `this` binding of the memoized function. 19118 * 19119 * **Note:** The cache is exposed as the `cache` property on the memoized 19120 * function. Its creation may be customized by replacing the `_.memoize.Cache` 19121 * constructor with one whose instances implement the 19122 * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) 19123 * method interface of `clear`, `delete`, `get`, `has`, and `set`. 19124 * 19125 * @static 19126 * @memberOf _ 19127 * @since 0.1.0 19128 * @category Function 19129 * @param {Function} func The function to have its output memoized. 19130 * @param {Function} [resolver] The function to resolve the cache key. 19131 * @returns {Function} Returns the new memoized function. 19132 * @example 19133 * 19134 * var object = { 'a': 1, 'b': 2 }; 19135 * var other = { 'c': 3, 'd': 4 }; 19136 * 19137 * var values = _.memoize(_.values); 19138 * values(object); 19139 * // => [1, 2] 19140 * 19141 * values(other); 19142 * // => [3, 4] 19143 * 19144 * object.a = 2; 19145 * values(object); 19146 * // => [1, 2] 19147 * 19148 * // Modify the result cache. 19149 * values.cache.set(object, ['a', 'b']); 19150 * values(object); 19151 * // => ['a', 'b'] 19152 * 19153 * // Replace `_.memoize.Cache`. 19154 * _.memoize.Cache = WeakMap; 19155 */ 19156 function memoize(func, resolver) { 19157 if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { 19158 throw new TypeError(FUNC_ERROR_TEXT); 19159 } 19160 var memoized = function() { 19161 var args = arguments, 19162 key = resolver ? resolver.apply(this, args) : args[0], 19163 cache = memoized.cache; 19164 19165 if (cache.has(key)) { 19166 return cache.get(key); 19167 } 19168 var result = func.apply(this, args); 19169 memoized.cache = cache.set(key, result) || cache; 19170 return result; 19171 }; 19172 memoized.cache = new (memoize.Cache || MapCache); 19173 return memoized; 19174 } 19175 19176 // Expose `MapCache`. 19177 memoize.Cache = MapCache; 19178 19179 /** 19180 * Creates a function that negates the result of the predicate `func`. The 19181 * `func` predicate is invoked with the `this` binding and arguments of the 19182 * created function. 19183 * 19184 * @static 19185 * @memberOf _ 19186 * @since 3.0.0 19187 * @category Function 19188 * @param {Function} predicate The predicate to negate. 19189 * @returns {Function} Returns the new negated function. 19190 * @example 19191 * 19192 * function isEven(n) { 19193 * return n % 2 == 0; 19194 * } 19195 * 19196 * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); 19197 * // => [1, 3, 5] 19198 */ 19199 function negate(predicate) { 19200 if (typeof predicate != 'function') { 19201 throw new TypeError(FUNC_ERROR_TEXT); 19202 } 19203 return function() { 19204 var args = arguments; 19205 switch (args.length) { 19206 case 0: return !predicate.call(this); 19207 case 1: return !predicate.call(this, args[0]); 19208 case 2: return !predicate.call(this, args[0], args[1]); 19209 case 3: return !predicate.call(this, args[0], args[1], args[2]); 19210 } 19211 return !predicate.apply(this, args); 19212 }; 19213 } 19214 19215 /** 19216 * Creates a function that is restricted to invoking `func` once. Repeat calls 19217 * to the function return the value of the first invocation. The `func` is 19218 * invoked with the `this` binding and arguments of the created function. 19219 * 19220 * @static 19221 * @memberOf _ 19222 * @since 0.1.0 19223 * @category Function 19224 * @param {Function} func The function to restrict. 19225 * @returns {Function} Returns the new restricted function. 19226 * @example 19227 * 19228 * var initialize = _.once(createApplication); 19229 * initialize(); 19230 * initialize(); 19231 * // => `createApplication` is invoked once 19232 */ 19233 function once(func) { 19234 return before(2, func); 19235 } 19236 19237 /** 19238 * Creates a function that invokes `func` with its arguments transformed. 19239 * 19240 * @static 19241 * @since 4.0.0 19242 * @memberOf _ 19243 * @category Function 19244 * @param {Function} func The function to wrap. 19245 * @param {...(Function|Function[])} [transforms=[_.identity]] 19246 * The argument transforms. 19247 * @returns {Function} Returns the new function. 19248 * @example 19249 * 19250 * function doubled(n) { 19251 * return n * 2; 19252 * } 19253 * 19254 * function square(n) { 19255 * return n * n; 19256 * } 19257 * 19258 * var func = _.overArgs(function(x, y) { 19259 * return [x, y]; 19260 * }, [square, doubled]); 19261 * 19262 * func(9, 3); 19263 * // => [81, 6] 19264 * 19265 * func(10, 5); 19266 * // => [100, 10] 19267 */ 19268 var overArgs = castRest(function(func, transforms) { 19269 transforms = (transforms.length == 1 && isArray(transforms[0])) 19270 ? arrayMap(transforms[0], baseUnary(getIteratee())) 19271 : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); 19272 19273 var funcsLength = transforms.length; 19274 return baseRest(function(args) { 19275 var index = -1, 19276 length = nativeMin(args.length, funcsLength); 19277 19278 while (++index < length) { 19279 args[index] = transforms[index].call(this, args[index]); 19280 } 19281 return apply(func, this, args); 19282 }); 19283 }); 19284 19285 /** 19286 * Creates a function that invokes `func` with `partials` prepended to the 19287 * arguments it receives. This method is like `_.bind` except it does **not** 19288 * alter the `this` binding. 19289 * 19290 * The `_.partial.placeholder` value, which defaults to `_` in monolithic 19291 * builds, may be used as a placeholder for partially applied arguments. 19292 * 19293 * **Note:** This method doesn't set the "length" property of partially 19294 * applied functions. 19295 * 19296 * @static 19297 * @memberOf _ 19298 * @since 0.2.0 19299 * @category Function 19300 * @param {Function} func The function to partially apply arguments to. 19301 * @param {...*} [partials] The arguments to be partially applied. 19302 * @returns {Function} Returns the new partially applied function. 19303 * @example 19304 * 19305 * function greet(greeting, name) { 19306 * return greeting + ' ' + name; 19307 * } 19308 * 19309 * var sayHelloTo = _.partial(greet, 'hello'); 19310 * sayHelloTo('fred'); 19311 * // => 'hello fred' 19312 * 19313 * // Partially applied with placeholders. 19314 * var greetFred = _.partial(greet, _, 'fred'); 19315 * greetFred('hi'); 19316 * // => 'hi fred' 19317 */ 19318 var partial = baseRest(function(func, partials) { 19319 var holders = replaceHolders(partials, getHolder(partial)); 19320 return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders); 19321 }); 19322 19323 /** 19324 * This method is like `_.partial` except that partially applied arguments 19325 * are appended to the arguments it receives. 19326 * 19327 * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic 19328 * builds, may be used as a placeholder for partially applied arguments. 19329 * 19330 * **Note:** This method doesn't set the "length" property of partially 19331 * applied functions. 19332 * 19333 * @static 19334 * @memberOf _ 19335 * @since 1.0.0 19336 * @category Function 19337 * @param {Function} func The function to partially apply arguments to. 19338 * @param {...*} [partials] The arguments to be partially applied. 19339 * @returns {Function} Returns the new partially applied function. 19340 * @example 19341 * 19342 * function greet(greeting, name) { 19343 * return greeting + ' ' + name; 19344 * } 19345 * 19346 * var greetFred = _.partialRight(greet, 'fred'); 19347 * greetFred('hi'); 19348 * // => 'hi fred' 19349 * 19350 * // Partially applied with placeholders. 19351 * var sayHelloTo = _.partialRight(greet, 'hello', _); 19352 * sayHelloTo('fred'); 19353 * // => 'hello fred' 19354 */ 19355 var partialRight = baseRest(function(func, partials) { 19356 var holders = replaceHolders(partials, getHolder(partialRight)); 19357 return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders); 19358 }); 19359 19360 /** 19361 * Creates a function that invokes `func` with arguments arranged according 19362 * to the specified `indexes` where the argument value at the first index is 19363 * provided as the first argument, the argument value at the second index is 19364 * provided as the second argument, and so on. 19365 * 19366 * @static 19367 * @memberOf _ 19368 * @since 3.0.0 19369 * @category Function 19370 * @param {Function} func The function to rearrange arguments for. 19371 * @param {...(number|number[])} indexes The arranged argument indexes. 19372 * @returns {Function} Returns the new function. 19373 * @example 19374 * 19375 * var rearged = _.rearg(function(a, b, c) { 19376 * return [a, b, c]; 19377 * }, [2, 0, 1]); 19378 * 19379 * rearged('b', 'c', 'a') 19380 * // => ['a', 'b', 'c'] 19381 */ 19382 var rearg = flatRest(function(func, indexes) { 19383 return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes); 19384 }); 19385 19386 /** 19387 * Creates a function that invokes `func` with the `this` binding of the 19388 * created function and arguments from `start` and beyond provided as 19389 * an array. 19390 * 19391 * **Note:** This method is based on the 19392 * [rest parameter](https://mdn.io/rest_parameters). 19393 * 19394 * @static 19395 * @memberOf _ 19396 * @since 4.0.0 19397 * @category Function 19398 * @param {Function} func The function to apply a rest parameter to. 19399 * @param {number} [start=func.length-1] The start position of the rest parameter. 19400 * @returns {Function} Returns the new function. 19401 * @example 19402 * 19403 * var say = _.rest(function(what, names) { 19404 * return what + ' ' + _.initial(names).join(', ') + 19405 * (_.size(names) > 1 ? ', & ' : '') + _.last(names); 19406 * }); 19407 * 19408 * say('hello', 'fred', 'barney', 'pebbles'); 19409 * // => 'hello fred, barney, & pebbles' 19410 */ 19411 function rest(func, start) { 19412 if (typeof func != 'function') { 19413 throw new TypeError(FUNC_ERROR_TEXT); 19414 } 19415 start = start === undefined ? start : toInteger(start); 19416 return baseRest(func, start); 19417 } 19418 19419 /** 19420 * Creates a function that invokes `func` with the `this` binding of the 19421 * create function and an array of arguments much like 19422 * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply). 19423 * 19424 * **Note:** This method is based on the 19425 * [spread operator](https://mdn.io/spread_operator). 19426 * 19427 * @static 19428 * @memberOf _ 19429 * @since 3.2.0 19430 * @category Function 19431 * @param {Function} func The function to spread arguments over. 19432 * @param {number} [start=0] The start position of the spread. 19433 * @returns {Function} Returns the new function. 19434 * @example 19435 * 19436 * var say = _.spread(function(who, what) { 19437 * return who + ' says ' + what; 19438 * }); 19439 * 19440 * say(['fred', 'hello']); 19441 * // => 'fred says hello' 19442 * 19443 * var numbers = Promise.all([ 19444 * Promise.resolve(40), 19445 * Promise.resolve(36) 19446 * ]); 19447 * 19448 * numbers.then(_.spread(function(x, y) { 19449 * return x + y; 19450 * })); 19451 * // => a Promise of 76 19452 */ 19453 function spread(func, start) { 19454 if (typeof func != 'function') { 19455 throw new TypeError(FUNC_ERROR_TEXT); 19456 } 19457 start = start == null ? 0 : nativeMax(toInteger(start), 0); 19458 return baseRest(function(args) { 19459 var array = args[start], 19460 otherArgs = castSlice(args, 0, start); 19461 19462 if (array) { 19463 arrayPush(otherArgs, array); 19464 } 19465 return apply(func, this, otherArgs); 19466 }); 19467 } 19468 19469 /** 19470 * Creates a throttled function that only invokes `func` at most once per 19471 * every `wait` milliseconds. The throttled function comes with a `cancel` 19472 * method to cancel delayed `func` invocations and a `flush` method to 19473 * immediately invoke them. Provide `options` to indicate whether `func` 19474 * should be invoked on the leading and/or trailing edge of the `wait` 19475 * timeout. The `func` is invoked with the last arguments provided to the 19476 * throttled function. Subsequent calls to the throttled function return the 19477 * result of the last `func` invocation. 19478 * 19479 * **Note:** If `leading` and `trailing` options are `true`, `func` is 19480 * invoked on the trailing edge of the timeout only if the throttled function 19481 * is invoked more than once during the `wait` timeout. 19482 * 19483 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 19484 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 19485 * 19486 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 19487 * for details over the differences between `_.throttle` and `_.debounce`. 19488 * 19489 * @static 19490 * @memberOf _ 19491 * @since 0.1.0 19492 * @category Function 19493 * @param {Function} func The function to throttle. 19494 * @param {number} [wait=0] The number of milliseconds to throttle invocations to. 19495 * @param {Object} [options={}] The options object. 19496 * @param {boolean} [options.leading=true] 19497 * Specify invoking on the leading edge of the timeout. 19498 * @param {boolean} [options.trailing=true] 19499 * Specify invoking on the trailing edge of the timeout. 19500 * @returns {Function} Returns the new throttled function. 19501 * @example 19502 * 19503 * // Avoid excessively updating the position while scrolling. 19504 * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); 19505 * 19506 * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. 19507 * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); 19508 * jQuery(element).on('click', throttled); 19509 * 19510 * // Cancel the trailing throttled invocation. 19511 * jQuery(window).on('popstate', throttled.cancel); 19512 */ 19513 function throttle(func, wait, options) { 19514 var leading = true, 19515 trailing = true; 19516 19517 if (typeof func != 'function') { 19518 throw new TypeError(FUNC_ERROR_TEXT); 19519 } 19520 if (isObject(options)) { 19521 leading = 'leading' in options ? !!options.leading : leading; 19522 trailing = 'trailing' in options ? !!options.trailing : trailing; 19523 } 19524 return debounce(func, wait, { 19525 'leading': leading, 19526 'maxWait': wait, 19527 'trailing': trailing 19528 }); 19529 } 19530 19531 /** 19532 * Creates a function that accepts up to one argument, ignoring any 19533 * additional arguments. 19534 * 19535 * @static 19536 * @memberOf _ 19537 * @since 4.0.0 19538 * @category Function 19539 * @param {Function} func The function to cap arguments for. 19540 * @returns {Function} Returns the new capped function. 19541 * @example 19542 * 19543 * _.map(['6', '8', '10'], _.unary(parseInt)); 19544 * // => [6, 8, 10] 19545 */ 19546 function unary(func) { 19547 return ary(func, 1); 19548 } 19549 19550 /** 19551 * Creates a function that provides `value` to `wrapper` as its first 19552 * argument. Any additional arguments provided to the function are appended 19553 * to those provided to the `wrapper`. The wrapper is invoked with the `this` 19554 * binding of the created function. 19555 * 19556 * @static 19557 * @memberOf _ 19558 * @since 0.1.0 19559 * @category Function 19560 * @param {*} value The value to wrap. 19561 * @param {Function} [wrapper=identity] The wrapper function. 19562 * @returns {Function} Returns the new function. 19563 * @example 19564 * 19565 * var p = _.wrap(_.escape, function(func, text) { 19566 * return '<p>' + func(text) + '</p>'; 19567 * }); 19568 * 19569 * p('fred, barney, & pebbles'); 19570 * // => '<p>fred, barney, & pebbles</p>' 19571 */ 19572 function wrap(value, wrapper) { 19573 return partial(castFunction(wrapper), value); 19574 } 19575 19576 /*------------------------------------------------------------------------*/ 19577 19578 /** 19579 * Casts `value` as an array if it's not one. 19580 * 19581 * @static 19582 * @memberOf _ 19583 * @since 4.4.0 19584 * @category Lang 19585 * @param {*} value The value to inspect. 19586 * @returns {Array} Returns the cast array. 19587 * @example 19588 * 19589 * _.castArray(1); 19590 * // => [1] 19591 * 19592 * _.castArray({ 'a': 1 }); 19593 * // => [{ 'a': 1 }] 19594 * 19595 * _.castArray('abc'); 19596 * // => ['abc'] 19597 * 19598 * _.castArray(null); 19599 * // => [null] 19600 * 19601 * _.castArray(undefined); 19602 * // => [undefined] 19603 * 19604 * _.castArray(); 19605 * // => [] 19606 * 19607 * var array = [1, 2, 3]; 19608 * console.log(_.castArray(array) === array); 19609 * // => true 19610 */ 19611 function castArray() { 19612 if (!arguments.length) { 19613 return []; 19614 } 19615 var value = arguments[0]; 19616 return isArray(value) ? value : [value]; 19617 } 19618 19619 /** 19620 * Creates a shallow clone of `value`. 19621 * 19622 * **Note:** This method is loosely based on the 19623 * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) 19624 * and supports cloning arrays, array buffers, booleans, date objects, maps, 19625 * numbers, `Object` objects, regexes, sets, strings, symbols, and typed 19626 * arrays. The own enumerable properties of `arguments` objects are cloned 19627 * as plain objects. An empty object is returned for uncloneable values such 19628 * as error objects, functions, DOM nodes, and WeakMaps. 19629 * 19630 * @static 19631 * @memberOf _ 19632 * @since 0.1.0 19633 * @category Lang 19634 * @param {*} value The value to clone. 19635 * @returns {*} Returns the cloned value. 19636 * @see _.cloneDeep 19637 * @example 19638 * 19639 * var objects = [{ 'a': 1 }, { 'b': 2 }]; 19640 * 19641 * var shallow = _.clone(objects); 19642 * console.log(shallow[0] === objects[0]); 19643 * // => true 19644 */ 19645 function clone(value) { 19646 return baseClone(value, CLONE_SYMBOLS_FLAG); 19647 } 19648 19649 /** 19650 * This method is like `_.clone` except that it accepts `customizer` which 19651 * is invoked to produce the cloned value. If `customizer` returns `undefined`, 19652 * cloning is handled by the method instead. The `customizer` is invoked with 19653 * up to four arguments; (value [, index|key, object, stack]). 19654 * 19655 * @static 19656 * @memberOf _ 19657 * @since 4.0.0 19658 * @category Lang 19659 * @param {*} value The value to clone. 19660 * @param {Function} [customizer] The function to customize cloning. 19661 * @returns {*} Returns the cloned value. 19662 * @see _.cloneDeepWith 19663 * @example 19664 * 19665 * function customizer(value) { 19666 * if (_.isElement(value)) { 19667 * return value.cloneNode(false); 19668 * } 19669 * } 19670 * 19671 * var el = _.cloneWith(document.body, customizer); 19672 * 19673 * console.log(el === document.body); 19674 * // => false 19675 * console.log(el.nodeName); 19676 * // => 'BODY' 19677 * console.log(el.childNodes.length); 19678 * // => 0 19679 */ 19680 function cloneWith(value, customizer) { 19681 customizer = typeof customizer == 'function' ? customizer : undefined; 19682 return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); 19683 } 19684 19685 /** 19686 * This method is like `_.clone` except that it recursively clones `value`. 19687 * 19688 * @static 19689 * @memberOf _ 19690 * @since 1.0.0 19691 * @category Lang 19692 * @param {*} value The value to recursively clone. 19693 * @returns {*} Returns the deep cloned value. 19694 * @see _.clone 19695 * @example 19696 * 19697 * var objects = [{ 'a': 1 }, { 'b': 2 }]; 19698 * 19699 * var deep = _.cloneDeep(objects); 19700 * console.log(deep[0] === objects[0]); 19701 * // => false 19702 */ 19703 function cloneDeep(value) { 19704 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); 19705 } 19706 19707 /** 19708 * This method is like `_.cloneWith` except that it recursively clones `value`. 19709 * 19710 * @static 19711 * @memberOf _ 19712 * @since 4.0.0 19713 * @category Lang 19714 * @param {*} value The value to recursively clone. 19715 * @param {Function} [customizer] The function to customize cloning. 19716 * @returns {*} Returns the deep cloned value. 19717 * @see _.cloneWith 19718 * @example 19719 * 19720 * function customizer(value) { 19721 * if (_.isElement(value)) { 19722 * return value.cloneNode(true); 19723 * } 19724 * } 19725 * 19726 * var el = _.cloneDeepWith(document.body, customizer); 19727 * 19728 * console.log(el === document.body); 19729 * // => false 19730 * console.log(el.nodeName); 19731 * // => 'BODY' 19732 * console.log(el.childNodes.length); 19733 * // => 20 19734 */ 19735 function cloneDeepWith(value, customizer) { 19736 customizer = typeof customizer == 'function' ? customizer : undefined; 19737 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); 19738 } 19739 19740 /** 19741 * Checks if `object` conforms to `source` by invoking the predicate 19742 * properties of `source` with the corresponding property values of `object`. 19743 * 19744 * **Note:** This method is equivalent to `_.conforms` when `source` is 19745 * partially applied. 19746 * 19747 * @static 19748 * @memberOf _ 19749 * @since 4.14.0 19750 * @category Lang 19751 * @param {Object} object The object to inspect. 19752 * @param {Object} source The object of property predicates to conform to. 19753 * @returns {boolean} Returns `true` if `object` conforms, else `false`. 19754 * @example 19755 * 19756 * var object = { 'a': 1, 'b': 2 }; 19757 * 19758 * _.conformsTo(object, { 'b': function(n) { return n > 1; } }); 19759 * // => true 19760 * 19761 * _.conformsTo(object, { 'b': function(n) { return n > 2; } }); 19762 * // => false 19763 */ 19764 function conformsTo(object, source) { 19765 return source == null || baseConformsTo(object, source, keys(source)); 19766 } 19767 19768 /** 19769 * Performs a 19770 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 19771 * comparison between two values to determine if they are equivalent. 19772 * 19773 * @static 19774 * @memberOf _ 19775 * @since 4.0.0 19776 * @category Lang 19777 * @param {*} value The value to compare. 19778 * @param {*} other The other value to compare. 19779 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 19780 * @example 19781 * 19782 * var object = { 'a': 1 }; 19783 * var other = { 'a': 1 }; 19784 * 19785 * _.eq(object, object); 19786 * // => true 19787 * 19788 * _.eq(object, other); 19789 * // => false 19790 * 19791 * _.eq('a', 'a'); 19792 * // => true 19793 * 19794 * _.eq('a', Object('a')); 19795 * // => false 19796 * 19797 * _.eq(NaN, NaN); 19798 * // => true 19799 */ 19800 function eq(value, other) { 19801 return value === other || (value !== value && other !== other); 19802 } 19803 19804 /** 19805 * Checks if `value` is greater than `other`. 19806 * 19807 * @static 19808 * @memberOf _ 19809 * @since 3.9.0 19810 * @category Lang 19811 * @param {*} value The value to compare. 19812 * @param {*} other The other value to compare. 19813 * @returns {boolean} Returns `true` if `value` is greater than `other`, 19814 * else `false`. 19815 * @see _.lt 19816 * @example 19817 * 19818 * _.gt(3, 1); 19819 * // => true 19820 * 19821 * _.gt(3, 3); 19822 * // => false 19823 * 19824 * _.gt(1, 3); 19825 * // => false 19826 */ 19827 var gt = createRelationalOperation(baseGt); 19828 19829 /** 19830 * Checks if `value` is greater than or equal to `other`. 19831 * 19832 * @static 19833 * @memberOf _ 19834 * @since 3.9.0 19835 * @category Lang 19836 * @param {*} value The value to compare. 19837 * @param {*} other The other value to compare. 19838 * @returns {boolean} Returns `true` if `value` is greater than or equal to 19839 * `other`, else `false`. 19840 * @see _.lte 19841 * @example 19842 * 19843 * _.gte(3, 1); 19844 * // => true 19845 * 19846 * _.gte(3, 3); 19847 * // => true 19848 * 19849 * _.gte(1, 3); 19850 * // => false 19851 */ 19852 var gte = createRelationalOperation(function(value, other) { 19853 return value >= other; 19854 }); 19855 19856 /** 19857 * Checks if `value` is likely an `arguments` object. 19858 * 19859 * @static 19860 * @memberOf _ 19861 * @since 0.1.0 19862 * @category Lang 19863 * @param {*} value The value to check. 19864 * @returns {boolean} Returns `true` if `value` is an `arguments` object, 19865 * else `false`. 19866 * @example 19867 * 19868 * _.isArguments(function() { return arguments; }()); 19869 * // => true 19870 * 19871 * _.isArguments([1, 2, 3]); 19872 * // => false 19873 */ 19874 var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { 19875 return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && 19876 !propertyIsEnumerable.call(value, 'callee'); 19877 }; 19878 19879 /** 19880 * Checks if `value` is classified as an `Array` object. 19881 * 19882 * @static 19883 * @memberOf _ 19884 * @since 0.1.0 19885 * @category Lang 19886 * @param {*} value The value to check. 19887 * @returns {boolean} Returns `true` if `value` is an array, else `false`. 19888 * @example 19889 * 19890 * _.isArray([1, 2, 3]); 19891 * // => true 19892 * 19893 * _.isArray(document.body.children); 19894 * // => false 19895 * 19896 * _.isArray('abc'); 19897 * // => false 19898 * 19899 * _.isArray(_.noop); 19900 * // => false 19901 */ 19902 var isArray = Array.isArray; 19903 19904 /** 19905 * Checks if `value` is classified as an `ArrayBuffer` object. 19906 * 19907 * @static 19908 * @memberOf _ 19909 * @since 4.3.0 19910 * @category Lang 19911 * @param {*} value The value to check. 19912 * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. 19913 * @example 19914 * 19915 * _.isArrayBuffer(new ArrayBuffer(2)); 19916 * // => true 19917 * 19918 * _.isArrayBuffer(new Array(2)); 19919 * // => false 19920 */ 19921 var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; 19922 19923 /** 19924 * Checks if `value` is array-like. A value is considered array-like if it's 19925 * not a function and has a `value.length` that's an integer greater than or 19926 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. 19927 * 19928 * @static 19929 * @memberOf _ 19930 * @since 4.0.0 19931 * @category Lang 19932 * @param {*} value The value to check. 19933 * @returns {boolean} Returns `true` if `value` is array-like, else `false`. 19934 * @example 19935 * 19936 * _.isArrayLike([1, 2, 3]); 19937 * // => true 19938 * 19939 * _.isArrayLike(document.body.children); 19940 * // => true 19941 * 19942 * _.isArrayLike('abc'); 19943 * // => true 19944 * 19945 * _.isArrayLike(_.noop); 19946 * // => false 19947 */ 19948 function isArrayLike(value) { 19949 return value != null && isLength(value.length) && !isFunction(value); 19950 } 19951 19952 /** 19953 * This method is like `_.isArrayLike` except that it also checks if `value` 19954 * is an object. 19955 * 19956 * @static 19957 * @memberOf _ 19958 * @since 4.0.0 19959 * @category Lang 19960 * @param {*} value The value to check. 19961 * @returns {boolean} Returns `true` if `value` is an array-like object, 19962 * else `false`. 19963 * @example 19964 * 19965 * _.isArrayLikeObject([1, 2, 3]); 19966 * // => true 19967 * 19968 * _.isArrayLikeObject(document.body.children); 19969 * // => true 19970 * 19971 * _.isArrayLikeObject('abc'); 19972 * // => false 19973 * 19974 * _.isArrayLikeObject(_.noop); 19975 * // => false 19976 */ 19977 function isArrayLikeObject(value) { 19978 return isObjectLike(value) && isArrayLike(value); 19979 } 19980 19981 /** 19982 * Checks if `value` is classified as a boolean primitive or object. 19983 * 19984 * @static 19985 * @memberOf _ 19986 * @since 0.1.0 19987 * @category Lang 19988 * @param {*} value The value to check. 19989 * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. 19990 * @example 19991 * 19992 * _.isBoolean(false); 19993 * // => true 19994 * 19995 * _.isBoolean(null); 19996 * // => false 19997 */ 19998 function isBoolean(value) { 19999 return value === true || value === false || 20000 (isObjectLike(value) && baseGetTag(value) == boolTag); 20001 } 20002 20003 /** 20004 * Checks if `value` is a buffer. 20005 * 20006 * @static 20007 * @memberOf _ 20008 * @since 4.3.0 20009 * @category Lang 20010 * @param {*} value The value to check. 20011 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. 20012 * @example 20013 * 20014 * _.isBuffer(new Buffer(2)); 20015 * // => true 20016 * 20017 * _.isBuffer(new Uint8Array(2)); 20018 * // => false 20019 */ 20020 var isBuffer = nativeIsBuffer || stubFalse; 20021 20022 /** 20023 * Checks if `value` is classified as a `Date` object. 20024 * 20025 * @static 20026 * @memberOf _ 20027 * @since 0.1.0 20028 * @category Lang 20029 * @param {*} value The value to check. 20030 * @returns {boolean} Returns `true` if `value` is a date object, else `false`. 20031 * @example 20032 * 20033 * _.isDate(new Date); 20034 * // => true 20035 * 20036 * _.isDate('Mon April 23 2012'); 20037 * // => false 20038 */ 20039 var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; 20040 20041 /** 20042 * Checks if `value` is likely a DOM element. 20043 * 20044 * @static 20045 * @memberOf _ 20046 * @since 0.1.0 20047 * @category Lang 20048 * @param {*} value The value to check. 20049 * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. 20050 * @example 20051 * 20052 * _.isElement(document.body); 20053 * // => true 20054 * 20055 * _.isElement('<body>'); 20056 * // => false 20057 */ 20058 function isElement(value) { 20059 return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); 20060 } 20061 20062 /** 20063 * Checks if `value` is an empty object, collection, map, or set. 20064 * 20065 * Objects are considered empty if they have no own enumerable string keyed 20066 * properties. 20067 * 20068 * Array-like values such as `arguments` objects, arrays, buffers, strings, or 20069 * jQuery-like collections are considered empty if they have a `length` of `0`. 20070 * Similarly, maps and sets are considered empty if they have a `size` of `0`. 20071 * 20072 * @static 20073 * @memberOf _ 20074 * @since 0.1.0 20075 * @category Lang 20076 * @param {*} value The value to check. 20077 * @returns {boolean} Returns `true` if `value` is empty, else `false`. 20078 * @example 20079 * 20080 * _.isEmpty(null); 20081 * // => true 20082 * 20083 * _.isEmpty(true); 20084 * // => true 20085 * 20086 * _.isEmpty(1); 20087 * // => true 20088 * 20089 * _.isEmpty([1, 2, 3]); 20090 * // => false 20091 * 20092 * _.isEmpty({ 'a': 1 }); 20093 * // => false 20094 */ 20095 function isEmpty(value) { 20096 if (value == null) { 20097 return true; 20098 } 20099 if (isArrayLike(value) && 20100 (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || 20101 isBuffer(value) || isTypedArray(value) || isArguments(value))) { 20102 return !value.length; 20103 } 20104 var tag = getTag(value); 20105 if (tag == mapTag || tag == setTag) { 20106 return !value.size; 20107 } 20108 if (isPrototype(value)) { 20109 return !baseKeys(value).length; 20110 } 20111 for (var key in value) { 20112 if (hasOwnProperty.call(value, key)) { 20113 return false; 20114 } 20115 } 20116 return true; 20117 } 20118 20119 /** 20120 * Performs a deep comparison between two values to determine if they are 20121 * equivalent. 20122 * 20123 * **Note:** This method supports comparing arrays, array buffers, booleans, 20124 * date objects, error objects, maps, numbers, `Object` objects, regexes, 20125 * sets, strings, symbols, and typed arrays. `Object` objects are compared 20126 * by their own, not inherited, enumerable properties. Functions and DOM 20127 * nodes are compared by strict equality, i.e. `===`. 20128 * 20129 * @static 20130 * @memberOf _ 20131 * @since 0.1.0 20132 * @category Lang 20133 * @param {*} value The value to compare. 20134 * @param {*} other The other value to compare. 20135 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 20136 * @example 20137 * 20138 * var object = { 'a': 1 }; 20139 * var other = { 'a': 1 }; 20140 * 20141 * _.isEqual(object, other); 20142 * // => true 20143 * 20144 * object === other; 20145 * // => false 20146 */ 20147 function isEqual(value, other) { 20148 return baseIsEqual(value, other); 20149 } 20150 20151 /** 20152 * This method is like `_.isEqual` except that it accepts `customizer` which 20153 * is invoked to compare values. If `customizer` returns `undefined`, comparisons 20154 * are handled by the method instead. The `customizer` is invoked with up to 20155 * six arguments: (objValue, othValue [, index|key, object, other, stack]). 20156 * 20157 * @static 20158 * @memberOf _ 20159 * @since 4.0.0 20160 * @category Lang 20161 * @param {*} value The value to compare. 20162 * @param {*} other The other value to compare. 20163 * @param {Function} [customizer] The function to customize comparisons. 20164 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 20165 * @example 20166 * 20167 * function isGreeting(value) { 20168 * return /^h(?:i|ello)$/.test(value); 20169 * } 20170 * 20171 * function customizer(objValue, othValue) { 20172 * if (isGreeting(objValue) && isGreeting(othValue)) { 20173 * return true; 20174 * } 20175 * } 20176 * 20177 * var array = ['hello', 'goodbye']; 20178 * var other = ['hi', 'goodbye']; 20179 * 20180 * _.isEqualWith(array, other, customizer); 20181 * // => true 20182 */ 20183 function isEqualWith(value, other, customizer) { 20184 customizer = typeof customizer == 'function' ? customizer : undefined; 20185 var result = customizer ? customizer(value, other) : undefined; 20186 return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result; 20187 } 20188 20189 /** 20190 * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, 20191 * `SyntaxError`, `TypeError`, or `URIError` object. 20192 * 20193 * @static 20194 * @memberOf _ 20195 * @since 3.0.0 20196 * @category Lang 20197 * @param {*} value The value to check. 20198 * @returns {boolean} Returns `true` if `value` is an error object, else `false`. 20199 * @example 20200 * 20201 * _.isError(new Error); 20202 * // => true 20203 * 20204 * _.isError(Error); 20205 * // => false 20206 */ 20207 function isError(value) { 20208 if (!isObjectLike(value)) { 20209 return false; 20210 } 20211 var tag = baseGetTag(value); 20212 return tag == errorTag || tag == domExcTag || 20213 (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); 20214 } 20215 20216 /** 20217 * Checks if `value` is a finite primitive number. 20218 * 20219 * **Note:** This method is based on 20220 * [`Number.isFinite`](https://mdn.io/Number/isFinite). 20221 * 20222 * @static 20223 * @memberOf _ 20224 * @since 0.1.0 20225 * @category Lang 20226 * @param {*} value The value to check. 20227 * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. 20228 * @example 20229 * 20230 * _.isFinite(3); 20231 * // => true 20232 * 20233 * _.isFinite(Number.MIN_VALUE); 20234 * // => true 20235 * 20236 * _.isFinite(Infinity); 20237 * // => false 20238 * 20239 * _.isFinite('3'); 20240 * // => false 20241 */ 20242 function isFinite(value) { 20243 return typeof value == 'number' && nativeIsFinite(value); 20244 } 20245 20246 /** 20247 * Checks if `value` is classified as a `Function` object. 20248 * 20249 * @static 20250 * @memberOf _ 20251 * @since 0.1.0 20252 * @category Lang 20253 * @param {*} value The value to check. 20254 * @returns {boolean} Returns `true` if `value` is a function, else `false`. 20255 * @example 20256 * 20257 * _.isFunction(_); 20258 * // => true 20259 * 20260 * _.isFunction(/abc/); 20261 * // => false 20262 */ 20263 function isFunction(value) { 20264 if (!isObject(value)) { 20265 return false; 20266 } 20267 // The use of `Object#toString` avoids issues with the `typeof` operator 20268 // in Safari 9 which returns 'object' for typed arrays and other constructors. 20269 var tag = baseGetTag(value); 20270 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; 20271 } 20272 20273 /** 20274 * Checks if `value` is an integer. 20275 * 20276 * **Note:** This method is based on 20277 * [`Number.isInteger`](https://mdn.io/Number/isInteger). 20278 * 20279 * @static 20280 * @memberOf _ 20281 * @since 4.0.0 20282 * @category Lang 20283 * @param {*} value The value to check. 20284 * @returns {boolean} Returns `true` if `value` is an integer, else `false`. 20285 * @example 20286 * 20287 * _.isInteger(3); 20288 * // => true 20289 * 20290 * _.isInteger(Number.MIN_VALUE); 20291 * // => false 20292 * 20293 * _.isInteger(Infinity); 20294 * // => false 20295 * 20296 * _.isInteger('3'); 20297 * // => false 20298 */ 20299 function isInteger(value) { 20300 return typeof value == 'number' && value == toInteger(value); 20301 } 20302 20303 /** 20304 * Checks if `value` is a valid array-like length. 20305 * 20306 * **Note:** This method is loosely based on 20307 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). 20308 * 20309 * @static 20310 * @memberOf _ 20311 * @since 4.0.0 20312 * @category Lang 20313 * @param {*} value The value to check. 20314 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. 20315 * @example 20316 * 20317 * _.isLength(3); 20318 * // => true 20319 * 20320 * _.isLength(Number.MIN_VALUE); 20321 * // => false 20322 * 20323 * _.isLength(Infinity); 20324 * // => false 20325 * 20326 * _.isLength('3'); 20327 * // => false 20328 */ 20329 function isLength(value) { 20330 return typeof value == 'number' && 20331 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; 20332 } 20333 20334 /** 20335 * Checks if `value` is the 20336 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) 20337 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) 20338 * 20339 * @static 20340 * @memberOf _ 20341 * @since 0.1.0 20342 * @category Lang 20343 * @param {*} value The value to check. 20344 * @returns {boolean} Returns `true` if `value` is an object, else `false`. 20345 * @example 20346 * 20347 * _.isObject({}); 20348 * // => true 20349 * 20350 * _.isObject([1, 2, 3]); 20351 * // => true 20352 * 20353 * _.isObject(_.noop); 20354 * // => true 20355 * 20356 * _.isObject(null); 20357 * // => false 20358 */ 20359 function isObject(value) { 20360 var type = typeof value; 20361 return value != null && (type == 'object' || type == 'function'); 20362 } 20363 20364 /** 20365 * Checks if `value` is object-like. A value is object-like if it's not `null` 20366 * and has a `typeof` result of "object". 20367 * 20368 * @static 20369 * @memberOf _ 20370 * @since 4.0.0 20371 * @category Lang 20372 * @param {*} value The value to check. 20373 * @returns {boolean} Returns `true` if `value` is object-like, else `false`. 20374 * @example 20375 * 20376 * _.isObjectLike({}); 20377 * // => true 20378 * 20379 * _.isObjectLike([1, 2, 3]); 20380 * // => true 20381 * 20382 * _.isObjectLike(_.noop); 20383 * // => false 20384 * 20385 * _.isObjectLike(null); 20386 * // => false 20387 */ 20388 function isObjectLike(value) { 20389 return value != null && typeof value == 'object'; 20390 } 20391 20392 /** 20393 * Checks if `value` is classified as a `Map` object. 20394 * 20395 * @static 20396 * @memberOf _ 20397 * @since 4.3.0 20398 * @category Lang 20399 * @param {*} value The value to check. 20400 * @returns {boolean} Returns `true` if `value` is a map, else `false`. 20401 * @example 20402 * 20403 * _.isMap(new Map); 20404 * // => true 20405 * 20406 * _.isMap(new WeakMap); 20407 * // => false 20408 */ 20409 var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; 20410 20411 /** 20412 * Performs a partial deep comparison between `object` and `source` to 20413 * determine if `object` contains equivalent property values. 20414 * 20415 * **Note:** This method is equivalent to `_.matches` when `source` is 20416 * partially applied. 20417 * 20418 * Partial comparisons will match empty array and empty object `source` 20419 * values against any array or object value, respectively. See `_.isEqual` 20420 * for a list of supported value comparisons. 20421 * 20422 * @static 20423 * @memberOf _ 20424 * @since 3.0.0 20425 * @category Lang 20426 * @param {Object} object The object to inspect. 20427 * @param {Object} source The object of property values to match. 20428 * @returns {boolean} Returns `true` if `object` is a match, else `false`. 20429 * @example 20430 * 20431 * var object = { 'a': 1, 'b': 2 }; 20432 * 20433 * _.isMatch(object, { 'b': 2 }); 20434 * // => true 20435 * 20436 * _.isMatch(object, { 'b': 1 }); 20437 * // => false 20438 */ 20439 function isMatch(object, source) { 20440 return object === source || baseIsMatch(object, source, getMatchData(source)); 20441 } 20442 20443 /** 20444 * This method is like `_.isMatch` except that it accepts `customizer` which 20445 * is invoked to compare values. If `customizer` returns `undefined`, comparisons 20446 * are handled by the method instead. The `customizer` is invoked with five 20447 * arguments: (objValue, srcValue, index|key, object, source). 20448 * 20449 * @static 20450 * @memberOf _ 20451 * @since 4.0.0 20452 * @category Lang 20453 * @param {Object} object The object to inspect. 20454 * @param {Object} source The object of property values to match. 20455 * @param {Function} [customizer] The function to customize comparisons. 20456 * @returns {boolean} Returns `true` if `object` is a match, else `false`. 20457 * @example 20458 * 20459 * function isGreeting(value) { 20460 * return /^h(?:i|ello)$/.test(value); 20461 * } 20462 * 20463 * function customizer(objValue, srcValue) { 20464 * if (isGreeting(objValue) && isGreeting(srcValue)) { 20465 * return true; 20466 * } 20467 * } 20468 * 20469 * var object = { 'greeting': 'hello' }; 20470 * var source = { 'greeting': 'hi' }; 20471 * 20472 * _.isMatchWith(object, source, customizer); 20473 * // => true 20474 */ 20475 function isMatchWith(object, source, customizer) { 20476 customizer = typeof customizer == 'function' ? customizer : undefined; 20477 return baseIsMatch(object, source, getMatchData(source), customizer); 20478 } 20479 20480 /** 20481 * Checks if `value` is `NaN`. 20482 * 20483 * **Note:** This method is based on 20484 * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as 20485 * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for 20486 * `undefined` and other non-number values. 20487 * 20488 * @static 20489 * @memberOf _ 20490 * @since 0.1.0 20491 * @category Lang 20492 * @param {*} value The value to check. 20493 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. 20494 * @example 20495 * 20496 * _.isNaN(NaN); 20497 * // => true 20498 * 20499 * _.isNaN(new Number(NaN)); 20500 * // => true 20501 * 20502 * isNaN(undefined); 20503 * // => true 20504 * 20505 * _.isNaN(undefined); 20506 * // => false 20507 */ 20508 function isNaN(value) { 20509 // An `NaN` primitive is the only value that is not equal to itself. 20510 // Perform the `toStringTag` check first to avoid errors with some 20511 // ActiveX objects in IE. 20512 return isNumber(value) && value != +value; 20513 } 20514 20515 /** 20516 * Checks if `value` is a pristine native function. 20517 * 20518 * **Note:** This method can't reliably detect native functions in the presence 20519 * of the core-js package because core-js circumvents this kind of detection. 20520 * Despite multiple requests, the core-js maintainer has made it clear: any 20521 * attempt to fix the detection will be obstructed. As a result, we're left 20522 * with little choice but to throw an error. Unfortunately, this also affects 20523 * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), 20524 * which rely on core-js. 20525 * 20526 * @static 20527 * @memberOf _ 20528 * @since 3.0.0 20529 * @category Lang 20530 * @param {*} value The value to check. 20531 * @returns {boolean} Returns `true` if `value` is a native function, 20532 * else `false`. 20533 * @example 20534 * 20535 * _.isNative(Array.prototype.push); 20536 * // => true 20537 * 20538 * _.isNative(_); 20539 * // => false 20540 */ 20541 function isNative(value) { 20542 if (isMaskable(value)) { 20543 throw new Error(CORE_ERROR_TEXT); 20544 } 20545 return baseIsNative(value); 20546 } 20547 20548 /** 20549 * Checks if `value` is `null`. 20550 * 20551 * @static 20552 * @memberOf _ 20553 * @since 0.1.0 20554 * @category Lang 20555 * @param {*} value The value to check. 20556 * @returns {boolean} Returns `true` if `value` is `null`, else `false`. 20557 * @example 20558 * 20559 * _.isNull(null); 20560 * // => true 20561 * 20562 * _.isNull(void 0); 20563 * // => false 20564 */ 20565 function isNull(value) { 20566 return value === null; 20567 } 20568 20569 /** 20570 * Checks if `value` is `null` or `undefined`. 20571 * 20572 * @static 20573 * @memberOf _ 20574 * @since 4.0.0 20575 * @category Lang 20576 * @param {*} value The value to check. 20577 * @returns {boolean} Returns `true` if `value` is nullish, else `false`. 20578 * @example 20579 * 20580 * _.isNil(null); 20581 * // => true 20582 * 20583 * _.isNil(void 0); 20584 * // => true 20585 * 20586 * _.isNil(NaN); 20587 * // => false 20588 */ 20589 function isNil(value) { 20590 return value == null; 20591 } 20592 20593 /** 20594 * Checks if `value` is classified as a `Number` primitive or object. 20595 * 20596 * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are 20597 * classified as numbers, use the `_.isFinite` method. 20598 * 20599 * @static 20600 * @memberOf _ 20601 * @since 0.1.0 20602 * @category Lang 20603 * @param {*} value The value to check. 20604 * @returns {boolean} Returns `true` if `value` is a number, else `false`. 20605 * @example 20606 * 20607 * _.isNumber(3); 20608 * // => true 20609 * 20610 * _.isNumber(Number.MIN_VALUE); 20611 * // => true 20612 * 20613 * _.isNumber(Infinity); 20614 * // => true 20615 * 20616 * _.isNumber('3'); 20617 * // => false 20618 */ 20619 function isNumber(value) { 20620 return typeof value == 'number' || 20621 (isObjectLike(value) && baseGetTag(value) == numberTag); 20622 } 20623 20624 /** 20625 * Checks if `value` is a plain object, that is, an object created by the 20626 * `Object` constructor or one with a `[[Prototype]]` of `null`. 20627 * 20628 * @static 20629 * @memberOf _ 20630 * @since 0.8.0 20631 * @category Lang 20632 * @param {*} value The value to check. 20633 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. 20634 * @example 20635 * 20636 * function Foo() { 20637 * this.a = 1; 20638 * } 20639 * 20640 * _.isPlainObject(new Foo); 20641 * // => false 20642 * 20643 * _.isPlainObject([1, 2, 3]); 20644 * // => false 20645 * 20646 * _.isPlainObject({ 'x': 0, 'y': 0 }); 20647 * // => true 20648 * 20649 * _.isPlainObject(Object.create(null)); 20650 * // => true 20651 */ 20652 function isPlainObject(value) { 20653 if (!isObjectLike(value) || baseGetTag(value) != objectTag) { 20654 return false; 20655 } 20656 var proto = getPrototype(value); 20657 if (proto === null) { 20658 return true; 20659 } 20660 var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; 20661 return typeof Ctor == 'function' && Ctor instanceof Ctor && 20662 funcToString.call(Ctor) == objectCtorString; 20663 } 20664 20665 /** 20666 * Checks if `value` is classified as a `RegExp` object. 20667 * 20668 * @static 20669 * @memberOf _ 20670 * @since 0.1.0 20671 * @category Lang 20672 * @param {*} value The value to check. 20673 * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. 20674 * @example 20675 * 20676 * _.isRegExp(/abc/); 20677 * // => true 20678 * 20679 * _.isRegExp('/abc/'); 20680 * // => false 20681 */ 20682 var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; 20683 20684 /** 20685 * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 20686 * double precision number which isn't the result of a rounded unsafe integer. 20687 * 20688 * **Note:** This method is based on 20689 * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). 20690 * 20691 * @static 20692 * @memberOf _ 20693 * @since 4.0.0 20694 * @category Lang 20695 * @param {*} value The value to check. 20696 * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. 20697 * @example 20698 * 20699 * _.isSafeInteger(3); 20700 * // => true 20701 * 20702 * _.isSafeInteger(Number.MIN_VALUE); 20703 * // => false 20704 * 20705 * _.isSafeInteger(Infinity); 20706 * // => false 20707 * 20708 * _.isSafeInteger('3'); 20709 * // => false 20710 */ 20711 function isSafeInteger(value) { 20712 return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; 20713 } 20714 20715 /** 20716 * Checks if `value` is classified as a `Set` object. 20717 * 20718 * @static 20719 * @memberOf _ 20720 * @since 4.3.0 20721 * @category Lang 20722 * @param {*} value The value to check. 20723 * @returns {boolean} Returns `true` if `value` is a set, else `false`. 20724 * @example 20725 * 20726 * _.isSet(new Set); 20727 * // => true 20728 * 20729 * _.isSet(new WeakSet); 20730 * // => false 20731 */ 20732 var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; 20733 20734 /** 20735 * Checks if `value` is classified as a `String` primitive or object. 20736 * 20737 * @static 20738 * @since 0.1.0 20739 * @memberOf _ 20740 * @category Lang 20741 * @param {*} value The value to check. 20742 * @returns {boolean} Returns `true` if `value` is a string, else `false`. 20743 * @example 20744 * 20745 * _.isString('abc'); 20746 * // => true 20747 * 20748 * _.isString(1); 20749 * // => false 20750 */ 20751 function isString(value) { 20752 return typeof value == 'string' || 20753 (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); 20754 } 20755 20756 /** 20757 * Checks if `value` is classified as a `Symbol` primitive or object. 20758 * 20759 * @static 20760 * @memberOf _ 20761 * @since 4.0.0 20762 * @category Lang 20763 * @param {*} value The value to check. 20764 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. 20765 * @example 20766 * 20767 * _.isSymbol(Symbol.iterator); 20768 * // => true 20769 * 20770 * _.isSymbol('abc'); 20771 * // => false 20772 */ 20773 function isSymbol(value) { 20774 return typeof value == 'symbol' || 20775 (isObjectLike(value) && baseGetTag(value) == symbolTag); 20776 } 20777 20778 /** 20779 * Checks if `value` is classified as a typed array. 20780 * 20781 * @static 20782 * @memberOf _ 20783 * @since 3.0.0 20784 * @category Lang 20785 * @param {*} value The value to check. 20786 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. 20787 * @example 20788 * 20789 * _.isTypedArray(new Uint8Array); 20790 * // => true 20791 * 20792 * _.isTypedArray([]); 20793 * // => false 20794 */ 20795 var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; 20796 20797 /** 20798 * Checks if `value` is `undefined`. 20799 * 20800 * @static 20801 * @since 0.1.0 20802 * @memberOf _ 20803 * @category Lang 20804 * @param {*} value The value to check. 20805 * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. 20806 * @example 20807 * 20808 * _.isUndefined(void 0); 20809 * // => true 20810 * 20811 * _.isUndefined(null); 20812 * // => false 20813 */ 20814 function isUndefined(value) { 20815 return value === undefined; 20816 } 20817 20818 /** 20819 * Checks if `value` is classified as a `WeakMap` object. 20820 * 20821 * @static 20822 * @memberOf _ 20823 * @since 4.3.0 20824 * @category Lang 20825 * @param {*} value The value to check. 20826 * @returns {boolean} Returns `true` if `value` is a weak map, else `false`. 20827 * @example 20828 * 20829 * _.isWeakMap(new WeakMap); 20830 * // => true 20831 * 20832 * _.isWeakMap(new Map); 20833 * // => false 20834 */ 20835 function isWeakMap(value) { 20836 return isObjectLike(value) && getTag(value) == weakMapTag; 20837 } 20838 20839 /** 20840 * Checks if `value` is classified as a `WeakSet` object. 20841 * 20842 * @static 20843 * @memberOf _ 20844 * @since 4.3.0 20845 * @category Lang 20846 * @param {*} value The value to check. 20847 * @returns {boolean} Returns `true` if `value` is a weak set, else `false`. 20848 * @example 20849 * 20850 * _.isWeakSet(new WeakSet); 20851 * // => true 20852 * 20853 * _.isWeakSet(new Set); 20854 * // => false 20855 */ 20856 function isWeakSet(value) { 20857 return isObjectLike(value) && baseGetTag(value) == weakSetTag; 20858 } 20859 20860 /** 20861 * Checks if `value` is less than `other`. 20862 * 20863 * @static 20864 * @memberOf _ 20865 * @since 3.9.0 20866 * @category Lang 20867 * @param {*} value The value to compare. 20868 * @param {*} other The other value to compare. 20869 * @returns {boolean} Returns `true` if `value` is less than `other`, 20870 * else `false`. 20871 * @see _.gt 20872 * @example 20873 * 20874 * _.lt(1, 3); 20875 * // => true 20876 * 20877 * _.lt(3, 3); 20878 * // => false 20879 * 20880 * _.lt(3, 1); 20881 * // => false 20882 */ 20883 var lt = createRelationalOperation(baseLt); 20884 20885 /** 20886 * Checks if `value` is less than or equal to `other`. 20887 * 20888 * @static 20889 * @memberOf _ 20890 * @since 3.9.0 20891 * @category Lang 20892 * @param {*} value The value to compare. 20893 * @param {*} other The other value to compare. 20894 * @returns {boolean} Returns `true` if `value` is less than or equal to 20895 * `other`, else `false`. 20896 * @see _.gte 20897 * @example 20898 * 20899 * _.lte(1, 3); 20900 * // => true 20901 * 20902 * _.lte(3, 3); 20903 * // => true 20904 * 20905 * _.lte(3, 1); 20906 * // => false 20907 */ 20908 var lte = createRelationalOperation(function(value, other) { 20909 return value <= other; 20910 }); 20911 20912 /** 20913 * Converts `value` to an array. 20914 * 20915 * @static 20916 * @since 0.1.0 20917 * @memberOf _ 20918 * @category Lang 20919 * @param {*} value The value to convert. 20920 * @returns {Array} Returns the converted array. 20921 * @example 20922 * 20923 * _.toArray({ 'a': 1, 'b': 2 }); 20924 * // => [1, 2] 20925 * 20926 * _.toArray('abc'); 20927 * // => ['a', 'b', 'c'] 20928 * 20929 * _.toArray(1); 20930 * // => [] 20931 * 20932 * _.toArray(null); 20933 * // => [] 20934 */ 20935 function toArray(value) { 20936 if (!value) { 20937 return []; 20938 } 20939 if (isArrayLike(value)) { 20940 return isString(value) ? stringToArray(value) : copyArray(value); 20941 } 20942 if (symIterator && value[symIterator]) { 20943 return iteratorToArray(value[symIterator]()); 20944 } 20945 var tag = getTag(value), 20946 func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); 20947 20948 return func(value); 20949 } 20950 20951 /** 20952 * Converts `value` to a finite number. 20953 * 20954 * @static 20955 * @memberOf _ 20956 * @since 4.12.0 20957 * @category Lang 20958 * @param {*} value The value to convert. 20959 * @returns {number} Returns the converted number. 20960 * @example 20961 * 20962 * _.toFinite(3.2); 20963 * // => 3.2 20964 * 20965 * _.toFinite(Number.MIN_VALUE); 20966 * // => 5e-324 20967 * 20968 * _.toFinite(Infinity); 20969 * // => 1.7976931348623157e+308 20970 * 20971 * _.toFinite('3.2'); 20972 * // => 3.2 20973 */ 20974 function toFinite(value) { 20975 if (!value) { 20976 return value === 0 ? value : 0; 20977 } 20978 value = toNumber(value); 20979 if (value === INFINITY || value === -INFINITY) { 20980 var sign = (value < 0 ? -1 : 1); 20981 return sign * MAX_INTEGER; 20982 } 20983 return value === value ? value : 0; 20984 } 20985 20986 /** 20987 * Converts `value` to an integer. 20988 * 20989 * **Note:** This method is loosely based on 20990 * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). 20991 * 20992 * @static 20993 * @memberOf _ 20994 * @since 4.0.0 20995 * @category Lang 20996 * @param {*} value The value to convert. 20997 * @returns {number} Returns the converted integer. 20998 * @example 20999 * 21000 * _.toInteger(3.2); 21001 * // => 3 21002 * 21003 * _.toInteger(Number.MIN_VALUE); 21004 * // => 0 21005 * 21006 * _.toInteger(Infinity); 21007 * // => 1.7976931348623157e+308 21008 * 21009 * _.toInteger('3.2'); 21010 * // => 3 21011 */ 21012 function toInteger(value) { 21013 var result = toFinite(value), 21014 remainder = result % 1; 21015 21016 return result === result ? (remainder ? result - remainder : result) : 0; 21017 } 21018 21019 /** 21020 * Converts `value` to an integer suitable for use as the length of an 21021 * array-like object. 21022 * 21023 * **Note:** This method is based on 21024 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). 21025 * 21026 * @static 21027 * @memberOf _ 21028 * @since 4.0.0 21029 * @category Lang 21030 * @param {*} value The value to convert. 21031 * @returns {number} Returns the converted integer. 21032 * @example 21033 * 21034 * _.toLength(3.2); 21035 * // => 3 21036 * 21037 * _.toLength(Number.MIN_VALUE); 21038 * // => 0 21039 * 21040 * _.toLength(Infinity); 21041 * // => 4294967295 21042 * 21043 * _.toLength('3.2'); 21044 * // => 3 21045 */ 21046 function toLength(value) { 21047 return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; 21048 } 21049 21050 /** 21051 * Converts `value` to a number. 21052 * 21053 * @static 21054 * @memberOf _ 21055 * @since 4.0.0 21056 * @category Lang 21057 * @param {*} value The value to process. 21058 * @returns {number} Returns the number. 21059 * @example 21060 * 21061 * _.toNumber(3.2); 21062 * // => 3.2 21063 * 21064 * _.toNumber(Number.MIN_VALUE); 21065 * // => 5e-324 21066 * 21067 * _.toNumber(Infinity); 21068 * // => Infinity 21069 * 21070 * _.toNumber('3.2'); 21071 * // => 3.2 21072 */ 21073 function toNumber(value) { 21074 if (typeof value == 'number') { 21075 return value; 21076 } 21077 if (isSymbol(value)) { 21078 return NAN; 21079 } 21080 if (isObject(value)) { 21081 var other = typeof value.valueOf == 'function' ? value.valueOf() : value; 21082 value = isObject(other) ? (other + '') : other; 21083 } 21084 if (typeof value != 'string') { 21085 return value === 0 ? value : +value; 21086 } 21087 value = baseTrim(value); 21088 var isBinary = reIsBinary.test(value); 21089 return (isBinary || reIsOctal.test(value)) 21090 ? freeParseInt(value.slice(2), isBinary ? 2 : 8) 21091 : (reIsBadHex.test(value) ? NAN : +value); 21092 } 21093 21094 /** 21095 * Converts `value` to a plain object flattening inherited enumerable string 21096 * keyed properties of `value` to own properties of the plain object. 21097 * 21098 * @static 21099 * @memberOf _ 21100 * @since 3.0.0 21101 * @category Lang 21102 * @param {*} value The value to convert. 21103 * @returns {Object} Returns the converted plain object. 21104 * @example 21105 * 21106 * function Foo() { 21107 * this.b = 2; 21108 * } 21109 * 21110 * Foo.prototype.c = 3; 21111 * 21112 * _.assign({ 'a': 1 }, new Foo); 21113 * // => { 'a': 1, 'b': 2 } 21114 * 21115 * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); 21116 * // => { 'a': 1, 'b': 2, 'c': 3 } 21117 */ 21118 function toPlainObject(value) { 21119 return copyObject(value, keysIn(value)); 21120 } 21121 21122 /** 21123 * Converts `value` to a safe integer. A safe integer can be compared and 21124 * represented correctly. 21125 * 21126 * @static 21127 * @memberOf _ 21128 * @since 4.0.0 21129 * @category Lang 21130 * @param {*} value The value to convert. 21131 * @returns {number} Returns the converted integer. 21132 * @example 21133 * 21134 * _.toSafeInteger(3.2); 21135 * // => 3 21136 * 21137 * _.toSafeInteger(Number.MIN_VALUE); 21138 * // => 0 21139 * 21140 * _.toSafeInteger(Infinity); 21141 * // => 9007199254740991 21142 * 21143 * _.toSafeInteger('3.2'); 21144 * // => 3 21145 */ 21146 function toSafeInteger(value) { 21147 return value 21148 ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) 21149 : (value === 0 ? value : 0); 21150 } 21151 21152 /** 21153 * Converts `value` to a string. An empty string is returned for `null` 21154 * and `undefined` values. The sign of `-0` is preserved. 21155 * 21156 * @static 21157 * @memberOf _ 21158 * @since 4.0.0 21159 * @category Lang 21160 * @param {*} value The value to convert. 21161 * @returns {string} Returns the converted string. 21162 * @example 21163 * 21164 * _.toString(null); 21165 * // => '' 21166 * 21167 * _.toString(-0); 21168 * // => '-0' 21169 * 21170 * _.toString([1, 2, 3]); 21171 * // => '1,2,3' 21172 */ 21173 function toString(value) { 21174 return value == null ? '' : baseToString(value); 21175 } 21176 21177 /*------------------------------------------------------------------------*/ 21178 21179 /** 21180 * Assigns own enumerable string keyed properties of source objects to the 21181 * destination object. Source objects are applied from left to right. 21182 * Subsequent sources overwrite property assignments of previous sources. 21183 * 21184 * **Note:** This method mutates `object` and is loosely based on 21185 * [`Object.assign`](https://mdn.io/Object/assign). 21186 * 21187 * @static 21188 * @memberOf _ 21189 * @since 0.10.0 21190 * @category Object 21191 * @param {Object} object The destination object. 21192 * @param {...Object} [sources] The source objects. 21193 * @returns {Object} Returns `object`. 21194 * @see _.assignIn 21195 * @example 21196 * 21197 * function Foo() { 21198 * this.a = 1; 21199 * } 21200 * 21201 * function Bar() { 21202 * this.c = 3; 21203 * } 21204 * 21205 * Foo.prototype.b = 2; 21206 * Bar.prototype.d = 4; 21207 * 21208 * _.assign({ 'a': 0 }, new Foo, new Bar); 21209 * // => { 'a': 1, 'c': 3 } 21210 */ 21211 var assign = createAssigner(function(object, source) { 21212 if (isPrototype(source) || isArrayLike(source)) { 21213 copyObject(source, keys(source), object); 21214 return; 21215 } 21216 for (var key in source) { 21217 if (hasOwnProperty.call(source, key)) { 21218 assignValue(object, key, source[key]); 21219 } 21220 } 21221 }); 21222 21223 /** 21224 * This method is like `_.assign` except that it iterates over own and 21225 * inherited source properties. 21226 * 21227 * **Note:** This method mutates `object`. 21228 * 21229 * @static 21230 * @memberOf _ 21231 * @since 4.0.0 21232 * @alias extend 21233 * @category Object 21234 * @param {Object} object The destination object. 21235 * @param {...Object} [sources] The source objects. 21236 * @returns {Object} Returns `object`. 21237 * @see _.assign 21238 * @example 21239 * 21240 * function Foo() { 21241 * this.a = 1; 21242 * } 21243 * 21244 * function Bar() { 21245 * this.c = 3; 21246 * } 21247 * 21248 * Foo.prototype.b = 2; 21249 * Bar.prototype.d = 4; 21250 * 21251 * _.assignIn({ 'a': 0 }, new Foo, new Bar); 21252 * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } 21253 */ 21254 var assignIn = createAssigner(function(object, source) { 21255 copyObject(source, keysIn(source), object); 21256 }); 21257 21258 /** 21259 * This method is like `_.assignIn` except that it accepts `customizer` 21260 * which is invoked to produce the assigned values. If `customizer` returns 21261 * `undefined`, assignment is handled by the method instead. The `customizer` 21262 * is invoked with five arguments: (objValue, srcValue, key, object, source). 21263 * 21264 * **Note:** This method mutates `object`. 21265 * 21266 * @static 21267 * @memberOf _ 21268 * @since 4.0.0 21269 * @alias extendWith 21270 * @category Object 21271 * @param {Object} object The destination object. 21272 * @param {...Object} sources The source objects. 21273 * @param {Function} [customizer] The function to customize assigned values. 21274 * @returns {Object} Returns `object`. 21275 * @see _.assignWith 21276 * @example 21277 * 21278 * function customizer(objValue, srcValue) { 21279 * return _.isUndefined(objValue) ? srcValue : objValue; 21280 * } 21281 * 21282 * var defaults = _.partialRight(_.assignInWith, customizer); 21283 * 21284 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 21285 * // => { 'a': 1, 'b': 2 } 21286 */ 21287 var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { 21288 copyObject(source, keysIn(source), object, customizer); 21289 }); 21290 21291 /** 21292 * This method is like `_.assign` except that it accepts `customizer` 21293 * which is invoked to produce the assigned values. If `customizer` returns 21294 * `undefined`, assignment is handled by the method instead. The `customizer` 21295 * is invoked with five arguments: (objValue, srcValue, key, object, source). 21296 * 21297 * **Note:** This method mutates `object`. 21298 * 21299 * @static 21300 * @memberOf _ 21301 * @since 4.0.0 21302 * @category Object 21303 * @param {Object} object The destination object. 21304 * @param {...Object} sources The source objects. 21305 * @param {Function} [customizer] The function to customize assigned values. 21306 * @returns {Object} Returns `object`. 21307 * @see _.assignInWith 21308 * @example 21309 * 21310 * function customizer(objValue, srcValue) { 21311 * return _.isUndefined(objValue) ? srcValue : objValue; 21312 * } 21313 * 21314 * var defaults = _.partialRight(_.assignWith, customizer); 21315 * 21316 * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 21317 * // => { 'a': 1, 'b': 2 } 21318 */ 21319 var assignWith = createAssigner(function(object, source, srcIndex, customizer) { 21320 copyObject(source, keys(source), object, customizer); 21321 }); 21322 21323 /** 21324 * Creates an array of values corresponding to `paths` of `object`. 21325 * 21326 * @static 21327 * @memberOf _ 21328 * @since 1.0.0 21329 * @category Object 21330 * @param {Object} object The object to iterate over. 21331 * @param {...(string|string[])} [paths] The property paths to pick. 21332 * @returns {Array} Returns the picked values. 21333 * @example 21334 * 21335 * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; 21336 * 21337 * _.at(object, ['a[0].b.c', 'a[1]']); 21338 * // => [3, 4] 21339 */ 21340 var at = flatRest(baseAt); 21341 21342 /** 21343 * Creates an object that inherits from the `prototype` object. If a 21344 * `properties` object is given, its own enumerable string keyed properties 21345 * are assigned to the created object. 21346 * 21347 * @static 21348 * @memberOf _ 21349 * @since 2.3.0 21350 * @category Object 21351 * @param {Object} prototype The object to inherit from. 21352 * @param {Object} [properties] The properties to assign to the object. 21353 * @returns {Object} Returns the new object. 21354 * @example 21355 * 21356 * function Shape() { 21357 * this.x = 0; 21358 * this.y = 0; 21359 * } 21360 * 21361 * function Circle() { 21362 * Shape.call(this); 21363 * } 21364 * 21365 * Circle.prototype = _.create(Shape.prototype, { 21366 * 'constructor': Circle 21367 * }); 21368 * 21369 * var circle = new Circle; 21370 * circle instanceof Circle; 21371 * // => true 21372 * 21373 * circle instanceof Shape; 21374 * // => true 21375 */ 21376 function create(prototype, properties) { 21377 var result = baseCreate(prototype); 21378 return properties == null ? result : baseAssign(result, properties); 21379 } 21380 21381 /** 21382 * Assigns own and inherited enumerable string keyed properties of source 21383 * objects to the destination object for all destination properties that 21384 * resolve to `undefined`. Source objects are applied from left to right. 21385 * Once a property is set, additional values of the same property are ignored. 21386 * 21387 * **Note:** This method mutates `object`. 21388 * 21389 * @static 21390 * @since 0.1.0 21391 * @memberOf _ 21392 * @category Object 21393 * @param {Object} object The destination object. 21394 * @param {...Object} [sources] The source objects. 21395 * @returns {Object} Returns `object`. 21396 * @see _.defaultsDeep 21397 * @example 21398 * 21399 * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); 21400 * // => { 'a': 1, 'b': 2 } 21401 */ 21402 var defaults = baseRest(function(object, sources) { 21403 object = Object(object); 21404 21405 var index = -1; 21406 var length = sources.length; 21407 var guard = length > 2 ? sources[2] : undefined; 21408 21409 if (guard && isIterateeCall(sources[0], sources[1], guard)) { 21410 length = 1; 21411 } 21412 21413 while (++index < length) { 21414 var source = sources[index]; 21415 var props = keysIn(source); 21416 var propsIndex = -1; 21417 var propsLength = props.length; 21418 21419 while (++propsIndex < propsLength) { 21420 var key = props[propsIndex]; 21421 var value = object[key]; 21422 21423 if (value === undefined || 21424 (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { 21425 object[key] = source[key]; 21426 } 21427 } 21428 } 21429 21430 return object; 21431 }); 21432 21433 /** 21434 * This method is like `_.defaults` except that it recursively assigns 21435 * default properties. 21436 * 21437 * **Note:** This method mutates `object`. 21438 * 21439 * @static 21440 * @memberOf _ 21441 * @since 3.10.0 21442 * @category Object 21443 * @param {Object} object The destination object. 21444 * @param {...Object} [sources] The source objects. 21445 * @returns {Object} Returns `object`. 21446 * @see _.defaults 21447 * @example 21448 * 21449 * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); 21450 * // => { 'a': { 'b': 2, 'c': 3 } } 21451 */ 21452 var defaultsDeep = baseRest(function(args) { 21453 args.push(undefined, customDefaultsMerge); 21454 return apply(mergeWith, undefined, args); 21455 }); 21456 21457 /** 21458 * This method is like `_.find` except that it returns the key of the first 21459 * element `predicate` returns truthy for instead of the element itself. 21460 * 21461 * @static 21462 * @memberOf _ 21463 * @since 1.1.0 21464 * @category Object 21465 * @param {Object} object The object to inspect. 21466 * @param {Function} [predicate=_.identity] The function invoked per iteration. 21467 * @returns {string|undefined} Returns the key of the matched element, 21468 * else `undefined`. 21469 * @example 21470 * 21471 * var users = { 21472 * 'barney': { 'age': 36, 'active': true }, 21473 * 'fred': { 'age': 40, 'active': false }, 21474 * 'pebbles': { 'age': 1, 'active': true } 21475 * }; 21476 * 21477 * _.findKey(users, function(o) { return o.age < 40; }); 21478 * // => 'barney' (iteration order is not guaranteed) 21479 * 21480 * // The `_.matches` iteratee shorthand. 21481 * _.findKey(users, { 'age': 1, 'active': true }); 21482 * // => 'pebbles' 21483 * 21484 * // The `_.matchesProperty` iteratee shorthand. 21485 * _.findKey(users, ['active', false]); 21486 * // => 'fred' 21487 * 21488 * // The `_.property` iteratee shorthand. 21489 * _.findKey(users, 'active'); 21490 * // => 'barney' 21491 */ 21492 function findKey(object, predicate) { 21493 return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); 21494 } 21495 21496 /** 21497 * This method is like `_.findKey` except that it iterates over elements of 21498 * a collection in the opposite order. 21499 * 21500 * @static 21501 * @memberOf _ 21502 * @since 2.0.0 21503 * @category Object 21504 * @param {Object} object The object to inspect. 21505 * @param {Function} [predicate=_.identity] The function invoked per iteration. 21506 * @returns {string|undefined} Returns the key of the matched element, 21507 * else `undefined`. 21508 * @example 21509 * 21510 * var users = { 21511 * 'barney': { 'age': 36, 'active': true }, 21512 * 'fred': { 'age': 40, 'active': false }, 21513 * 'pebbles': { 'age': 1, 'active': true } 21514 * }; 21515 * 21516 * _.findLastKey(users, function(o) { return o.age < 40; }); 21517 * // => returns 'pebbles' assuming `_.findKey` returns 'barney' 21518 * 21519 * // The `_.matches` iteratee shorthand. 21520 * _.findLastKey(users, { 'age': 36, 'active': true }); 21521 * // => 'barney' 21522 * 21523 * // The `_.matchesProperty` iteratee shorthand. 21524 * _.findLastKey(users, ['active', false]); 21525 * // => 'fred' 21526 * 21527 * // The `_.property` iteratee shorthand. 21528 * _.findLastKey(users, 'active'); 21529 * // => 'pebbles' 21530 */ 21531 function findLastKey(object, predicate) { 21532 return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); 21533 } 21534 21535 /** 21536 * Iterates over own and inherited enumerable string keyed properties of an 21537 * object and invokes `iteratee` for each property. The iteratee is invoked 21538 * with three arguments: (value, key, object). Iteratee functions may exit 21539 * iteration early by explicitly returning `false`. 21540 * 21541 * @static 21542 * @memberOf _ 21543 * @since 0.3.0 21544 * @category Object 21545 * @param {Object} object The object to iterate over. 21546 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 21547 * @returns {Object} Returns `object`. 21548 * @see _.forInRight 21549 * @example 21550 * 21551 * function Foo() { 21552 * this.a = 1; 21553 * this.b = 2; 21554 * } 21555 * 21556 * Foo.prototype.c = 3; 21557 * 21558 * _.forIn(new Foo, function(value, key) { 21559 * console.log(key); 21560 * }); 21561 * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). 21562 */ 21563 function forIn(object, iteratee) { 21564 return object == null 21565 ? object 21566 : baseFor(object, getIteratee(iteratee, 3), keysIn); 21567 } 21568 21569 /** 21570 * This method is like `_.forIn` except that it iterates over properties of 21571 * `object` in the opposite order. 21572 * 21573 * @static 21574 * @memberOf _ 21575 * @since 2.0.0 21576 * @category Object 21577 * @param {Object} object The object to iterate over. 21578 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 21579 * @returns {Object} Returns `object`. 21580 * @see _.forIn 21581 * @example 21582 * 21583 * function Foo() { 21584 * this.a = 1; 21585 * this.b = 2; 21586 * } 21587 * 21588 * Foo.prototype.c = 3; 21589 * 21590 * _.forInRight(new Foo, function(value, key) { 21591 * console.log(key); 21592 * }); 21593 * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. 21594 */ 21595 function forInRight(object, iteratee) { 21596 return object == null 21597 ? object 21598 : baseForRight(object, getIteratee(iteratee, 3), keysIn); 21599 } 21600 21601 /** 21602 * Iterates over own enumerable string keyed properties of an object and 21603 * invokes `iteratee` for each property. The iteratee is invoked with three 21604 * arguments: (value, key, object). Iteratee functions may exit iteration 21605 * early by explicitly returning `false`. 21606 * 21607 * @static 21608 * @memberOf _ 21609 * @since 0.3.0 21610 * @category Object 21611 * @param {Object} object The object to iterate over. 21612 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 21613 * @returns {Object} Returns `object`. 21614 * @see _.forOwnRight 21615 * @example 21616 * 21617 * function Foo() { 21618 * this.a = 1; 21619 * this.b = 2; 21620 * } 21621 * 21622 * Foo.prototype.c = 3; 21623 * 21624 * _.forOwn(new Foo, function(value, key) { 21625 * console.log(key); 21626 * }); 21627 * // => Logs 'a' then 'b' (iteration order is not guaranteed). 21628 */ 21629 function forOwn(object, iteratee) { 21630 return object && baseForOwn(object, getIteratee(iteratee, 3)); 21631 } 21632 21633 /** 21634 * This method is like `_.forOwn` except that it iterates over properties of 21635 * `object` in the opposite order. 21636 * 21637 * @static 21638 * @memberOf _ 21639 * @since 2.0.0 21640 * @category Object 21641 * @param {Object} object The object to iterate over. 21642 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 21643 * @returns {Object} Returns `object`. 21644 * @see _.forOwn 21645 * @example 21646 * 21647 * function Foo() { 21648 * this.a = 1; 21649 * this.b = 2; 21650 * } 21651 * 21652 * Foo.prototype.c = 3; 21653 * 21654 * _.forOwnRight(new Foo, function(value, key) { 21655 * console.log(key); 21656 * }); 21657 * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. 21658 */ 21659 function forOwnRight(object, iteratee) { 21660 return object && baseForOwnRight(object, getIteratee(iteratee, 3)); 21661 } 21662 21663 /** 21664 * Creates an array of function property names from own enumerable properties 21665 * of `object`. 21666 * 21667 * @static 21668 * @since 0.1.0 21669 * @memberOf _ 21670 * @category Object 21671 * @param {Object} object The object to inspect. 21672 * @returns {Array} Returns the function names. 21673 * @see _.functionsIn 21674 * @example 21675 * 21676 * function Foo() { 21677 * this.a = _.constant('a'); 21678 * this.b = _.constant('b'); 21679 * } 21680 * 21681 * Foo.prototype.c = _.constant('c'); 21682 * 21683 * _.functions(new Foo); 21684 * // => ['a', 'b'] 21685 */ 21686 function functions(object) { 21687 return object == null ? [] : baseFunctions(object, keys(object)); 21688 } 21689 21690 /** 21691 * Creates an array of function property names from own and inherited 21692 * enumerable properties of `object`. 21693 * 21694 * @static 21695 * @memberOf _ 21696 * @since 4.0.0 21697 * @category Object 21698 * @param {Object} object The object to inspect. 21699 * @returns {Array} Returns the function names. 21700 * @see _.functions 21701 * @example 21702 * 21703 * function Foo() { 21704 * this.a = _.constant('a'); 21705 * this.b = _.constant('b'); 21706 * } 21707 * 21708 * Foo.prototype.c = _.constant('c'); 21709 * 21710 * _.functionsIn(new Foo); 21711 * // => ['a', 'b', 'c'] 21712 */ 21713 function functionsIn(object) { 21714 return object == null ? [] : baseFunctions(object, keysIn(object)); 21715 } 21716 21717 /** 21718 * Gets the value at `path` of `object`. If the resolved value is 21719 * `undefined`, the `defaultValue` is returned in its place. 21720 * 21721 * @static 21722 * @memberOf _ 21723 * @since 3.7.0 21724 * @category Object 21725 * @param {Object} object The object to query. 21726 * @param {Array|string} path The path of the property to get. 21727 * @param {*} [defaultValue] The value returned for `undefined` resolved values. 21728 * @returns {*} Returns the resolved value. 21729 * @example 21730 * 21731 * var object = { 'a': [{ 'b': { 'c': 3 } }] }; 21732 * 21733 * _.get(object, 'a[0].b.c'); 21734 * // => 3 21735 * 21736 * _.get(object, ['a', '0', 'b', 'c']); 21737 * // => 3 21738 * 21739 * _.get(object, 'a.b.c', 'default'); 21740 * // => 'default' 21741 */ 21742 function get(object, path, defaultValue) { 21743 var result = object == null ? undefined : baseGet(object, path); 21744 return result === undefined ? defaultValue : result; 21745 } 21746 21747 /** 21748 * Checks if `path` is a direct property of `object`. 21749 * 21750 * @static 21751 * @since 0.1.0 21752 * @memberOf _ 21753 * @category Object 21754 * @param {Object} object The object to query. 21755 * @param {Array|string} path The path to check. 21756 * @returns {boolean} Returns `true` if `path` exists, else `false`. 21757 * @example 21758 * 21759 * var object = { 'a': { 'b': 2 } }; 21760 * var other = _.create({ 'a': _.create({ 'b': 2 }) }); 21761 * 21762 * _.has(object, 'a'); 21763 * // => true 21764 * 21765 * _.has(object, 'a.b'); 21766 * // => true 21767 * 21768 * _.has(object, ['a', 'b']); 21769 * // => true 21770 * 21771 * _.has(other, 'a'); 21772 * // => false 21773 */ 21774 function has(object, path) { 21775 return object != null && hasPath(object, path, baseHas); 21776 } 21777 21778 /** 21779 * Checks if `path` is a direct or inherited property of `object`. 21780 * 21781 * @static 21782 * @memberOf _ 21783 * @since 4.0.0 21784 * @category Object 21785 * @param {Object} object The object to query. 21786 * @param {Array|string} path The path to check. 21787 * @returns {boolean} Returns `true` if `path` exists, else `false`. 21788 * @example 21789 * 21790 * var object = _.create({ 'a': _.create({ 'b': 2 }) }); 21791 * 21792 * _.hasIn(object, 'a'); 21793 * // => true 21794 * 21795 * _.hasIn(object, 'a.b'); 21796 * // => true 21797 * 21798 * _.hasIn(object, ['a', 'b']); 21799 * // => true 21800 * 21801 * _.hasIn(object, 'b'); 21802 * // => false 21803 */ 21804 function hasIn(object, path) { 21805 return object != null && hasPath(object, path, baseHasIn); 21806 } 21807 21808 /** 21809 * Creates an object composed of the inverted keys and values of `object`. 21810 * If `object` contains duplicate values, subsequent values overwrite 21811 * property assignments of previous values. 21812 * 21813 * @static 21814 * @memberOf _ 21815 * @since 0.7.0 21816 * @category Object 21817 * @param {Object} object The object to invert. 21818 * @returns {Object} Returns the new inverted object. 21819 * @example 21820 * 21821 * var object = { 'a': 1, 'b': 2, 'c': 1 }; 21822 * 21823 * _.invert(object); 21824 * // => { '1': 'c', '2': 'b' } 21825 */ 21826 var invert = createInverter(function(result, value, key) { 21827 if (value != null && 21828 typeof value.toString != 'function') { 21829 value = nativeObjectToString.call(value); 21830 } 21831 21832 result[value] = key; 21833 }, constant(identity)); 21834 21835 /** 21836 * This method is like `_.invert` except that the inverted object is generated 21837 * from the results of running each element of `object` thru `iteratee`. The 21838 * corresponding inverted value of each inverted key is an array of keys 21839 * responsible for generating the inverted value. The iteratee is invoked 21840 * with one argument: (value). 21841 * 21842 * @static 21843 * @memberOf _ 21844 * @since 4.1.0 21845 * @category Object 21846 * @param {Object} object The object to invert. 21847 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 21848 * @returns {Object} Returns the new inverted object. 21849 * @example 21850 * 21851 * var object = { 'a': 1, 'b': 2, 'c': 1 }; 21852 * 21853 * _.invertBy(object); 21854 * // => { '1': ['a', 'c'], '2': ['b'] } 21855 * 21856 * _.invertBy(object, function(value) { 21857 * return 'group' + value; 21858 * }); 21859 * // => { 'group1': ['a', 'c'], 'group2': ['b'] } 21860 */ 21861 var invertBy = createInverter(function(result, value, key) { 21862 if (value != null && 21863 typeof value.toString != 'function') { 21864 value = nativeObjectToString.call(value); 21865 } 21866 21867 if (hasOwnProperty.call(result, value)) { 21868 result[value].push(key); 21869 } else { 21870 result[value] = [key]; 21871 } 21872 }, getIteratee); 21873 21874 /** 21875 * Invokes the method at `path` of `object`. 21876 * 21877 * @static 21878 * @memberOf _ 21879 * @since 4.0.0 21880 * @category Object 21881 * @param {Object} object The object to query. 21882 * @param {Array|string} path The path of the method to invoke. 21883 * @param {...*} [args] The arguments to invoke the method with. 21884 * @returns {*} Returns the result of the invoked method. 21885 * @example 21886 * 21887 * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; 21888 * 21889 * _.invoke(object, 'a[0].b.c.slice', 1, 3); 21890 * // => [2, 3] 21891 */ 21892 var invoke = baseRest(baseInvoke); 21893 21894 /** 21895 * Creates an array of the own enumerable property names of `object`. 21896 * 21897 * **Note:** Non-object values are coerced to objects. See the 21898 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) 21899 * for more details. 21900 * 21901 * @static 21902 * @since 0.1.0 21903 * @memberOf _ 21904 * @category Object 21905 * @param {Object} object The object to query. 21906 * @returns {Array} Returns the array of property names. 21907 * @example 21908 * 21909 * function Foo() { 21910 * this.a = 1; 21911 * this.b = 2; 21912 * } 21913 * 21914 * Foo.prototype.c = 3; 21915 * 21916 * _.keys(new Foo); 21917 * // => ['a', 'b'] (iteration order is not guaranteed) 21918 * 21919 * _.keys('hi'); 21920 * // => ['0', '1'] 21921 */ 21922 function keys(object) { 21923 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); 21924 } 21925 21926 /** 21927 * Creates an array of the own and inherited enumerable property names of `object`. 21928 * 21929 * **Note:** Non-object values are coerced to objects. 21930 * 21931 * @static 21932 * @memberOf _ 21933 * @since 3.0.0 21934 * @category Object 21935 * @param {Object} object The object to query. 21936 * @returns {Array} Returns the array of property names. 21937 * @example 21938 * 21939 * function Foo() { 21940 * this.a = 1; 21941 * this.b = 2; 21942 * } 21943 * 21944 * Foo.prototype.c = 3; 21945 * 21946 * _.keysIn(new Foo); 21947 * // => ['a', 'b', 'c'] (iteration order is not guaranteed) 21948 */ 21949 function keysIn(object) { 21950 return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); 21951 } 21952 21953 /** 21954 * The opposite of `_.mapValues`; this method creates an object with the 21955 * same values as `object` and keys generated by running each own enumerable 21956 * string keyed property of `object` thru `iteratee`. The iteratee is invoked 21957 * with three arguments: (value, key, object). 21958 * 21959 * @static 21960 * @memberOf _ 21961 * @since 3.8.0 21962 * @category Object 21963 * @param {Object} object The object to iterate over. 21964 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 21965 * @returns {Object} Returns the new mapped object. 21966 * @see _.mapValues 21967 * @example 21968 * 21969 * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { 21970 * return key + value; 21971 * }); 21972 * // => { 'a1': 1, 'b2': 2 } 21973 */ 21974 function mapKeys(object, iteratee) { 21975 var result = {}; 21976 iteratee = getIteratee(iteratee, 3); 21977 21978 baseForOwn(object, function(value, key, object) { 21979 baseAssignValue(result, iteratee(value, key, object), value); 21980 }); 21981 return result; 21982 } 21983 21984 /** 21985 * Creates an object with the same keys as `object` and values generated 21986 * by running each own enumerable string keyed property of `object` thru 21987 * `iteratee`. The iteratee is invoked with three arguments: 21988 * (value, key, object). 21989 * 21990 * @static 21991 * @memberOf _ 21992 * @since 2.4.0 21993 * @category Object 21994 * @param {Object} object The object to iterate over. 21995 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 21996 * @returns {Object} Returns the new mapped object. 21997 * @see _.mapKeys 21998 * @example 21999 * 22000 * var users = { 22001 * 'fred': { 'user': 'fred', 'age': 40 }, 22002 * 'pebbles': { 'user': 'pebbles', 'age': 1 } 22003 * }; 22004 * 22005 * _.mapValues(users, function(o) { return o.age; }); 22006 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) 22007 * 22008 * // The `_.property` iteratee shorthand. 22009 * _.mapValues(users, 'age'); 22010 * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) 22011 */ 22012 function mapValues(object, iteratee) { 22013 var result = {}; 22014 iteratee = getIteratee(iteratee, 3); 22015 22016 baseForOwn(object, function(value, key, object) { 22017 baseAssignValue(result, key, iteratee(value, key, object)); 22018 }); 22019 return result; 22020 } 22021 22022 /** 22023 * This method is like `_.assign` except that it recursively merges own and 22024 * inherited enumerable string keyed properties of source objects into the 22025 * destination object. Source properties that resolve to `undefined` are 22026 * skipped if a destination value exists. Array and plain object properties 22027 * are merged recursively. Other objects and value types are overridden by 22028 * assignment. Source objects are applied from left to right. Subsequent 22029 * sources overwrite property assignments of previous sources. 22030 * 22031 * **Note:** This method mutates `object`. 22032 * 22033 * @static 22034 * @memberOf _ 22035 * @since 0.5.0 22036 * @category Object 22037 * @param {Object} object The destination object. 22038 * @param {...Object} [sources] The source objects. 22039 * @returns {Object} Returns `object`. 22040 * @example 22041 * 22042 * var object = { 22043 * 'a': [{ 'b': 2 }, { 'd': 4 }] 22044 * }; 22045 * 22046 * var other = { 22047 * 'a': [{ 'c': 3 }, { 'e': 5 }] 22048 * }; 22049 * 22050 * _.merge(object, other); 22051 * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } 22052 */ 22053 var merge = createAssigner(function(object, source, srcIndex) { 22054 baseMerge(object, source, srcIndex); 22055 }); 22056 22057 /** 22058 * This method is like `_.merge` except that it accepts `customizer` which 22059 * is invoked to produce the merged values of the destination and source 22060 * properties. If `customizer` returns `undefined`, merging is handled by the 22061 * method instead. The `customizer` is invoked with six arguments: 22062 * (objValue, srcValue, key, object, source, stack). 22063 * 22064 * **Note:** This method mutates `object`. 22065 * 22066 * @static 22067 * @memberOf _ 22068 * @since 4.0.0 22069 * @category Object 22070 * @param {Object} object The destination object. 22071 * @param {...Object} sources The source objects. 22072 * @param {Function} customizer The function to customize assigned values. 22073 * @returns {Object} Returns `object`. 22074 * @example 22075 * 22076 * function customizer(objValue, srcValue) { 22077 * if (_.isArray(objValue)) { 22078 * return objValue.concat(srcValue); 22079 * } 22080 * } 22081 * 22082 * var object = { 'a': [1], 'b': [2] }; 22083 * var other = { 'a': [3], 'b': [4] }; 22084 * 22085 * _.mergeWith(object, other, customizer); 22086 * // => { 'a': [1, 3], 'b': [2, 4] } 22087 */ 22088 var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { 22089 baseMerge(object, source, srcIndex, customizer); 22090 }); 22091 22092 /** 22093 * The opposite of `_.pick`; this method creates an object composed of the 22094 * own and inherited enumerable property paths of `object` that are not omitted. 22095 * 22096 * **Note:** This method is considerably slower than `_.pick`. 22097 * 22098 * @static 22099 * @since 0.1.0 22100 * @memberOf _ 22101 * @category Object 22102 * @param {Object} object The source object. 22103 * @param {...(string|string[])} [paths] The property paths to omit. 22104 * @returns {Object} Returns the new object. 22105 * @example 22106 * 22107 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 22108 * 22109 * _.omit(object, ['a', 'c']); 22110 * // => { 'b': '2' } 22111 */ 22112 var omit = flatRest(function(object, paths) { 22113 var result = {}; 22114 if (object == null) { 22115 return result; 22116 } 22117 var isDeep = false; 22118 paths = arrayMap(paths, function(path) { 22119 path = castPath(path, object); 22120 isDeep || (isDeep = path.length > 1); 22121 return path; 22122 }); 22123 copyObject(object, getAllKeysIn(object), result); 22124 if (isDeep) { 22125 result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); 22126 } 22127 var length = paths.length; 22128 while (length--) { 22129 baseUnset(result, paths[length]); 22130 } 22131 return result; 22132 }); 22133 22134 /** 22135 * The opposite of `_.pickBy`; this method creates an object composed of 22136 * the own and inherited enumerable string keyed properties of `object` that 22137 * `predicate` doesn't return truthy for. The predicate is invoked with two 22138 * arguments: (value, key). 22139 * 22140 * @static 22141 * @memberOf _ 22142 * @since 4.0.0 22143 * @category Object 22144 * @param {Object} object The source object. 22145 * @param {Function} [predicate=_.identity] The function invoked per property. 22146 * @returns {Object} Returns the new object. 22147 * @example 22148 * 22149 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 22150 * 22151 * _.omitBy(object, _.isNumber); 22152 * // => { 'b': '2' } 22153 */ 22154 function omitBy(object, predicate) { 22155 return pickBy(object, negate(getIteratee(predicate))); 22156 } 22157 22158 /** 22159 * Creates an object composed of the picked `object` properties. 22160 * 22161 * @static 22162 * @since 0.1.0 22163 * @memberOf _ 22164 * @category Object 22165 * @param {Object} object The source object. 22166 * @param {...(string|string[])} [paths] The property paths to pick. 22167 * @returns {Object} Returns the new object. 22168 * @example 22169 * 22170 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 22171 * 22172 * _.pick(object, ['a', 'c']); 22173 * // => { 'a': 1, 'c': 3 } 22174 */ 22175 var pick = flatRest(function(object, paths) { 22176 return object == null ? {} : basePick(object, paths); 22177 }); 22178 22179 /** 22180 * Creates an object composed of the `object` properties `predicate` returns 22181 * truthy for. The predicate is invoked with two arguments: (value, key). 22182 * 22183 * @static 22184 * @memberOf _ 22185 * @since 4.0.0 22186 * @category Object 22187 * @param {Object} object The source object. 22188 * @param {Function} [predicate=_.identity] The function invoked per property. 22189 * @returns {Object} Returns the new object. 22190 * @example 22191 * 22192 * var object = { 'a': 1, 'b': '2', 'c': 3 }; 22193 * 22194 * _.pickBy(object, _.isNumber); 22195 * // => { 'a': 1, 'c': 3 } 22196 */ 22197 function pickBy(object, predicate) { 22198 if (object == null) { 22199 return {}; 22200 } 22201 var props = arrayMap(getAllKeysIn(object), function(prop) { 22202 return [prop]; 22203 }); 22204 predicate = getIteratee(predicate); 22205 return basePickBy(object, props, function(value, path) { 22206 return predicate(value, path[0]); 22207 }); 22208 } 22209 22210 /** 22211 * This method is like `_.get` except that if the resolved value is a 22212 * function it's invoked with the `this` binding of its parent object and 22213 * its result is returned. 22214 * 22215 * @static 22216 * @since 0.1.0 22217 * @memberOf _ 22218 * @category Object 22219 * @param {Object} object The object to query. 22220 * @param {Array|string} path The path of the property to resolve. 22221 * @param {*} [defaultValue] The value returned for `undefined` resolved values. 22222 * @returns {*} Returns the resolved value. 22223 * @example 22224 * 22225 * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; 22226 * 22227 * _.result(object, 'a[0].b.c1'); 22228 * // => 3 22229 * 22230 * _.result(object, 'a[0].b.c2'); 22231 * // => 4 22232 * 22233 * _.result(object, 'a[0].b.c3', 'default'); 22234 * // => 'default' 22235 * 22236 * _.result(object, 'a[0].b.c3', _.constant('default')); 22237 * // => 'default' 22238 */ 22239 function result(object, path, defaultValue) { 22240 path = castPath(path, object); 22241 22242 var index = -1, 22243 length = path.length; 22244 22245 // Ensure the loop is entered when path is empty. 22246 if (!length) { 22247 length = 1; 22248 object = undefined; 22249 } 22250 while (++index < length) { 22251 var value = object == null ? undefined : object[toKey(path[index])]; 22252 if (value === undefined) { 22253 index = length; 22254 value = defaultValue; 22255 } 22256 object = isFunction(value) ? value.call(object) : value; 22257 } 22258 return object; 22259 } 22260 22261 /** 22262 * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, 22263 * it's created. Arrays are created for missing index properties while objects 22264 * are created for all other missing properties. Use `_.setWith` to customize 22265 * `path` creation. 22266 * 22267 * **Note:** This method mutates `object`. 22268 * 22269 * @static 22270 * @memberOf _ 22271 * @since 3.7.0 22272 * @category Object 22273 * @param {Object} object The object to modify. 22274 * @param {Array|string} path The path of the property to set. 22275 * @param {*} value The value to set. 22276 * @returns {Object} Returns `object`. 22277 * @example 22278 * 22279 * var object = { 'a': [{ 'b': { 'c': 3 } }] }; 22280 * 22281 * _.set(object, 'a[0].b.c', 4); 22282 * console.log(object.a[0].b.c); 22283 * // => 4 22284 * 22285 * _.set(object, ['x', '0', 'y', 'z'], 5); 22286 * console.log(object.x[0].y.z); 22287 * // => 5 22288 */ 22289 function set(object, path, value) { 22290 return object == null ? object : baseSet(object, path, value); 22291 } 22292 22293 /** 22294 * This method is like `_.set` except that it accepts `customizer` which is 22295 * invoked to produce the objects of `path`. If `customizer` returns `undefined` 22296 * path creation is handled by the method instead. The `customizer` is invoked 22297 * with three arguments: (nsValue, key, nsObject). 22298 * 22299 * **Note:** This method mutates `object`. 22300 * 22301 * @static 22302 * @memberOf _ 22303 * @since 4.0.0 22304 * @category Object 22305 * @param {Object} object The object to modify. 22306 * @param {Array|string} path The path of the property to set. 22307 * @param {*} value The value to set. 22308 * @param {Function} [customizer] The function to customize assigned values. 22309 * @returns {Object} Returns `object`. 22310 * @example 22311 * 22312 * var object = {}; 22313 * 22314 * _.setWith(object, '[0][1]', 'a', Object); 22315 * // => { '0': { '1': 'a' } } 22316 */ 22317 function setWith(object, path, value, customizer) { 22318 customizer = typeof customizer == 'function' ? customizer : undefined; 22319 return object == null ? object : baseSet(object, path, value, customizer); 22320 } 22321 22322 /** 22323 * Creates an array of own enumerable string keyed-value pairs for `object` 22324 * which can be consumed by `_.fromPairs`. If `object` is a map or set, its 22325 * entries are returned. 22326 * 22327 * @static 22328 * @memberOf _ 22329 * @since 4.0.0 22330 * @alias entries 22331 * @category Object 22332 * @param {Object} object The object to query. 22333 * @returns {Array} Returns the key-value pairs. 22334 * @example 22335 * 22336 * function Foo() { 22337 * this.a = 1; 22338 * this.b = 2; 22339 * } 22340 * 22341 * Foo.prototype.c = 3; 22342 * 22343 * _.toPairs(new Foo); 22344 * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) 22345 */ 22346 var toPairs = createToPairs(keys); 22347 22348 /** 22349 * Creates an array of own and inherited enumerable string keyed-value pairs 22350 * for `object` which can be consumed by `_.fromPairs`. If `object` is a map 22351 * or set, its entries are returned. 22352 * 22353 * @static 22354 * @memberOf _ 22355 * @since 4.0.0 22356 * @alias entriesIn 22357 * @category Object 22358 * @param {Object} object The object to query. 22359 * @returns {Array} Returns the key-value pairs. 22360 * @example 22361 * 22362 * function Foo() { 22363 * this.a = 1; 22364 * this.b = 2; 22365 * } 22366 * 22367 * Foo.prototype.c = 3; 22368 * 22369 * _.toPairsIn(new Foo); 22370 * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed) 22371 */ 22372 var toPairsIn = createToPairs(keysIn); 22373 22374 /** 22375 * An alternative to `_.reduce`; this method transforms `object` to a new 22376 * `accumulator` object which is the result of running each of its own 22377 * enumerable string keyed properties thru `iteratee`, with each invocation 22378 * potentially mutating the `accumulator` object. If `accumulator` is not 22379 * provided, a new object with the same `[[Prototype]]` will be used. The 22380 * iteratee is invoked with four arguments: (accumulator, value, key, object). 22381 * Iteratee functions may exit iteration early by explicitly returning `false`. 22382 * 22383 * @static 22384 * @memberOf _ 22385 * @since 1.3.0 22386 * @category Object 22387 * @param {Object} object The object to iterate over. 22388 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 22389 * @param {*} [accumulator] The custom accumulator value. 22390 * @returns {*} Returns the accumulated value. 22391 * @example 22392 * 22393 * _.transform([2, 3, 4], function(result, n) { 22394 * result.push(n *= n); 22395 * return n % 2 == 0; 22396 * }, []); 22397 * // => [4, 9] 22398 * 22399 * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { 22400 * (result[value] || (result[value] = [])).push(key); 22401 * }, {}); 22402 * // => { '1': ['a', 'c'], '2': ['b'] } 22403 */ 22404 function transform(object, iteratee, accumulator) { 22405 var isArr = isArray(object), 22406 isArrLike = isArr || isBuffer(object) || isTypedArray(object); 22407 22408 iteratee = getIteratee(iteratee, 4); 22409 if (accumulator == null) { 22410 var Ctor = object && object.constructor; 22411 if (isArrLike) { 22412 accumulator = isArr ? new Ctor : []; 22413 } 22414 else if (isObject(object)) { 22415 accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; 22416 } 22417 else { 22418 accumulator = {}; 22419 } 22420 } 22421 (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) { 22422 return iteratee(accumulator, value, index, object); 22423 }); 22424 return accumulator; 22425 } 22426 22427 /** 22428 * Removes the property at `path` of `object`. 22429 * 22430 * **Note:** This method mutates `object`. 22431 * 22432 * @static 22433 * @memberOf _ 22434 * @since 4.0.0 22435 * @category Object 22436 * @param {Object} object The object to modify. 22437 * @param {Array|string} path The path of the property to unset. 22438 * @returns {boolean} Returns `true` if the property is deleted, else `false`. 22439 * @example 22440 * 22441 * var object = { 'a': [{ 'b': { 'c': 7 } }] }; 22442 * _.unset(object, 'a[0].b.c'); 22443 * // => true 22444 * 22445 * console.log(object); 22446 * // => { 'a': [{ 'b': {} }] }; 22447 * 22448 * _.unset(object, ['a', '0', 'b', 'c']); 22449 * // => true 22450 * 22451 * console.log(object); 22452 * // => { 'a': [{ 'b': {} }] }; 22453 */ 22454 function unset(object, path) { 22455 return object == null ? true : baseUnset(object, path); 22456 } 22457 22458 /** 22459 * This method is like `_.set` except that accepts `updater` to produce the 22460 * value to set. Use `_.updateWith` to customize `path` creation. The `updater` 22461 * is invoked with one argument: (value). 22462 * 22463 * **Note:** This method mutates `object`. 22464 * 22465 * @static 22466 * @memberOf _ 22467 * @since 4.6.0 22468 * @category Object 22469 * @param {Object} object The object to modify. 22470 * @param {Array|string} path The path of the property to set. 22471 * @param {Function} updater The function to produce the updated value. 22472 * @returns {Object} Returns `object`. 22473 * @example 22474 * 22475 * var object = { 'a': [{ 'b': { 'c': 3 } }] }; 22476 * 22477 * _.update(object, 'a[0].b.c', function(n) { return n * n; }); 22478 * console.log(object.a[0].b.c); 22479 * // => 9 22480 * 22481 * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); 22482 * console.log(object.x[0].y.z); 22483 * // => 0 22484 */ 22485 function update(object, path, updater) { 22486 return object == null ? object : baseUpdate(object, path, castFunction(updater)); 22487 } 22488 22489 /** 22490 * This method is like `_.update` except that it accepts `customizer` which is 22491 * invoked to produce the objects of `path`. If `customizer` returns `undefined` 22492 * path creation is handled by the method instead. The `customizer` is invoked 22493 * with three arguments: (nsValue, key, nsObject). 22494 * 22495 * **Note:** This method mutates `object`. 22496 * 22497 * @static 22498 * @memberOf _ 22499 * @since 4.6.0 22500 * @category Object 22501 * @param {Object} object The object to modify. 22502 * @param {Array|string} path The path of the property to set. 22503 * @param {Function} updater The function to produce the updated value. 22504 * @param {Function} [customizer] The function to customize assigned values. 22505 * @returns {Object} Returns `object`. 22506 * @example 22507 * 22508 * var object = {}; 22509 * 22510 * _.updateWith(object, '[0][1]', _.constant('a'), Object); 22511 * // => { '0': { '1': 'a' } } 22512 */ 22513 function updateWith(object, path, updater, customizer) { 22514 customizer = typeof customizer == 'function' ? customizer : undefined; 22515 return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); 22516 } 22517 22518 /** 22519 * Creates an array of the own enumerable string keyed property values of `object`. 22520 * 22521 * **Note:** Non-object values are coerced to objects. 22522 * 22523 * @static 22524 * @since 0.1.0 22525 * @memberOf _ 22526 * @category Object 22527 * @param {Object} object The object to query. 22528 * @returns {Array} Returns the array of property values. 22529 * @example 22530 * 22531 * function Foo() { 22532 * this.a = 1; 22533 * this.b = 2; 22534 * } 22535 * 22536 * Foo.prototype.c = 3; 22537 * 22538 * _.values(new Foo); 22539 * // => [1, 2] (iteration order is not guaranteed) 22540 * 22541 * _.values('hi'); 22542 * // => ['h', 'i'] 22543 */ 22544 function values(object) { 22545 return object == null ? [] : baseValues(object, keys(object)); 22546 } 22547 22548 /** 22549 * Creates an array of the own and inherited enumerable string keyed property 22550 * values of `object`. 22551 * 22552 * **Note:** Non-object values are coerced to objects. 22553 * 22554 * @static 22555 * @memberOf _ 22556 * @since 3.0.0 22557 * @category Object 22558 * @param {Object} object The object to query. 22559 * @returns {Array} Returns the array of property values. 22560 * @example 22561 * 22562 * function Foo() { 22563 * this.a = 1; 22564 * this.b = 2; 22565 * } 22566 * 22567 * Foo.prototype.c = 3; 22568 * 22569 * _.valuesIn(new Foo); 22570 * // => [1, 2, 3] (iteration order is not guaranteed) 22571 */ 22572 function valuesIn(object) { 22573 return object == null ? [] : baseValues(object, keysIn(object)); 22574 } 22575 22576 /*------------------------------------------------------------------------*/ 22577 22578 /** 22579 * Clamps `number` within the inclusive `lower` and `upper` bounds. 22580 * 22581 * @static 22582 * @memberOf _ 22583 * @since 4.0.0 22584 * @category Number 22585 * @param {number} number The number to clamp. 22586 * @param {number} [lower] The lower bound. 22587 * @param {number} upper The upper bound. 22588 * @returns {number} Returns the clamped number. 22589 * @example 22590 * 22591 * _.clamp(-10, -5, 5); 22592 * // => -5 22593 * 22594 * _.clamp(10, -5, 5); 22595 * // => 5 22596 */ 22597 function clamp(number, lower, upper) { 22598 if (upper === undefined) { 22599 upper = lower; 22600 lower = undefined; 22601 } 22602 if (upper !== undefined) { 22603 upper = toNumber(upper); 22604 upper = upper === upper ? upper : 0; 22605 } 22606 if (lower !== undefined) { 22607 lower = toNumber(lower); 22608 lower = lower === lower ? lower : 0; 22609 } 22610 return baseClamp(toNumber(number), lower, upper); 22611 } 22612 22613 /** 22614 * Checks if `n` is between `start` and up to, but not including, `end`. If 22615 * `end` is not specified, it's set to `start` with `start` then set to `0`. 22616 * If `start` is greater than `end` the params are swapped to support 22617 * negative ranges. 22618 * 22619 * @static 22620 * @memberOf _ 22621 * @since 3.3.0 22622 * @category Number 22623 * @param {number} number The number to check. 22624 * @param {number} [start=0] The start of the range. 22625 * @param {number} end The end of the range. 22626 * @returns {boolean} Returns `true` if `number` is in the range, else `false`. 22627 * @see _.range, _.rangeRight 22628 * @example 22629 * 22630 * _.inRange(3, 2, 4); 22631 * // => true 22632 * 22633 * _.inRange(4, 8); 22634 * // => true 22635 * 22636 * _.inRange(4, 2); 22637 * // => false 22638 * 22639 * _.inRange(2, 2); 22640 * // => false 22641 * 22642 * _.inRange(1.2, 2); 22643 * // => true 22644 * 22645 * _.inRange(5.2, 4); 22646 * // => false 22647 * 22648 * _.inRange(-3, -2, -6); 22649 * // => true 22650 */ 22651 function inRange(number, start, end) { 22652 start = toFinite(start); 22653 if (end === undefined) { 22654 end = start; 22655 start = 0; 22656 } else { 22657 end = toFinite(end); 22658 } 22659 number = toNumber(number); 22660 return baseInRange(number, start, end); 22661 } 22662 22663 /** 22664 * Produces a random number between the inclusive `lower` and `upper` bounds. 22665 * If only one argument is provided a number between `0` and the given number 22666 * is returned. If `floating` is `true`, or either `lower` or `upper` are 22667 * floats, a floating-point number is returned instead of an integer. 22668 * 22669 * **Note:** JavaScript follows the IEEE-754 standard for resolving 22670 * floating-point values which can produce unexpected results. 22671 * 22672 * @static 22673 * @memberOf _ 22674 * @since 0.7.0 22675 * @category Number 22676 * @param {number} [lower=0] The lower bound. 22677 * @param {number} [upper=1] The upper bound. 22678 * @param {boolean} [floating] Specify returning a floating-point number. 22679 * @returns {number} Returns the random number. 22680 * @example 22681 * 22682 * _.random(0, 5); 22683 * // => an integer between 0 and 5 22684 * 22685 * _.random(5); 22686 * // => also an integer between 0 and 5 22687 * 22688 * _.random(5, true); 22689 * // => a floating-point number between 0 and 5 22690 * 22691 * _.random(1.2, 5.2); 22692 * // => a floating-point number between 1.2 and 5.2 22693 */ 22694 function random(lower, upper, floating) { 22695 if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { 22696 upper = floating = undefined; 22697 } 22698 if (floating === undefined) { 22699 if (typeof upper == 'boolean') { 22700 floating = upper; 22701 upper = undefined; 22702 } 22703 else if (typeof lower == 'boolean') { 22704 floating = lower; 22705 lower = undefined; 22706 } 22707 } 22708 if (lower === undefined && upper === undefined) { 22709 lower = 0; 22710 upper = 1; 22711 } 22712 else { 22713 lower = toFinite(lower); 22714 if (upper === undefined) { 22715 upper = lower; 22716 lower = 0; 22717 } else { 22718 upper = toFinite(upper); 22719 } 22720 } 22721 if (lower > upper) { 22722 var temp = lower; 22723 lower = upper; 22724 upper = temp; 22725 } 22726 if (floating || lower % 1 || upper % 1) { 22727 var rand = nativeRandom(); 22728 return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); 22729 } 22730 return baseRandom(lower, upper); 22731 } 22732 22733 /*------------------------------------------------------------------------*/ 22734 22735 /** 22736 * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). 22737 * 22738 * @static 22739 * @memberOf _ 22740 * @since 3.0.0 22741 * @category String 22742 * @param {string} [string=''] The string to convert. 22743 * @returns {string} Returns the camel cased string. 22744 * @example 22745 * 22746 * _.camelCase('Foo Bar'); 22747 * // => 'fooBar' 22748 * 22749 * _.camelCase('--foo-bar--'); 22750 * // => 'fooBar' 22751 * 22752 * _.camelCase('__FOO_BAR__'); 22753 * // => 'fooBar' 22754 */ 22755 var camelCase = createCompounder(function(result, word, index) { 22756 word = word.toLowerCase(); 22757 return result + (index ? capitalize(word) : word); 22758 }); 22759 22760 /** 22761 * Converts the first character of `string` to upper case and the remaining 22762 * to lower case. 22763 * 22764 * @static 22765 * @memberOf _ 22766 * @since 3.0.0 22767 * @category String 22768 * @param {string} [string=''] The string to capitalize. 22769 * @returns {string} Returns the capitalized string. 22770 * @example 22771 * 22772 * _.capitalize('FRED'); 22773 * // => 'Fred' 22774 */ 22775 function capitalize(string) { 22776 return upperFirst(toString(string).toLowerCase()); 22777 } 22778 22779 /** 22780 * Deburrs `string` by converting 22781 * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) 22782 * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) 22783 * letters to basic Latin letters and removing 22784 * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). 22785 * 22786 * @static 22787 * @memberOf _ 22788 * @since 3.0.0 22789 * @category String 22790 * @param {string} [string=''] The string to deburr. 22791 * @returns {string} Returns the deburred string. 22792 * @example 22793 * 22794 * _.deburr('déjà vu'); 22795 * // => 'deja vu' 22796 */ 22797 function deburr(string) { 22798 string = toString(string); 22799 return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); 22800 } 22801 22802 /** 22803 * Checks if `string` ends with the given target string. 22804 * 22805 * @static 22806 * @memberOf _ 22807 * @since 3.0.0 22808 * @category String 22809 * @param {string} [string=''] The string to inspect. 22810 * @param {string} [target] The string to search for. 22811 * @param {number} [position=string.length] The position to search up to. 22812 * @returns {boolean} Returns `true` if `string` ends with `target`, 22813 * else `false`. 22814 * @example 22815 * 22816 * _.endsWith('abc', 'c'); 22817 * // => true 22818 * 22819 * _.endsWith('abc', 'b'); 22820 * // => false 22821 * 22822 * _.endsWith('abc', 'b', 2); 22823 * // => true 22824 */ 22825 function endsWith(string, target, position) { 22826 string = toString(string); 22827 target = baseToString(target); 22828 22829 var length = string.length; 22830 position = position === undefined 22831 ? length 22832 : baseClamp(toInteger(position), 0, length); 22833 22834 var end = position; 22835 position -= target.length; 22836 return position >= 0 && string.slice(position, end) == target; 22837 } 22838 22839 /** 22840 * Converts the characters "&", "<", ">", '"', and "'" in `string` to their 22841 * corresponding HTML entities. 22842 * 22843 * **Note:** No other characters are escaped. To escape additional 22844 * characters use a third-party library like [_he_](https://mths.be/he). 22845 * 22846 * Though the ">" character is escaped for symmetry, characters like 22847 * ">" and "/" don't need escaping in HTML and have no special meaning 22848 * unless they're part of a tag or unquoted attribute value. See 22849 * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) 22850 * (under "semi-related fun fact") for more details. 22851 * 22852 * When working with HTML you should always 22853 * [quote attribute values](http://wonko.com/post/html-escaping) to reduce 22854 * XSS vectors. 22855 * 22856 * @static 22857 * @since 0.1.0 22858 * @memberOf _ 22859 * @category String 22860 * @param {string} [string=''] The string to escape. 22861 * @returns {string} Returns the escaped string. 22862 * @example 22863 * 22864 * _.escape('fred, barney, & pebbles'); 22865 * // => 'fred, barney, & pebbles' 22866 */ 22867 function escape(string) { 22868 string = toString(string); 22869 return (string && reHasUnescapedHtml.test(string)) 22870 ? string.replace(reUnescapedHtml, escapeHtmlChar) 22871 : string; 22872 } 22873 22874 /** 22875 * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", 22876 * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. 22877 * 22878 * @static 22879 * @memberOf _ 22880 * @since 3.0.0 22881 * @category String 22882 * @param {string} [string=''] The string to escape. 22883 * @returns {string} Returns the escaped string. 22884 * @example 22885 * 22886 * _.escapeRegExp('[lodash](https://lodash.com/)'); 22887 * // => '\[lodash\]\(https://lodash\.com/\)' 22888 */ 22889 function escapeRegExp(string) { 22890 string = toString(string); 22891 return (string && reHasRegExpChar.test(string)) 22892 ? string.replace(reRegExpChar, '\\$&') 22893 : string; 22894 } 22895 22896 /** 22897 * Converts `string` to 22898 * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). 22899 * 22900 * @static 22901 * @memberOf _ 22902 * @since 3.0.0 22903 * @category String 22904 * @param {string} [string=''] The string to convert. 22905 * @returns {string} Returns the kebab cased string. 22906 * @example 22907 * 22908 * _.kebabCase('Foo Bar'); 22909 * // => 'foo-bar' 22910 * 22911 * _.kebabCase('fooBar'); 22912 * // => 'foo-bar' 22913 * 22914 * _.kebabCase('__FOO_BAR__'); 22915 * // => 'foo-bar' 22916 */ 22917 var kebabCase = createCompounder(function(result, word, index) { 22918 return result + (index ? '-' : '') + word.toLowerCase(); 22919 }); 22920 22921 /** 22922 * Converts `string`, as space separated words, to lower case. 22923 * 22924 * @static 22925 * @memberOf _ 22926 * @since 4.0.0 22927 * @category String 22928 * @param {string} [string=''] The string to convert. 22929 * @returns {string} Returns the lower cased string. 22930 * @example 22931 * 22932 * _.lowerCase('--Foo-Bar--'); 22933 * // => 'foo bar' 22934 * 22935 * _.lowerCase('fooBar'); 22936 * // => 'foo bar' 22937 * 22938 * _.lowerCase('__FOO_BAR__'); 22939 * // => 'foo bar' 22940 */ 22941 var lowerCase = createCompounder(function(result, word, index) { 22942 return result + (index ? ' ' : '') + word.toLowerCase(); 22943 }); 22944 22945 /** 22946 * Converts the first character of `string` to lower case. 22947 * 22948 * @static 22949 * @memberOf _ 22950 * @since 4.0.0 22951 * @category String 22952 * @param {string} [string=''] The string to convert. 22953 * @returns {string} Returns the converted string. 22954 * @example 22955 * 22956 * _.lowerFirst('Fred'); 22957 * // => 'fred' 22958 * 22959 * _.lowerFirst('FRED'); 22960 * // => 'fRED' 22961 */ 22962 var lowerFirst = createCaseFirst('toLowerCase'); 22963 22964 /** 22965 * Pads `string` on the left and right sides if it's shorter than `length`. 22966 * Padding characters are truncated if they can't be evenly divided by `length`. 22967 * 22968 * @static 22969 * @memberOf _ 22970 * @since 3.0.0 22971 * @category String 22972 * @param {string} [string=''] The string to pad. 22973 * @param {number} [length=0] The padding length. 22974 * @param {string} [chars=' '] The string used as padding. 22975 * @returns {string} Returns the padded string. 22976 * @example 22977 * 22978 * _.pad('abc', 8); 22979 * // => ' abc ' 22980 * 22981 * _.pad('abc', 8, '_-'); 22982 * // => '_-abc_-_' 22983 * 22984 * _.pad('abc', 3); 22985 * // => 'abc' 22986 */ 22987 function pad(string, length, chars) { 22988 string = toString(string); 22989 length = toInteger(length); 22990 22991 var strLength = length ? stringSize(string) : 0; 22992 if (!length || strLength >= length) { 22993 return string; 22994 } 22995 var mid = (length - strLength) / 2; 22996 return ( 22997 createPadding(nativeFloor(mid), chars) + 22998 string + 22999 createPadding(nativeCeil(mid), chars) 23000 ); 23001 } 23002 23003 /** 23004 * Pads `string` on the right side if it's shorter than `length`. Padding 23005 * characters are truncated if they exceed `length`. 23006 * 23007 * @static 23008 * @memberOf _ 23009 * @since 4.0.0 23010 * @category String 23011 * @param {string} [string=''] The string to pad. 23012 * @param {number} [length=0] The padding length. 23013 * @param {string} [chars=' '] The string used as padding. 23014 * @returns {string} Returns the padded string. 23015 * @example 23016 * 23017 * _.padEnd('abc', 6); 23018 * // => 'abc ' 23019 * 23020 * _.padEnd('abc', 6, '_-'); 23021 * // => 'abc_-_' 23022 * 23023 * _.padEnd('abc', 3); 23024 * // => 'abc' 23025 */ 23026 function padEnd(string, length, chars) { 23027 string = toString(string); 23028 length = toInteger(length); 23029 23030 var strLength = length ? stringSize(string) : 0; 23031 return (length && strLength < length) 23032 ? (string + createPadding(length - strLength, chars)) 23033 : string; 23034 } 23035 23036 /** 23037 * Pads `string` on the left side if it's shorter than `length`. Padding 23038 * characters are truncated if they exceed `length`. 23039 * 23040 * @static 23041 * @memberOf _ 23042 * @since 4.0.0 23043 * @category String 23044 * @param {string} [string=''] The string to pad. 23045 * @param {number} [length=0] The padding length. 23046 * @param {string} [chars=' '] The string used as padding. 23047 * @returns {string} Returns the padded string. 23048 * @example 23049 * 23050 * _.padStart('abc', 6); 23051 * // => ' abc' 23052 * 23053 * _.padStart('abc', 6, '_-'); 23054 * // => '_-_abc' 23055 * 23056 * _.padStart('abc', 3); 23057 * // => 'abc' 23058 */ 23059 function padStart(string, length, chars) { 23060 string = toString(string); 23061 length = toInteger(length); 23062 23063 var strLength = length ? stringSize(string) : 0; 23064 return (length && strLength < length) 23065 ? (createPadding(length - strLength, chars) + string) 23066 : string; 23067 } 23068 23069 /** 23070 * Converts `string` to an integer of the specified radix. If `radix` is 23071 * `undefined` or `0`, a `radix` of `10` is used unless `value` is a 23072 * hexadecimal, in which case a `radix` of `16` is used. 23073 * 23074 * **Note:** This method aligns with the 23075 * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. 23076 * 23077 * @static 23078 * @memberOf _ 23079 * @since 1.1.0 23080 * @category String 23081 * @param {string} string The string to convert. 23082 * @param {number} [radix=10] The radix to interpret `value` by. 23083 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 23084 * @returns {number} Returns the converted integer. 23085 * @example 23086 * 23087 * _.parseInt('08'); 23088 * // => 8 23089 * 23090 * _.map(['6', '08', '10'], _.parseInt); 23091 * // => [6, 8, 10] 23092 */ 23093 function parseInt(string, radix, guard) { 23094 if (guard || radix == null) { 23095 radix = 0; 23096 } else if (radix) { 23097 radix = +radix; 23098 } 23099 return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0); 23100 } 23101 23102 /** 23103 * Repeats the given string `n` times. 23104 * 23105 * @static 23106 * @memberOf _ 23107 * @since 3.0.0 23108 * @category String 23109 * @param {string} [string=''] The string to repeat. 23110 * @param {number} [n=1] The number of times to repeat the string. 23111 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 23112 * @returns {string} Returns the repeated string. 23113 * @example 23114 * 23115 * _.repeat('*', 3); 23116 * // => '***' 23117 * 23118 * _.repeat('abc', 2); 23119 * // => 'abcabc' 23120 * 23121 * _.repeat('abc', 0); 23122 * // => '' 23123 */ 23124 function repeat(string, n, guard) { 23125 if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) { 23126 n = 1; 23127 } else { 23128 n = toInteger(n); 23129 } 23130 return baseRepeat(toString(string), n); 23131 } 23132 23133 /** 23134 * Replaces matches for `pattern` in `string` with `replacement`. 23135 * 23136 * **Note:** This method is based on 23137 * [`String#replace`](https://mdn.io/String/replace). 23138 * 23139 * @static 23140 * @memberOf _ 23141 * @since 4.0.0 23142 * @category String 23143 * @param {string} [string=''] The string to modify. 23144 * @param {RegExp|string} pattern The pattern to replace. 23145 * @param {Function|string} replacement The match replacement. 23146 * @returns {string} Returns the modified string. 23147 * @example 23148 * 23149 * _.replace('Hi Fred', 'Fred', 'Barney'); 23150 * // => 'Hi Barney' 23151 */ 23152 function replace() { 23153 var args = arguments, 23154 string = toString(args[0]); 23155 23156 return args.length < 3 ? string : string.replace(args[1], args[2]); 23157 } 23158 23159 /** 23160 * Converts `string` to 23161 * [snake case](https://en.wikipedia.org/wiki/Snake_case). 23162 * 23163 * @static 23164 * @memberOf _ 23165 * @since 3.0.0 23166 * @category String 23167 * @param {string} [string=''] The string to convert. 23168 * @returns {string} Returns the snake cased string. 23169 * @example 23170 * 23171 * _.snakeCase('Foo Bar'); 23172 * // => 'foo_bar' 23173 * 23174 * _.snakeCase('fooBar'); 23175 * // => 'foo_bar' 23176 * 23177 * _.snakeCase('--FOO-BAR--'); 23178 * // => 'foo_bar' 23179 */ 23180 var snakeCase = createCompounder(function(result, word, index) { 23181 return result + (index ? '_' : '') + word.toLowerCase(); 23182 }); 23183 23184 /** 23185 * Splits `string` by `separator`. 23186 * 23187 * **Note:** This method is based on 23188 * [`String#split`](https://mdn.io/String/split). 23189 * 23190 * @static 23191 * @memberOf _ 23192 * @since 4.0.0 23193 * @category String 23194 * @param {string} [string=''] The string to split. 23195 * @param {RegExp|string} separator The separator pattern to split by. 23196 * @param {number} [limit] The length to truncate results to. 23197 * @returns {Array} Returns the string segments. 23198 * @example 23199 * 23200 * _.split('a-b-c', '-', 2); 23201 * // => ['a', 'b'] 23202 */ 23203 function split(string, separator, limit) { 23204 if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) { 23205 separator = limit = undefined; 23206 } 23207 limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0; 23208 if (!limit) { 23209 return []; 23210 } 23211 string = toString(string); 23212 if (string && ( 23213 typeof separator == 'string' || 23214 (separator != null && !isRegExp(separator)) 23215 )) { 23216 separator = baseToString(separator); 23217 if (!separator && hasUnicode(string)) { 23218 return castSlice(stringToArray(string), 0, limit); 23219 } 23220 } 23221 return string.split(separator, limit); 23222 } 23223 23224 /** 23225 * Converts `string` to 23226 * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). 23227 * 23228 * @static 23229 * @memberOf _ 23230 * @since 3.1.0 23231 * @category String 23232 * @param {string} [string=''] The string to convert. 23233 * @returns {string} Returns the start cased string. 23234 * @example 23235 * 23236 * _.startCase('--foo-bar--'); 23237 * // => 'Foo Bar' 23238 * 23239 * _.startCase('fooBar'); 23240 * // => 'Foo Bar' 23241 * 23242 * _.startCase('__FOO_BAR__'); 23243 * // => 'FOO BAR' 23244 */ 23245 var startCase = createCompounder(function(result, word, index) { 23246 return result + (index ? ' ' : '') + upperFirst(word); 23247 }); 23248 23249 /** 23250 * Checks if `string` starts with the given target string. 23251 * 23252 * @static 23253 * @memberOf _ 23254 * @since 3.0.0 23255 * @category String 23256 * @param {string} [string=''] The string to inspect. 23257 * @param {string} [target] The string to search for. 23258 * @param {number} [position=0] The position to search from. 23259 * @returns {boolean} Returns `true` if `string` starts with `target`, 23260 * else `false`. 23261 * @example 23262 * 23263 * _.startsWith('abc', 'a'); 23264 * // => true 23265 * 23266 * _.startsWith('abc', 'b'); 23267 * // => false 23268 * 23269 * _.startsWith('abc', 'b', 1); 23270 * // => true 23271 */ 23272 function startsWith(string, target, position) { 23273 string = toString(string); 23274 position = position == null 23275 ? 0 23276 : baseClamp(toInteger(position), 0, string.length); 23277 23278 target = baseToString(target); 23279 return string.slice(position, position + target.length) == target; 23280 } 23281 23282 /** 23283 * Creates a compiled template function that can interpolate data properties 23284 * in "interpolate" delimiters, HTML-escape interpolated data properties in 23285 * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data 23286 * properties may be accessed as free variables in the template. If a setting 23287 * object is given, it takes precedence over `_.templateSettings` values. 23288 * 23289 * **Note:** In the development build `_.template` utilizes 23290 * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) 23291 * for easier debugging. 23292 * 23293 * For more information on precompiling templates see 23294 * [lodash's custom builds documentation](https://lodash.com/custom-builds). 23295 * 23296 * For more information on Chrome extension sandboxes see 23297 * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). 23298 * 23299 * @static 23300 * @since 0.1.0 23301 * @memberOf _ 23302 * @category String 23303 * @param {string} [string=''] The template string. 23304 * @param {Object} [options={}] The options object. 23305 * @param {RegExp} [options.escape=_.templateSettings.escape] 23306 * The HTML "escape" delimiter. 23307 * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] 23308 * The "evaluate" delimiter. 23309 * @param {Object} [options.imports=_.templateSettings.imports] 23310 * An object to import into the template as free variables. 23311 * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] 23312 * The "interpolate" delimiter. 23313 * @param {string} [options.sourceURL='lodash.templateSources[n]'] 23314 * The sourceURL of the compiled template. 23315 * @param {string} [options.variable='obj'] 23316 * The data object variable name. 23317 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 23318 * @returns {Function} Returns the compiled template function. 23319 * @example 23320 * 23321 * // Use the "interpolate" delimiter to create a compiled template. 23322 * var compiled = _.template('hello <%= user %>!'); 23323 * compiled({ 'user': 'fred' }); 23324 * // => 'hello fred!' 23325 * 23326 * // Use the HTML "escape" delimiter to escape data property values. 23327 * var compiled = _.template('<b><%- value %></b>'); 23328 * compiled({ 'value': '<script>' }); 23329 * // => '<b><script></b>' 23330 * 23331 * // Use the "evaluate" delimiter to execute JavaScript and generate HTML. 23332 * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>'); 23333 * compiled({ 'users': ['fred', 'barney'] }); 23334 * // => '<li>fred</li><li>barney</li>' 23335 * 23336 * // Use the internal `print` function in "evaluate" delimiters. 23337 * var compiled = _.template('<% print("hello " + user); %>!'); 23338 * compiled({ 'user': 'barney' }); 23339 * // => 'hello barney!' 23340 * 23341 * // Use the ES template literal delimiter as an "interpolate" delimiter. 23342 * // Disable support by replacing the "interpolate" delimiter. 23343 * var compiled = _.template('hello ${ user }!'); 23344 * compiled({ 'user': 'pebbles' }); 23345 * // => 'hello pebbles!' 23346 * 23347 * // Use backslashes to treat delimiters as plain text. 23348 * var compiled = _.template('<%= "\\<%- value %\\>" %>'); 23349 * compiled({ 'value': 'ignored' }); 23350 * // => '<%- value %>' 23351 * 23352 * // Use the `imports` option to import `jQuery` as `jq`. 23353 * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>'; 23354 * var compiled = _.template(text, { 'imports': { 'jq': jQuery } }); 23355 * compiled({ 'users': ['fred', 'barney'] }); 23356 * // => '<li>fred</li><li>barney</li>' 23357 * 23358 * // Use the `sourceURL` option to specify a custom sourceURL for the template. 23359 * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' }); 23360 * compiled(data); 23361 * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector. 23362 * 23363 * // Use the `variable` option to ensure a with-statement isn't used in the compiled template. 23364 * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' }); 23365 * compiled.source; 23366 * // => function(data) { 23367 * // var __t, __p = ''; 23368 * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!'; 23369 * // return __p; 23370 * // } 23371 * 23372 * // Use custom template delimiters. 23373 * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g; 23374 * var compiled = _.template('hello {{ user }}!'); 23375 * compiled({ 'user': 'mustache' }); 23376 * // => 'hello mustache!' 23377 * 23378 * // Use the `source` property to inline compiled templates for meaningful 23379 * // line numbers in error messages and stack traces. 23380 * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\ 23381 * var JST = {\ 23382 * "main": ' + _.template(mainText).source + '\ 23383 * };\ 23384 * '); 23385 */ 23386 function template(string, options, guard) { 23387 // Based on John Resig's `tmpl` implementation 23388 // (http://ejohn.org/blog/javascript-micro-templating/) 23389 // and Laura Doktorova's doT.js (https://github.com/olado/doT). 23390 var settings = lodash.templateSettings; 23391 23392 if (guard && isIterateeCall(string, options, guard)) { 23393 options = undefined; 23394 } 23395 string = toString(string); 23396 options = assignInWith({}, options, settings, customDefaultsAssignIn); 23397 23398 var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), 23399 importsKeys = keys(imports), 23400 importsValues = baseValues(imports, importsKeys); 23401 23402 var isEscaping, 23403 isEvaluating, 23404 index = 0, 23405 interpolate = options.interpolate || reNoMatch, 23406 source = "__p += '"; 23407 23408 // Compile the regexp to match each delimiter. 23409 var reDelimiters = RegExp( 23410 (options.escape || reNoMatch).source + '|' + 23411 interpolate.source + '|' + 23412 (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' + 23413 (options.evaluate || reNoMatch).source + '|$' 23414 , 'g'); 23415 23416 // Use a sourceURL for easier debugging. 23417 // The sourceURL gets injected into the source that's eval-ed, so be careful 23418 // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in 23419 // and escape the comment, thus injecting code that gets evaled. 23420 var sourceURL = '//# sourceURL=' + 23421 (hasOwnProperty.call(options, 'sourceURL') 23422 ? (options.sourceURL + '').replace(/\s/g, ' ') 23423 : ('lodash.templateSources[' + (++templateCounter) + ']') 23424 ) + '\n'; 23425 23426 string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { 23427 interpolateValue || (interpolateValue = esTemplateValue); 23428 23429 // Escape characters that can't be included in string literals. 23430 source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar); 23431 23432 // Replace delimiters with snippets. 23433 if (escapeValue) { 23434 isEscaping = true; 23435 source += "' +\n__e(" + escapeValue + ") +\n'"; 23436 } 23437 if (evaluateValue) { 23438 isEvaluating = true; 23439 source += "';\n" + evaluateValue + ";\n__p += '"; 23440 } 23441 if (interpolateValue) { 23442 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; 23443 } 23444 index = offset + match.length; 23445 23446 // The JS engine embedded in Adobe products needs `match` returned in 23447 // order to produce the correct `offset` value. 23448 return match; 23449 }); 23450 23451 source += "';\n"; 23452 23453 // If `variable` is not specified wrap a with-statement around the generated 23454 // code to add the data object to the top of the scope chain. 23455 var variable = hasOwnProperty.call(options, 'variable') && options.variable; 23456 if (!variable) { 23457 source = 'with (obj) {\n' + source + '\n}\n'; 23458 } 23459 // Throw an error if a forbidden character was found in `variable`, to prevent 23460 // potential command injection attacks. 23461 else if (reForbiddenIdentifierChars.test(variable)) { 23462 throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT); 23463 } 23464 23465 // Cleanup code by stripping empty strings. 23466 source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source) 23467 .replace(reEmptyStringMiddle, '$1') 23468 .replace(reEmptyStringTrailing, '$1;'); 23469 23470 // Frame code as the function body. 23471 source = 'function(' + (variable || 'obj') + ') {\n' + 23472 (variable 23473 ? '' 23474 : 'obj || (obj = {});\n' 23475 ) + 23476 "var __t, __p = ''" + 23477 (isEscaping 23478 ? ', __e = _.escape' 23479 : '' 23480 ) + 23481 (isEvaluating 23482 ? ', __j = Array.prototype.join;\n' + 23483 "function print() { __p += __j.call(arguments, '') }\n" 23484 : ';\n' 23485 ) + 23486 source + 23487 'return __p\n}'; 23488 23489 var result = attempt(function() { 23490 return Function(importsKeys, sourceURL + 'return ' + source) 23491 .apply(undefined, importsValues); 23492 }); 23493 23494 // Provide the compiled function's source by its `toString` method or 23495 // the `source` property as a convenience for inlining compiled templates. 23496 result.source = source; 23497 if (isError(result)) { 23498 throw result; 23499 } 23500 return result; 23501 } 23502 23503 /** 23504 * Converts `string`, as a whole, to lower case just like 23505 * [String#toLowerCase](https://mdn.io/toLowerCase). 23506 * 23507 * @static 23508 * @memberOf _ 23509 * @since 4.0.0 23510 * @category String 23511 * @param {string} [string=''] The string to convert. 23512 * @returns {string} Returns the lower cased string. 23513 * @example 23514 * 23515 * _.toLower('--Foo-Bar--'); 23516 * // => '--foo-bar--' 23517 * 23518 * _.toLower('fooBar'); 23519 * // => 'foobar' 23520 * 23521 * _.toLower('__FOO_BAR__'); 23522 * // => '__foo_bar__' 23523 */ 23524 function toLower(value) { 23525 return toString(value).toLowerCase(); 23526 } 23527 23528 /** 23529 * Converts `string`, as a whole, to upper case just like 23530 * [String#toUpperCase](https://mdn.io/toUpperCase). 23531 * 23532 * @static 23533 * @memberOf _ 23534 * @since 4.0.0 23535 * @category String 23536 * @param {string} [string=''] The string to convert. 23537 * @returns {string} Returns the upper cased string. 23538 * @example 23539 * 23540 * _.toUpper('--foo-bar--'); 23541 * // => '--FOO-BAR--' 23542 * 23543 * _.toUpper('fooBar'); 23544 * // => 'FOOBAR' 23545 * 23546 * _.toUpper('__foo_bar__'); 23547 * // => '__FOO_BAR__' 23548 */ 23549 function toUpper(value) { 23550 return toString(value).toUpperCase(); 23551 } 23552 23553 /** 23554 * Removes leading and trailing whitespace or specified characters from `string`. 23555 * 23556 * @static 23557 * @memberOf _ 23558 * @since 3.0.0 23559 * @category String 23560 * @param {string} [string=''] The string to trim. 23561 * @param {string} [chars=whitespace] The characters to trim. 23562 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 23563 * @returns {string} Returns the trimmed string. 23564 * @example 23565 * 23566 * _.trim(' abc '); 23567 * // => 'abc' 23568 * 23569 * _.trim('-_-abc-_-', '_-'); 23570 * // => 'abc' 23571 * 23572 * _.map([' foo ', ' bar '], _.trim); 23573 * // => ['foo', 'bar'] 23574 */ 23575 function trim(string, chars, guard) { 23576 string = toString(string); 23577 if (string && (guard || chars === undefined)) { 23578 return baseTrim(string); 23579 } 23580 if (!string || !(chars = baseToString(chars))) { 23581 return string; 23582 } 23583 var strSymbols = stringToArray(string), 23584 chrSymbols = stringToArray(chars), 23585 start = charsStartIndex(strSymbols, chrSymbols), 23586 end = charsEndIndex(strSymbols, chrSymbols) + 1; 23587 23588 return castSlice(strSymbols, start, end).join(''); 23589 } 23590 23591 /** 23592 * Removes trailing whitespace or specified characters from `string`. 23593 * 23594 * @static 23595 * @memberOf _ 23596 * @since 4.0.0 23597 * @category String 23598 * @param {string} [string=''] The string to trim. 23599 * @param {string} [chars=whitespace] The characters to trim. 23600 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 23601 * @returns {string} Returns the trimmed string. 23602 * @example 23603 * 23604 * _.trimEnd(' abc '); 23605 * // => ' abc' 23606 * 23607 * _.trimEnd('-_-abc-_-', '_-'); 23608 * // => '-_-abc' 23609 */ 23610 function trimEnd(string, chars, guard) { 23611 string = toString(string); 23612 if (string && (guard || chars === undefined)) { 23613 return string.slice(0, trimmedEndIndex(string) + 1); 23614 } 23615 if (!string || !(chars = baseToString(chars))) { 23616 return string; 23617 } 23618 var strSymbols = stringToArray(string), 23619 end = charsEndIndex(strSymbols, stringToArray(chars)) + 1; 23620 23621 return castSlice(strSymbols, 0, end).join(''); 23622 } 23623 23624 /** 23625 * Removes leading whitespace or specified characters from `string`. 23626 * 23627 * @static 23628 * @memberOf _ 23629 * @since 4.0.0 23630 * @category String 23631 * @param {string} [string=''] The string to trim. 23632 * @param {string} [chars=whitespace] The characters to trim. 23633 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 23634 * @returns {string} Returns the trimmed string. 23635 * @example 23636 * 23637 * _.trimStart(' abc '); 23638 * // => 'abc ' 23639 * 23640 * _.trimStart('-_-abc-_-', '_-'); 23641 * // => 'abc-_-' 23642 */ 23643 function trimStart(string, chars, guard) { 23644 string = toString(string); 23645 if (string && (guard || chars === undefined)) { 23646 return string.replace(reTrimStart, ''); 23647 } 23648 if (!string || !(chars = baseToString(chars))) { 23649 return string; 23650 } 23651 var strSymbols = stringToArray(string), 23652 start = charsStartIndex(strSymbols, stringToArray(chars)); 23653 23654 return castSlice(strSymbols, start).join(''); 23655 } 23656 23657 /** 23658 * Truncates `string` if it's longer than the given maximum string length. 23659 * The last characters of the truncated string are replaced with the omission 23660 * string which defaults to "...". 23661 * 23662 * @static 23663 * @memberOf _ 23664 * @since 4.0.0 23665 * @category String 23666 * @param {string} [string=''] The string to truncate. 23667 * @param {Object} [options={}] The options object. 23668 * @param {number} [options.length=30] The maximum string length. 23669 * @param {string} [options.omission='...'] The string to indicate text is omitted. 23670 * @param {RegExp|string} [options.separator] The separator pattern to truncate to. 23671 * @returns {string} Returns the truncated string. 23672 * @example 23673 * 23674 * _.truncate('hi-diddly-ho there, neighborino'); 23675 * // => 'hi-diddly-ho there, neighbo...' 23676 * 23677 * _.truncate('hi-diddly-ho there, neighborino', { 23678 * 'length': 24, 23679 * 'separator': ' ' 23680 * }); 23681 * // => 'hi-diddly-ho there,...' 23682 * 23683 * _.truncate('hi-diddly-ho there, neighborino', { 23684 * 'length': 24, 23685 * 'separator': /,? +/ 23686 * }); 23687 * // => 'hi-diddly-ho there...' 23688 * 23689 * _.truncate('hi-diddly-ho there, neighborino', { 23690 * 'omission': ' [...]' 23691 * }); 23692 * // => 'hi-diddly-ho there, neig [...]' 23693 */ 23694 function truncate(string, options) { 23695 var length = DEFAULT_TRUNC_LENGTH, 23696 omission = DEFAULT_TRUNC_OMISSION; 23697 23698 if (isObject(options)) { 23699 var separator = 'separator' in options ? options.separator : separator; 23700 length = 'length' in options ? toInteger(options.length) : length; 23701 omission = 'omission' in options ? baseToString(options.omission) : omission; 23702 } 23703 string = toString(string); 23704 23705 var strLength = string.length; 23706 if (hasUnicode(string)) { 23707 var strSymbols = stringToArray(string); 23708 strLength = strSymbols.length; 23709 } 23710 if (length >= strLength) { 23711 return string; 23712 } 23713 var end = length - stringSize(omission); 23714 if (end < 1) { 23715 return omission; 23716 } 23717 var result = strSymbols 23718 ? castSlice(strSymbols, 0, end).join('') 23719 : string.slice(0, end); 23720 23721 if (separator === undefined) { 23722 return result + omission; 23723 } 23724 if (strSymbols) { 23725 end += (result.length - end); 23726 } 23727 if (isRegExp(separator)) { 23728 if (string.slice(end).search(separator)) { 23729 var match, 23730 substring = result; 23731 23732 if (!separator.global) { 23733 separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g'); 23734 } 23735 separator.lastIndex = 0; 23736 while ((match = separator.exec(substring))) { 23737 var newEnd = match.index; 23738 } 23739 result = result.slice(0, newEnd === undefined ? end : newEnd); 23740 } 23741 } else if (string.indexOf(baseToString(separator), end) != end) { 23742 var index = result.lastIndexOf(separator); 23743 if (index > -1) { 23744 result = result.slice(0, index); 23745 } 23746 } 23747 return result + omission; 23748 } 23749 23750 /** 23751 * The inverse of `_.escape`; this method converts the HTML entities 23752 * `&`, `<`, `>`, `"`, and `'` in `string` to 23753 * their corresponding characters. 23754 * 23755 * **Note:** No other HTML entities are unescaped. To unescape additional 23756 * HTML entities use a third-party library like [_he_](https://mths.be/he). 23757 * 23758 * @static 23759 * @memberOf _ 23760 * @since 0.6.0 23761 * @category String 23762 * @param {string} [string=''] The string to unescape. 23763 * @returns {string} Returns the unescaped string. 23764 * @example 23765 * 23766 * _.unescape('fred, barney, & pebbles'); 23767 * // => 'fred, barney, & pebbles' 23768 */ 23769 function unescape(string) { 23770 string = toString(string); 23771 return (string && reHasEscapedHtml.test(string)) 23772 ? string.replace(reEscapedHtml, unescapeHtmlChar) 23773 : string; 23774 } 23775 23776 /** 23777 * Converts `string`, as space separated words, to upper case. 23778 * 23779 * @static 23780 * @memberOf _ 23781 * @since 4.0.0 23782 * @category String 23783 * @param {string} [string=''] The string to convert. 23784 * @returns {string} Returns the upper cased string. 23785 * @example 23786 * 23787 * _.upperCase('--foo-bar'); 23788 * // => 'FOO BAR' 23789 * 23790 * _.upperCase('fooBar'); 23791 * // => 'FOO BAR' 23792 * 23793 * _.upperCase('__foo_bar__'); 23794 * // => 'FOO BAR' 23795 */ 23796 var upperCase = createCompounder(function(result, word, index) { 23797 return result + (index ? ' ' : '') + word.toUpperCase(); 23798 }); 23799 23800 /** 23801 * Converts the first character of `string` to upper case. 23802 * 23803 * @static 23804 * @memberOf _ 23805 * @since 4.0.0 23806 * @category String 23807 * @param {string} [string=''] The string to convert. 23808 * @returns {string} Returns the converted string. 23809 * @example 23810 * 23811 * _.upperFirst('fred'); 23812 * // => 'Fred' 23813 * 23814 * _.upperFirst('FRED'); 23815 * // => 'FRED' 23816 */ 23817 var upperFirst = createCaseFirst('toUpperCase'); 23818 23819 /** 23820 * Splits `string` into an array of its words. 23821 * 23822 * @static 23823 * @memberOf _ 23824 * @since 3.0.0 23825 * @category String 23826 * @param {string} [string=''] The string to inspect. 23827 * @param {RegExp|string} [pattern] The pattern to match words. 23828 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 23829 * @returns {Array} Returns the words of `string`. 23830 * @example 23831 * 23832 * _.words('fred, barney, & pebbles'); 23833 * // => ['fred', 'barney', 'pebbles'] 23834 * 23835 * _.words('fred, barney, & pebbles', /[^, ]+/g); 23836 * // => ['fred', 'barney', '&', 'pebbles'] 23837 */ 23838 function words(string, pattern, guard) { 23839 string = toString(string); 23840 pattern = guard ? undefined : pattern; 23841 23842 if (pattern === undefined) { 23843 return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); 23844 } 23845 return string.match(pattern) || []; 23846 } 23847 23848 /*------------------------------------------------------------------------*/ 23849 23850 /** 23851 * Attempts to invoke `func`, returning either the result or the caught error 23852 * object. Any additional arguments are provided to `func` when it's invoked. 23853 * 23854 * @static 23855 * @memberOf _ 23856 * @since 3.0.0 23857 * @category Util 23858 * @param {Function} func The function to attempt. 23859 * @param {...*} [args] The arguments to invoke `func` with. 23860 * @returns {*} Returns the `func` result or error object. 23861 * @example 23862 * 23863 * // Avoid throwing errors for invalid selectors. 23864 * var elements = _.attempt(function(selector) { 23865 * return document.querySelectorAll(selector); 23866 * }, '>_>'); 23867 * 23868 * if (_.isError(elements)) { 23869 * elements = []; 23870 * } 23871 */ 23872 var attempt = baseRest(function(func, args) { 23873 try { 23874 return apply(func, undefined, args); 23875 } catch (e) { 23876 return isError(e) ? e : new Error(e); 23877 } 23878 }); 23879 23880 /** 23881 * Binds methods of an object to the object itself, overwriting the existing 23882 * method. 23883 * 23884 * **Note:** This method doesn't set the "length" property of bound functions. 23885 * 23886 * @static 23887 * @since 0.1.0 23888 * @memberOf _ 23889 * @category Util 23890 * @param {Object} object The object to bind and assign the bound methods to. 23891 * @param {...(string|string[])} methodNames The object method names to bind. 23892 * @returns {Object} Returns `object`. 23893 * @example 23894 * 23895 * var view = { 23896 * 'label': 'docs', 23897 * 'click': function() { 23898 * console.log('clicked ' + this.label); 23899 * } 23900 * }; 23901 * 23902 * _.bindAll(view, ['click']); 23903 * jQuery(element).on('click', view.click); 23904 * // => Logs 'clicked docs' when clicked. 23905 */ 23906 var bindAll = flatRest(function(object, methodNames) { 23907 arrayEach(methodNames, function(key) { 23908 key = toKey(key); 23909 baseAssignValue(object, key, bind(object[key], object)); 23910 }); 23911 return object; 23912 }); 23913 23914 /** 23915 * Creates a function that iterates over `pairs` and invokes the corresponding 23916 * function of the first predicate to return truthy. The predicate-function 23917 * pairs are invoked with the `this` binding and arguments of the created 23918 * function. 23919 * 23920 * @static 23921 * @memberOf _ 23922 * @since 4.0.0 23923 * @category Util 23924 * @param {Array} pairs The predicate-function pairs. 23925 * @returns {Function} Returns the new composite function. 23926 * @example 23927 * 23928 * var func = _.cond([ 23929 * [_.matches({ 'a': 1 }), _.constant('matches A')], 23930 * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')], 23931 * [_.stubTrue, _.constant('no match')] 23932 * ]); 23933 * 23934 * func({ 'a': 1, 'b': 2 }); 23935 * // => 'matches A' 23936 * 23937 * func({ 'a': 0, 'b': 1 }); 23938 * // => 'matches B' 23939 * 23940 * func({ 'a': '1', 'b': '2' }); 23941 * // => 'no match' 23942 */ 23943 function cond(pairs) { 23944 var length = pairs == null ? 0 : pairs.length, 23945 toIteratee = getIteratee(); 23946 23947 pairs = !length ? [] : arrayMap(pairs, function(pair) { 23948 if (typeof pair[1] != 'function') { 23949 throw new TypeError(FUNC_ERROR_TEXT); 23950 } 23951 return [toIteratee(pair[0]), pair[1]]; 23952 }); 23953 23954 return baseRest(function(args) { 23955 var index = -1; 23956 while (++index < length) { 23957 var pair = pairs[index]; 23958 if (apply(pair[0], this, args)) { 23959 return apply(pair[1], this, args); 23960 } 23961 } 23962 }); 23963 } 23964 23965 /** 23966 * Creates a function that invokes the predicate properties of `source` with 23967 * the corresponding property values of a given object, returning `true` if 23968 * all predicates return truthy, else `false`. 23969 * 23970 * **Note:** The created function is equivalent to `_.conformsTo` with 23971 * `source` partially applied. 23972 * 23973 * @static 23974 * @memberOf _ 23975 * @since 4.0.0 23976 * @category Util 23977 * @param {Object} source The object of property predicates to conform to. 23978 * @returns {Function} Returns the new spec function. 23979 * @example 23980 * 23981 * var objects = [ 23982 * { 'a': 2, 'b': 1 }, 23983 * { 'a': 1, 'b': 2 } 23984 * ]; 23985 * 23986 * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } })); 23987 * // => [{ 'a': 1, 'b': 2 }] 23988 */ 23989 function conforms(source) { 23990 return baseConforms(baseClone(source, CLONE_DEEP_FLAG)); 23991 } 23992 23993 /** 23994 * Creates a function that returns `value`. 23995 * 23996 * @static 23997 * @memberOf _ 23998 * @since 2.4.0 23999 * @category Util 24000 * @param {*} value The value to return from the new function. 24001 * @returns {Function} Returns the new constant function. 24002 * @example 24003 * 24004 * var objects = _.times(2, _.constant({ 'a': 1 })); 24005 * 24006 * console.log(objects); 24007 * // => [{ 'a': 1 }, { 'a': 1 }] 24008 * 24009 * console.log(objects[0] === objects[1]); 24010 * // => true 24011 */ 24012 function constant(value) { 24013 return function() { 24014 return value; 24015 }; 24016 } 24017 24018 /** 24019 * Checks `value` to determine whether a default value should be returned in 24020 * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, 24021 * or `undefined`. 24022 * 24023 * @static 24024 * @memberOf _ 24025 * @since 4.14.0 24026 * @category Util 24027 * @param {*} value The value to check. 24028 * @param {*} defaultValue The default value. 24029 * @returns {*} Returns the resolved value. 24030 * @example 24031 * 24032 * _.defaultTo(1, 10); 24033 * // => 1 24034 * 24035 * _.defaultTo(undefined, 10); 24036 * // => 10 24037 */ 24038 function defaultTo(value, defaultValue) { 24039 return (value == null || value !== value) ? defaultValue : value; 24040 } 24041 24042 /** 24043 * Creates a function that returns the result of invoking the given functions 24044 * with the `this` binding of the created function, where each successive 24045 * invocation is supplied the return value of the previous. 24046 * 24047 * @static 24048 * @memberOf _ 24049 * @since 3.0.0 24050 * @category Util 24051 * @param {...(Function|Function[])} [funcs] The functions to invoke. 24052 * @returns {Function} Returns the new composite function. 24053 * @see _.flowRight 24054 * @example 24055 * 24056 * function square(n) { 24057 * return n * n; 24058 * } 24059 * 24060 * var addSquare = _.flow([_.add, square]); 24061 * addSquare(1, 2); 24062 * // => 9 24063 */ 24064 var flow = createFlow(); 24065 24066 /** 24067 * This method is like `_.flow` except that it creates a function that 24068 * invokes the given functions from right to left. 24069 * 24070 * @static 24071 * @since 3.0.0 24072 * @memberOf _ 24073 * @category Util 24074 * @param {...(Function|Function[])} [funcs] The functions to invoke. 24075 * @returns {Function} Returns the new composite function. 24076 * @see _.flow 24077 * @example 24078 * 24079 * function square(n) { 24080 * return n * n; 24081 * } 24082 * 24083 * var addSquare = _.flowRight([square, _.add]); 24084 * addSquare(1, 2); 24085 * // => 9 24086 */ 24087 var flowRight = createFlow(true); 24088 24089 /** 24090 * This method returns the first argument it receives. 24091 * 24092 * @static 24093 * @since 0.1.0 24094 * @memberOf _ 24095 * @category Util 24096 * @param {*} value Any value. 24097 * @returns {*} Returns `value`. 24098 * @example 24099 * 24100 * var object = { 'a': 1 }; 24101 * 24102 * console.log(_.identity(object) === object); 24103 * // => true 24104 */ 24105 function identity(value) { 24106 return value; 24107 } 24108 24109 /** 24110 * Creates a function that invokes `func` with the arguments of the created 24111 * function. If `func` is a property name, the created function returns the 24112 * property value for a given element. If `func` is an array or object, the 24113 * created function returns `true` for elements that contain the equivalent 24114 * source properties, otherwise it returns `false`. 24115 * 24116 * @static 24117 * @since 4.0.0 24118 * @memberOf _ 24119 * @category Util 24120 * @param {*} [func=_.identity] The value to convert to a callback. 24121 * @returns {Function} Returns the callback. 24122 * @example 24123 * 24124 * var users = [ 24125 * { 'user': 'barney', 'age': 36, 'active': true }, 24126 * { 'user': 'fred', 'age': 40, 'active': false } 24127 * ]; 24128 * 24129 * // The `_.matches` iteratee shorthand. 24130 * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true })); 24131 * // => [{ 'user': 'barney', 'age': 36, 'active': true }] 24132 * 24133 * // The `_.matchesProperty` iteratee shorthand. 24134 * _.filter(users, _.iteratee(['user', 'fred'])); 24135 * // => [{ 'user': 'fred', 'age': 40 }] 24136 * 24137 * // The `_.property` iteratee shorthand. 24138 * _.map(users, _.iteratee('user')); 24139 * // => ['barney', 'fred'] 24140 * 24141 * // Create custom iteratee shorthands. 24142 * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) { 24143 * return !_.isRegExp(func) ? iteratee(func) : function(string) { 24144 * return func.test(string); 24145 * }; 24146 * }); 24147 * 24148 * _.filter(['abc', 'def'], /ef/); 24149 * // => ['def'] 24150 */ 24151 function iteratee(func) { 24152 return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG)); 24153 } 24154 24155 /** 24156 * Creates a function that performs a partial deep comparison between a given 24157 * object and `source`, returning `true` if the given object has equivalent 24158 * property values, else `false`. 24159 * 24160 * **Note:** The created function is equivalent to `_.isMatch` with `source` 24161 * partially applied. 24162 * 24163 * Partial comparisons will match empty array and empty object `source` 24164 * values against any array or object value, respectively. See `_.isEqual` 24165 * for a list of supported value comparisons. 24166 * 24167 * **Note:** Multiple values can be checked by combining several matchers 24168 * using `_.overSome` 24169 * 24170 * @static 24171 * @memberOf _ 24172 * @since 3.0.0 24173 * @category Util 24174 * @param {Object} source The object of property values to match. 24175 * @returns {Function} Returns the new spec function. 24176 * @example 24177 * 24178 * var objects = [ 24179 * { 'a': 1, 'b': 2, 'c': 3 }, 24180 * { 'a': 4, 'b': 5, 'c': 6 } 24181 * ]; 24182 * 24183 * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); 24184 * // => [{ 'a': 4, 'b': 5, 'c': 6 }] 24185 * 24186 * // Checking for several possible values 24187 * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })])); 24188 * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] 24189 */ 24190 function matches(source) { 24191 return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); 24192 } 24193 24194 /** 24195 * Creates a function that performs a partial deep comparison between the 24196 * value at `path` of a given object to `srcValue`, returning `true` if the 24197 * object value is equivalent, else `false`. 24198 * 24199 * **Note:** Partial comparisons will match empty array and empty object 24200 * `srcValue` values against any array or object value, respectively. See 24201 * `_.isEqual` for a list of supported value comparisons. 24202 * 24203 * **Note:** Multiple values can be checked by combining several matchers 24204 * using `_.overSome` 24205 * 24206 * @static 24207 * @memberOf _ 24208 * @since 3.2.0 24209 * @category Util 24210 * @param {Array|string} path The path of the property to get. 24211 * @param {*} srcValue The value to match. 24212 * @returns {Function} Returns the new spec function. 24213 * @example 24214 * 24215 * var objects = [ 24216 * { 'a': 1, 'b': 2, 'c': 3 }, 24217 * { 'a': 4, 'b': 5, 'c': 6 } 24218 * ]; 24219 * 24220 * _.find(objects, _.matchesProperty('a', 4)); 24221 * // => { 'a': 4, 'b': 5, 'c': 6 } 24222 * 24223 * // Checking for several possible values 24224 * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)])); 24225 * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }] 24226 */ 24227 function matchesProperty(path, srcValue) { 24228 return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); 24229 } 24230 24231 /** 24232 * Creates a function that invokes the method at `path` of a given object. 24233 * Any additional arguments are provided to the invoked method. 24234 * 24235 * @static 24236 * @memberOf _ 24237 * @since 3.7.0 24238 * @category Util 24239 * @param {Array|string} path The path of the method to invoke. 24240 * @param {...*} [args] The arguments to invoke the method with. 24241 * @returns {Function} Returns the new invoker function. 24242 * @example 24243 * 24244 * var objects = [ 24245 * { 'a': { 'b': _.constant(2) } }, 24246 * { 'a': { 'b': _.constant(1) } } 24247 * ]; 24248 * 24249 * _.map(objects, _.method('a.b')); 24250 * // => [2, 1] 24251 * 24252 * _.map(objects, _.method(['a', 'b'])); 24253 * // => [2, 1] 24254 */ 24255 var method = baseRest(function(path, args) { 24256 return function(object) { 24257 return baseInvoke(object, path, args); 24258 }; 24259 }); 24260 24261 /** 24262 * The opposite of `_.method`; this method creates a function that invokes 24263 * the method at a given path of `object`. Any additional arguments are 24264 * provided to the invoked method. 24265 * 24266 * @static 24267 * @memberOf _ 24268 * @since 3.7.0 24269 * @category Util 24270 * @param {Object} object The object to query. 24271 * @param {...*} [args] The arguments to invoke the method with. 24272 * @returns {Function} Returns the new invoker function. 24273 * @example 24274 * 24275 * var array = _.times(3, _.constant), 24276 * object = { 'a': array, 'b': array, 'c': array }; 24277 * 24278 * _.map(['a[2]', 'c[0]'], _.methodOf(object)); 24279 * // => [2, 0] 24280 * 24281 * _.map([['a', '2'], ['c', '0']], _.methodOf(object)); 24282 * // => [2, 0] 24283 */ 24284 var methodOf = baseRest(function(object, args) { 24285 return function(path) { 24286 return baseInvoke(object, path, args); 24287 }; 24288 }); 24289 24290 /** 24291 * Adds all own enumerable string keyed function properties of a source 24292 * object to the destination object. If `object` is a function, then methods 24293 * are added to its prototype as well. 24294 * 24295 * **Note:** Use `_.runInContext` to create a pristine `lodash` function to 24296 * avoid conflicts caused by modifying the original. 24297 * 24298 * @static 24299 * @since 0.1.0 24300 * @memberOf _ 24301 * @category Util 24302 * @param {Function|Object} [object=lodash] The destination object. 24303 * @param {Object} source The object of functions to add. 24304 * @param {Object} [options={}] The options object. 24305 * @param {boolean} [options.chain=true] Specify whether mixins are chainable. 24306 * @returns {Function|Object} Returns `object`. 24307 * @example 24308 * 24309 * function vowels(string) { 24310 * return _.filter(string, function(v) { 24311 * return /[aeiou]/i.test(v); 24312 * }); 24313 * } 24314 * 24315 * _.mixin({ 'vowels': vowels }); 24316 * _.vowels('fred'); 24317 * // => ['e'] 24318 * 24319 * _('fred').vowels().value(); 24320 * // => ['e'] 24321 * 24322 * _.mixin({ 'vowels': vowels }, { 'chain': false }); 24323 * _('fred').vowels(); 24324 * // => ['e'] 24325 */ 24326 function mixin(object, source, options) { 24327 var props = keys(source), 24328 methodNames = baseFunctions(source, props); 24329 24330 if (options == null && 24331 !(isObject(source) && (methodNames.length || !props.length))) { 24332 options = source; 24333 source = object; 24334 object = this; 24335 methodNames = baseFunctions(source, keys(source)); 24336 } 24337 var chain = !(isObject(options) && 'chain' in options) || !!options.chain, 24338 isFunc = isFunction(object); 24339 24340 arrayEach(methodNames, function(methodName) { 24341 var func = source[methodName]; 24342 object[methodName] = func; 24343 if (isFunc) { 24344 object.prototype[methodName] = function() { 24345 var chainAll = this.__chain__; 24346 if (chain || chainAll) { 24347 var result = object(this.__wrapped__), 24348 actions = result.__actions__ = copyArray(this.__actions__); 24349 24350 actions.push({ 'func': func, 'args': arguments, 'thisArg': object }); 24351 result.__chain__ = chainAll; 24352 return result; 24353 } 24354 return func.apply(object, arrayPush([this.value()], arguments)); 24355 }; 24356 } 24357 }); 24358 24359 return object; 24360 } 24361 24362 /** 24363 * Reverts the `_` variable to its previous value and returns a reference to 24364 * the `lodash` function. 24365 * 24366 * @static 24367 * @since 0.1.0 24368 * @memberOf _ 24369 * @category Util 24370 * @returns {Function} Returns the `lodash` function. 24371 * @example 24372 * 24373 * var lodash = _.noConflict(); 24374 */ 24375 function noConflict() { 24376 if (root._ === this) { 24377 root._ = oldDash; 24378 } 24379 return this; 24380 } 24381 24382 /** 24383 * This method returns `undefined`. 24384 * 24385 * @static 24386 * @memberOf _ 24387 * @since 2.3.0 24388 * @category Util 24389 * @example 24390 * 24391 * _.times(2, _.noop); 24392 * // => [undefined, undefined] 24393 */ 24394 function noop() { 24395 // No operation performed. 24396 } 24397 24398 /** 24399 * Creates a function that gets the argument at index `n`. If `n` is negative, 24400 * the nth argument from the end is returned. 24401 * 24402 * @static 24403 * @memberOf _ 24404 * @since 4.0.0 24405 * @category Util 24406 * @param {number} [n=0] The index of the argument to return. 24407 * @returns {Function} Returns the new pass-thru function. 24408 * @example 24409 * 24410 * var func = _.nthArg(1); 24411 * func('a', 'b', 'c', 'd'); 24412 * // => 'b' 24413 * 24414 * var func = _.nthArg(-2); 24415 * func('a', 'b', 'c', 'd'); 24416 * // => 'c' 24417 */ 24418 function nthArg(n) { 24419 n = toInteger(n); 24420 return baseRest(function(args) { 24421 return baseNth(args, n); 24422 }); 24423 } 24424 24425 /** 24426 * Creates a function that invokes `iteratees` with the arguments it receives 24427 * and returns their results. 24428 * 24429 * @static 24430 * @memberOf _ 24431 * @since 4.0.0 24432 * @category Util 24433 * @param {...(Function|Function[])} [iteratees=[_.identity]] 24434 * The iteratees to invoke. 24435 * @returns {Function} Returns the new function. 24436 * @example 24437 * 24438 * var func = _.over([Math.max, Math.min]); 24439 * 24440 * func(1, 2, 3, 4); 24441 * // => [4, 1] 24442 */ 24443 var over = createOver(arrayMap); 24444 24445 /** 24446 * Creates a function that checks if **all** of the `predicates` return 24447 * truthy when invoked with the arguments it receives. 24448 * 24449 * Following shorthands are possible for providing predicates. 24450 * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate. 24451 * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them. 24452 * 24453 * @static 24454 * @memberOf _ 24455 * @since 4.0.0 24456 * @category Util 24457 * @param {...(Function|Function[])} [predicates=[_.identity]] 24458 * The predicates to check. 24459 * @returns {Function} Returns the new function. 24460 * @example 24461 * 24462 * var func = _.overEvery([Boolean, isFinite]); 24463 * 24464 * func('1'); 24465 * // => true 24466 * 24467 * func(null); 24468 * // => false 24469 * 24470 * func(NaN); 24471 * // => false 24472 */ 24473 var overEvery = createOver(arrayEvery); 24474 24475 /** 24476 * Creates a function that checks if **any** of the `predicates` return 24477 * truthy when invoked with the arguments it receives. 24478 * 24479 * Following shorthands are possible for providing predicates. 24480 * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate. 24481 * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them. 24482 * 24483 * @static 24484 * @memberOf _ 24485 * @since 4.0.0 24486 * @category Util 24487 * @param {...(Function|Function[])} [predicates=[_.identity]] 24488 * The predicates to check. 24489 * @returns {Function} Returns the new function. 24490 * @example 24491 * 24492 * var func = _.overSome([Boolean, isFinite]); 24493 * 24494 * func('1'); 24495 * // => true 24496 * 24497 * func(null); 24498 * // => true 24499 * 24500 * func(NaN); 24501 * // => false 24502 * 24503 * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }]) 24504 * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]]) 24505 */ 24506 var overSome = createOver(arraySome); 24507 24508 /** 24509 * Creates a function that returns the value at `path` of a given object. 24510 * 24511 * @static 24512 * @memberOf _ 24513 * @since 2.4.0 24514 * @category Util 24515 * @param {Array|string} path The path of the property to get. 24516 * @returns {Function} Returns the new accessor function. 24517 * @example 24518 * 24519 * var objects = [ 24520 * { 'a': { 'b': 2 } }, 24521 * { 'a': { 'b': 1 } } 24522 * ]; 24523 * 24524 * _.map(objects, _.property('a.b')); 24525 * // => [2, 1] 24526 * 24527 * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); 24528 * // => [1, 2] 24529 */ 24530 function property(path) { 24531 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); 24532 } 24533 24534 /** 24535 * The opposite of `_.property`; this method creates a function that returns 24536 * the value at a given path of `object`. 24537 * 24538 * @static 24539 * @memberOf _ 24540 * @since 3.0.0 24541 * @category Util 24542 * @param {Object} object The object to query. 24543 * @returns {Function} Returns the new accessor function. 24544 * @example 24545 * 24546 * var array = [0, 1, 2], 24547 * object = { 'a': array, 'b': array, 'c': array }; 24548 * 24549 * _.map(['a[2]', 'c[0]'], _.propertyOf(object)); 24550 * // => [2, 0] 24551 * 24552 * _.map([['a', '2'], ['c', '0']], _.propertyOf(object)); 24553 * // => [2, 0] 24554 */ 24555 function propertyOf(object) { 24556 return function(path) { 24557 return object == null ? undefined : baseGet(object, path); 24558 }; 24559 } 24560 24561 /** 24562 * Creates an array of numbers (positive and/or negative) progressing from 24563 * `start` up to, but not including, `end`. A step of `-1` is used if a negative 24564 * `start` is specified without an `end` or `step`. If `end` is not specified, 24565 * it's set to `start` with `start` then set to `0`. 24566 * 24567 * **Note:** JavaScript follows the IEEE-754 standard for resolving 24568 * floating-point values which can produce unexpected results. 24569 * 24570 * @static 24571 * @since 0.1.0 24572 * @memberOf _ 24573 * @category Util 24574 * @param {number} [start=0] The start of the range. 24575 * @param {number} end The end of the range. 24576 * @param {number} [step=1] The value to increment or decrement by. 24577 * @returns {Array} Returns the range of numbers. 24578 * @see _.inRange, _.rangeRight 24579 * @example 24580 * 24581 * _.range(4); 24582 * // => [0, 1, 2, 3] 24583 * 24584 * _.range(-4); 24585 * // => [0, -1, -2, -3] 24586 * 24587 * _.range(1, 5); 24588 * // => [1, 2, 3, 4] 24589 * 24590 * _.range(0, 20, 5); 24591 * // => [0, 5, 10, 15] 24592 * 24593 * _.range(0, -4, -1); 24594 * // => [0, -1, -2, -3] 24595 * 24596 * _.range(1, 4, 0); 24597 * // => [1, 1, 1] 24598 * 24599 * _.range(0); 24600 * // => [] 24601 */ 24602 var range = createRange(); 24603 24604 /** 24605 * This method is like `_.range` except that it populates values in 24606 * descending order. 24607 * 24608 * @static 24609 * @memberOf _ 24610 * @since 4.0.0 24611 * @category Util 24612 * @param {number} [start=0] The start of the range. 24613 * @param {number} end The end of the range. 24614 * @param {number} [step=1] The value to increment or decrement by. 24615 * @returns {Array} Returns the range of numbers. 24616 * @see _.inRange, _.range 24617 * @example 24618 * 24619 * _.rangeRight(4); 24620 * // => [3, 2, 1, 0] 24621 * 24622 * _.rangeRight(-4); 24623 * // => [-3, -2, -1, 0] 24624 * 24625 * _.rangeRight(1, 5); 24626 * // => [4, 3, 2, 1] 24627 * 24628 * _.rangeRight(0, 20, 5); 24629 * // => [15, 10, 5, 0] 24630 * 24631 * _.rangeRight(0, -4, -1); 24632 * // => [-3, -2, -1, 0] 24633 * 24634 * _.rangeRight(1, 4, 0); 24635 * // => [1, 1, 1] 24636 * 24637 * _.rangeRight(0); 24638 * // => [] 24639 */ 24640 var rangeRight = createRange(true); 24641 24642 /** 24643 * This method returns a new empty array. 24644 * 24645 * @static 24646 * @memberOf _ 24647 * @since 4.13.0 24648 * @category Util 24649 * @returns {Array} Returns the new empty array. 24650 * @example 24651 * 24652 * var arrays = _.times(2, _.stubArray); 24653 * 24654 * console.log(arrays); 24655 * // => [[], []] 24656 * 24657 * console.log(arrays[0] === arrays[1]); 24658 * // => false 24659 */ 24660 function stubArray() { 24661 return []; 24662 } 24663 24664 /** 24665 * This method returns `false`. 24666 * 24667 * @static 24668 * @memberOf _ 24669 * @since 4.13.0 24670 * @category Util 24671 * @returns {boolean} Returns `false`. 24672 * @example 24673 * 24674 * _.times(2, _.stubFalse); 24675 * // => [false, false] 24676 */ 24677 function stubFalse() { 24678 return false; 24679 } 24680 24681 /** 24682 * This method returns a new empty object. 24683 * 24684 * @static 24685 * @memberOf _ 24686 * @since 4.13.0 24687 * @category Util 24688 * @returns {Object} Returns the new empty object. 24689 * @example 24690 * 24691 * var objects = _.times(2, _.stubObject); 24692 * 24693 * console.log(objects); 24694 * // => [{}, {}] 24695 * 24696 * console.log(objects[0] === objects[1]); 24697 * // => false 24698 */ 24699 function stubObject() { 24700 return {}; 24701 } 24702 24703 /** 24704 * This method returns an empty string. 24705 * 24706 * @static 24707 * @memberOf _ 24708 * @since 4.13.0 24709 * @category Util 24710 * @returns {string} Returns the empty string. 24711 * @example 24712 * 24713 * _.times(2, _.stubString); 24714 * // => ['', ''] 24715 */ 24716 function stubString() { 24717 return ''; 24718 } 24719 24720 /** 24721 * This method returns `true`. 24722 * 24723 * @static 24724 * @memberOf _ 24725 * @since 4.13.0 24726 * @category Util 24727 * @returns {boolean} Returns `true`. 24728 * @example 24729 * 24730 * _.times(2, _.stubTrue); 24731 * // => [true, true] 24732 */ 24733 function stubTrue() { 24734 return true; 24735 } 24736 24737 /** 24738 * Invokes the iteratee `n` times, returning an array of the results of 24739 * each invocation. The iteratee is invoked with one argument; (index). 24740 * 24741 * @static 24742 * @since 0.1.0 24743 * @memberOf _ 24744 * @category Util 24745 * @param {number} n The number of times to invoke `iteratee`. 24746 * @param {Function} [iteratee=_.identity] The function invoked per iteration. 24747 * @returns {Array} Returns the array of results. 24748 * @example 24749 * 24750 * _.times(3, String); 24751 * // => ['0', '1', '2'] 24752 * 24753 * _.times(4, _.constant(0)); 24754 * // => [0, 0, 0, 0] 24755 */ 24756 function times(n, iteratee) { 24757 n = toInteger(n); 24758 if (n < 1 || n > MAX_SAFE_INTEGER) { 24759 return []; 24760 } 24761 var index = MAX_ARRAY_LENGTH, 24762 length = nativeMin(n, MAX_ARRAY_LENGTH); 24763 24764 iteratee = getIteratee(iteratee); 24765 n -= MAX_ARRAY_LENGTH; 24766 24767 var result = baseTimes(length, iteratee); 24768 while (++index < n) { 24769 iteratee(index); 24770 } 24771 return result; 24772 } 24773 24774 /** 24775 * Converts `value` to a property path array. 24776 * 24777 * @static 24778 * @memberOf _ 24779 * @since 4.0.0 24780 * @category Util 24781 * @param {*} value The value to convert. 24782 * @returns {Array} Returns the new property path array. 24783 * @example 24784 * 24785 * _.toPath('a.b.c'); 24786 * // => ['a', 'b', 'c'] 24787 * 24788 * _.toPath('a[0].b.c'); 24789 * // => ['a', '0', 'b', 'c'] 24790 */ 24791 function toPath(value) { 24792 if (isArray(value)) { 24793 return arrayMap(value, toKey); 24794 } 24795 return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value))); 24796 } 24797 24798 /** 24799 * Generates a unique ID. If `prefix` is given, the ID is appended to it. 24800 * 24801 * @static 24802 * @since 0.1.0 24803 * @memberOf _ 24804 * @category Util 24805 * @param {string} [prefix=''] The value to prefix the ID with. 24806 * @returns {string} Returns the unique ID. 24807 * @example 24808 * 24809 * _.uniqueId('contact_'); 24810 * // => 'contact_104' 24811 * 24812 * _.uniqueId(); 24813 * // => '105' 24814 */ 24815 function uniqueId(prefix) { 24816 var id = ++idCounter; 24817 return toString(prefix) + id; 24818 } 24819 24820 /*------------------------------------------------------------------------*/ 24821 24822 /** 24823 * Adds two numbers. 24824 * 24825 * @static 24826 * @memberOf _ 24827 * @since 3.4.0 24828 * @category Math 24829 * @param {number} augend The first number in an addition. 24830 * @param {number} addend The second number in an addition. 24831 * @returns {number} Returns the total. 24832 * @example 24833 * 24834 * _.add(6, 4); 24835 * // => 10 24836 */ 24837 var add = createMathOperation(function(augend, addend) { 24838 return augend + addend; 24839 }, 0); 24840 24841 /** 24842 * Computes `number` rounded up to `precision`. 24843 * 24844 * @static 24845 * @memberOf _ 24846 * @since 3.10.0 24847 * @category Math 24848 * @param {number} number The number to round up. 24849 * @param {number} [precision=0] The precision to round up to. 24850 * @returns {number} Returns the rounded up number. 24851 * @example 24852 * 24853 * _.ceil(4.006); 24854 * // => 5 24855 * 24856 * _.ceil(6.004, 2); 24857 * // => 6.01 24858 * 24859 * _.ceil(6040, -2); 24860 * // => 6100 24861 */ 24862 var ceil = createRound('ceil'); 24863 24864 /** 24865 * Divide two numbers. 24866 * 24867 * @static 24868 * @memberOf _ 24869 * @since 4.7.0 24870 * @category Math 24871 * @param {number} dividend The first number in a division. 24872 * @param {number} divisor The second number in a division. 24873 * @returns {number} Returns the quotient. 24874 * @example 24875 * 24876 * _.divide(6, 4); 24877 * // => 1.5 24878 */ 24879 var divide = createMathOperation(function(dividend, divisor) { 24880 return dividend / divisor; 24881 }, 1); 24882 24883 /** 24884 * Computes `number` rounded down to `precision`. 24885 * 24886 * @static 24887 * @memberOf _ 24888 * @since 3.10.0 24889 * @category Math 24890 * @param {number} number The number to round down. 24891 * @param {number} [precision=0] The precision to round down to. 24892 * @returns {number} Returns the rounded down number. 24893 * @example 24894 * 24895 * _.floor(4.006); 24896 * // => 4 24897 * 24898 * _.floor(0.046, 2); 24899 * // => 0.04 24900 * 24901 * _.floor(4060, -2); 24902 * // => 4000 24903 */ 24904 var floor = createRound('floor'); 24905 24906 /** 24907 * Computes the maximum value of `array`. If `array` is empty or falsey, 24908 * `undefined` is returned. 24909 * 24910 * @static 24911 * @since 0.1.0 24912 * @memberOf _ 24913 * @category Math 24914 * @param {Array} array The array to iterate over. 24915 * @returns {*} Returns the maximum value. 24916 * @example 24917 * 24918 * _.max([4, 2, 8, 6]); 24919 * // => 8 24920 * 24921 * _.max([]); 24922 * // => undefined 24923 */ 24924 function max(array) { 24925 return (array && array.length) 24926 ? baseExtremum(array, identity, baseGt) 24927 : undefined; 24928 } 24929 24930 /** 24931 * This method is like `_.max` except that it accepts `iteratee` which is 24932 * invoked for each element in `array` to generate the criterion by which 24933 * the value is ranked. The iteratee is invoked with one argument: (value). 24934 * 24935 * @static 24936 * @memberOf _ 24937 * @since 4.0.0 24938 * @category Math 24939 * @param {Array} array The array to iterate over. 24940 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 24941 * @returns {*} Returns the maximum value. 24942 * @example 24943 * 24944 * var objects = [{ 'n': 1 }, { 'n': 2 }]; 24945 * 24946 * _.maxBy(objects, function(o) { return o.n; }); 24947 * // => { 'n': 2 } 24948 * 24949 * // The `_.property` iteratee shorthand. 24950 * _.maxBy(objects, 'n'); 24951 * // => { 'n': 2 } 24952 */ 24953 function maxBy(array, iteratee) { 24954 return (array && array.length) 24955 ? baseExtremum(array, getIteratee(iteratee, 2), baseGt) 24956 : undefined; 24957 } 24958 24959 /** 24960 * Computes the mean of the values in `array`. 24961 * 24962 * @static 24963 * @memberOf _ 24964 * @since 4.0.0 24965 * @category Math 24966 * @param {Array} array The array to iterate over. 24967 * @returns {number} Returns the mean. 24968 * @example 24969 * 24970 * _.mean([4, 2, 8, 6]); 24971 * // => 5 24972 */ 24973 function mean(array) { 24974 return baseMean(array, identity); 24975 } 24976 24977 /** 24978 * This method is like `_.mean` except that it accepts `iteratee` which is 24979 * invoked for each element in `array` to generate the value to be averaged. 24980 * The iteratee is invoked with one argument: (value). 24981 * 24982 * @static 24983 * @memberOf _ 24984 * @since 4.7.0 24985 * @category Math 24986 * @param {Array} array The array to iterate over. 24987 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 24988 * @returns {number} Returns the mean. 24989 * @example 24990 * 24991 * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; 24992 * 24993 * _.meanBy(objects, function(o) { return o.n; }); 24994 * // => 5 24995 * 24996 * // The `_.property` iteratee shorthand. 24997 * _.meanBy(objects, 'n'); 24998 * // => 5 24999 */ 25000 function meanBy(array, iteratee) { 25001 return baseMean(array, getIteratee(iteratee, 2)); 25002 } 25003 25004 /** 25005 * Computes the minimum value of `array`. If `array` is empty or falsey, 25006 * `undefined` is returned. 25007 * 25008 * @static 25009 * @since 0.1.0 25010 * @memberOf _ 25011 * @category Math 25012 * @param {Array} array The array to iterate over. 25013 * @returns {*} Returns the minimum value. 25014 * @example 25015 * 25016 * _.min([4, 2, 8, 6]); 25017 * // => 2 25018 * 25019 * _.min([]); 25020 * // => undefined 25021 */ 25022 function min(array) { 25023 return (array && array.length) 25024 ? baseExtremum(array, identity, baseLt) 25025 : undefined; 25026 } 25027 25028 /** 25029 * This method is like `_.min` except that it accepts `iteratee` which is 25030 * invoked for each element in `array` to generate the criterion by which 25031 * the value is ranked. The iteratee is invoked with one argument: (value). 25032 * 25033 * @static 25034 * @memberOf _ 25035 * @since 4.0.0 25036 * @category Math 25037 * @param {Array} array The array to iterate over. 25038 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 25039 * @returns {*} Returns the minimum value. 25040 * @example 25041 * 25042 * var objects = [{ 'n': 1 }, { 'n': 2 }]; 25043 * 25044 * _.minBy(objects, function(o) { return o.n; }); 25045 * // => { 'n': 1 } 25046 * 25047 * // The `_.property` iteratee shorthand. 25048 * _.minBy(objects, 'n'); 25049 * // => { 'n': 1 } 25050 */ 25051 function minBy(array, iteratee) { 25052 return (array && array.length) 25053 ? baseExtremum(array, getIteratee(iteratee, 2), baseLt) 25054 : undefined; 25055 } 25056 25057 /** 25058 * Multiply two numbers. 25059 * 25060 * @static 25061 * @memberOf _ 25062 * @since 4.7.0 25063 * @category Math 25064 * @param {number} multiplier The first number in a multiplication. 25065 * @param {number} multiplicand The second number in a multiplication. 25066 * @returns {number} Returns the product. 25067 * @example 25068 * 25069 * _.multiply(6, 4); 25070 * // => 24 25071 */ 25072 var multiply = createMathOperation(function(multiplier, multiplicand) { 25073 return multiplier * multiplicand; 25074 }, 1); 25075 25076 /** 25077 * Computes `number` rounded to `precision`. 25078 * 25079 * @static 25080 * @memberOf _ 25081 * @since 3.10.0 25082 * @category Math 25083 * @param {number} number The number to round. 25084 * @param {number} [precision=0] The precision to round to. 25085 * @returns {number} Returns the rounded number. 25086 * @example 25087 * 25088 * _.round(4.006); 25089 * // => 4 25090 * 25091 * _.round(4.006, 2); 25092 * // => 4.01 25093 * 25094 * _.round(4060, -2); 25095 * // => 4100 25096 */ 25097 var round = createRound('round'); 25098 25099 /** 25100 * Subtract two numbers. 25101 * 25102 * @static 25103 * @memberOf _ 25104 * @since 4.0.0 25105 * @category Math 25106 * @param {number} minuend The first number in a subtraction. 25107 * @param {number} subtrahend The second number in a subtraction. 25108 * @returns {number} Returns the difference. 25109 * @example 25110 * 25111 * _.subtract(6, 4); 25112 * // => 2 25113 */ 25114 var subtract = createMathOperation(function(minuend, subtrahend) { 25115 return minuend - subtrahend; 25116 }, 0); 25117 25118 /** 25119 * Computes the sum of the values in `array`. 25120 * 25121 * @static 25122 * @memberOf _ 25123 * @since 3.4.0 25124 * @category Math 25125 * @param {Array} array The array to iterate over. 25126 * @returns {number} Returns the sum. 25127 * @example 25128 * 25129 * _.sum([4, 2, 8, 6]); 25130 * // => 20 25131 */ 25132 function sum(array) { 25133 return (array && array.length) 25134 ? baseSum(array, identity) 25135 : 0; 25136 } 25137 25138 /** 25139 * This method is like `_.sum` except that it accepts `iteratee` which is 25140 * invoked for each element in `array` to generate the value to be summed. 25141 * The iteratee is invoked with one argument: (value). 25142 * 25143 * @static 25144 * @memberOf _ 25145 * @since 4.0.0 25146 * @category Math 25147 * @param {Array} array The array to iterate over. 25148 * @param {Function} [iteratee=_.identity] The iteratee invoked per element. 25149 * @returns {number} Returns the sum. 25150 * @example 25151 * 25152 * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; 25153 * 25154 * _.sumBy(objects, function(o) { return o.n; }); 25155 * // => 20 25156 * 25157 * // The `_.property` iteratee shorthand. 25158 * _.sumBy(objects, 'n'); 25159 * // => 20 25160 */ 25161 function sumBy(array, iteratee) { 25162 return (array && array.length) 25163 ? baseSum(array, getIteratee(iteratee, 2)) 25164 : 0; 25165 } 25166 25167 /*------------------------------------------------------------------------*/ 25168 25169 // Add methods that return wrapped values in chain sequences. 25170 lodash.after = after; 25171 lodash.ary = ary; 25172 lodash.assign = assign; 25173 lodash.assignIn = assignIn; 25174 lodash.assignInWith = assignInWith; 25175 lodash.assignWith = assignWith; 25176 lodash.at = at; 25177 lodash.before = before; 25178 lodash.bind = bind; 25179 lodash.bindAll = bindAll; 25180 lodash.bindKey = bindKey; 25181 lodash.castArray = castArray; 25182 lodash.chain = chain; 25183 lodash.chunk = chunk; 25184 lodash.compact = compact; 25185 lodash.concat = concat; 25186 lodash.cond = cond; 25187 lodash.conforms = conforms; 25188 lodash.constant = constant; 25189 lodash.countBy = countBy; 25190 lodash.create = create; 25191 lodash.curry = curry; 25192 lodash.curryRight = curryRight; 25193 lodash.debounce = debounce; 25194 lodash.defaults = defaults; 25195 lodash.defaultsDeep = defaultsDeep; 25196 lodash.defer = defer; 25197 lodash.delay = delay; 25198 lodash.difference = difference; 25199 lodash.differenceBy = differenceBy; 25200 lodash.differenceWith = differenceWith; 25201 lodash.drop = drop; 25202 lodash.dropRight = dropRight; 25203 lodash.dropRightWhile = dropRightWhile; 25204 lodash.dropWhile = dropWhile; 25205 lodash.fill = fill; 25206 lodash.filter = filter; 25207 lodash.flatMap = flatMap; 25208 lodash.flatMapDeep = flatMapDeep; 25209 lodash.flatMapDepth = flatMapDepth; 25210 lodash.flatten = flatten; 25211 lodash.flattenDeep = flattenDeep; 25212 lodash.flattenDepth = flattenDepth; 25213 lodash.flip = flip; 25214 lodash.flow = flow; 25215 lodash.flowRight = flowRight; 25216 lodash.fromPairs = fromPairs; 25217 lodash.functions = functions; 25218 lodash.functionsIn = functionsIn; 25219 lodash.groupBy = groupBy; 25220 lodash.initial = initial; 25221 lodash.intersection = intersection; 25222 lodash.intersectionBy = intersectionBy; 25223 lodash.intersectionWith = intersectionWith; 25224 lodash.invert = invert; 25225 lodash.invertBy = invertBy; 25226 lodash.invokeMap = invokeMap; 25227 lodash.iteratee = iteratee; 25228 lodash.keyBy = keyBy; 25229 lodash.keys = keys; 25230 lodash.keysIn = keysIn; 25231 lodash.map = map; 25232 lodash.mapKeys = mapKeys; 25233 lodash.mapValues = mapValues; 25234 lodash.matches = matches; 25235 lodash.matchesProperty = matchesProperty; 25236 lodash.memoize = memoize; 25237 lodash.merge = merge; 25238 lodash.mergeWith = mergeWith; 25239 lodash.method = method; 25240 lodash.methodOf = methodOf; 25241 lodash.mixin = mixin; 25242 lodash.negate = negate; 25243 lodash.nthArg = nthArg; 25244 lodash.omit = omit; 25245 lodash.omitBy = omitBy; 25246 lodash.once = once; 25247 lodash.orderBy = orderBy; 25248 lodash.over = over; 25249 lodash.overArgs = overArgs; 25250 lodash.overEvery = overEvery; 25251 lodash.overSome = overSome; 25252 lodash.partial = partial; 25253 lodash.partialRight = partialRight; 25254 lodash.partition = partition; 25255 lodash.pick = pick; 25256 lodash.pickBy = pickBy; 25257 lodash.property = property; 25258 lodash.propertyOf = propertyOf; 25259 lodash.pull = pull; 25260 lodash.pullAll = pullAll; 25261 lodash.pullAllBy = pullAllBy; 25262 lodash.pullAllWith = pullAllWith; 25263 lodash.pullAt = pullAt; 25264 lodash.range = range; 25265 lodash.rangeRight = rangeRight; 25266 lodash.rearg = rearg; 25267 lodash.reject = reject; 25268 lodash.remove = remove; 25269 lodash.rest = rest; 25270 lodash.reverse = reverse; 25271 lodash.sampleSize = sampleSize; 25272 lodash.set = set; 25273 lodash.setWith = setWith; 25274 lodash.shuffle = shuffle; 25275 lodash.slice = slice; 25276 lodash.sortBy = sortBy; 25277 lodash.sortedUniq = sortedUniq; 25278 lodash.sortedUniqBy = sortedUniqBy; 25279 lodash.split = split; 25280 lodash.spread = spread; 25281 lodash.tail = tail; 25282 lodash.take = take; 25283 lodash.takeRight = takeRight; 25284 lodash.takeRightWhile = takeRightWhile; 25285 lodash.takeWhile = takeWhile; 25286 lodash.tap = tap; 25287 lodash.throttle = throttle; 25288 lodash.thru = thru; 25289 lodash.toArray = toArray; 25290 lodash.toPairs = toPairs; 25291 lodash.toPairsIn = toPairsIn; 25292 lodash.toPath = toPath; 25293 lodash.toPlainObject = toPlainObject; 25294 lodash.transform = transform; 25295 lodash.unary = unary; 25296 lodash.union = union; 25297 lodash.unionBy = unionBy; 25298 lodash.unionWith = unionWith; 25299 lodash.uniq = uniq; 25300 lodash.uniqBy = uniqBy; 25301 lodash.uniqWith = uniqWith; 25302 lodash.unset = unset; 25303 lodash.unzip = unzip; 25304 lodash.unzipWith = unzipWith; 25305 lodash.update = update; 25306 lodash.updateWith = updateWith; 25307 lodash.values = values; 25308 lodash.valuesIn = valuesIn; 25309 lodash.without = without; 25310 lodash.words = words; 25311 lodash.wrap = wrap; 25312 lodash.xor = xor; 25313 lodash.xorBy = xorBy; 25314 lodash.xorWith = xorWith; 25315 lodash.zip = zip; 25316 lodash.zipObject = zipObject; 25317 lodash.zipObjectDeep = zipObjectDeep; 25318 lodash.zipWith = zipWith; 25319 25320 // Add aliases. 25321 lodash.entries = toPairs; 25322 lodash.entriesIn = toPairsIn; 25323 lodash.extend = assignIn; 25324 lodash.extendWith = assignInWith; 25325 25326 // Add methods to `lodash.prototype`. 25327 mixin(lodash, lodash); 25328 25329 /*------------------------------------------------------------------------*/ 25330 25331 // Add methods that return unwrapped values in chain sequences. 25332 lodash.add = add; 25333 lodash.attempt = attempt; 25334 lodash.camelCase = camelCase; 25335 lodash.capitalize = capitalize; 25336 lodash.ceil = ceil; 25337 lodash.clamp = clamp; 25338 lodash.clone = clone; 25339 lodash.cloneDeep = cloneDeep; 25340 lodash.cloneDeepWith = cloneDeepWith; 25341 lodash.cloneWith = cloneWith; 25342 lodash.conformsTo = conformsTo; 25343 lodash.deburr = deburr; 25344 lodash.defaultTo = defaultTo; 25345 lodash.divide = divide; 25346 lodash.endsWith = endsWith; 25347 lodash.eq = eq; 25348 lodash.escape = escape; 25349 lodash.escapeRegExp = escapeRegExp; 25350 lodash.every = every; 25351 lodash.find = find; 25352 lodash.findIndex = findIndex; 25353 lodash.findKey = findKey; 25354 lodash.findLast = findLast; 25355 lodash.findLastIndex = findLastIndex; 25356 lodash.findLastKey = findLastKey; 25357 lodash.floor = floor; 25358 lodash.forEach = forEach; 25359 lodash.forEachRight = forEachRight; 25360 lodash.forIn = forIn; 25361 lodash.forInRight = forInRight; 25362 lodash.forOwn = forOwn; 25363 lodash.forOwnRight = forOwnRight; 25364 lodash.get = get; 25365 lodash.gt = gt; 25366 lodash.gte = gte; 25367 lodash.has = has; 25368 lodash.hasIn = hasIn; 25369 lodash.head = head; 25370 lodash.identity = identity; 25371 lodash.includes = includes; 25372 lodash.indexOf = indexOf; 25373 lodash.inRange = inRange; 25374 lodash.invoke = invoke; 25375 lodash.isArguments = isArguments; 25376 lodash.isArray = isArray; 25377 lodash.isArrayBuffer = isArrayBuffer; 25378 lodash.isArrayLike = isArrayLike; 25379 lodash.isArrayLikeObject = isArrayLikeObject; 25380 lodash.isBoolean = isBoolean; 25381 lodash.isBuffer = isBuffer; 25382 lodash.isDate = isDate; 25383 lodash.isElement = isElement; 25384 lodash.isEmpty = isEmpty; 25385 lodash.isEqual = isEqual; 25386 lodash.isEqualWith = isEqualWith; 25387 lodash.isError = isError; 25388 lodash.isFinite = isFinite; 25389 lodash.isFunction = isFunction; 25390 lodash.isInteger = isInteger; 25391 lodash.isLength = isLength; 25392 lodash.isMap = isMap; 25393 lodash.isMatch = isMatch; 25394 lodash.isMatchWith = isMatchWith; 25395 lodash.isNaN = isNaN; 25396 lodash.isNative = isNative; 25397 lodash.isNil = isNil; 25398 lodash.isNull = isNull; 25399 lodash.isNumber = isNumber; 25400 lodash.isObject = isObject; 25401 lodash.isObjectLike = isObjectLike; 25402 lodash.isPlainObject = isPlainObject; 25403 lodash.isRegExp = isRegExp; 25404 lodash.isSafeInteger = isSafeInteger; 25405 lodash.isSet = isSet; 25406 lodash.isString = isString; 25407 lodash.isSymbol = isSymbol; 25408 lodash.isTypedArray = isTypedArray; 25409 lodash.isUndefined = isUndefined; 25410 lodash.isWeakMap = isWeakMap; 25411 lodash.isWeakSet = isWeakSet; 25412 lodash.join = join; 25413 lodash.kebabCase = kebabCase; 25414 lodash.last = last; 25415 lodash.lastIndexOf = lastIndexOf; 25416 lodash.lowerCase = lowerCase; 25417 lodash.lowerFirst = lowerFirst; 25418 lodash.lt = lt; 25419 lodash.lte = lte; 25420 lodash.max = max; 25421 lodash.maxBy = maxBy; 25422 lodash.mean = mean; 25423 lodash.meanBy = meanBy; 25424 lodash.min = min; 25425 lodash.minBy = minBy; 25426 lodash.stubArray = stubArray; 25427 lodash.stubFalse = stubFalse; 25428 lodash.stubObject = stubObject; 25429 lodash.stubString = stubString; 25430 lodash.stubTrue = stubTrue; 25431 lodash.multiply = multiply; 25432 lodash.nth = nth; 25433 lodash.noConflict = noConflict; 25434 lodash.noop = noop; 25435 lodash.now = now; 25436 lodash.pad = pad; 25437 lodash.padEnd = padEnd; 25438 lodash.padStart = padStart; 25439 lodash.parseInt = parseInt; 25440 lodash.random = random; 25441 lodash.reduce = reduce; 25442 lodash.reduceRight = reduceRight; 25443 lodash.repeat = repeat; 25444 lodash.replace = replace; 25445 lodash.result = result; 25446 lodash.round = round; 25447 lodash.runInContext = runInContext; 25448 lodash.sample = sample; 25449 lodash.size = size; 25450 lodash.snakeCase = snakeCase; 25451 lodash.some = some; 25452 lodash.sortedIndex = sortedIndex; 25453 lodash.sortedIndexBy = sortedIndexBy; 25454 lodash.sortedIndexOf = sortedIndexOf; 25455 lodash.sortedLastIndex = sortedLastIndex; 25456 lodash.sortedLastIndexBy = sortedLastIndexBy; 25457 lodash.sortedLastIndexOf = sortedLastIndexOf; 25458 lodash.startCase = startCase; 25459 lodash.startsWith = startsWith; 25460 lodash.subtract = subtract; 25461 lodash.sum = sum; 25462 lodash.sumBy = sumBy; 25463 lodash.template = template; 25464 lodash.times = times; 25465 lodash.toFinite = toFinite; 25466 lodash.toInteger = toInteger; 25467 lodash.toLength = toLength; 25468 lodash.toLower = toLower; 25469 lodash.toNumber = toNumber; 25470 lodash.toSafeInteger = toSafeInteger; 25471 lodash.toString = toString; 25472 lodash.toUpper = toUpper; 25473 lodash.trim = trim; 25474 lodash.trimEnd = trimEnd; 25475 lodash.trimStart = trimStart; 25476 lodash.truncate = truncate; 25477 lodash.unescape = unescape; 25478 lodash.uniqueId = uniqueId; 25479 lodash.upperCase = upperCase; 25480 lodash.upperFirst = upperFirst; 25481 25482 // Add aliases. 25483 lodash.each = forEach; 25484 lodash.eachRight = forEachRight; 25485 lodash.first = head; 25486 25487 mixin(lodash, (function() { 25488 var source = {}; 25489 baseForOwn(lodash, function(func, methodName) { 25490 if (!hasOwnProperty.call(lodash.prototype, methodName)) { 25491 source[methodName] = func; 25492 } 25493 }); 25494 return source; 25495 }()), { 'chain': false }); 25496 25497 /*------------------------------------------------------------------------*/ 25498 25499 /** 25500 * The semantic version number. 25501 * 25502 * @static 25503 * @memberOf _ 25504 * @type {string} 25505 */ 25506 lodash.VERSION = VERSION; 25507 25508 // Assign default placeholders. 25509 arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) { 25510 lodash[methodName].placeholder = lodash; 25511 }); 25512 25513 // Add `LazyWrapper` methods for `_.drop` and `_.take` variants. 25514 arrayEach(['drop', 'take'], function(methodName, index) { 25515 LazyWrapper.prototype[methodName] = function(n) { 25516 n = n === undefined ? 1 : nativeMax(toInteger(n), 0); 25517 25518 var result = (this.__filtered__ && !index) 25519 ? new LazyWrapper(this) 25520 : this.clone(); 25521 25522 if (result.__filtered__) { 25523 result.__takeCount__ = nativeMin(n, result.__takeCount__); 25524 } else { 25525 result.__views__.push({ 25526 'size': nativeMin(n, MAX_ARRAY_LENGTH), 25527 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') 25528 }); 25529 } 25530 return result; 25531 }; 25532 25533 LazyWrapper.prototype[methodName + 'Right'] = function(n) { 25534 return this.reverse()[methodName](n).reverse(); 25535 }; 25536 }); 25537 25538 // Add `LazyWrapper` methods that accept an `iteratee` value. 25539 arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) { 25540 var type = index + 1, 25541 isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; 25542 25543 LazyWrapper.prototype[methodName] = function(iteratee) { 25544 var result = this.clone(); 25545 result.__iteratees__.push({ 25546 'iteratee': getIteratee(iteratee, 3), 25547 'type': type 25548 }); 25549 result.__filtered__ = result.__filtered__ || isFilter; 25550 return result; 25551 }; 25552 }); 25553 25554 // Add `LazyWrapper` methods for `_.head` and `_.last`. 25555 arrayEach(['head', 'last'], function(methodName, index) { 25556 var takeName = 'take' + (index ? 'Right' : ''); 25557 25558 LazyWrapper.prototype[methodName] = function() { 25559 return this[takeName](1).value()[0]; 25560 }; 25561 }); 25562 25563 // Add `LazyWrapper` methods for `_.initial` and `_.tail`. 25564 arrayEach(['initial', 'tail'], function(methodName, index) { 25565 var dropName = 'drop' + (index ? '' : 'Right'); 25566 25567 LazyWrapper.prototype[methodName] = function() { 25568 return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); 25569 }; 25570 }); 25571 25572 LazyWrapper.prototype.compact = function() { 25573 return this.filter(identity); 25574 }; 25575 25576 LazyWrapper.prototype.find = function(predicate) { 25577 return this.filter(predicate).head(); 25578 }; 25579 25580 LazyWrapper.prototype.findLast = function(predicate) { 25581 return this.reverse().find(predicate); 25582 }; 25583 25584 LazyWrapper.prototype.invokeMap = baseRest(function(path, args) { 25585 if (typeof path == 'function') { 25586 return new LazyWrapper(this); 25587 } 25588 return this.map(function(value) { 25589 return baseInvoke(value, path, args); 25590 }); 25591 }); 25592 25593 LazyWrapper.prototype.reject = function(predicate) { 25594 return this.filter(negate(getIteratee(predicate))); 25595 }; 25596 25597 LazyWrapper.prototype.slice = function(start, end) { 25598 start = toInteger(start); 25599 25600 var result = this; 25601 if (result.__filtered__ && (start > 0 || end < 0)) { 25602 return new LazyWrapper(result); 25603 } 25604 if (start < 0) { 25605 result = result.takeRight(-start); 25606 } else if (start) { 25607 result = result.drop(start); 25608 } 25609 if (end !== undefined) { 25610 end = toInteger(end); 25611 result = end < 0 ? result.dropRight(-end) : result.take(end - start); 25612 } 25613 return result; 25614 }; 25615 25616 LazyWrapper.prototype.takeRightWhile = function(predicate) { 25617 return this.reverse().takeWhile(predicate).reverse(); 25618 }; 25619 25620 LazyWrapper.prototype.toArray = function() { 25621 return this.take(MAX_ARRAY_LENGTH); 25622 }; 25623 25624 // Add `LazyWrapper` methods to `lodash.prototype`. 25625 baseForOwn(LazyWrapper.prototype, function(func, methodName) { 25626 var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), 25627 isTaker = /^(?:head|last)$/.test(methodName), 25628 lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName], 25629 retUnwrapped = isTaker || /^find/.test(methodName); 25630 25631 if (!lodashFunc) { 25632 return; 25633 } 25634 lodash.prototype[methodName] = function() { 25635 var value = this.__wrapped__, 25636 args = isTaker ? [1] : arguments, 25637 isLazy = value instanceof LazyWrapper, 25638 iteratee = args[0], 25639 useLazy = isLazy || isArray(value); 25640 25641 var interceptor = function(value) { 25642 var result = lodashFunc.apply(lodash, arrayPush([value], args)); 25643 return (isTaker && chainAll) ? result[0] : result; 25644 }; 25645 25646 if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) { 25647 // Avoid lazy use if the iteratee has a "length" value other than `1`. 25648 isLazy = useLazy = false; 25649 } 25650 var chainAll = this.__chain__, 25651 isHybrid = !!this.__actions__.length, 25652 isUnwrapped = retUnwrapped && !chainAll, 25653 onlyLazy = isLazy && !isHybrid; 25654 25655 if (!retUnwrapped && useLazy) { 25656 value = onlyLazy ? value : new LazyWrapper(this); 25657 var result = func.apply(value, args); 25658 result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); 25659 return new LodashWrapper(result, chainAll); 25660 } 25661 if (isUnwrapped && onlyLazy) { 25662 return func.apply(this, args); 25663 } 25664 result = this.thru(interceptor); 25665 return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result; 25666 }; 25667 }); 25668 25669 // Add `Array` methods to `lodash.prototype`. 25670 arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { 25671 var func = arrayProto[methodName], 25672 chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', 25673 retUnwrapped = /^(?:pop|shift)$/.test(methodName); 25674 25675 lodash.prototype[methodName] = function() { 25676 var args = arguments; 25677 if (retUnwrapped && !this.__chain__) { 25678 var value = this.value(); 25679 return func.apply(isArray(value) ? value : [], args); 25680 } 25681 return this[chainName](function(value) { 25682 return func.apply(isArray(value) ? value : [], args); 25683 }); 25684 }; 25685 }); 25686 25687 // Map minified method names to their real names. 25688 baseForOwn(LazyWrapper.prototype, function(func, methodName) { 25689 var lodashFunc = lodash[methodName]; 25690 if (lodashFunc) { 25691 var key = lodashFunc.name + ''; 25692 if (!hasOwnProperty.call(realNames, key)) { 25693 realNames[key] = []; 25694 } 25695 realNames[key].push({ 'name': methodName, 'func': lodashFunc }); 25696 } 25697 }); 25698 25699 realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{ 25700 'name': 'wrapper', 25701 'func': undefined 25702 }]; 25703 25704 // Add methods to `LazyWrapper`. 25705 LazyWrapper.prototype.clone = lazyClone; 25706 LazyWrapper.prototype.reverse = lazyReverse; 25707 LazyWrapper.prototype.value = lazyValue; 25708 25709 // Add chain sequence methods to the `lodash` wrapper. 25710 lodash.prototype.at = wrapperAt; 25711 lodash.prototype.chain = wrapperChain; 25712 lodash.prototype.commit = wrapperCommit; 25713 lodash.prototype.next = wrapperNext; 25714 lodash.prototype.plant = wrapperPlant; 25715 lodash.prototype.reverse = wrapperReverse; 25716 lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue; 25717 25718 // Add lazy aliases. 25719 lodash.prototype.first = lodash.prototype.head; 25720 25721 if (symIterator) { 25722 lodash.prototype[symIterator] = wrapperToIterator; 25723 } 25724 return lodash; 25725 }); 25726 25727 /*--------------------------------------------------------------------------*/ 25728 25729 // Export lodash. 25730 var _ = runInContext(); 25731 25732 // Some AMD build optimizers, like r.js, check for condition patterns like: 25733 if (true) { 25734 // Expose Lodash on the global object to prevent errors when Lodash is 25735 // loaded by a script tag in the presence of an AMD loader. 25736 // See http://requirejs.org/docs/errors.html#mismatch for more details. 25737 // Use `_.noConflict` to remove Lodash from the global object. 25738 root._ = _; 25739 25740 // Define as an anonymous module so, through path mapping, it can be 25741 // referenced as the "underscore" module. 25742 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { 25743 return _; 25744 }).call(exports, __webpack_require__, exports, module), 25745 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 25746 } 25747 // Check for `exports` after `define` in case a build optimizer adds it. 25748 else // removed by dead control flow 25749{} 25750}.call(this)); 25751 25752 25753/***/ }), 25754
vendor: 1,886 bytes, lines 25755-25820
25755/***/ "./node_modules/memoize-one/dist/memoize-one.esm.js": 25756/*!**********************************************************!*\ 25757 !*** ./node_modules/memoize-one/dist/memoize-one.esm.js ***! 25758 \**********************************************************/ 25759/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 25760 25761"use strict"; 25762__webpack_require__.r(__webpack_exports__); 25763/* harmony export */ __webpack_require__.d(__webpack_exports__, { 25764/* harmony export */ "default": () => (/* binding */ memoizeOne) 25765/* harmony export */ }); 25766var safeIsNaN = Number.isNaN || 25767 function ponyfill(value) { 25768 return typeof value === 'number' && value !== value; 25769 }; 25770function isEqual(first, second) { 25771 if (first === second) { 25772 return true; 25773 } 25774 if (safeIsNaN(first) && safeIsNaN(second)) { 25775 return true; 25776 } 25777 return false; 25778} 25779function areInputsEqual(newInputs, lastInputs) { 25780 if (newInputs.length !== lastInputs.length) { 25781 return false; 25782 } 25783 for (var i = 0; i < newInputs.length; i++) { 25784 if (!isEqual(newInputs[i], lastInputs[i])) { 25785 return false; 25786 } 25787 } 25788 return true; 25789} 25790 25791function memoizeOne(resultFn, isEqual) { 25792 if (isEqual === void 0) { isEqual = areInputsEqual; } 25793 var cache = null; 25794 function memoized() { 25795 var newArgs = []; 25796 for (var _i = 0; _i < arguments.length; _i++) { 25797 newArgs[_i] = arguments[_i]; 25798 } 25799 if (cache && cache.lastThis === this && isEqual(newArgs, cache.lastArgs)) { 25800 return cache.lastResult; 25801 } 25802 var lastResult = resultFn.apply(this, newArgs); 25803 cache = { 25804 lastResult: lastResult, 25805 lastArgs: newArgs, 25806 lastThis: this, 25807 }; 25808 return lastResult; 25809 } 25810 memoized.clear = function clear() { 25811 cache = null; 25812 }; 25813 return memoized; 25814} 25815 25816 25817 25818 25819/***/ }), 25820
vendor: 2,343 bytes, lines 25821-25921
25821/***/ "./node_modules/object-assign/index.js": 25822/*!*********************************************!*\ 25823 !*** ./node_modules/object-assign/index.js ***! 25824 \*********************************************/ 25825/***/ ((module) => { 25826 25827"use strict"; 25828/* 25829object-assign 25830(c) Sindre Sorhus 25831@license MIT 25832*/ 25833 25834 25835/* eslint-disable no-unused-vars */ 25836var getOwnPropertySymbols = Object.getOwnPropertySymbols; 25837var hasOwnProperty = Object.prototype.hasOwnProperty; 25838var propIsEnumerable = Object.prototype.propertyIsEnumerable; 25839 25840function toObject(val) { 25841 if (val === null || val === undefined) { 25842 throw new TypeError('Object.assign cannot be called with null or undefined'); 25843 } 25844 25845 return Object(val); 25846} 25847 25848function shouldUseNative() { 25849 try { 25850 if (!Object.assign) { 25851 return false; 25852 } 25853 25854 // Detect buggy property enumeration order in older V8 versions. 25855 25856 // https://bugs.chromium.org/p/v8/issues/detail?id=4118 25857 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers 25858 test1[5] = 'de'; 25859 if (Object.getOwnPropertyNames(test1)[0] === '5') { 25860 return false; 25861 } 25862 25863 // https://bugs.chromium.org/p/v8/issues/detail?id=3056 25864 var test2 = {}; 25865 for (var i = 0; i < 10; i++) { 25866 test2['_' + String.fromCharCode(i)] = i; 25867 } 25868 var order2 = Object.getOwnPropertyNames(test2).map(function (n) { 25869 return test2[n]; 25870 }); 25871 if (order2.join('') !== '0123456789') { 25872 return false; 25873 } 25874 25875 // https://bugs.chromium.org/p/v8/issues/detail?id=3056 25876 var test3 = {}; 25877 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { 25878 test3[letter] = letter; 25879 }); 25880 if (Object.keys(Object.assign({}, test3)).join('') !== 25881 'abcdefghijklmnopqrst') { 25882 return false; 25883 } 25884 25885 return true; 25886 } catch (err) { 25887 // We don't expect any of the above to throw, but better to be safe. 25888 return false; 25889 } 25890} 25891 25892module.exports = shouldUseNative() ? Object.assign : function (target, source) { 25893 var from; 25894 var to = toObject(target); 25895 var symbols; 25896 25897 for (var s = 1; s < arguments.length; s++) { 25898 from = Object(arguments[s]); 25899 25900 for (var key in from) { 25901 if (hasOwnProperty.call(from, key)) { 25902 to[key] = from[key]; 25903 } 25904 } 25905 25906 if (getOwnPropertySymbols) { 25907 symbols = getOwnPropertySymbols(from); 25908 for (var i = 0; i < symbols.length; i++) { 25909 if (propIsEnumerable.call(from, symbols[i])) { 25910 to[symbols[i]] = from[symbols[i]]; 25911 } 25912 } 25913 } 25914 } 25915 25916 return to; 25917}; 25918 25919 25920/***/ }), 25921
vendor: 4,204 bytes, lines 25922-26035
25922/***/ "./node_modules/prop-types/checkPropTypes.js": 25923/*!***************************************************!*\ 25924 !*** ./node_modules/prop-types/checkPropTypes.js ***! 25925 \***************************************************/ 25926/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 25927 25928"use strict"; 25929/** 25930 * Copyright (c) 2013-present, Facebook, Inc. 25931 * 25932 * This source code is licensed under the MIT license found in the 25933 * LICENSE file in the root directory of this source tree. 25934 */ 25935 25936 25937 25938var printWarning = function() {}; 25939 25940if (true) { 25941 var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js"); 25942 var loggedTypeFailures = {}; 25943 var has = __webpack_require__(/*! ./lib/has */ "./node_modules/prop-types/lib/has.js"); 25944 25945 printWarning = function(text) { 25946 var message = 'Warning: ' + text; 25947 if (typeof console !== 'undefined') { 25948 console.error(message); 25949 } 25950 try { 25951 // --- Welcome to debugging React --- 25952 // This error was thrown as a convenience so that you can use this stack 25953 // to find the callsite that caused this warning to fire. 25954 throw new Error(message); 25955 } catch (x) { /**/ } 25956 }; 25957} 25958 25959/** 25960 * Assert that the values match with the type specs. 25961 * Error messages are memorized and will only be shown once. 25962 * 25963 * @param {object} typeSpecs Map of name to a ReactPropType 25964 * @param {object} values Runtime values that need to be type-checked 25965 * @param {string} location e.g. "prop", "context", "child context" 25966 * @param {string} componentName Name of the component for error messages. 25967 * @param {?Function} getStack Returns the component stack. 25968 * @private 25969 */ 25970function checkPropTypes(typeSpecs, values, location, componentName, getStack) { 25971 if (true) { 25972 for (var typeSpecName in typeSpecs) { 25973 if (has(typeSpecs, typeSpecName)) { 25974 var error; 25975 // Prop type validation may throw. In case they do, we don't want to 25976 // fail the render phase where it didn't fail before. So we log it. 25977 // After these have been cleaned up, we'll let them throw. 25978 try { 25979 // This is intentionally an invariant that gets caught. It's the same 25980 // behavior as without this statement except with a better message. 25981 if (typeof typeSpecs[typeSpecName] !== 'function') { 25982 var err = Error( 25983 (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 25984 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 25985 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.' 25986 ); 25987 err.name = 'Invariant Violation'; 25988 throw err; 25989 } 25990 error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); 25991 } catch (ex) { 25992 error = ex; 25993 } 25994 if (error && !(error instanceof Error)) { 25995 printWarning( 25996 (componentName || 'React class') + ': type specification of ' + 25997 location + ' `' + typeSpecName + '` is invalid; the type checker ' + 25998 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + 25999 'You may have forgotten to pass an argument to the type checker ' + 26000 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 26001 'shape all require an argument).' 26002 ); 26003 } 26004 if (error instanceof Error && !(error.message in loggedTypeFailures)) { 26005 // Only monitor this failure once because there tends to be a lot of the 26006 // same error. 26007 loggedTypeFailures[error.message] = true; 26008 26009 var stack = getStack ? getStack() : ''; 26010 26011 printWarning( 26012 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '') 26013 ); 26014 } 26015 } 26016 } 26017 } 26018} 26019 26020/** 26021 * Resets warning cache when testing. 26022 * 26023 * @private 26024 */ 26025checkPropTypes.resetWarningCache = function() { 26026 if (true) { 26027 loggedTypeFailures = {}; 26028 } 26029} 26030 26031module.exports = checkPropTypes; 26032 26033 26034/***/ }), 26035
vendor: 613 bytes, lines 26036-26058
26036/***/ "./node_modules/prop-types/lib/ReactPropTypesSecret.js": 26037/*!*************************************************************!*\ 26038 !*** ./node_modules/prop-types/lib/ReactPropTypesSecret.js ***! 26039 \*************************************************************/ 26040/***/ ((module) => { 26041 26042"use strict"; 26043/** 26044 * Copyright (c) 2013-present, Facebook, Inc. 26045 * 26046 * This source code is licensed under the MIT license found in the 26047 * LICENSE file in the root directory of this source tree. 26048 */ 26049 26050 26051 26052var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; 26053 26054module.exports = ReactPropTypesSecret; 26055 26056 26057/***/ }), 26058
vendor: 300 bytes, lines 26059-26069
26059/***/ "./node_modules/prop-types/lib/has.js": 26060/*!********************************************!*\ 26061 !*** ./node_modules/prop-types/lib/has.js ***! 26062 \********************************************/ 26063/***/ ((module) => { 26064 26065module.exports = Function.call.bind(Object.prototype.hasOwnProperty); 26066 26067 26068/***/ }), 26069
vendor: 859,405 bytes, lines 26070-51092
26070/***/ "./node_modules/react-dom/cjs/react-dom.development.js": 26071/*!*************************************************************!*\ 26072 !*** ./node_modules/react-dom/cjs/react-dom.development.js ***! 26073 \*************************************************************/ 26074/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 26075 26076"use strict"; 26077/** @license React v16.13.1 26078 * react-dom.development.js 26079 * 26080 * Copyright (c) Facebook, Inc. and its affiliates. 26081 * 26082 * This source code is licensed under the MIT license found in the 26083 * LICENSE file in the root directory of this source tree. 26084 */ 26085 26086 26087 26088 26089 26090if (true) { 26091 (function() { 26092'use strict'; 26093 26094var React = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 26095var _assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js"); 26096var Scheduler = __webpack_require__(/*! scheduler */ "./node_modules/scheduler/index.js"); 26097var checkPropTypes = __webpack_require__(/*! prop-types/checkPropTypes */ "./node_modules/prop-types/checkPropTypes.js"); 26098var tracing = __webpack_require__(/*! scheduler/tracing */ "./node_modules/scheduler/tracing.js"); 26099 26100var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions. 26101// Current owner and dispatcher used to share the same ref, 26102// but PR #14548 split them out to better support the react-debug-tools package. 26103 26104if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) { 26105 ReactSharedInternals.ReactCurrentDispatcher = { 26106 current: null 26107 }; 26108} 26109 26110if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) { 26111 ReactSharedInternals.ReactCurrentBatchConfig = { 26112 suspense: null 26113 }; 26114} 26115 26116// by calls to these methods by a Babel plugin. 26117// 26118// In PROD (or in packages without access to React internals), 26119// they are left as they are instead. 26120 26121function warn(format) { 26122 { 26123 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 26124 args[_key - 1] = arguments[_key]; 26125 } 26126 26127 printWarning('warn', format, args); 26128 } 26129} 26130function error(format) { 26131 { 26132 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { 26133 args[_key2 - 1] = arguments[_key2]; 26134 } 26135 26136 printWarning('error', format, args); 26137 } 26138} 26139 26140function printWarning(level, format, args) { 26141 // When changing this logic, you might want to also 26142 // update consoleWithStackDev.www.js as well. 26143 { 26144 var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0; 26145 26146 if (!hasExistingStack) { 26147 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; 26148 var stack = ReactDebugCurrentFrame.getStackAddendum(); 26149 26150 if (stack !== '') { 26151 format += '%s'; 26152 args = args.concat([stack]); 26153 } 26154 } 26155 26156 var argsWithFormat = args.map(function (item) { 26157 return '' + item; 26158 }); // Careful: RN currently depends on this prefix 26159 26160 argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it 26161 // breaks IE9: https://github.com/facebook/react/issues/13610 26162 // eslint-disable-next-line react-internal/no-production-logging 26163 26164 Function.prototype.apply.call(console[level], console, argsWithFormat); 26165 26166 try { 26167 // --- Welcome to debugging React --- 26168 // This error was thrown as a convenience so that you can use this stack 26169 // to find the callsite that caused this warning to fire. 26170 var argIndex = 0; 26171 var message = 'Warning: ' + format.replace(/%s/g, function () { 26172 return args[argIndex++]; 26173 }); 26174 throw new Error(message); 26175 } catch (x) {} 26176 } 26177} 26178 26179if (!React) { 26180 { 26181 throw Error( "ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM." ); 26182 } 26183} 26184 26185var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f) { 26186 var funcArgs = Array.prototype.slice.call(arguments, 3); 26187 26188 try { 26189 func.apply(context, funcArgs); 26190 } catch (error) { 26191 this.onError(error); 26192 } 26193}; 26194 26195{ 26196 // In DEV mode, we swap out invokeGuardedCallback for a special version 26197 // that plays more nicely with the browser's DevTools. The idea is to preserve 26198 // "Pause on exceptions" behavior. Because React wraps all user-provided 26199 // functions in invokeGuardedCallback, and the production version of 26200 // invokeGuardedCallback uses a try-catch, all user exceptions are treated 26201 // like caught exceptions, and the DevTools won't pause unless the developer 26202 // takes the extra step of enabling pause on caught exceptions. This is 26203 // unintuitive, though, because even though React has caught the error, from 26204 // the developer's perspective, the error is uncaught. 26205 // 26206 // To preserve the expected "Pause on exceptions" behavior, we don't use a 26207 // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake 26208 // DOM node, and call the user-provided callback from inside an event handler 26209 // for that fake event. If the callback throws, the error is "captured" using 26210 // a global event handler. But because the error happens in a different 26211 // event loop context, it does not interrupt the normal program flow. 26212 // Effectively, this gives us try-catch behavior without actually using 26213 // try-catch. Neat! 26214 // Check that the browser supports the APIs we need to implement our special 26215 // DEV version of invokeGuardedCallback 26216 if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') { 26217 var fakeNode = document.createElement('react'); 26218 26219 var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) { 26220 // If document doesn't exist we know for sure we will crash in this method 26221 // when we call document.createEvent(). However this can cause confusing 26222 // errors: https://github.com/facebookincubator/create-react-app/issues/3482 26223 // So we preemptively throw with a better message instead. 26224 if (!(typeof document !== 'undefined')) { 26225 { 26226 throw Error( "The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous." ); 26227 } 26228 } 26229 26230 var evt = document.createEvent('Event'); // Keeps track of whether the user-provided callback threw an error. We 26231 // set this to true at the beginning, then set it to false right after 26232 // calling the function. If the function errors, `didError` will never be 26233 // set to false. This strategy works even if the browser is flaky and 26234 // fails to call our global error handler, because it doesn't rely on 26235 // the error event at all. 26236 26237 var didError = true; // Keeps track of the value of window.event so that we can reset it 26238 // during the callback to let user code access window.event in the 26239 // browsers that support it. 26240 26241 var windowEvent = window.event; // Keeps track of the descriptor of window.event to restore it after event 26242 // dispatching: https://github.com/facebook/react/issues/13688 26243 26244 var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event'); // Create an event handler for our fake event. We will synchronously 26245 // dispatch our fake event using `dispatchEvent`. Inside the handler, we 26246 // call the user-provided callback. 26247 26248 var funcArgs = Array.prototype.slice.call(arguments, 3); 26249 26250 function callCallback() { 26251 // We immediately remove the callback from event listeners so that 26252 // nested `invokeGuardedCallback` calls do not clash. Otherwise, a 26253 // nested call would trigger the fake event handlers of any call higher 26254 // in the stack. 26255 fakeNode.removeEventListener(evtType, callCallback, false); // We check for window.hasOwnProperty('event') to prevent the 26256 // window.event assignment in both IE <= 10 as they throw an error 26257 // "Member not found" in strict mode, and in Firefox which does not 26258 // support window.event. 26259 26260 if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) { 26261 window.event = windowEvent; 26262 } 26263 26264 func.apply(context, funcArgs); 26265 didError = false; 26266 } // Create a global error event handler. We use this to capture the value 26267 // that was thrown. It's possible that this error handler will fire more 26268 // than once; for example, if non-React code also calls `dispatchEvent` 26269 // and a handler for that event throws. We should be resilient to most of 26270 // those cases. Even if our error event handler fires more than once, the 26271 // last error event is always used. If the callback actually does error, 26272 // we know that the last error event is the correct one, because it's not 26273 // possible for anything else to have happened in between our callback 26274 // erroring and the code that follows the `dispatchEvent` call below. If 26275 // the callback doesn't error, but the error event was fired, we know to 26276 // ignore it because `didError` will be false, as described above. 26277 26278 26279 var error; // Use this to track whether the error event is ever called. 26280 26281 var didSetError = false; 26282 var isCrossOriginError = false; 26283 26284 function handleWindowError(event) { 26285 error = event.error; 26286 didSetError = true; 26287 26288 if (error === null && event.colno === 0 && event.lineno === 0) { 26289 isCrossOriginError = true; 26290 } 26291 26292 if (event.defaultPrevented) { 26293 // Some other error handler has prevented default. 26294 // Browsers silence the error report if this happens. 26295 // We'll remember this to later decide whether to log it or not. 26296 if (error != null && typeof error === 'object') { 26297 try { 26298 error._suppressLogging = true; 26299 } catch (inner) {// Ignore. 26300 } 26301 } 26302 } 26303 } // Create a fake event type. 26304 26305 26306 var evtType = "react-" + (name ? name : 'invokeguardedcallback'); // Attach our event handlers 26307 26308 window.addEventListener('error', handleWindowError); 26309 fakeNode.addEventListener(evtType, callCallback, false); // Synchronously dispatch our fake event. If the user-provided function 26310 // errors, it will trigger our global error handler. 26311 26312 evt.initEvent(evtType, false, false); 26313 fakeNode.dispatchEvent(evt); 26314 26315 if (windowEventDescriptor) { 26316 Object.defineProperty(window, 'event', windowEventDescriptor); 26317 } 26318 26319 if (didError) { 26320 if (!didSetError) { 26321 // The callback errored, but the error event never fired. 26322 error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.'); 26323 } else if (isCrossOriginError) { 26324 error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.'); 26325 } 26326 26327 this.onError(error); 26328 } // Remove our event listeners 26329 26330 26331 window.removeEventListener('error', handleWindowError); 26332 }; 26333 26334 invokeGuardedCallbackImpl = invokeGuardedCallbackDev; 26335 } 26336} 26337 26338var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl; 26339 26340var hasError = false; 26341var caughtError = null; // Used by event system to capture/rethrow the first error. 26342 26343var hasRethrowError = false; 26344var rethrowError = null; 26345var reporter = { 26346 onError: function (error) { 26347 hasError = true; 26348 caughtError = error; 26349 } 26350}; 26351/** 26352 * Call a function while guarding against errors that happens within it. 26353 * Returns an error if it throws, otherwise null. 26354 * 26355 * In production, this is implemented using a try-catch. The reason we don't 26356 * use a try-catch directly is so that we can swap out a different 26357 * implementation in DEV mode. 26358 * 26359 * @param {String} name of the guard to use for logging or debugging 26360 * @param {Function} func The function to invoke 26361 * @param {*} context The context to use when calling the function 26362 * @param {...*} args Arguments for function 26363 */ 26364 26365function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { 26366 hasError = false; 26367 caughtError = null; 26368 invokeGuardedCallbackImpl$1.apply(reporter, arguments); 26369} 26370/** 26371 * Same as invokeGuardedCallback, but instead of returning an error, it stores 26372 * it in a global so it can be rethrown by `rethrowCaughtError` later. 26373 * TODO: See if caughtError and rethrowError can be unified. 26374 * 26375 * @param {String} name of the guard to use for logging or debugging 26376 * @param {Function} func The function to invoke 26377 * @param {*} context The context to use when calling the function 26378 * @param {...*} args Arguments for function 26379 */ 26380 26381function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) { 26382 invokeGuardedCallback.apply(this, arguments); 26383 26384 if (hasError) { 26385 var error = clearCaughtError(); 26386 26387 if (!hasRethrowError) { 26388 hasRethrowError = true; 26389 rethrowError = error; 26390 } 26391 } 26392} 26393/** 26394 * During execution of guarded functions we will capture the first error which 26395 * we will rethrow to be handled by the top level error handler. 26396 */ 26397 26398function rethrowCaughtError() { 26399 if (hasRethrowError) { 26400 var error = rethrowError; 26401 hasRethrowError = false; 26402 rethrowError = null; 26403 throw error; 26404 } 26405} 26406function hasCaughtError() { 26407 return hasError; 26408} 26409function clearCaughtError() { 26410 if (hasError) { 26411 var error = caughtError; 26412 hasError = false; 26413 caughtError = null; 26414 return error; 26415 } else { 26416 { 26417 { 26418 throw Error( "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." ); 26419 } 26420 } 26421 } 26422} 26423 26424var getFiberCurrentPropsFromNode = null; 26425var getInstanceFromNode = null; 26426var getNodeFromInstance = null; 26427function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) { 26428 getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl; 26429 getInstanceFromNode = getInstanceFromNodeImpl; 26430 getNodeFromInstance = getNodeFromInstanceImpl; 26431 26432 { 26433 if (!getNodeFromInstance || !getInstanceFromNode) { 26434 error('EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.'); 26435 } 26436 } 26437} 26438var validateEventDispatches; 26439 26440{ 26441 validateEventDispatches = function (event) { 26442 var dispatchListeners = event._dispatchListeners; 26443 var dispatchInstances = event._dispatchInstances; 26444 var listenersIsArr = Array.isArray(dispatchListeners); 26445 var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; 26446 var instancesIsArr = Array.isArray(dispatchInstances); 26447 var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0; 26448 26449 if (instancesIsArr !== listenersIsArr || instancesLen !== listenersLen) { 26450 error('EventPluginUtils: Invalid `event`.'); 26451 } 26452 }; 26453} 26454/** 26455 * Dispatch the event to the listener. 26456 * @param {SyntheticEvent} event SyntheticEvent to handle 26457 * @param {function} listener Application-level callback 26458 * @param {*} inst Internal component instance 26459 */ 26460 26461 26462function executeDispatch(event, listener, inst) { 26463 var type = event.type || 'unknown-event'; 26464 event.currentTarget = getNodeFromInstance(inst); 26465 invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event); 26466 event.currentTarget = null; 26467} 26468/** 26469 * Standard/simple iteration through an event's collected dispatches. 26470 */ 26471 26472function executeDispatchesInOrder(event) { 26473 var dispatchListeners = event._dispatchListeners; 26474 var dispatchInstances = event._dispatchInstances; 26475 26476 { 26477 validateEventDispatches(event); 26478 } 26479 26480 if (Array.isArray(dispatchListeners)) { 26481 for (var i = 0; i < dispatchListeners.length; i++) { 26482 if (event.isPropagationStopped()) { 26483 break; 26484 } // Listeners and Instances are two parallel arrays that are always in sync. 26485 26486 26487 executeDispatch(event, dispatchListeners[i], dispatchInstances[i]); 26488 } 26489 } else if (dispatchListeners) { 26490 executeDispatch(event, dispatchListeners, dispatchInstances); 26491 } 26492 26493 event._dispatchListeners = null; 26494 event._dispatchInstances = null; 26495} 26496 26497var FunctionComponent = 0; 26498var ClassComponent = 1; 26499var IndeterminateComponent = 2; // Before we know whether it is function or class 26500 26501var HostRoot = 3; // Root of a host tree. Could be nested inside another node. 26502 26503var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. 26504 26505var HostComponent = 5; 26506var HostText = 6; 26507var Fragment = 7; 26508var Mode = 8; 26509var ContextConsumer = 9; 26510var ContextProvider = 10; 26511var ForwardRef = 11; 26512var Profiler = 12; 26513var SuspenseComponent = 13; 26514var MemoComponent = 14; 26515var SimpleMemoComponent = 15; 26516var LazyComponent = 16; 26517var IncompleteClassComponent = 17; 26518var DehydratedFragment = 18; 26519var SuspenseListComponent = 19; 26520var FundamentalComponent = 20; 26521var ScopeComponent = 21; 26522var Block = 22; 26523 26524/** 26525 * Injectable ordering of event plugins. 26526 */ 26527var eventPluginOrder = null; 26528/** 26529 * Injectable mapping from names to event plugin modules. 26530 */ 26531 26532var namesToPlugins = {}; 26533/** 26534 * Recomputes the plugin list using the injected plugins and plugin ordering. 26535 * 26536 * @private 26537 */ 26538 26539function recomputePluginOrdering() { 26540 if (!eventPluginOrder) { 26541 // Wait until an `eventPluginOrder` is injected. 26542 return; 26543 } 26544 26545 for (var pluginName in namesToPlugins) { 26546 var pluginModule = namesToPlugins[pluginName]; 26547 var pluginIndex = eventPluginOrder.indexOf(pluginName); 26548 26549 if (!(pluginIndex > -1)) { 26550 { 26551 throw Error( "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + pluginName + "`." ); 26552 } 26553 } 26554 26555 if (plugins[pluginIndex]) { 26556 continue; 26557 } 26558 26559 if (!pluginModule.extractEvents) { 26560 { 26561 throw Error( "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + pluginName + "` does not." ); 26562 } 26563 } 26564 26565 plugins[pluginIndex] = pluginModule; 26566 var publishedEvents = pluginModule.eventTypes; 26567 26568 for (var eventName in publishedEvents) { 26569 if (!publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName)) { 26570 { 26571 throw Error( "EventPluginRegistry: Failed to publish event `" + eventName + "` for plugin `" + pluginName + "`." ); 26572 } 26573 } 26574 } 26575 } 26576} 26577/** 26578 * Publishes an event so that it can be dispatched by the supplied plugin. 26579 * 26580 * @param {object} dispatchConfig Dispatch configuration for the event. 26581 * @param {object} PluginModule Plugin publishing the event. 26582 * @return {boolean} True if the event was successfully published. 26583 * @private 26584 */ 26585 26586 26587function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { 26588 if (!!eventNameDispatchConfigs.hasOwnProperty(eventName)) { 26589 { 26590 throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same event name, `" + eventName + "`." ); 26591 } 26592 } 26593 26594 eventNameDispatchConfigs[eventName] = dispatchConfig; 26595 var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; 26596 26597 if (phasedRegistrationNames) { 26598 for (var phaseName in phasedRegistrationNames) { 26599 if (phasedRegistrationNames.hasOwnProperty(phaseName)) { 26600 var phasedRegistrationName = phasedRegistrationNames[phaseName]; 26601 publishRegistrationName(phasedRegistrationName, pluginModule, eventName); 26602 } 26603 } 26604 26605 return true; 26606 } else if (dispatchConfig.registrationName) { 26607 publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); 26608 return true; 26609 } 26610 26611 return false; 26612} 26613/** 26614 * Publishes a registration name that is used to identify dispatched events. 26615 * 26616 * @param {string} registrationName Registration name to add. 26617 * @param {object} PluginModule Plugin publishing the event. 26618 * @private 26619 */ 26620 26621 26622function publishRegistrationName(registrationName, pluginModule, eventName) { 26623 if (!!registrationNameModules[registrationName]) { 26624 { 26625 throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same registration name, `" + registrationName + "`." ); 26626 } 26627 } 26628 26629 registrationNameModules[registrationName] = pluginModule; 26630 registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies; 26631 26632 { 26633 var lowerCasedName = registrationName.toLowerCase(); 26634 possibleRegistrationNames[lowerCasedName] = registrationName; 26635 26636 if (registrationName === 'onDoubleClick') { 26637 possibleRegistrationNames.ondblclick = registrationName; 26638 } 26639 } 26640} 26641/** 26642 * Registers plugins so that they can extract and dispatch events. 26643 */ 26644 26645/** 26646 * Ordered list of injected plugins. 26647 */ 26648 26649 26650var plugins = []; 26651/** 26652 * Mapping from event name to dispatch config 26653 */ 26654 26655var eventNameDispatchConfigs = {}; 26656/** 26657 * Mapping from registration name to plugin module 26658 */ 26659 26660var registrationNameModules = {}; 26661/** 26662 * Mapping from registration name to event name 26663 */ 26664 26665var registrationNameDependencies = {}; 26666/** 26667 * Mapping from lowercase registration names to the properly cased version, 26668 * used to warn in the case of missing event handlers. Available 26669 * only in true. 26670 * @type {Object} 26671 */ 26672 26673var possibleRegistrationNames = {} ; // Trust the developer to only use possibleRegistrationNames in true 26674 26675/** 26676 * Injects an ordering of plugins (by plugin name). This allows the ordering 26677 * to be decoupled from injection of the actual plugins so that ordering is 26678 * always deterministic regardless of packaging, on-the-fly injection, etc. 26679 * 26680 * @param {array} InjectedEventPluginOrder 26681 * @internal 26682 */ 26683 26684function injectEventPluginOrder(injectedEventPluginOrder) { 26685 if (!!eventPluginOrder) { 26686 { 26687 throw Error( "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." ); 26688 } 26689 } // Clone the ordering so it cannot be dynamically mutated. 26690 26691 26692 eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); 26693 recomputePluginOrdering(); 26694} 26695/** 26696 * Injects plugins to be used by plugin event system. The plugin names must be 26697 * in the ordering injected by `injectEventPluginOrder`. 26698 * 26699 * Plugins can be injected as part of page initialization or on-the-fly. 26700 * 26701 * @param {object} injectedNamesToPlugins Map from names to plugin modules. 26702 * @internal 26703 */ 26704 26705function injectEventPluginsByName(injectedNamesToPlugins) { 26706 var isOrderingDirty = false; 26707 26708 for (var pluginName in injectedNamesToPlugins) { 26709 if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { 26710 continue; 26711 } 26712 26713 var pluginModule = injectedNamesToPlugins[pluginName]; 26714 26715 if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) { 26716 if (!!namesToPlugins[pluginName]) { 26717 { 26718 throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + pluginName + "`." ); 26719 } 26720 } 26721 26722 namesToPlugins[pluginName] = pluginModule; 26723 isOrderingDirty = true; 26724 } 26725 } 26726 26727 if (isOrderingDirty) { 26728 recomputePluginOrdering(); 26729 } 26730} 26731 26732var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined'); 26733 26734var PLUGIN_EVENT_SYSTEM = 1; 26735var IS_REPLAYED = 1 << 5; 26736var IS_FIRST_ANCESTOR = 1 << 6; 26737 26738var restoreImpl = null; 26739var restoreTarget = null; 26740var restoreQueue = null; 26741 26742function restoreStateOfTarget(target) { 26743 // We perform this translation at the end of the event loop so that we 26744 // always receive the correct fiber here 26745 var internalInstance = getInstanceFromNode(target); 26746 26747 if (!internalInstance) { 26748 // Unmounted 26749 return; 26750 } 26751 26752 if (!(typeof restoreImpl === 'function')) { 26753 { 26754 throw Error( "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." ); 26755 } 26756 } 26757 26758 var stateNode = internalInstance.stateNode; // Guard against Fiber being unmounted. 26759 26760 if (stateNode) { 26761 var _props = getFiberCurrentPropsFromNode(stateNode); 26762 26763 restoreImpl(internalInstance.stateNode, internalInstance.type, _props); 26764 } 26765} 26766 26767function setRestoreImplementation(impl) { 26768 restoreImpl = impl; 26769} 26770function enqueueStateRestore(target) { 26771 if (restoreTarget) { 26772 if (restoreQueue) { 26773 restoreQueue.push(target); 26774 } else { 26775 restoreQueue = [target]; 26776 } 26777 } else { 26778 restoreTarget = target; 26779 } 26780} 26781function needsStateRestore() { 26782 return restoreTarget !== null || restoreQueue !== null; 26783} 26784function restoreStateIfNeeded() { 26785 if (!restoreTarget) { 26786 return; 26787 } 26788 26789 var target = restoreTarget; 26790 var queuedTargets = restoreQueue; 26791 restoreTarget = null; 26792 restoreQueue = null; 26793 restoreStateOfTarget(target); 26794 26795 if (queuedTargets) { 26796 for (var i = 0; i < queuedTargets.length; i++) { 26797 restoreStateOfTarget(queuedTargets[i]); 26798 } 26799 } 26800} 26801 26802var enableProfilerTimer = true; // Trace which interactions trigger each commit. 26803 26804var enableDeprecatedFlareAPI = false; // Experimental Host Component support. 26805 26806var enableFundamentalAPI = false; // Experimental Scope support. 26807var warnAboutStringRefs = false; 26808 26809// the renderer. Such as when we're dispatching events or if third party 26810// libraries need to call batchedUpdates. Eventually, this API will go away when 26811// everything is batched by default. We'll then have a similar API to opt-out of 26812// scheduled work and instead do synchronous work. 26813// Defaults 26814 26815var batchedUpdatesImpl = function (fn, bookkeeping) { 26816 return fn(bookkeeping); 26817}; 26818 26819var discreteUpdatesImpl = function (fn, a, b, c, d) { 26820 return fn(a, b, c, d); 26821}; 26822 26823var flushDiscreteUpdatesImpl = function () {}; 26824 26825var batchedEventUpdatesImpl = batchedUpdatesImpl; 26826var isInsideEventHandler = false; 26827var isBatchingEventUpdates = false; 26828 26829function finishEventHandler() { 26830 // Here we wait until all updates have propagated, which is important 26831 // when using controlled components within layers: 26832 // https://github.com/facebook/react/issues/1698 26833 // Then we restore state of any controlled component. 26834 var controlledComponentsHavePendingUpdates = needsStateRestore(); 26835 26836 if (controlledComponentsHavePendingUpdates) { 26837 // If a controlled event was fired, we may need to restore the state of 26838 // the DOM node back to the controlled value. This is necessary when React 26839 // bails out of the update without touching the DOM. 26840 flushDiscreteUpdatesImpl(); 26841 restoreStateIfNeeded(); 26842 } 26843} 26844 26845function batchedUpdates(fn, bookkeeping) { 26846 if (isInsideEventHandler) { 26847 // If we are currently inside another batch, we need to wait until it 26848 // fully completes before restoring state. 26849 return fn(bookkeeping); 26850 } 26851 26852 isInsideEventHandler = true; 26853 26854 try { 26855 return batchedUpdatesImpl(fn, bookkeeping); 26856 } finally { 26857 isInsideEventHandler = false; 26858 finishEventHandler(); 26859 } 26860} 26861function batchedEventUpdates(fn, a, b) { 26862 if (isBatchingEventUpdates) { 26863 // If we are currently inside another batch, we need to wait until it 26864 // fully completes before restoring state. 26865 return fn(a, b); 26866 } 26867 26868 isBatchingEventUpdates = true; 26869 26870 try { 26871 return batchedEventUpdatesImpl(fn, a, b); 26872 } finally { 26873 isBatchingEventUpdates = false; 26874 finishEventHandler(); 26875 } 26876} // This is for the React Flare event system 26877function discreteUpdates(fn, a, b, c, d) { 26878 var prevIsInsideEventHandler = isInsideEventHandler; 26879 isInsideEventHandler = true; 26880 26881 try { 26882 return discreteUpdatesImpl(fn, a, b, c, d); 26883 } finally { 26884 isInsideEventHandler = prevIsInsideEventHandler; 26885 26886 if (!isInsideEventHandler) { 26887 finishEventHandler(); 26888 } 26889 } 26890} 26891function flushDiscreteUpdatesIfNeeded(timeStamp) { 26892 // event.timeStamp isn't overly reliable due to inconsistencies in 26893 // how different browsers have historically provided the time stamp. 26894 // Some browsers provide high-resolution time stamps for all events, 26895 // some provide low-resolution time stamps for all events. FF < 52 26896 // even mixes both time stamps together. Some browsers even report 26897 // negative time stamps or time stamps that are 0 (iOS9) in some cases. 26898 // Given we are only comparing two time stamps with equality (!==), 26899 // we are safe from the resolution differences. If the time stamp is 0 26900 // we bail-out of preventing the flush, which can affect semantics, 26901 // such as if an earlier flush removes or adds event listeners that 26902 // are fired in the subsequent flush. However, this is the same 26903 // behaviour as we had before this change, so the risks are low. 26904 if (!isInsideEventHandler && (!enableDeprecatedFlareAPI )) { 26905 flushDiscreteUpdatesImpl(); 26906 } 26907} 26908function setBatchingImplementation(_batchedUpdatesImpl, _discreteUpdatesImpl, _flushDiscreteUpdatesImpl, _batchedEventUpdatesImpl) { 26909 batchedUpdatesImpl = _batchedUpdatesImpl; 26910 discreteUpdatesImpl = _discreteUpdatesImpl; 26911 flushDiscreteUpdatesImpl = _flushDiscreteUpdatesImpl; 26912 batchedEventUpdatesImpl = _batchedEventUpdatesImpl; 26913} 26914 26915var DiscreteEvent = 0; 26916var UserBlockingEvent = 1; 26917var ContinuousEvent = 2; 26918 26919// A reserved attribute. 26920// It is handled by React separately and shouldn't be written to the DOM. 26921var RESERVED = 0; // A simple string attribute. 26922// Attributes that aren't in the whitelist are presumed to have this type. 26923 26924var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called 26925// "enumerated" attributes with "true" and "false" as possible values. 26926// When true, it should be set to a "true" string. 26927// When false, it should be set to a "false" string. 26928 26929var BOOLEANISH_STRING = 2; // A real boolean attribute. 26930// When true, it should be present (set either to an empty string or its name). 26931// When false, it should be omitted. 26932 26933var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value. 26934// When true, it should be present (set either to an empty string or its name). 26935// When false, it should be omitted. 26936// For any other value, should be present with that value. 26937 26938var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric. 26939// When falsy, it should be removed. 26940 26941var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric. 26942// When falsy, it should be removed. 26943 26944var POSITIVE_NUMERIC = 6; 26945 26946/* eslint-disable max-len */ 26947var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"; 26948/* eslint-enable max-len */ 26949 26950var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040"; 26951var ROOT_ATTRIBUTE_NAME = 'data-reactroot'; 26952var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$'); 26953var hasOwnProperty = Object.prototype.hasOwnProperty; 26954var illegalAttributeNameCache = {}; 26955var validatedAttributeNameCache = {}; 26956function isAttributeNameSafe(attributeName) { 26957 if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) { 26958 return true; 26959 } 26960 26961 if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) { 26962 return false; 26963 } 26964 26965 if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) { 26966 validatedAttributeNameCache[attributeName] = true; 26967 return true; 26968 } 26969 26970 illegalAttributeNameCache[attributeName] = true; 26971 26972 { 26973 error('Invalid attribute name: `%s`', attributeName); 26974 } 26975 26976 return false; 26977} 26978function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) { 26979 if (propertyInfo !== null) { 26980 return propertyInfo.type === RESERVED; 26981 } 26982 26983 if (isCustomComponentTag) { 26984 return false; 26985 } 26986 26987 if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) { 26988 return true; 26989 } 26990 26991 return false; 26992} 26993function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) { 26994 if (propertyInfo !== null && propertyInfo.type === RESERVED) { 26995 return false; 26996 } 26997 26998 switch (typeof value) { 26999 case 'function': // $FlowIssue symbol is perfectly valid here 27000 27001 case 'symbol': 27002 // eslint-disable-line 27003 return true; 27004 27005 case 'boolean': 27006 { 27007 if (isCustomComponentTag) { 27008 return false; 27009 } 27010 27011 if (propertyInfo !== null) { 27012 return !propertyInfo.acceptsBooleans; 27013 } else { 27014 var prefix = name.toLowerCase().slice(0, 5); 27015 return prefix !== 'data-' && prefix !== 'aria-'; 27016 } 27017 } 27018 27019 default: 27020 return false; 27021 } 27022} 27023function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) { 27024 if (value === null || typeof value === 'undefined') { 27025 return true; 27026 } 27027 27028 if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) { 27029 return true; 27030 } 27031 27032 if (isCustomComponentTag) { 27033 return false; 27034 } 27035 27036 if (propertyInfo !== null) { 27037 switch (propertyInfo.type) { 27038 case BOOLEAN: 27039 return !value; 27040 27041 case OVERLOADED_BOOLEAN: 27042 return value === false; 27043 27044 case NUMERIC: 27045 return isNaN(value); 27046 27047 case POSITIVE_NUMERIC: 27048 return isNaN(value) || value < 1; 27049 } 27050 } 27051 27052 return false; 27053} 27054function getPropertyInfo(name) { 27055 return properties.hasOwnProperty(name) ? properties[name] : null; 27056} 27057 27058function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL) { 27059 this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN; 27060 this.attributeName = attributeName; 27061 this.attributeNamespace = attributeNamespace; 27062 this.mustUseProperty = mustUseProperty; 27063 this.propertyName = name; 27064 this.type = type; 27065 this.sanitizeURL = sanitizeURL; 27066} // When adding attributes to this list, be sure to also add them to 27067// the `possibleStandardNames` module to ensure casing and incorrect 27068// name warnings. 27069 27070 27071var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM. 27072 27073var reservedProps = ['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular 27074// elements (not just inputs). Now that ReactDOMInput assigns to the 27075// defaultValue property -- do we need this? 27076'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style']; 27077 27078reservedProps.forEach(function (name) { 27079 properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty 27080 name, // attributeName 27081 null, // attributeNamespace 27082 false); 27083}); // A few React string attributes have a different name. 27084// This is a mapping from React prop names to the attribute names. 27085 27086[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) { 27087 var name = _ref[0], 27088 attributeName = _ref[1]; 27089 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty 27090 attributeName, // attributeName 27091 null, // attributeNamespace 27092 false); 27093}); // These are "enumerated" HTML attributes that accept "true" and "false". 27094// In React, we let users pass `true` and `false` even though technically 27095// these aren't boolean attributes (they are coerced to strings). 27096 27097['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) { 27098 properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty 27099 name.toLowerCase(), // attributeName 27100 null, // attributeNamespace 27101 false); 27102}); // These are "enumerated" SVG attributes that accept "true" and "false". 27103// In React, we let users pass `true` and `false` even though technically 27104// these aren't boolean attributes (they are coerced to strings). 27105// Since these are SVG attributes, their attribute names are case-sensitive. 27106 27107['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) { 27108 properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty 27109 name, // attributeName 27110 null, // attributeNamespace 27111 false); 27112}); // These are HTML boolean attributes. 27113 27114['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM 27115// on the client side because the browsers are inconsistent. Instead we call focus(). 27116'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata 27117'itemScope'].forEach(function (name) { 27118 properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty 27119 name.toLowerCase(), // attributeName 27120 null, // attributeNamespace 27121 false); 27122}); // These are the few React props that we set as DOM properties 27123// rather than attributes. These are all booleans. 27124 27125['checked', // Note: `option.selected` is not updated if `select.multiple` is 27126// disabled with `removeAttribute`. We have special logic for handling this. 27127'multiple', 'muted', 'selected' // NOTE: if you add a camelCased prop to this list, 27128// you'll need to set attributeName to name.toLowerCase() 27129// instead in the assignment below. 27130].forEach(function (name) { 27131 properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty 27132 name, // attributeName 27133 null, // attributeNamespace 27134 false); 27135}); // These are HTML attributes that are "overloaded booleans": they behave like 27136// booleans, but can also accept a string value. 27137 27138['capture', 'download' // NOTE: if you add a camelCased prop to this list, 27139// you'll need to set attributeName to name.toLowerCase() 27140// instead in the assignment below. 27141].forEach(function (name) { 27142 properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty 27143 name, // attributeName 27144 null, // attributeNamespace 27145 false); 27146}); // These are HTML attributes that must be positive numbers. 27147 27148['cols', 'rows', 'size', 'span' // NOTE: if you add a camelCased prop to this list, 27149// you'll need to set attributeName to name.toLowerCase() 27150// instead in the assignment below. 27151].forEach(function (name) { 27152 properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty 27153 name, // attributeName 27154 null, // attributeNamespace 27155 false); 27156}); // These are HTML attributes that must be numbers. 27157 27158['rowSpan', 'start'].forEach(function (name) { 27159 properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty 27160 name.toLowerCase(), // attributeName 27161 null, // attributeNamespace 27162 false); 27163}); 27164var CAMELIZE = /[\-\:]([a-z])/g; 27165 27166var capitalize = function (token) { 27167 return token[1].toUpperCase(); 27168}; // This is a list of all SVG attributes that need special casing, namespacing, 27169// or boolean value assignment. Regular attributes that just accept strings 27170// and have the same names are omitted, just like in the HTML whitelist. 27171// Some of these attributes can be hard to find. This list was created by 27172// scraping the MDN documentation. 27173 27174 27175['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height' // NOTE: if you add a camelCased prop to this list, 27176// you'll need to set attributeName to name.toLowerCase() 27177// instead in the assignment below. 27178].forEach(function (attributeName) { 27179 var name = attributeName.replace(CAMELIZE, capitalize); 27180 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty 27181 attributeName, null, // attributeNamespace 27182 false); 27183}); // String SVG attributes with the xlink namespace. 27184 27185['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type' // NOTE: if you add a camelCased prop to this list, 27186// you'll need to set attributeName to name.toLowerCase() 27187// instead in the assignment below. 27188].forEach(function (attributeName) { 27189 var name = attributeName.replace(CAMELIZE, capitalize); 27190 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty 27191 attributeName, 'http://www.w3.org/1999/xlink', false); 27192}); // String SVG attributes with the xml namespace. 27193 27194['xml:base', 'xml:lang', 'xml:space' // NOTE: if you add a camelCased prop to this list, 27195// you'll need to set attributeName to name.toLowerCase() 27196// instead in the assignment below. 27197].forEach(function (attributeName) { 27198 var name = attributeName.replace(CAMELIZE, capitalize); 27199 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty 27200 attributeName, 'http://www.w3.org/XML/1998/namespace', false); 27201}); // These attribute exists both in HTML and SVG. 27202// The attribute name is case-sensitive in SVG so we can't just use 27203// the React name like we do for attributes that exist only in HTML. 27204 27205['tabIndex', 'crossOrigin'].forEach(function (attributeName) { 27206 properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty 27207 attributeName.toLowerCase(), // attributeName 27208 null, // attributeNamespace 27209 false); 27210}); // These attributes accept URLs. These must not allow javascript: URLS. 27211// These will also need to accept Trusted Types object in the future. 27212 27213var xlinkHref = 'xlinkHref'; 27214properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty 27215'xlink:href', 'http://www.w3.org/1999/xlink', true); 27216['src', 'href', 'action', 'formAction'].forEach(function (attributeName) { 27217 properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty 27218 attributeName.toLowerCase(), // attributeName 27219 null, // attributeNamespace 27220 true); 27221}); 27222 27223var ReactDebugCurrentFrame = null; 27224 27225{ 27226 ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; 27227} // A javascript: URL can contain leading C0 control or \u0020 SPACE, 27228// and any newline or tab are filtered out as if they're not part of the URL. 27229// https://url.spec.whatwg.org/#url-parsing 27230// Tab or newline are defined as \r\n\t: 27231// https://infra.spec.whatwg.org/#ascii-tab-or-newline 27232// A C0 control is a code point in the range \u0000 NULL to \u001F 27233// INFORMATION SEPARATOR ONE, inclusive: 27234// https://infra.spec.whatwg.org/#c0-control-or-space 27235 27236/* eslint-disable max-len */ 27237 27238 27239var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i; 27240var didWarn = false; 27241 27242function sanitizeURL(url) { 27243 { 27244 if (!didWarn && isJavaScriptProtocol.test(url)) { 27245 didWarn = true; 27246 27247 error('A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url)); 27248 } 27249 } 27250} 27251 27252/** 27253 * Get the value for a property on a node. Only used in DEV for SSR validation. 27254 * The "expected" argument is used as a hint of what the expected value is. 27255 * Some properties have multiple equivalent values. 27256 */ 27257function getValueForProperty(node, name, expected, propertyInfo) { 27258 { 27259 if (propertyInfo.mustUseProperty) { 27260 var propertyName = propertyInfo.propertyName; 27261 return node[propertyName]; 27262 } else { 27263 if ( propertyInfo.sanitizeURL) { 27264 // If we haven't fully disabled javascript: URLs, and if 27265 // the hydration is successful of a javascript: URL, we 27266 // still want to warn on the client. 27267 sanitizeURL('' + expected); 27268 } 27269 27270 var attributeName = propertyInfo.attributeName; 27271 var stringValue = null; 27272 27273 if (propertyInfo.type === OVERLOADED_BOOLEAN) { 27274 if (node.hasAttribute(attributeName)) { 27275 var value = node.getAttribute(attributeName); 27276 27277 if (value === '') { 27278 return true; 27279 } 27280 27281 if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { 27282 return value; 27283 } 27284 27285 if (value === '' + expected) { 27286 return expected; 27287 } 27288 27289 return value; 27290 } 27291 } else if (node.hasAttribute(attributeName)) { 27292 if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { 27293 // We had an attribute but shouldn't have had one, so read it 27294 // for the error message. 27295 return node.getAttribute(attributeName); 27296 } 27297 27298 if (propertyInfo.type === BOOLEAN) { 27299 // If this was a boolean, it doesn't matter what the value is 27300 // the fact that we have it is the same as the expected. 27301 return expected; 27302 } // Even if this property uses a namespace we use getAttribute 27303 // because we assume its namespaced name is the same as our config. 27304 // To use getAttributeNS we need the local name which we don't have 27305 // in our config atm. 27306 27307 27308 stringValue = node.getAttribute(attributeName); 27309 } 27310 27311 if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { 27312 return stringValue === null ? expected : stringValue; 27313 } else if (stringValue === '' + expected) { 27314 return expected; 27315 } else { 27316 return stringValue; 27317 } 27318 } 27319 } 27320} 27321/** 27322 * Get the value for a attribute on a node. Only used in DEV for SSR validation. 27323 * The third argument is used as a hint of what the expected value is. Some 27324 * attributes have multiple equivalent values. 27325 */ 27326 27327function getValueForAttribute(node, name, expected) { 27328 { 27329 if (!isAttributeNameSafe(name)) { 27330 return; 27331 } 27332 27333 if (!node.hasAttribute(name)) { 27334 return expected === undefined ? undefined : null; 27335 } 27336 27337 var value = node.getAttribute(name); 27338 27339 if (value === '' + expected) { 27340 return expected; 27341 } 27342 27343 return value; 27344 } 27345} 27346/** 27347 * Sets the value for a property on a node. 27348 * 27349 * @param {DOMElement} node 27350 * @param {string} name 27351 * @param {*} value 27352 */ 27353 27354function setValueForProperty(node, name, value, isCustomComponentTag) { 27355 var propertyInfo = getPropertyInfo(name); 27356 27357 if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) { 27358 return; 27359 } 27360 27361 if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) { 27362 value = null; 27363 } // If the prop isn't in the special list, treat it as a simple attribute. 27364 27365 27366 if (isCustomComponentTag || propertyInfo === null) { 27367 if (isAttributeNameSafe(name)) { 27368 var _attributeName = name; 27369 27370 if (value === null) { 27371 node.removeAttribute(_attributeName); 27372 } else { 27373 node.setAttribute(_attributeName, '' + value); 27374 } 27375 } 27376 27377 return; 27378 } 27379 27380 var mustUseProperty = propertyInfo.mustUseProperty; 27381 27382 if (mustUseProperty) { 27383 var propertyName = propertyInfo.propertyName; 27384 27385 if (value === null) { 27386 var type = propertyInfo.type; 27387 node[propertyName] = type === BOOLEAN ? false : ''; 27388 } else { 27389 // Contrary to `setAttribute`, object properties are properly 27390 // `toString`ed by IE8/9. 27391 node[propertyName] = value; 27392 } 27393 27394 return; 27395 } // The rest are treated as attributes with special cases. 27396 27397 27398 var attributeName = propertyInfo.attributeName, 27399 attributeNamespace = propertyInfo.attributeNamespace; 27400 27401 if (value === null) { 27402 node.removeAttribute(attributeName); 27403 } else { 27404 var _type = propertyInfo.type; 27405 var attributeValue; 27406 27407 if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) { 27408 // If attribute type is boolean, we know for sure it won't be an execution sink 27409 // and we won't require Trusted Type here. 27410 attributeValue = ''; 27411 } else { 27412 // `setAttribute` with objects becomes only `[object]` in IE8/9, 27413 // ('' + value) makes it output the correct toString()-value. 27414 { 27415 attributeValue = '' + value; 27416 } 27417 27418 if (propertyInfo.sanitizeURL) { 27419 sanitizeURL(attributeValue.toString()); 27420 } 27421 } 27422 27423 if (attributeNamespace) { 27424 node.setAttributeNS(attributeNamespace, attributeName, attributeValue); 27425 } else { 27426 node.setAttribute(attributeName, attributeValue); 27427 } 27428 } 27429} 27430 27431var BEFORE_SLASH_RE = /^(.*)[\\\/]/; 27432function describeComponentFrame (name, source, ownerName) { 27433 var sourceInfo = ''; 27434 27435 if (source) { 27436 var path = source.fileName; 27437 var fileName = path.replace(BEFORE_SLASH_RE, ''); 27438 27439 { 27440 // In DEV, include code for a common special case: 27441 // prefer "folder/index.js" instead of just "index.js". 27442 if (/^index\./.test(fileName)) { 27443 var match = path.match(BEFORE_SLASH_RE); 27444 27445 if (match) { 27446 var pathBeforeSlash = match[1]; 27447 27448 if (pathBeforeSlash) { 27449 var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, ''); 27450 fileName = folderName + '/' + fileName; 27451 } 27452 } 27453 } 27454 } 27455 27456 sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')'; 27457 } else if (ownerName) { 27458 sourceInfo = ' (created by ' + ownerName + ')'; 27459 } 27460 27461 return '\n in ' + (name || 'Unknown') + sourceInfo; 27462} 27463 27464// The Symbol used to tag the ReactElement-like types. If there is no native Symbol 27465// nor polyfill, then a plain number is used for performance. 27466var hasSymbol = typeof Symbol === 'function' && Symbol.for; 27467var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; 27468var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; 27469var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; 27470var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; 27471var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; 27472var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; 27473var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary 27474var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; 27475var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; 27476var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; 27477var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; 27478var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; 27479var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; 27480var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; 27481var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; 27482var FAUX_ITERATOR_SYMBOL = '@@iterator'; 27483function getIteratorFn(maybeIterable) { 27484 if (maybeIterable === null || typeof maybeIterable !== 'object') { 27485 return null; 27486 } 27487 27488 var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; 27489 27490 if (typeof maybeIterator === 'function') { 27491 return maybeIterator; 27492 } 27493 27494 return null; 27495} 27496 27497var Uninitialized = -1; 27498var Pending = 0; 27499var Resolved = 1; 27500var Rejected = 2; 27501function refineResolvedLazyComponent(lazyComponent) { 27502 return lazyComponent._status === Resolved ? lazyComponent._result : null; 27503} 27504function initializeLazyComponentType(lazyComponent) { 27505 if (lazyComponent._status === Uninitialized) { 27506 lazyComponent._status = Pending; 27507 var ctor = lazyComponent._ctor; 27508 var thenable = ctor(); 27509 lazyComponent._result = thenable; 27510 thenable.then(function (moduleObject) { 27511 if (lazyComponent._status === Pending) { 27512 var defaultExport = moduleObject.default; 27513 27514 { 27515 if (defaultExport === undefined) { 27516 error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + "const MyComponent = lazy(() => import('./MyComponent'))", moduleObject); 27517 } 27518 } 27519 27520 lazyComponent._status = Resolved; 27521 lazyComponent._result = defaultExport; 27522 } 27523 }, function (error) { 27524 if (lazyComponent._status === Pending) { 27525 lazyComponent._status = Rejected; 27526 lazyComponent._result = error; 27527 } 27528 }); 27529 } 27530} 27531 27532function getWrappedName(outerType, innerType, wrapperName) { 27533 var functionName = innerType.displayName || innerType.name || ''; 27534 return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName); 27535} 27536 27537function getComponentName(type) { 27538 if (type == null) { 27539 // Host root, text node or just invalid type. 27540 return null; 27541 } 27542 27543 { 27544 if (typeof type.tag === 'number') { 27545 error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.'); 27546 } 27547 } 27548 27549 if (typeof type === 'function') { 27550 return type.displayName || type.name || null; 27551 } 27552 27553 if (typeof type === 'string') { 27554 return type; 27555 } 27556 27557 switch (type) { 27558 case REACT_FRAGMENT_TYPE: 27559 return 'Fragment'; 27560 27561 case REACT_PORTAL_TYPE: 27562 return 'Portal'; 27563 27564 case REACT_PROFILER_TYPE: 27565 return "Profiler"; 27566 27567 case REACT_STRICT_MODE_TYPE: 27568 return 'StrictMode'; 27569 27570 case REACT_SUSPENSE_TYPE: 27571 return 'Suspense'; 27572 27573 case REACT_SUSPENSE_LIST_TYPE: 27574 return 'SuspenseList'; 27575 } 27576 27577 if (typeof type === 'object') { 27578 switch (type.$$typeof) { 27579 case REACT_CONTEXT_TYPE: 27580 return 'Context.Consumer'; 27581 27582 case REACT_PROVIDER_TYPE: 27583 return 'Context.Provider'; 27584 27585 case REACT_FORWARD_REF_TYPE: 27586 return getWrappedName(type, type.render, 'ForwardRef'); 27587 27588 case REACT_MEMO_TYPE: 27589 return getComponentName(type.type); 27590 27591 case REACT_BLOCK_TYPE: 27592 return getComponentName(type.render); 27593 27594 case REACT_LAZY_TYPE: 27595 { 27596 var thenable = type; 27597 var resolvedThenable = refineResolvedLazyComponent(thenable); 27598 27599 if (resolvedThenable) { 27600 return getComponentName(resolvedThenable); 27601 } 27602 27603 break; 27604 } 27605 } 27606 } 27607 27608 return null; 27609} 27610 27611var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; 27612 27613function describeFiber(fiber) { 27614 switch (fiber.tag) { 27615 case HostRoot: 27616 case HostPortal: 27617 case HostText: 27618 case Fragment: 27619 case ContextProvider: 27620 case ContextConsumer: 27621 return ''; 27622 27623 default: 27624 var owner = fiber._debugOwner; 27625 var source = fiber._debugSource; 27626 var name = getComponentName(fiber.type); 27627 var ownerName = null; 27628 27629 if (owner) { 27630 ownerName = getComponentName(owner.type); 27631 } 27632 27633 return describeComponentFrame(name, source, ownerName); 27634 } 27635} 27636 27637function getStackByFiberInDevAndProd(workInProgress) { 27638 var info = ''; 27639 var node = workInProgress; 27640 27641 do { 27642 info += describeFiber(node); 27643 node = node.return; 27644 } while (node); 27645 27646 return info; 27647} 27648var current = null; 27649var isRendering = false; 27650function getCurrentFiberOwnerNameInDevOrNull() { 27651 { 27652 if (current === null) { 27653 return null; 27654 } 27655 27656 var owner = current._debugOwner; 27657 27658 if (owner !== null && typeof owner !== 'undefined') { 27659 return getComponentName(owner.type); 27660 } 27661 } 27662 27663 return null; 27664} 27665function getCurrentFiberStackInDev() { 27666 { 27667 if (current === null) { 27668 return ''; 27669 } // Safe because if current fiber exists, we are reconciling, 27670 // and it is guaranteed to be the work-in-progress version. 27671 27672 27673 return getStackByFiberInDevAndProd(current); 27674 } 27675} 27676function resetCurrentFiber() { 27677 { 27678 ReactDebugCurrentFrame$1.getCurrentStack = null; 27679 current = null; 27680 isRendering = false; 27681 } 27682} 27683function setCurrentFiber(fiber) { 27684 { 27685 ReactDebugCurrentFrame$1.getCurrentStack = getCurrentFiberStackInDev; 27686 current = fiber; 27687 isRendering = false; 27688 } 27689} 27690function setIsRendering(rendering) { 27691 { 27692 isRendering = rendering; 27693 } 27694} 27695 27696// Flow does not allow string concatenation of most non-string types. To work 27697// around this limitation, we use an opaque type that can only be obtained by 27698// passing the value through getToStringValue first. 27699function toString(value) { 27700 return '' + value; 27701} 27702function getToStringValue(value) { 27703 switch (typeof value) { 27704 case 'boolean': 27705 case 'number': 27706 case 'object': 27707 case 'string': 27708 case 'undefined': 27709 return value; 27710 27711 default: 27712 // function, symbol are assigned as empty strings 27713 return ''; 27714 } 27715} 27716 27717var ReactDebugCurrentFrame$2 = null; 27718var ReactControlledValuePropTypes = { 27719 checkPropTypes: null 27720}; 27721 27722{ 27723 ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame; 27724 var hasReadOnlyValue = { 27725 button: true, 27726 checkbox: true, 27727 image: true, 27728 hidden: true, 27729 radio: true, 27730 reset: true, 27731 submit: true 27732 }; 27733 var propTypes = { 27734 value: function (props, propName, componentName) { 27735 if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null || enableDeprecatedFlareAPI ) { 27736 return null; 27737 } 27738 27739 return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); 27740 }, 27741 checked: function (props, propName, componentName) { 27742 if (props.onChange || props.readOnly || props.disabled || props[propName] == null || enableDeprecatedFlareAPI ) { 27743 return null; 27744 } 27745 27746 return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); 27747 } 27748 }; 27749 /** 27750 * Provide a linked `value` attribute for controlled forms. You should not use 27751 * this outside of the ReactDOM controlled form components. 27752 */ 27753 27754 ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) { 27755 checkPropTypes(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$2.getStackAddendum); 27756 }; 27757} 27758 27759function isCheckable(elem) { 27760 var type = elem.type; 27761 var nodeName = elem.nodeName; 27762 return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio'); 27763} 27764 27765function getTracker(node) { 27766 return node._valueTracker; 27767} 27768 27769function detachTracker(node) { 27770 node._valueTracker = null; 27771} 27772 27773function getValueFromNode(node) { 27774 var value = ''; 27775 27776 if (!node) { 27777 return value; 27778 } 27779 27780 if (isCheckable(node)) { 27781 value = node.checked ? 'true' : 'false'; 27782 } else { 27783 value = node.value; 27784 } 27785 27786 return value; 27787} 27788 27789function trackValueOnNode(node) { 27790 var valueField = isCheckable(node) ? 'checked' : 'value'; 27791 var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField); 27792 var currentValue = '' + node[valueField]; // if someone has already defined a value or Safari, then bail 27793 // and don't track value will cause over reporting of changes, 27794 // but it's better then a hard failure 27795 // (needed for certain tests that spyOn input values and Safari) 27796 27797 if (node.hasOwnProperty(valueField) || typeof descriptor === 'undefined' || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') { 27798 return; 27799 } 27800 27801 var get = descriptor.get, 27802 set = descriptor.set; 27803 Object.defineProperty(node, valueField, { 27804 configurable: true, 27805 get: function () { 27806 return get.call(this); 27807 }, 27808 set: function (value) { 27809 currentValue = '' + value; 27810 set.call(this, value); 27811 } 27812 }); // We could've passed this the first time 27813 // but it triggers a bug in IE11 and Edge 14/15. 27814 // Calling defineProperty() again should be equivalent. 27815 // https://github.com/facebook/react/issues/11768 27816 27817 Object.defineProperty(node, valueField, { 27818 enumerable: descriptor.enumerable 27819 }); 27820 var tracker = { 27821 getValue: function () { 27822 return currentValue; 27823 }, 27824 setValue: function (value) { 27825 currentValue = '' + value; 27826 }, 27827 stopTracking: function () { 27828 detachTracker(node); 27829 delete node[valueField]; 27830 } 27831 }; 27832 return tracker; 27833} 27834 27835function track(node) { 27836 if (getTracker(node)) { 27837 return; 27838 } // TODO: Once it's just Fiber we can move this to node._wrapperState 27839 27840 27841 node._valueTracker = trackValueOnNode(node); 27842} 27843function updateValueIfChanged(node) { 27844 if (!node) { 27845 return false; 27846 } 27847 27848 var tracker = getTracker(node); // if there is no tracker at this point it's unlikely 27849 // that trying again will succeed 27850 27851 if (!tracker) { 27852 return true; 27853 } 27854 27855 var lastValue = tracker.getValue(); 27856 var nextValue = getValueFromNode(node); 27857 27858 if (nextValue !== lastValue) { 27859 tracker.setValue(nextValue); 27860 return true; 27861 } 27862 27863 return false; 27864} 27865 27866var didWarnValueDefaultValue = false; 27867var didWarnCheckedDefaultChecked = false; 27868var didWarnControlledToUncontrolled = false; 27869var didWarnUncontrolledToControlled = false; 27870 27871function isControlled(props) { 27872 var usesChecked = props.type === 'checkbox' || props.type === 'radio'; 27873 return usesChecked ? props.checked != null : props.value != null; 27874} 27875/** 27876 * Implements an <input> host component that allows setting these optional 27877 * props: `checked`, `value`, `defaultChecked`, and `defaultValue`. 27878 * 27879 * If `checked` or `value` are not supplied (or null/undefined), user actions 27880 * that affect the checked state or value will trigger updates to the element. 27881 * 27882 * If they are supplied (and not null/undefined), the rendered element will not 27883 * trigger updates to the element. Instead, the props must change in order for 27884 * the rendered element to be updated. 27885 * 27886 * The rendered element will be initialized as unchecked (or `defaultChecked`) 27887 * with an empty value (or `defaultValue`). 27888 * 27889 * See http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html 27890 */ 27891 27892 27893function getHostProps(element, props) { 27894 var node = element; 27895 var checked = props.checked; 27896 27897 var hostProps = _assign({}, props, { 27898 defaultChecked: undefined, 27899 defaultValue: undefined, 27900 value: undefined, 27901 checked: checked != null ? checked : node._wrapperState.initialChecked 27902 }); 27903 27904 return hostProps; 27905} 27906function initWrapperState(element, props) { 27907 { 27908 ReactControlledValuePropTypes.checkPropTypes('input', props); 27909 27910 if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) { 27911 error('%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type); 27912 27913 didWarnCheckedDefaultChecked = true; 27914 } 27915 27916 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { 27917 error('%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type); 27918 27919 didWarnValueDefaultValue = true; 27920 } 27921 } 27922 27923 var node = element; 27924 var defaultValue = props.defaultValue == null ? '' : props.defaultValue; 27925 node._wrapperState = { 27926 initialChecked: props.checked != null ? props.checked : props.defaultChecked, 27927 initialValue: getToStringValue(props.value != null ? props.value : defaultValue), 27928 controlled: isControlled(props) 27929 }; 27930} 27931function updateChecked(element, props) { 27932 var node = element; 27933 var checked = props.checked; 27934 27935 if (checked != null) { 27936 setValueForProperty(node, 'checked', checked, false); 27937 } 27938} 27939function updateWrapper(element, props) { 27940 var node = element; 27941 27942 { 27943 var controlled = isControlled(props); 27944 27945 if (!node._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) { 27946 error('A component is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type); 27947 27948 didWarnUncontrolledToControlled = true; 27949 } 27950 27951 if (node._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) { 27952 error('A component is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type); 27953 27954 didWarnControlledToUncontrolled = true; 27955 } 27956 } 27957 27958 updateChecked(element, props); 27959 var value = getToStringValue(props.value); 27960 var type = props.type; 27961 27962 if (value != null) { 27963 if (type === 'number') { 27964 if (value === 0 && node.value === '' || // We explicitly want to coerce to number here if possible. 27965 // eslint-disable-next-line 27966 node.value != value) { 27967 node.value = toString(value); 27968 } 27969 } else if (node.value !== toString(value)) { 27970 node.value = toString(value); 27971 } 27972 } else if (type === 'submit' || type === 'reset') { 27973 // Submit/reset inputs need the attribute removed completely to avoid 27974 // blank-text buttons. 27975 node.removeAttribute('value'); 27976 return; 27977 } 27978 27979 { 27980 // When syncing the value attribute, the value comes from a cascade of 27981 // properties: 27982 // 1. The value React property 27983 // 2. The defaultValue React property 27984 // 3. Otherwise there should be no change 27985 if (props.hasOwnProperty('value')) { 27986 setDefaultValue(node, props.type, value); 27987 } else if (props.hasOwnProperty('defaultValue')) { 27988 setDefaultValue(node, props.type, getToStringValue(props.defaultValue)); 27989 } 27990 } 27991 27992 { 27993 // When syncing the checked attribute, it only changes when it needs 27994 // to be removed, such as transitioning from a checkbox into a text input 27995 if (props.checked == null && props.defaultChecked != null) { 27996 node.defaultChecked = !!props.defaultChecked; 27997 } 27998 } 27999} 28000function postMountWrapper(element, props, isHydrating) { 28001 var node = element; // Do not assign value if it is already set. This prevents user text input 28002 // from being lost during SSR hydration. 28003 28004 if (props.hasOwnProperty('value') || props.hasOwnProperty('defaultValue')) { 28005 var type = props.type; 28006 var isButton = type === 'submit' || type === 'reset'; // Avoid setting value attribute on submit/reset inputs as it overrides the 28007 // default value provided by the browser. See: #12872 28008 28009 if (isButton && (props.value === undefined || props.value === null)) { 28010 return; 28011 } 28012 28013 var initialValue = toString(node._wrapperState.initialValue); // Do not assign value if it is already set. This prevents user text input 28014 // from being lost during SSR hydration. 28015 28016 if (!isHydrating) { 28017 { 28018 // When syncing the value attribute, the value property should use 28019 // the wrapperState._initialValue property. This uses: 28020 // 28021 // 1. The value React property when present 28022 // 2. The defaultValue React property when present 28023 // 3. An empty string 28024 if (initialValue !== node.value) { 28025 node.value = initialValue; 28026 } 28027 } 28028 } 28029 28030 { 28031 // Otherwise, the value attribute is synchronized to the property, 28032 // so we assign defaultValue to the same thing as the value property 28033 // assignment step above. 28034 node.defaultValue = initialValue; 28035 } 28036 } // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug 28037 // this is needed to work around a chrome bug where setting defaultChecked 28038 // will sometimes influence the value of checked (even after detachment). 28039 // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416 28040 // We need to temporarily unset name to avoid disrupting radio button groups. 28041 28042 28043 var name = node.name; 28044 28045 if (name !== '') { 28046 node.name = ''; 28047 } 28048 28049 { 28050 // When syncing the checked attribute, both the checked property and 28051 // attribute are assigned at the same time using defaultChecked. This uses: 28052 // 28053 // 1. The checked React property when present 28054 // 2. The defaultChecked React property when present 28055 // 3. Otherwise, false 28056 node.defaultChecked = !node.defaultChecked; 28057 node.defaultChecked = !!node._wrapperState.initialChecked; 28058 } 28059 28060 if (name !== '') { 28061 node.name = name; 28062 } 28063} 28064function restoreControlledState(element, props) { 28065 var node = element; 28066 updateWrapper(node, props); 28067 updateNamedCousins(node, props); 28068} 28069 28070function updateNamedCousins(rootNode, props) { 28071 var name = props.name; 28072 28073 if (props.type === 'radio' && name != null) { 28074 var queryRoot = rootNode; 28075 28076 while (queryRoot.parentNode) { 28077 queryRoot = queryRoot.parentNode; 28078 } // If `rootNode.form` was non-null, then we could try `form.elements`, 28079 // but that sometimes behaves strangely in IE8. We could also try using 28080 // `form.getElementsByName`, but that will only return direct children 28081 // and won't include inputs that use the HTML5 `form=` attribute. Since 28082 // the input might not even be in a form. It might not even be in the 28083 // document. Let's just use the local `querySelectorAll` to ensure we don't 28084 // miss anything. 28085 28086 28087 var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]'); 28088 28089 for (var i = 0; i < group.length; i++) { 28090 var otherNode = group[i]; 28091 28092 if (otherNode === rootNode || otherNode.form !== rootNode.form) { 28093 continue; 28094 } // This will throw if radio buttons rendered by different copies of React 28095 // and the same name are rendered into the same form (same as #1939). 28096 // That's probably okay; we don't support it just as we don't support 28097 // mixing React radio buttons with non-React ones. 28098 28099 28100 var otherProps = getFiberCurrentPropsFromNode$1(otherNode); 28101 28102 if (!otherProps) { 28103 { 28104 throw Error( "ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported." ); 28105 } 28106 } // We need update the tracked value on the named cousin since the value 28107 // was changed but the input saw no event or value set 28108 28109 28110 updateValueIfChanged(otherNode); // If this is a controlled radio button group, forcing the input that 28111 // was previously checked to update will cause it to be come re-checked 28112 // as appropriate. 28113 28114 updateWrapper(otherNode, otherProps); 28115 } 28116 } 28117} // In Chrome, assigning defaultValue to certain input types triggers input validation. 28118// For number inputs, the display value loses trailing decimal points. For email inputs, 28119// Chrome raises "The specified value <x> is not a valid email address". 28120// 28121// Here we check to see if the defaultValue has actually changed, avoiding these problems 28122// when the user is inputting text 28123// 28124// https://github.com/facebook/react/issues/7253 28125 28126 28127function setDefaultValue(node, type, value) { 28128 if ( // Focused number inputs synchronize on blur. See ChangeEventPlugin.js 28129 type !== 'number' || node.ownerDocument.activeElement !== node) { 28130 if (value == null) { 28131 node.defaultValue = toString(node._wrapperState.initialValue); 28132 } else if (node.defaultValue !== toString(value)) { 28133 node.defaultValue = toString(value); 28134 } 28135 } 28136} 28137 28138var didWarnSelectedSetOnOption = false; 28139var didWarnInvalidChild = false; 28140 28141function flattenChildren(children) { 28142 var content = ''; // Flatten children. We'll warn if they are invalid 28143 // during validateProps() which runs for hydration too. 28144 // Note that this would throw on non-element objects. 28145 // Elements are stringified (which is normally irrelevant 28146 // but matters for <fbt>). 28147 28148 React.Children.forEach(children, function (child) { 28149 if (child == null) { 28150 return; 28151 } 28152 28153 content += child; // Note: we don't warn about invalid children here. 28154 // Instead, this is done separately below so that 28155 // it happens during the hydration codepath too. 28156 }); 28157 return content; 28158} 28159/** 28160 * Implements an <option> host component that warns when `selected` is set. 28161 */ 28162 28163 28164function validateProps(element, props) { 28165 { 28166 // This mirrors the codepath above, but runs for hydration too. 28167 // Warn about invalid children here so that client and hydration are consistent. 28168 // TODO: this seems like it could cause a DEV-only throw for hydration 28169 // if children contains a non-element object. We should try to avoid that. 28170 if (typeof props.children === 'object' && props.children !== null) { 28171 React.Children.forEach(props.children, function (child) { 28172 if (child == null) { 28173 return; 28174 } 28175 28176 if (typeof child === 'string' || typeof child === 'number') { 28177 return; 28178 } 28179 28180 if (typeof child.type !== 'string') { 28181 return; 28182 } 28183 28184 if (!didWarnInvalidChild) { 28185 didWarnInvalidChild = true; 28186 28187 error('Only strings and numbers are supported as <option> children.'); 28188 } 28189 }); 28190 } // TODO: Remove support for `selected` in <option>. 28191 28192 28193 if (props.selected != null && !didWarnSelectedSetOnOption) { 28194 error('Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.'); 28195 28196 didWarnSelectedSetOnOption = true; 28197 } 28198 } 28199} 28200function postMountWrapper$1(element, props) { 28201 // value="" should make a value attribute (#6219) 28202 if (props.value != null) { 28203 element.setAttribute('value', toString(getToStringValue(props.value))); 28204 } 28205} 28206function getHostProps$1(element, props) { 28207 var hostProps = _assign({ 28208 children: undefined 28209 }, props); 28210 28211 var content = flattenChildren(props.children); 28212 28213 if (content) { 28214 hostProps.children = content; 28215 } 28216 28217 return hostProps; 28218} 28219 28220var didWarnValueDefaultValue$1; 28221 28222{ 28223 didWarnValueDefaultValue$1 = false; 28224} 28225 28226function getDeclarationErrorAddendum() { 28227 var ownerName = getCurrentFiberOwnerNameInDevOrNull(); 28228 28229 if (ownerName) { 28230 return '\n\nCheck the render method of `' + ownerName + '`.'; 28231 } 28232 28233 return ''; 28234} 28235 28236var valuePropNames = ['value', 'defaultValue']; 28237/** 28238 * Validation function for `value` and `defaultValue`. 28239 */ 28240 28241function checkSelectPropTypes(props) { 28242 { 28243 ReactControlledValuePropTypes.checkPropTypes('select', props); 28244 28245 for (var i = 0; i < valuePropNames.length; i++) { 28246 var propName = valuePropNames[i]; 28247 28248 if (props[propName] == null) { 28249 continue; 28250 } 28251 28252 var isArray = Array.isArray(props[propName]); 28253 28254 if (props.multiple && !isArray) { 28255 error('The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum()); 28256 } else if (!props.multiple && isArray) { 28257 error('The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum()); 28258 } 28259 } 28260 } 28261} 28262 28263function updateOptions(node, multiple, propValue, setDefaultSelected) { 28264 var options = node.options; 28265 28266 if (multiple) { 28267 var selectedValues = propValue; 28268 var selectedValue = {}; 28269 28270 for (var i = 0; i < selectedValues.length; i++) { 28271 // Prefix to avoid chaos with special keys. 28272 selectedValue['$' + selectedValues[i]] = true; 28273 } 28274 28275 for (var _i = 0; _i < options.length; _i++) { 28276 var selected = selectedValue.hasOwnProperty('$' + options[_i].value); 28277 28278 if (options[_i].selected !== selected) { 28279 options[_i].selected = selected; 28280 } 28281 28282 if (selected && setDefaultSelected) { 28283 options[_i].defaultSelected = true; 28284 } 28285 } 28286 } else { 28287 // Do not set `select.value` as exact behavior isn't consistent across all 28288 // browsers for all cases. 28289 var _selectedValue = toString(getToStringValue(propValue)); 28290 28291 var defaultSelected = null; 28292 28293 for (var _i2 = 0; _i2 < options.length; _i2++) { 28294 if (options[_i2].value === _selectedValue) { 28295 options[_i2].selected = true; 28296 28297 if (setDefaultSelected) { 28298 options[_i2].defaultSelected = true; 28299 } 28300 28301 return; 28302 } 28303 28304 if (defaultSelected === null && !options[_i2].disabled) { 28305 defaultSelected = options[_i2]; 28306 } 28307 } 28308 28309 if (defaultSelected !== null) { 28310 defaultSelected.selected = true; 28311 } 28312 } 28313} 28314/** 28315 * Implements a <select> host component that allows optionally setting the 28316 * props `value` and `defaultValue`. If `multiple` is false, the prop must be a 28317 * stringable. If `multiple` is true, the prop must be an array of stringables. 28318 * 28319 * If `value` is not supplied (or null/undefined), user actions that change the 28320 * selected option will trigger updates to the rendered options. 28321 * 28322 * If it is supplied (and not null/undefined), the rendered options will not 28323 * update in response to user actions. Instead, the `value` prop must change in 28324 * order for the rendered options to update. 28325 * 28326 * If `defaultValue` is provided, any options with the supplied values will be 28327 * selected. 28328 */ 28329 28330 28331function getHostProps$2(element, props) { 28332 return _assign({}, props, { 28333 value: undefined 28334 }); 28335} 28336function initWrapperState$1(element, props) { 28337 var node = element; 28338 28339 { 28340 checkSelectPropTypes(props); 28341 } 28342 28343 node._wrapperState = { 28344 wasMultiple: !!props.multiple 28345 }; 28346 28347 { 28348 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue$1) { 28349 error('Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components'); 28350 28351 didWarnValueDefaultValue$1 = true; 28352 } 28353 } 28354} 28355function postMountWrapper$2(element, props) { 28356 var node = element; 28357 node.multiple = !!props.multiple; 28358 var value = props.value; 28359 28360 if (value != null) { 28361 updateOptions(node, !!props.multiple, value, false); 28362 } else if (props.defaultValue != null) { 28363 updateOptions(node, !!props.multiple, props.defaultValue, true); 28364 } 28365} 28366function postUpdateWrapper(element, props) { 28367 var node = element; 28368 var wasMultiple = node._wrapperState.wasMultiple; 28369 node._wrapperState.wasMultiple = !!props.multiple; 28370 var value = props.value; 28371 28372 if (value != null) { 28373 updateOptions(node, !!props.multiple, value, false); 28374 } else if (wasMultiple !== !!props.multiple) { 28375 // For simplicity, reapply `defaultValue` if `multiple` is toggled. 28376 if (props.defaultValue != null) { 28377 updateOptions(node, !!props.multiple, props.defaultValue, true); 28378 } else { 28379 // Revert the select back to its default unselected state. 28380 updateOptions(node, !!props.multiple, props.multiple ? [] : '', false); 28381 } 28382 } 28383} 28384function restoreControlledState$1(element, props) { 28385 var node = element; 28386 var value = props.value; 28387 28388 if (value != null) { 28389 updateOptions(node, !!props.multiple, value, false); 28390 } 28391} 28392 28393var didWarnValDefaultVal = false; 28394 28395/** 28396 * Implements a <textarea> host component that allows setting `value`, and 28397 * `defaultValue`. This differs from the traditional DOM API because value is 28398 * usually set as PCDATA children. 28399 * 28400 * If `value` is not supplied (or null/undefined), user actions that affect the 28401 * value will trigger updates to the element. 28402 * 28403 * If `value` is supplied (and not null/undefined), the rendered element will 28404 * not trigger updates to the element. Instead, the `value` prop must change in 28405 * order for the rendered element to be updated. 28406 * 28407 * The rendered element will be initialized with an empty value, the prop 28408 * `defaultValue` if specified, or the children content (deprecated). 28409 */ 28410function getHostProps$3(element, props) { 28411 var node = element; 28412 28413 if (!(props.dangerouslySetInnerHTML == null)) { 28414 { 28415 throw Error( "`dangerouslySetInnerHTML` does not make sense on <textarea>." ); 28416 } 28417 } // Always set children to the same thing. In IE9, the selection range will 28418 // get reset if `textContent` is mutated. We could add a check in setTextContent 28419 // to only set the value if/when the value differs from the node value (which would 28420 // completely solve this IE9 bug), but Sebastian+Sophie seemed to like this 28421 // solution. The value can be a boolean or object so that's why it's forced 28422 // to be a string. 28423 28424 28425 var hostProps = _assign({}, props, { 28426 value: undefined, 28427 defaultValue: undefined, 28428 children: toString(node._wrapperState.initialValue) 28429 }); 28430 28431 return hostProps; 28432} 28433function initWrapperState$2(element, props) { 28434 var node = element; 28435 28436 { 28437 ReactControlledValuePropTypes.checkPropTypes('textarea', props); 28438 28439 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) { 28440 error('%s contains a textarea with both value and defaultValue props. ' + 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component'); 28441 28442 didWarnValDefaultVal = true; 28443 } 28444 } 28445 28446 var initialValue = props.value; // Only bother fetching default value if we're going to use it 28447 28448 if (initialValue == null) { 28449 var children = props.children, 28450 defaultValue = props.defaultValue; 28451 28452 if (children != null) { 28453 { 28454 error('Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.'); 28455 } 28456 28457 { 28458 if (!(defaultValue == null)) { 28459 { 28460 throw Error( "If you supply `defaultValue` on a <textarea>, do not pass children." ); 28461 } 28462 } 28463 28464 if (Array.isArray(children)) { 28465 if (!(children.length <= 1)) { 28466 { 28467 throw Error( "<textarea> can only have at most one child." ); 28468 } 28469 } 28470 28471 children = children[0]; 28472 } 28473 28474 defaultValue = children; 28475 } 28476 } 28477 28478 if (defaultValue == null) { 28479 defaultValue = ''; 28480 } 28481 28482 initialValue = defaultValue; 28483 } 28484 28485 node._wrapperState = { 28486 initialValue: getToStringValue(initialValue) 28487 }; 28488} 28489function updateWrapper$1(element, props) { 28490 var node = element; 28491 var value = getToStringValue(props.value); 28492 var defaultValue = getToStringValue(props.defaultValue); 28493 28494 if (value != null) { 28495 // Cast `value` to a string to ensure the value is set correctly. While 28496 // browsers typically do this as necessary, jsdom doesn't. 28497 var newValue = toString(value); // To avoid side effects (such as losing text selection), only set value if changed 28498 28499 if (newValue !== node.value) { 28500 node.value = newValue; 28501 } 28502 28503 if (props.defaultValue == null && node.defaultValue !== newValue) { 28504 node.defaultValue = newValue; 28505 } 28506 } 28507 28508 if (defaultValue != null) { 28509 node.defaultValue = toString(defaultValue); 28510 } 28511} 28512function postMountWrapper$3(element, props) { 28513 var node = element; // This is in postMount because we need access to the DOM node, which is not 28514 // available until after the component has mounted. 28515 28516 var textContent = node.textContent; // Only set node.value if textContent is equal to the expected 28517 // initial value. In IE10/IE11 there is a bug where the placeholder attribute 28518 // will populate textContent as well. 28519 // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/ 28520 28521 if (textContent === node._wrapperState.initialValue) { 28522 if (textContent !== '' && textContent !== null) { 28523 node.value = textContent; 28524 } 28525 } 28526} 28527function restoreControlledState$2(element, props) { 28528 // DOM component is still mounted; update 28529 updateWrapper$1(element, props); 28530} 28531 28532var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml'; 28533var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML'; 28534var SVG_NAMESPACE = 'http://www.w3.org/2000/svg'; 28535var Namespaces = { 28536 html: HTML_NAMESPACE, 28537 mathml: MATH_NAMESPACE, 28538 svg: SVG_NAMESPACE 28539}; // Assumes there is no parent namespace. 28540 28541function getIntrinsicNamespace(type) { 28542 switch (type) { 28543 case 'svg': 28544 return SVG_NAMESPACE; 28545 28546 case 'math': 28547 return MATH_NAMESPACE; 28548 28549 default: 28550 return HTML_NAMESPACE; 28551 } 28552} 28553function getChildNamespace(parentNamespace, type) { 28554 if (parentNamespace == null || parentNamespace === HTML_NAMESPACE) { 28555 // No (or default) parent namespace: potential entry point. 28556 return getIntrinsicNamespace(type); 28557 } 28558 28559 if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') { 28560 // We're leaving SVG. 28561 return HTML_NAMESPACE; 28562 } // By default, pass namespace below. 28563 28564 28565 return parentNamespace; 28566} 28567 28568/* globals MSApp */ 28569 28570/** 28571 * Create a function which has 'unsafe' privileges (required by windows8 apps) 28572 */ 28573var createMicrosoftUnsafeLocalFunction = function (func) { 28574 if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) { 28575 return function (arg0, arg1, arg2, arg3) { 28576 MSApp.execUnsafeLocalFunction(function () { 28577 return func(arg0, arg1, arg2, arg3); 28578 }); 28579 }; 28580 } else { 28581 return func; 28582 } 28583}; 28584 28585var reusableSVGContainer; 28586/** 28587 * Set the innerHTML property of a node 28588 * 28589 * @param {DOMElement} node 28590 * @param {string} html 28591 * @internal 28592 */ 28593 28594var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) { 28595 if (node.namespaceURI === Namespaces.svg) { 28596 28597 if (!('innerHTML' in node)) { 28598 // IE does not have innerHTML for SVG nodes, so instead we inject the 28599 // new markup in a temp node and then move the child nodes across into 28600 // the target node 28601 reusableSVGContainer = reusableSVGContainer || document.createElement('div'); 28602 reusableSVGContainer.innerHTML = '<svg>' + html.valueOf().toString() + '</svg>'; 28603 var svgNode = reusableSVGContainer.firstChild; 28604 28605 while (node.firstChild) { 28606 node.removeChild(node.firstChild); 28607 } 28608 28609 while (svgNode.firstChild) { 28610 node.appendChild(svgNode.firstChild); 28611 } 28612 28613 return; 28614 } 28615 } 28616 28617 node.innerHTML = html; 28618}); 28619 28620/** 28621 * HTML nodeType values that represent the type of the node 28622 */ 28623var ELEMENT_NODE = 1; 28624var TEXT_NODE = 3; 28625var COMMENT_NODE = 8; 28626var DOCUMENT_NODE = 9; 28627var DOCUMENT_FRAGMENT_NODE = 11; 28628 28629/** 28630 * Set the textContent property of a node. For text updates, it's faster 28631 * to set the `nodeValue` of the Text node directly instead of using 28632 * `.textContent` which will remove the existing node and create a new one. 28633 * 28634 * @param {DOMElement} node 28635 * @param {string} text 28636 * @internal 28637 */ 28638 28639var setTextContent = function (node, text) { 28640 if (text) { 28641 var firstChild = node.firstChild; 28642 28643 if (firstChild && firstChild === node.lastChild && firstChild.nodeType === TEXT_NODE) { 28644 firstChild.nodeValue = text; 28645 return; 28646 } 28647 } 28648 28649 node.textContent = text; 28650}; 28651 28652// Do not use the below two methods directly! 28653// Instead use constants exported from DOMTopLevelEventTypes in ReactDOM. 28654// (It is the only module that is allowed to access these methods.) 28655function unsafeCastStringToDOMTopLevelType(topLevelType) { 28656 return topLevelType; 28657} 28658function unsafeCastDOMTopLevelTypeToString(topLevelType) { 28659 return topLevelType; 28660} 28661 28662/** 28663 * Generate a mapping of standard vendor prefixes using the defined style property and event name. 28664 * 28665 * @param {string} styleProp 28666 * @param {string} eventName 28667 * @returns {object} 28668 */ 28669 28670function makePrefixMap(styleProp, eventName) { 28671 var prefixes = {}; 28672 prefixes[styleProp.toLowerCase()] = eventName.toLowerCase(); 28673 prefixes['Webkit' + styleProp] = 'webkit' + eventName; 28674 prefixes['Moz' + styleProp] = 'moz' + eventName; 28675 return prefixes; 28676} 28677/** 28678 * A list of event names to a configurable list of vendor prefixes. 28679 */ 28680 28681 28682var vendorPrefixes = { 28683 animationend: makePrefixMap('Animation', 'AnimationEnd'), 28684 animationiteration: makePrefixMap('Animation', 'AnimationIteration'), 28685 animationstart: makePrefixMap('Animation', 'AnimationStart'), 28686 transitionend: makePrefixMap('Transition', 'TransitionEnd') 28687}; 28688/** 28689 * Event names that have already been detected and prefixed (if applicable). 28690 */ 28691 28692var prefixedEventNames = {}; 28693/** 28694 * Element to check for prefixes on. 28695 */ 28696 28697var style = {}; 28698/** 28699 * Bootstrap if a DOM exists. 28700 */ 28701 28702if (canUseDOM) { 28703 style = document.createElement('div').style; // On some platforms, in particular some releases of Android 4.x, 28704 // the un-prefixed "animation" and "transition" properties are defined on the 28705 // style object but the events that fire will still be prefixed, so we need 28706 // to check if the un-prefixed events are usable, and if not remove them from the map. 28707 28708 if (!('AnimationEvent' in window)) { 28709 delete vendorPrefixes.animationend.animation; 28710 delete vendorPrefixes.animationiteration.animation; 28711 delete vendorPrefixes.animationstart.animation; 28712 } // Same as above 28713 28714 28715 if (!('TransitionEvent' in window)) { 28716 delete vendorPrefixes.transitionend.transition; 28717 } 28718} 28719/** 28720 * Attempts to determine the correct vendor prefixed event name. 28721 * 28722 * @param {string} eventName 28723 * @returns {string} 28724 */ 28725 28726 28727function getVendorPrefixedEventName(eventName) { 28728 if (prefixedEventNames[eventName]) { 28729 return prefixedEventNames[eventName]; 28730 } else if (!vendorPrefixes[eventName]) { 28731 return eventName; 28732 } 28733 28734 var prefixMap = vendorPrefixes[eventName]; 28735 28736 for (var styleProp in prefixMap) { 28737 if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) { 28738 return prefixedEventNames[eventName] = prefixMap[styleProp]; 28739 } 28740 } 28741 28742 return eventName; 28743} 28744 28745/** 28746 * To identify top level events in ReactDOM, we use constants defined by this 28747 * module. This is the only module that uses the unsafe* methods to express 28748 * that the constants actually correspond to the browser event names. This lets 28749 * us save some bundle size by avoiding a top level type -> event name map. 28750 * The rest of ReactDOM code should import top level types from this file. 28751 */ 28752 28753var TOP_ABORT = unsafeCastStringToDOMTopLevelType('abort'); 28754var TOP_ANIMATION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationend')); 28755var TOP_ANIMATION_ITERATION = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationiteration')); 28756var TOP_ANIMATION_START = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationstart')); 28757var TOP_BLUR = unsafeCastStringToDOMTopLevelType('blur'); 28758var TOP_CAN_PLAY = unsafeCastStringToDOMTopLevelType('canplay'); 28759var TOP_CAN_PLAY_THROUGH = unsafeCastStringToDOMTopLevelType('canplaythrough'); 28760var TOP_CANCEL = unsafeCastStringToDOMTopLevelType('cancel'); 28761var TOP_CHANGE = unsafeCastStringToDOMTopLevelType('change'); 28762var TOP_CLICK = unsafeCastStringToDOMTopLevelType('click'); 28763var TOP_CLOSE = unsafeCastStringToDOMTopLevelType('close'); 28764var TOP_COMPOSITION_END = unsafeCastStringToDOMTopLevelType('compositionend'); 28765var TOP_COMPOSITION_START = unsafeCastStringToDOMTopLevelType('compositionstart'); 28766var TOP_COMPOSITION_UPDATE = unsafeCastStringToDOMTopLevelType('compositionupdate'); 28767var TOP_CONTEXT_MENU = unsafeCastStringToDOMTopLevelType('contextmenu'); 28768var TOP_COPY = unsafeCastStringToDOMTopLevelType('copy'); 28769var TOP_CUT = unsafeCastStringToDOMTopLevelType('cut'); 28770var TOP_DOUBLE_CLICK = unsafeCastStringToDOMTopLevelType('dblclick'); 28771var TOP_AUX_CLICK = unsafeCastStringToDOMTopLevelType('auxclick'); 28772var TOP_DRAG = unsafeCastStringToDOMTopLevelType('drag'); 28773var TOP_DRAG_END = unsafeCastStringToDOMTopLevelType('dragend'); 28774var TOP_DRAG_ENTER = unsafeCastStringToDOMTopLevelType('dragenter'); 28775var TOP_DRAG_EXIT = unsafeCastStringToDOMTopLevelType('dragexit'); 28776var TOP_DRAG_LEAVE = unsafeCastStringToDOMTopLevelType('dragleave'); 28777var TOP_DRAG_OVER = unsafeCastStringToDOMTopLevelType('dragover'); 28778var TOP_DRAG_START = unsafeCastStringToDOMTopLevelType('dragstart'); 28779var TOP_DROP = unsafeCastStringToDOMTopLevelType('drop'); 28780var TOP_DURATION_CHANGE = unsafeCastStringToDOMTopLevelType('durationchange'); 28781var TOP_EMPTIED = unsafeCastStringToDOMTopLevelType('emptied'); 28782var TOP_ENCRYPTED = unsafeCastStringToDOMTopLevelType('encrypted'); 28783var TOP_ENDED = unsafeCastStringToDOMTopLevelType('ended'); 28784var TOP_ERROR = unsafeCastStringToDOMTopLevelType('error'); 28785var TOP_FOCUS = unsafeCastStringToDOMTopLevelType('focus'); 28786var TOP_GOT_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('gotpointercapture'); 28787var TOP_INPUT = unsafeCastStringToDOMTopLevelType('input'); 28788var TOP_INVALID = unsafeCastStringToDOMTopLevelType('invalid'); 28789var TOP_KEY_DOWN = unsafeCastStringToDOMTopLevelType('keydown'); 28790var TOP_KEY_PRESS = unsafeCastStringToDOMTopLevelType('keypress'); 28791var TOP_KEY_UP = unsafeCastStringToDOMTopLevelType('keyup'); 28792var TOP_LOAD = unsafeCastStringToDOMTopLevelType('load'); 28793var TOP_LOAD_START = unsafeCastStringToDOMTopLevelType('loadstart'); 28794var TOP_LOADED_DATA = unsafeCastStringToDOMTopLevelType('loadeddata'); 28795var TOP_LOADED_METADATA = unsafeCastStringToDOMTopLevelType('loadedmetadata'); 28796var TOP_LOST_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('lostpointercapture'); 28797var TOP_MOUSE_DOWN = unsafeCastStringToDOMTopLevelType('mousedown'); 28798var TOP_MOUSE_MOVE = unsafeCastStringToDOMTopLevelType('mousemove'); 28799var TOP_MOUSE_OUT = unsafeCastStringToDOMTopLevelType('mouseout'); 28800var TOP_MOUSE_OVER = unsafeCastStringToDOMTopLevelType('mouseover'); 28801var TOP_MOUSE_UP = unsafeCastStringToDOMTopLevelType('mouseup'); 28802var TOP_PASTE = unsafeCastStringToDOMTopLevelType('paste'); 28803var TOP_PAUSE = unsafeCastStringToDOMTopLevelType('pause'); 28804var TOP_PLAY = unsafeCastStringToDOMTopLevelType('play'); 28805var TOP_PLAYING = unsafeCastStringToDOMTopLevelType('playing'); 28806var TOP_POINTER_CANCEL = unsafeCastStringToDOMTopLevelType('pointercancel'); 28807var TOP_POINTER_DOWN = unsafeCastStringToDOMTopLevelType('pointerdown'); 28808var TOP_POINTER_MOVE = unsafeCastStringToDOMTopLevelType('pointermove'); 28809var TOP_POINTER_OUT = unsafeCastStringToDOMTopLevelType('pointerout'); 28810var TOP_POINTER_OVER = unsafeCastStringToDOMTopLevelType('pointerover'); 28811var TOP_POINTER_UP = unsafeCastStringToDOMTopLevelType('pointerup'); 28812var TOP_PROGRESS = unsafeCastStringToDOMTopLevelType('progress'); 28813var TOP_RATE_CHANGE = unsafeCastStringToDOMTopLevelType('ratechange'); 28814var TOP_RESET = unsafeCastStringToDOMTopLevelType('reset'); 28815var TOP_SCROLL = unsafeCastStringToDOMTopLevelType('scroll'); 28816var TOP_SEEKED = unsafeCastStringToDOMTopLevelType('seeked'); 28817var TOP_SEEKING = unsafeCastStringToDOMTopLevelType('seeking'); 28818var TOP_SELECTION_CHANGE = unsafeCastStringToDOMTopLevelType('selectionchange'); 28819var TOP_STALLED = unsafeCastStringToDOMTopLevelType('stalled'); 28820var TOP_SUBMIT = unsafeCastStringToDOMTopLevelType('submit'); 28821var TOP_SUSPEND = unsafeCastStringToDOMTopLevelType('suspend'); 28822var TOP_TEXT_INPUT = unsafeCastStringToDOMTopLevelType('textInput'); 28823var TOP_TIME_UPDATE = unsafeCastStringToDOMTopLevelType('timeupdate'); 28824var TOP_TOGGLE = unsafeCastStringToDOMTopLevelType('toggle'); 28825var TOP_TOUCH_CANCEL = unsafeCastStringToDOMTopLevelType('touchcancel'); 28826var TOP_TOUCH_END = unsafeCastStringToDOMTopLevelType('touchend'); 28827var TOP_TOUCH_MOVE = unsafeCastStringToDOMTopLevelType('touchmove'); 28828var TOP_TOUCH_START = unsafeCastStringToDOMTopLevelType('touchstart'); 28829var TOP_TRANSITION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('transitionend')); 28830var TOP_VOLUME_CHANGE = unsafeCastStringToDOMTopLevelType('volumechange'); 28831var TOP_WAITING = unsafeCastStringToDOMTopLevelType('waiting'); 28832var TOP_WHEEL = unsafeCastStringToDOMTopLevelType('wheel'); // List of events that need to be individually attached to media elements. 28833// Note that events in this list will *not* be listened to at the top level 28834// unless they're explicitly whitelisted in `ReactBrowserEventEmitter.listenTo`. 28835 28836var mediaEventTypes = [TOP_ABORT, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_VOLUME_CHANGE, TOP_WAITING]; 28837function getRawEventName(topLevelType) { 28838 return unsafeCastDOMTopLevelTypeToString(topLevelType); 28839} 28840 28841var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; // prettier-ignore 28842 28843var elementListenerMap = new PossiblyWeakMap(); 28844function getListenerMapForElement(element) { 28845 var listenerMap = elementListenerMap.get(element); 28846 28847 if (listenerMap === undefined) { 28848 listenerMap = new Map(); 28849 elementListenerMap.set(element, listenerMap); 28850 } 28851 28852 return listenerMap; 28853} 28854 28855/** 28856 * `ReactInstanceMap` maintains a mapping from a public facing stateful 28857 * instance (key) and the internal representation (value). This allows public 28858 * methods to accept the user facing instance as an argument and map them back 28859 * to internal methods. 28860 * 28861 * Note that this module is currently shared and assumed to be stateless. 28862 * If this becomes an actual Map, that will break. 28863 */ 28864function get(key) { 28865 return key._reactInternalFiber; 28866} 28867function has(key) { 28868 return key._reactInternalFiber !== undefined; 28869} 28870function set(key, value) { 28871 key._reactInternalFiber = value; 28872} 28873 28874// Don't change these two values. They're used by React Dev Tools. 28875var NoEffect = 28876/* */ 288770; 28878var PerformedWork = 28879/* */ 288801; // You can change the rest (and add more). 28881 28882var Placement = 28883/* */ 288842; 28885var Update = 28886/* */ 288874; 28888var PlacementAndUpdate = 28889/* */ 288906; 28891var Deletion = 28892/* */ 288938; 28894var ContentReset = 28895/* */ 2889616; 28897var Callback = 28898/* */ 2889932; 28900var DidCapture = 28901/* */ 2890264; 28903var Ref = 28904/* */ 28905128; 28906var Snapshot = 28907/* */ 28908256; 28909var Passive = 28910/* */ 28911512; 28912var Hydrating = 28913/* */ 289141024; 28915var HydratingAndUpdate = 28916/* */ 289171028; // Passive & Update & Callback & Ref & Snapshot 28918 28919var LifecycleEffectMask = 28920/* */ 28921932; // Union of all host effects 28922 28923var HostEffectMask = 28924/* */ 289252047; 28926var Incomplete = 28927/* */ 289282048; 28929var ShouldCapture = 28930/* */ 289314096; 28932 28933var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; 28934function getNearestMountedFiber(fiber) { 28935 var node = fiber; 28936 var nearestMounted = fiber; 28937 28938 if (!fiber.alternate) { 28939 // If there is no alternate, this might be a new tree that isn't inserted 28940 // yet. If it is, then it will have a pending insertion effect on it. 28941 var nextNode = node; 28942 28943 do { 28944 node = nextNode; 28945 28946 if ((node.effectTag & (Placement | Hydrating)) !== NoEffect) { 28947 // This is an insertion or in-progress hydration. The nearest possible 28948 // mounted fiber is the parent but we need to continue to figure out 28949 // if that one is still mounted. 28950 nearestMounted = node.return; 28951 } 28952 28953 nextNode = node.return; 28954 } while (nextNode); 28955 } else { 28956 while (node.return) { 28957 node = node.return; 28958 } 28959 } 28960 28961 if (node.tag === HostRoot) { 28962 // TODO: Check if this was a nested HostRoot when used with 28963 // renderContainerIntoSubtree. 28964 return nearestMounted; 28965 } // If we didn't hit the root, that means that we're in an disconnected tree 28966 // that has been unmounted. 28967 28968 28969 return null; 28970} 28971function getSuspenseInstanceFromFiber(fiber) { 28972 if (fiber.tag === SuspenseComponent) { 28973 var suspenseState = fiber.memoizedState; 28974 28975 if (suspenseState === null) { 28976 var current = fiber.alternate; 28977 28978 if (current !== null) { 28979 suspenseState = current.memoizedState; 28980 } 28981 } 28982 28983 if (suspenseState !== null) { 28984 return suspenseState.dehydrated; 28985 } 28986 } 28987 28988 return null; 28989} 28990function getContainerFromFiber(fiber) { 28991 return fiber.tag === HostRoot ? fiber.stateNode.containerInfo : null; 28992} 28993function isFiberMounted(fiber) { 28994 return getNearestMountedFiber(fiber) === fiber; 28995} 28996function isMounted(component) { 28997 { 28998 var owner = ReactCurrentOwner.current; 28999 29000 if (owner !== null && owner.tag === ClassComponent) { 29001 var ownerFiber = owner; 29002 var instance = ownerFiber.stateNode; 29003 29004 if (!instance._warnedAboutRefsInRender) { 29005 error('%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(ownerFiber.type) || 'A component'); 29006 } 29007 29008 instance._warnedAboutRefsInRender = true; 29009 } 29010 } 29011 29012 var fiber = get(component); 29013 29014 if (!fiber) { 29015 return false; 29016 } 29017 29018 return getNearestMountedFiber(fiber) === fiber; 29019} 29020 29021function assertIsMounted(fiber) { 29022 if (!(getNearestMountedFiber(fiber) === fiber)) { 29023 { 29024 throw Error( "Unable to find node on an unmounted component." ); 29025 } 29026 } 29027} 29028 29029function findCurrentFiberUsingSlowPath(fiber) { 29030 var alternate = fiber.alternate; 29031 29032 if (!alternate) { 29033 // If there is no alternate, then we only need to check if it is mounted. 29034 var nearestMounted = getNearestMountedFiber(fiber); 29035 29036 if (!(nearestMounted !== null)) { 29037 { 29038 throw Error( "Unable to find node on an unmounted component." ); 29039 } 29040 } 29041 29042 if (nearestMounted !== fiber) { 29043 return null; 29044 } 29045 29046 return fiber; 29047 } // If we have two possible branches, we'll walk backwards up to the root 29048 // to see what path the root points to. On the way we may hit one of the 29049 // special cases and we'll deal with them. 29050 29051 29052 var a = fiber; 29053 var b = alternate; 29054 29055 while (true) { 29056 var parentA = a.return; 29057 29058 if (parentA === null) { 29059 // We're at the root. 29060 break; 29061 } 29062 29063 var parentB = parentA.alternate; 29064 29065 if (parentB === null) { 29066 // There is no alternate. This is an unusual case. Currently, it only 29067 // happens when a Suspense component is hidden. An extra fragment fiber 29068 // is inserted in between the Suspense fiber and its children. Skip 29069 // over this extra fragment fiber and proceed to the next parent. 29070 var nextParent = parentA.return; 29071 29072 if (nextParent !== null) { 29073 a = b = nextParent; 29074 continue; 29075 } // If there's no parent, we're at the root. 29076 29077 29078 break; 29079 } // If both copies of the parent fiber point to the same child, we can 29080 // assume that the child is current. This happens when we bailout on low 29081 // priority: the bailed out fiber's child reuses the current child. 29082 29083 29084 if (parentA.child === parentB.child) { 29085 var child = parentA.child; 29086 29087 while (child) { 29088 if (child === a) { 29089 // We've determined that A is the current branch. 29090 assertIsMounted(parentA); 29091 return fiber; 29092 } 29093 29094 if (child === b) { 29095 // We've determined that B is the current branch. 29096 assertIsMounted(parentA); 29097 return alternate; 29098 } 29099 29100 child = child.sibling; 29101 } // We should never have an alternate for any mounting node. So the only 29102 // way this could possibly happen is if this was unmounted, if at all. 29103 29104 29105 { 29106 { 29107 throw Error( "Unable to find node on an unmounted component." ); 29108 } 29109 } 29110 } 29111 29112 if (a.return !== b.return) { 29113 // The return pointer of A and the return pointer of B point to different 29114 // fibers. We assume that return pointers never criss-cross, so A must 29115 // belong to the child set of A.return, and B must belong to the child 29116 // set of B.return. 29117 a = parentA; 29118 b = parentB; 29119 } else { 29120 // The return pointers point to the same fiber. We'll have to use the 29121 // default, slow path: scan the child sets of each parent alternate to see 29122 // which child belongs to which set. 29123 // 29124 // Search parent A's child set 29125 var didFindChild = false; 29126 var _child = parentA.child; 29127 29128 while (_child) { 29129 if (_child === a) { 29130 didFindChild = true; 29131 a = parentA; 29132 b = parentB; 29133 break; 29134 } 29135 29136 if (_child === b) { 29137 didFindChild = true; 29138 b = parentA; 29139 a = parentB; 29140 break; 29141 } 29142 29143 _child = _child.sibling; 29144 } 29145 29146 if (!didFindChild) { 29147 // Search parent B's child set 29148 _child = parentB.child; 29149 29150 while (_child) { 29151 if (_child === a) { 29152 didFindChild = true; 29153 a = parentB; 29154 b = parentA; 29155 break; 29156 } 29157 29158 if (_child === b) { 29159 didFindChild = true; 29160 b = parentB; 29161 a = parentA; 29162 break; 29163 } 29164 29165 _child = _child.sibling; 29166 } 29167 29168 if (!didFindChild) { 29169 { 29170 throw Error( "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." ); 29171 } 29172 } 29173 } 29174 } 29175 29176 if (!(a.alternate === b)) { 29177 { 29178 throw Error( "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." ); 29179 } 29180 } 29181 } // If the root is not a host container, we're in a disconnected tree. I.e. 29182 // unmounted. 29183 29184 29185 if (!(a.tag === HostRoot)) { 29186 { 29187 throw Error( "Unable to find node on an unmounted component." ); 29188 } 29189 } 29190 29191 if (a.stateNode.current === a) { 29192 // We've determined that A is the current branch. 29193 return fiber; 29194 } // Otherwise B has to be current branch. 29195 29196 29197 return alternate; 29198} 29199function findCurrentHostFiber(parent) { 29200 var currentParent = findCurrentFiberUsingSlowPath(parent); 29201 29202 if (!currentParent) { 29203 return null; 29204 } // Next we'll drill down this component to find the first HostComponent/Text. 29205 29206 29207 var node = currentParent; 29208 29209 while (true) { 29210 if (node.tag === HostComponent || node.tag === HostText) { 29211 return node; 29212 } else if (node.child) { 29213 node.child.return = node; 29214 node = node.child; 29215 continue; 29216 } 29217 29218 if (node === currentParent) { 29219 return null; 29220 } 29221 29222 while (!node.sibling) { 29223 if (!node.return || node.return === currentParent) { 29224 return null; 29225 } 29226 29227 node = node.return; 29228 } 29229 29230 node.sibling.return = node.return; 29231 node = node.sibling; 29232 } // Flow needs the return null here, but ESLint complains about it. 29233 // eslint-disable-next-line no-unreachable 29234 29235 29236 return null; 29237} 29238function findCurrentHostFiberWithNoPortals(parent) { 29239 var currentParent = findCurrentFiberUsingSlowPath(parent); 29240 29241 if (!currentParent) { 29242 return null; 29243 } // Next we'll drill down this component to find the first HostComponent/Text. 29244 29245 29246 var node = currentParent; 29247 29248 while (true) { 29249 if (node.tag === HostComponent || node.tag === HostText || enableFundamentalAPI ) { 29250 return node; 29251 } else if (node.child && node.tag !== HostPortal) { 29252 node.child.return = node; 29253 node = node.child; 29254 continue; 29255 } 29256 29257 if (node === currentParent) { 29258 return null; 29259 } 29260 29261 while (!node.sibling) { 29262 if (!node.return || node.return === currentParent) { 29263 return null; 29264 } 29265 29266 node = node.return; 29267 } 29268 29269 node.sibling.return = node.return; 29270 node = node.sibling; 29271 } // Flow needs the return null here, but ESLint complains about it. 29272 // eslint-disable-next-line no-unreachable 29273 29274 29275 return null; 29276} 29277 29278/** 29279 * Accumulates items that must not be null or undefined into the first one. This 29280 * is used to conserve memory by avoiding array allocations, and thus sacrifices 29281 * API cleanness. Since `current` can be null before being passed in and not 29282 * null after this function, make sure to assign it back to `current`: 29283 * 29284 * `a = accumulateInto(a, b);` 29285 * 29286 * This API should be sparingly used. Try `accumulate` for something cleaner. 29287 * 29288 * @return {*|array<*>} An accumulation of items. 29289 */ 29290 29291function accumulateInto(current, next) { 29292 if (!(next != null)) { 29293 { 29294 throw Error( "accumulateInto(...): Accumulated items must not be null or undefined." ); 29295 } 29296 } 29297 29298 if (current == null) { 29299 return next; 29300 } // Both are not empty. Warning: Never call x.concat(y) when you are not 29301 // certain that x is an Array (x could be a string with concat method). 29302 29303 29304 if (Array.isArray(current)) { 29305 if (Array.isArray(next)) { 29306 current.push.apply(current, next); 29307 return current; 29308 } 29309 29310 current.push(next); 29311 return current; 29312 } 29313 29314 if (Array.isArray(next)) { 29315 // A bit too dangerous to mutate `next`. 29316 return [current].concat(next); 29317 } 29318 29319 return [current, next]; 29320} 29321 29322/** 29323 * @param {array} arr an "accumulation" of items which is either an Array or 29324 * a single item. Useful when paired with the `accumulate` module. This is a 29325 * simple utility that allows us to reason about a collection of items, but 29326 * handling the case when there is exactly one item (and we do not need to 29327 * allocate an array). 29328 * @param {function} cb Callback invoked with each element or a collection. 29329 * @param {?} [scope] Scope used as `this` in a callback. 29330 */ 29331function forEachAccumulated(arr, cb, scope) { 29332 if (Array.isArray(arr)) { 29333 arr.forEach(cb, scope); 29334 } else if (arr) { 29335 cb.call(scope, arr); 29336 } 29337} 29338 29339/** 29340 * Internal queue of events that have accumulated their dispatches and are 29341 * waiting to have their dispatches executed. 29342 */ 29343 29344var eventQueue = null; 29345/** 29346 * Dispatches an event and releases it back into the pool, unless persistent. 29347 * 29348 * @param {?object} event Synthetic event to be dispatched. 29349 * @private 29350 */ 29351 29352var executeDispatchesAndRelease = function (event) { 29353 if (event) { 29354 executeDispatchesInOrder(event); 29355 29356 if (!event.isPersistent()) { 29357 event.constructor.release(event); 29358 } 29359 } 29360}; 29361 29362var executeDispatchesAndReleaseTopLevel = function (e) { 29363 return executeDispatchesAndRelease(e); 29364}; 29365 29366function runEventsInBatch(events) { 29367 if (events !== null) { 29368 eventQueue = accumulateInto(eventQueue, events); 29369 } // Set `eventQueue` to null before processing it so that we can tell if more 29370 // events get enqueued while processing. 29371 29372 29373 var processingEventQueue = eventQueue; 29374 eventQueue = null; 29375 29376 if (!processingEventQueue) { 29377 return; 29378 } 29379 29380 forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel); 29381 29382 if (!!eventQueue) { 29383 { 29384 throw Error( "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." ); 29385 } 29386 } // This would be a good time to rethrow if any of the event handlers threw. 29387 29388 29389 rethrowCaughtError(); 29390} 29391 29392/** 29393 * Gets the target node from a native browser event by accounting for 29394 * inconsistencies in browser DOM APIs. 29395 * 29396 * @param {object} nativeEvent Native browser event. 29397 * @return {DOMEventTarget} Target node. 29398 */ 29399 29400function getEventTarget(nativeEvent) { 29401 // Fallback to nativeEvent.srcElement for IE9 29402 // https://github.com/facebook/react/issues/12506 29403 var target = nativeEvent.target || nativeEvent.srcElement || window; // Normalize SVG <use> element events #4963 29404 29405 if (target.correspondingUseElement) { 29406 target = target.correspondingUseElement; 29407 } // Safari may fire events on text nodes (Node.TEXT_NODE is 3). 29408 // @see http://www.quirksmode.org/js/events_properties.html 29409 29410 29411 return target.nodeType === TEXT_NODE ? target.parentNode : target; 29412} 29413 29414/** 29415 * Checks if an event is supported in the current execution environment. 29416 * 29417 * NOTE: This will not work correctly for non-generic events such as `change`, 29418 * `reset`, `load`, `error`, and `select`. 29419 * 29420 * Borrows from Modernizr. 29421 * 29422 * @param {string} eventNameSuffix Event name, e.g. "click". 29423 * @return {boolean} True if the event is supported. 29424 * @internal 29425 * @license Modernizr 3.0.0pre (Custom Build) | MIT 29426 */ 29427 29428function isEventSupported(eventNameSuffix) { 29429 if (!canUseDOM) { 29430 return false; 29431 } 29432 29433 var eventName = 'on' + eventNameSuffix; 29434 var isSupported = eventName in document; 29435 29436 if (!isSupported) { 29437 var element = document.createElement('div'); 29438 element.setAttribute(eventName, 'return;'); 29439 isSupported = typeof element[eventName] === 'function'; 29440 } 29441 29442 return isSupported; 29443} 29444 29445/** 29446 * Summary of `DOMEventPluginSystem` event handling: 29447 * 29448 * - Top-level delegation is used to trap most native browser events. This 29449 * may only occur in the main thread and is the responsibility of 29450 * ReactDOMEventListener, which is injected and can therefore support 29451 * pluggable event sources. This is the only work that occurs in the main 29452 * thread. 29453 * 29454 * - We normalize and de-duplicate events to account for browser quirks. This 29455 * may be done in the worker thread. 29456 * 29457 * - Forward these native events (with the associated top-level type used to 29458 * trap it) to `EventPluginRegistry`, which in turn will ask plugins if they want 29459 * to extract any synthetic events. 29460 * 29461 * - The `EventPluginRegistry` will then process each event by annotating them with 29462 * "dispatches", a sequence of listeners and IDs that care about that event. 29463 * 29464 * - The `EventPluginRegistry` then dispatches the events. 29465 * 29466 * Overview of React and the event system: 29467 * 29468 * +------------+ . 29469 * | DOM | . 29470 * +------------+ . 29471 * | . 29472 * v . 29473 * +------------+ . 29474 * | ReactEvent | . 29475 * | Listener | . 29476 * +------------+ . +-----------+ 29477 * | . +--------+|SimpleEvent| 29478 * | . | |Plugin | 29479 * +-----|------+ . v +-----------+ 29480 * | | | . +--------------+ +------------+ 29481 * | +-----------.--->|PluginRegistry| | Event | 29482 * | | . | | +-----------+ | Propagators| 29483 * | ReactEvent | . | | |TapEvent | |------------| 29484 * | Emitter | . | |<---+|Plugin | |other plugin| 29485 * | | . | | +-----------+ | utilities | 29486 * | +-----------.--->| | +------------+ 29487 * | | | . +--------------+ 29488 * +-----|------+ . ^ +-----------+ 29489 * | . | |Enter/Leave| 29490 * + . +-------+|Plugin | 29491 * +-------------+ . +-----------+ 29492 * | application | . 29493 * |-------------| . 29494 * | | . 29495 * | | . 29496 * +-------------+ . 29497 * . 29498 * React Core . General Purpose Event Plugin System 29499 */ 29500 29501var CALLBACK_BOOKKEEPING_POOL_SIZE = 10; 29502var callbackBookkeepingPool = []; 29503 29504function releaseTopLevelCallbackBookKeeping(instance) { 29505 instance.topLevelType = null; 29506 instance.nativeEvent = null; 29507 instance.targetInst = null; 29508 instance.ancestors.length = 0; 29509 29510 if (callbackBookkeepingPool.length < CALLBACK_BOOKKEEPING_POOL_SIZE) { 29511 callbackBookkeepingPool.push(instance); 29512 } 29513} // Used to store ancestor hierarchy in top level callback 29514 29515 29516function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst, eventSystemFlags) { 29517 if (callbackBookkeepingPool.length) { 29518 var instance = callbackBookkeepingPool.pop(); 29519 instance.topLevelType = topLevelType; 29520 instance.eventSystemFlags = eventSystemFlags; 29521 instance.nativeEvent = nativeEvent; 29522 instance.targetInst = targetInst; 29523 return instance; 29524 } 29525 29526 return { 29527 topLevelType: topLevelType, 29528 eventSystemFlags: eventSystemFlags, 29529 nativeEvent: nativeEvent, 29530 targetInst: targetInst, 29531 ancestors: [] 29532 }; 29533} 29534/** 29535 * Find the deepest React component completely containing the root of the 29536 * passed-in instance (for use when entire React trees are nested within each 29537 * other). If React trees are not nested, returns null. 29538 */ 29539 29540 29541function findRootContainerNode(inst) { 29542 if (inst.tag === HostRoot) { 29543 return inst.stateNode.containerInfo; 29544 } // TODO: It may be a good idea to cache this to prevent unnecessary DOM 29545 // traversal, but caching is difficult to do correctly without using a 29546 // mutation observer to listen for all DOM changes. 29547 29548 29549 while (inst.return) { 29550 inst = inst.return; 29551 } 29552 29553 if (inst.tag !== HostRoot) { 29554 // This can happen if we're in a detached tree. 29555 return null; 29556 } 29557 29558 return inst.stateNode.containerInfo; 29559} 29560/** 29561 * Allows registered plugins an opportunity to extract events from top-level 29562 * native browser events. 29563 * 29564 * @return {*} An accumulation of synthetic events. 29565 * @internal 29566 */ 29567 29568 29569function extractPluginEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) { 29570 var events = null; 29571 29572 for (var i = 0; i < plugins.length; i++) { 29573 // Not every plugin in the ordering may be loaded at runtime. 29574 var possiblePlugin = plugins[i]; 29575 29576 if (possiblePlugin) { 29577 var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags); 29578 29579 if (extractedEvents) { 29580 events = accumulateInto(events, extractedEvents); 29581 } 29582 } 29583 } 29584 29585 return events; 29586} 29587 29588function runExtractedPluginEventsInBatch(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) { 29589 var events = extractPluginEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags); 29590 runEventsInBatch(events); 29591} 29592 29593function handleTopLevel(bookKeeping) { 29594 var targetInst = bookKeeping.targetInst; // Loop through the hierarchy, in case there's any nested components. 29595 // It's important that we build the array of ancestors before calling any 29596 // event handlers, because event handlers can modify the DOM, leading to 29597 // inconsistencies with ReactMount's node cache. See #1105. 29598 29599 var ancestor = targetInst; 29600 29601 do { 29602 if (!ancestor) { 29603 var ancestors = bookKeeping.ancestors; 29604 ancestors.push(ancestor); 29605 break; 29606 } 29607 29608 var root = findRootContainerNode(ancestor); 29609 29610 if (!root) { 29611 break; 29612 } 29613 29614 var tag = ancestor.tag; 29615 29616 if (tag === HostComponent || tag === HostText) { 29617 bookKeeping.ancestors.push(ancestor); 29618 } 29619 29620 ancestor = getClosestInstanceFromNode(root); 29621 } while (ancestor); 29622 29623 for (var i = 0; i < bookKeeping.ancestors.length; i++) { 29624 targetInst = bookKeeping.ancestors[i]; 29625 var eventTarget = getEventTarget(bookKeeping.nativeEvent); 29626 var topLevelType = bookKeeping.topLevelType; 29627 var nativeEvent = bookKeeping.nativeEvent; 29628 var eventSystemFlags = bookKeeping.eventSystemFlags; // If this is the first ancestor, we mark it on the system flags 29629 29630 if (i === 0) { 29631 eventSystemFlags |= IS_FIRST_ANCESTOR; 29632 } 29633 29634 runExtractedPluginEventsInBatch(topLevelType, targetInst, nativeEvent, eventTarget, eventSystemFlags); 29635 } 29636} 29637 29638function dispatchEventForLegacyPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, targetInst) { 29639 var bookKeeping = getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst, eventSystemFlags); 29640 29641 try { 29642 // Event queue being processed in the same cycle allows 29643 // `preventDefault`. 29644 batchedEventUpdates(handleTopLevel, bookKeeping); 29645 } finally { 29646 releaseTopLevelCallbackBookKeeping(bookKeeping); 29647 } 29648} 29649/** 29650 * We listen for bubbled touch events on the document object. 29651 * 29652 * Firefox v8.01 (and possibly others) exhibited strange behavior when 29653 * mounting `onmousemove` events at some node that was not the document 29654 * element. The symptoms were that if your mouse is not moving over something 29655 * contained within that mount point (for example on the background) the 29656 * top-level listeners for `onmousemove` won't be called. However, if you 29657 * register the `mousemove` on the document object, then it will of course 29658 * catch all `mousemove`s. This along with iOS quirks, justifies restricting 29659 * top-level listeners to the document object only, at least for these 29660 * movement types of events and possibly all events. 29661 * 29662 * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html 29663 * 29664 * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but 29665 * they bubble to document. 29666 * 29667 * @param {string} registrationName Name of listener (e.g. `onClick`). 29668 * @param {object} mountAt Container where to mount the listener 29669 */ 29670 29671function legacyListenToEvent(registrationName, mountAt) { 29672 var listenerMap = getListenerMapForElement(mountAt); 29673 var dependencies = registrationNameDependencies[registrationName]; 29674 29675 for (var i = 0; i < dependencies.length; i++) { 29676 var dependency = dependencies[i]; 29677 legacyListenToTopLevelEvent(dependency, mountAt, listenerMap); 29678 } 29679} 29680function legacyListenToTopLevelEvent(topLevelType, mountAt, listenerMap) { 29681 if (!listenerMap.has(topLevelType)) { 29682 switch (topLevelType) { 29683 case TOP_SCROLL: 29684 trapCapturedEvent(TOP_SCROLL, mountAt); 29685 break; 29686 29687 case TOP_FOCUS: 29688 case TOP_BLUR: 29689 trapCapturedEvent(TOP_FOCUS, mountAt); 29690 trapCapturedEvent(TOP_BLUR, mountAt); // We set the flag for a single dependency later in this function, 29691 // but this ensures we mark both as attached rather than just one. 29692 29693 listenerMap.set(TOP_BLUR, null); 29694 listenerMap.set(TOP_FOCUS, null); 29695 break; 29696 29697 case TOP_CANCEL: 29698 case TOP_CLOSE: 29699 if (isEventSupported(getRawEventName(topLevelType))) { 29700 trapCapturedEvent(topLevelType, mountAt); 29701 } 29702 29703 break; 29704 29705 case TOP_INVALID: 29706 case TOP_SUBMIT: 29707 case TOP_RESET: 29708 // We listen to them on the target DOM elements. 29709 // Some of them bubble so we don't want them to fire twice. 29710 break; 29711 29712 default: 29713 // By default, listen on the top level to all non-media events. 29714 // Media events don't bubble so adding the listener wouldn't do anything. 29715 var isMediaEvent = mediaEventTypes.indexOf(topLevelType) !== -1; 29716 29717 if (!isMediaEvent) { 29718 trapBubbledEvent(topLevelType, mountAt); 29719 } 29720 29721 break; 29722 } 29723 29724 listenerMap.set(topLevelType, null); 29725 } 29726} 29727function isListeningToAllDependencies(registrationName, mountAt) { 29728 var listenerMap = getListenerMapForElement(mountAt); 29729 var dependencies = registrationNameDependencies[registrationName]; 29730 29731 for (var i = 0; i < dependencies.length; i++) { 29732 var dependency = dependencies[i]; 29733 29734 if (!listenerMap.has(dependency)) { 29735 return false; 29736 } 29737 } 29738 29739 return true; 29740} 29741 29742var attemptUserBlockingHydration; 29743function setAttemptUserBlockingHydration(fn) { 29744 attemptUserBlockingHydration = fn; 29745} 29746var attemptContinuousHydration; 29747function setAttemptContinuousHydration(fn) { 29748 attemptContinuousHydration = fn; 29749} 29750var attemptHydrationAtCurrentPriority; 29751function setAttemptHydrationAtCurrentPriority(fn) { 29752 attemptHydrationAtCurrentPriority = fn; 29753} // TODO: Upgrade this definition once we're on a newer version of Flow that 29754var hasScheduledReplayAttempt = false; // The queue of discrete events to be replayed. 29755 29756var queuedDiscreteEvents = []; // Indicates if any continuous event targets are non-null for early bailout. 29757// if the last target was dehydrated. 29758 29759var queuedFocus = null; 29760var queuedDrag = null; 29761var queuedMouse = null; // For pointer events there can be one latest event per pointerId. 29762 29763var queuedPointers = new Map(); 29764var queuedPointerCaptures = new Map(); // We could consider replaying selectionchange and touchmoves too. 29765 29766var queuedExplicitHydrationTargets = []; 29767function hasQueuedDiscreteEvents() { 29768 return queuedDiscreteEvents.length > 0; 29769} 29770var discreteReplayableEvents = [TOP_MOUSE_DOWN, TOP_MOUSE_UP, TOP_TOUCH_CANCEL, TOP_TOUCH_END, TOP_TOUCH_START, TOP_AUX_CLICK, TOP_DOUBLE_CLICK, TOP_POINTER_CANCEL, TOP_POINTER_DOWN, TOP_POINTER_UP, TOP_DRAG_END, TOP_DRAG_START, TOP_DROP, TOP_COMPOSITION_END, TOP_COMPOSITION_START, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_INPUT, TOP_TEXT_INPUT, TOP_CLOSE, TOP_CANCEL, TOP_COPY, TOP_CUT, TOP_PASTE, TOP_CLICK, TOP_CHANGE, TOP_CONTEXT_MENU, TOP_RESET, TOP_SUBMIT]; 29771var continuousReplayableEvents = [TOP_FOCUS, TOP_BLUR, TOP_DRAG_ENTER, TOP_DRAG_LEAVE, TOP_MOUSE_OVER, TOP_MOUSE_OUT, TOP_POINTER_OVER, TOP_POINTER_OUT, TOP_GOT_POINTER_CAPTURE, TOP_LOST_POINTER_CAPTURE]; 29772function isReplayableDiscreteEvent(eventType) { 29773 return discreteReplayableEvents.indexOf(eventType) > -1; 29774} 29775 29776function trapReplayableEventForDocument(topLevelType, document, listenerMap) { 29777 legacyListenToTopLevelEvent(topLevelType, document, listenerMap); 29778} 29779 29780function eagerlyTrapReplayableEvents(container, document) { 29781 var listenerMapForDoc = getListenerMapForElement(document); // Discrete 29782 29783 discreteReplayableEvents.forEach(function (topLevelType) { 29784 trapReplayableEventForDocument(topLevelType, document, listenerMapForDoc); 29785 }); // Continuous 29786 29787 continuousReplayableEvents.forEach(function (topLevelType) { 29788 trapReplayableEventForDocument(topLevelType, document, listenerMapForDoc); 29789 }); 29790} 29791 29792function createQueuedReplayableEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent) { 29793 return { 29794 blockedOn: blockedOn, 29795 topLevelType: topLevelType, 29796 eventSystemFlags: eventSystemFlags | IS_REPLAYED, 29797 nativeEvent: nativeEvent, 29798 container: container 29799 }; 29800} 29801 29802function queueDiscreteEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent) { 29803 var queuedEvent = createQueuedReplayableEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent); 29804 queuedDiscreteEvents.push(queuedEvent); 29805} // Resets the replaying for this type of continuous event to no event. 29806 29807function clearIfContinuousEvent(topLevelType, nativeEvent) { 29808 switch (topLevelType) { 29809 case TOP_FOCUS: 29810 case TOP_BLUR: 29811 queuedFocus = null; 29812 break; 29813 29814 case TOP_DRAG_ENTER: 29815 case TOP_DRAG_LEAVE: 29816 queuedDrag = null; 29817 break; 29818 29819 case TOP_MOUSE_OVER: 29820 case TOP_MOUSE_OUT: 29821 queuedMouse = null; 29822 break; 29823 29824 case TOP_POINTER_OVER: 29825 case TOP_POINTER_OUT: 29826 { 29827 var pointerId = nativeEvent.pointerId; 29828 queuedPointers.delete(pointerId); 29829 break; 29830 } 29831 29832 case TOP_GOT_POINTER_CAPTURE: 29833 case TOP_LOST_POINTER_CAPTURE: 29834 { 29835 var _pointerId = nativeEvent.pointerId; 29836 queuedPointerCaptures.delete(_pointerId); 29837 break; 29838 } 29839 } 29840} 29841 29842function accumulateOrCreateContinuousQueuedReplayableEvent(existingQueuedEvent, blockedOn, topLevelType, eventSystemFlags, container, nativeEvent) { 29843 if (existingQueuedEvent === null || existingQueuedEvent.nativeEvent !== nativeEvent) { 29844 var queuedEvent = createQueuedReplayableEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent); 29845 29846 if (blockedOn !== null) { 29847 var _fiber2 = getInstanceFromNode$1(blockedOn); 29848 29849 if (_fiber2 !== null) { 29850 // Attempt to increase the priority of this target. 29851 attemptContinuousHydration(_fiber2); 29852 } 29853 } 29854 29855 return queuedEvent; 29856 } // If we have already queued this exact event, then it's because 29857 // the different event systems have different DOM event listeners. 29858 // We can accumulate the flags and store a single event to be 29859 // replayed. 29860 29861 29862 existingQueuedEvent.eventSystemFlags |= eventSystemFlags; 29863 return existingQueuedEvent; 29864} 29865 29866function queueIfContinuousEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent) { 29867 // These set relatedTarget to null because the replayed event will be treated as if we 29868 // moved from outside the window (no target) onto the target once it hydrates. 29869 // Instead of mutating we could clone the event. 29870 switch (topLevelType) { 29871 case TOP_FOCUS: 29872 { 29873 var focusEvent = nativeEvent; 29874 queuedFocus = accumulateOrCreateContinuousQueuedReplayableEvent(queuedFocus, blockedOn, topLevelType, eventSystemFlags, container, focusEvent); 29875 return true; 29876 } 29877 29878 case TOP_DRAG_ENTER: 29879 { 29880 var dragEvent = nativeEvent; 29881 queuedDrag = accumulateOrCreateContinuousQueuedReplayableEvent(queuedDrag, blockedOn, topLevelType, eventSystemFlags, container, dragEvent); 29882 return true; 29883 } 29884 29885 case TOP_MOUSE_OVER: 29886 { 29887 var mouseEvent = nativeEvent; 29888 queuedMouse = accumulateOrCreateContinuousQueuedReplayableEvent(queuedMouse, blockedOn, topLevelType, eventSystemFlags, container, mouseEvent); 29889 return true; 29890 } 29891 29892 case TOP_POINTER_OVER: 29893 { 29894 var pointerEvent = nativeEvent; 29895 var pointerId = pointerEvent.pointerId; 29896 queuedPointers.set(pointerId, accumulateOrCreateContinuousQueuedReplayableEvent(queuedPointers.get(pointerId) || null, blockedOn, topLevelType, eventSystemFlags, container, pointerEvent)); 29897 return true; 29898 } 29899 29900 case TOP_GOT_POINTER_CAPTURE: 29901 { 29902 var _pointerEvent = nativeEvent; 29903 var _pointerId2 = _pointerEvent.pointerId; 29904 queuedPointerCaptures.set(_pointerId2, accumulateOrCreateContinuousQueuedReplayableEvent(queuedPointerCaptures.get(_pointerId2) || null, blockedOn, topLevelType, eventSystemFlags, container, _pointerEvent)); 29905 return true; 29906 } 29907 } 29908 29909 return false; 29910} // Check if this target is unblocked. Returns true if it's unblocked. 29911 29912function attemptExplicitHydrationTarget(queuedTarget) { 29913 // TODO: This function shares a lot of logic with attemptToDispatchEvent. 29914 // Try to unify them. It's a bit tricky since it would require two return 29915 // values. 29916 var targetInst = getClosestInstanceFromNode(queuedTarget.target); 29917 29918 if (targetInst !== null) { 29919 var nearestMounted = getNearestMountedFiber(targetInst); 29920 29921 if (nearestMounted !== null) { 29922 var tag = nearestMounted.tag; 29923 29924 if (tag === SuspenseComponent) { 29925 var instance = getSuspenseInstanceFromFiber(nearestMounted); 29926 29927 if (instance !== null) { 29928 // We're blocked on hydrating this boundary. 29929 // Increase its priority. 29930 queuedTarget.blockedOn = instance; 29931 Scheduler.unstable_runWithPriority(queuedTarget.priority, function () { 29932 attemptHydrationAtCurrentPriority(nearestMounted); 29933 }); 29934 return; 29935 } 29936 } else if (tag === HostRoot) { 29937 var root = nearestMounted.stateNode; 29938 29939 if (root.hydrate) { 29940 queuedTarget.blockedOn = getContainerFromFiber(nearestMounted); // We don't currently have a way to increase the priority of 29941 // a root other than sync. 29942 29943 return; 29944 } 29945 } 29946 } 29947 } 29948 29949 queuedTarget.blockedOn = null; 29950} 29951 29952function attemptReplayContinuousQueuedEvent(queuedEvent) { 29953 if (queuedEvent.blockedOn !== null) { 29954 return false; 29955 } 29956 29957 var nextBlockedOn = attemptToDispatchEvent(queuedEvent.topLevelType, queuedEvent.eventSystemFlags, queuedEvent.container, queuedEvent.nativeEvent); 29958 29959 if (nextBlockedOn !== null) { 29960 // We're still blocked. Try again later. 29961 var _fiber3 = getInstanceFromNode$1(nextBlockedOn); 29962 29963 if (_fiber3 !== null) { 29964 attemptContinuousHydration(_fiber3); 29965 } 29966 29967 queuedEvent.blockedOn = nextBlockedOn; 29968 return false; 29969 } 29970 29971 return true; 29972} 29973 29974function attemptReplayContinuousQueuedEventInMap(queuedEvent, key, map) { 29975 if (attemptReplayContinuousQueuedEvent(queuedEvent)) { 29976 map.delete(key); 29977 } 29978} 29979 29980function replayUnblockedEvents() { 29981 hasScheduledReplayAttempt = false; // First replay discrete events. 29982 29983 while (queuedDiscreteEvents.length > 0) { 29984 var nextDiscreteEvent = queuedDiscreteEvents[0]; 29985 29986 if (nextDiscreteEvent.blockedOn !== null) { 29987 // We're still blocked. 29988 // Increase the priority of this boundary to unblock 29989 // the next discrete event. 29990 var _fiber4 = getInstanceFromNode$1(nextDiscreteEvent.blockedOn); 29991 29992 if (_fiber4 !== null) { 29993 attemptUserBlockingHydration(_fiber4); 29994 } 29995 29996 break; 29997 } 29998 29999 var nextBlockedOn = attemptToDispatchEvent(nextDiscreteEvent.topLevelType, nextDiscreteEvent.eventSystemFlags, nextDiscreteEvent.container, nextDiscreteEvent.nativeEvent); 30000 30001 if (nextBlockedOn !== null) { 30002 // We're still blocked. Try again later. 30003 nextDiscreteEvent.blockedOn = nextBlockedOn; 30004 } else { 30005 // We've successfully replayed the first event. Let's try the next one. 30006 queuedDiscreteEvents.shift(); 30007 } 30008 } // Next replay any continuous events. 30009 30010 30011 if (queuedFocus !== null && attemptReplayContinuousQueuedEvent(queuedFocus)) { 30012 queuedFocus = null; 30013 } 30014 30015 if (queuedDrag !== null && attemptReplayContinuousQueuedEvent(queuedDrag)) { 30016 queuedDrag = null; 30017 } 30018 30019 if (queuedMouse !== null && attemptReplayContinuousQueuedEvent(queuedMouse)) { 30020 queuedMouse = null; 30021 } 30022 30023 queuedPointers.forEach(attemptReplayContinuousQueuedEventInMap); 30024 queuedPointerCaptures.forEach(attemptReplayContinuousQueuedEventInMap); 30025} 30026 30027function scheduleCallbackIfUnblocked(queuedEvent, unblocked) { 30028 if (queuedEvent.blockedOn === unblocked) { 30029 queuedEvent.blockedOn = null; 30030 30031 if (!hasScheduledReplayAttempt) { 30032 hasScheduledReplayAttempt = true; // Schedule a callback to attempt replaying as many events as are 30033 // now unblocked. This first might not actually be unblocked yet. 30034 // We could check it early to avoid scheduling an unnecessary callback. 30035 30036 Scheduler.unstable_scheduleCallback(Scheduler.unstable_NormalPriority, replayUnblockedEvents); 30037 } 30038 } 30039} 30040 30041function retryIfBlockedOn(unblocked) { 30042 // Mark anything that was blocked on this as no longer blocked 30043 // and eligible for a replay. 30044 if (queuedDiscreteEvents.length > 0) { 30045 scheduleCallbackIfUnblocked(queuedDiscreteEvents[0], unblocked); // This is a exponential search for each boundary that commits. I think it's 30046 // worth it because we expect very few discrete events to queue up and once 30047 // we are actually fully unblocked it will be fast to replay them. 30048 30049 for (var i = 1; i < queuedDiscreteEvents.length; i++) { 30050 var queuedEvent = queuedDiscreteEvents[i]; 30051 30052 if (queuedEvent.blockedOn === unblocked) { 30053 queuedEvent.blockedOn = null; 30054 } 30055 } 30056 } 30057 30058 if (queuedFocus !== null) { 30059 scheduleCallbackIfUnblocked(queuedFocus, unblocked); 30060 } 30061 30062 if (queuedDrag !== null) { 30063 scheduleCallbackIfUnblocked(queuedDrag, unblocked); 30064 } 30065 30066 if (queuedMouse !== null) { 30067 scheduleCallbackIfUnblocked(queuedMouse, unblocked); 30068 } 30069 30070 var unblock = function (queuedEvent) { 30071 return scheduleCallbackIfUnblocked(queuedEvent, unblocked); 30072 }; 30073 30074 queuedPointers.forEach(unblock); 30075 queuedPointerCaptures.forEach(unblock); 30076 30077 for (var _i = 0; _i < queuedExplicitHydrationTargets.length; _i++) { 30078 var queuedTarget = queuedExplicitHydrationTargets[_i]; 30079 30080 if (queuedTarget.blockedOn === unblocked) { 30081 queuedTarget.blockedOn = null; 30082 } 30083 } 30084 30085 while (queuedExplicitHydrationTargets.length > 0) { 30086 var nextExplicitTarget = queuedExplicitHydrationTargets[0]; 30087 30088 if (nextExplicitTarget.blockedOn !== null) { 30089 // We're still blocked. 30090 break; 30091 } else { 30092 attemptExplicitHydrationTarget(nextExplicitTarget); 30093 30094 if (nextExplicitTarget.blockedOn === null) { 30095 // We're unblocked. 30096 queuedExplicitHydrationTargets.shift(); 30097 } 30098 } 30099 } 30100} 30101 30102function addEventBubbleListener(element, eventType, listener) { 30103 element.addEventListener(eventType, listener, false); 30104} 30105function addEventCaptureListener(element, eventType, listener) { 30106 element.addEventListener(eventType, listener, true); 30107} 30108 30109// do it in two places, which duplicates logic 30110// and increases the bundle size, we do it all 30111// here once. If we remove or refactor the 30112// SimpleEventPlugin, we should also remove or 30113// update the below line. 30114 30115var simpleEventPluginEventTypes = {}; 30116var topLevelEventsToDispatchConfig = new Map(); 30117var eventPriorities = new Map(); // We store most of the events in this module in pairs of two strings so we can re-use 30118// the code required to apply the same logic for event prioritization and that of the 30119// SimpleEventPlugin. This complicates things slightly, but the aim is to reduce code 30120// duplication (for which there would be quite a bit). For the events that are not needed 30121// for the SimpleEventPlugin (otherDiscreteEvents) we process them separately as an 30122// array of top level events. 30123// Lastly, we ignore prettier so we can keep the formatting sane. 30124// prettier-ignore 30125 30126var discreteEventPairsForSimpleEventPlugin = [TOP_BLUR, 'blur', TOP_CANCEL, 'cancel', TOP_CLICK, 'click', TOP_CLOSE, 'close', TOP_CONTEXT_MENU, 'contextMenu', TOP_COPY, 'copy', TOP_CUT, 'cut', TOP_AUX_CLICK, 'auxClick', TOP_DOUBLE_CLICK, 'doubleClick', TOP_DRAG_END, 'dragEnd', TOP_DRAG_START, 'dragStart', TOP_DROP, 'drop', TOP_FOCUS, 'focus', TOP_INPUT, 'input', TOP_INVALID, 'invalid', TOP_KEY_DOWN, 'keyDown', TOP_KEY_PRESS, 'keyPress', TOP_KEY_UP, 'keyUp', TOP_MOUSE_DOWN, 'mouseDown', TOP_MOUSE_UP, 'mouseUp', TOP_PASTE, 'paste', TOP_PAUSE, 'pause', TOP_PLAY, 'play', TOP_POINTER_CANCEL, 'pointerCancel', TOP_POINTER_DOWN, 'pointerDown', TOP_POINTER_UP, 'pointerUp', TOP_RATE_CHANGE, 'rateChange', TOP_RESET, 'reset', TOP_SEEKED, 'seeked', TOP_SUBMIT, 'submit', TOP_TOUCH_CANCEL, 'touchCancel', TOP_TOUCH_END, 'touchEnd', TOP_TOUCH_START, 'touchStart', TOP_VOLUME_CHANGE, 'volumeChange']; 30127var otherDiscreteEvents = [TOP_CHANGE, TOP_SELECTION_CHANGE, TOP_TEXT_INPUT, TOP_COMPOSITION_START, TOP_COMPOSITION_END, TOP_COMPOSITION_UPDATE]; // prettier-ignore 30128 30129var userBlockingPairsForSimpleEventPlugin = [TOP_DRAG, 'drag', TOP_DRAG_ENTER, 'dragEnter', TOP_DRAG_EXIT, 'dragExit', TOP_DRAG_LEAVE, 'dragLeave', TOP_DRAG_OVER, 'dragOver', TOP_MOUSE_MOVE, 'mouseMove', TOP_MOUSE_OUT, 'mouseOut', TOP_MOUSE_OVER, 'mouseOver', TOP_POINTER_MOVE, 'pointerMove', TOP_POINTER_OUT, 'pointerOut', TOP_POINTER_OVER, 'pointerOver', TOP_SCROLL, 'scroll', TOP_TOGGLE, 'toggle', TOP_TOUCH_MOVE, 'touchMove', TOP_WHEEL, 'wheel']; // prettier-ignore 30130 30131var continuousPairsForSimpleEventPlugin = [TOP_ABORT, 'abort', TOP_ANIMATION_END, 'animationEnd', TOP_ANIMATION_ITERATION, 'animationIteration', TOP_ANIMATION_START, 'animationStart', TOP_CAN_PLAY, 'canPlay', TOP_CAN_PLAY_THROUGH, 'canPlayThrough', TOP_DURATION_CHANGE, 'durationChange', TOP_EMPTIED, 'emptied', TOP_ENCRYPTED, 'encrypted', TOP_ENDED, 'ended', TOP_ERROR, 'error', TOP_GOT_POINTER_CAPTURE, 'gotPointerCapture', TOP_LOAD, 'load', TOP_LOADED_DATA, 'loadedData', TOP_LOADED_METADATA, 'loadedMetadata', TOP_LOAD_START, 'loadStart', TOP_LOST_POINTER_CAPTURE, 'lostPointerCapture', TOP_PLAYING, 'playing', TOP_PROGRESS, 'progress', TOP_SEEKING, 'seeking', TOP_STALLED, 'stalled', TOP_SUSPEND, 'suspend', TOP_TIME_UPDATE, 'timeUpdate', TOP_TRANSITION_END, 'transitionEnd', TOP_WAITING, 'waiting']; 30132/** 30133 * Turns 30134 * ['abort', ...] 30135 * into 30136 * eventTypes = { 30137 * 'abort': { 30138 * phasedRegistrationNames: { 30139 * bubbled: 'onAbort', 30140 * captured: 'onAbortCapture', 30141 * }, 30142 * dependencies: [TOP_ABORT], 30143 * }, 30144 * ... 30145 * }; 30146 * topLevelEventsToDispatchConfig = new Map([ 30147 * [TOP_ABORT, { sameConfig }], 30148 * ]); 30149 */ 30150 30151function processSimpleEventPluginPairsByPriority(eventTypes, priority) { 30152 // As the event types are in pairs of two, we need to iterate 30153 // through in twos. The events are in pairs of two to save code 30154 // and improve init perf of processing this array, as it will 30155 // result in far fewer object allocations and property accesses 30156 // if we only use three arrays to process all the categories of 30157 // instead of tuples. 30158 for (var i = 0; i < eventTypes.length; i += 2) { 30159 var topEvent = eventTypes[i]; 30160 var event = eventTypes[i + 1]; 30161 var capitalizedEvent = event[0].toUpperCase() + event.slice(1); 30162 var onEvent = 'on' + capitalizedEvent; 30163 var config = { 30164 phasedRegistrationNames: { 30165 bubbled: onEvent, 30166 captured: onEvent + 'Capture' 30167 }, 30168 dependencies: [topEvent], 30169 eventPriority: priority 30170 }; 30171 eventPriorities.set(topEvent, priority); 30172 topLevelEventsToDispatchConfig.set(topEvent, config); 30173 simpleEventPluginEventTypes[event] = config; 30174 } 30175} 30176 30177function processTopEventPairsByPriority(eventTypes, priority) { 30178 for (var i = 0; i < eventTypes.length; i++) { 30179 eventPriorities.set(eventTypes[i], priority); 30180 } 30181} // SimpleEventPlugin 30182 30183 30184processSimpleEventPluginPairsByPriority(discreteEventPairsForSimpleEventPlugin, DiscreteEvent); 30185processSimpleEventPluginPairsByPriority(userBlockingPairsForSimpleEventPlugin, UserBlockingEvent); 30186processSimpleEventPluginPairsByPriority(continuousPairsForSimpleEventPlugin, ContinuousEvent); // Not used by SimpleEventPlugin 30187 30188processTopEventPairsByPriority(otherDiscreteEvents, DiscreteEvent); 30189function getEventPriorityForPluginSystem(topLevelType) { 30190 var priority = eventPriorities.get(topLevelType); // Default to a ContinuousEvent. Note: we might 30191 // want to warn if we can't detect the priority 30192 // for the event. 30193 30194 return priority === undefined ? ContinuousEvent : priority; 30195} 30196 30197// Intentionally not named imports because Rollup would use dynamic dispatch for 30198var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority, 30199 runWithPriority = Scheduler.unstable_runWithPriority; // TODO: can we stop exporting these? 30200 30201var _enabled = true; 30202function setEnabled(enabled) { 30203 _enabled = !!enabled; 30204} 30205function isEnabled() { 30206 return _enabled; 30207} 30208function trapBubbledEvent(topLevelType, element) { 30209 trapEventForPluginEventSystem(element, topLevelType, false); 30210} 30211function trapCapturedEvent(topLevelType, element) { 30212 trapEventForPluginEventSystem(element, topLevelType, true); 30213} 30214 30215function trapEventForPluginEventSystem(container, topLevelType, capture) { 30216 var listener; 30217 30218 switch (getEventPriorityForPluginSystem(topLevelType)) { 30219 case DiscreteEvent: 30220 listener = dispatchDiscreteEvent.bind(null, topLevelType, PLUGIN_EVENT_SYSTEM, container); 30221 break; 30222 30223 case UserBlockingEvent: 30224 listener = dispatchUserBlockingUpdate.bind(null, topLevelType, PLUGIN_EVENT_SYSTEM, container); 30225 break; 30226 30227 case ContinuousEvent: 30228 default: 30229 listener = dispatchEvent.bind(null, topLevelType, PLUGIN_EVENT_SYSTEM, container); 30230 break; 30231 } 30232 30233 var rawEventName = getRawEventName(topLevelType); 30234 30235 if (capture) { 30236 addEventCaptureListener(container, rawEventName, listener); 30237 } else { 30238 addEventBubbleListener(container, rawEventName, listener); 30239 } 30240} 30241 30242function dispatchDiscreteEvent(topLevelType, eventSystemFlags, container, nativeEvent) { 30243 flushDiscreteUpdatesIfNeeded(nativeEvent.timeStamp); 30244 discreteUpdates(dispatchEvent, topLevelType, eventSystemFlags, container, nativeEvent); 30245} 30246 30247function dispatchUserBlockingUpdate(topLevelType, eventSystemFlags, container, nativeEvent) { 30248 runWithPriority(UserBlockingPriority, dispatchEvent.bind(null, topLevelType, eventSystemFlags, container, nativeEvent)); 30249} 30250 30251function dispatchEvent(topLevelType, eventSystemFlags, container, nativeEvent) { 30252 if (!_enabled) { 30253 return; 30254 } 30255 30256 if (hasQueuedDiscreteEvents() && isReplayableDiscreteEvent(topLevelType)) { 30257 // If we already have a queue of discrete events, and this is another discrete 30258 // event, then we can't dispatch it regardless of its target, since they 30259 // need to dispatch in order. 30260 queueDiscreteEvent(null, // Flags that we're not actually blocked on anything as far as we know. 30261 topLevelType, eventSystemFlags, container, nativeEvent); 30262 return; 30263 } 30264 30265 var blockedOn = attemptToDispatchEvent(topLevelType, eventSystemFlags, container, nativeEvent); 30266 30267 if (blockedOn === null) { 30268 // We successfully dispatched this event. 30269 clearIfContinuousEvent(topLevelType, nativeEvent); 30270 return; 30271 } 30272 30273 if (isReplayableDiscreteEvent(topLevelType)) { 30274 // This this to be replayed later once the target is available. 30275 queueDiscreteEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent); 30276 return; 30277 } 30278 30279 if (queueIfContinuousEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent)) { 30280 return; 30281 } // We need to clear only if we didn't queue because 30282 // queueing is accummulative. 30283 30284 30285 clearIfContinuousEvent(topLevelType, nativeEvent); // This is not replayable so we'll invoke it but without a target, 30286 // in case the event system needs to trace it. 30287 30288 { 30289 dispatchEventForLegacyPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, null); 30290 } 30291} // Attempt dispatching an event. Returns a SuspenseInstance or Container if it's blocked. 30292 30293function attemptToDispatchEvent(topLevelType, eventSystemFlags, container, nativeEvent) { 30294 // TODO: Warn if _enabled is false. 30295 var nativeEventTarget = getEventTarget(nativeEvent); 30296 var targetInst = getClosestInstanceFromNode(nativeEventTarget); 30297 30298 if (targetInst !== null) { 30299 var nearestMounted = getNearestMountedFiber(targetInst); 30300 30301 if (nearestMounted === null) { 30302 // This tree has been unmounted already. Dispatch without a target. 30303 targetInst = null; 30304 } else { 30305 var tag = nearestMounted.tag; 30306 30307 if (tag === SuspenseComponent) { 30308 var instance = getSuspenseInstanceFromFiber(nearestMounted); 30309 30310 if (instance !== null) { 30311 // Queue the event to be replayed later. Abort dispatching since we 30312 // don't want this event dispatched twice through the event system. 30313 // TODO: If this is the first discrete event in the queue. Schedule an increased 30314 // priority for this boundary. 30315 return instance; 30316 } // This shouldn't happen, something went wrong but to avoid blocking 30317 // the whole system, dispatch the event without a target. 30318 // TODO: Warn. 30319 30320 30321 targetInst = null; 30322 } else if (tag === HostRoot) { 30323 var root = nearestMounted.stateNode; 30324 30325 if (root.hydrate) { 30326 // If this happens during a replay something went wrong and it might block 30327 // the whole system. 30328 return getContainerFromFiber(nearestMounted); 30329 } 30330 30331 targetInst = null; 30332 } else if (nearestMounted !== targetInst) { 30333 // If we get an event (ex: img onload) before committing that 30334 // component's mount, ignore it for now (that is, treat it as if it was an 30335 // event on a non-React tree). We might also consider queueing events and 30336 // dispatching them after the mount. 30337 targetInst = null; 30338 } 30339 } 30340 } 30341 30342 { 30343 dispatchEventForLegacyPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, targetInst); 30344 } // We're not blocked on anything. 30345 30346 30347 return null; 30348} 30349 30350// List derived from Gecko source code: 30351// https://github.com/mozilla/gecko-dev/blob/4e638efc71/layout/style/test/property_database.js 30352var shorthandToLonghand = { 30353 animation: ['animationDelay', 'animationDirection', 'animationDuration', 'animationFillMode', 'animationIterationCount', 'animationName', 'animationPlayState', 'animationTimingFunction'], 30354 background: ['backgroundAttachment', 'backgroundClip', 'backgroundColor', 'backgroundImage', 'backgroundOrigin', 'backgroundPositionX', 'backgroundPositionY', 'backgroundRepeat', 'backgroundSize'], 30355 backgroundPosition: ['backgroundPositionX', 'backgroundPositionY'], 30356 border: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth', 'borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth', 'borderLeftColor', 'borderLeftStyle', 'borderLeftWidth', 'borderRightColor', 'borderRightStyle', 'borderRightWidth', 'borderTopColor', 'borderTopStyle', 'borderTopWidth'], 30357 borderBlockEnd: ['borderBlockEndColor', 'borderBlockEndStyle', 'borderBlockEndWidth'], 30358 borderBlockStart: ['borderBlockStartColor', 'borderBlockStartStyle', 'borderBlockStartWidth'], 30359 borderBottom: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth'], 30360 borderColor: ['borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor'], 30361 borderImage: ['borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth'], 30362 borderInlineEnd: ['borderInlineEndColor', 'borderInlineEndStyle', 'borderInlineEndWidth'], 30363 borderInlineStart: ['borderInlineStartColor', 'borderInlineStartStyle', 'borderInlineStartWidth'], 30364 borderLeft: ['borderLeftColor', 'borderLeftStyle', 'borderLeftWidth'], 30365 borderRadius: ['borderBottomLeftRadius', 'borderBottomRightRadius', 'borderTopLeftRadius', 'borderTopRightRadius'], 30366 borderRight: ['borderRightColor', 'borderRightStyle', 'borderRightWidth'], 30367 borderStyle: ['borderBottomStyle', 'borderLeftStyle', 'borderRightStyle', 'borderTopStyle'], 30368 borderTop: ['borderTopColor', 'borderTopStyle', 'borderTopWidth'], 30369 borderWidth: ['borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopWidth'], 30370 columnRule: ['columnRuleColor', 'columnRuleStyle', 'columnRuleWidth'], 30371 columns: ['columnCount', 'columnWidth'], 30372 flex: ['flexBasis', 'flexGrow', 'flexShrink'], 30373 flexFlow: ['flexDirection', 'flexWrap'], 30374 font: ['fontFamily', 'fontFeatureSettings', 'fontKerning', 'fontLanguageOverride', 'fontSize', 'fontSizeAdjust', 'fontStretch', 'fontStyle', 'fontVariant', 'fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition', 'fontWeight', 'lineHeight'], 30375 fontVariant: ['fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition'], 30376 gap: ['columnGap', 'rowGap'], 30377 grid: ['gridAutoColumns', 'gridAutoFlow', 'gridAutoRows', 'gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'], 30378 gridArea: ['gridColumnEnd', 'gridColumnStart', 'gridRowEnd', 'gridRowStart'], 30379 gridColumn: ['gridColumnEnd', 'gridColumnStart'], 30380 gridColumnGap: ['columnGap'], 30381 gridGap: ['columnGap', 'rowGap'], 30382 gridRow: ['gridRowEnd', 'gridRowStart'], 30383 gridRowGap: ['rowGap'], 30384 gridTemplate: ['gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'], 30385 listStyle: ['listStyleImage', 'listStylePosition', 'listStyleType'], 30386 margin: ['marginBottom', 'marginLeft', 'marginRight', 'marginTop'], 30387 marker: ['markerEnd', 'markerMid', 'markerStart'], 30388 mask: ['maskClip', 'maskComposite', 'maskImage', 'maskMode', 'maskOrigin', 'maskPositionX', 'maskPositionY', 'maskRepeat', 'maskSize'], 30389 maskPosition: ['maskPositionX', 'maskPositionY'], 30390 outline: ['outlineColor', 'outlineStyle', 'outlineWidth'], 30391 overflow: ['overflowX', 'overflowY'], 30392 padding: ['paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop'], 30393 placeContent: ['alignContent', 'justifyContent'], 30394 placeItems: ['alignItems', 'justifyItems'], 30395 placeSelf: ['alignSelf', 'justifySelf'], 30396 textDecoration: ['textDecorationColor', 'textDecorationLine', 'textDecorationStyle'], 30397 textEmphasis: ['textEmphasisColor', 'textEmphasisStyle'], 30398 transition: ['transitionDelay', 'transitionDuration', 'transitionProperty', 'transitionTimingFunction'], 30399 wordWrap: ['overflowWrap'] 30400}; 30401 30402/** 30403 * CSS properties which accept numbers but are not in units of "px". 30404 */ 30405var isUnitlessNumber = { 30406 animationIterationCount: true, 30407 borderImageOutset: true, 30408 borderImageSlice: true, 30409 borderImageWidth: true, 30410 boxFlex: true, 30411 boxFlexGroup: true, 30412 boxOrdinalGroup: true, 30413 columnCount: true, 30414 columns: true, 30415 flex: true, 30416 flexGrow: true, 30417 flexPositive: true, 30418 flexShrink: true, 30419 flexNegative: true, 30420 flexOrder: true, 30421 gridArea: true, 30422 gridRow: true, 30423 gridRowEnd: true, 30424 gridRowSpan: true, 30425 gridRowStart: true, 30426 gridColumn: true, 30427 gridColumnEnd: true, 30428 gridColumnSpan: true, 30429 gridColumnStart: true, 30430 fontWeight: true, 30431 lineClamp: true, 30432 lineHeight: true, 30433 opacity: true, 30434 order: true, 30435 orphans: true, 30436 tabSize: true, 30437 widows: true, 30438 zIndex: true, 30439 zoom: true, 30440 // SVG-related properties 30441 fillOpacity: true, 30442 floodOpacity: true, 30443 stopOpacity: true, 30444 strokeDasharray: true, 30445 strokeDashoffset: true, 30446 strokeMiterlimit: true, 30447 strokeOpacity: true, 30448 strokeWidth: true 30449}; 30450/** 30451 * @param {string} prefix vendor-specific prefix, eg: Webkit 30452 * @param {string} key style name, eg: transitionDuration 30453 * @return {string} style name prefixed with `prefix`, properly camelCased, eg: 30454 * WebkitTransitionDuration 30455 */ 30456 30457function prefixKey(prefix, key) { 30458 return prefix + key.charAt(0).toUpperCase() + key.substring(1); 30459} 30460/** 30461 * Support style names that may come passed in prefixed by adding permutations 30462 * of vendor prefixes. 30463 */ 30464 30465 30466var prefixes = ['Webkit', 'ms', 'Moz', 'O']; // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an 30467// infinite loop, because it iterates over the newly added props too. 30468 30469Object.keys(isUnitlessNumber).forEach(function (prop) { 30470 prefixes.forEach(function (prefix) { 30471 isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop]; 30472 }); 30473}); 30474 30475/** 30476 * Convert a value into the proper css writable value. The style name `name` 30477 * should be logical (no hyphens), as specified 30478 * in `CSSProperty.isUnitlessNumber`. 30479 * 30480 * @param {string} name CSS property name such as `topMargin`. 30481 * @param {*} value CSS property value such as `10px`. 30482 * @return {string} Normalized style value with dimensions applied. 30483 */ 30484 30485function dangerousStyleValue(name, value, isCustomProperty) { 30486 // Note that we've removed escapeTextForBrowser() calls here since the 30487 // whole string will be escaped when the attribute is injected into 30488 // the markup. If you provide unsafe user data here they can inject 30489 // arbitrary CSS which may be problematic (I couldn't repro this): 30490 // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet 30491 // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/ 30492 // This is not an XSS hole but instead a potential CSS injection issue 30493 // which has lead to a greater discussion about how we're going to 30494 // trust URLs moving forward. See #2115901 30495 var isEmpty = value == null || typeof value === 'boolean' || value === ''; 30496 30497 if (isEmpty) { 30498 return ''; 30499 } 30500 30501 if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) { 30502 return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers 30503 } 30504 30505 return ('' + value).trim(); 30506} 30507 30508var uppercasePattern = /([A-Z])/g; 30509var msPattern = /^ms-/; 30510/** 30511 * Hyphenates a camelcased CSS property name, for example: 30512 * 30513 * > hyphenateStyleName('backgroundColor') 30514 * < "background-color" 30515 * > hyphenateStyleName('MozTransition') 30516 * < "-moz-transition" 30517 * > hyphenateStyleName('msTransition') 30518 * < "-ms-transition" 30519 * 30520 * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix 30521 * is converted to `-ms-`. 30522 */ 30523 30524function hyphenateStyleName(name) { 30525 return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-'); 30526} 30527 30528var warnValidStyle = function () {}; 30529 30530{ 30531 // 'msTransform' is correct, but the other prefixes should be capitalized 30532 var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/; 30533 var msPattern$1 = /^-ms-/; 30534 var hyphenPattern = /-(.)/g; // style values shouldn't contain a semicolon 30535 30536 var badStyleValueWithSemicolonPattern = /;\s*$/; 30537 var warnedStyleNames = {}; 30538 var warnedStyleValues = {}; 30539 var warnedForNaNValue = false; 30540 var warnedForInfinityValue = false; 30541 30542 var camelize = function (string) { 30543 return string.replace(hyphenPattern, function (_, character) { 30544 return character.toUpperCase(); 30545 }); 30546 }; 30547 30548 var warnHyphenatedStyleName = function (name) { 30549 if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { 30550 return; 30551 } 30552 30553 warnedStyleNames[name] = true; 30554 30555 error('Unsupported style property %s. Did you mean %s?', name, // As Andi Smith suggests 30556 // (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix 30557 // is converted to lowercase `ms`. 30558 camelize(name.replace(msPattern$1, 'ms-'))); 30559 }; 30560 30561 var warnBadVendoredStyleName = function (name) { 30562 if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { 30563 return; 30564 } 30565 30566 warnedStyleNames[name] = true; 30567 30568 error('Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1)); 30569 }; 30570 30571 var warnStyleValueWithSemicolon = function (name, value) { 30572 if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) { 30573 return; 30574 } 30575 30576 warnedStyleValues[value] = true; 30577 30578 error("Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '')); 30579 }; 30580 30581 var warnStyleValueIsNaN = function (name, value) { 30582 if (warnedForNaNValue) { 30583 return; 30584 } 30585 30586 warnedForNaNValue = true; 30587 30588 error('`NaN` is an invalid value for the `%s` css style property.', name); 30589 }; 30590 30591 var warnStyleValueIsInfinity = function (name, value) { 30592 if (warnedForInfinityValue) { 30593 return; 30594 } 30595 30596 warnedForInfinityValue = true; 30597 30598 error('`Infinity` is an invalid value for the `%s` css style property.', name); 30599 }; 30600 30601 warnValidStyle = function (name, value) { 30602 if (name.indexOf('-') > -1) { 30603 warnHyphenatedStyleName(name); 30604 } else if (badVendoredStyleNamePattern.test(name)) { 30605 warnBadVendoredStyleName(name); 30606 } else if (badStyleValueWithSemicolonPattern.test(value)) { 30607 warnStyleValueWithSemicolon(name, value); 30608 } 30609 30610 if (typeof value === 'number') { 30611 if (isNaN(value)) { 30612 warnStyleValueIsNaN(name, value); 30613 } else if (!isFinite(value)) { 30614 warnStyleValueIsInfinity(name, value); 30615 } 30616 } 30617 }; 30618} 30619 30620var warnValidStyle$1 = warnValidStyle; 30621 30622/** 30623 * Operations for dealing with CSS properties. 30624 */ 30625 30626/** 30627 * This creates a string that is expected to be equivalent to the style 30628 * attribute generated by server-side rendering. It by-passes warnings and 30629 * security checks so it's not safe to use this value for anything other than 30630 * comparison. It is only used in DEV for SSR validation. 30631 */ 30632 30633function createDangerousStringForStyles(styles) { 30634 { 30635 var serialized = ''; 30636 var delimiter = ''; 30637 30638 for (var styleName in styles) { 30639 if (!styles.hasOwnProperty(styleName)) { 30640 continue; 30641 } 30642 30643 var styleValue = styles[styleName]; 30644 30645 if (styleValue != null) { 30646 var isCustomProperty = styleName.indexOf('--') === 0; 30647 serialized += delimiter + (isCustomProperty ? styleName : hyphenateStyleName(styleName)) + ':'; 30648 serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty); 30649 delimiter = ';'; 30650 } 30651 } 30652 30653 return serialized || null; 30654 } 30655} 30656/** 30657 * Sets the value for multiple styles on a node. If a value is specified as 30658 * '' (empty string), the corresponding style property will be unset. 30659 * 30660 * @param {DOMElement} node 30661 * @param {object} styles 30662 */ 30663 30664function setValueForStyles(node, styles) { 30665 var style = node.style; 30666 30667 for (var styleName in styles) { 30668 if (!styles.hasOwnProperty(styleName)) { 30669 continue; 30670 } 30671 30672 var isCustomProperty = styleName.indexOf('--') === 0; 30673 30674 { 30675 if (!isCustomProperty) { 30676 warnValidStyle$1(styleName, styles[styleName]); 30677 } 30678 } 30679 30680 var styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty); 30681 30682 if (styleName === 'float') { 30683 styleName = 'cssFloat'; 30684 } 30685 30686 if (isCustomProperty) { 30687 style.setProperty(styleName, styleValue); 30688 } else { 30689 style[styleName] = styleValue; 30690 } 30691 } 30692} 30693 30694function isValueEmpty(value) { 30695 return value == null || typeof value === 'boolean' || value === ''; 30696} 30697/** 30698 * Given {color: 'red', overflow: 'hidden'} returns { 30699 * color: 'color', 30700 * overflowX: 'overflow', 30701 * overflowY: 'overflow', 30702 * }. This can be read as "the overflowY property was set by the overflow 30703 * shorthand". That is, the values are the property that each was derived from. 30704 */ 30705 30706 30707function expandShorthandMap(styles) { 30708 var expanded = {}; 30709 30710 for (var key in styles) { 30711 var longhands = shorthandToLonghand[key] || [key]; 30712 30713 for (var i = 0; i < longhands.length; i++) { 30714 expanded[longhands[i]] = key; 30715 } 30716 } 30717 30718 return expanded; 30719} 30720/** 30721 * When mixing shorthand and longhand property names, we warn during updates if 30722 * we expect an incorrect result to occur. In particular, we warn for: 30723 * 30724 * Updating a shorthand property (longhand gets overwritten): 30725 * {font: 'foo', fontVariant: 'bar'} -> {font: 'baz', fontVariant: 'bar'} 30726 * becomes .style.font = 'baz' 30727 * Removing a shorthand property (longhand gets lost too): 30728 * {font: 'foo', fontVariant: 'bar'} -> {fontVariant: 'bar'} 30729 * becomes .style.font = '' 30730 * Removing a longhand property (should revert to shorthand; doesn't): 30731 * {font: 'foo', fontVariant: 'bar'} -> {font: 'foo'} 30732 * becomes .style.fontVariant = '' 30733 */ 30734 30735 30736function validateShorthandPropertyCollisionInDev(styleUpdates, nextStyles) { 30737 { 30738 30739 if (!nextStyles) { 30740 return; 30741 } 30742 30743 var expandedUpdates = expandShorthandMap(styleUpdates); 30744 var expandedStyles = expandShorthandMap(nextStyles); 30745 var warnedAbout = {}; 30746 30747 for (var key in expandedUpdates) { 30748 var originalKey = expandedUpdates[key]; 30749 var correctOriginalKey = expandedStyles[key]; 30750 30751 if (correctOriginalKey && originalKey !== correctOriginalKey) { 30752 var warningKey = originalKey + ',' + correctOriginalKey; 30753 30754 if (warnedAbout[warningKey]) { 30755 continue; 30756 } 30757 30758 warnedAbout[warningKey] = true; 30759 30760 error('%s a style property during rerender (%s) when a ' + 'conflicting property is set (%s) can lead to styling bugs. To ' + "avoid this, don't mix shorthand and non-shorthand properties " + 'for the same value; instead, replace the shorthand with ' + 'separate values.', isValueEmpty(styleUpdates[originalKey]) ? 'Removing' : 'Updating', originalKey, correctOriginalKey); 30761 } 30762 } 30763 } 30764} 30765 30766// For HTML, certain tags should omit their close tag. We keep a whitelist for 30767// those special-case tags. 30768var omittedCloseTags = { 30769 area: true, 30770 base: true, 30771 br: true, 30772 col: true, 30773 embed: true, 30774 hr: true, 30775 img: true, 30776 input: true, 30777 keygen: true, 30778 link: true, 30779 meta: true, 30780 param: true, 30781 source: true, 30782 track: true, 30783 wbr: true // NOTE: menuitem's close tag should be omitted, but that causes problems. 30784 30785}; 30786 30787// `omittedCloseTags` except that `menuitem` should still have its closing tag. 30788 30789var voidElementTags = _assign({ 30790 menuitem: true 30791}, omittedCloseTags); 30792 30793var HTML = '__html'; 30794var ReactDebugCurrentFrame$3 = null; 30795 30796{ 30797 ReactDebugCurrentFrame$3 = ReactSharedInternals.ReactDebugCurrentFrame; 30798} 30799 30800function assertValidProps(tag, props) { 30801 if (!props) { 30802 return; 30803 } // Note the use of `==` which checks for null or undefined. 30804 30805 30806 if (voidElementTags[tag]) { 30807 if (!(props.children == null && props.dangerouslySetInnerHTML == null)) { 30808 { 30809 throw Error( tag + " is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`." + ( ReactDebugCurrentFrame$3.getStackAddendum() ) ); 30810 } 30811 } 30812 } 30813 30814 if (props.dangerouslySetInnerHTML != null) { 30815 if (!(props.children == null)) { 30816 { 30817 throw Error( "Can only set one of `children` or `props.dangerouslySetInnerHTML`." ); 30818 } 30819 } 30820 30821 if (!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML)) { 30822 { 30823 throw Error( "`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information." ); 30824 } 30825 } 30826 } 30827 30828 { 30829 if (!props.suppressContentEditableWarning && props.contentEditable && props.children != null) { 30830 error('A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.'); 30831 } 30832 } 30833 30834 if (!(props.style == null || typeof props.style === 'object')) { 30835 { 30836 throw Error( "The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX." + ( ReactDebugCurrentFrame$3.getStackAddendum() ) ); 30837 } 30838 } 30839} 30840 30841function isCustomComponent(tagName, props) { 30842 if (tagName.indexOf('-') === -1) { 30843 return typeof props.is === 'string'; 30844 } 30845 30846 switch (tagName) { 30847 // These are reserved SVG and MathML elements. 30848 // We don't mind this whitelist too much because we expect it to never grow. 30849 // The alternative is to track the namespace in a few places which is convoluted. 30850 // https://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts 30851 case 'annotation-xml': 30852 case 'color-profile': 30853 case 'font-face': 30854 case 'font-face-src': 30855 case 'font-face-uri': 30856 case 'font-face-format': 30857 case 'font-face-name': 30858 case 'missing-glyph': 30859 return false; 30860 30861 default: 30862 return true; 30863 } 30864} 30865 30866// When adding attributes to the HTML or SVG whitelist, be sure to 30867// also add them to this module to ensure casing and incorrect name 30868// warnings. 30869var possibleStandardNames = { 30870 // HTML 30871 accept: 'accept', 30872 acceptcharset: 'acceptCharset', 30873 'accept-charset': 'acceptCharset', 30874 accesskey: 'accessKey', 30875 action: 'action', 30876 allowfullscreen: 'allowFullScreen', 30877 alt: 'alt', 30878 as: 'as', 30879 async: 'async', 30880 autocapitalize: 'autoCapitalize', 30881 autocomplete: 'autoComplete', 30882 autocorrect: 'autoCorrect', 30883 autofocus: 'autoFocus', 30884 autoplay: 'autoPlay', 30885 autosave: 'autoSave', 30886 capture: 'capture', 30887 cellpadding: 'cellPadding', 30888 cellspacing: 'cellSpacing', 30889 challenge: 'challenge', 30890 charset: 'charSet', 30891 checked: 'checked', 30892 children: 'children', 30893 cite: 'cite', 30894 class: 'className', 30895 classid: 'classID', 30896 classname: 'className', 30897 cols: 'cols', 30898 colspan: 'colSpan', 30899 content: 'content', 30900 contenteditable: 'contentEditable', 30901 contextmenu: 'contextMenu', 30902 controls: 'controls', 30903 controlslist: 'controlsList', 30904 coords: 'coords', 30905 crossorigin: 'crossOrigin', 30906 dangerouslysetinnerhtml: 'dangerouslySetInnerHTML', 30907 data: 'data', 30908 datetime: 'dateTime', 30909 default: 'default', 30910 defaultchecked: 'defaultChecked', 30911 defaultvalue: 'defaultValue', 30912 defer: 'defer', 30913 dir: 'dir', 30914 disabled: 'disabled', 30915 disablepictureinpicture: 'disablePictureInPicture', 30916 download: 'download', 30917 draggable: 'draggable', 30918 enctype: 'encType', 30919 for: 'htmlFor', 30920 form: 'form', 30921 formmethod: 'formMethod', 30922 formaction: 'formAction', 30923 formenctype: 'formEncType', 30924 formnovalidate: 'formNoValidate', 30925 formtarget: 'formTarget', 30926 frameborder: 'frameBorder', 30927 headers: 'headers', 30928 height: 'height', 30929 hidden: 'hidden', 30930 high: 'high', 30931 href: 'href', 30932 hreflang: 'hrefLang', 30933 htmlfor: 'htmlFor', 30934 httpequiv: 'httpEquiv', 30935 'http-equiv': 'httpEquiv', 30936 icon: 'icon', 30937 id: 'id', 30938 innerhtml: 'innerHTML', 30939 inputmode: 'inputMode', 30940 integrity: 'integrity', 30941 is: 'is', 30942 itemid: 'itemID', 30943 itemprop: 'itemProp', 30944 itemref: 'itemRef', 30945 itemscope: 'itemScope', 30946 itemtype: 'itemType', 30947 keyparams: 'keyParams', 30948 keytype: 'keyType', 30949 kind: 'kind', 30950 label: 'label', 30951 lang: 'lang', 30952 list: 'list', 30953 loop: 'loop', 30954 low: 'low', 30955 manifest: 'manifest', 30956 marginwidth: 'marginWidth', 30957 marginheight: 'marginHeight', 30958 max: 'max', 30959 maxlength: 'maxLength', 30960 media: 'media', 30961 mediagroup: 'mediaGroup', 30962 method: 'method', 30963 min: 'min', 30964 minlength: 'minLength', 30965 multiple: 'multiple', 30966 muted: 'muted', 30967 name: 'name', 30968 nomodule: 'noModule', 30969 nonce: 'nonce', 30970 novalidate: 'noValidate', 30971 open: 'open', 30972 optimum: 'optimum', 30973 pattern: 'pattern', 30974 placeholder: 'placeholder', 30975 playsinline: 'playsInline', 30976 poster: 'poster', 30977 preload: 'preload', 30978 profile: 'profile', 30979 radiogroup: 'radioGroup', 30980 readonly: 'readOnly', 30981 referrerpolicy: 'referrerPolicy', 30982 rel: 'rel', 30983 required: 'required', 30984 reversed: 'reversed', 30985 role: 'role', 30986 rows: 'rows', 30987 rowspan: 'rowSpan', 30988 sandbox: 'sandbox', 30989 scope: 'scope', 30990 scoped: 'scoped', 30991 scrolling: 'scrolling', 30992 seamless: 'seamless', 30993 selected: 'selected', 30994 shape: 'shape', 30995 size: 'size', 30996 sizes: 'sizes', 30997 span: 'span', 30998 spellcheck: 'spellCheck', 30999 src: 'src', 31000 srcdoc: 'srcDoc', 31001 srclang: 'srcLang', 31002 srcset: 'srcSet', 31003 start: 'start', 31004 step: 'step', 31005 style: 'style', 31006 summary: 'summary', 31007 tabindex: 'tabIndex', 31008 target: 'target', 31009 title: 'title', 31010 type: 'type', 31011 usemap: 'useMap', 31012 value: 'value', 31013 width: 'width', 31014 wmode: 'wmode', 31015 wrap: 'wrap', 31016 // SVG 31017 about: 'about', 31018 accentheight: 'accentHeight', 31019 'accent-height': 'accentHeight', 31020 accumulate: 'accumulate', 31021 additive: 'additive', 31022 alignmentbaseline: 'alignmentBaseline', 31023 'alignment-baseline': 'alignmentBaseline', 31024 allowreorder: 'allowReorder', 31025 alphabetic: 'alphabetic', 31026 amplitude: 'amplitude', 31027 arabicform: 'arabicForm', 31028 'arabic-form': 'arabicForm', 31029 ascent: 'ascent', 31030 attributename: 'attributeName', 31031 attributetype: 'attributeType', 31032 autoreverse: 'autoReverse', 31033 azimuth: 'azimuth', 31034 basefrequency: 'baseFrequency', 31035 baselineshift: 'baselineShift', 31036 'baseline-shift': 'baselineShift', 31037 baseprofile: 'baseProfile', 31038 bbox: 'bbox', 31039 begin: 'begin', 31040 bias: 'bias', 31041 by: 'by', 31042 calcmode: 'calcMode', 31043 capheight: 'capHeight', 31044 'cap-height': 'capHeight', 31045 clip: 'clip', 31046 clippath: 'clipPath', 31047 'clip-path': 'clipPath', 31048 clippathunits: 'clipPathUnits', 31049 cliprule: 'clipRule', 31050 'clip-rule': 'clipRule', 31051 color: 'color', 31052 colorinterpolation: 'colorInterpolation', 31053 'color-interpolation': 'colorInterpolation', 31054 colorinterpolationfilters: 'colorInterpolationFilters', 31055 'color-interpolation-filters': 'colorInterpolationFilters', 31056 colorprofile: 'colorProfile', 31057 'color-profile': 'colorProfile', 31058 colorrendering: 'colorRendering', 31059 'color-rendering': 'colorRendering', 31060 contentscripttype: 'contentScriptType', 31061 contentstyletype: 'contentStyleType', 31062 cursor: 'cursor', 31063 cx: 'cx', 31064 cy: 'cy', 31065 d: 'd', 31066 datatype: 'datatype', 31067 decelerate: 'decelerate', 31068 descent: 'descent', 31069 diffuseconstant: 'diffuseConstant', 31070 direction: 'direction', 31071 display: 'display', 31072 divisor: 'divisor', 31073 dominantbaseline: 'dominantBaseline', 31074 'dominant-baseline': 'dominantBaseline', 31075 dur: 'dur', 31076 dx: 'dx', 31077 dy: 'dy', 31078 edgemode: 'edgeMode', 31079 elevation: 'elevation', 31080 enablebackground: 'enableBackground', 31081 'enable-background': 'enableBackground', 31082 end: 'end', 31083 exponent: 'exponent', 31084 externalresourcesrequired: 'externalResourcesRequired', 31085 fill: 'fill', 31086 fillopacity: 'fillOpacity', 31087 'fill-opacity': 'fillOpacity', 31088 fillrule: 'fillRule', 31089 'fill-rule': 'fillRule', 31090 filter: 'filter', 31091 filterres: 'filterRes', 31092 filterunits: 'filterUnits', 31093 floodopacity: 'floodOpacity', 31094 'flood-opacity': 'floodOpacity', 31095 floodcolor: 'floodColor', 31096 'flood-color': 'floodColor', 31097 focusable: 'focusable', 31098 fontfamily: 'fontFamily', 31099 'font-family': 'fontFamily', 31100 fontsize: 'fontSize', 31101 'font-size': 'fontSize', 31102 fontsizeadjust: 'fontSizeAdjust', 31103 'font-size-adjust': 'fontSizeAdjust', 31104 fontstretch: 'fontStretch', 31105 'font-stretch': 'fontStretch', 31106 fontstyle: 'fontStyle', 31107 'font-style': 'fontStyle', 31108 fontvariant: 'fontVariant', 31109 'font-variant': 'fontVariant', 31110 fontweight: 'fontWeight', 31111 'font-weight': 'fontWeight', 31112 format: 'format', 31113 from: 'from', 31114 fx: 'fx', 31115 fy: 'fy', 31116 g1: 'g1', 31117 g2: 'g2', 31118 glyphname: 'glyphName', 31119 'glyph-name': 'glyphName', 31120 glyphorientationhorizontal: 'glyphOrientationHorizontal', 31121 'glyph-orientation-horizontal': 'glyphOrientationHorizontal', 31122 glyphorientationvertical: 'glyphOrientationVertical', 31123 'glyph-orientation-vertical': 'glyphOrientationVertical', 31124 glyphref: 'glyphRef', 31125 gradienttransform: 'gradientTransform', 31126 gradientunits: 'gradientUnits', 31127 hanging: 'hanging', 31128 horizadvx: 'horizAdvX', 31129 'horiz-adv-x': 'horizAdvX', 31130 horizoriginx: 'horizOriginX', 31131 'horiz-origin-x': 'horizOriginX', 31132 ideographic: 'ideographic', 31133 imagerendering: 'imageRendering', 31134 'image-rendering': 'imageRendering', 31135 in2: 'in2', 31136 in: 'in', 31137 inlist: 'inlist', 31138 intercept: 'intercept', 31139 k1: 'k1', 31140 k2: 'k2', 31141 k3: 'k3', 31142 k4: 'k4', 31143 k: 'k', 31144 kernelmatrix: 'kernelMatrix', 31145 kernelunitlength: 'kernelUnitLength', 31146 kerning: 'kerning', 31147 keypoints: 'keyPoints', 31148 keysplines: 'keySplines', 31149 keytimes: 'keyTimes', 31150 lengthadjust: 'lengthAdjust', 31151 letterspacing: 'letterSpacing', 31152 'letter-spacing': 'letterSpacing', 31153 lightingcolor: 'lightingColor', 31154 'lighting-color': 'lightingColor', 31155 limitingconeangle: 'limitingConeAngle', 31156 local: 'local', 31157 markerend: 'markerEnd', 31158 'marker-end': 'markerEnd', 31159 markerheight: 'markerHeight', 31160 markermid: 'markerMid', 31161 'marker-mid': 'markerMid', 31162 markerstart: 'markerStart', 31163 'marker-start': 'markerStart', 31164 markerunits: 'markerUnits', 31165 markerwidth: 'markerWidth', 31166 mask: 'mask', 31167 maskcontentunits: 'maskContentUnits', 31168 maskunits: 'maskUnits', 31169 mathematical: 'mathematical', 31170 mode: 'mode', 31171 numoctaves: 'numOctaves', 31172 offset: 'offset', 31173 opacity: 'opacity', 31174 operator: 'operator', 31175 order: 'order', 31176 orient: 'orient', 31177 orientation: 'orientation', 31178 origin: 'origin', 31179 overflow: 'overflow', 31180 overlineposition: 'overlinePosition', 31181 'overline-position': 'overlinePosition', 31182 overlinethickness: 'overlineThickness', 31183 'overline-thickness': 'overlineThickness', 31184 paintorder: 'paintOrder', 31185 'paint-order': 'paintOrder', 31186 panose1: 'panose1', 31187 'panose-1': 'panose1', 31188 pathlength: 'pathLength', 31189 patterncontentunits: 'patternContentUnits', 31190 patterntransform: 'patternTransform', 31191 patternunits: 'patternUnits', 31192 pointerevents: 'pointerEvents', 31193 'pointer-events': 'pointerEvents', 31194 points: 'points', 31195 pointsatx: 'pointsAtX', 31196 pointsaty: 'pointsAtY', 31197 pointsatz: 'pointsAtZ', 31198 prefix: 'prefix', 31199 preservealpha: 'preserveAlpha', 31200 preserveaspectratio: 'preserveAspectRatio', 31201 primitiveunits: 'primitiveUnits', 31202 property: 'property', 31203 r: 'r', 31204 radius: 'radius', 31205 refx: 'refX', 31206 refy: 'refY', 31207 renderingintent: 'renderingIntent', 31208 'rendering-intent': 'renderingIntent', 31209 repeatcount: 'repeatCount', 31210 repeatdur: 'repeatDur', 31211 requiredextensions: 'requiredExtensions', 31212 requiredfeatures: 'requiredFeatures', 31213 resource: 'resource', 31214 restart: 'restart', 31215 result: 'result', 31216 results: 'results', 31217 rotate: 'rotate', 31218 rx: 'rx', 31219 ry: 'ry', 31220 scale: 'scale', 31221 security: 'security', 31222 seed: 'seed', 31223 shaperendering: 'shapeRendering', 31224 'shape-rendering': 'shapeRendering', 31225 slope: 'slope', 31226 spacing: 'spacing', 31227 specularconstant: 'specularConstant', 31228 specularexponent: 'specularExponent', 31229 speed: 'speed', 31230 spreadmethod: 'spreadMethod', 31231 startoffset: 'startOffset', 31232 stddeviation: 'stdDeviation', 31233 stemh: 'stemh', 31234 stemv: 'stemv', 31235 stitchtiles: 'stitchTiles', 31236 stopcolor: 'stopColor', 31237 'stop-color': 'stopColor', 31238 stopopacity: 'stopOpacity', 31239 'stop-opacity': 'stopOpacity', 31240 strikethroughposition: 'strikethroughPosition', 31241 'strikethrough-position': 'strikethroughPosition', 31242 strikethroughthickness: 'strikethroughThickness', 31243 'strikethrough-thickness': 'strikethroughThickness', 31244 string: 'string', 31245 stroke: 'stroke', 31246 strokedasharray: 'strokeDasharray', 31247 'stroke-dasharray': 'strokeDasharray', 31248 strokedashoffset: 'strokeDashoffset', 31249 'stroke-dashoffset': 'strokeDashoffset', 31250 strokelinecap: 'strokeLinecap', 31251 'stroke-linecap': 'strokeLinecap', 31252 strokelinejoin: 'strokeLinejoin', 31253 'stroke-linejoin': 'strokeLinejoin', 31254 strokemiterlimit: 'strokeMiterlimit', 31255 'stroke-miterlimit': 'strokeMiterlimit', 31256 strokewidth: 'strokeWidth', 31257 'stroke-width': 'strokeWidth', 31258 strokeopacity: 'strokeOpacity', 31259 'stroke-opacity': 'strokeOpacity', 31260 suppresscontenteditablewarning: 'suppressContentEditableWarning', 31261 suppresshydrationwarning: 'suppressHydrationWarning', 31262 surfacescale: 'surfaceScale', 31263 systemlanguage: 'systemLanguage', 31264 tablevalues: 'tableValues', 31265 targetx: 'targetX', 31266 targety: 'targetY', 31267 textanchor: 'textAnchor', 31268 'text-anchor': 'textAnchor', 31269 textdecoration: 'textDecoration', 31270 'text-decoration': 'textDecoration', 31271 textlength: 'textLength', 31272 textrendering: 'textRendering', 31273 'text-rendering': 'textRendering', 31274 to: 'to', 31275 transform: 'transform', 31276 typeof: 'typeof', 31277 u1: 'u1', 31278 u2: 'u2', 31279 underlineposition: 'underlinePosition', 31280 'underline-position': 'underlinePosition', 31281 underlinethickness: 'underlineThickness', 31282 'underline-thickness': 'underlineThickness', 31283 unicode: 'unicode', 31284 unicodebidi: 'unicodeBidi', 31285 'unicode-bidi': 'unicodeBidi', 31286 unicoderange: 'unicodeRange', 31287 'unicode-range': 'unicodeRange', 31288 unitsperem: 'unitsPerEm', 31289 'units-per-em': 'unitsPerEm', 31290 unselectable: 'unselectable', 31291 valphabetic: 'vAlphabetic', 31292 'v-alphabetic': 'vAlphabetic', 31293 values: 'values', 31294 vectoreffect: 'vectorEffect', 31295 'vector-effect': 'vectorEffect', 31296 version: 'version', 31297 vertadvy: 'vertAdvY', 31298 'vert-adv-y': 'vertAdvY', 31299 vertoriginx: 'vertOriginX', 31300 'vert-origin-x': 'vertOriginX', 31301 vertoriginy: 'vertOriginY', 31302 'vert-origin-y': 'vertOriginY', 31303 vhanging: 'vHanging', 31304 'v-hanging': 'vHanging', 31305 videographic: 'vIdeographic', 31306 'v-ideographic': 'vIdeographic', 31307 viewbox: 'viewBox', 31308 viewtarget: 'viewTarget', 31309 visibility: 'visibility', 31310 vmathematical: 'vMathematical', 31311 'v-mathematical': 'vMathematical', 31312 vocab: 'vocab', 31313 widths: 'widths', 31314 wordspacing: 'wordSpacing', 31315 'word-spacing': 'wordSpacing', 31316 writingmode: 'writingMode', 31317 'writing-mode': 'writingMode', 31318 x1: 'x1', 31319 x2: 'x2', 31320 x: 'x', 31321 xchannelselector: 'xChannelSelector', 31322 xheight: 'xHeight', 31323 'x-height': 'xHeight', 31324 xlinkactuate: 'xlinkActuate', 31325 'xlink:actuate': 'xlinkActuate', 31326 xlinkarcrole: 'xlinkArcrole', 31327 'xlink:arcrole': 'xlinkArcrole', 31328 xlinkhref: 'xlinkHref', 31329 'xlink:href': 'xlinkHref', 31330 xlinkrole: 'xlinkRole', 31331 'xlink:role': 'xlinkRole', 31332 xlinkshow: 'xlinkShow', 31333 'xlink:show': 'xlinkShow', 31334 xlinktitle: 'xlinkTitle', 31335 'xlink:title': 'xlinkTitle', 31336 xlinktype: 'xlinkType', 31337 'xlink:type': 'xlinkType', 31338 xmlbase: 'xmlBase', 31339 'xml:base': 'xmlBase', 31340 xmllang: 'xmlLang', 31341 'xml:lang': 'xmlLang', 31342 xmlns: 'xmlns', 31343 'xml:space': 'xmlSpace', 31344 xmlnsxlink: 'xmlnsXlink', 31345 'xmlns:xlink': 'xmlnsXlink', 31346 xmlspace: 'xmlSpace', 31347 y1: 'y1', 31348 y2: 'y2', 31349 y: 'y', 31350 ychannelselector: 'yChannelSelector', 31351 z: 'z', 31352 zoomandpan: 'zoomAndPan' 31353}; 31354 31355var ariaProperties = { 31356 'aria-current': 0, 31357 // state 31358 'aria-details': 0, 31359 'aria-disabled': 0, 31360 // state 31361 'aria-hidden': 0, 31362 // state 31363 'aria-invalid': 0, 31364 // state 31365 'aria-keyshortcuts': 0, 31366 'aria-label': 0, 31367 'aria-roledescription': 0, 31368 // Widget Attributes 31369 'aria-autocomplete': 0, 31370 'aria-checked': 0, 31371 'aria-expanded': 0, 31372 'aria-haspopup': 0, 31373 'aria-level': 0, 31374 'aria-modal': 0, 31375 'aria-multiline': 0, 31376 'aria-multiselectable': 0, 31377 'aria-orientation': 0, 31378 'aria-placeholder': 0, 31379 'aria-pressed': 0, 31380 'aria-readonly': 0, 31381 'aria-required': 0, 31382 'aria-selected': 0, 31383 'aria-sort': 0, 31384 'aria-valuemax': 0, 31385 'aria-valuemin': 0, 31386 'aria-valuenow': 0, 31387 'aria-valuetext': 0, 31388 // Live Region Attributes 31389 'aria-atomic': 0, 31390 'aria-busy': 0, 31391 'aria-live': 0, 31392 'aria-relevant': 0, 31393 // Drag-and-Drop Attributes 31394 'aria-dropeffect': 0, 31395 'aria-grabbed': 0, 31396 // Relationship Attributes 31397 'aria-activedescendant': 0, 31398 'aria-colcount': 0, 31399 'aria-colindex': 0, 31400 'aria-colspan': 0, 31401 'aria-controls': 0, 31402 'aria-describedby': 0, 31403 'aria-errormessage': 0, 31404 'aria-flowto': 0, 31405 'aria-labelledby': 0, 31406 'aria-owns': 0, 31407 'aria-posinset': 0, 31408 'aria-rowcount': 0, 31409 'aria-rowindex': 0, 31410 'aria-rowspan': 0, 31411 'aria-setsize': 0 31412}; 31413 31414var warnedProperties = {}; 31415var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$'); 31416var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$'); 31417var hasOwnProperty$1 = Object.prototype.hasOwnProperty; 31418 31419function validateProperty(tagName, name) { 31420 { 31421 if (hasOwnProperty$1.call(warnedProperties, name) && warnedProperties[name]) { 31422 return true; 31423 } 31424 31425 if (rARIACamel.test(name)) { 31426 var ariaName = 'aria-' + name.slice(4).toLowerCase(); 31427 var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null; // If this is an aria-* attribute, but is not listed in the known DOM 31428 // DOM properties, then it is an invalid aria-* attribute. 31429 31430 if (correctName == null) { 31431 error('Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name); 31432 31433 warnedProperties[name] = true; 31434 return true; 31435 } // aria-* attributes should be lowercase; suggest the lowercase version. 31436 31437 31438 if (name !== correctName) { 31439 error('Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName); 31440 31441 warnedProperties[name] = true; 31442 return true; 31443 } 31444 } 31445 31446 if (rARIA.test(name)) { 31447 var lowerCasedName = name.toLowerCase(); 31448 var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null; // If this is an aria-* attribute, but is not listed in the known DOM 31449 // DOM properties, then it is an invalid aria-* attribute. 31450 31451 if (standardName == null) { 31452 warnedProperties[name] = true; 31453 return false; 31454 } // aria-* attributes should be lowercase; suggest the lowercase version. 31455 31456 31457 if (name !== standardName) { 31458 error('Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName); 31459 31460 warnedProperties[name] = true; 31461 return true; 31462 } 31463 } 31464 } 31465 31466 return true; 31467} 31468 31469function warnInvalidARIAProps(type, props) { 31470 { 31471 var invalidProps = []; 31472 31473 for (var key in props) { 31474 var isValid = validateProperty(type, key); 31475 31476 if (!isValid) { 31477 invalidProps.push(key); 31478 } 31479 } 31480 31481 var unknownPropString = invalidProps.map(function (prop) { 31482 return '`' + prop + '`'; 31483 }).join(', '); 31484 31485 if (invalidProps.length === 1) { 31486 error('Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type); 31487 } else if (invalidProps.length > 1) { 31488 error('Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type); 31489 } 31490 } 31491} 31492 31493function validateProperties(type, props) { 31494 if (isCustomComponent(type, props)) { 31495 return; 31496 } 31497 31498 warnInvalidARIAProps(type, props); 31499} 31500 31501var didWarnValueNull = false; 31502function validateProperties$1(type, props) { 31503 { 31504 if (type !== 'input' && type !== 'textarea' && type !== 'select') { 31505 return; 31506 } 31507 31508 if (props != null && props.value === null && !didWarnValueNull) { 31509 didWarnValueNull = true; 31510 31511 if (type === 'select' && props.multiple) { 31512 error('`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.', type); 31513 } else { 31514 error('`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.', type); 31515 } 31516 } 31517 } 31518} 31519 31520var validateProperty$1 = function () {}; 31521 31522{ 31523 var warnedProperties$1 = {}; 31524 var _hasOwnProperty = Object.prototype.hasOwnProperty; 31525 var EVENT_NAME_REGEX = /^on./; 31526 var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/; 31527 var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$'); 31528 var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$'); 31529 31530 validateProperty$1 = function (tagName, name, value, canUseEventSystem) { 31531 if (_hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) { 31532 return true; 31533 } 31534 31535 var lowerCasedName = name.toLowerCase(); 31536 31537 if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') { 31538 error('React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.'); 31539 31540 warnedProperties$1[name] = true; 31541 return true; 31542 } // We can't rely on the event system being injected on the server. 31543 31544 31545 if (canUseEventSystem) { 31546 if (registrationNameModules.hasOwnProperty(name)) { 31547 return true; 31548 } 31549 31550 var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null; 31551 31552 if (registrationName != null) { 31553 error('Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName); 31554 31555 warnedProperties$1[name] = true; 31556 return true; 31557 } 31558 31559 if (EVENT_NAME_REGEX.test(name)) { 31560 error('Unknown event handler property `%s`. It will be ignored.', name); 31561 31562 warnedProperties$1[name] = true; 31563 return true; 31564 } 31565 } else if (EVENT_NAME_REGEX.test(name)) { 31566 // If no event plugins have been injected, we are in a server environment. 31567 // So we can't tell if the event name is correct for sure, but we can filter 31568 // out known bad ones like `onclick`. We can't suggest a specific replacement though. 31569 if (INVALID_EVENT_NAME_REGEX.test(name)) { 31570 error('Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name); 31571 } 31572 31573 warnedProperties$1[name] = true; 31574 return true; 31575 } // Let the ARIA attribute hook validate ARIA attributes 31576 31577 31578 if (rARIA$1.test(name) || rARIACamel$1.test(name)) { 31579 return true; 31580 } 31581 31582 if (lowerCasedName === 'innerhtml') { 31583 error('Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.'); 31584 31585 warnedProperties$1[name] = true; 31586 return true; 31587 } 31588 31589 if (lowerCasedName === 'aria') { 31590 error('The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.'); 31591 31592 warnedProperties$1[name] = true; 31593 return true; 31594 } 31595 31596 if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') { 31597 error('Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value); 31598 31599 warnedProperties$1[name] = true; 31600 return true; 31601 } 31602 31603 if (typeof value === 'number' && isNaN(value)) { 31604 error('Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name); 31605 31606 warnedProperties$1[name] = true; 31607 return true; 31608 } 31609 31610 var propertyInfo = getPropertyInfo(name); 31611 var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED; // Known attributes should match the casing specified in the property config. 31612 31613 if (possibleStandardNames.hasOwnProperty(lowerCasedName)) { 31614 var standardName = possibleStandardNames[lowerCasedName]; 31615 31616 if (standardName !== name) { 31617 error('Invalid DOM property `%s`. Did you mean `%s`?', name, standardName); 31618 31619 warnedProperties$1[name] = true; 31620 return true; 31621 } 31622 } else if (!isReserved && name !== lowerCasedName) { 31623 // Unknown attributes should have lowercase casing since that's how they 31624 // will be cased anyway with server rendering. 31625 error('React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.', name, lowerCasedName); 31626 31627 warnedProperties$1[name] = true; 31628 return true; 31629 } 31630 31631 if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) { 31632 if (value) { 31633 error('Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.', value, name, name, value, name); 31634 } else { 31635 error('Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name); 31636 } 31637 31638 warnedProperties$1[name] = true; 31639 return true; 31640 } // Now that we've validated casing, do not validate 31641 // data types for reserved props 31642 31643 31644 if (isReserved) { 31645 return true; 31646 } // Warn when a known attribute is a bad type 31647 31648 31649 if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) { 31650 warnedProperties$1[name] = true; 31651 return false; 31652 } // Warn when passing the strings 'false' or 'true' into a boolean prop 31653 31654 31655 if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) { 31656 error('Received the string `%s` for the boolean attribute `%s`. ' + '%s ' + 'Did you mean %s={%s}?', value, name, value === 'false' ? 'The browser will interpret it as a truthy value.' : 'Although this works, it will not work as expected if you pass the string "false".', name, value); 31657 31658 warnedProperties$1[name] = true; 31659 return true; 31660 } 31661 31662 return true; 31663 }; 31664} 31665 31666var warnUnknownProperties = function (type, props, canUseEventSystem) { 31667 { 31668 var unknownProps = []; 31669 31670 for (var key in props) { 31671 var isValid = validateProperty$1(type, key, props[key], canUseEventSystem); 31672 31673 if (!isValid) { 31674 unknownProps.push(key); 31675 } 31676 } 31677 31678 var unknownPropString = unknownProps.map(function (prop) { 31679 return '`' + prop + '`'; 31680 }).join(', '); 31681 31682 if (unknownProps.length === 1) { 31683 error('Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type); 31684 } else if (unknownProps.length > 1) { 31685 error('Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type); 31686 } 31687 } 31688}; 31689 31690function validateProperties$2(type, props, canUseEventSystem) { 31691 if (isCustomComponent(type, props)) { 31692 return; 31693 } 31694 31695 warnUnknownProperties(type, props, canUseEventSystem); 31696} 31697 31698var didWarnInvalidHydration = false; 31699var DANGEROUSLY_SET_INNER_HTML = 'dangerouslySetInnerHTML'; 31700var SUPPRESS_CONTENT_EDITABLE_WARNING = 'suppressContentEditableWarning'; 31701var SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning'; 31702var AUTOFOCUS = 'autoFocus'; 31703var CHILDREN = 'children'; 31704var STYLE = 'style'; 31705var HTML$1 = '__html'; 31706var HTML_NAMESPACE$1 = Namespaces.html; 31707var warnedUnknownTags; 31708var suppressHydrationWarning; 31709var validatePropertiesInDevelopment; 31710var warnForTextDifference; 31711var warnForPropDifference; 31712var warnForExtraAttributes; 31713var warnForInvalidEventListener; 31714var canDiffStyleForHydrationWarning; 31715var normalizeMarkupForTextOrAttribute; 31716var normalizeHTML; 31717 31718{ 31719 warnedUnknownTags = { 31720 // Chrome is the only major browser not shipping <time>. But as of July 31721 // 2017 it intends to ship it due to widespread usage. We intentionally 31722 // *don't* warn for <time> even if it's unrecognized by Chrome because 31723 // it soon will be, and many apps have been using it anyway. 31724 time: true, 31725 // There are working polyfills for <dialog>. Let people use it. 31726 dialog: true, 31727 // Electron ships a custom <webview> tag to display external web content in 31728 // an isolated frame and process. 31729 // This tag is not present in non Electron environments such as JSDom which 31730 // is often used for testing purposes. 31731 // @see https://electronjs.org/docs/api/webview-tag 31732 webview: true 31733 }; 31734 31735 validatePropertiesInDevelopment = function (type, props) { 31736 validateProperties(type, props); 31737 validateProperties$1(type, props); 31738 validateProperties$2(type, props, 31739 /* canUseEventSystem */ 31740 true); 31741 }; // IE 11 parses & normalizes the style attribute as opposed to other 31742 // browsers. It adds spaces and sorts the properties in some 31743 // non-alphabetical order. Handling that would require sorting CSS 31744 // properties in the client & server versions or applying 31745 // `expectedStyle` to a temporary DOM node to read its `style` attribute 31746 // normalized. Since it only affects IE, we're skipping style warnings 31747 // in that browser completely in favor of doing all that work. 31748 // See https://github.com/facebook/react/issues/11807 31749 31750 31751 canDiffStyleForHydrationWarning = canUseDOM && !document.documentMode; // HTML parsing normalizes CR and CRLF to LF. 31752 // It also can turn \u0000 into \uFFFD inside attributes. 31753 // https://www.w3.org/TR/html5/single-page.html#preprocessing-the-input-stream 31754 // If we have a mismatch, it might be caused by that. 31755 // We will still patch up in this case but not fire the warning. 31756 31757 var NORMALIZE_NEWLINES_REGEX = /\r\n?/g; 31758 var NORMALIZE_NULL_AND_REPLACEMENT_REGEX = /\u0000|\uFFFD/g; 31759 31760 normalizeMarkupForTextOrAttribute = function (markup) { 31761 var markupString = typeof markup === 'string' ? markup : '' + markup; 31762 return markupString.replace(NORMALIZE_NEWLINES_REGEX, '\n').replace(NORMALIZE_NULL_AND_REPLACEMENT_REGEX, ''); 31763 }; 31764 31765 warnForTextDifference = function (serverText, clientText) { 31766 if (didWarnInvalidHydration) { 31767 return; 31768 } 31769 31770 var normalizedClientText = normalizeMarkupForTextOrAttribute(clientText); 31771 var normalizedServerText = normalizeMarkupForTextOrAttribute(serverText); 31772 31773 if (normalizedServerText === normalizedClientText) { 31774 return; 31775 } 31776 31777 didWarnInvalidHydration = true; 31778 31779 error('Text content did not match. Server: "%s" Client: "%s"', normalizedServerText, normalizedClientText); 31780 }; 31781 31782 warnForPropDifference = function (propName, serverValue, clientValue) { 31783 if (didWarnInvalidHydration) { 31784 return; 31785 } 31786 31787 var normalizedClientValue = normalizeMarkupForTextOrAttribute(clientValue); 31788 var normalizedServerValue = normalizeMarkupForTextOrAttribute(serverValue); 31789 31790 if (normalizedServerValue === normalizedClientValue) { 31791 return; 31792 } 31793 31794 didWarnInvalidHydration = true; 31795 31796 error('Prop `%s` did not match. Server: %s Client: %s', propName, JSON.stringify(normalizedServerValue), JSON.stringify(normalizedClientValue)); 31797 }; 31798 31799 warnForExtraAttributes = function (attributeNames) { 31800 if (didWarnInvalidHydration) { 31801 return; 31802 } 31803 31804 didWarnInvalidHydration = true; 31805 var names = []; 31806 attributeNames.forEach(function (name) { 31807 names.push(name); 31808 }); 31809 31810 error('Extra attributes from the server: %s', names); 31811 }; 31812 31813 warnForInvalidEventListener = function (registrationName, listener) { 31814 if (listener === false) { 31815 error('Expected `%s` listener to be a function, instead got `false`.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', registrationName, registrationName, registrationName); 31816 } else { 31817 error('Expected `%s` listener to be a function, instead got a value of `%s` type.', registrationName, typeof listener); 31818 } 31819 }; // Parse the HTML and read it back to normalize the HTML string so that it 31820 // can be used for comparison. 31821 31822 31823 normalizeHTML = function (parent, html) { 31824 // We could have created a separate document here to avoid 31825 // re-initializing custom elements if they exist. But this breaks 31826 // how <noscript> is being handled. So we use the same document. 31827 // See the discussion in https://github.com/facebook/react/pull/11157. 31828 var testElement = parent.namespaceURI === HTML_NAMESPACE$1 ? parent.ownerDocument.createElement(parent.tagName) : parent.ownerDocument.createElementNS(parent.namespaceURI, parent.tagName); 31829 testElement.innerHTML = html; 31830 return testElement.innerHTML; 31831 }; 31832} 31833 31834function ensureListeningTo(rootContainerElement, registrationName) { 31835 var isDocumentOrFragment = rootContainerElement.nodeType === DOCUMENT_NODE || rootContainerElement.nodeType === DOCUMENT_FRAGMENT_NODE; 31836 var doc = isDocumentOrFragment ? rootContainerElement : rootContainerElement.ownerDocument; 31837 legacyListenToEvent(registrationName, doc); 31838} 31839 31840function getOwnerDocumentFromRootContainer(rootContainerElement) { 31841 return rootContainerElement.nodeType === DOCUMENT_NODE ? rootContainerElement : rootContainerElement.ownerDocument; 31842} 31843 31844function noop() {} 31845 31846function trapClickOnNonInteractiveElement(node) { 31847 // Mobile Safari does not fire properly bubble click events on 31848 // non-interactive elements, which means delegated click listeners do not 31849 // fire. The workaround for this bug involves attaching an empty click 31850 // listener on the target node. 31851 // http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html 31852 // Just set it using the onclick property so that we don't have to manage any 31853 // bookkeeping for it. Not sure if we need to clear it when the listener is 31854 // removed. 31855 // TODO: Only do this for the relevant Safaris maybe? 31856 node.onclick = noop; 31857} 31858 31859function setInitialDOMProperties(tag, domElement, rootContainerElement, nextProps, isCustomComponentTag) { 31860 for (var propKey in nextProps) { 31861 if (!nextProps.hasOwnProperty(propKey)) { 31862 continue; 31863 } 31864 31865 var nextProp = nextProps[propKey]; 31866 31867 if (propKey === STYLE) { 31868 { 31869 if (nextProp) { 31870 // Freeze the next style object so that we can assume it won't be 31871 // mutated. We have already warned for this in the past. 31872 Object.freeze(nextProp); 31873 } 31874 } // Relies on `updateStylesByID` not mutating `styleUpdates`. 31875 31876 31877 setValueForStyles(domElement, nextProp); 31878 } else if (propKey === DANGEROUSLY_SET_INNER_HTML) { 31879 var nextHtml = nextProp ? nextProp[HTML$1] : undefined; 31880 31881 if (nextHtml != null) { 31882 setInnerHTML(domElement, nextHtml); 31883 } 31884 } else if (propKey === CHILDREN) { 31885 if (typeof nextProp === 'string') { 31886 // Avoid setting initial textContent when the text is empty. In IE11 setting 31887 // textContent on a <textarea> will cause the placeholder to not 31888 // show within the <textarea> until it has been focused and blurred again. 31889 // https://github.com/facebook/react/issues/6731#issuecomment-254874553 31890 var canSetTextContent = tag !== 'textarea' || nextProp !== ''; 31891 31892 if (canSetTextContent) { 31893 setTextContent(domElement, nextProp); 31894 } 31895 } else if (typeof nextProp === 'number') { 31896 setTextContent(domElement, '' + nextProp); 31897 } 31898 } else if ( propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING) ; else if (propKey === AUTOFOCUS) ; else if (registrationNameModules.hasOwnProperty(propKey)) { 31899 if (nextProp != null) { 31900 if ( typeof nextProp !== 'function') { 31901 warnForInvalidEventListener(propKey, nextProp); 31902 } 31903 31904 ensureListeningTo(rootContainerElement, propKey); 31905 } 31906 } else if (nextProp != null) { 31907 setValueForProperty(domElement, propKey, nextProp, isCustomComponentTag); 31908 } 31909 } 31910} 31911 31912function updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag) { 31913 // TODO: Handle wasCustomComponentTag 31914 for (var i = 0; i < updatePayload.length; i += 2) { 31915 var propKey = updatePayload[i]; 31916 var propValue = updatePayload[i + 1]; 31917 31918 if (propKey === STYLE) { 31919 setValueForStyles(domElement, propValue); 31920 } else if (propKey === DANGEROUSLY_SET_INNER_HTML) { 31921 setInnerHTML(domElement, propValue); 31922 } else if (propKey === CHILDREN) { 31923 setTextContent(domElement, propValue); 31924 } else { 31925 setValueForProperty(domElement, propKey, propValue, isCustomComponentTag); 31926 } 31927 } 31928} 31929 31930function createElement(type, props, rootContainerElement, parentNamespace) { 31931 var isCustomComponentTag; // We create tags in the namespace of their parent container, except HTML 31932 // tags get no namespace. 31933 31934 var ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement); 31935 var domElement; 31936 var namespaceURI = parentNamespace; 31937 31938 if (namespaceURI === HTML_NAMESPACE$1) { 31939 namespaceURI = getIntrinsicNamespace(type); 31940 } 31941 31942 if (namespaceURI === HTML_NAMESPACE$1) { 31943 { 31944 isCustomComponentTag = isCustomComponent(type, props); // Should this check be gated by parent namespace? Not sure we want to 31945 // allow <SVG> or <mATH>. 31946 31947 if (!isCustomComponentTag && type !== type.toLowerCase()) { 31948 error('<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', type); 31949 } 31950 } 31951 31952 if (type === 'script') { 31953 // Create the script via .innerHTML so its "parser-inserted" flag is 31954 // set to true and it does not execute 31955 var div = ownerDocument.createElement('div'); 31956 31957 div.innerHTML = '<script><' + '/script>'; // eslint-disable-line 31958 // This is guaranteed to yield a script element. 31959 31960 var firstChild = div.firstChild; 31961 domElement = div.removeChild(firstChild); 31962 } else if (typeof props.is === 'string') { 31963 // $FlowIssue `createElement` should be updated for Web Components 31964 domElement = ownerDocument.createElement(type, { 31965 is: props.is 31966 }); 31967 } else { 31968 // Separate else branch instead of using `props.is || undefined` above because of a Firefox bug. 31969 // See discussion in https://github.com/facebook/react/pull/6896 31970 // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240 31971 domElement = ownerDocument.createElement(type); // Normally attributes are assigned in `setInitialDOMProperties`, however the `multiple` and `size` 31972 // attributes on `select`s needs to be added before `option`s are inserted. 31973 // This prevents: 31974 // - a bug where the `select` does not scroll to the correct option because singular 31975 // `select` elements automatically pick the first item #13222 31976 // - a bug where the `select` set the first item as selected despite the `size` attribute #14239 31977 // See https://github.com/facebook/react/issues/13222 31978 // and https://github.com/facebook/react/issues/14239 31979 31980 if (type === 'select') { 31981 var node = domElement; 31982 31983 if (props.multiple) { 31984 node.multiple = true; 31985 } else if (props.size) { 31986 // Setting a size greater than 1 causes a select to behave like `multiple=true`, where 31987 // it is possible that no option is selected. 31988 // 31989 // This is only necessary when a select in "single selection mode". 31990 node.size = props.size; 31991 } 31992 } 31993 } 31994 } else { 31995 domElement = ownerDocument.createElementNS(namespaceURI, type); 31996 } 31997 31998 { 31999 if (namespaceURI === HTML_NAMESPACE$1) { 32000 if (!isCustomComponentTag && Object.prototype.toString.call(domElement) === '[object HTMLUnknownElement]' && !Object.prototype.hasOwnProperty.call(warnedUnknownTags, type)) { 32001 warnedUnknownTags[type] = true; 32002 32003 error('The tag <%s> is unrecognized in this browser. ' + 'If you meant to render a React component, start its name with ' + 'an uppercase letter.', type); 32004 } 32005 } 32006 } 32007 32008 return domElement; 32009} 32010function createTextNode(text, rootContainerElement) { 32011 return getOwnerDocumentFromRootContainer(rootContainerElement).createTextNode(text); 32012} 32013function setInitialProperties(domElement, tag, rawProps, rootContainerElement) { 32014 var isCustomComponentTag = isCustomComponent(tag, rawProps); 32015 32016 { 32017 validatePropertiesInDevelopment(tag, rawProps); 32018 } // TODO: Make sure that we check isMounted before firing any of these events. 32019 32020 32021 var props; 32022 32023 switch (tag) { 32024 case 'iframe': 32025 case 'object': 32026 case 'embed': 32027 trapBubbledEvent(TOP_LOAD, domElement); 32028 props = rawProps; 32029 break; 32030 32031 case 'video': 32032 case 'audio': 32033 // Create listener for each media event 32034 for (var i = 0; i < mediaEventTypes.length; i++) { 32035 trapBubbledEvent(mediaEventTypes[i], domElement); 32036 } 32037 32038 props = rawProps; 32039 break; 32040 32041 case 'source': 32042 trapBubbledEvent(TOP_ERROR, domElement); 32043 props = rawProps; 32044 break; 32045 32046 case 'img': 32047 case 'image': 32048 case 'link': 32049 trapBubbledEvent(TOP_ERROR, domElement); 32050 trapBubbledEvent(TOP_LOAD, domElement); 32051 props = rawProps; 32052 break; 32053 32054 case 'form': 32055 trapBubbledEvent(TOP_RESET, domElement); 32056 trapBubbledEvent(TOP_SUBMIT, domElement); 32057 props = rawProps; 32058 break; 32059 32060 case 'details': 32061 trapBubbledEvent(TOP_TOGGLE, domElement); 32062 props = rawProps; 32063 break; 32064 32065 case 'input': 32066 initWrapperState(domElement, rawProps); 32067 props = getHostProps(domElement, rawProps); 32068 trapBubbledEvent(TOP_INVALID, domElement); // For controlled components we always need to ensure we're listening 32069 // to onChange. Even if there is no listener. 32070 32071 ensureListeningTo(rootContainerElement, 'onChange'); 32072 break; 32073 32074 case 'option': 32075 validateProps(domElement, rawProps); 32076 props = getHostProps$1(domElement, rawProps); 32077 break; 32078 32079 case 'select': 32080 initWrapperState$1(domElement, rawProps); 32081 props = getHostProps$2(domElement, rawProps); 32082 trapBubbledEvent(TOP_INVALID, domElement); // For controlled components we always need to ensure we're listening 32083 // to onChange. Even if there is no listener. 32084 32085 ensureListeningTo(rootContainerElement, 'onChange'); 32086 break; 32087 32088 case 'textarea': 32089 initWrapperState$2(domElement, rawProps); 32090 props = getHostProps$3(domElement, rawProps); 32091 trapBubbledEvent(TOP_INVALID, domElement); // For controlled components we always need to ensure we're listening 32092 // to onChange. Even if there is no listener. 32093 32094 ensureListeningTo(rootContainerElement, 'onChange'); 32095 break; 32096 32097 default: 32098 props = rawProps; 32099 } 32100 32101 assertValidProps(tag, props); 32102 setInitialDOMProperties(tag, domElement, rootContainerElement, props, isCustomComponentTag); 32103 32104 switch (tag) { 32105 case 'input': 32106 // TODO: Make sure we check if this is still unmounted or do any clean 32107 // up necessary since we never stop tracking anymore. 32108 track(domElement); 32109 postMountWrapper(domElement, rawProps, false); 32110 break; 32111 32112 case 'textarea': 32113 // TODO: Make sure we check if this is still unmounted or do any clean 32114 // up necessary since we never stop tracking anymore. 32115 track(domElement); 32116 postMountWrapper$3(domElement); 32117 break; 32118 32119 case 'option': 32120 postMountWrapper$1(domElement, rawProps); 32121 break; 32122 32123 case 'select': 32124 postMountWrapper$2(domElement, rawProps); 32125 break; 32126 32127 default: 32128 if (typeof props.onClick === 'function') { 32129 // TODO: This cast may not be sound for SVG, MathML or custom elements. 32130 trapClickOnNonInteractiveElement(domElement); 32131 } 32132 32133 break; 32134 } 32135} // Calculate the diff between the two objects. 32136 32137function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContainerElement) { 32138 { 32139 validatePropertiesInDevelopment(tag, nextRawProps); 32140 } 32141 32142 var updatePayload = null; 32143 var lastProps; 32144 var nextProps; 32145 32146 switch (tag) { 32147 case 'input': 32148 lastProps = getHostProps(domElement, lastRawProps); 32149 nextProps = getHostProps(domElement, nextRawProps); 32150 updatePayload = []; 32151 break; 32152 32153 case 'option': 32154 lastProps = getHostProps$1(domElement, lastRawProps); 32155 nextProps = getHostProps$1(domElement, nextRawProps); 32156 updatePayload = []; 32157 break; 32158 32159 case 'select': 32160 lastProps = getHostProps$2(domElement, lastRawProps); 32161 nextProps = getHostProps$2(domElement, nextRawProps); 32162 updatePayload = []; 32163 break; 32164 32165 case 'textarea': 32166 lastProps = getHostProps$3(domElement, lastRawProps); 32167 nextProps = getHostProps$3(domElement, nextRawProps); 32168 updatePayload = []; 32169 break; 32170 32171 default: 32172 lastProps = lastRawProps; 32173 nextProps = nextRawProps; 32174 32175 if (typeof lastProps.onClick !== 'function' && typeof nextProps.onClick === 'function') { 32176 // TODO: This cast may not be sound for SVG, MathML or custom elements. 32177 trapClickOnNonInteractiveElement(domElement); 32178 } 32179 32180 break; 32181 } 32182 32183 assertValidProps(tag, nextProps); 32184 var propKey; 32185 var styleName; 32186 var styleUpdates = null; 32187 32188 for (propKey in lastProps) { 32189 if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) { 32190 continue; 32191 } 32192 32193 if (propKey === STYLE) { 32194 var lastStyle = lastProps[propKey]; 32195 32196 for (styleName in lastStyle) { 32197 if (lastStyle.hasOwnProperty(styleName)) { 32198 if (!styleUpdates) { 32199 styleUpdates = {}; 32200 } 32201 32202 styleUpdates[styleName] = ''; 32203 } 32204 } 32205 } else if (propKey === DANGEROUSLY_SET_INNER_HTML || propKey === CHILDREN) ; else if ( propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING) ; else if (propKey === AUTOFOCUS) ; else if (registrationNameModules.hasOwnProperty(propKey)) { 32206 // This is a special case. If any listener updates we need to ensure 32207 // that the "current" fiber pointer gets updated so we need a commit 32208 // to update this element. 32209 if (!updatePayload) { 32210 updatePayload = []; 32211 } 32212 } else { 32213 // For all other deleted properties we add it to the queue. We use 32214 // the whitelist in the commit phase instead. 32215 (updatePayload = updatePayload || []).push(propKey, null); 32216 } 32217 } 32218 32219 for (propKey in nextProps) { 32220 var nextProp = nextProps[propKey]; 32221 var lastProp = lastProps != null ? lastProps[propKey] : undefined; 32222 32223 if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) { 32224 continue; 32225 } 32226 32227 if (propKey === STYLE) { 32228 { 32229 if (nextProp) { 32230 // Freeze the next style object so that we can assume it won't be 32231 // mutated. We have already warned for this in the past. 32232 Object.freeze(nextProp); 32233 } 32234 } 32235 32236 if (lastProp) { 32237 // Unset styles on `lastProp` but not on `nextProp`. 32238 for (styleName in lastProp) { 32239 if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) { 32240 if (!styleUpdates) { 32241 styleUpdates = {}; 32242 } 32243 32244 styleUpdates[styleName] = ''; 32245 } 32246 } // Update styles that changed since `lastProp`. 32247 32248 32249 for (styleName in nextProp) { 32250 if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) { 32251 if (!styleUpdates) { 32252 styleUpdates = {}; 32253 } 32254 32255 styleUpdates[styleName] = nextProp[styleName]; 32256 } 32257 } 32258 } else { 32259 // Relies on `updateStylesByID` not mutating `styleUpdates`. 32260 if (!styleUpdates) { 32261 if (!updatePayload) { 32262 updatePayload = []; 32263 } 32264 32265 updatePayload.push(propKey, styleUpdates); 32266 } 32267 32268 styleUpdates = nextProp; 32269 } 32270 } else if (propKey === DANGEROUSLY_SET_INNER_HTML) { 32271 var nextHtml = nextProp ? nextProp[HTML$1] : undefined; 32272 var lastHtml = lastProp ? lastProp[HTML$1] : undefined; 32273 32274 if (nextHtml != null) { 32275 if (lastHtml !== nextHtml) { 32276 (updatePayload = updatePayload || []).push(propKey, nextHtml); 32277 } 32278 } 32279 } else if (propKey === CHILDREN) { 32280 if (lastProp !== nextProp && (typeof nextProp === 'string' || typeof nextProp === 'number')) { 32281 (updatePayload = updatePayload || []).push(propKey, '' + nextProp); 32282 } 32283 } else if ( propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING) ; else if (registrationNameModules.hasOwnProperty(propKey)) { 32284 if (nextProp != null) { 32285 // We eagerly listen to this even though we haven't committed yet. 32286 if ( typeof nextProp !== 'function') { 32287 warnForInvalidEventListener(propKey, nextProp); 32288 } 32289 32290 ensureListeningTo(rootContainerElement, propKey); 32291 } 32292 32293 if (!updatePayload && lastProp !== nextProp) { 32294 // This is a special case. If any listener updates we need to ensure 32295 // that the "current" props pointer gets updated so we need a commit 32296 // to update this element. 32297 updatePayload = []; 32298 } 32299 } else { 32300 // For any other property we always add it to the queue and then we 32301 // filter it out using the whitelist during the commit. 32302 (updatePayload = updatePayload || []).push(propKey, nextProp); 32303 } 32304 } 32305 32306 if (styleUpdates) { 32307 { 32308 validateShorthandPropertyCollisionInDev(styleUpdates, nextProps[STYLE]); 32309 } 32310 32311 (updatePayload = updatePayload || []).push(STYLE, styleUpdates); 32312 } 32313 32314 return updatePayload; 32315} // Apply the diff. 32316 32317function updateProperties(domElement, updatePayload, tag, lastRawProps, nextRawProps) { 32318 // Update checked *before* name. 32319 // In the middle of an update, it is possible to have multiple checked. 32320 // When a checked radio tries to change name, browser makes another radio's checked false. 32321 if (tag === 'input' && nextRawProps.type === 'radio' && nextRawProps.name != null) { 32322 updateChecked(domElement, nextRawProps); 32323 } 32324 32325 var wasCustomComponentTag = isCustomComponent(tag, lastRawProps); 32326 var isCustomComponentTag = isCustomComponent(tag, nextRawProps); // Apply the diff. 32327 32328 updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag); // TODO: Ensure that an update gets scheduled if any of the special props 32329 // changed. 32330 32331 switch (tag) { 32332 case 'input': 32333 // Update the wrapper around inputs *after* updating props. This has to 32334 // happen after `updateDOMProperties`. Otherwise HTML5 input validations 32335 // raise warnings and prevent the new value from being assigned. 32336 updateWrapper(domElement, nextRawProps); 32337 break; 32338 32339 case 'textarea': 32340 updateWrapper$1(domElement, nextRawProps); 32341 break; 32342 32343 case 'select': 32344 // <select> value update needs to occur after <option> children 32345 // reconciliation 32346 postUpdateWrapper(domElement, nextRawProps); 32347 break; 32348 } 32349} 32350 32351function getPossibleStandardName(propName) { 32352 { 32353 var lowerCasedName = propName.toLowerCase(); 32354 32355 if (!possibleStandardNames.hasOwnProperty(lowerCasedName)) { 32356 return null; 32357 } 32358 32359 return possibleStandardNames[lowerCasedName] || null; 32360 } 32361} 32362 32363function diffHydratedProperties(domElement, tag, rawProps, parentNamespace, rootContainerElement) { 32364 var isCustomComponentTag; 32365 var extraAttributeNames; 32366 32367 { 32368 suppressHydrationWarning = rawProps[SUPPRESS_HYDRATION_WARNING] === true; 32369 isCustomComponentTag = isCustomComponent(tag, rawProps); 32370 validatePropertiesInDevelopment(tag, rawProps); 32371 } // TODO: Make sure that we check isMounted before firing any of these events. 32372 32373 32374 switch (tag) { 32375 case 'iframe': 32376 case 'object': 32377 case 'embed': 32378 trapBubbledEvent(TOP_LOAD, domElement); 32379 break; 32380 32381 case 'video': 32382 case 'audio': 32383 // Create listener for each media event 32384 for (var i = 0; i < mediaEventTypes.length; i++) { 32385 trapBubbledEvent(mediaEventTypes[i], domElement); 32386 } 32387 32388 break; 32389 32390 case 'source': 32391 trapBubbledEvent(TOP_ERROR, domElement); 32392 break; 32393 32394 case 'img': 32395 case 'image': 32396 case 'link': 32397 trapBubbledEvent(TOP_ERROR, domElement); 32398 trapBubbledEvent(TOP_LOAD, domElement); 32399 break; 32400 32401 case 'form': 32402 trapBubbledEvent(TOP_RESET, domElement); 32403 trapBubbledEvent(TOP_SUBMIT, domElement); 32404 break; 32405 32406 case 'details': 32407 trapBubbledEvent(TOP_TOGGLE, domElement); 32408 break; 32409 32410 case 'input': 32411 initWrapperState(domElement, rawProps); 32412 trapBubbledEvent(TOP_INVALID, domElement); // For controlled components we always need to ensure we're listening 32413 // to onChange. Even if there is no listener. 32414 32415 ensureListeningTo(rootContainerElement, 'onChange'); 32416 break; 32417 32418 case 'option': 32419 validateProps(domElement, rawProps); 32420 break; 32421 32422 case 'select': 32423 initWrapperState$1(domElement, rawProps); 32424 trapBubbledEvent(TOP_INVALID, domElement); // For controlled components we always need to ensure we're listening 32425 // to onChange. Even if there is no listener. 32426 32427 ensureListeningTo(rootContainerElement, 'onChange'); 32428 break; 32429 32430 case 'textarea': 32431 initWrapperState$2(domElement, rawProps); 32432 trapBubbledEvent(TOP_INVALID, domElement); // For controlled components we always need to ensure we're listening 32433 // to onChange. Even if there is no listener. 32434 32435 ensureListeningTo(rootContainerElement, 'onChange'); 32436 break; 32437 } 32438 32439 assertValidProps(tag, rawProps); 32440 32441 { 32442 extraAttributeNames = new Set(); 32443 var attributes = domElement.attributes; 32444 32445 for (var _i = 0; _i < attributes.length; _i++) { 32446 var name = attributes[_i].name.toLowerCase(); 32447 32448 switch (name) { 32449 // Built-in SSR attribute is whitelisted 32450 case 'data-reactroot': 32451 break; 32452 // Controlled attributes are not validated 32453 // TODO: Only ignore them on controlled tags. 32454 32455 case 'value': 32456 break; 32457 32458 case 'checked': 32459 break; 32460 32461 case 'selected': 32462 break; 32463 32464 default: 32465 // Intentionally use the original name. 32466 // See discussion in https://github.com/facebook/react/pull/10676. 32467 extraAttributeNames.add(attributes[_i].name); 32468 } 32469 } 32470 } 32471 32472 var updatePayload = null; 32473 32474 for (var propKey in rawProps) { 32475 if (!rawProps.hasOwnProperty(propKey)) { 32476 continue; 32477 } 32478 32479 var nextProp = rawProps[propKey]; 32480 32481 if (propKey === CHILDREN) { 32482 // For text content children we compare against textContent. This 32483 // might match additional HTML that is hidden when we read it using 32484 // textContent. E.g. "foo" will match "f<span>oo</span>" but that still 32485 // satisfies our requirement. Our requirement is not to produce perfect 32486 // HTML and attributes. Ideally we should preserve structure but it's 32487 // ok not to if the visible content is still enough to indicate what 32488 // even listeners these nodes might be wired up to. 32489 // TODO: Warn if there is more than a single textNode as a child. 32490 // TODO: Should we use domElement.firstChild.nodeValue to compare? 32491 if (typeof nextProp === 'string') { 32492 if (domElement.textContent !== nextProp) { 32493 if ( !suppressHydrationWarning) { 32494 warnForTextDifference(domElement.textContent, nextProp); 32495 } 32496 32497 updatePayload = [CHILDREN, nextProp]; 32498 } 32499 } else if (typeof nextProp === 'number') { 32500 if (domElement.textContent !== '' + nextProp) { 32501 if ( !suppressHydrationWarning) { 32502 warnForTextDifference(domElement.textContent, nextProp); 32503 } 32504 32505 updatePayload = [CHILDREN, '' + nextProp]; 32506 } 32507 } 32508 } else if (registrationNameModules.hasOwnProperty(propKey)) { 32509 if (nextProp != null) { 32510 if ( typeof nextProp !== 'function') { 32511 warnForInvalidEventListener(propKey, nextProp); 32512 } 32513 32514 ensureListeningTo(rootContainerElement, propKey); 32515 } 32516 } else if ( // Convince Flow we've calculated it (it's DEV-only in this method.) 32517 typeof isCustomComponentTag === 'boolean') { 32518 // Validate that the properties correspond to their expected values. 32519 var serverValue = void 0; 32520 var propertyInfo = getPropertyInfo(propKey); 32521 32522 if (suppressHydrationWarning) ; else if ( propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING || // Controlled attributes are not validated 32523 // TODO: Only ignore them on controlled tags. 32524 propKey === 'value' || propKey === 'checked' || propKey === 'selected') ; else if (propKey === DANGEROUSLY_SET_INNER_HTML) { 32525 var serverHTML = domElement.innerHTML; 32526 var nextHtml = nextProp ? nextProp[HTML$1] : undefined; 32527 var expectedHTML = normalizeHTML(domElement, nextHtml != null ? nextHtml : ''); 32528 32529 if (expectedHTML !== serverHTML) { 32530 warnForPropDifference(propKey, serverHTML, expectedHTML); 32531 } 32532 } else if (propKey === STYLE) { 32533 // $FlowFixMe - Should be inferred as not undefined. 32534 extraAttributeNames.delete(propKey); 32535 32536 if (canDiffStyleForHydrationWarning) { 32537 var expectedStyle = createDangerousStringForStyles(nextProp); 32538 serverValue = domElement.getAttribute('style'); 32539 32540 if (expectedStyle !== serverValue) { 32541 warnForPropDifference(propKey, serverValue, expectedStyle); 32542 } 32543 } 32544 } else if (isCustomComponentTag) { 32545 // $FlowFixMe - Should be inferred as not undefined. 32546 extraAttributeNames.delete(propKey.toLowerCase()); 32547 serverValue = getValueForAttribute(domElement, propKey, nextProp); 32548 32549 if (nextProp !== serverValue) { 32550 warnForPropDifference(propKey, serverValue, nextProp); 32551 } 32552 } else if (!shouldIgnoreAttribute(propKey, propertyInfo, isCustomComponentTag) && !shouldRemoveAttribute(propKey, nextProp, propertyInfo, isCustomComponentTag)) { 32553 var isMismatchDueToBadCasing = false; 32554 32555 if (propertyInfo !== null) { 32556 // $FlowFixMe - Should be inferred as not undefined. 32557 extraAttributeNames.delete(propertyInfo.attributeName); 32558 serverValue = getValueForProperty(domElement, propKey, nextProp, propertyInfo); 32559 } else { 32560 var ownNamespace = parentNamespace; 32561 32562 if (ownNamespace === HTML_NAMESPACE$1) { 32563 ownNamespace = getIntrinsicNamespace(tag); 32564 } 32565 32566 if (ownNamespace === HTML_NAMESPACE$1) { 32567 // $FlowFixMe - Should be inferred as not undefined. 32568 extraAttributeNames.delete(propKey.toLowerCase()); 32569 } else { 32570 var standardName = getPossibleStandardName(propKey); 32571 32572 if (standardName !== null && standardName !== propKey) { 32573 // If an SVG prop is supplied with bad casing, it will 32574 // be successfully parsed from HTML, but will produce a mismatch 32575 // (and would be incorrectly rendered on the client). 32576 // However, we already warn about bad casing elsewhere. 32577 // So we'll skip the misleading extra mismatch warning in this case. 32578 isMismatchDueToBadCasing = true; // $FlowFixMe - Should be inferred as not undefined. 32579 32580 extraAttributeNames.delete(standardName); 32581 } // $FlowFixMe - Should be inferred as not undefined. 32582 32583 32584 extraAttributeNames.delete(propKey); 32585 } 32586 32587 serverValue = getValueForAttribute(domElement, propKey, nextProp); 32588 } 32589 32590 if (nextProp !== serverValue && !isMismatchDueToBadCasing) { 32591 warnForPropDifference(propKey, serverValue, nextProp); 32592 } 32593 } 32594 } 32595 } 32596 32597 { 32598 // $FlowFixMe - Should be inferred as not undefined. 32599 if (extraAttributeNames.size > 0 && !suppressHydrationWarning) { 32600 // $FlowFixMe - Should be inferred as not undefined. 32601 warnForExtraAttributes(extraAttributeNames); 32602 } 32603 } 32604 32605 switch (tag) { 32606 case 'input': 32607 // TODO: Make sure we check if this is still unmounted or do any clean 32608 // up necessary since we never stop tracking anymore. 32609 track(domElement); 32610 postMountWrapper(domElement, rawProps, true); 32611 break; 32612 32613 case 'textarea': 32614 // TODO: Make sure we check if this is still unmounted or do any clean 32615 // up necessary since we never stop tracking anymore. 32616 track(domElement); 32617 postMountWrapper$3(domElement); 32618 break; 32619 32620 case 'select': 32621 case 'option': 32622 // For input and textarea we current always set the value property at 32623 // post mount to force it to diverge from attributes. However, for 32624 // option and select we don't quite do the same thing and select 32625 // is not resilient to the DOM state changing so we don't do that here. 32626 // TODO: Consider not doing this for input and textarea. 32627 break; 32628 32629 default: 32630 if (typeof rawProps.onClick === 'function') { 32631 // TODO: This cast may not be sound for SVG, MathML or custom elements. 32632 trapClickOnNonInteractiveElement(domElement); 32633 } 32634 32635 break; 32636 } 32637 32638 return updatePayload; 32639} 32640function diffHydratedText(textNode, text) { 32641 var isDifferent = textNode.nodeValue !== text; 32642 return isDifferent; 32643} 32644function warnForUnmatchedText(textNode, text) { 32645 { 32646 warnForTextDifference(textNode.nodeValue, text); 32647 } 32648} 32649function warnForDeletedHydratableElement(parentNode, child) { 32650 { 32651 if (didWarnInvalidHydration) { 32652 return; 32653 } 32654 32655 didWarnInvalidHydration = true; 32656 32657 error('Did not expect server HTML to contain a <%s> in <%s>.', child.nodeName.toLowerCase(), parentNode.nodeName.toLowerCase()); 32658 } 32659} 32660function warnForDeletedHydratableText(parentNode, child) { 32661 { 32662 if (didWarnInvalidHydration) { 32663 return; 32664 } 32665 32666 didWarnInvalidHydration = true; 32667 32668 error('Did not expect server HTML to contain the text node "%s" in <%s>.', child.nodeValue, parentNode.nodeName.toLowerCase()); 32669 } 32670} 32671function warnForInsertedHydratedElement(parentNode, tag, props) { 32672 { 32673 if (didWarnInvalidHydration) { 32674 return; 32675 } 32676 32677 didWarnInvalidHydration = true; 32678 32679 error('Expected server HTML to contain a matching <%s> in <%s>.', tag, parentNode.nodeName.toLowerCase()); 32680 } 32681} 32682function warnForInsertedHydratedText(parentNode, text) { 32683 { 32684 if (text === '') { 32685 // We expect to insert empty text nodes since they're not represented in 32686 // the HTML. 32687 // TODO: Remove this special case if we can just avoid inserting empty 32688 // text nodes. 32689 return; 32690 } 32691 32692 if (didWarnInvalidHydration) { 32693 return; 32694 } 32695 32696 didWarnInvalidHydration = true; 32697 32698 error('Expected server HTML to contain a matching text node for "%s" in <%s>.', text, parentNode.nodeName.toLowerCase()); 32699 } 32700} 32701function restoreControlledState$3(domElement, tag, props) { 32702 switch (tag) { 32703 case 'input': 32704 restoreControlledState(domElement, props); 32705 return; 32706 32707 case 'textarea': 32708 restoreControlledState$2(domElement, props); 32709 return; 32710 32711 case 'select': 32712 restoreControlledState$1(domElement, props); 32713 return; 32714 } 32715} 32716 32717function getActiveElement(doc) { 32718 doc = doc || (typeof document !== 'undefined' ? document : undefined); 32719 32720 if (typeof doc === 'undefined') { 32721 return null; 32722 } 32723 32724 try { 32725 return doc.activeElement || doc.body; 32726 } catch (e) { 32727 return doc.body; 32728 } 32729} 32730 32731/** 32732 * Given any node return the first leaf node without children. 32733 * 32734 * @param {DOMElement|DOMTextNode} node 32735 * @return {DOMElement|DOMTextNode} 32736 */ 32737 32738function getLeafNode(node) { 32739 while (node && node.firstChild) { 32740 node = node.firstChild; 32741 } 32742 32743 return node; 32744} 32745/** 32746 * Get the next sibling within a container. This will walk up the 32747 * DOM if a node's siblings have been exhausted. 32748 * 32749 * @param {DOMElement|DOMTextNode} node 32750 * @return {?DOMElement|DOMTextNode} 32751 */ 32752 32753 32754function getSiblingNode(node) { 32755 while (node) { 32756 if (node.nextSibling) { 32757 return node.nextSibling; 32758 } 32759 32760 node = node.parentNode; 32761 } 32762} 32763/** 32764 * Get object describing the nodes which contain characters at offset. 32765 * 32766 * @param {DOMElement|DOMTextNode} root 32767 * @param {number} offset 32768 * @return {?object} 32769 */ 32770 32771 32772function getNodeForCharacterOffset(root, offset) { 32773 var node = getLeafNode(root); 32774 var nodeStart = 0; 32775 var nodeEnd = 0; 32776 32777 while (node) { 32778 if (node.nodeType === TEXT_NODE) { 32779 nodeEnd = nodeStart + node.textContent.length; 32780 32781 if (nodeStart <= offset && nodeEnd >= offset) { 32782 return { 32783 node: node, 32784 offset: offset - nodeStart 32785 }; 32786 } 32787 32788 nodeStart = nodeEnd; 32789 } 32790 32791 node = getLeafNode(getSiblingNode(node)); 32792 } 32793} 32794 32795/** 32796 * @param {DOMElement} outerNode 32797 * @return {?object} 32798 */ 32799 32800function getOffsets(outerNode) { 32801 var ownerDocument = outerNode.ownerDocument; 32802 var win = ownerDocument && ownerDocument.defaultView || window; 32803 var selection = win.getSelection && win.getSelection(); 32804 32805 if (!selection || selection.rangeCount === 0) { 32806 return null; 32807 } 32808 32809 var anchorNode = selection.anchorNode, 32810 anchorOffset = selection.anchorOffset, 32811 focusNode = selection.focusNode, 32812 focusOffset = selection.focusOffset; // In Firefox, anchorNode and focusNode can be "anonymous divs", e.g. the 32813 // up/down buttons on an <input type="number">. Anonymous divs do not seem to 32814 // expose properties, triggering a "Permission denied error" if any of its 32815 // properties are accessed. The only seemingly possible way to avoid erroring 32816 // is to access a property that typically works for non-anonymous divs and 32817 // catch any error that may otherwise arise. See 32818 // https://bugzilla.mozilla.org/show_bug.cgi?id=208427 32819 32820 try { 32821 /* eslint-disable no-unused-expressions */ 32822 anchorNode.nodeType; 32823 focusNode.nodeType; 32824 /* eslint-enable no-unused-expressions */ 32825 } catch (e) { 32826 return null; 32827 } 32828 32829 return getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset); 32830} 32831/** 32832 * Returns {start, end} where `start` is the character/codepoint index of 32833 * (anchorNode, anchorOffset) within the textContent of `outerNode`, and 32834 * `end` is the index of (focusNode, focusOffset). 32835 * 32836 * Returns null if you pass in garbage input but we should probably just crash. 32837 * 32838 * Exported only for testing. 32839 */ 32840 32841function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset) { 32842 var length = 0; 32843 var start = -1; 32844 var end = -1; 32845 var indexWithinAnchor = 0; 32846 var indexWithinFocus = 0; 32847 var node = outerNode; 32848 var parentNode = null; 32849 32850 outer: while (true) { 32851 var next = null; 32852 32853 while (true) { 32854 if (node === anchorNode && (anchorOffset === 0 || node.nodeType === TEXT_NODE)) { 32855 start = length + anchorOffset; 32856 } 32857 32858 if (node === focusNode && (focusOffset === 0 || node.nodeType === TEXT_NODE)) { 32859 end = length + focusOffset; 32860 } 32861 32862 if (node.nodeType === TEXT_NODE) { 32863 length += node.nodeValue.length; 32864 } 32865 32866 if ((next = node.firstChild) === null) { 32867 break; 32868 } // Moving from `node` to its first child `next`. 32869 32870 32871 parentNode = node; 32872 node = next; 32873 } 32874 32875 while (true) { 32876 if (node === outerNode) { 32877 // If `outerNode` has children, this is always the second time visiting 32878 // it. If it has no children, this is still the first loop, and the only 32879 // valid selection is anchorNode and focusNode both equal to this node 32880 // and both offsets 0, in which case we will have handled above. 32881 break outer; 32882 } 32883 32884 if (parentNode === anchorNode && ++indexWithinAnchor === anchorOffset) { 32885 start = length; 32886 } 32887 32888 if (parentNode === focusNode && ++indexWithinFocus === focusOffset) { 32889 end = length; 32890 } 32891 32892 if ((next = node.nextSibling) !== null) { 32893 break; 32894 } 32895 32896 node = parentNode; 32897 parentNode = node.parentNode; 32898 } // Moving from `node` to its next sibling `next`. 32899 32900 32901 node = next; 32902 } 32903 32904 if (start === -1 || end === -1) { 32905 // This should never happen. (Would happen if the anchor/focus nodes aren't 32906 // actually inside the passed-in node.) 32907 return null; 32908 } 32909 32910 return { 32911 start: start, 32912 end: end 32913 }; 32914} 32915/** 32916 * In modern non-IE browsers, we can support both forward and backward 32917 * selections. 32918 * 32919 * Note: IE10+ supports the Selection object, but it does not support 32920 * the `extend` method, which means that even in modern IE, it's not possible 32921 * to programmatically create a backward selection. Thus, for all IE 32922 * versions, we use the old IE API to create our selections. 32923 * 32924 * @param {DOMElement|DOMTextNode} node 32925 * @param {object} offsets 32926 */ 32927 32928function setOffsets(node, offsets) { 32929 var doc = node.ownerDocument || document; 32930 var win = doc && doc.defaultView || window; // Edge fails with "Object expected" in some scenarios. 32931 // (For instance: TinyMCE editor used in a list component that supports pasting to add more, 32932 // fails when pasting 100+ items) 32933 32934 if (!win.getSelection) { 32935 return; 32936 } 32937 32938 var selection = win.getSelection(); 32939 var length = node.textContent.length; 32940 var start = Math.min(offsets.start, length); 32941 var end = offsets.end === undefined ? start : Math.min(offsets.end, length); // IE 11 uses modern selection, but doesn't support the extend method. 32942 // Flip backward selections, so we can set with a single range. 32943 32944 if (!selection.extend && start > end) { 32945 var temp = end; 32946 end = start; 32947 start = temp; 32948 } 32949 32950 var startMarker = getNodeForCharacterOffset(node, start); 32951 var endMarker = getNodeForCharacterOffset(node, end); 32952 32953 if (startMarker && endMarker) { 32954 if (selection.rangeCount === 1 && selection.anchorNode === startMarker.node && selection.anchorOffset === startMarker.offset && selection.focusNode === endMarker.node && selection.focusOffset === endMarker.offset) { 32955 return; 32956 } 32957 32958 var range = doc.createRange(); 32959 range.setStart(startMarker.node, startMarker.offset); 32960 selection.removeAllRanges(); 32961 32962 if (start > end) { 32963 selection.addRange(range); 32964 selection.extend(endMarker.node, endMarker.offset); 32965 } else { 32966 range.setEnd(endMarker.node, endMarker.offset); 32967 selection.addRange(range); 32968 } 32969 } 32970} 32971 32972function isTextNode(node) { 32973 return node && node.nodeType === TEXT_NODE; 32974} 32975 32976function containsNode(outerNode, innerNode) { 32977 if (!outerNode || !innerNode) { 32978 return false; 32979 } else if (outerNode === innerNode) { 32980 return true; 32981 } else if (isTextNode(outerNode)) { 32982 return false; 32983 } else if (isTextNode(innerNode)) { 32984 return containsNode(outerNode, innerNode.parentNode); 32985 } else if ('contains' in outerNode) { 32986 return outerNode.contains(innerNode); 32987 } else if (outerNode.compareDocumentPosition) { 32988 return !!(outerNode.compareDocumentPosition(innerNode) & 16); 32989 } else { 32990 return false; 32991 } 32992} 32993 32994function isInDocument(node) { 32995 return node && node.ownerDocument && containsNode(node.ownerDocument.documentElement, node); 32996} 32997 32998function isSameOriginFrame(iframe) { 32999 try { 33000 // Accessing the contentDocument of a HTMLIframeElement can cause the browser 33001 // to throw, e.g. if it has a cross-origin src attribute. 33002 // Safari will show an error in the console when the access results in "Blocked a frame with origin". e.g: 33003 // iframe.contentDocument.defaultView; 33004 // A safety way is to access one of the cross origin properties: Window or Location 33005 // Which might result in "SecurityError" DOM Exception and it is compatible to Safari. 33006 // https://html.spec.whatwg.org/multipage/browsers.html#integration-with-idl 33007 return typeof iframe.contentWindow.location.href === 'string'; 33008 } catch (err) { 33009 return false; 33010 } 33011} 33012 33013function getActiveElementDeep() { 33014 var win = window; 33015 var element = getActiveElement(); 33016 33017 while (element instanceof win.HTMLIFrameElement) { 33018 if (isSameOriginFrame(element)) { 33019 win = element.contentWindow; 33020 } else { 33021 return element; 33022 } 33023 33024 element = getActiveElement(win.document); 33025 } 33026 33027 return element; 33028} 33029/** 33030 * @ReactInputSelection: React input selection module. Based on Selection.js, 33031 * but modified to be suitable for react and has a couple of bug fixes (doesn't 33032 * assume buttons have range selections allowed). 33033 * Input selection module for React. 33034 */ 33035 33036/** 33037 * @hasSelectionCapabilities: we get the element types that support selection 33038 * from https://html.spec.whatwg.org/#do-not-apply, looking at `selectionStart` 33039 * and `selectionEnd` rows. 33040 */ 33041 33042 33043function hasSelectionCapabilities(elem) { 33044 var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); 33045 return nodeName && (nodeName === 'input' && (elem.type === 'text' || elem.type === 'search' || elem.type === 'tel' || elem.type === 'url' || elem.type === 'password') || nodeName === 'textarea' || elem.contentEditable === 'true'); 33046} 33047function getSelectionInformation() { 33048 var focusedElem = getActiveElementDeep(); 33049 return { 33050 // Used by Flare 33051 activeElementDetached: null, 33052 focusedElem: focusedElem, 33053 selectionRange: hasSelectionCapabilities(focusedElem) ? getSelection(focusedElem) : null 33054 }; 33055} 33056/** 33057 * @restoreSelection: If any selection information was potentially lost, 33058 * restore it. This is useful when performing operations that could remove dom 33059 * nodes and place them back in, resulting in focus being lost. 33060 */ 33061 33062function restoreSelection(priorSelectionInformation) { 33063 var curFocusedElem = getActiveElementDeep(); 33064 var priorFocusedElem = priorSelectionInformation.focusedElem; 33065 var priorSelectionRange = priorSelectionInformation.selectionRange; 33066 33067 if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) { 33068 if (priorSelectionRange !== null && hasSelectionCapabilities(priorFocusedElem)) { 33069 setSelection(priorFocusedElem, priorSelectionRange); 33070 } // Focusing a node can change the scroll position, which is undesirable 33071 33072 33073 var ancestors = []; 33074 var ancestor = priorFocusedElem; 33075 33076 while (ancestor = ancestor.parentNode) { 33077 if (ancestor.nodeType === ELEMENT_NODE) { 33078 ancestors.push({ 33079 element: ancestor, 33080 left: ancestor.scrollLeft, 33081 top: ancestor.scrollTop 33082 }); 33083 } 33084 } 33085 33086 if (typeof priorFocusedElem.focus === 'function') { 33087 priorFocusedElem.focus(); 33088 } 33089 33090 for (var i = 0; i < ancestors.length; i++) { 33091 var info = ancestors[i]; 33092 info.element.scrollLeft = info.left; 33093 info.element.scrollTop = info.top; 33094 } 33095 } 33096} 33097/** 33098 * @getSelection: Gets the selection bounds of a focused textarea, input or 33099 * contentEditable node. 33100 * -@input: Look up selection bounds of this input 33101 * -@return {start: selectionStart, end: selectionEnd} 33102 */ 33103 33104function getSelection(input) { 33105 var selection; 33106 33107 if ('selectionStart' in input) { 33108 // Modern browser with input or textarea. 33109 selection = { 33110 start: input.selectionStart, 33111 end: input.selectionEnd 33112 }; 33113 } else { 33114 // Content editable or old IE textarea. 33115 selection = getOffsets(input); 33116 } 33117 33118 return selection || { 33119 start: 0, 33120 end: 0 33121 }; 33122} 33123/** 33124 * @setSelection: Sets the selection bounds of a textarea or input and focuses 33125 * the input. 33126 * -@input Set selection bounds of this input or textarea 33127 * -@offsets Object of same form that is returned from get* 33128 */ 33129 33130function setSelection(input, offsets) { 33131 var start = offsets.start, 33132 end = offsets.end; 33133 33134 if (end === undefined) { 33135 end = start; 33136 } 33137 33138 if ('selectionStart' in input) { 33139 input.selectionStart = start; 33140 input.selectionEnd = Math.min(end, input.value.length); 33141 } else { 33142 setOffsets(input, offsets); 33143 } 33144} 33145 33146var validateDOMNesting = function () {}; 33147 33148var updatedAncestorInfo = function () {}; 33149 33150{ 33151 // This validation code was written based on the HTML5 parsing spec: 33152 // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope 33153 // 33154 // Note: this does not catch all invalid nesting, nor does it try to (as it's 33155 // not clear what practical benefit doing so provides); instead, we warn only 33156 // for cases where the parser will give a parse tree differing from what React 33157 // intended. For example, <b><div></div></b> is invalid but we don't warn 33158 // because it still parses correctly; we do warn for other cases like nested 33159 // <p> tags where the beginning of the second element implicitly closes the 33160 // first, causing a confusing mess. 33161 // https://html.spec.whatwg.org/multipage/syntax.html#special 33162 var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp']; // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope 33163 33164 var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template', // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point 33165 // TODO: Distinguish by namespace here -- for <title>, including it here 33166 // errs on the side of fewer warnings 33167 'foreignObject', 'desc', 'title']; // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope 33168 33169 var buttonScopeTags = inScopeTags.concat(['button']); // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags 33170 33171 var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt']; 33172 var emptyAncestorInfo = { 33173 current: null, 33174 formTag: null, 33175 aTagInScope: null, 33176 buttonTagInScope: null, 33177 nobrTagInScope: null, 33178 pTagInButtonScope: null, 33179 listItemTagAutoclosing: null, 33180 dlItemTagAutoclosing: null 33181 }; 33182 33183 updatedAncestorInfo = function (oldInfo, tag) { 33184 var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo); 33185 33186 var info = { 33187 tag: tag 33188 }; 33189 33190 if (inScopeTags.indexOf(tag) !== -1) { 33191 ancestorInfo.aTagInScope = null; 33192 ancestorInfo.buttonTagInScope = null; 33193 ancestorInfo.nobrTagInScope = null; 33194 } 33195 33196 if (buttonScopeTags.indexOf(tag) !== -1) { 33197 ancestorInfo.pTagInButtonScope = null; 33198 } // See rules for 'li', 'dd', 'dt' start tags in 33199 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody 33200 33201 33202 if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') { 33203 ancestorInfo.listItemTagAutoclosing = null; 33204 ancestorInfo.dlItemTagAutoclosing = null; 33205 } 33206 33207 ancestorInfo.current = info; 33208 33209 if (tag === 'form') { 33210 ancestorInfo.formTag = info; 33211 } 33212 33213 if (tag === 'a') { 33214 ancestorInfo.aTagInScope = info; 33215 } 33216 33217 if (tag === 'button') { 33218 ancestorInfo.buttonTagInScope = info; 33219 } 33220 33221 if (tag === 'nobr') { 33222 ancestorInfo.nobrTagInScope = info; 33223 } 33224 33225 if (tag === 'p') { 33226 ancestorInfo.pTagInButtonScope = info; 33227 } 33228 33229 if (tag === 'li') { 33230 ancestorInfo.listItemTagAutoclosing = info; 33231 } 33232 33233 if (tag === 'dd' || tag === 'dt') { 33234 ancestorInfo.dlItemTagAutoclosing = info; 33235 } 33236 33237 return ancestorInfo; 33238 }; 33239 /** 33240 * Returns whether 33241 */ 33242 33243 33244 var isTagValidWithParent = function (tag, parentTag) { 33245 // First, let's check if we're in an unusual parsing mode... 33246 switch (parentTag) { 33247 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect 33248 case 'select': 33249 return tag === 'option' || tag === 'optgroup' || tag === '#text'; 33250 33251 case 'optgroup': 33252 return tag === 'option' || tag === '#text'; 33253 // Strictly speaking, seeing an <option> doesn't mean we're in a <select> 33254 // but 33255 33256 case 'option': 33257 return tag === '#text'; 33258 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd 33259 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption 33260 // No special behavior since these rules fall back to "in body" mode for 33261 // all except special table nodes which cause bad parsing behavior anyway. 33262 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr 33263 33264 case 'tr': 33265 return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template'; 33266 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody 33267 33268 case 'tbody': 33269 case 'thead': 33270 case 'tfoot': 33271 return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template'; 33272 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup 33273 33274 case 'colgroup': 33275 return tag === 'col' || tag === 'template'; 33276 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable 33277 33278 case 'table': 33279 return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template'; 33280 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead 33281 33282 case 'head': 33283 return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template'; 33284 // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element 33285 33286 case 'html': 33287 return tag === 'head' || tag === 'body' || tag === 'frameset'; 33288 33289 case 'frameset': 33290 return tag === 'frame'; 33291 33292 case '#document': 33293 return tag === 'html'; 33294 } // Probably in the "in body" parsing mode, so we outlaw only tag combos 33295 // where the parsing rules cause implicit opens or closes to be added. 33296 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody 33297 33298 33299 switch (tag) { 33300 case 'h1': 33301 case 'h2': 33302 case 'h3': 33303 case 'h4': 33304 case 'h5': 33305 case 'h6': 33306 return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6'; 33307 33308 case 'rp': 33309 case 'rt': 33310 return impliedEndTags.indexOf(parentTag) === -1; 33311 33312 case 'body': 33313 case 'caption': 33314 case 'col': 33315 case 'colgroup': 33316 case 'frameset': 33317 case 'frame': 33318 case 'head': 33319 case 'html': 33320 case 'tbody': 33321 case 'td': 33322 case 'tfoot': 33323 case 'th': 33324 case 'thead': 33325 case 'tr': 33326 // These tags are only valid with a few parents that have special child 33327 // parsing rules -- if we're down here, then none of those matched and 33328 // so we allow it only if we don't know what the parent is, as all other 33329 // cases are invalid. 33330 return parentTag == null; 33331 } 33332 33333 return true; 33334 }; 33335 /** 33336 * Returns whether 33337 */ 33338 33339 33340 var findInvalidAncestorForTag = function (tag, ancestorInfo) { 33341 switch (tag) { 33342 case 'address': 33343 case 'article': 33344 case 'aside': 33345 case 'blockquote': 33346 case 'center': 33347 case 'details': 33348 case 'dialog': 33349 case 'dir': 33350 case 'div': 33351 case 'dl': 33352 case 'fieldset': 33353 case 'figcaption': 33354 case 'figure': 33355 case 'footer': 33356 case 'header': 33357 case 'hgroup': 33358 case 'main': 33359 case 'menu': 33360 case 'nav': 33361 case 'ol': 33362 case 'p': 33363 case 'section': 33364 case 'summary': 33365 case 'ul': 33366 case 'pre': 33367 case 'listing': 33368 case 'table': 33369 case 'hr': 33370 case 'xmp': 33371 case 'h1': 33372 case 'h2': 33373 case 'h3': 33374 case 'h4': 33375 case 'h5': 33376 case 'h6': 33377 return ancestorInfo.pTagInButtonScope; 33378 33379 case 'form': 33380 return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope; 33381 33382 case 'li': 33383 return ancestorInfo.listItemTagAutoclosing; 33384 33385 case 'dd': 33386 case 'dt': 33387 return ancestorInfo.dlItemTagAutoclosing; 33388 33389 case 'button': 33390 return ancestorInfo.buttonTagInScope; 33391 33392 case 'a': 33393 // Spec says something about storing a list of markers, but it sounds 33394 // equivalent to this check. 33395 return ancestorInfo.aTagInScope; 33396 33397 case 'nobr': 33398 return ancestorInfo.nobrTagInScope; 33399 } 33400 33401 return null; 33402 }; 33403 33404 var didWarn$1 = {}; 33405 33406 validateDOMNesting = function (childTag, childText, ancestorInfo) { 33407 ancestorInfo = ancestorInfo || emptyAncestorInfo; 33408 var parentInfo = ancestorInfo.current; 33409 var parentTag = parentInfo && parentInfo.tag; 33410 33411 if (childText != null) { 33412 if (childTag != null) { 33413 error('validateDOMNesting: when childText is passed, childTag should be null'); 33414 } 33415 33416 childTag = '#text'; 33417 } 33418 33419 var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo; 33420 var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo); 33421 var invalidParentOrAncestor = invalidParent || invalidAncestor; 33422 33423 if (!invalidParentOrAncestor) { 33424 return; 33425 } 33426 33427 var ancestorTag = invalidParentOrAncestor.tag; 33428 var addendum = getCurrentFiberStackInDev(); 33429 var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + addendum; 33430 33431 if (didWarn$1[warnKey]) { 33432 return; 33433 } 33434 33435 didWarn$1[warnKey] = true; 33436 var tagDisplayName = childTag; 33437 var whitespaceInfo = ''; 33438 33439 if (childTag === '#text') { 33440 if (/\S/.test(childText)) { 33441 tagDisplayName = 'Text nodes'; 33442 } else { 33443 tagDisplayName = 'Whitespace text nodes'; 33444 whitespaceInfo = " Make sure you don't have any extra whitespace between tags on " + 'each line of your source code.'; 33445 } 33446 } else { 33447 tagDisplayName = '<' + childTag + '>'; 33448 } 33449 33450 if (invalidParent) { 33451 var info = ''; 33452 33453 if (ancestorTag === 'table' && childTag === 'tr') { 33454 info += ' Add a <tbody>, <thead> or <tfoot> to your code to match the DOM tree generated by ' + 'the browser.'; 33455 } 33456 33457 error('validateDOMNesting(...): %s cannot appear as a child of <%s>.%s%s', tagDisplayName, ancestorTag, whitespaceInfo, info); 33458 } else { 33459 error('validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>.', tagDisplayName, ancestorTag); 33460 } 33461 }; 33462} 33463 33464var SUPPRESS_HYDRATION_WARNING$1; 33465 33466{ 33467 SUPPRESS_HYDRATION_WARNING$1 = 'suppressHydrationWarning'; 33468} 33469 33470var SUSPENSE_START_DATA = '$'; 33471var SUSPENSE_END_DATA = '/$'; 33472var SUSPENSE_PENDING_START_DATA = '$?'; 33473var SUSPENSE_FALLBACK_START_DATA = '$!'; 33474var STYLE$1 = 'style'; 33475var eventsEnabled = null; 33476var selectionInformation = null; 33477 33478function shouldAutoFocusHostComponent(type, props) { 33479 switch (type) { 33480 case 'button': 33481 case 'input': 33482 case 'select': 33483 case 'textarea': 33484 return !!props.autoFocus; 33485 } 33486 33487 return false; 33488} 33489function getRootHostContext(rootContainerInstance) { 33490 var type; 33491 var namespace; 33492 var nodeType = rootContainerInstance.nodeType; 33493 33494 switch (nodeType) { 33495 case DOCUMENT_NODE: 33496 case DOCUMENT_FRAGMENT_NODE: 33497 { 33498 type = nodeType === DOCUMENT_NODE ? '#document' : '#fragment'; 33499 var root = rootContainerInstance.documentElement; 33500 namespace = root ? root.namespaceURI : getChildNamespace(null, ''); 33501 break; 33502 } 33503 33504 default: 33505 { 33506 var container = nodeType === COMMENT_NODE ? rootContainerInstance.parentNode : rootContainerInstance; 33507 var ownNamespace = container.namespaceURI || null; 33508 type = container.tagName; 33509 namespace = getChildNamespace(ownNamespace, type); 33510 break; 33511 } 33512 } 33513 33514 { 33515 var validatedTag = type.toLowerCase(); 33516 var ancestorInfo = updatedAncestorInfo(null, validatedTag); 33517 return { 33518 namespace: namespace, 33519 ancestorInfo: ancestorInfo 33520 }; 33521 } 33522} 33523function getChildHostContext(parentHostContext, type, rootContainerInstance) { 33524 { 33525 var parentHostContextDev = parentHostContext; 33526 var namespace = getChildNamespace(parentHostContextDev.namespace, type); 33527 var ancestorInfo = updatedAncestorInfo(parentHostContextDev.ancestorInfo, type); 33528 return { 33529 namespace: namespace, 33530 ancestorInfo: ancestorInfo 33531 }; 33532 } 33533} 33534function getPublicInstance(instance) { 33535 return instance; 33536} 33537function prepareForCommit(containerInfo) { 33538 eventsEnabled = isEnabled(); 33539 selectionInformation = getSelectionInformation(); 33540 setEnabled(false); 33541} 33542function resetAfterCommit(containerInfo) { 33543 restoreSelection(selectionInformation); 33544 setEnabled(eventsEnabled); 33545 eventsEnabled = null; 33546 33547 selectionInformation = null; 33548} 33549function createInstance(type, props, rootContainerInstance, hostContext, internalInstanceHandle) { 33550 var parentNamespace; 33551 33552 { 33553 // TODO: take namespace into account when validating. 33554 var hostContextDev = hostContext; 33555 validateDOMNesting(type, null, hostContextDev.ancestorInfo); 33556 33557 if (typeof props.children === 'string' || typeof props.children === 'number') { 33558 var string = '' + props.children; 33559 var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type); 33560 validateDOMNesting(null, string, ownAncestorInfo); 33561 } 33562 33563 parentNamespace = hostContextDev.namespace; 33564 } 33565 33566 var domElement = createElement(type, props, rootContainerInstance, parentNamespace); 33567 precacheFiberNode(internalInstanceHandle, domElement); 33568 updateFiberProps(domElement, props); 33569 return domElement; 33570} 33571function appendInitialChild(parentInstance, child) { 33572 parentInstance.appendChild(child); 33573} 33574function finalizeInitialChildren(domElement, type, props, rootContainerInstance, hostContext) { 33575 setInitialProperties(domElement, type, props, rootContainerInstance); 33576 return shouldAutoFocusHostComponent(type, props); 33577} 33578function prepareUpdate(domElement, type, oldProps, newProps, rootContainerInstance, hostContext) { 33579 { 33580 var hostContextDev = hostContext; 33581 33582 if (typeof newProps.children !== typeof oldProps.children && (typeof newProps.children === 'string' || typeof newProps.children === 'number')) { 33583 var string = '' + newProps.children; 33584 var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type); 33585 validateDOMNesting(null, string, ownAncestorInfo); 33586 } 33587 } 33588 33589 return diffProperties(domElement, type, oldProps, newProps, rootContainerInstance); 33590} 33591function shouldSetTextContent(type, props) { 33592 return type === 'textarea' || type === 'option' || type === 'noscript' || typeof props.children === 'string' || typeof props.children === 'number' || typeof props.dangerouslySetInnerHTML === 'object' && props.dangerouslySetInnerHTML !== null && props.dangerouslySetInnerHTML.__html != null; 33593} 33594function shouldDeprioritizeSubtree(type, props) { 33595 return !!props.hidden; 33596} 33597function createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) { 33598 { 33599 var hostContextDev = hostContext; 33600 validateDOMNesting(null, text, hostContextDev.ancestorInfo); 33601 } 33602 33603 var textNode = createTextNode(text, rootContainerInstance); 33604 precacheFiberNode(internalInstanceHandle, textNode); 33605 return textNode; 33606} 33607// if a component just imports ReactDOM (e.g. for findDOMNode). 33608// Some environments might not have setTimeout or clearTimeout. 33609 33610var scheduleTimeout = typeof setTimeout === 'function' ? setTimeout : undefined; 33611var cancelTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined; 33612var noTimeout = -1; // ------------------- 33613function commitMount(domElement, type, newProps, internalInstanceHandle) { 33614 // Despite the naming that might imply otherwise, this method only 33615 // fires if there is an `Update` effect scheduled during mounting. 33616 // This happens if `finalizeInitialChildren` returns `true` (which it 33617 // does to implement the `autoFocus` attribute on the client). But 33618 // there are also other cases when this might happen (such as patching 33619 // up text content during hydration mismatch). So we'll check this again. 33620 if (shouldAutoFocusHostComponent(type, newProps)) { 33621 domElement.focus(); 33622 } 33623} 33624function commitUpdate(domElement, updatePayload, type, oldProps, newProps, internalInstanceHandle) { 33625 // Update the props handle so that we know which props are the ones with 33626 // with current event handlers. 33627 updateFiberProps(domElement, newProps); // Apply the diff to the DOM node. 33628 33629 updateProperties(domElement, updatePayload, type, oldProps, newProps); 33630} 33631function resetTextContent(domElement) { 33632 setTextContent(domElement, ''); 33633} 33634function commitTextUpdate(textInstance, oldText, newText) { 33635 textInstance.nodeValue = newText; 33636} 33637function appendChild(parentInstance, child) { 33638 parentInstance.appendChild(child); 33639} 33640function appendChildToContainer(container, child) { 33641 var parentNode; 33642 33643 if (container.nodeType === COMMENT_NODE) { 33644 parentNode = container.parentNode; 33645 parentNode.insertBefore(child, container); 33646 } else { 33647 parentNode = container; 33648 parentNode.appendChild(child); 33649 } // This container might be used for a portal. 33650 // If something inside a portal is clicked, that click should bubble 33651 // through the React tree. However, on Mobile Safari the click would 33652 // never bubble through the *DOM* tree unless an ancestor with onclick 33653 // event exists. So we wouldn't see it and dispatch it. 33654 // This is why we ensure that non React root containers have inline onclick 33655 // defined. 33656 // https://github.com/facebook/react/issues/11918 33657 33658 33659 var reactRootContainer = container._reactRootContainer; 33660 33661 if ((reactRootContainer === null || reactRootContainer === undefined) && parentNode.onclick === null) { 33662 // TODO: This cast may not be sound for SVG, MathML or custom elements. 33663 trapClickOnNonInteractiveElement(parentNode); 33664 } 33665} 33666function insertBefore(parentInstance, child, beforeChild) { 33667 parentInstance.insertBefore(child, beforeChild); 33668} 33669function insertInContainerBefore(container, child, beforeChild) { 33670 if (container.nodeType === COMMENT_NODE) { 33671 container.parentNode.insertBefore(child, beforeChild); 33672 } else { 33673 container.insertBefore(child, beforeChild); 33674 } 33675} 33676function removeChild(parentInstance, child) { 33677 parentInstance.removeChild(child); 33678} 33679function removeChildFromContainer(container, child) { 33680 if (container.nodeType === COMMENT_NODE) { 33681 container.parentNode.removeChild(child); 33682 } else { 33683 container.removeChild(child); 33684 } 33685} 33686 33687function hideInstance(instance) { 33688 // pass host context to this method? 33689 33690 33691 instance = instance; 33692 var style = instance.style; 33693 33694 if (typeof style.setProperty === 'function') { 33695 style.setProperty('display', 'none', 'important'); 33696 } else { 33697 style.display = 'none'; 33698 } 33699} 33700function hideTextInstance(textInstance) { 33701 textInstance.nodeValue = ''; 33702} 33703function unhideInstance(instance, props) { 33704 instance = instance; 33705 var styleProp = props[STYLE$1]; 33706 var display = styleProp !== undefined && styleProp !== null && styleProp.hasOwnProperty('display') ? styleProp.display : null; 33707 instance.style.display = dangerousStyleValue('display', display); 33708} 33709function unhideTextInstance(textInstance, text) { 33710 textInstance.nodeValue = text; 33711} // ------------------- 33712function canHydrateInstance(instance, type, props) { 33713 if (instance.nodeType !== ELEMENT_NODE || type.toLowerCase() !== instance.nodeName.toLowerCase()) { 33714 return null; 33715 } // This has now been refined to an element node. 33716 33717 33718 return instance; 33719} 33720function canHydrateTextInstance(instance, text) { 33721 if (text === '' || instance.nodeType !== TEXT_NODE) { 33722 // Empty strings are not parsed by HTML so there won't be a correct match here. 33723 return null; 33724 } // This has now been refined to a text node. 33725 33726 33727 return instance; 33728} 33729function isSuspenseInstancePending(instance) { 33730 return instance.data === SUSPENSE_PENDING_START_DATA; 33731} 33732function isSuspenseInstanceFallback(instance) { 33733 return instance.data === SUSPENSE_FALLBACK_START_DATA; 33734} 33735 33736function getNextHydratable(node) { 33737 // Skip non-hydratable nodes. 33738 for (; node != null; node = node.nextSibling) { 33739 var nodeType = node.nodeType; 33740 33741 if (nodeType === ELEMENT_NODE || nodeType === TEXT_NODE) { 33742 break; 33743 } 33744 } 33745 33746 return node; 33747} 33748 33749function getNextHydratableSibling(instance) { 33750 return getNextHydratable(instance.nextSibling); 33751} 33752function getFirstHydratableChild(parentInstance) { 33753 return getNextHydratable(parentInstance.firstChild); 33754} 33755function hydrateInstance(instance, type, props, rootContainerInstance, hostContext, internalInstanceHandle) { 33756 precacheFiberNode(internalInstanceHandle, instance); // TODO: Possibly defer this until the commit phase where all the events 33757 // get attached. 33758 33759 updateFiberProps(instance, props); 33760 var parentNamespace; 33761 33762 { 33763 var hostContextDev = hostContext; 33764 parentNamespace = hostContextDev.namespace; 33765 } 33766 33767 return diffHydratedProperties(instance, type, props, parentNamespace, rootContainerInstance); 33768} 33769function hydrateTextInstance(textInstance, text, internalInstanceHandle) { 33770 precacheFiberNode(internalInstanceHandle, textInstance); 33771 return diffHydratedText(textInstance, text); 33772} 33773function getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance) { 33774 var node = suspenseInstance.nextSibling; // Skip past all nodes within this suspense boundary. 33775 // There might be nested nodes so we need to keep track of how 33776 // deep we are and only break out when we're back on top. 33777 33778 var depth = 0; 33779 33780 while (node) { 33781 if (node.nodeType === COMMENT_NODE) { 33782 var data = node.data; 33783 33784 if (data === SUSPENSE_END_DATA) { 33785 if (depth === 0) { 33786 return getNextHydratableSibling(node); 33787 } else { 33788 depth--; 33789 } 33790 } else if (data === SUSPENSE_START_DATA || data === SUSPENSE_FALLBACK_START_DATA || data === SUSPENSE_PENDING_START_DATA) { 33791 depth++; 33792 } 33793 } 33794 33795 node = node.nextSibling; 33796 } // TODO: Warn, we didn't find the end comment boundary. 33797 33798 33799 return null; 33800} // Returns the SuspenseInstance if this node is a direct child of a 33801// SuspenseInstance. I.e. if its previous sibling is a Comment with 33802// SUSPENSE_x_START_DATA. Otherwise, null. 33803 33804function getParentSuspenseInstance(targetInstance) { 33805 var node = targetInstance.previousSibling; // Skip past all nodes within this suspense boundary. 33806 // There might be nested nodes so we need to keep track of how 33807 // deep we are and only break out when we're back on top. 33808 33809 var depth = 0; 33810 33811 while (node) { 33812 if (node.nodeType === COMMENT_NODE) { 33813 var data = node.data; 33814 33815 if (data === SUSPENSE_START_DATA || data === SUSPENSE_FALLBACK_START_DATA || data === SUSPENSE_PENDING_START_DATA) { 33816 if (depth === 0) { 33817 return node; 33818 } else { 33819 depth--; 33820 } 33821 } else if (data === SUSPENSE_END_DATA) { 33822 depth++; 33823 } 33824 } 33825 33826 node = node.previousSibling; 33827 } 33828 33829 return null; 33830} 33831function commitHydratedContainer(container) { 33832 // Retry if any event replaying was blocked on this. 33833 retryIfBlockedOn(container); 33834} 33835function commitHydratedSuspenseInstance(suspenseInstance) { 33836 // Retry if any event replaying was blocked on this. 33837 retryIfBlockedOn(suspenseInstance); 33838} 33839function didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, text) { 33840 { 33841 warnForUnmatchedText(textInstance, text); 33842 } 33843} 33844function didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, text) { 33845 if ( parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) { 33846 warnForUnmatchedText(textInstance, text); 33847 } 33848} 33849function didNotHydrateContainerInstance(parentContainer, instance) { 33850 { 33851 if (instance.nodeType === ELEMENT_NODE) { 33852 warnForDeletedHydratableElement(parentContainer, instance); 33853 } else if (instance.nodeType === COMMENT_NODE) ; else { 33854 warnForDeletedHydratableText(parentContainer, instance); 33855 } 33856 } 33857} 33858function didNotHydrateInstance(parentType, parentProps, parentInstance, instance) { 33859 if ( parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) { 33860 if (instance.nodeType === ELEMENT_NODE) { 33861 warnForDeletedHydratableElement(parentInstance, instance); 33862 } else if (instance.nodeType === COMMENT_NODE) ; else { 33863 warnForDeletedHydratableText(parentInstance, instance); 33864 } 33865 } 33866} 33867function didNotFindHydratableContainerInstance(parentContainer, type, props) { 33868 { 33869 warnForInsertedHydratedElement(parentContainer, type); 33870 } 33871} 33872function didNotFindHydratableContainerTextInstance(parentContainer, text) { 33873 { 33874 warnForInsertedHydratedText(parentContainer, text); 33875 } 33876} 33877function didNotFindHydratableInstance(parentType, parentProps, parentInstance, type, props) { 33878 if ( parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) { 33879 warnForInsertedHydratedElement(parentInstance, type); 33880 } 33881} 33882function didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, text) { 33883 if ( parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) { 33884 warnForInsertedHydratedText(parentInstance, text); 33885 } 33886} 33887function didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance) { 33888 if ( parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) ; 33889} 33890 33891var randomKey = Math.random().toString(36).slice(2); 33892var internalInstanceKey = '__reactInternalInstance$' + randomKey; 33893var internalEventHandlersKey = '__reactEventHandlers$' + randomKey; 33894var internalContainerInstanceKey = '__reactContainere$' + randomKey; 33895function precacheFiberNode(hostInst, node) { 33896 node[internalInstanceKey] = hostInst; 33897} 33898function markContainerAsRoot(hostRoot, node) { 33899 node[internalContainerInstanceKey] = hostRoot; 33900} 33901function unmarkContainerAsRoot(node) { 33902 node[internalContainerInstanceKey] = null; 33903} 33904function isContainerMarkedAsRoot(node) { 33905 return !!node[internalContainerInstanceKey]; 33906} // Given a DOM node, return the closest HostComponent or HostText fiber ancestor. 33907// If the target node is part of a hydrated or not yet rendered subtree, then 33908// this may also return a SuspenseComponent or HostRoot to indicate that. 33909// Conceptually the HostRoot fiber is a child of the Container node. So if you 33910// pass the Container node as the targetNode, you will not actually get the 33911// HostRoot back. To get to the HostRoot, you need to pass a child of it. 33912// The same thing applies to Suspense boundaries. 33913 33914function getClosestInstanceFromNode(targetNode) { 33915 var targetInst = targetNode[internalInstanceKey]; 33916 33917 if (targetInst) { 33918 // Don't return HostRoot or SuspenseComponent here. 33919 return targetInst; 33920 } // If the direct event target isn't a React owned DOM node, we need to look 33921 // to see if one of its parents is a React owned DOM node. 33922 33923 33924 var parentNode = targetNode.parentNode; 33925 33926 while (parentNode) { 33927 // We'll check if this is a container root that could include 33928 // React nodes in the future. We need to check this first because 33929 // if we're a child of a dehydrated container, we need to first 33930 // find that inner container before moving on to finding the parent 33931 // instance. Note that we don't check this field on the targetNode 33932 // itself because the fibers are conceptually between the container 33933 // node and the first child. It isn't surrounding the container node. 33934 // If it's not a container, we check if it's an instance. 33935 targetInst = parentNode[internalContainerInstanceKey] || parentNode[internalInstanceKey]; 33936 33937 if (targetInst) { 33938 // Since this wasn't the direct target of the event, we might have 33939 // stepped past dehydrated DOM nodes to get here. However they could 33940 // also have been non-React nodes. We need to answer which one. 33941 // If we the instance doesn't have any children, then there can't be 33942 // a nested suspense boundary within it. So we can use this as a fast 33943 // bailout. Most of the time, when people add non-React children to 33944 // the tree, it is using a ref to a child-less DOM node. 33945 // Normally we'd only need to check one of the fibers because if it 33946 // has ever gone from having children to deleting them or vice versa 33947 // it would have deleted the dehydrated boundary nested inside already. 33948 // However, since the HostRoot starts out with an alternate it might 33949 // have one on the alternate so we need to check in case this was a 33950 // root. 33951 var alternate = targetInst.alternate; 33952 33953 if (targetInst.child !== null || alternate !== null && alternate.child !== null) { 33954 // Next we need to figure out if the node that skipped past is 33955 // nested within a dehydrated boundary and if so, which one. 33956 var suspenseInstance = getParentSuspenseInstance(targetNode); 33957 33958 while (suspenseInstance !== null) { 33959 // We found a suspense instance. That means that we haven't 33960 // hydrated it yet. Even though we leave the comments in the 33961 // DOM after hydrating, and there are boundaries in the DOM 33962 // that could already be hydrated, we wouldn't have found them 33963 // through this pass since if the target is hydrated it would 33964 // have had an internalInstanceKey on it. 33965 // Let's get the fiber associated with the SuspenseComponent 33966 // as the deepest instance. 33967 var targetSuspenseInst = suspenseInstance[internalInstanceKey]; 33968 33969 if (targetSuspenseInst) { 33970 return targetSuspenseInst; 33971 } // If we don't find a Fiber on the comment, it might be because 33972 // we haven't gotten to hydrate it yet. There might still be a 33973 // parent boundary that hasn't above this one so we need to find 33974 // the outer most that is known. 33975 33976 33977 suspenseInstance = getParentSuspenseInstance(suspenseInstance); // If we don't find one, then that should mean that the parent 33978 // host component also hasn't hydrated yet. We can return it 33979 // below since it will bail out on the isMounted check later. 33980 } 33981 } 33982 33983 return targetInst; 33984 } 33985 33986 targetNode = parentNode; 33987 parentNode = targetNode.parentNode; 33988 } 33989 33990 return null; 33991} 33992/** 33993 * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent 33994 * instance, or null if the node was not rendered by this React. 33995 */ 33996 33997function getInstanceFromNode$1(node) { 33998 var inst = node[internalInstanceKey] || node[internalContainerInstanceKey]; 33999 34000 if (inst) { 34001 if (inst.tag === HostComponent || inst.tag === HostText || inst.tag === SuspenseComponent || inst.tag === HostRoot) { 34002 return inst; 34003 } else { 34004 return null; 34005 } 34006 } 34007 34008 return null; 34009} 34010/** 34011 * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding 34012 * DOM node. 34013 */ 34014 34015function getNodeFromInstance$1(inst) { 34016 if (inst.tag === HostComponent || inst.tag === HostText) { 34017 // In Fiber this, is just the state node right now. We assume it will be 34018 // a host component or host text. 34019 return inst.stateNode; 34020 } // Without this first invariant, passing a non-DOM-component triggers the next 34021 // invariant for a missing parent, which is super confusing. 34022 34023 34024 { 34025 { 34026 throw Error( "getNodeFromInstance: Invalid argument." ); 34027 } 34028 } 34029} 34030function getFiberCurrentPropsFromNode$1(node) { 34031 return node[internalEventHandlersKey] || null; 34032} 34033function updateFiberProps(node, props) { 34034 node[internalEventHandlersKey] = props; 34035} 34036 34037function getParent(inst) { 34038 do { 34039 inst = inst.return; // TODO: If this is a HostRoot we might want to bail out. 34040 // That is depending on if we want nested subtrees (layers) to bubble 34041 // events to their parent. We could also go through parentNode on the 34042 // host node but that wouldn't work for React Native and doesn't let us 34043 // do the portal feature. 34044 } while (inst && inst.tag !== HostComponent); 34045 34046 if (inst) { 34047 return inst; 34048 } 34049 34050 return null; 34051} 34052/** 34053 * Return the lowest common ancestor of A and B, or null if they are in 34054 * different trees. 34055 */ 34056 34057 34058function getLowestCommonAncestor(instA, instB) { 34059 var depthA = 0; 34060 34061 for (var tempA = instA; tempA; tempA = getParent(tempA)) { 34062 depthA++; 34063 } 34064 34065 var depthB = 0; 34066 34067 for (var tempB = instB; tempB; tempB = getParent(tempB)) { 34068 depthB++; 34069 } // If A is deeper, crawl up. 34070 34071 34072 while (depthA - depthB > 0) { 34073 instA = getParent(instA); 34074 depthA--; 34075 } // If B is deeper, crawl up. 34076 34077 34078 while (depthB - depthA > 0) { 34079 instB = getParent(instB); 34080 depthB--; 34081 } // Walk in lockstep until we find a match. 34082 34083 34084 var depth = depthA; 34085 34086 while (depth--) { 34087 if (instA === instB || instA === instB.alternate) { 34088 return instA; 34089 } 34090 34091 instA = getParent(instA); 34092 instB = getParent(instB); 34093 } 34094 34095 return null; 34096} 34097/** 34098 * Simulates the traversal of a two-phase, capture/bubble event dispatch. 34099 */ 34100 34101function traverseTwoPhase(inst, fn, arg) { 34102 var path = []; 34103 34104 while (inst) { 34105 path.push(inst); 34106 inst = getParent(inst); 34107 } 34108 34109 var i; 34110 34111 for (i = path.length; i-- > 0;) { 34112 fn(path[i], 'captured', arg); 34113 } 34114 34115 for (i = 0; i < path.length; i++) { 34116 fn(path[i], 'bubbled', arg); 34117 } 34118} 34119/** 34120 * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that 34121 * should would receive a `mouseEnter` or `mouseLeave` event. 34122 * 34123 * Does not invoke the callback on the nearest common ancestor because nothing 34124 * "entered" or "left" that element. 34125 */ 34126 34127function traverseEnterLeave(from, to, fn, argFrom, argTo) { 34128 var common = from && to ? getLowestCommonAncestor(from, to) : null; 34129 var pathFrom = []; 34130 34131 while (true) { 34132 if (!from) { 34133 break; 34134 } 34135 34136 if (from === common) { 34137 break; 34138 } 34139 34140 var alternate = from.alternate; 34141 34142 if (alternate !== null && alternate === common) { 34143 break; 34144 } 34145 34146 pathFrom.push(from); 34147 from = getParent(from); 34148 } 34149 34150 var pathTo = []; 34151 34152 while (true) { 34153 if (!to) { 34154 break; 34155 } 34156 34157 if (to === common) { 34158 break; 34159 } 34160 34161 var _alternate = to.alternate; 34162 34163 if (_alternate !== null && _alternate === common) { 34164 break; 34165 } 34166 34167 pathTo.push(to); 34168 to = getParent(to); 34169 } 34170 34171 for (var i = 0; i < pathFrom.length; i++) { 34172 fn(pathFrom[i], 'bubbled', argFrom); 34173 } 34174 34175 for (var _i = pathTo.length; _i-- > 0;) { 34176 fn(pathTo[_i], 'captured', argTo); 34177 } 34178} 34179 34180function isInteractive(tag) { 34181 return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea'; 34182} 34183 34184function shouldPreventMouseEvent(name, type, props) { 34185 switch (name) { 34186 case 'onClick': 34187 case 'onClickCapture': 34188 case 'onDoubleClick': 34189 case 'onDoubleClickCapture': 34190 case 'onMouseDown': 34191 case 'onMouseDownCapture': 34192 case 'onMouseMove': 34193 case 'onMouseMoveCapture': 34194 case 'onMouseUp': 34195 case 'onMouseUpCapture': 34196 case 'onMouseEnter': 34197 return !!(props.disabled && isInteractive(type)); 34198 34199 default: 34200 return false; 34201 } 34202} 34203/** 34204 * @param {object} inst The instance, which is the source of events. 34205 * @param {string} registrationName Name of listener (e.g. `onClick`). 34206 * @return {?function} The stored callback. 34207 */ 34208 34209 34210function getListener(inst, registrationName) { 34211 var listener; // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not 34212 // live here; needs to be moved to a better place soon 34213 34214 var stateNode = inst.stateNode; 34215 34216 if (!stateNode) { 34217 // Work in progress (ex: onload events in incremental mode). 34218 return null; 34219 } 34220 34221 var props = getFiberCurrentPropsFromNode(stateNode); 34222 34223 if (!props) { 34224 // Work in progress. 34225 return null; 34226 } 34227 34228 listener = props[registrationName]; 34229 34230 if (shouldPreventMouseEvent(registrationName, inst.type, props)) { 34231 return null; 34232 } 34233 34234 if (!(!listener || typeof listener === 'function')) { 34235 { 34236 throw Error( "Expected `" + registrationName + "` listener to be a function, instead got a value of `" + typeof listener + "` type." ); 34237 } 34238 } 34239 34240 return listener; 34241} 34242 34243/** 34244 * Some event types have a notion of different registration names for different 34245 * "phases" of propagation. This finds listeners by a given phase. 34246 */ 34247function listenerAtPhase(inst, event, propagationPhase) { 34248 var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; 34249 return getListener(inst, registrationName); 34250} 34251/** 34252 * A small set of propagation patterns, each of which will accept a small amount 34253 * of information, and generate a set of "dispatch ready event objects" - which 34254 * are sets of events that have already been annotated with a set of dispatched 34255 * listener functions/ids. The API is designed this way to discourage these 34256 * propagation strategies from actually executing the dispatches, since we 34257 * always want to collect the entire set of dispatches before executing even a 34258 * single one. 34259 */ 34260 34261/** 34262 * Tags a `SyntheticEvent` with dispatched listeners. Creating this function 34263 * here, allows us to not have to bind or create functions for each event. 34264 * Mutating the event's members allows us to not have to create a wrapping 34265 * "dispatch" object that pairs the event with the listener. 34266 */ 34267 34268 34269function accumulateDirectionalDispatches(inst, phase, event) { 34270 { 34271 if (!inst) { 34272 error('Dispatching inst must not be null'); 34273 } 34274 } 34275 34276 var listener = listenerAtPhase(inst, event, phase); 34277 34278 if (listener) { 34279 event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); 34280 event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); 34281 } 34282} 34283/** 34284 * Collect dispatches (must be entirely collected before dispatching - see unit 34285 * tests). Lazily allocate the array to conserve memory. We must loop through 34286 * each event and perform the traversal for each one. We cannot perform a 34287 * single traversal for the entire collection of events because each event may 34288 * have a different target. 34289 */ 34290 34291 34292function accumulateTwoPhaseDispatchesSingle(event) { 34293 if (event && event.dispatchConfig.phasedRegistrationNames) { 34294 traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); 34295 } 34296} 34297/** 34298 * Accumulates without regard to direction, does not look for phased 34299 * registration names. Same as `accumulateDirectDispatchesSingle` but without 34300 * requiring that the `dispatchMarker` be the same as the dispatched ID. 34301 */ 34302 34303 34304function accumulateDispatches(inst, ignoredDirection, event) { 34305 if (inst && event && event.dispatchConfig.registrationName) { 34306 var registrationName = event.dispatchConfig.registrationName; 34307 var listener = getListener(inst, registrationName); 34308 34309 if (listener) { 34310 event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); 34311 event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); 34312 } 34313 } 34314} 34315/** 34316 * Accumulates dispatches on an `SyntheticEvent`, but only for the 34317 * `dispatchMarker`. 34318 * @param {SyntheticEvent} event 34319 */ 34320 34321 34322function accumulateDirectDispatchesSingle(event) { 34323 if (event && event.dispatchConfig.registrationName) { 34324 accumulateDispatches(event._targetInst, null, event); 34325 } 34326} 34327 34328function accumulateTwoPhaseDispatches(events) { 34329 forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); 34330} 34331function accumulateEnterLeaveDispatches(leave, enter, from, to) { 34332 traverseEnterLeave(from, to, accumulateDispatches, leave, enter); 34333} 34334function accumulateDirectDispatches(events) { 34335 forEachAccumulated(events, accumulateDirectDispatchesSingle); 34336} 34337 34338/** 34339 * These variables store information about text content of a target node, 34340 * allowing comparison of content before and after a given event. 34341 * 34342 * Identify the node where selection currently begins, then observe 34343 * both its text content and its current position in the DOM. Since the 34344 * browser may natively replace the target node during composition, we can 34345 * use its position to find its replacement. 34346 * 34347 * 34348 */ 34349var root = null; 34350var startText = null; 34351var fallbackText = null; 34352function initialize(nativeEventTarget) { 34353 root = nativeEventTarget; 34354 startText = getText(); 34355 return true; 34356} 34357function reset() { 34358 root = null; 34359 startText = null; 34360 fallbackText = null; 34361} 34362function getData() { 34363 if (fallbackText) { 34364 return fallbackText; 34365 } 34366 34367 var start; 34368 var startValue = startText; 34369 var startLength = startValue.length; 34370 var end; 34371 var endValue = getText(); 34372 var endLength = endValue.length; 34373 34374 for (start = 0; start < startLength; start++) { 34375 if (startValue[start] !== endValue[start]) { 34376 break; 34377 } 34378 } 34379 34380 var minEnd = startLength - start; 34381 34382 for (end = 1; end <= minEnd; end++) { 34383 if (startValue[startLength - end] !== endValue[endLength - end]) { 34384 break; 34385 } 34386 } 34387 34388 var sliceTail = end > 1 ? 1 - end : undefined; 34389 fallbackText = endValue.slice(start, sliceTail); 34390 return fallbackText; 34391} 34392function getText() { 34393 if ('value' in root) { 34394 return root.value; 34395 } 34396 34397 return root.textContent; 34398} 34399 34400var EVENT_POOL_SIZE = 10; 34401/** 34402 * @interface Event 34403 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 34404 */ 34405 34406var EventInterface = { 34407 type: null, 34408 target: null, 34409 // currentTarget is set when dispatching; no use in copying it here 34410 currentTarget: function () { 34411 return null; 34412 }, 34413 eventPhase: null, 34414 bubbles: null, 34415 cancelable: null, 34416 timeStamp: function (event) { 34417 return event.timeStamp || Date.now(); 34418 }, 34419 defaultPrevented: null, 34420 isTrusted: null 34421}; 34422 34423function functionThatReturnsTrue() { 34424 return true; 34425} 34426 34427function functionThatReturnsFalse() { 34428 return false; 34429} 34430/** 34431 * Synthetic events are dispatched by event plugins, typically in response to a 34432 * top-level event delegation handler. 34433 * 34434 * These systems should generally use pooling to reduce the frequency of garbage 34435 * collection. The system should check `isPersistent` to determine whether the 34436 * event should be released into the pool after being dispatched. Users that 34437 * need a persisted event should invoke `persist`. 34438 * 34439 * Synthetic events (and subclasses) implement the DOM Level 3 Events API by 34440 * normalizing browser quirks. Subclasses do not necessarily have to implement a 34441 * DOM interface; custom application-specific events can also subclass this. 34442 * 34443 * @param {object} dispatchConfig Configuration used to dispatch this event. 34444 * @param {*} targetInst Marker identifying the event target. 34445 * @param {object} nativeEvent Native browser event. 34446 * @param {DOMEventTarget} nativeEventTarget Target node. 34447 */ 34448 34449 34450function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) { 34451 { 34452 // these have a getter/setter for warnings 34453 delete this.nativeEvent; 34454 delete this.preventDefault; 34455 delete this.stopPropagation; 34456 delete this.isDefaultPrevented; 34457 delete this.isPropagationStopped; 34458 } 34459 34460 this.dispatchConfig = dispatchConfig; 34461 this._targetInst = targetInst; 34462 this.nativeEvent = nativeEvent; 34463 var Interface = this.constructor.Interface; 34464 34465 for (var propName in Interface) { 34466 if (!Interface.hasOwnProperty(propName)) { 34467 continue; 34468 } 34469 34470 { 34471 delete this[propName]; // this has a getter/setter for warnings 34472 } 34473 34474 var normalize = Interface[propName]; 34475 34476 if (normalize) { 34477 this[propName] = normalize(nativeEvent); 34478 } else { 34479 if (propName === 'target') { 34480 this.target = nativeEventTarget; 34481 } else { 34482 this[propName] = nativeEvent[propName]; 34483 } 34484 } 34485 } 34486 34487 var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false; 34488 34489 if (defaultPrevented) { 34490 this.isDefaultPrevented = functionThatReturnsTrue; 34491 } else { 34492 this.isDefaultPrevented = functionThatReturnsFalse; 34493 } 34494 34495 this.isPropagationStopped = functionThatReturnsFalse; 34496 return this; 34497} 34498 34499_assign(SyntheticEvent.prototype, { 34500 preventDefault: function () { 34501 this.defaultPrevented = true; 34502 var event = this.nativeEvent; 34503 34504 if (!event) { 34505 return; 34506 } 34507 34508 if (event.preventDefault) { 34509 event.preventDefault(); 34510 } else if (typeof event.returnValue !== 'unknown') { 34511 event.returnValue = false; 34512 } 34513 34514 this.isDefaultPrevented = functionThatReturnsTrue; 34515 }, 34516 stopPropagation: function () { 34517 var event = this.nativeEvent; 34518 34519 if (!event) { 34520 return; 34521 } 34522 34523 if (event.stopPropagation) { 34524 event.stopPropagation(); 34525 } else if (typeof event.cancelBubble !== 'unknown') { 34526 // The ChangeEventPlugin registers a "propertychange" event for 34527 // IE. This event does not support bubbling or cancelling, and 34528 // any references to cancelBubble throw "Member not found". A 34529 // typeof check of "unknown" circumvents this issue (and is also 34530 // IE specific). 34531 event.cancelBubble = true; 34532 } 34533 34534 this.isPropagationStopped = functionThatReturnsTrue; 34535 }, 34536 34537 /** 34538 * We release all dispatched `SyntheticEvent`s after each event loop, adding 34539 * them back into the pool. This allows a way to hold onto a reference that 34540 * won't be added back into the pool. 34541 */ 34542 persist: function () { 34543 this.isPersistent = functionThatReturnsTrue; 34544 }, 34545 34546 /** 34547 * Checks if this event should be released back into the pool. 34548 * 34549 * @return {boolean} True if this should not be released, false otherwise. 34550 */ 34551 isPersistent: functionThatReturnsFalse, 34552 34553 /** 34554 * `PooledClass` looks for `destructor` on each instance it releases. 34555 */ 34556 destructor: function () { 34557 var Interface = this.constructor.Interface; 34558 34559 for (var propName in Interface) { 34560 { 34561 Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName])); 34562 } 34563 } 34564 34565 this.dispatchConfig = null; 34566 this._targetInst = null; 34567 this.nativeEvent = null; 34568 this.isDefaultPrevented = functionThatReturnsFalse; 34569 this.isPropagationStopped = functionThatReturnsFalse; 34570 this._dispatchListeners = null; 34571 this._dispatchInstances = null; 34572 34573 { 34574 Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null)); 34575 Object.defineProperty(this, 'isDefaultPrevented', getPooledWarningPropertyDefinition('isDefaultPrevented', functionThatReturnsFalse)); 34576 Object.defineProperty(this, 'isPropagationStopped', getPooledWarningPropertyDefinition('isPropagationStopped', functionThatReturnsFalse)); 34577 Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', function () {})); 34578 Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', function () {})); 34579 } 34580 } 34581}); 34582 34583SyntheticEvent.Interface = EventInterface; 34584/** 34585 * Helper to reduce boilerplate when creating subclasses. 34586 */ 34587 34588SyntheticEvent.extend = function (Interface) { 34589 var Super = this; 34590 34591 var E = function () {}; 34592 34593 E.prototype = Super.prototype; 34594 var prototype = new E(); 34595 34596 function Class() { 34597 return Super.apply(this, arguments); 34598 } 34599 34600 _assign(prototype, Class.prototype); 34601 34602 Class.prototype = prototype; 34603 Class.prototype.constructor = Class; 34604 Class.Interface = _assign({}, Super.Interface, Interface); 34605 Class.extend = Super.extend; 34606 addEventPoolingTo(Class); 34607 return Class; 34608}; 34609 34610addEventPoolingTo(SyntheticEvent); 34611/** 34612 * Helper to nullify syntheticEvent instance properties when destructing 34613 * 34614 * @param {String} propName 34615 * @param {?object} getVal 34616 * @return {object} defineProperty object 34617 */ 34618 34619function getPooledWarningPropertyDefinition(propName, getVal) { 34620 var isFunction = typeof getVal === 'function'; 34621 return { 34622 configurable: true, 34623 set: set, 34624 get: get 34625 }; 34626 34627 function set(val) { 34628 var action = isFunction ? 'setting the method' : 'setting the property'; 34629 warn(action, 'This is effectively a no-op'); 34630 return val; 34631 } 34632 34633 function get() { 34634 var action = isFunction ? 'accessing the method' : 'accessing the property'; 34635 var result = isFunction ? 'This is a no-op function' : 'This is set to null'; 34636 warn(action, result); 34637 return getVal; 34638 } 34639 34640 function warn(action, result) { 34641 { 34642 error("This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result); 34643 } 34644 } 34645} 34646 34647function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) { 34648 var EventConstructor = this; 34649 34650 if (EventConstructor.eventPool.length) { 34651 var instance = EventConstructor.eventPool.pop(); 34652 EventConstructor.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst); 34653 return instance; 34654 } 34655 34656 return new EventConstructor(dispatchConfig, targetInst, nativeEvent, nativeInst); 34657} 34658 34659function releasePooledEvent(event) { 34660 var EventConstructor = this; 34661 34662 if (!(event instanceof EventConstructor)) { 34663 { 34664 throw Error( "Trying to release an event instance into a pool of a different type." ); 34665 } 34666 } 34667 34668 event.destructor(); 34669 34670 if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) { 34671 EventConstructor.eventPool.push(event); 34672 } 34673} 34674 34675function addEventPoolingTo(EventConstructor) { 34676 EventConstructor.eventPool = []; 34677 EventConstructor.getPooled = getPooledEvent; 34678 EventConstructor.release = releasePooledEvent; 34679} 34680 34681/** 34682 * @interface Event 34683 * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents 34684 */ 34685 34686var SyntheticCompositionEvent = SyntheticEvent.extend({ 34687 data: null 34688}); 34689 34690/** 34691 * @interface Event 34692 * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105 34693 * /#events-inputevents 34694 */ 34695 34696var SyntheticInputEvent = SyntheticEvent.extend({ 34697 data: null 34698}); 34699 34700var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space 34701 34702var START_KEYCODE = 229; 34703var canUseCompositionEvent = canUseDOM && 'CompositionEvent' in window; 34704var documentMode = null; 34705 34706if (canUseDOM && 'documentMode' in document) { 34707 documentMode = document.documentMode; 34708} // Webkit offers a very useful `textInput` event that can be used to 34709// directly represent `beforeInput`. The IE `textinput` event is not as 34710// useful, so we don't use it. 34711 34712 34713var canUseTextInputEvent = canUseDOM && 'TextEvent' in window && !documentMode; // In IE9+, we have access to composition events, but the data supplied 34714// by the native compositionend event may be incorrect. Japanese ideographic 34715// spaces, for instance (\u3000) are not recorded correctly. 34716 34717var useFallbackCompositionData = canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11); 34718var SPACEBAR_CODE = 32; 34719var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); // Events and their corresponding property names. 34720 34721var eventTypes = { 34722 beforeInput: { 34723 phasedRegistrationNames: { 34724 bubbled: 'onBeforeInput', 34725 captured: 'onBeforeInputCapture' 34726 }, 34727 dependencies: [TOP_COMPOSITION_END, TOP_KEY_PRESS, TOP_TEXT_INPUT, TOP_PASTE] 34728 }, 34729 compositionEnd: { 34730 phasedRegistrationNames: { 34731 bubbled: 'onCompositionEnd', 34732 captured: 'onCompositionEndCapture' 34733 }, 34734 dependencies: [TOP_BLUR, TOP_COMPOSITION_END, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN] 34735 }, 34736 compositionStart: { 34737 phasedRegistrationNames: { 34738 bubbled: 'onCompositionStart', 34739 captured: 'onCompositionStartCapture' 34740 }, 34741 dependencies: [TOP_BLUR, TOP_COMPOSITION_START, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN] 34742 }, 34743 compositionUpdate: { 34744 phasedRegistrationNames: { 34745 bubbled: 'onCompositionUpdate', 34746 captured: 'onCompositionUpdateCapture' 34747 }, 34748 dependencies: [TOP_BLUR, TOP_COMPOSITION_UPDATE, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN] 34749 } 34750}; // Track whether we've ever handled a keypress on the space key. 34751 34752var hasSpaceKeypress = false; 34753/** 34754 * Return whether a native keypress event is assumed to be a command. 34755 * This is required because Firefox fires `keypress` events for key commands 34756 * (cut, copy, select-all, etc.) even though no character is inserted. 34757 */ 34758 34759function isKeypressCommand(nativeEvent) { 34760 return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && // ctrlKey && altKey is equivalent to AltGr, and is not a command. 34761 !(nativeEvent.ctrlKey && nativeEvent.altKey); 34762} 34763/** 34764 * Translate native top level events into event types. 34765 * 34766 * @param {string} topLevelType 34767 * @return {object} 34768 */ 34769 34770 34771function getCompositionEventType(topLevelType) { 34772 switch (topLevelType) { 34773 case TOP_COMPOSITION_START: 34774 return eventTypes.compositionStart; 34775 34776 case TOP_COMPOSITION_END: 34777 return eventTypes.compositionEnd; 34778 34779 case TOP_COMPOSITION_UPDATE: 34780 return eventTypes.compositionUpdate; 34781 } 34782} 34783/** 34784 * Does our fallback best-guess model think this event signifies that 34785 * composition has begun? 34786 * 34787 * @param {string} topLevelType 34788 * @param {object} nativeEvent 34789 * @return {boolean} 34790 */ 34791 34792 34793function isFallbackCompositionStart(topLevelType, nativeEvent) { 34794 return topLevelType === TOP_KEY_DOWN && nativeEvent.keyCode === START_KEYCODE; 34795} 34796/** 34797 * Does our fallback mode think that this event is the end of composition? 34798 * 34799 * @param {string} topLevelType 34800 * @param {object} nativeEvent 34801 * @return {boolean} 34802 */ 34803 34804 34805function isFallbackCompositionEnd(topLevelType, nativeEvent) { 34806 switch (topLevelType) { 34807 case TOP_KEY_UP: 34808 // Command keys insert or clear IME input. 34809 return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; 34810 34811 case TOP_KEY_DOWN: 34812 // Expect IME keyCode on each keydown. If we get any other 34813 // code we must have exited earlier. 34814 return nativeEvent.keyCode !== START_KEYCODE; 34815 34816 case TOP_KEY_PRESS: 34817 case TOP_MOUSE_DOWN: 34818 case TOP_BLUR: 34819 // Events are not possible without cancelling IME. 34820 return true; 34821 34822 default: 34823 return false; 34824 } 34825} 34826/** 34827 * Google Input Tools provides composition data via a CustomEvent, 34828 * with the `data` property populated in the `detail` object. If this 34829 * is available on the event object, use it. If not, this is a plain 34830 * composition event and we have nothing special to extract. 34831 * 34832 * @param {object} nativeEvent 34833 * @return {?string} 34834 */ 34835 34836 34837function getDataFromCustomEvent(nativeEvent) { 34838 var detail = nativeEvent.detail; 34839 34840 if (typeof detail === 'object' && 'data' in detail) { 34841 return detail.data; 34842 } 34843 34844 return null; 34845} 34846/** 34847 * Check if a composition event was triggered by Korean IME. 34848 * Our fallback mode does not work well with IE's Korean IME, 34849 * so just use native composition events when Korean IME is used. 34850 * Although CompositionEvent.locale property is deprecated, 34851 * it is available in IE, where our fallback mode is enabled. 34852 * 34853 * @param {object} nativeEvent 34854 * @return {boolean} 34855 */ 34856 34857 34858function isUsingKoreanIME(nativeEvent) { 34859 return nativeEvent.locale === 'ko'; 34860} // Track the current IME composition status, if any. 34861 34862 34863var isComposing = false; 34864/** 34865 * @return {?object} A SyntheticCompositionEvent. 34866 */ 34867 34868function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { 34869 var eventType; 34870 var fallbackData; 34871 34872 if (canUseCompositionEvent) { 34873 eventType = getCompositionEventType(topLevelType); 34874 } else if (!isComposing) { 34875 if (isFallbackCompositionStart(topLevelType, nativeEvent)) { 34876 eventType = eventTypes.compositionStart; 34877 } 34878 } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) { 34879 eventType = eventTypes.compositionEnd; 34880 } 34881 34882 if (!eventType) { 34883 return null; 34884 } 34885 34886 if (useFallbackCompositionData && !isUsingKoreanIME(nativeEvent)) { 34887 // The current composition is stored statically and must not be 34888 // overwritten while composition continues. 34889 if (!isComposing && eventType === eventTypes.compositionStart) { 34890 isComposing = initialize(nativeEventTarget); 34891 } else if (eventType === eventTypes.compositionEnd) { 34892 if (isComposing) { 34893 fallbackData = getData(); 34894 } 34895 } 34896 } 34897 34898 var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget); 34899 34900 if (fallbackData) { 34901 // Inject data generated from fallback path into the synthetic event. 34902 // This matches the property of native CompositionEventInterface. 34903 event.data = fallbackData; 34904 } else { 34905 var customData = getDataFromCustomEvent(nativeEvent); 34906 34907 if (customData !== null) { 34908 event.data = customData; 34909 } 34910 } 34911 34912 accumulateTwoPhaseDispatches(event); 34913 return event; 34914} 34915/** 34916 * @param {TopLevelType} topLevelType Number from `TopLevelType`. 34917 * @param {object} nativeEvent Native browser event. 34918 * @return {?string} The string corresponding to this `beforeInput` event. 34919 */ 34920 34921 34922function getNativeBeforeInputChars(topLevelType, nativeEvent) { 34923 switch (topLevelType) { 34924 case TOP_COMPOSITION_END: 34925 return getDataFromCustomEvent(nativeEvent); 34926 34927 case TOP_KEY_PRESS: 34928 /** 34929 * If native `textInput` events are available, our goal is to make 34930 * use of them. However, there is a special case: the spacebar key. 34931 * In Webkit, preventing default on a spacebar `textInput` event 34932 * cancels character insertion, but it *also* causes the browser 34933 * to fall back to its default spacebar behavior of scrolling the 34934 * page. 34935 * 34936 * Tracking at: 34937 * https://code.google.com/p/chromium/issues/detail?id=355103 34938 * 34939 * To avoid this issue, use the keypress event as if no `textInput` 34940 * event is available. 34941 */ 34942 var which = nativeEvent.which; 34943 34944 if (which !== SPACEBAR_CODE) { 34945 return null; 34946 } 34947 34948 hasSpaceKeypress = true; 34949 return SPACEBAR_CHAR; 34950 34951 case TOP_TEXT_INPUT: 34952 // Record the characters to be added to the DOM. 34953 var chars = nativeEvent.data; // If it's a spacebar character, assume that we have already handled 34954 // it at the keypress level and bail immediately. Android Chrome 34955 // doesn't give us keycodes, so we need to ignore it. 34956 34957 if (chars === SPACEBAR_CHAR && hasSpaceKeypress) { 34958 return null; 34959 } 34960 34961 return chars; 34962 34963 default: 34964 // For other native event types, do nothing. 34965 return null; 34966 } 34967} 34968/** 34969 * For browsers that do not provide the `textInput` event, extract the 34970 * appropriate string to use for SyntheticInputEvent. 34971 * 34972 * @param {number} topLevelType Number from `TopLevelEventTypes`. 34973 * @param {object} nativeEvent Native browser event. 34974 * @return {?string} The fallback string for this `beforeInput` event. 34975 */ 34976 34977 34978function getFallbackBeforeInputChars(topLevelType, nativeEvent) { 34979 // If we are currently composing (IME) and using a fallback to do so, 34980 // try to extract the composed characters from the fallback object. 34981 // If composition event is available, we extract a string only at 34982 // compositionevent, otherwise extract it at fallback events. 34983 if (isComposing) { 34984 if (topLevelType === TOP_COMPOSITION_END || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) { 34985 var chars = getData(); 34986 reset(); 34987 isComposing = false; 34988 return chars; 34989 } 34990 34991 return null; 34992 } 34993 34994 switch (topLevelType) { 34995 case TOP_PASTE: 34996 // If a paste event occurs after a keypress, throw out the input 34997 // chars. Paste events should not lead to BeforeInput events. 34998 return null; 34999 35000 case TOP_KEY_PRESS: 35001 /** 35002 * As of v27, Firefox may fire keypress events even when no character 35003 * will be inserted. A few possibilities: 35004 * 35005 * - `which` is `0`. Arrow keys, Esc key, etc. 35006 * 35007 * - `which` is the pressed key code, but no char is available. 35008 * Ex: 'AltGr + d` in Polish. There is no modified character for 35009 * this key combination and no character is inserted into the 35010 * document, but FF fires the keypress for char code `100` anyway. 35011 * No `input` event will occur. 35012 * 35013 * - `which` is the pressed key code, but a command combination is 35014 * being used. Ex: `Cmd+C`. No character is inserted, and no 35015 * `input` event will occur. 35016 */ 35017 if (!isKeypressCommand(nativeEvent)) { 35018 // IE fires the `keypress` event when a user types an emoji via 35019 // Touch keyboard of Windows. In such a case, the `char` property 35020 // holds an emoji character like `\uD83D\uDE0A`. Because its length 35021 // is 2, the property `which` does not represent an emoji correctly. 35022 // In such a case, we directly return the `char` property instead of 35023 // using `which`. 35024 if (nativeEvent.char && nativeEvent.char.length > 1) { 35025 return nativeEvent.char; 35026 } else if (nativeEvent.which) { 35027 return String.fromCharCode(nativeEvent.which); 35028 } 35029 } 35030 35031 return null; 35032 35033 case TOP_COMPOSITION_END: 35034 return useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) ? null : nativeEvent.data; 35035 35036 default: 35037 return null; 35038 } 35039} 35040/** 35041 * Extract a SyntheticInputEvent for `beforeInput`, based on either native 35042 * `textInput` or fallback behavior. 35043 * 35044 * @return {?object} A SyntheticInputEvent. 35045 */ 35046 35047 35048function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { 35049 var chars; 35050 35051 if (canUseTextInputEvent) { 35052 chars = getNativeBeforeInputChars(topLevelType, nativeEvent); 35053 } else { 35054 chars = getFallbackBeforeInputChars(topLevelType, nativeEvent); 35055 } // If no characters are being inserted, no BeforeInput event should 35056 // be fired. 35057 35058 35059 if (!chars) { 35060 return null; 35061 } 35062 35063 var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget); 35064 event.data = chars; 35065 accumulateTwoPhaseDispatches(event); 35066 return event; 35067} 35068/** 35069 * Create an `onBeforeInput` event to match 35070 * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents. 35071 * 35072 * This event plugin is based on the native `textInput` event 35073 * available in Chrome, Safari, Opera, and IE. This event fires after 35074 * `onKeyPress` and `onCompositionEnd`, but before `onInput`. 35075 * 35076 * `beforeInput` is spec'd but not implemented in any browsers, and 35077 * the `input` event does not provide any useful information about what has 35078 * actually been added, contrary to the spec. Thus, `textInput` is the best 35079 * available event to identify the characters that have actually been inserted 35080 * into the target node. 35081 * 35082 * This plugin is also responsible for emitting `composition` events, thus 35083 * allowing us to share composition fallback code for both `beforeInput` and 35084 * `composition` event types. 35085 */ 35086 35087 35088var BeforeInputEventPlugin = { 35089 eventTypes: eventTypes, 35090 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) { 35091 var composition = extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget); 35092 var beforeInput = extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget); 35093 35094 if (composition === null) { 35095 return beforeInput; 35096 } 35097 35098 if (beforeInput === null) { 35099 return composition; 35100 } 35101 35102 return [composition, beforeInput]; 35103 } 35104}; 35105 35106/** 35107 * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary 35108 */ 35109var supportedInputTypes = { 35110 color: true, 35111 date: true, 35112 datetime: true, 35113 'datetime-local': true, 35114 email: true, 35115 month: true, 35116 number: true, 35117 password: true, 35118 range: true, 35119 search: true, 35120 tel: true, 35121 text: true, 35122 time: true, 35123 url: true, 35124 week: true 35125}; 35126 35127function isTextInputElement(elem) { 35128 var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); 35129 35130 if (nodeName === 'input') { 35131 return !!supportedInputTypes[elem.type]; 35132 } 35133 35134 if (nodeName === 'textarea') { 35135 return true; 35136 } 35137 35138 return false; 35139} 35140 35141var eventTypes$1 = { 35142 change: { 35143 phasedRegistrationNames: { 35144 bubbled: 'onChange', 35145 captured: 'onChangeCapture' 35146 }, 35147 dependencies: [TOP_BLUR, TOP_CHANGE, TOP_CLICK, TOP_FOCUS, TOP_INPUT, TOP_KEY_DOWN, TOP_KEY_UP, TOP_SELECTION_CHANGE] 35148 } 35149}; 35150 35151function createAndAccumulateChangeEvent(inst, nativeEvent, target) { 35152 var event = SyntheticEvent.getPooled(eventTypes$1.change, inst, nativeEvent, target); 35153 event.type = 'change'; // Flag this event loop as needing state restore. 35154 35155 enqueueStateRestore(target); 35156 accumulateTwoPhaseDispatches(event); 35157 return event; 35158} 35159/** 35160 * For IE shims 35161 */ 35162 35163 35164var activeElement = null; 35165var activeElementInst = null; 35166/** 35167 * SECTION: handle `change` event 35168 */ 35169 35170function shouldUseChangeEvent(elem) { 35171 var nodeName = elem.nodeName && elem.nodeName.toLowerCase(); 35172 return nodeName === 'select' || nodeName === 'input' && elem.type === 'file'; 35173} 35174 35175function manualDispatchChangeEvent(nativeEvent) { 35176 var event = createAndAccumulateChangeEvent(activeElementInst, nativeEvent, getEventTarget(nativeEvent)); // If change and propertychange bubbled, we'd just bind to it like all the 35177 // other events and have it go through ReactBrowserEventEmitter. Since it 35178 // doesn't, we manually listen for the events and so we have to enqueue and 35179 // process the abstract event manually. 35180 // 35181 // Batching is necessary here in order to ensure that all event handlers run 35182 // before the next rerender (including event handlers attached to ancestor 35183 // elements instead of directly on the input). Without this, controlled 35184 // components don't work properly in conjunction with event bubbling because 35185 // the component is rerendered and the value reverted before all the event 35186 // handlers can run. See https://github.com/facebook/react/issues/708. 35187 35188 batchedUpdates(runEventInBatch, event); 35189} 35190 35191function runEventInBatch(event) { 35192 runEventsInBatch(event); 35193} 35194 35195function getInstIfValueChanged(targetInst) { 35196 var targetNode = getNodeFromInstance$1(targetInst); 35197 35198 if (updateValueIfChanged(targetNode)) { 35199 return targetInst; 35200 } 35201} 35202 35203function getTargetInstForChangeEvent(topLevelType, targetInst) { 35204 if (topLevelType === TOP_CHANGE) { 35205 return targetInst; 35206 } 35207} 35208/** 35209 * SECTION: handle `input` event 35210 */ 35211 35212 35213var isInputEventSupported = false; 35214 35215if (canUseDOM) { 35216 // IE9 claims to support the input event but fails to trigger it when 35217 // deleting text, so we ignore its input events. 35218 isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 9); 35219} 35220/** 35221 * (For IE <=9) Starts tracking propertychange events on the passed-in element 35222 * and override the value property so that we can distinguish user events from 35223 * value changes in JS. 35224 */ 35225 35226 35227function startWatchingForValueChange(target, targetInst) { 35228 activeElement = target; 35229 activeElementInst = targetInst; 35230 activeElement.attachEvent('onpropertychange', handlePropertyChange); 35231} 35232/** 35233 * (For IE <=9) Removes the event listeners from the currently-tracked element, 35234 * if any exists. 35235 */ 35236 35237 35238function stopWatchingForValueChange() { 35239 if (!activeElement) { 35240 return; 35241 } 35242 35243 activeElement.detachEvent('onpropertychange', handlePropertyChange); 35244 activeElement = null; 35245 activeElementInst = null; 35246} 35247/** 35248 * (For IE <=9) Handles a propertychange event, sending a `change` event if 35249 * the value of the active element has changed. 35250 */ 35251 35252 35253function handlePropertyChange(nativeEvent) { 35254 if (nativeEvent.propertyName !== 'value') { 35255 return; 35256 } 35257 35258 if (getInstIfValueChanged(activeElementInst)) { 35259 manualDispatchChangeEvent(nativeEvent); 35260 } 35261} 35262 35263function handleEventsForInputEventPolyfill(topLevelType, target, targetInst) { 35264 if (topLevelType === TOP_FOCUS) { 35265 // In IE9, propertychange fires for most input events but is buggy and 35266 // doesn't fire when text is deleted, but conveniently, selectionchange 35267 // appears to fire in all of the remaining cases so we catch those and 35268 // forward the event if the value has changed 35269 // In either case, we don't want to call the event handler if the value 35270 // is changed from JS so we redefine a setter for `.value` that updates 35271 // our activeElementValue variable, allowing us to ignore those changes 35272 // 35273 // stopWatching() should be a noop here but we call it just in case we 35274 // missed a blur event somehow. 35275 stopWatchingForValueChange(); 35276 startWatchingForValueChange(target, targetInst); 35277 } else if (topLevelType === TOP_BLUR) { 35278 stopWatchingForValueChange(); 35279 } 35280} // For IE8 and IE9. 35281 35282 35283function getTargetInstForInputEventPolyfill(topLevelType, targetInst) { 35284 if (topLevelType === TOP_SELECTION_CHANGE || topLevelType === TOP_KEY_UP || topLevelType === TOP_KEY_DOWN) { 35285 // On the selectionchange event, the target is just document which isn't 35286 // helpful for us so just check activeElement instead. 35287 // 35288 // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire 35289 // propertychange on the first input event after setting `value` from a 35290 // script and fires only keydown, keypress, keyup. Catching keyup usually 35291 // gets it and catching keydown lets us fire an event for the first 35292 // keystroke if user does a key repeat (it'll be a little delayed: right 35293 // before the second keystroke). Other input methods (e.g., paste) seem to 35294 // fire selectionchange normally. 35295 return getInstIfValueChanged(activeElementInst); 35296 } 35297} 35298/** 35299 * SECTION: handle `click` event 35300 */ 35301 35302 35303function shouldUseClickEvent(elem) { 35304 // Use the `click` event to detect changes to checkbox and radio inputs. 35305 // This approach works across all browsers, whereas `change` does not fire 35306 // until `blur` in IE8. 35307 var nodeName = elem.nodeName; 35308 return nodeName && nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio'); 35309} 35310 35311function getTargetInstForClickEvent(topLevelType, targetInst) { 35312 if (topLevelType === TOP_CLICK) { 35313 return getInstIfValueChanged(targetInst); 35314 } 35315} 35316 35317function getTargetInstForInputOrChangeEvent(topLevelType, targetInst) { 35318 if (topLevelType === TOP_INPUT || topLevelType === TOP_CHANGE) { 35319 return getInstIfValueChanged(targetInst); 35320 } 35321} 35322 35323function handleControlledInputBlur(node) { 35324 var state = node._wrapperState; 35325 35326 if (!state || !state.controlled || node.type !== 'number') { 35327 return; 35328 } 35329 35330 { 35331 // If controlled, assign the value attribute to the current value on blur 35332 setDefaultValue(node, 'number', node.value); 35333 } 35334} 35335/** 35336 * This plugin creates an `onChange` event that normalizes change events 35337 * across form elements. This event fires at a time when it's possible to 35338 * change the element's value without seeing a flicker. 35339 * 35340 * Supported elements are: 35341 * - input (see `isTextInputElement`) 35342 * - textarea 35343 * - select 35344 */ 35345 35346 35347var ChangeEventPlugin = { 35348 eventTypes: eventTypes$1, 35349 _isInputEventSupported: isInputEventSupported, 35350 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) { 35351 var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window; 35352 var getTargetInstFunc, handleEventFunc; 35353 35354 if (shouldUseChangeEvent(targetNode)) { 35355 getTargetInstFunc = getTargetInstForChangeEvent; 35356 } else if (isTextInputElement(targetNode)) { 35357 if (isInputEventSupported) { 35358 getTargetInstFunc = getTargetInstForInputOrChangeEvent; 35359 } else { 35360 getTargetInstFunc = getTargetInstForInputEventPolyfill; 35361 handleEventFunc = handleEventsForInputEventPolyfill; 35362 } 35363 } else if (shouldUseClickEvent(targetNode)) { 35364 getTargetInstFunc = getTargetInstForClickEvent; 35365 } 35366 35367 if (getTargetInstFunc) { 35368 var inst = getTargetInstFunc(topLevelType, targetInst); 35369 35370 if (inst) { 35371 var event = createAndAccumulateChangeEvent(inst, nativeEvent, nativeEventTarget); 35372 return event; 35373 } 35374 } 35375 35376 if (handleEventFunc) { 35377 handleEventFunc(topLevelType, targetNode, targetInst); 35378 } // When blurring, set the value attribute for number inputs 35379 35380 35381 if (topLevelType === TOP_BLUR) { 35382 handleControlledInputBlur(targetNode); 35383 } 35384 } 35385}; 35386 35387var SyntheticUIEvent = SyntheticEvent.extend({ 35388 view: null, 35389 detail: null 35390}); 35391 35392/** 35393 * Translation from modifier key to the associated property in the event. 35394 * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers 35395 */ 35396var modifierKeyToProp = { 35397 Alt: 'altKey', 35398 Control: 'ctrlKey', 35399 Meta: 'metaKey', 35400 Shift: 'shiftKey' 35401}; // Older browsers (Safari <= 10, iOS Safari <= 10.2) do not support 35402// getModifierState. If getModifierState is not supported, we map it to a set of 35403// modifier keys exposed by the event. In this case, Lock-keys are not supported. 35404 35405function modifierStateGetter(keyArg) { 35406 var syntheticEvent = this; 35407 var nativeEvent = syntheticEvent.nativeEvent; 35408 35409 if (nativeEvent.getModifierState) { 35410 return nativeEvent.getModifierState(keyArg); 35411 } 35412 35413 var keyProp = modifierKeyToProp[keyArg]; 35414 return keyProp ? !!nativeEvent[keyProp] : false; 35415} 35416 35417function getEventModifierState(nativeEvent) { 35418 return modifierStateGetter; 35419} 35420 35421var previousScreenX = 0; 35422var previousScreenY = 0; // Use flags to signal movementX/Y has already been set 35423 35424var isMovementXSet = false; 35425var isMovementYSet = false; 35426/** 35427 * @interface MouseEvent 35428 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 35429 */ 35430 35431var SyntheticMouseEvent = SyntheticUIEvent.extend({ 35432 screenX: null, 35433 screenY: null, 35434 clientX: null, 35435 clientY: null, 35436 pageX: null, 35437 pageY: null, 35438 ctrlKey: null, 35439 shiftKey: null, 35440 altKey: null, 35441 metaKey: null, 35442 getModifierState: getEventModifierState, 35443 button: null, 35444 buttons: null, 35445 relatedTarget: function (event) { 35446 return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement); 35447 }, 35448 movementX: function (event) { 35449 if ('movementX' in event) { 35450 return event.movementX; 35451 } 35452 35453 var screenX = previousScreenX; 35454 previousScreenX = event.screenX; 35455 35456 if (!isMovementXSet) { 35457 isMovementXSet = true; 35458 return 0; 35459 } 35460 35461 return event.type === 'mousemove' ? event.screenX - screenX : 0; 35462 }, 35463 movementY: function (event) { 35464 if ('movementY' in event) { 35465 return event.movementY; 35466 } 35467 35468 var screenY = previousScreenY; 35469 previousScreenY = event.screenY; 35470 35471 if (!isMovementYSet) { 35472 isMovementYSet = true; 35473 return 0; 35474 } 35475 35476 return event.type === 'mousemove' ? event.screenY - screenY : 0; 35477 } 35478}); 35479 35480/** 35481 * @interface PointerEvent 35482 * @see http://www.w3.org/TR/pointerevents/ 35483 */ 35484 35485var SyntheticPointerEvent = SyntheticMouseEvent.extend({ 35486 pointerId: null, 35487 width: null, 35488 height: null, 35489 pressure: null, 35490 tangentialPressure: null, 35491 tiltX: null, 35492 tiltY: null, 35493 twist: null, 35494 pointerType: null, 35495 isPrimary: null 35496}); 35497 35498var eventTypes$2 = { 35499 mouseEnter: { 35500 registrationName: 'onMouseEnter', 35501 dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER] 35502 }, 35503 mouseLeave: { 35504 registrationName: 'onMouseLeave', 35505 dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER] 35506 }, 35507 pointerEnter: { 35508 registrationName: 'onPointerEnter', 35509 dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER] 35510 }, 35511 pointerLeave: { 35512 registrationName: 'onPointerLeave', 35513 dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER] 35514 } 35515}; 35516var EnterLeaveEventPlugin = { 35517 eventTypes: eventTypes$2, 35518 35519 /** 35520 * For almost every interaction we care about, there will be both a top-level 35521 * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that 35522 * we do not extract duplicate events. However, moving the mouse into the 35523 * browser from outside will not fire a `mouseout` event. In this case, we use 35524 * the `mouseover` top-level event. 35525 */ 35526 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) { 35527 var isOverEvent = topLevelType === TOP_MOUSE_OVER || topLevelType === TOP_POINTER_OVER; 35528 var isOutEvent = topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_POINTER_OUT; 35529 35530 if (isOverEvent && (eventSystemFlags & IS_REPLAYED) === 0 && (nativeEvent.relatedTarget || nativeEvent.fromElement)) { 35531 // If this is an over event with a target, then we've already dispatched 35532 // the event in the out event of the other target. If this is replayed, 35533 // then it's because we couldn't dispatch against this target previously 35534 // so we have to do it now instead. 35535 return null; 35536 } 35537 35538 if (!isOutEvent && !isOverEvent) { 35539 // Must not be a mouse or pointer in or out - ignoring. 35540 return null; 35541 } 35542 35543 var win; 35544 35545 if (nativeEventTarget.window === nativeEventTarget) { 35546 // `nativeEventTarget` is probably a window object. 35547 win = nativeEventTarget; 35548 } else { 35549 // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. 35550 var doc = nativeEventTarget.ownerDocument; 35551 35552 if (doc) { 35553 win = doc.defaultView || doc.parentWindow; 35554 } else { 35555 win = window; 35556 } 35557 } 35558 35559 var from; 35560 var to; 35561 35562 if (isOutEvent) { 35563 from = targetInst; 35564 var related = nativeEvent.relatedTarget || nativeEvent.toElement; 35565 to = related ? getClosestInstanceFromNode(related) : null; 35566 35567 if (to !== null) { 35568 var nearestMounted = getNearestMountedFiber(to); 35569 35570 if (to !== nearestMounted || to.tag !== HostComponent && to.tag !== HostText) { 35571 to = null; 35572 } 35573 } 35574 } else { 35575 // Moving to a node from outside the window. 35576 from = null; 35577 to = targetInst; 35578 } 35579 35580 if (from === to) { 35581 // Nothing pertains to our managed components. 35582 return null; 35583 } 35584 35585 var eventInterface, leaveEventType, enterEventType, eventTypePrefix; 35586 35587 if (topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_MOUSE_OVER) { 35588 eventInterface = SyntheticMouseEvent; 35589 leaveEventType = eventTypes$2.mouseLeave; 35590 enterEventType = eventTypes$2.mouseEnter; 35591 eventTypePrefix = 'mouse'; 35592 } else if (topLevelType === TOP_POINTER_OUT || topLevelType === TOP_POINTER_OVER) { 35593 eventInterface = SyntheticPointerEvent; 35594 leaveEventType = eventTypes$2.pointerLeave; 35595 enterEventType = eventTypes$2.pointerEnter; 35596 eventTypePrefix = 'pointer'; 35597 } 35598 35599 var fromNode = from == null ? win : getNodeFromInstance$1(from); 35600 var toNode = to == null ? win : getNodeFromInstance$1(to); 35601 var leave = eventInterface.getPooled(leaveEventType, from, nativeEvent, nativeEventTarget); 35602 leave.type = eventTypePrefix + 'leave'; 35603 leave.target = fromNode; 35604 leave.relatedTarget = toNode; 35605 var enter = eventInterface.getPooled(enterEventType, to, nativeEvent, nativeEventTarget); 35606 enter.type = eventTypePrefix + 'enter'; 35607 enter.target = toNode; 35608 enter.relatedTarget = fromNode; 35609 accumulateEnterLeaveDispatches(leave, enter, from, to); // If we are not processing the first ancestor, then we 35610 // should not process the same nativeEvent again, as we 35611 // will have already processed it in the first ancestor. 35612 35613 if ((eventSystemFlags & IS_FIRST_ANCESTOR) === 0) { 35614 return [leave]; 35615 } 35616 35617 return [leave, enter]; 35618 } 35619}; 35620 35621/** 35622 * inlined Object.is polyfill to avoid requiring consumers ship their own 35623 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is 35624 */ 35625function is(x, y) { 35626 return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare 35627 ; 35628} 35629 35630var objectIs = typeof Object.is === 'function' ? Object.is : is; 35631 35632var hasOwnProperty$2 = Object.prototype.hasOwnProperty; 35633/** 35634 * Performs equality by iterating through keys on an object and returning false 35635 * when any key has values which are not strictly equal between the arguments. 35636 * Returns true when the values of all keys are strictly equal. 35637 */ 35638 35639function shallowEqual(objA, objB) { 35640 if (objectIs(objA, objB)) { 35641 return true; 35642 } 35643 35644 if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { 35645 return false; 35646 } 35647 35648 var keysA = Object.keys(objA); 35649 var keysB = Object.keys(objB); 35650 35651 if (keysA.length !== keysB.length) { 35652 return false; 35653 } // Test for A's keys different from B. 35654 35655 35656 for (var i = 0; i < keysA.length; i++) { 35657 if (!hasOwnProperty$2.call(objB, keysA[i]) || !objectIs(objA[keysA[i]], objB[keysA[i]])) { 35658 return false; 35659 } 35660 } 35661 35662 return true; 35663} 35664 35665var skipSelectionChangeEvent = canUseDOM && 'documentMode' in document && document.documentMode <= 11; 35666var eventTypes$3 = { 35667 select: { 35668 phasedRegistrationNames: { 35669 bubbled: 'onSelect', 35670 captured: 'onSelectCapture' 35671 }, 35672 dependencies: [TOP_BLUR, TOP_CONTEXT_MENU, TOP_DRAG_END, TOP_FOCUS, TOP_KEY_DOWN, TOP_KEY_UP, TOP_MOUSE_DOWN, TOP_MOUSE_UP, TOP_SELECTION_CHANGE] 35673 } 35674}; 35675var activeElement$1 = null; 35676var activeElementInst$1 = null; 35677var lastSelection = null; 35678var mouseDown = false; 35679/** 35680 * Get an object which is a unique representation of the current selection. 35681 * 35682 * The return value will not be consistent across nodes or browsers, but 35683 * two identical selections on the same node will return identical objects. 35684 * 35685 * @param {DOMElement} node 35686 * @return {object} 35687 */ 35688 35689function getSelection$1(node) { 35690 if ('selectionStart' in node && hasSelectionCapabilities(node)) { 35691 return { 35692 start: node.selectionStart, 35693 end: node.selectionEnd 35694 }; 35695 } else { 35696 var win = node.ownerDocument && node.ownerDocument.defaultView || window; 35697 var selection = win.getSelection(); 35698 return { 35699 anchorNode: selection.anchorNode, 35700 anchorOffset: selection.anchorOffset, 35701 focusNode: selection.focusNode, 35702 focusOffset: selection.focusOffset 35703 }; 35704 } 35705} 35706/** 35707 * Get document associated with the event target. 35708 * 35709 * @param {object} nativeEventTarget 35710 * @return {Document} 35711 */ 35712 35713 35714function getEventTargetDocument(eventTarget) { 35715 return eventTarget.window === eventTarget ? eventTarget.document : eventTarget.nodeType === DOCUMENT_NODE ? eventTarget : eventTarget.ownerDocument; 35716} 35717/** 35718 * Poll selection to see whether it's changed. 35719 * 35720 * @param {object} nativeEvent 35721 * @param {object} nativeEventTarget 35722 * @return {?SyntheticEvent} 35723 */ 35724 35725 35726function constructSelectEvent(nativeEvent, nativeEventTarget) { 35727 // Ensure we have the right element, and that the user is not dragging a 35728 // selection (this matches native `select` event behavior). In HTML5, select 35729 // fires only on input and textarea thus if there's no focused element we 35730 // won't dispatch. 35731 var doc = getEventTargetDocument(nativeEventTarget); 35732 35733 if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement(doc)) { 35734 return null; 35735 } // Only fire when selection has actually changed. 35736 35737 35738 var currentSelection = getSelection$1(activeElement$1); 35739 35740 if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { 35741 lastSelection = currentSelection; 35742 var syntheticEvent = SyntheticEvent.getPooled(eventTypes$3.select, activeElementInst$1, nativeEvent, nativeEventTarget); 35743 syntheticEvent.type = 'select'; 35744 syntheticEvent.target = activeElement$1; 35745 accumulateTwoPhaseDispatches(syntheticEvent); 35746 return syntheticEvent; 35747 } 35748 35749 return null; 35750} 35751/** 35752 * This plugin creates an `onSelect` event that normalizes select events 35753 * across form elements. 35754 * 35755 * Supported elements are: 35756 * - input (see `isTextInputElement`) 35757 * - textarea 35758 * - contentEditable 35759 * 35760 * This differs from native browser implementations in the following ways: 35761 * - Fires on contentEditable fields as well as inputs. 35762 * - Fires for collapsed selection. 35763 * - Fires after user input. 35764 */ 35765 35766 35767var SelectEventPlugin = { 35768 eventTypes: eventTypes$3, 35769 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, container) { 35770 var containerOrDoc = container || getEventTargetDocument(nativeEventTarget); // Track whether all listeners exists for this plugin. If none exist, we do 35771 // not extract events. See #3639. 35772 35773 if (!containerOrDoc || !isListeningToAllDependencies('onSelect', containerOrDoc)) { 35774 return null; 35775 } 35776 35777 var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window; 35778 35779 switch (topLevelType) { 35780 // Track the input node that has focus. 35781 case TOP_FOCUS: 35782 if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') { 35783 activeElement$1 = targetNode; 35784 activeElementInst$1 = targetInst; 35785 lastSelection = null; 35786 } 35787 35788 break; 35789 35790 case TOP_BLUR: 35791 activeElement$1 = null; 35792 activeElementInst$1 = null; 35793 lastSelection = null; 35794 break; 35795 // Don't fire the event while the user is dragging. This matches the 35796 // semantics of the native select event. 35797 35798 case TOP_MOUSE_DOWN: 35799 mouseDown = true; 35800 break; 35801 35802 case TOP_CONTEXT_MENU: 35803 case TOP_MOUSE_UP: 35804 case TOP_DRAG_END: 35805 mouseDown = false; 35806 return constructSelectEvent(nativeEvent, nativeEventTarget); 35807 // Chrome and IE fire non-standard event when selection is changed (and 35808 // sometimes when it hasn't). IE's event fires out of order with respect 35809 // to key and input events on deletion, so we discard it. 35810 // 35811 // Firefox doesn't support selectionchange, so check selection status 35812 // after each key entry. The selection changes after keydown and before 35813 // keyup, but we check on keydown as well in the case of holding down a 35814 // key, when multiple keydown events are fired but only one keyup is. 35815 // This is also our approach for IE handling, for the reason above. 35816 35817 case TOP_SELECTION_CHANGE: 35818 if (skipSelectionChangeEvent) { 35819 break; 35820 } 35821 35822 // falls through 35823 35824 case TOP_KEY_DOWN: 35825 case TOP_KEY_UP: 35826 return constructSelectEvent(nativeEvent, nativeEventTarget); 35827 } 35828 35829 return null; 35830 } 35831}; 35832 35833/** 35834 * @interface Event 35835 * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface 35836 * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent 35837 */ 35838 35839var SyntheticAnimationEvent = SyntheticEvent.extend({ 35840 animationName: null, 35841 elapsedTime: null, 35842 pseudoElement: null 35843}); 35844 35845/** 35846 * @interface Event 35847 * @see http://www.w3.org/TR/clipboard-apis/ 35848 */ 35849 35850var SyntheticClipboardEvent = SyntheticEvent.extend({ 35851 clipboardData: function (event) { 35852 return 'clipboardData' in event ? event.clipboardData : window.clipboardData; 35853 } 35854}); 35855 35856/** 35857 * @interface FocusEvent 35858 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 35859 */ 35860 35861var SyntheticFocusEvent = SyntheticUIEvent.extend({ 35862 relatedTarget: null 35863}); 35864 35865/** 35866 * `charCode` represents the actual "character code" and is safe to use with 35867 * `String.fromCharCode`. As such, only keys that correspond to printable 35868 * characters produce a valid `charCode`, the only exception to this is Enter. 35869 * The Tab-key is considered non-printable and does not have a `charCode`, 35870 * presumably because it does not produce a tab-character in browsers. 35871 * 35872 * @param {object} nativeEvent Native browser event. 35873 * @return {number} Normalized `charCode` property. 35874 */ 35875function getEventCharCode(nativeEvent) { 35876 var charCode; 35877 var keyCode = nativeEvent.keyCode; 35878 35879 if ('charCode' in nativeEvent) { 35880 charCode = nativeEvent.charCode; // FF does not set `charCode` for the Enter-key, check against `keyCode`. 35881 35882 if (charCode === 0 && keyCode === 13) { 35883 charCode = 13; 35884 } 35885 } else { 35886 // IE8 does not implement `charCode`, but `keyCode` has the correct value. 35887 charCode = keyCode; 35888 } // IE and Edge (on Windows) and Chrome / Safari (on Windows and Linux) 35889 // report Enter as charCode 10 when ctrl is pressed. 35890 35891 35892 if (charCode === 10) { 35893 charCode = 13; 35894 } // Some non-printable keys are reported in `charCode`/`keyCode`, discard them. 35895 // Must not discard the (non-)printable Enter-key. 35896 35897 35898 if (charCode >= 32 || charCode === 13) { 35899 return charCode; 35900 } 35901 35902 return 0; 35903} 35904 35905/** 35906 * Normalization of deprecated HTML5 `key` values 35907 * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names 35908 */ 35909 35910var normalizeKey = { 35911 Esc: 'Escape', 35912 Spacebar: ' ', 35913 Left: 'ArrowLeft', 35914 Up: 'ArrowUp', 35915 Right: 'ArrowRight', 35916 Down: 'ArrowDown', 35917 Del: 'Delete', 35918 Win: 'OS', 35919 Menu: 'ContextMenu', 35920 Apps: 'ContextMenu', 35921 Scroll: 'ScrollLock', 35922 MozPrintableKey: 'Unidentified' 35923}; 35924/** 35925 * Translation from legacy `keyCode` to HTML5 `key` 35926 * Only special keys supported, all others depend on keyboard layout or browser 35927 * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names 35928 */ 35929 35930var translateToKey = { 35931 '8': 'Backspace', 35932 '9': 'Tab', 35933 '12': 'Clear', 35934 '13': 'Enter', 35935 '16': 'Shift', 35936 '17': 'Control', 35937 '18': 'Alt', 35938 '19': 'Pause', 35939 '20': 'CapsLock', 35940 '27': 'Escape', 35941 '32': ' ', 35942 '33': 'PageUp', 35943 '34': 'PageDown', 35944 '35': 'End', 35945 '36': 'Home', 35946 '37': 'ArrowLeft', 35947 '38': 'ArrowUp', 35948 '39': 'ArrowRight', 35949 '40': 'ArrowDown', 35950 '45': 'Insert', 35951 '46': 'Delete', 35952 '112': 'F1', 35953 '113': 'F2', 35954 '114': 'F3', 35955 '115': 'F4', 35956 '116': 'F5', 35957 '117': 'F6', 35958 '118': 'F7', 35959 '119': 'F8', 35960 '120': 'F9', 35961 '121': 'F10', 35962 '122': 'F11', 35963 '123': 'F12', 35964 '144': 'NumLock', 35965 '145': 'ScrollLock', 35966 '224': 'Meta' 35967}; 35968/** 35969 * @param {object} nativeEvent Native browser event. 35970 * @return {string} Normalized `key` property. 35971 */ 35972 35973function getEventKey(nativeEvent) { 35974 if (nativeEvent.key) { 35975 // Normalize inconsistent values reported by browsers due to 35976 // implementations of a working draft specification. 35977 // FireFox implements `key` but returns `MozPrintableKey` for all 35978 // printable characters (normalized to `Unidentified`), ignore it. 35979 var key = normalizeKey[nativeEvent.key] || nativeEvent.key; 35980 35981 if (key !== 'Unidentified') { 35982 return key; 35983 } 35984 } // Browser does not implement `key`, polyfill as much of it as we can. 35985 35986 35987 if (nativeEvent.type === 'keypress') { 35988 var charCode = getEventCharCode(nativeEvent); // The enter-key is technically both printable and non-printable and can 35989 // thus be captured by `keypress`, no other non-printable key should. 35990 35991 return charCode === 13 ? 'Enter' : String.fromCharCode(charCode); 35992 } 35993 35994 if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') { 35995 // While user keyboard layout determines the actual meaning of each 35996 // `keyCode` value, almost all function keys have a universal value. 35997 return translateToKey[nativeEvent.keyCode] || 'Unidentified'; 35998 } 35999 36000 return ''; 36001} 36002 36003/** 36004 * @interface KeyboardEvent 36005 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 36006 */ 36007 36008var SyntheticKeyboardEvent = SyntheticUIEvent.extend({ 36009 key: getEventKey, 36010 location: null, 36011 ctrlKey: null, 36012 shiftKey: null, 36013 altKey: null, 36014 metaKey: null, 36015 repeat: null, 36016 locale: null, 36017 getModifierState: getEventModifierState, 36018 // Legacy Interface 36019 charCode: function (event) { 36020 // `charCode` is the result of a KeyPress event and represents the value of 36021 // the actual printable character. 36022 // KeyPress is deprecated, but its replacement is not yet final and not 36023 // implemented in any major browser. Only KeyPress has charCode. 36024 if (event.type === 'keypress') { 36025 return getEventCharCode(event); 36026 } 36027 36028 return 0; 36029 }, 36030 keyCode: function (event) { 36031 // `keyCode` is the result of a KeyDown/Up event and represents the value of 36032 // physical keyboard key. 36033 // The actual meaning of the value depends on the users' keyboard layout 36034 // which cannot be detected. Assuming that it is a US keyboard layout 36035 // provides a surprisingly accurate mapping for US and European users. 36036 // Due to this, it is left to the user to implement at this time. 36037 if (event.type === 'keydown' || event.type === 'keyup') { 36038 return event.keyCode; 36039 } 36040 36041 return 0; 36042 }, 36043 which: function (event) { 36044 // `which` is an alias for either `keyCode` or `charCode` depending on the 36045 // type of the event. 36046 if (event.type === 'keypress') { 36047 return getEventCharCode(event); 36048 } 36049 36050 if (event.type === 'keydown' || event.type === 'keyup') { 36051 return event.keyCode; 36052 } 36053 36054 return 0; 36055 } 36056}); 36057 36058/** 36059 * @interface DragEvent 36060 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 36061 */ 36062 36063var SyntheticDragEvent = SyntheticMouseEvent.extend({ 36064 dataTransfer: null 36065}); 36066 36067/** 36068 * @interface TouchEvent 36069 * @see http://www.w3.org/TR/touch-events/ 36070 */ 36071 36072var SyntheticTouchEvent = SyntheticUIEvent.extend({ 36073 touches: null, 36074 targetTouches: null, 36075 changedTouches: null, 36076 altKey: null, 36077 metaKey: null, 36078 ctrlKey: null, 36079 shiftKey: null, 36080 getModifierState: getEventModifierState 36081}); 36082 36083/** 36084 * @interface Event 36085 * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events- 36086 * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent 36087 */ 36088 36089var SyntheticTransitionEvent = SyntheticEvent.extend({ 36090 propertyName: null, 36091 elapsedTime: null, 36092 pseudoElement: null 36093}); 36094 36095/** 36096 * @interface WheelEvent 36097 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 36098 */ 36099 36100var SyntheticWheelEvent = SyntheticMouseEvent.extend({ 36101 deltaX: function (event) { 36102 return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive). 36103 'wheelDeltaX' in event ? -event.wheelDeltaX : 0; 36104 }, 36105 deltaY: function (event) { 36106 return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive). 36107 'wheelDeltaY' in event ? -event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive). 36108 'wheelDelta' in event ? -event.wheelDelta : 0; 36109 }, 36110 deltaZ: null, 36111 // Browsers without "deltaMode" is reporting in raw wheel delta where one 36112 // notch on the scroll is always +/- 120, roughly equivalent to pixels. 36113 // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or 36114 // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size. 36115 deltaMode: null 36116}); 36117 36118var knownHTMLTopLevelTypes = [TOP_ABORT, TOP_CANCEL, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_CLOSE, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_INPUT, TOP_INVALID, TOP_LOAD, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_RESET, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUBMIT, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_TOGGLE, TOP_VOLUME_CHANGE, TOP_WAITING]; 36119var SimpleEventPlugin = { 36120 // simpleEventPluginEventTypes gets populated from 36121 // the DOMEventProperties module. 36122 eventTypes: simpleEventPluginEventTypes, 36123 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) { 36124 var dispatchConfig = topLevelEventsToDispatchConfig.get(topLevelType); 36125 36126 if (!dispatchConfig) { 36127 return null; 36128 } 36129 36130 var EventConstructor; 36131 36132 switch (topLevelType) { 36133 case TOP_KEY_PRESS: 36134 // Firefox creates a keypress event for function keys too. This removes 36135 // the unwanted keypress events. Enter is however both printable and 36136 // non-printable. One would expect Tab to be as well (but it isn't). 36137 if (getEventCharCode(nativeEvent) === 0) { 36138 return null; 36139 } 36140 36141 /* falls through */ 36142 36143 case TOP_KEY_DOWN: 36144 case TOP_KEY_UP: 36145 EventConstructor = SyntheticKeyboardEvent; 36146 break; 36147 36148 case TOP_BLUR: 36149 case TOP_FOCUS: 36150 EventConstructor = SyntheticFocusEvent; 36151 break; 36152 36153 case TOP_CLICK: 36154 // Firefox creates a click event on right mouse clicks. This removes the 36155 // unwanted click events. 36156 if (nativeEvent.button === 2) { 36157 return null; 36158 } 36159 36160 /* falls through */ 36161 36162 case TOP_AUX_CLICK: 36163 case TOP_DOUBLE_CLICK: 36164 case TOP_MOUSE_DOWN: 36165 case TOP_MOUSE_MOVE: 36166 case TOP_MOUSE_UP: // TODO: Disabled elements should not respond to mouse events 36167 36168 /* falls through */ 36169 36170 case TOP_MOUSE_OUT: 36171 case TOP_MOUSE_OVER: 36172 case TOP_CONTEXT_MENU: 36173 EventConstructor = SyntheticMouseEvent; 36174 break; 36175 36176 case TOP_DRAG: 36177 case TOP_DRAG_END: 36178 case TOP_DRAG_ENTER: 36179 case TOP_DRAG_EXIT: 36180 case TOP_DRAG_LEAVE: 36181 case TOP_DRAG_OVER: 36182 case TOP_DRAG_START: 36183 case TOP_DROP: 36184 EventConstructor = SyntheticDragEvent; 36185 break; 36186 36187 case TOP_TOUCH_CANCEL: 36188 case TOP_TOUCH_END: 36189 case TOP_TOUCH_MOVE: 36190 case TOP_TOUCH_START: 36191 EventConstructor = SyntheticTouchEvent; 36192 break; 36193 36194 case TOP_ANIMATION_END: 36195 case TOP_ANIMATION_ITERATION: 36196 case TOP_ANIMATION_START: 36197 EventConstructor = SyntheticAnimationEvent; 36198 break; 36199 36200 case TOP_TRANSITION_END: 36201 EventConstructor = SyntheticTransitionEvent; 36202 break; 36203 36204 case TOP_SCROLL: 36205 EventConstructor = SyntheticUIEvent; 36206 break; 36207 36208 case TOP_WHEEL: 36209 EventConstructor = SyntheticWheelEvent; 36210 break; 36211 36212 case TOP_COPY: 36213 case TOP_CUT: 36214 case TOP_PASTE: 36215 EventConstructor = SyntheticClipboardEvent; 36216 break; 36217 36218 case TOP_GOT_POINTER_CAPTURE: 36219 case TOP_LOST_POINTER_CAPTURE: 36220 case TOP_POINTER_CANCEL: 36221 case TOP_POINTER_DOWN: 36222 case TOP_POINTER_MOVE: 36223 case TOP_POINTER_OUT: 36224 case TOP_POINTER_OVER: 36225 case TOP_POINTER_UP: 36226 EventConstructor = SyntheticPointerEvent; 36227 break; 36228 36229 default: 36230 { 36231 if (knownHTMLTopLevelTypes.indexOf(topLevelType) === -1) { 36232 error('SimpleEventPlugin: Unhandled event type, `%s`. This warning ' + 'is likely caused by a bug in React. Please file an issue.', topLevelType); 36233 } 36234 } // HTML Events 36235 // @see http://www.w3.org/TR/html5/index.html#events-0 36236 36237 36238 EventConstructor = SyntheticEvent; 36239 break; 36240 } 36241 36242 var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget); 36243 accumulateTwoPhaseDispatches(event); 36244 return event; 36245 } 36246}; 36247 36248/** 36249 * Specifies a deterministic ordering of `EventPlugin`s. A convenient way to 36250 * reason about plugins, without having to package every one of them. This 36251 * is better than having plugins be ordered in the same order that they 36252 * are injected because that ordering would be influenced by the packaging order. 36253 * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that 36254 * preventing default on events is convenient in `SimpleEventPlugin` handlers. 36255 */ 36256 36257var DOMEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin']; 36258/** 36259 * Inject modules for resolving DOM hierarchy and plugin ordering. 36260 */ 36261 36262injectEventPluginOrder(DOMEventPluginOrder); 36263setComponentTree(getFiberCurrentPropsFromNode$1, getInstanceFromNode$1, getNodeFromInstance$1); 36264/** 36265 * Some important event plugins included by default (without having to require 36266 * them). 36267 */ 36268 36269injectEventPluginsByName({ 36270 SimpleEventPlugin: SimpleEventPlugin, 36271 EnterLeaveEventPlugin: EnterLeaveEventPlugin, 36272 ChangeEventPlugin: ChangeEventPlugin, 36273 SelectEventPlugin: SelectEventPlugin, 36274 BeforeInputEventPlugin: BeforeInputEventPlugin 36275}); 36276 36277// Prefix measurements so that it's possible to filter them. 36278// Longer prefixes are hard to read in DevTools. 36279var reactEmoji = "\u269B"; 36280var warningEmoji = "\u26D4"; 36281var supportsUserTiming = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function'; // Keep track of current fiber so that we know the path to unwind on pause. 36282// TODO: this looks the same as nextUnitOfWork in scheduler. Can we unify them? 36283 36284var currentFiber = null; // If we're in the middle of user code, which fiber and method is it? 36285// Reusing `currentFiber` would be confusing for this because user code fiber 36286// can change during commit phase too, but we don't need to unwind it (since 36287// lifecycles in the commit phase don't resemble a tree). 36288 36289var currentPhase = null; 36290var currentPhaseFiber = null; // Did lifecycle hook schedule an update? This is often a performance problem, 36291// so we will keep track of it, and include it in the report. 36292// Track commits caused by cascading updates. 36293 36294var isCommitting = false; 36295var hasScheduledUpdateInCurrentCommit = false; 36296var hasScheduledUpdateInCurrentPhase = false; 36297var commitCountInCurrentWorkLoop = 0; 36298var effectCountInCurrentCommit = 0; 36299// to avoid stretch the commit phase with measurement overhead. 36300 36301var labelsInCurrentCommit = new Set(); 36302 36303var formatMarkName = function (markName) { 36304 return reactEmoji + " " + markName; 36305}; 36306 36307var formatLabel = function (label, warning) { 36308 var prefix = warning ? warningEmoji + " " : reactEmoji + " "; 36309 var suffix = warning ? " Warning: " + warning : ''; 36310 return "" + prefix + label + suffix; 36311}; 36312 36313var beginMark = function (markName) { 36314 performance.mark(formatMarkName(markName)); 36315}; 36316 36317var clearMark = function (markName) { 36318 performance.clearMarks(formatMarkName(markName)); 36319}; 36320 36321var endMark = function (label, markName, warning) { 36322 var formattedMarkName = formatMarkName(markName); 36323 var formattedLabel = formatLabel(label, warning); 36324 36325 try { 36326 performance.measure(formattedLabel, formattedMarkName); 36327 } catch (err) {} // If previous mark was missing for some reason, this will throw. 36328 // This could only happen if React crashed in an unexpected place earlier. 36329 // Don't pile on with more errors. 36330 // Clear marks immediately to avoid growing buffer. 36331 36332 36333 performance.clearMarks(formattedMarkName); 36334 performance.clearMeasures(formattedLabel); 36335}; 36336 36337var getFiberMarkName = function (label, debugID) { 36338 return label + " (#" + debugID + ")"; 36339}; 36340 36341var getFiberLabel = function (componentName, isMounted, phase) { 36342 if (phase === null) { 36343 // These are composite component total time measurements. 36344 return componentName + " [" + (isMounted ? 'update' : 'mount') + "]"; 36345 } else { 36346 // Composite component methods. 36347 return componentName + "." + phase; 36348 } 36349}; 36350 36351var beginFiberMark = function (fiber, phase) { 36352 var componentName = getComponentName(fiber.type) || 'Unknown'; 36353 var debugID = fiber._debugID; 36354 var isMounted = fiber.alternate !== null; 36355 var label = getFiberLabel(componentName, isMounted, phase); 36356 36357 if (isCommitting && labelsInCurrentCommit.has(label)) { 36358 // During the commit phase, we don't show duplicate labels because 36359 // there is a fixed overhead for every measurement, and we don't 36360 // want to stretch the commit phase beyond necessary. 36361 return false; 36362 } 36363 36364 labelsInCurrentCommit.add(label); 36365 var markName = getFiberMarkName(label, debugID); 36366 beginMark(markName); 36367 return true; 36368}; 36369 36370var clearFiberMark = function (fiber, phase) { 36371 var componentName = getComponentName(fiber.type) || 'Unknown'; 36372 var debugID = fiber._debugID; 36373 var isMounted = fiber.alternate !== null; 36374 var label = getFiberLabel(componentName, isMounted, phase); 36375 var markName = getFiberMarkName(label, debugID); 36376 clearMark(markName); 36377}; 36378 36379var endFiberMark = function (fiber, phase, warning) { 36380 var componentName = getComponentName(fiber.type) || 'Unknown'; 36381 var debugID = fiber._debugID; 36382 var isMounted = fiber.alternate !== null; 36383 var label = getFiberLabel(componentName, isMounted, phase); 36384 var markName = getFiberMarkName(label, debugID); 36385 endMark(label, markName, warning); 36386}; 36387 36388var shouldIgnoreFiber = function (fiber) { 36389 // Host components should be skipped in the timeline. 36390 // We could check typeof fiber.type, but does this work with RN? 36391 switch (fiber.tag) { 36392 case HostRoot: 36393 case HostComponent: 36394 case HostText: 36395 case HostPortal: 36396 case Fragment: 36397 case ContextProvider: 36398 case ContextConsumer: 36399 case Mode: 36400 return true; 36401 36402 default: 36403 return false; 36404 } 36405}; 36406 36407var clearPendingPhaseMeasurement = function () { 36408 if (currentPhase !== null && currentPhaseFiber !== null) { 36409 clearFiberMark(currentPhaseFiber, currentPhase); 36410 } 36411 36412 currentPhaseFiber = null; 36413 currentPhase = null; 36414 hasScheduledUpdateInCurrentPhase = false; 36415}; 36416 36417var pauseTimers = function () { 36418 // Stops all currently active measurements so that they can be resumed 36419 // if we continue in a later deferred loop from the same unit of work. 36420 var fiber = currentFiber; 36421 36422 while (fiber) { 36423 if (fiber._debugIsCurrentlyTiming) { 36424 endFiberMark(fiber, null, null); 36425 } 36426 36427 fiber = fiber.return; 36428 } 36429}; 36430 36431var resumeTimersRecursively = function (fiber) { 36432 if (fiber.return !== null) { 36433 resumeTimersRecursively(fiber.return); 36434 } 36435 36436 if (fiber._debugIsCurrentlyTiming) { 36437 beginFiberMark(fiber, null); 36438 } 36439}; 36440 36441var resumeTimers = function () { 36442 // Resumes all measurements that were active during the last deferred loop. 36443 if (currentFiber !== null) { 36444 resumeTimersRecursively(currentFiber); 36445 } 36446}; 36447 36448function recordEffect() { 36449 { 36450 effectCountInCurrentCommit++; 36451 } 36452} 36453function recordScheduleUpdate() { 36454 { 36455 if (isCommitting) { 36456 hasScheduledUpdateInCurrentCommit = true; 36457 } 36458 36459 if (currentPhase !== null && currentPhase !== 'componentWillMount' && currentPhase !== 'componentWillReceiveProps') { 36460 hasScheduledUpdateInCurrentPhase = true; 36461 } 36462 } 36463} 36464function startWorkTimer(fiber) { 36465 { 36466 if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { 36467 return; 36468 } // If we pause, this is the fiber to unwind from. 36469 36470 36471 currentFiber = fiber; 36472 36473 if (!beginFiberMark(fiber, null)) { 36474 return; 36475 } 36476 36477 fiber._debugIsCurrentlyTiming = true; 36478 } 36479} 36480function cancelWorkTimer(fiber) { 36481 { 36482 if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { 36483 return; 36484 } // Remember we shouldn't complete measurement for this fiber. 36485 // Otherwise flamechart will be deep even for small updates. 36486 36487 36488 fiber._debugIsCurrentlyTiming = false; 36489 clearFiberMark(fiber, null); 36490 } 36491} 36492function stopWorkTimer(fiber) { 36493 { 36494 if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { 36495 return; 36496 } // If we pause, its parent is the fiber to unwind from. 36497 36498 36499 currentFiber = fiber.return; 36500 36501 if (!fiber._debugIsCurrentlyTiming) { 36502 return; 36503 } 36504 36505 fiber._debugIsCurrentlyTiming = false; 36506 endFiberMark(fiber, null, null); 36507 } 36508} 36509function stopFailedWorkTimer(fiber) { 36510 { 36511 if (!supportsUserTiming || shouldIgnoreFiber(fiber)) { 36512 return; 36513 } // If we pause, its parent is the fiber to unwind from. 36514 36515 36516 currentFiber = fiber.return; 36517 36518 if (!fiber._debugIsCurrentlyTiming) { 36519 return; 36520 } 36521 36522 fiber._debugIsCurrentlyTiming = false; 36523 var warning = fiber.tag === SuspenseComponent ? 'Rendering was suspended' : 'An error was thrown inside this error boundary'; 36524 endFiberMark(fiber, null, warning); 36525 } 36526} 36527function startPhaseTimer(fiber, phase) { 36528 { 36529 if (!supportsUserTiming) { 36530 return; 36531 } 36532 36533 clearPendingPhaseMeasurement(); 36534 36535 if (!beginFiberMark(fiber, phase)) { 36536 return; 36537 } 36538 36539 currentPhaseFiber = fiber; 36540 currentPhase = phase; 36541 } 36542} 36543function stopPhaseTimer() { 36544 { 36545 if (!supportsUserTiming) { 36546 return; 36547 } 36548 36549 if (currentPhase !== null && currentPhaseFiber !== null) { 36550 var warning = hasScheduledUpdateInCurrentPhase ? 'Scheduled a cascading update' : null; 36551 endFiberMark(currentPhaseFiber, currentPhase, warning); 36552 } 36553 36554 currentPhase = null; 36555 currentPhaseFiber = null; 36556 } 36557} 36558function startWorkLoopTimer(nextUnitOfWork) { 36559 { 36560 currentFiber = nextUnitOfWork; 36561 36562 if (!supportsUserTiming) { 36563 return; 36564 } 36565 36566 commitCountInCurrentWorkLoop = 0; // This is top level call. 36567 // Any other measurements are performed within. 36568 36569 beginMark('(React Tree Reconciliation)'); // Resume any measurements that were in progress during the last loop. 36570 36571 resumeTimers(); 36572 } 36573} 36574function stopWorkLoopTimer(interruptedBy, didCompleteRoot) { 36575 { 36576 if (!supportsUserTiming) { 36577 return; 36578 } 36579 36580 var warning = null; 36581 36582 if (interruptedBy !== null) { 36583 if (interruptedBy.tag === HostRoot) { 36584 warning = 'A top-level update interrupted the previous render'; 36585 } else { 36586 var componentName = getComponentName(interruptedBy.type) || 'Unknown'; 36587 warning = "An update to " + componentName + " interrupted the previous render"; 36588 } 36589 } else if (commitCountInCurrentWorkLoop > 1) { 36590 warning = 'There were cascading updates'; 36591 } 36592 36593 commitCountInCurrentWorkLoop = 0; 36594 var label = didCompleteRoot ? '(React Tree Reconciliation: Completed Root)' : '(React Tree Reconciliation: Yielded)'; // Pause any measurements until the next loop. 36595 36596 pauseTimers(); 36597 endMark(label, '(React Tree Reconciliation)', warning); 36598 } 36599} 36600function startCommitTimer() { 36601 { 36602 if (!supportsUserTiming) { 36603 return; 36604 } 36605 36606 isCommitting = true; 36607 hasScheduledUpdateInCurrentCommit = false; 36608 labelsInCurrentCommit.clear(); 36609 beginMark('(Committing Changes)'); 36610 } 36611} 36612function stopCommitTimer() { 36613 { 36614 if (!supportsUserTiming) { 36615 return; 36616 } 36617 36618 var warning = null; 36619 36620 if (hasScheduledUpdateInCurrentCommit) { 36621 warning = 'Lifecycle hook scheduled a cascading update'; 36622 } else if (commitCountInCurrentWorkLoop > 0) { 36623 warning = 'Caused by a cascading update in earlier commit'; 36624 } 36625 36626 hasScheduledUpdateInCurrentCommit = false; 36627 commitCountInCurrentWorkLoop++; 36628 isCommitting = false; 36629 labelsInCurrentCommit.clear(); 36630 endMark('(Committing Changes)', '(Committing Changes)', warning); 36631 } 36632} 36633function startCommitSnapshotEffectsTimer() { 36634 { 36635 if (!supportsUserTiming) { 36636 return; 36637 } 36638 36639 effectCountInCurrentCommit = 0; 36640 beginMark('(Committing Snapshot Effects)'); 36641 } 36642} 36643function stopCommitSnapshotEffectsTimer() { 36644 { 36645 if (!supportsUserTiming) { 36646 return; 36647 } 36648 36649 var count = effectCountInCurrentCommit; 36650 effectCountInCurrentCommit = 0; 36651 endMark("(Committing Snapshot Effects: " + count + " Total)", '(Committing Snapshot Effects)', null); 36652 } 36653} 36654function startCommitHostEffectsTimer() { 36655 { 36656 if (!supportsUserTiming) { 36657 return; 36658 } 36659 36660 effectCountInCurrentCommit = 0; 36661 beginMark('(Committing Host Effects)'); 36662 } 36663} 36664function stopCommitHostEffectsTimer() { 36665 { 36666 if (!supportsUserTiming) { 36667 return; 36668 } 36669 36670 var count = effectCountInCurrentCommit; 36671 effectCountInCurrentCommit = 0; 36672 endMark("(Committing Host Effects: " + count + " Total)", '(Committing Host Effects)', null); 36673 } 36674} 36675function startCommitLifeCyclesTimer() { 36676 { 36677 if (!supportsUserTiming) { 36678 return; 36679 } 36680 36681 effectCountInCurrentCommit = 0; 36682 beginMark('(Calling Lifecycle Methods)'); 36683 } 36684} 36685function stopCommitLifeCyclesTimer() { 36686 { 36687 if (!supportsUserTiming) { 36688 return; 36689 } 36690 36691 var count = effectCountInCurrentCommit; 36692 effectCountInCurrentCommit = 0; 36693 endMark("(Calling Lifecycle Methods: " + count + " Total)", '(Calling Lifecycle Methods)', null); 36694 } 36695} 36696 36697var valueStack = []; 36698var fiberStack; 36699 36700{ 36701 fiberStack = []; 36702} 36703 36704var index = -1; 36705 36706function createCursor(defaultValue) { 36707 return { 36708 current: defaultValue 36709 }; 36710} 36711 36712function pop(cursor, fiber) { 36713 if (index < 0) { 36714 { 36715 error('Unexpected pop.'); 36716 } 36717 36718 return; 36719 } 36720 36721 { 36722 if (fiber !== fiberStack[index]) { 36723 error('Unexpected Fiber popped.'); 36724 } 36725 } 36726 36727 cursor.current = valueStack[index]; 36728 valueStack[index] = null; 36729 36730 { 36731 fiberStack[index] = null; 36732 } 36733 36734 index--; 36735} 36736 36737function push(cursor, value, fiber) { 36738 index++; 36739 valueStack[index] = cursor.current; 36740 36741 { 36742 fiberStack[index] = fiber; 36743 } 36744 36745 cursor.current = value; 36746} 36747 36748var warnedAboutMissingGetChildContext; 36749 36750{ 36751 warnedAboutMissingGetChildContext = {}; 36752} 36753 36754var emptyContextObject = {}; 36755 36756{ 36757 Object.freeze(emptyContextObject); 36758} // A cursor to the current merged context object on the stack. 36759 36760 36761var contextStackCursor = createCursor(emptyContextObject); // A cursor to a boolean indicating whether the context has changed. 36762 36763var didPerformWorkStackCursor = createCursor(false); // Keep track of the previous context object that was on the stack. 36764// We use this to get access to the parent context after we have already 36765// pushed the next context provider, and now need to merge their contexts. 36766 36767var previousContext = emptyContextObject; 36768 36769function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) { 36770 { 36771 if (didPushOwnContextIfProvider && isContextProvider(Component)) { 36772 // If the fiber is a context provider itself, when we read its context 36773 // we may have already pushed its own child context on the stack. A context 36774 // provider should not "see" its own child context. Therefore we read the 36775 // previous (parent) context instead for a context provider. 36776 return previousContext; 36777 } 36778 36779 return contextStackCursor.current; 36780 } 36781} 36782 36783function cacheContext(workInProgress, unmaskedContext, maskedContext) { 36784 { 36785 var instance = workInProgress.stateNode; 36786 instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext; 36787 instance.__reactInternalMemoizedMaskedChildContext = maskedContext; 36788 } 36789} 36790 36791function getMaskedContext(workInProgress, unmaskedContext) { 36792 { 36793 var type = workInProgress.type; 36794 var contextTypes = type.contextTypes; 36795 36796 if (!contextTypes) { 36797 return emptyContextObject; 36798 } // Avoid recreating masked context unless unmasked context has changed. 36799 // Failing to do this will result in unnecessary calls to componentWillReceiveProps. 36800 // This may trigger infinite loops if componentWillReceiveProps calls setState. 36801 36802 36803 var instance = workInProgress.stateNode; 36804 36805 if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) { 36806 return instance.__reactInternalMemoizedMaskedChildContext; 36807 } 36808 36809 var context = {}; 36810 36811 for (var key in contextTypes) { 36812 context[key] = unmaskedContext[key]; 36813 } 36814 36815 { 36816 var name = getComponentName(type) || 'Unknown'; 36817 checkPropTypes(contextTypes, context, 'context', name, getCurrentFiberStackInDev); 36818 } // Cache unmasked context so we can avoid recreating masked context unless necessary. 36819 // Context is created before the class component is instantiated so check for instance. 36820 36821 36822 if (instance) { 36823 cacheContext(workInProgress, unmaskedContext, context); 36824 } 36825 36826 return context; 36827 } 36828} 36829 36830function hasContextChanged() { 36831 { 36832 return didPerformWorkStackCursor.current; 36833 } 36834} 36835 36836function isContextProvider(type) { 36837 { 36838 var childContextTypes = type.childContextTypes; 36839 return childContextTypes !== null && childContextTypes !== undefined; 36840 } 36841} 36842 36843function popContext(fiber) { 36844 { 36845 pop(didPerformWorkStackCursor, fiber); 36846 pop(contextStackCursor, fiber); 36847 } 36848} 36849 36850function popTopLevelContextObject(fiber) { 36851 { 36852 pop(didPerformWorkStackCursor, fiber); 36853 pop(contextStackCursor, fiber); 36854 } 36855} 36856 36857function pushTopLevelContextObject(fiber, context, didChange) { 36858 { 36859 if (!(contextStackCursor.current === emptyContextObject)) { 36860 { 36861 throw Error( "Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue." ); 36862 } 36863 } 36864 36865 push(contextStackCursor, context, fiber); 36866 push(didPerformWorkStackCursor, didChange, fiber); 36867 } 36868} 36869 36870function processChildContext(fiber, type, parentContext) { 36871 { 36872 var instance = fiber.stateNode; 36873 var childContextTypes = type.childContextTypes; // TODO (bvaughn) Replace this behavior with an invariant() in the future. 36874 // It has only been added in Fiber to match the (unintentional) behavior in Stack. 36875 36876 if (typeof instance.getChildContext !== 'function') { 36877 { 36878 var componentName = getComponentName(type) || 'Unknown'; 36879 36880 if (!warnedAboutMissingGetChildContext[componentName]) { 36881 warnedAboutMissingGetChildContext[componentName] = true; 36882 36883 error('%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName); 36884 } 36885 } 36886 36887 return parentContext; 36888 } 36889 36890 var childContext; 36891 startPhaseTimer(fiber, 'getChildContext'); 36892 childContext = instance.getChildContext(); 36893 stopPhaseTimer(); 36894 36895 for (var contextKey in childContext) { 36896 if (!(contextKey in childContextTypes)) { 36897 { 36898 throw Error( (getComponentName(type) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes." ); 36899 } 36900 } 36901 } 36902 36903 { 36904 var name = getComponentName(type) || 'Unknown'; 36905 checkPropTypes(childContextTypes, childContext, 'child context', name, // In practice, there is one case in which we won't get a stack. It's when 36906 // somebody calls unstable_renderSubtreeIntoContainer() and we process 36907 // context from the parent component instance. The stack will be missing 36908 // because it's outside of the reconciliation, and so the pointer has not 36909 // been set. This is rare and doesn't matter. We'll also remove that API. 36910 getCurrentFiberStackInDev); 36911 } 36912 36913 return _assign({}, parentContext, {}, childContext); 36914 } 36915} 36916 36917function pushContextProvider(workInProgress) { 36918 { 36919 var instance = workInProgress.stateNode; // We push the context as early as possible to ensure stack integrity. 36920 // If the instance does not exist yet, we will push null at first, 36921 // and replace it on the stack later when invalidating the context. 36922 36923 var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject; // Remember the parent context so we can merge with it later. 36924 // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates. 36925 36926 previousContext = contextStackCursor.current; 36927 push(contextStackCursor, memoizedMergedChildContext, workInProgress); 36928 push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress); 36929 return true; 36930 } 36931} 36932 36933function invalidateContextProvider(workInProgress, type, didChange) { 36934 { 36935 var instance = workInProgress.stateNode; 36936 36937 if (!instance) { 36938 { 36939 throw Error( "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." ); 36940 } 36941 } 36942 36943 if (didChange) { 36944 // Merge parent and own context. 36945 // Skip this if we're not updating due to sCU. 36946 // This avoids unnecessarily recomputing memoized values. 36947 var mergedContext = processChildContext(workInProgress, type, previousContext); 36948 instance.__reactInternalMemoizedMergedChildContext = mergedContext; // Replace the old (or empty) context with the new one. 36949 // It is important to unwind the context in the reverse order. 36950 36951 pop(didPerformWorkStackCursor, workInProgress); 36952 pop(contextStackCursor, workInProgress); // Now push the new context and mark that it has changed. 36953 36954 push(contextStackCursor, mergedContext, workInProgress); 36955 push(didPerformWorkStackCursor, didChange, workInProgress); 36956 } else { 36957 pop(didPerformWorkStackCursor, workInProgress); 36958 push(didPerformWorkStackCursor, didChange, workInProgress); 36959 } 36960 } 36961} 36962 36963function findCurrentUnmaskedContext(fiber) { 36964 { 36965 // Currently this is only used with renderSubtreeIntoContainer; not sure if it 36966 // makes sense elsewhere 36967 if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) { 36968 { 36969 throw Error( "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." ); 36970 } 36971 } 36972 36973 var node = fiber; 36974 36975 do { 36976 switch (node.tag) { 36977 case HostRoot: 36978 return node.stateNode.context; 36979 36980 case ClassComponent: 36981 { 36982 var Component = node.type; 36983 36984 if (isContextProvider(Component)) { 36985 return node.stateNode.__reactInternalMemoizedMergedChildContext; 36986 } 36987 36988 break; 36989 } 36990 } 36991 36992 node = node.return; 36993 } while (node !== null); 36994 36995 { 36996 { 36997 throw Error( "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." ); 36998 } 36999 } 37000 } 37001} 37002 37003var LegacyRoot = 0; 37004var BlockingRoot = 1; 37005var ConcurrentRoot = 2; 37006 37007var Scheduler_runWithPriority = Scheduler.unstable_runWithPriority, 37008 Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback, 37009 Scheduler_cancelCallback = Scheduler.unstable_cancelCallback, 37010 Scheduler_shouldYield = Scheduler.unstable_shouldYield, 37011 Scheduler_requestPaint = Scheduler.unstable_requestPaint, 37012 Scheduler_now = Scheduler.unstable_now, 37013 Scheduler_getCurrentPriorityLevel = Scheduler.unstable_getCurrentPriorityLevel, 37014 Scheduler_ImmediatePriority = Scheduler.unstable_ImmediatePriority, 37015 Scheduler_UserBlockingPriority = Scheduler.unstable_UserBlockingPriority, 37016 Scheduler_NormalPriority = Scheduler.unstable_NormalPriority, 37017 Scheduler_LowPriority = Scheduler.unstable_LowPriority, 37018 Scheduler_IdlePriority = Scheduler.unstable_IdlePriority; 37019 37020{ 37021 // Provide explicit error message when production+profiling bundle of e.g. 37022 // react-dom is used with production (non-profiling) bundle of 37023 // scheduler/tracing 37024 if (!(tracing.__interactionsRef != null && tracing.__interactionsRef.current != null)) { 37025 { 37026 throw Error( "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling" ); 37027 } 37028 } 37029} 37030 37031var fakeCallbackNode = {}; // Except for NoPriority, these correspond to Scheduler priorities. We use 37032// ascending numbers so we can compare them like numbers. They start at 90 to 37033// avoid clashing with Scheduler's priorities. 37034 37035var ImmediatePriority = 99; 37036var UserBlockingPriority$1 = 98; 37037var NormalPriority = 97; 37038var LowPriority = 96; 37039var IdlePriority = 95; // NoPriority is the absence of priority. Also React-only. 37040 37041var NoPriority = 90; 37042var shouldYield = Scheduler_shouldYield; 37043var requestPaint = // Fall back gracefully if we're running an older version of Scheduler. 37044Scheduler_requestPaint !== undefined ? Scheduler_requestPaint : function () {}; 37045var syncQueue = null; 37046var immediateQueueCallbackNode = null; 37047var isFlushingSyncQueue = false; 37048var initialTimeMs = Scheduler_now(); // If the initial timestamp is reasonably small, use Scheduler's `now` directly. 37049// This will be the case for modern browsers that support `performance.now`. In 37050// older browsers, Scheduler falls back to `Date.now`, which returns a Unix 37051// timestamp. In that case, subtract the module initialization time to simulate 37052// the behavior of performance.now and keep our times small enough to fit 37053// within 32 bits. 37054// TODO: Consider lifting this into Scheduler. 37055 37056var now = initialTimeMs < 10000 ? Scheduler_now : function () { 37057 return Scheduler_now() - initialTimeMs; 37058}; 37059function getCurrentPriorityLevel() { 37060 switch (Scheduler_getCurrentPriorityLevel()) { 37061 case Scheduler_ImmediatePriority: 37062 return ImmediatePriority; 37063 37064 case Scheduler_UserBlockingPriority: 37065 return UserBlockingPriority$1; 37066 37067 case Scheduler_NormalPriority: 37068 return NormalPriority; 37069 37070 case Scheduler_LowPriority: 37071 return LowPriority; 37072 37073 case Scheduler_IdlePriority: 37074 return IdlePriority; 37075 37076 default: 37077 { 37078 { 37079 throw Error( "Unknown priority level." ); 37080 } 37081 } 37082 37083 } 37084} 37085 37086function reactPriorityToSchedulerPriority(reactPriorityLevel) { 37087 switch (reactPriorityLevel) { 37088 case ImmediatePriority: 37089 return Scheduler_ImmediatePriority; 37090 37091 case UserBlockingPriority$1: 37092 return Scheduler_UserBlockingPriority; 37093 37094 case NormalPriority: 37095 return Scheduler_NormalPriority; 37096 37097 case LowPriority: 37098 return Scheduler_LowPriority; 37099 37100 case IdlePriority: 37101 return Scheduler_IdlePriority; 37102 37103 default: 37104 { 37105 { 37106 throw Error( "Unknown priority level." ); 37107 } 37108 } 37109 37110 } 37111} 37112 37113function runWithPriority$1(reactPriorityLevel, fn) { 37114 var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); 37115 return Scheduler_runWithPriority(priorityLevel, fn); 37116} 37117function scheduleCallback(reactPriorityLevel, callback, options) { 37118 var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); 37119 return Scheduler_scheduleCallback(priorityLevel, callback, options); 37120} 37121function scheduleSyncCallback(callback) { 37122 // Push this callback into an internal queue. We'll flush these either in 37123 // the next tick, or earlier if something calls `flushSyncCallbackQueue`. 37124 if (syncQueue === null) { 37125 syncQueue = [callback]; // Flush the queue in the next tick, at the earliest. 37126 37127 immediateQueueCallbackNode = Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueueImpl); 37128 } else { 37129 // Push onto existing queue. Don't need to schedule a callback because 37130 // we already scheduled one when we created the queue. 37131 syncQueue.push(callback); 37132 } 37133 37134 return fakeCallbackNode; 37135} 37136function cancelCallback(callbackNode) { 37137 if (callbackNode !== fakeCallbackNode) { 37138 Scheduler_cancelCallback(callbackNode); 37139 } 37140} 37141function flushSyncCallbackQueue() { 37142 if (immediateQueueCallbackNode !== null) { 37143 var node = immediateQueueCallbackNode; 37144 immediateQueueCallbackNode = null; 37145 Scheduler_cancelCallback(node); 37146 } 37147 37148 flushSyncCallbackQueueImpl(); 37149} 37150 37151function flushSyncCallbackQueueImpl() { 37152 if (!isFlushingSyncQueue && syncQueue !== null) { 37153 // Prevent re-entrancy. 37154 isFlushingSyncQueue = true; 37155 var i = 0; 37156 37157 try { 37158 var _isSync = true; 37159 var queue = syncQueue; 37160 runWithPriority$1(ImmediatePriority, function () { 37161 for (; i < queue.length; i++) { 37162 var callback = queue[i]; 37163 37164 do { 37165 callback = callback(_isSync); 37166 } while (callback !== null); 37167 } 37168 }); 37169 syncQueue = null; 37170 } catch (error) { 37171 // If something throws, leave the remaining callbacks on the queue. 37172 if (syncQueue !== null) { 37173 syncQueue = syncQueue.slice(i + 1); 37174 } // Resume flushing in the next tick 37175 37176 37177 Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueue); 37178 throw error; 37179 } finally { 37180 isFlushingSyncQueue = false; 37181 } 37182 } 37183} 37184 37185var NoMode = 0; 37186var StrictMode = 1; // TODO: Remove BlockingMode and ConcurrentMode by reading from the root 37187// tag instead 37188 37189var BlockingMode = 2; 37190var ConcurrentMode = 4; 37191var ProfileMode = 8; 37192 37193// Max 31 bit integer. The max integer size in V8 for 32-bit systems. 37194// Math.pow(2, 30) - 1 37195// 0b111111111111111111111111111111 37196var MAX_SIGNED_31_BIT_INT = 1073741823; 37197 37198var NoWork = 0; // TODO: Think of a better name for Never. The key difference with Idle is that 37199// Never work can be committed in an inconsistent state without tearing the UI. 37200// The main example is offscreen content, like a hidden subtree. So one possible 37201// name is Offscreen. However, it also includes dehydrated Suspense boundaries, 37202// which are inconsistent in the sense that they haven't finished yet, but 37203// aren't visibly inconsistent because the server rendered HTML matches what the 37204// hydrated tree would look like. 37205 37206var Never = 1; // Idle is slightly higher priority than Never. It must completely finish in 37207// order to be consistent. 37208 37209var Idle = 2; // Continuous Hydration is slightly higher than Idle and is used to increase 37210// priority of hover targets. 37211 37212var ContinuousHydration = 3; 37213var Sync = MAX_SIGNED_31_BIT_INT; 37214var Batched = Sync - 1; 37215var UNIT_SIZE = 10; 37216var MAGIC_NUMBER_OFFSET = Batched - 1; // 1 unit of expiration time represents 10ms. 37217 37218function msToExpirationTime(ms) { 37219 // Always subtract from the offset so that we don't clash with the magic number for NoWork. 37220 return MAGIC_NUMBER_OFFSET - (ms / UNIT_SIZE | 0); 37221} 37222function expirationTimeToMs(expirationTime) { 37223 return (MAGIC_NUMBER_OFFSET - expirationTime) * UNIT_SIZE; 37224} 37225 37226function ceiling(num, precision) { 37227 return ((num / precision | 0) + 1) * precision; 37228} 37229 37230function computeExpirationBucket(currentTime, expirationInMs, bucketSizeMs) { 37231 return MAGIC_NUMBER_OFFSET - ceiling(MAGIC_NUMBER_OFFSET - currentTime + expirationInMs / UNIT_SIZE, bucketSizeMs / UNIT_SIZE); 37232} // TODO: This corresponds to Scheduler's NormalPriority, not LowPriority. Update 37233// the names to reflect. 37234 37235 37236var LOW_PRIORITY_EXPIRATION = 5000; 37237var LOW_PRIORITY_BATCH_SIZE = 250; 37238function computeAsyncExpiration(currentTime) { 37239 return computeExpirationBucket(currentTime, LOW_PRIORITY_EXPIRATION, LOW_PRIORITY_BATCH_SIZE); 37240} 37241function computeSuspenseExpiration(currentTime, timeoutMs) { 37242 // TODO: Should we warn if timeoutMs is lower than the normal pri expiration time? 37243 return computeExpirationBucket(currentTime, timeoutMs, LOW_PRIORITY_BATCH_SIZE); 37244} // We intentionally set a higher expiration time for interactive updates in 37245// dev than in production. 37246// 37247// If the main thread is being blocked so long that you hit the expiration, 37248// it's a problem that could be solved with better scheduling. 37249// 37250// People will be more likely to notice this and fix it with the long 37251// expiration time in development. 37252// 37253// In production we opt for better UX at the risk of masking scheduling 37254// problems, by expiring fast. 37255 37256var HIGH_PRIORITY_EXPIRATION = 500 ; 37257var HIGH_PRIORITY_BATCH_SIZE = 100; 37258function computeInteractiveExpiration(currentTime) { 37259 return computeExpirationBucket(currentTime, HIGH_PRIORITY_EXPIRATION, HIGH_PRIORITY_BATCH_SIZE); 37260} 37261function inferPriorityFromExpirationTime(currentTime, expirationTime) { 37262 if (expirationTime === Sync) { 37263 return ImmediatePriority; 37264 } 37265 37266 if (expirationTime === Never || expirationTime === Idle) { 37267 return IdlePriority; 37268 } 37269 37270 var msUntil = expirationTimeToMs(expirationTime) - expirationTimeToMs(currentTime); 37271 37272 if (msUntil <= 0) { 37273 return ImmediatePriority; 37274 } 37275 37276 if (msUntil <= HIGH_PRIORITY_EXPIRATION + HIGH_PRIORITY_BATCH_SIZE) { 37277 return UserBlockingPriority$1; 37278 } 37279 37280 if (msUntil <= LOW_PRIORITY_EXPIRATION + LOW_PRIORITY_BATCH_SIZE) { 37281 return NormalPriority; 37282 } // TODO: Handle LowPriority 37283 // Assume anything lower has idle priority 37284 37285 37286 return IdlePriority; 37287} 37288 37289var ReactStrictModeWarnings = { 37290 recordUnsafeLifecycleWarnings: function (fiber, instance) {}, 37291 flushPendingUnsafeLifecycleWarnings: function () {}, 37292 recordLegacyContextWarning: function (fiber, instance) {}, 37293 flushLegacyContextWarning: function () {}, 37294 discardPendingWarnings: function () {} 37295}; 37296 37297{ 37298 var findStrictRoot = function (fiber) { 37299 var maybeStrictRoot = null; 37300 var node = fiber; 37301 37302 while (node !== null) { 37303 if (node.mode & StrictMode) { 37304 maybeStrictRoot = node; 37305 } 37306 37307 node = node.return; 37308 } 37309 37310 return maybeStrictRoot; 37311 }; 37312 37313 var setToSortedString = function (set) { 37314 var array = []; 37315 set.forEach(function (value) { 37316 array.push(value); 37317 }); 37318 return array.sort().join(', '); 37319 }; 37320 37321 var pendingComponentWillMountWarnings = []; 37322 var pendingUNSAFE_ComponentWillMountWarnings = []; 37323 var pendingComponentWillReceivePropsWarnings = []; 37324 var pendingUNSAFE_ComponentWillReceivePropsWarnings = []; 37325 var pendingComponentWillUpdateWarnings = []; 37326 var pendingUNSAFE_ComponentWillUpdateWarnings = []; // Tracks components we have already warned about. 37327 37328 var didWarnAboutUnsafeLifecycles = new Set(); 37329 37330 ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function (fiber, instance) { 37331 // Dedup strategy: Warn once per component. 37332 if (didWarnAboutUnsafeLifecycles.has(fiber.type)) { 37333 return; 37334 } 37335 37336 if (typeof instance.componentWillMount === 'function' && // Don't warn about react-lifecycles-compat polyfilled components. 37337 instance.componentWillMount.__suppressDeprecationWarning !== true) { 37338 pendingComponentWillMountWarnings.push(fiber); 37339 } 37340 37341 if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillMount === 'function') { 37342 pendingUNSAFE_ComponentWillMountWarnings.push(fiber); 37343 } 37344 37345 if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) { 37346 pendingComponentWillReceivePropsWarnings.push(fiber); 37347 } 37348 37349 if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillReceiveProps === 'function') { 37350 pendingUNSAFE_ComponentWillReceivePropsWarnings.push(fiber); 37351 } 37352 37353 if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) { 37354 pendingComponentWillUpdateWarnings.push(fiber); 37355 } 37356 37357 if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillUpdate === 'function') { 37358 pendingUNSAFE_ComponentWillUpdateWarnings.push(fiber); 37359 } 37360 }; 37361 37362 ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function () { 37363 // We do an initial pass to gather component names 37364 var componentWillMountUniqueNames = new Set(); 37365 37366 if (pendingComponentWillMountWarnings.length > 0) { 37367 pendingComponentWillMountWarnings.forEach(function (fiber) { 37368 componentWillMountUniqueNames.add(getComponentName(fiber.type) || 'Component'); 37369 didWarnAboutUnsafeLifecycles.add(fiber.type); 37370 }); 37371 pendingComponentWillMountWarnings = []; 37372 } 37373 37374 var UNSAFE_componentWillMountUniqueNames = new Set(); 37375 37376 if (pendingUNSAFE_ComponentWillMountWarnings.length > 0) { 37377 pendingUNSAFE_ComponentWillMountWarnings.forEach(function (fiber) { 37378 UNSAFE_componentWillMountUniqueNames.add(getComponentName(fiber.type) || 'Component'); 37379 didWarnAboutUnsafeLifecycles.add(fiber.type); 37380 }); 37381 pendingUNSAFE_ComponentWillMountWarnings = []; 37382 } 37383 37384 var componentWillReceivePropsUniqueNames = new Set(); 37385 37386 if (pendingComponentWillReceivePropsWarnings.length > 0) { 37387 pendingComponentWillReceivePropsWarnings.forEach(function (fiber) { 37388 componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || 'Component'); 37389 didWarnAboutUnsafeLifecycles.add(fiber.type); 37390 }); 37391 pendingComponentWillReceivePropsWarnings = []; 37392 } 37393 37394 var UNSAFE_componentWillReceivePropsUniqueNames = new Set(); 37395 37396 if (pendingUNSAFE_ComponentWillReceivePropsWarnings.length > 0) { 37397 pendingUNSAFE_ComponentWillReceivePropsWarnings.forEach(function (fiber) { 37398 UNSAFE_componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || 'Component'); 37399 didWarnAboutUnsafeLifecycles.add(fiber.type); 37400 }); 37401 pendingUNSAFE_ComponentWillReceivePropsWarnings = []; 37402 } 37403 37404 var componentWillUpdateUniqueNames = new Set(); 37405 37406 if (pendingComponentWillUpdateWarnings.length > 0) { 37407 pendingComponentWillUpdateWarnings.forEach(function (fiber) { 37408 componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || 'Component'); 37409 didWarnAboutUnsafeLifecycles.add(fiber.type); 37410 }); 37411 pendingComponentWillUpdateWarnings = []; 37412 } 37413 37414 var UNSAFE_componentWillUpdateUniqueNames = new Set(); 37415 37416 if (pendingUNSAFE_ComponentWillUpdateWarnings.length > 0) { 37417 pendingUNSAFE_ComponentWillUpdateWarnings.forEach(function (fiber) { 37418 UNSAFE_componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || 'Component'); 37419 didWarnAboutUnsafeLifecycles.add(fiber.type); 37420 }); 37421 pendingUNSAFE_ComponentWillUpdateWarnings = []; 37422 } // Finally, we flush all the warnings 37423 // UNSAFE_ ones before the deprecated ones, since they'll be 'louder' 37424 37425 37426 if (UNSAFE_componentWillMountUniqueNames.size > 0) { 37427 var sortedNames = setToSortedString(UNSAFE_componentWillMountUniqueNames); 37428 37429 error('Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '\nPlease update the following components: %s', sortedNames); 37430 } 37431 37432 if (UNSAFE_componentWillReceivePropsUniqueNames.size > 0) { 37433 var _sortedNames = setToSortedString(UNSAFE_componentWillReceivePropsUniqueNames); 37434 37435 error('Using UNSAFE_componentWillReceiveProps in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, " + 'refactor your code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' + '\nPlease update the following components: %s', _sortedNames); 37436 } 37437 37438 if (UNSAFE_componentWillUpdateUniqueNames.size > 0) { 37439 var _sortedNames2 = setToSortedString(UNSAFE_componentWillUpdateUniqueNames); 37440 37441 error('Using UNSAFE_componentWillUpdate in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '\nPlease update the following components: %s', _sortedNames2); 37442 } 37443 37444 if (componentWillMountUniqueNames.size > 0) { 37445 var _sortedNames3 = setToSortedString(componentWillMountUniqueNames); 37446 37447 warn('componentWillMount has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '* Rename componentWillMount to UNSAFE_componentWillMount to suppress ' + 'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames3); 37448 } 37449 37450 if (componentWillReceivePropsUniqueNames.size > 0) { 37451 var _sortedNames4 = setToSortedString(componentWillReceivePropsUniqueNames); 37452 37453 warn('componentWillReceiveProps has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, refactor your " + 'code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' + '* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress ' + 'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames4); 37454 } 37455 37456 if (componentWillUpdateUniqueNames.size > 0) { 37457 var _sortedNames5 = setToSortedString(componentWillUpdateUniqueNames); 37458 37459 warn('componentWillUpdate has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress ' + 'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames5); 37460 } 37461 }; 37462 37463 var pendingLegacyContextWarning = new Map(); // Tracks components we have already warned about. 37464 37465 var didWarnAboutLegacyContext = new Set(); 37466 37467 ReactStrictModeWarnings.recordLegacyContextWarning = function (fiber, instance) { 37468 var strictRoot = findStrictRoot(fiber); 37469 37470 if (strictRoot === null) { 37471 error('Expected to find a StrictMode component in a strict mode tree. ' + 'This error is likely caused by a bug in React. Please file an issue.'); 37472 37473 return; 37474 } // Dedup strategy: Warn once per component. 37475 37476 37477 if (didWarnAboutLegacyContext.has(fiber.type)) { 37478 return; 37479 } 37480 37481 var warningsForRoot = pendingLegacyContextWarning.get(strictRoot); 37482 37483 if (fiber.type.contextTypes != null || fiber.type.childContextTypes != null || instance !== null && typeof instance.getChildContext === 'function') { 37484 if (warningsForRoot === undefined) { 37485 warningsForRoot = []; 37486 pendingLegacyContextWarning.set(strictRoot, warningsForRoot); 37487 } 37488 37489 warningsForRoot.push(fiber); 37490 } 37491 }; 37492 37493 ReactStrictModeWarnings.flushLegacyContextWarning = function () { 37494 pendingLegacyContextWarning.forEach(function (fiberArray, strictRoot) { 37495 if (fiberArray.length === 0) { 37496 return; 37497 } 37498 37499 var firstFiber = fiberArray[0]; 37500 var uniqueNames = new Set(); 37501 fiberArray.forEach(function (fiber) { 37502 uniqueNames.add(getComponentName(fiber.type) || 'Component'); 37503 didWarnAboutLegacyContext.add(fiber.type); 37504 }); 37505 var sortedNames = setToSortedString(uniqueNames); 37506 var firstComponentStack = getStackByFiberInDevAndProd(firstFiber); 37507 37508 error('Legacy context API has been detected within a strict-mode tree.' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here: https://fb.me/react-legacy-context' + '%s', sortedNames, firstComponentStack); 37509 }); 37510 }; 37511 37512 ReactStrictModeWarnings.discardPendingWarnings = function () { 37513 pendingComponentWillMountWarnings = []; 37514 pendingUNSAFE_ComponentWillMountWarnings = []; 37515 pendingComponentWillReceivePropsWarnings = []; 37516 pendingUNSAFE_ComponentWillReceivePropsWarnings = []; 37517 pendingComponentWillUpdateWarnings = []; 37518 pendingUNSAFE_ComponentWillUpdateWarnings = []; 37519 pendingLegacyContextWarning = new Map(); 37520 }; 37521} 37522 37523var resolveFamily = null; // $FlowFixMe Flow gets confused by a WeakSet feature check below. 37524 37525var failedBoundaries = null; 37526var setRefreshHandler = function (handler) { 37527 { 37528 resolveFamily = handler; 37529 } 37530}; 37531function resolveFunctionForHotReloading(type) { 37532 { 37533 if (resolveFamily === null) { 37534 // Hot reloading is disabled. 37535 return type; 37536 } 37537 37538 var family = resolveFamily(type); 37539 37540 if (family === undefined) { 37541 return type; 37542 } // Use the latest known implementation. 37543 37544 37545 return family.current; 37546 } 37547} 37548function resolveClassForHotReloading(type) { 37549 // No implementation differences. 37550 return resolveFunctionForHotReloading(type); 37551} 37552function resolveForwardRefForHotReloading(type) { 37553 { 37554 if (resolveFamily === null) { 37555 // Hot reloading is disabled. 37556 return type; 37557 } 37558 37559 var family = resolveFamily(type); 37560 37561 if (family === undefined) { 37562 // Check if we're dealing with a real forwardRef. Don't want to crash early. 37563 if (type !== null && type !== undefined && typeof type.render === 'function') { 37564 // ForwardRef is special because its resolved .type is an object, 37565 // but it's possible that we only have its inner render function in the map. 37566 // If that inner render function is different, we'll build a new forwardRef type. 37567 var currentRender = resolveFunctionForHotReloading(type.render); 37568 37569 if (type.render !== currentRender) { 37570 var syntheticType = { 37571 $$typeof: REACT_FORWARD_REF_TYPE, 37572 render: currentRender 37573 }; 37574 37575 if (type.displayName !== undefined) { 37576 syntheticType.displayName = type.displayName; 37577 } 37578 37579 return syntheticType; 37580 } 37581 } 37582 37583 return type; 37584 } // Use the latest known implementation. 37585 37586 37587 return family.current; 37588 } 37589} 37590function isCompatibleFamilyForHotReloading(fiber, element) { 37591 { 37592 if (resolveFamily === null) { 37593 // Hot reloading is disabled. 37594 return false; 37595 } 37596 37597 var prevType = fiber.elementType; 37598 var nextType = element.type; // If we got here, we know types aren't === equal. 37599 37600 var needsCompareFamilies = false; 37601 var $$typeofNextType = typeof nextType === 'object' && nextType !== null ? nextType.$$typeof : null; 37602 37603 switch (fiber.tag) { 37604 case ClassComponent: 37605 { 37606 if (typeof nextType === 'function') { 37607 needsCompareFamilies = true; 37608 } 37609 37610 break; 37611 } 37612 37613 case FunctionComponent: 37614 { 37615 if (typeof nextType === 'function') { 37616 needsCompareFamilies = true; 37617 } else if ($$typeofNextType === REACT_LAZY_TYPE) { 37618 // We don't know the inner type yet. 37619 // We're going to assume that the lazy inner type is stable, 37620 // and so it is sufficient to avoid reconciling it away. 37621 // We're not going to unwrap or actually use the new lazy type. 37622 needsCompareFamilies = true; 37623 } 37624 37625 break; 37626 } 37627 37628 case ForwardRef: 37629 { 37630 if ($$typeofNextType === REACT_FORWARD_REF_TYPE) { 37631 needsCompareFamilies = true; 37632 } else if ($$typeofNextType === REACT_LAZY_TYPE) { 37633 needsCompareFamilies = true; 37634 } 37635 37636 break; 37637 } 37638 37639 case MemoComponent: 37640 case SimpleMemoComponent: 37641 { 37642 if ($$typeofNextType === REACT_MEMO_TYPE) { 37643 // TODO: if it was but can no longer be simple, 37644 // we shouldn't set this. 37645 needsCompareFamilies = true; 37646 } else if ($$typeofNextType === REACT_LAZY_TYPE) { 37647 needsCompareFamilies = true; 37648 } 37649 37650 break; 37651 } 37652 37653 default: 37654 return false; 37655 } // Check if both types have a family and it's the same one. 37656 37657 37658 if (needsCompareFamilies) { 37659 // Note: memo() and forwardRef() we'll compare outer rather than inner type. 37660 // This means both of them need to be registered to preserve state. 37661 // If we unwrapped and compared the inner types for wrappers instead, 37662 // then we would risk falsely saying two separate memo(Foo) 37663 // calls are equivalent because they wrap the same Foo function. 37664 var prevFamily = resolveFamily(prevType); 37665 37666 if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) { 37667 return true; 37668 } 37669 } 37670 37671 return false; 37672 } 37673} 37674function markFailedErrorBoundaryForHotReloading(fiber) { 37675 { 37676 if (resolveFamily === null) { 37677 // Hot reloading is disabled. 37678 return; 37679 } 37680 37681 if (typeof WeakSet !== 'function') { 37682 return; 37683 } 37684 37685 if (failedBoundaries === null) { 37686 failedBoundaries = new WeakSet(); 37687 } 37688 37689 failedBoundaries.add(fiber); 37690 } 37691} 37692var scheduleRefresh = function (root, update) { 37693 { 37694 if (resolveFamily === null) { 37695 // Hot reloading is disabled. 37696 return; 37697 } 37698 37699 var staleFamilies = update.staleFamilies, 37700 updatedFamilies = update.updatedFamilies; 37701 flushPassiveEffects(); 37702 flushSync(function () { 37703 scheduleFibersWithFamiliesRecursively(root.current, updatedFamilies, staleFamilies); 37704 }); 37705 } 37706}; 37707var scheduleRoot = function (root, element) { 37708 { 37709 if (root.context !== emptyContextObject) { 37710 // Super edge case: root has a legacy _renderSubtree context 37711 // but we don't know the parentComponent so we can't pass it. 37712 // Just ignore. We'll delete this with _renderSubtree code path later. 37713 return; 37714 } 37715 37716 flushPassiveEffects(); 37717 syncUpdates(function () { 37718 updateContainer(element, root, null, null); 37719 }); 37720 } 37721}; 37722 37723function scheduleFibersWithFamiliesRecursively(fiber, updatedFamilies, staleFamilies) { 37724 { 37725 var alternate = fiber.alternate, 37726 child = fiber.child, 37727 sibling = fiber.sibling, 37728 tag = fiber.tag, 37729 type = fiber.type; 37730 var candidateType = null; 37731 37732 switch (tag) { 37733 case FunctionComponent: 37734 case SimpleMemoComponent: 37735 case ClassComponent: 37736 candidateType = type; 37737 break; 37738 37739 case ForwardRef: 37740 candidateType = type.render; 37741 break; 37742 } 37743 37744 if (resolveFamily === null) { 37745 throw new Error('Expected resolveFamily to be set during hot reload.'); 37746 } 37747 37748 var needsRender = false; 37749 var needsRemount = false; 37750 37751 if (candidateType !== null) { 37752 var family = resolveFamily(candidateType); 37753 37754 if (family !== undefined) { 37755 if (staleFamilies.has(family)) { 37756 needsRemount = true; 37757 } else if (updatedFamilies.has(family)) { 37758 if (tag === ClassComponent) { 37759 needsRemount = true; 37760 } else { 37761 needsRender = true; 37762 } 37763 } 37764 } 37765 } 37766 37767 if (failedBoundaries !== null) { 37768 if (failedBoundaries.has(fiber) || alternate !== null && failedBoundaries.has(alternate)) { 37769 needsRemount = true; 37770 } 37771 } 37772 37773 if (needsRemount) { 37774 fiber._debugNeedsRemount = true; 37775 } 37776 37777 if (needsRemount || needsRender) { 37778 scheduleWork(fiber, Sync); 37779 } 37780 37781 if (child !== null && !needsRemount) { 37782 scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies); 37783 } 37784 37785 if (sibling !== null) { 37786 scheduleFibersWithFamiliesRecursively(sibling, updatedFamilies, staleFamilies); 37787 } 37788 } 37789} 37790 37791var findHostInstancesForRefresh = function (root, families) { 37792 { 37793 var hostInstances = new Set(); 37794 var types = new Set(families.map(function (family) { 37795 return family.current; 37796 })); 37797 findHostInstancesForMatchingFibersRecursively(root.current, types, hostInstances); 37798 return hostInstances; 37799 } 37800}; 37801 37802function findHostInstancesForMatchingFibersRecursively(fiber, types, hostInstances) { 37803 { 37804 var child = fiber.child, 37805 sibling = fiber.sibling, 37806 tag = fiber.tag, 37807 type = fiber.type; 37808 var candidateType = null; 37809 37810 switch (tag) { 37811 case FunctionComponent: 37812 case SimpleMemoComponent: 37813 case ClassComponent: 37814 candidateType = type; 37815 break; 37816 37817 case ForwardRef: 37818 candidateType = type.render; 37819 break; 37820 } 37821 37822 var didMatch = false; 37823 37824 if (candidateType !== null) { 37825 if (types.has(candidateType)) { 37826 didMatch = true; 37827 } 37828 } 37829 37830 if (didMatch) { 37831 // We have a match. This only drills down to the closest host components. 37832 // There's no need to search deeper because for the purpose of giving 37833 // visual feedback, "flashing" outermost parent rectangles is sufficient. 37834 findHostInstancesForFiberShallowly(fiber, hostInstances); 37835 } else { 37836 // If there's no match, maybe there will be one further down in the child tree. 37837 if (child !== null) { 37838 findHostInstancesForMatchingFibersRecursively(child, types, hostInstances); 37839 } 37840 } 37841 37842 if (sibling !== null) { 37843 findHostInstancesForMatchingFibersRecursively(sibling, types, hostInstances); 37844 } 37845 } 37846} 37847 37848function findHostInstancesForFiberShallowly(fiber, hostInstances) { 37849 { 37850 var foundHostInstances = findChildHostInstancesForFiberShallowly(fiber, hostInstances); 37851 37852 if (foundHostInstances) { 37853 return; 37854 } // If we didn't find any host children, fallback to closest host parent. 37855 37856 37857 var node = fiber; 37858 37859 while (true) { 37860 switch (node.tag) { 37861 case HostComponent: 37862 hostInstances.add(node.stateNode); 37863 return; 37864 37865 case HostPortal: 37866 hostInstances.add(node.stateNode.containerInfo); 37867 return; 37868 37869 case HostRoot: 37870 hostInstances.add(node.stateNode.containerInfo); 37871 return; 37872 } 37873 37874 if (node.return === null) { 37875 throw new Error('Expected to reach root first.'); 37876 } 37877 37878 node = node.return; 37879 } 37880 } 37881} 37882 37883function findChildHostInstancesForFiberShallowly(fiber, hostInstances) { 37884 { 37885 var node = fiber; 37886 var foundHostInstances = false; 37887 37888 while (true) { 37889 if (node.tag === HostComponent) { 37890 // We got a match. 37891 foundHostInstances = true; 37892 hostInstances.add(node.stateNode); // There may still be more, so keep searching. 37893 } else if (node.child !== null) { 37894 node.child.return = node; 37895 node = node.child; 37896 continue; 37897 } 37898 37899 if (node === fiber) { 37900 return foundHostInstances; 37901 } 37902 37903 while (node.sibling === null) { 37904 if (node.return === null || node.return === fiber) { 37905 return foundHostInstances; 37906 } 37907 37908 node = node.return; 37909 } 37910 37911 node.sibling.return = node.return; 37912 node = node.sibling; 37913 } 37914 } 37915 37916 return false; 37917} 37918 37919function resolveDefaultProps(Component, baseProps) { 37920 if (Component && Component.defaultProps) { 37921 // Resolve default props. Taken from ReactElement 37922 var props = _assign({}, baseProps); 37923 37924 var defaultProps = Component.defaultProps; 37925 37926 for (var propName in defaultProps) { 37927 if (props[propName] === undefined) { 37928 props[propName] = defaultProps[propName]; 37929 } 37930 } 37931 37932 return props; 37933 } 37934 37935 return baseProps; 37936} 37937function readLazyComponentType(lazyComponent) { 37938 initializeLazyComponentType(lazyComponent); 37939 37940 if (lazyComponent._status !== Resolved) { 37941 throw lazyComponent._result; 37942 } 37943 37944 return lazyComponent._result; 37945} 37946 37947var valueCursor = createCursor(null); 37948var rendererSigil; 37949 37950{ 37951 // Use this to detect multiple renderers using the same context 37952 rendererSigil = {}; 37953} 37954 37955var currentlyRenderingFiber = null; 37956var lastContextDependency = null; 37957var lastContextWithAllBitsObserved = null; 37958var isDisallowedContextReadInDEV = false; 37959function resetContextDependencies() { 37960 // This is called right before React yields execution, to ensure `readContext` 37961 // cannot be called outside the render phase. 37962 currentlyRenderingFiber = null; 37963 lastContextDependency = null; 37964 lastContextWithAllBitsObserved = null; 37965 37966 { 37967 isDisallowedContextReadInDEV = false; 37968 } 37969} 37970function enterDisallowedContextReadInDEV() { 37971 { 37972 isDisallowedContextReadInDEV = true; 37973 } 37974} 37975function exitDisallowedContextReadInDEV() { 37976 { 37977 isDisallowedContextReadInDEV = false; 37978 } 37979} 37980function pushProvider(providerFiber, nextValue) { 37981 var context = providerFiber.type._context; 37982 37983 { 37984 push(valueCursor, context._currentValue, providerFiber); 37985 context._currentValue = nextValue; 37986 37987 { 37988 if (context._currentRenderer !== undefined && context._currentRenderer !== null && context._currentRenderer !== rendererSigil) { 37989 error('Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.'); 37990 } 37991 37992 context._currentRenderer = rendererSigil; 37993 } 37994 } 37995} 37996function popProvider(providerFiber) { 37997 var currentValue = valueCursor.current; 37998 pop(valueCursor, providerFiber); 37999 var context = providerFiber.type._context; 38000 38001 { 38002 context._currentValue = currentValue; 38003 } 38004} 38005function calculateChangedBits(context, newValue, oldValue) { 38006 if (objectIs(oldValue, newValue)) { 38007 // No change 38008 return 0; 38009 } else { 38010 var changedBits = typeof context._calculateChangedBits === 'function' ? context._calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT; 38011 38012 { 38013 if ((changedBits & MAX_SIGNED_31_BIT_INT) !== changedBits) { 38014 error('calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits); 38015 } 38016 } 38017 38018 return changedBits | 0; 38019 } 38020} 38021function scheduleWorkOnParentPath(parent, renderExpirationTime) { 38022 // Update the child expiration time of all the ancestors, including 38023 // the alternates. 38024 var node = parent; 38025 38026 while (node !== null) { 38027 var alternate = node.alternate; 38028 38029 if (node.childExpirationTime < renderExpirationTime) { 38030 node.childExpirationTime = renderExpirationTime; 38031 38032 if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) { 38033 alternate.childExpirationTime = renderExpirationTime; 38034 } 38035 } else if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) { 38036 alternate.childExpirationTime = renderExpirationTime; 38037 } else { 38038 // Neither alternate was updated, which means the rest of the 38039 // ancestor path already has sufficient priority. 38040 break; 38041 } 38042 38043 node = node.return; 38044 } 38045} 38046function propagateContextChange(workInProgress, context, changedBits, renderExpirationTime) { 38047 var fiber = workInProgress.child; 38048 38049 if (fiber !== null) { 38050 // Set the return pointer of the child to the work-in-progress fiber. 38051 fiber.return = workInProgress; 38052 } 38053 38054 while (fiber !== null) { 38055 var nextFiber = void 0; // Visit this fiber. 38056 38057 var list = fiber.dependencies; 38058 38059 if (list !== null) { 38060 nextFiber = fiber.child; 38061 var dependency = list.firstContext; 38062 38063 while (dependency !== null) { 38064 // Check if the context matches. 38065 if (dependency.context === context && (dependency.observedBits & changedBits) !== 0) { 38066 // Match! Schedule an update on this fiber. 38067 if (fiber.tag === ClassComponent) { 38068 // Schedule a force update on the work-in-progress. 38069 var update = createUpdate(renderExpirationTime, null); 38070 update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the 38071 // update to the current fiber, too, which means it will persist even if 38072 // this render is thrown away. Since it's a race condition, not sure it's 38073 // worth fixing. 38074 38075 enqueueUpdate(fiber, update); 38076 } 38077 38078 if (fiber.expirationTime < renderExpirationTime) { 38079 fiber.expirationTime = renderExpirationTime; 38080 } 38081 38082 var alternate = fiber.alternate; 38083 38084 if (alternate !== null && alternate.expirationTime < renderExpirationTime) { 38085 alternate.expirationTime = renderExpirationTime; 38086 } 38087 38088 scheduleWorkOnParentPath(fiber.return, renderExpirationTime); // Mark the expiration time on the list, too. 38089 38090 if (list.expirationTime < renderExpirationTime) { 38091 list.expirationTime = renderExpirationTime; 38092 } // Since we already found a match, we can stop traversing the 38093 // dependency list. 38094 38095 38096 break; 38097 } 38098 38099 dependency = dependency.next; 38100 } 38101 } else if (fiber.tag === ContextProvider) { 38102 // Don't scan deeper if this is a matching provider 38103 nextFiber = fiber.type === workInProgress.type ? null : fiber.child; 38104 } else { 38105 // Traverse down. 38106 nextFiber = fiber.child; 38107 } 38108 38109 if (nextFiber !== null) { 38110 // Set the return pointer of the child to the work-in-progress fiber. 38111 nextFiber.return = fiber; 38112 } else { 38113 // No child. Traverse to next sibling. 38114 nextFiber = fiber; 38115 38116 while (nextFiber !== null) { 38117 if (nextFiber === workInProgress) { 38118 // We're back to the root of this subtree. Exit. 38119 nextFiber = null; 38120 break; 38121 } 38122 38123 var sibling = nextFiber.sibling; 38124 38125 if (sibling !== null) { 38126 // Set the return pointer of the sibling to the work-in-progress fiber. 38127 sibling.return = nextFiber.return; 38128 nextFiber = sibling; 38129 break; 38130 } // No more siblings. Traverse up. 38131 38132 38133 nextFiber = nextFiber.return; 38134 } 38135 } 38136 38137 fiber = nextFiber; 38138 } 38139} 38140function prepareToReadContext(workInProgress, renderExpirationTime) { 38141 currentlyRenderingFiber = workInProgress; 38142 lastContextDependency = null; 38143 lastContextWithAllBitsObserved = null; 38144 var dependencies = workInProgress.dependencies; 38145 38146 if (dependencies !== null) { 38147 var firstContext = dependencies.firstContext; 38148 38149 if (firstContext !== null) { 38150 if (dependencies.expirationTime >= renderExpirationTime) { 38151 // Context list has a pending update. Mark that this fiber performed work. 38152 markWorkInProgressReceivedUpdate(); 38153 } // Reset the work-in-progress list 38154 38155 38156 dependencies.firstContext = null; 38157 } 38158 } 38159} 38160function readContext(context, observedBits) { 38161 { 38162 // This warning would fire if you read context inside a Hook like useMemo. 38163 // Unlike the class check below, it's not enforced in production for perf. 38164 if (isDisallowedContextReadInDEV) { 38165 error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().'); 38166 } 38167 } 38168 38169 if (lastContextWithAllBitsObserved === context) ; else if (observedBits === false || observedBits === 0) ; else { 38170 var resolvedObservedBits; // Avoid deopting on observable arguments or heterogeneous types. 38171 38172 if (typeof observedBits !== 'number' || observedBits === MAX_SIGNED_31_BIT_INT) { 38173 // Observe all updates. 38174 lastContextWithAllBitsObserved = context; 38175 resolvedObservedBits = MAX_SIGNED_31_BIT_INT; 38176 } else { 38177 resolvedObservedBits = observedBits; 38178 } 38179 38180 var contextItem = { 38181 context: context, 38182 observedBits: resolvedObservedBits, 38183 next: null 38184 }; 38185 38186 if (lastContextDependency === null) { 38187 if (!(currentlyRenderingFiber !== null)) { 38188 { 38189 throw Error( "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." ); 38190 } 38191 } // This is the first dependency for this component. Create a new list. 38192 38193 38194 lastContextDependency = contextItem; 38195 currentlyRenderingFiber.dependencies = { 38196 expirationTime: NoWork, 38197 firstContext: contextItem, 38198 responders: null 38199 }; 38200 } else { 38201 // Append a new context item. 38202 lastContextDependency = lastContextDependency.next = contextItem; 38203 } 38204 } 38205 38206 return context._currentValue ; 38207} 38208 38209var UpdateState = 0; 38210var ReplaceState = 1; 38211var ForceUpdate = 2; 38212var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. 38213// It should only be read right after calling `processUpdateQueue`, via 38214// `checkHasForceUpdateAfterProcessing`. 38215 38216var hasForceUpdate = false; 38217var didWarnUpdateInsideUpdate; 38218var currentlyProcessingQueue; 38219 38220{ 38221 didWarnUpdateInsideUpdate = false; 38222 currentlyProcessingQueue = null; 38223} 38224 38225function initializeUpdateQueue(fiber) { 38226 var queue = { 38227 baseState: fiber.memoizedState, 38228 baseQueue: null, 38229 shared: { 38230 pending: null 38231 }, 38232 effects: null 38233 }; 38234 fiber.updateQueue = queue; 38235} 38236function cloneUpdateQueue(current, workInProgress) { 38237 // Clone the update queue from current. Unless it's already a clone. 38238 var queue = workInProgress.updateQueue; 38239 var currentQueue = current.updateQueue; 38240 38241 if (queue === currentQueue) { 38242 var clone = { 38243 baseState: currentQueue.baseState, 38244 baseQueue: currentQueue.baseQueue, 38245 shared: currentQueue.shared, 38246 effects: currentQueue.effects 38247 }; 38248 workInProgress.updateQueue = clone; 38249 } 38250} 38251function createUpdate(expirationTime, suspenseConfig) { 38252 var update = { 38253 expirationTime: expirationTime, 38254 suspenseConfig: suspenseConfig, 38255 tag: UpdateState, 38256 payload: null, 38257 callback: null, 38258 next: null 38259 }; 38260 update.next = update; 38261 38262 { 38263 update.priority = getCurrentPriorityLevel(); 38264 } 38265 38266 return update; 38267} 38268function enqueueUpdate(fiber, update) { 38269 var updateQueue = fiber.updateQueue; 38270 38271 if (updateQueue === null) { 38272 // Only occurs if the fiber has been unmounted. 38273 return; 38274 } 38275 38276 var sharedQueue = updateQueue.shared; 38277 var pending = sharedQueue.pending; 38278 38279 if (pending === null) { 38280 // This is the first update. Create a circular list. 38281 update.next = update; 38282 } else { 38283 update.next = pending.next; 38284 pending.next = update; 38285 } 38286 38287 sharedQueue.pending = update; 38288 38289 { 38290 if (currentlyProcessingQueue === sharedQueue && !didWarnUpdateInsideUpdate) { 38291 error('An update (setState, replaceState, or forceUpdate) was scheduled ' + 'from inside an update function. Update functions should be pure, ' + 'with zero side-effects. Consider using componentDidUpdate or a ' + 'callback.'); 38292 38293 didWarnUpdateInsideUpdate = true; 38294 } 38295 } 38296} 38297function enqueueCapturedUpdate(workInProgress, update) { 38298 var current = workInProgress.alternate; 38299 38300 if (current !== null) { 38301 // Ensure the work-in-progress queue is a clone 38302 cloneUpdateQueue(current, workInProgress); 38303 } // Captured updates go only on the work-in-progress queue. 38304 38305 38306 var queue = workInProgress.updateQueue; // Append the update to the end of the list. 38307 38308 var last = queue.baseQueue; 38309 38310 if (last === null) { 38311 queue.baseQueue = update.next = update; 38312 update.next = update; 38313 } else { 38314 update.next = last.next; 38315 last.next = update; 38316 } 38317} 38318 38319function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps, instance) { 38320 switch (update.tag) { 38321 case ReplaceState: 38322 { 38323 var payload = update.payload; 38324 38325 if (typeof payload === 'function') { 38326 // Updater function 38327 { 38328 enterDisallowedContextReadInDEV(); 38329 38330 if ( workInProgress.mode & StrictMode) { 38331 payload.call(instance, prevState, nextProps); 38332 } 38333 } 38334 38335 var nextState = payload.call(instance, prevState, nextProps); 38336 38337 { 38338 exitDisallowedContextReadInDEV(); 38339 } 38340 38341 return nextState; 38342 } // State object 38343 38344 38345 return payload; 38346 } 38347 38348 case CaptureUpdate: 38349 { 38350 workInProgress.effectTag = workInProgress.effectTag & ~ShouldCapture | DidCapture; 38351 } 38352 // Intentional fallthrough 38353 38354 case UpdateState: 38355 { 38356 var _payload = update.payload; 38357 var partialState; 38358 38359 if (typeof _payload === 'function') { 38360 // Updater function 38361 { 38362 enterDisallowedContextReadInDEV(); 38363 38364 if ( workInProgress.mode & StrictMode) { 38365 _payload.call(instance, prevState, nextProps); 38366 } 38367 } 38368 38369 partialState = _payload.call(instance, prevState, nextProps); 38370 38371 { 38372 exitDisallowedContextReadInDEV(); 38373 } 38374 } else { 38375 // Partial state object 38376 partialState = _payload; 38377 } 38378 38379 if (partialState === null || partialState === undefined) { 38380 // Null and undefined are treated as no-ops. 38381 return prevState; 38382 } // Merge the partial state and the previous state. 38383 38384 38385 return _assign({}, prevState, partialState); 38386 } 38387 38388 case ForceUpdate: 38389 { 38390 hasForceUpdate = true; 38391 return prevState; 38392 } 38393 } 38394 38395 return prevState; 38396} 38397 38398function processUpdateQueue(workInProgress, props, instance, renderExpirationTime) { 38399 // This is always non-null on a ClassComponent or HostRoot 38400 var queue = workInProgress.updateQueue; 38401 hasForceUpdate = false; 38402 38403 { 38404 currentlyProcessingQueue = queue.shared; 38405 } // The last rebase update that is NOT part of the base state. 38406 38407 38408 var baseQueue = queue.baseQueue; // The last pending update that hasn't been processed yet. 38409 38410 var pendingQueue = queue.shared.pending; 38411 38412 if (pendingQueue !== null) { 38413 // We have new updates that haven't been processed yet. 38414 // We'll add them to the base queue. 38415 if (baseQueue !== null) { 38416 // Merge the pending queue and the base queue. 38417 var baseFirst = baseQueue.next; 38418 var pendingFirst = pendingQueue.next; 38419 baseQueue.next = pendingFirst; 38420 pendingQueue.next = baseFirst; 38421 } 38422 38423 baseQueue = pendingQueue; 38424 queue.shared.pending = null; // TODO: Pass `current` as argument 38425 38426 var current = workInProgress.alternate; 38427 38428 if (current !== null) { 38429 var currentQueue = current.updateQueue; 38430 38431 if (currentQueue !== null) { 38432 currentQueue.baseQueue = pendingQueue; 38433 } 38434 } 38435 } // These values may change as we process the queue. 38436 38437 38438 if (baseQueue !== null) { 38439 var first = baseQueue.next; // Iterate through the list of updates to compute the result. 38440 38441 var newState = queue.baseState; 38442 var newExpirationTime = NoWork; 38443 var newBaseState = null; 38444 var newBaseQueueFirst = null; 38445 var newBaseQueueLast = null; 38446 38447 if (first !== null) { 38448 var update = first; 38449 38450 do { 38451 var updateExpirationTime = update.expirationTime; 38452 38453 if (updateExpirationTime < renderExpirationTime) { 38454 // Priority is insufficient. Skip this update. If this is the first 38455 // skipped update, the previous update/state is the new base 38456 // update/state. 38457 var clone = { 38458 expirationTime: update.expirationTime, 38459 suspenseConfig: update.suspenseConfig, 38460 tag: update.tag, 38461 payload: update.payload, 38462 callback: update.callback, 38463 next: null 38464 }; 38465 38466 if (newBaseQueueLast === null) { 38467 newBaseQueueFirst = newBaseQueueLast = clone; 38468 newBaseState = newState; 38469 } else { 38470 newBaseQueueLast = newBaseQueueLast.next = clone; 38471 } // Update the remaining priority in the queue. 38472 38473 38474 if (updateExpirationTime > newExpirationTime) { 38475 newExpirationTime = updateExpirationTime; 38476 } 38477 } else { 38478 // This update does have sufficient priority. 38479 if (newBaseQueueLast !== null) { 38480 var _clone = { 38481 expirationTime: Sync, 38482 // This update is going to be committed so we never want uncommit it. 38483 suspenseConfig: update.suspenseConfig, 38484 tag: update.tag, 38485 payload: update.payload, 38486 callback: update.callback, 38487 next: null 38488 }; 38489 newBaseQueueLast = newBaseQueueLast.next = _clone; 38490 } // Mark the event time of this update as relevant to this render pass. 38491 // TODO: This should ideally use the true event time of this update rather than 38492 // its priority which is a derived and not reverseable value. 38493 // TODO: We should skip this update if it was already committed but currently 38494 // we have no way of detecting the difference between a committed and suspended 38495 // update here. 38496 38497 38498 markRenderEventTimeAndConfig(updateExpirationTime, update.suspenseConfig); // Process this update. 38499 38500 newState = getStateFromUpdate(workInProgress, queue, update, newState, props, instance); 38501 var callback = update.callback; 38502 38503 if (callback !== null) { 38504 workInProgress.effectTag |= Callback; 38505 var effects = queue.effects; 38506 38507 if (effects === null) { 38508 queue.effects = [update]; 38509 } else { 38510 effects.push(update); 38511 } 38512 } 38513 } 38514 38515 update = update.next; 38516 38517 if (update === null || update === first) { 38518 pendingQueue = queue.shared.pending; 38519 38520 if (pendingQueue === null) { 38521 break; 38522 } else { 38523 // An update was scheduled from inside a reducer. Add the new 38524 // pending updates to the end of the list and keep processing. 38525 update = baseQueue.next = pendingQueue.next; 38526 pendingQueue.next = first; 38527 queue.baseQueue = baseQueue = pendingQueue; 38528 queue.shared.pending = null; 38529 } 38530 } 38531 } while (true); 38532 } 38533 38534 if (newBaseQueueLast === null) { 38535 newBaseState = newState; 38536 } else { 38537 newBaseQueueLast.next = newBaseQueueFirst; 38538 } 38539 38540 queue.baseState = newBaseState; 38541 queue.baseQueue = newBaseQueueLast; // Set the remaining expiration time to be whatever is remaining in the queue. 38542 // This should be fine because the only two other things that contribute to 38543 // expiration time are props and context. We're already in the middle of the 38544 // begin phase by the time we start processing the queue, so we've already 38545 // dealt with the props. Context in components that specify 38546 // shouldComponentUpdate is tricky; but we'll have to account for 38547 // that regardless. 38548 38549 markUnprocessedUpdateTime(newExpirationTime); 38550 workInProgress.expirationTime = newExpirationTime; 38551 workInProgress.memoizedState = newState; 38552 } 38553 38554 { 38555 currentlyProcessingQueue = null; 38556 } 38557} 38558 38559function callCallback(callback, context) { 38560 if (!(typeof callback === 'function')) { 38561 { 38562 throw Error( "Invalid argument passed as callback. Expected a function. Instead received: " + callback ); 38563 } 38564 } 38565 38566 callback.call(context); 38567} 38568 38569function resetHasForceUpdateBeforeProcessing() { 38570 hasForceUpdate = false; 38571} 38572function checkHasForceUpdateAfterProcessing() { 38573 return hasForceUpdate; 38574} 38575function commitUpdateQueue(finishedWork, finishedQueue, instance) { 38576 // Commit the effects 38577 var effects = finishedQueue.effects; 38578 finishedQueue.effects = null; 38579 38580 if (effects !== null) { 38581 for (var i = 0; i < effects.length; i++) { 38582 var effect = effects[i]; 38583 var callback = effect.callback; 38584 38585 if (callback !== null) { 38586 effect.callback = null; 38587 callCallback(callback, instance); 38588 } 38589 } 38590 } 38591} 38592 38593var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; 38594function requestCurrentSuspenseConfig() { 38595 return ReactCurrentBatchConfig.suspense; 38596} 38597 38598var fakeInternalInstance = {}; 38599var isArray = Array.isArray; // React.Component uses a shared frozen object by default. 38600// We'll use it to determine whether we need to initialize legacy refs. 38601 38602var emptyRefsObject = new React.Component().refs; 38603var didWarnAboutStateAssignmentForComponent; 38604var didWarnAboutUninitializedState; 38605var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate; 38606var didWarnAboutLegacyLifecyclesAndDerivedState; 38607var didWarnAboutUndefinedDerivedState; 38608var warnOnUndefinedDerivedState; 38609var warnOnInvalidCallback; 38610var didWarnAboutDirectlyAssigningPropsToState; 38611var didWarnAboutContextTypeAndContextTypes; 38612var didWarnAboutInvalidateContextType; 38613 38614{ 38615 didWarnAboutStateAssignmentForComponent = new Set(); 38616 didWarnAboutUninitializedState = new Set(); 38617 didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set(); 38618 didWarnAboutLegacyLifecyclesAndDerivedState = new Set(); 38619 didWarnAboutDirectlyAssigningPropsToState = new Set(); 38620 didWarnAboutUndefinedDerivedState = new Set(); 38621 didWarnAboutContextTypeAndContextTypes = new Set(); 38622 didWarnAboutInvalidateContextType = new Set(); 38623 var didWarnOnInvalidCallback = new Set(); 38624 38625 warnOnInvalidCallback = function (callback, callerName) { 38626 if (callback === null || typeof callback === 'function') { 38627 return; 38628 } 38629 38630 var key = callerName + "_" + callback; 38631 38632 if (!didWarnOnInvalidCallback.has(key)) { 38633 didWarnOnInvalidCallback.add(key); 38634 38635 error('%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback); 38636 } 38637 }; 38638 38639 warnOnUndefinedDerivedState = function (type, partialState) { 38640 if (partialState === undefined) { 38641 var componentName = getComponentName(type) || 'Component'; 38642 38643 if (!didWarnAboutUndefinedDerivedState.has(componentName)) { 38644 didWarnAboutUndefinedDerivedState.add(componentName); 38645 38646 error('%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName); 38647 } 38648 } 38649 }; // This is so gross but it's at least non-critical and can be removed if 38650 // it causes problems. This is meant to give a nicer error message for 38651 // ReactDOM15.unstable_renderSubtreeIntoContainer(reactDOM16Component, 38652 // ...)) which otherwise throws a "_processChildContext is not a function" 38653 // exception. 38654 38655 38656 Object.defineProperty(fakeInternalInstance, '_processChildContext', { 38657 enumerable: false, 38658 value: function () { 38659 { 38660 { 38661 throw Error( "_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal)." ); 38662 } 38663 } 38664 } 38665 }); 38666 Object.freeze(fakeInternalInstance); 38667} 38668 38669function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, nextProps) { 38670 var prevState = workInProgress.memoizedState; 38671 38672 { 38673 if ( workInProgress.mode & StrictMode) { 38674 // Invoke the function an extra time to help detect side-effects. 38675 getDerivedStateFromProps(nextProps, prevState); 38676 } 38677 } 38678 38679 var partialState = getDerivedStateFromProps(nextProps, prevState); 38680 38681 { 38682 warnOnUndefinedDerivedState(ctor, partialState); 38683 } // Merge the partial state and the previous state. 38684 38685 38686 var memoizedState = partialState === null || partialState === undefined ? prevState : _assign({}, prevState, partialState); 38687 workInProgress.memoizedState = memoizedState; // Once the update queue is empty, persist the derived state onto the 38688 // base state. 38689 38690 if (workInProgress.expirationTime === NoWork) { 38691 // Queue is always non-null for classes 38692 var updateQueue = workInProgress.updateQueue; 38693 updateQueue.baseState = memoizedState; 38694 } 38695} 38696var classComponentUpdater = { 38697 isMounted: isMounted, 38698 enqueueSetState: function (inst, payload, callback) { 38699 var fiber = get(inst); 38700 var currentTime = requestCurrentTimeForUpdate(); 38701 var suspenseConfig = requestCurrentSuspenseConfig(); 38702 var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig); 38703 var update = createUpdate(expirationTime, suspenseConfig); 38704 update.payload = payload; 38705 38706 if (callback !== undefined && callback !== null) { 38707 { 38708 warnOnInvalidCallback(callback, 'setState'); 38709 } 38710 38711 update.callback = callback; 38712 } 38713 38714 enqueueUpdate(fiber, update); 38715 scheduleWork(fiber, expirationTime); 38716 }, 38717 enqueueReplaceState: function (inst, payload, callback) { 38718 var fiber = get(inst); 38719 var currentTime = requestCurrentTimeForUpdate(); 38720 var suspenseConfig = requestCurrentSuspenseConfig(); 38721 var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig); 38722 var update = createUpdate(expirationTime, suspenseConfig); 38723 update.tag = ReplaceState; 38724 update.payload = payload; 38725 38726 if (callback !== undefined && callback !== null) { 38727 { 38728 warnOnInvalidCallback(callback, 'replaceState'); 38729 } 38730 38731 update.callback = callback; 38732 } 38733 38734 enqueueUpdate(fiber, update); 38735 scheduleWork(fiber, expirationTime); 38736 }, 38737 enqueueForceUpdate: function (inst, callback) { 38738 var fiber = get(inst); 38739 var currentTime = requestCurrentTimeForUpdate(); 38740 var suspenseConfig = requestCurrentSuspenseConfig(); 38741 var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig); 38742 var update = createUpdate(expirationTime, suspenseConfig); 38743 update.tag = ForceUpdate; 38744 38745 if (callback !== undefined && callback !== null) { 38746 { 38747 warnOnInvalidCallback(callback, 'forceUpdate'); 38748 } 38749 38750 update.callback = callback; 38751 } 38752 38753 enqueueUpdate(fiber, update); 38754 scheduleWork(fiber, expirationTime); 38755 } 38756}; 38757 38758function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) { 38759 var instance = workInProgress.stateNode; 38760 38761 if (typeof instance.shouldComponentUpdate === 'function') { 38762 { 38763 if ( workInProgress.mode & StrictMode) { 38764 // Invoke the function an extra time to help detect side-effects. 38765 instance.shouldComponentUpdate(newProps, newState, nextContext); 38766 } 38767 } 38768 38769 startPhaseTimer(workInProgress, 'shouldComponentUpdate'); 38770 var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext); 38771 stopPhaseTimer(); 38772 38773 { 38774 if (shouldUpdate === undefined) { 38775 error('%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentName(ctor) || 'Component'); 38776 } 38777 } 38778 38779 return shouldUpdate; 38780 } 38781 38782 if (ctor.prototype && ctor.prototype.isPureReactComponent) { 38783 return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState); 38784 } 38785 38786 return true; 38787} 38788 38789function checkClassInstance(workInProgress, ctor, newProps) { 38790 var instance = workInProgress.stateNode; 38791 38792 { 38793 var name = getComponentName(ctor) || 'Component'; 38794 var renderPresent = instance.render; 38795 38796 if (!renderPresent) { 38797 if (ctor.prototype && typeof ctor.prototype.render === 'function') { 38798 error('%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name); 38799 } else { 38800 error('%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name); 38801 } 38802 } 38803 38804 if (instance.getInitialState && !instance.getInitialState.isReactClassApproved && !instance.state) { 38805 error('getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', name); 38806 } 38807 38808 if (instance.getDefaultProps && !instance.getDefaultProps.isReactClassApproved) { 38809 error('getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', name); 38810 } 38811 38812 if (instance.propTypes) { 38813 error('propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name); 38814 } 38815 38816 if (instance.contextType) { 38817 error('contextType was defined as an instance property on %s. Use a static ' + 'property to define contextType instead.', name); 38818 } 38819 38820 { 38821 if (instance.contextTypes) { 38822 error('contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name); 38823 } 38824 38825 if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) { 38826 didWarnAboutContextTypeAndContextTypes.add(ctor); 38827 38828 error('%s declares both contextTypes and contextType static properties. ' + 'The legacy contextTypes property will be ignored.', name); 38829 } 38830 } 38831 38832 if (typeof instance.componentShouldUpdate === 'function') { 38833 error('%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', name); 38834 } 38835 38836 if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') { 38837 error('%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentName(ctor) || 'A pure component'); 38838 } 38839 38840 if (typeof instance.componentDidUnmount === 'function') { 38841 error('%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name); 38842 } 38843 38844 if (typeof instance.componentDidReceiveProps === 'function') { 38845 error('%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name); 38846 } 38847 38848 if (typeof instance.componentWillRecieveProps === 'function') { 38849 error('%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name); 38850 } 38851 38852 if (typeof instance.UNSAFE_componentWillRecieveProps === 'function') { 38853 error('%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name); 38854 } 38855 38856 var hasMutatedProps = instance.props !== newProps; 38857 38858 if (instance.props !== undefined && hasMutatedProps) { 38859 error('%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name); 38860 } 38861 38862 if (instance.defaultProps) { 38863 error('Setting defaultProps as an instance property on %s is not supported and will be ignored.' + ' Instead, define defaultProps as a static property on %s.', name, name); 38864 } 38865 38866 if (typeof instance.getSnapshotBeforeUpdate === 'function' && typeof instance.componentDidUpdate !== 'function' && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor)) { 38867 didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor); 38868 38869 error('%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' + 'This component defines getSnapshotBeforeUpdate() only.', getComponentName(ctor)); 38870 } 38871 38872 if (typeof instance.getDerivedStateFromProps === 'function') { 38873 error('%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name); 38874 } 38875 38876 if (typeof instance.getDerivedStateFromError === 'function') { 38877 error('%s: getDerivedStateFromError() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name); 38878 } 38879 38880 if (typeof ctor.getSnapshotBeforeUpdate === 'function') { 38881 error('%s: getSnapshotBeforeUpdate() is defined as a static method ' + 'and will be ignored. Instead, declare it as an instance method.', name); 38882 } 38883 38884 var _state = instance.state; 38885 38886 if (_state && (typeof _state !== 'object' || isArray(_state))) { 38887 error('%s.state: must be set to an object or null', name); 38888 } 38889 38890 if (typeof instance.getChildContext === 'function' && typeof ctor.childContextTypes !== 'object') { 38891 error('%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name); 38892 } 38893 } 38894} 38895 38896function adoptClassInstance(workInProgress, instance) { 38897 instance.updater = classComponentUpdater; 38898 workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates 38899 38900 set(instance, workInProgress); 38901 38902 { 38903 instance._reactInternalInstance = fakeInternalInstance; 38904 } 38905} 38906 38907function constructClassInstance(workInProgress, ctor, props) { 38908 var isLegacyContextConsumer = false; 38909 var unmaskedContext = emptyContextObject; 38910 var context = emptyContextObject; 38911 var contextType = ctor.contextType; 38912 38913 { 38914 if ('contextType' in ctor) { 38915 var isValid = // Allow null for conditional declaration 38916 contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a <Context.Consumer> 38917 38918 if (!isValid && !didWarnAboutInvalidateContextType.has(ctor)) { 38919 didWarnAboutInvalidateContextType.add(ctor); 38920 var addendum = ''; 38921 38922 if (contextType === undefined) { 38923 addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.'; 38924 } else if (typeof contextType !== 'object') { 38925 addendum = ' However, it is set to a ' + typeof contextType + '.'; 38926 } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) { 38927 addendum = ' Did you accidentally pass the Context.Provider instead?'; 38928 } else if (contextType._context !== undefined) { 38929 // <Context.Consumer> 38930 addendum = ' Did you accidentally pass the Context.Consumer instead?'; 38931 } else { 38932 addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.'; 38933 } 38934 38935 error('%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentName(ctor) || 'Component', addendum); 38936 } 38937 } 38938 } 38939 38940 if (typeof contextType === 'object' && contextType !== null) { 38941 context = readContext(contextType); 38942 } else { 38943 unmaskedContext = getUnmaskedContext(workInProgress, ctor, true); 38944 var contextTypes = ctor.contextTypes; 38945 isLegacyContextConsumer = contextTypes !== null && contextTypes !== undefined; 38946 context = isLegacyContextConsumer ? getMaskedContext(workInProgress, unmaskedContext) : emptyContextObject; 38947 } // Instantiate twice to help detect side-effects. 38948 38949 38950 { 38951 if ( workInProgress.mode & StrictMode) { 38952 new ctor(props, context); // eslint-disable-line no-new 38953 } 38954 } 38955 38956 var instance = new ctor(props, context); 38957 var state = workInProgress.memoizedState = instance.state !== null && instance.state !== undefined ? instance.state : null; 38958 adoptClassInstance(workInProgress, instance); 38959 38960 { 38961 if (typeof ctor.getDerivedStateFromProps === 'function' && state === null) { 38962 var componentName = getComponentName(ctor) || 'Component'; 38963 38964 if (!didWarnAboutUninitializedState.has(componentName)) { 38965 didWarnAboutUninitializedState.add(componentName); 38966 38967 error('`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, instance.state === null ? 'null' : 'undefined', componentName); 38968 } 38969 } // If new component APIs are defined, "unsafe" lifecycles won't be called. 38970 // Warn about these lifecycles if they are present. 38971 // Don't warn about react-lifecycles-compat polyfilled methods though. 38972 38973 38974 if (typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function') { 38975 var foundWillMountName = null; 38976 var foundWillReceivePropsName = null; 38977 var foundWillUpdateName = null; 38978 38979 if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) { 38980 foundWillMountName = 'componentWillMount'; 38981 } else if (typeof instance.UNSAFE_componentWillMount === 'function') { 38982 foundWillMountName = 'UNSAFE_componentWillMount'; 38983 } 38984 38985 if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) { 38986 foundWillReceivePropsName = 'componentWillReceiveProps'; 38987 } else if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') { 38988 foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps'; 38989 } 38990 38991 if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) { 38992 foundWillUpdateName = 'componentWillUpdate'; 38993 } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') { 38994 foundWillUpdateName = 'UNSAFE_componentWillUpdate'; 38995 } 38996 38997 if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) { 38998 var _componentName = getComponentName(ctor) || 'Component'; 38999 39000 var newApiName = typeof ctor.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()'; 39001 39002 if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) { 39003 didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName); 39004 39005 error('Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + '%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n' + 'The above lifecycles should be removed. Learn more about this warning here:\n' + 'https://fb.me/react-unsafe-component-lifecycles', _componentName, newApiName, foundWillMountName !== null ? "\n " + foundWillMountName : '', foundWillReceivePropsName !== null ? "\n " + foundWillReceivePropsName : '', foundWillUpdateName !== null ? "\n " + foundWillUpdateName : ''); 39006 } 39007 } 39008 } 39009 } // Cache unmasked context so we can avoid recreating masked context unless necessary. 39010 // ReactFiberContext usually updates this cache but can't for newly-created instances. 39011 39012 39013 if (isLegacyContextConsumer) { 39014 cacheContext(workInProgress, unmaskedContext, context); 39015 } 39016 39017 return instance; 39018} 39019 39020function callComponentWillMount(workInProgress, instance) { 39021 startPhaseTimer(workInProgress, 'componentWillMount'); 39022 var oldState = instance.state; 39023 39024 if (typeof instance.componentWillMount === 'function') { 39025 instance.componentWillMount(); 39026 } 39027 39028 if (typeof instance.UNSAFE_componentWillMount === 'function') { 39029 instance.UNSAFE_componentWillMount(); 39030 } 39031 39032 stopPhaseTimer(); 39033 39034 if (oldState !== instance.state) { 39035 { 39036 error('%s.componentWillMount(): Assigning directly to this.state is ' + "deprecated (except inside a component's " + 'constructor). Use setState instead.', getComponentName(workInProgress.type) || 'Component'); 39037 } 39038 39039 classComponentUpdater.enqueueReplaceState(instance, instance.state, null); 39040 } 39041} 39042 39043function callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext) { 39044 var oldState = instance.state; 39045 startPhaseTimer(workInProgress, 'componentWillReceiveProps'); 39046 39047 if (typeof instance.componentWillReceiveProps === 'function') { 39048 instance.componentWillReceiveProps(newProps, nextContext); 39049 } 39050 39051 if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') { 39052 instance.UNSAFE_componentWillReceiveProps(newProps, nextContext); 39053 } 39054 39055 stopPhaseTimer(); 39056 39057 if (instance.state !== oldState) { 39058 { 39059 var componentName = getComponentName(workInProgress.type) || 'Component'; 39060 39061 if (!didWarnAboutStateAssignmentForComponent.has(componentName)) { 39062 didWarnAboutStateAssignmentForComponent.add(componentName); 39063 39064 error('%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName); 39065 } 39066 } 39067 39068 classComponentUpdater.enqueueReplaceState(instance, instance.state, null); 39069 } 39070} // Invokes the mount life-cycles on a previously never rendered instance. 39071 39072 39073function mountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) { 39074 { 39075 checkClassInstance(workInProgress, ctor, newProps); 39076 } 39077 39078 var instance = workInProgress.stateNode; 39079 instance.props = newProps; 39080 instance.state = workInProgress.memoizedState; 39081 instance.refs = emptyRefsObject; 39082 initializeUpdateQueue(workInProgress); 39083 var contextType = ctor.contextType; 39084 39085 if (typeof contextType === 'object' && contextType !== null) { 39086 instance.context = readContext(contextType); 39087 } else { 39088 var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true); 39089 instance.context = getMaskedContext(workInProgress, unmaskedContext); 39090 } 39091 39092 { 39093 if (instance.state === newProps) { 39094 var componentName = getComponentName(ctor) || 'Component'; 39095 39096 if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) { 39097 didWarnAboutDirectlyAssigningPropsToState.add(componentName); 39098 39099 error('%s: It is not recommended to assign props directly to state ' + "because updates to props won't be reflected in state. " + 'In most cases, it is better to use props directly.', componentName); 39100 } 39101 } 39102 39103 if (workInProgress.mode & StrictMode) { 39104 ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, instance); 39105 } 39106 39107 { 39108 ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance); 39109 } 39110 } 39111 39112 processUpdateQueue(workInProgress, newProps, instance, renderExpirationTime); 39113 instance.state = workInProgress.memoizedState; 39114 var getDerivedStateFromProps = ctor.getDerivedStateFromProps; 39115 39116 if (typeof getDerivedStateFromProps === 'function') { 39117 applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps); 39118 instance.state = workInProgress.memoizedState; 39119 } // In order to support react-lifecycles-compat polyfilled components, 39120 // Unsafe lifecycles should not be invoked for components using the new APIs. 39121 39122 39123 if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) { 39124 callComponentWillMount(workInProgress, instance); // If we had additional state updates during this life-cycle, let's 39125 // process them now. 39126 39127 processUpdateQueue(workInProgress, newProps, instance, renderExpirationTime); 39128 instance.state = workInProgress.memoizedState; 39129 } 39130 39131 if (typeof instance.componentDidMount === 'function') { 39132 workInProgress.effectTag |= Update; 39133 } 39134} 39135 39136function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) { 39137 var instance = workInProgress.stateNode; 39138 var oldProps = workInProgress.memoizedProps; 39139 instance.props = oldProps; 39140 var oldContext = instance.context; 39141 var contextType = ctor.contextType; 39142 var nextContext = emptyContextObject; 39143 39144 if (typeof contextType === 'object' && contextType !== null) { 39145 nextContext = readContext(contextType); 39146 } else { 39147 var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true); 39148 nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext); 39149 } 39150 39151 var getDerivedStateFromProps = ctor.getDerivedStateFromProps; 39152 var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function'; // Note: During these life-cycles, instance.props/instance.state are what 39153 // ever the previously attempted to render - not the "current". However, 39154 // during componentDidUpdate we pass the "current" props. 39155 // In order to support react-lifecycles-compat polyfilled components, 39156 // Unsafe lifecycles should not be invoked for components using the new APIs. 39157 39158 if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) { 39159 if (oldProps !== newProps || oldContext !== nextContext) { 39160 callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext); 39161 } 39162 } 39163 39164 resetHasForceUpdateBeforeProcessing(); 39165 var oldState = workInProgress.memoizedState; 39166 var newState = instance.state = oldState; 39167 processUpdateQueue(workInProgress, newProps, instance, renderExpirationTime); 39168 newState = workInProgress.memoizedState; 39169 39170 if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) { 39171 // If an update was already in progress, we should schedule an Update 39172 // effect even though we're bailing out, so that cWU/cDU are called. 39173 if (typeof instance.componentDidMount === 'function') { 39174 workInProgress.effectTag |= Update; 39175 } 39176 39177 return false; 39178 } 39179 39180 if (typeof getDerivedStateFromProps === 'function') { 39181 applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps); 39182 newState = workInProgress.memoizedState; 39183 } 39184 39185 var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext); 39186 39187 if (shouldUpdate) { 39188 // In order to support react-lifecycles-compat polyfilled components, 39189 // Unsafe lifecycles should not be invoked for components using the new APIs. 39190 if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) { 39191 startPhaseTimer(workInProgress, 'componentWillMount'); 39192 39193 if (typeof instance.componentWillMount === 'function') { 39194 instance.componentWillMount(); 39195 } 39196 39197 if (typeof instance.UNSAFE_componentWillMount === 'function') { 39198 instance.UNSAFE_componentWillMount(); 39199 } 39200 39201 stopPhaseTimer(); 39202 } 39203 39204 if (typeof instance.componentDidMount === 'function') { 39205 workInProgress.effectTag |= Update; 39206 } 39207 } else { 39208 // If an update was already in progress, we should schedule an Update 39209 // effect even though we're bailing out, so that cWU/cDU are called. 39210 if (typeof instance.componentDidMount === 'function') { 39211 workInProgress.effectTag |= Update; 39212 } // If shouldComponentUpdate returned false, we should still update the 39213 // memoized state to indicate that this work can be reused. 39214 39215 39216 workInProgress.memoizedProps = newProps; 39217 workInProgress.memoizedState = newState; 39218 } // Update the existing instance's state, props, and context pointers even 39219 // if shouldComponentUpdate returns false. 39220 39221 39222 instance.props = newProps; 39223 instance.state = newState; 39224 instance.context = nextContext; 39225 return shouldUpdate; 39226} // Invokes the update life-cycles and returns false if it shouldn't rerender. 39227 39228 39229function updateClassInstance(current, workInProgress, ctor, newProps, renderExpirationTime) { 39230 var instance = workInProgress.stateNode; 39231 cloneUpdateQueue(current, workInProgress); 39232 var oldProps = workInProgress.memoizedProps; 39233 instance.props = workInProgress.type === workInProgress.elementType ? oldProps : resolveDefaultProps(workInProgress.type, oldProps); 39234 var oldContext = instance.context; 39235 var contextType = ctor.contextType; 39236 var nextContext = emptyContextObject; 39237 39238 if (typeof contextType === 'object' && contextType !== null) { 39239 nextContext = readContext(contextType); 39240 } else { 39241 var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true); 39242 nextContext = getMaskedContext(workInProgress, nextUnmaskedContext); 39243 } 39244 39245 var getDerivedStateFromProps = ctor.getDerivedStateFromProps; 39246 var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function'; // Note: During these life-cycles, instance.props/instance.state are what 39247 // ever the previously attempted to render - not the "current". However, 39248 // during componentDidUpdate we pass the "current" props. 39249 // In order to support react-lifecycles-compat polyfilled components, 39250 // Unsafe lifecycles should not be invoked for components using the new APIs. 39251 39252 if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) { 39253 if (oldProps !== newProps || oldContext !== nextContext) { 39254 callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext); 39255 } 39256 } 39257 39258 resetHasForceUpdateBeforeProcessing(); 39259 var oldState = workInProgress.memoizedState; 39260 var newState = instance.state = oldState; 39261 processUpdateQueue(workInProgress, newProps, instance, renderExpirationTime); 39262 newState = workInProgress.memoizedState; 39263 39264 if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) { 39265 // If an update was already in progress, we should schedule an Update 39266 // effect even though we're bailing out, so that cWU/cDU are called. 39267 if (typeof instance.componentDidUpdate === 'function') { 39268 if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) { 39269 workInProgress.effectTag |= Update; 39270 } 39271 } 39272 39273 if (typeof instance.getSnapshotBeforeUpdate === 'function') { 39274 if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) { 39275 workInProgress.effectTag |= Snapshot; 39276 } 39277 } 39278 39279 return false; 39280 } 39281 39282 if (typeof getDerivedStateFromProps === 'function') { 39283 applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps); 39284 newState = workInProgress.memoizedState; 39285 } 39286 39287 var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext); 39288 39289 if (shouldUpdate) { 39290 // In order to support react-lifecycles-compat polyfilled components, 39291 // Unsafe lifecycles should not be invoked for components using the new APIs. 39292 if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) { 39293 startPhaseTimer(workInProgress, 'componentWillUpdate'); 39294 39295 if (typeof instance.componentWillUpdate === 'function') { 39296 instance.componentWillUpdate(newProps, newState, nextContext); 39297 } 39298 39299 if (typeof instance.UNSAFE_componentWillUpdate === 'function') { 39300 instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext); 39301 } 39302 39303 stopPhaseTimer(); 39304 } 39305 39306 if (typeof instance.componentDidUpdate === 'function') { 39307 workInProgress.effectTag |= Update; 39308 } 39309 39310 if (typeof instance.getSnapshotBeforeUpdate === 'function') { 39311 workInProgress.effectTag |= Snapshot; 39312 } 39313 } else { 39314 // If an update was already in progress, we should schedule an Update 39315 // effect even though we're bailing out, so that cWU/cDU are called. 39316 if (typeof instance.componentDidUpdate === 'function') { 39317 if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) { 39318 workInProgress.effectTag |= Update; 39319 } 39320 } 39321 39322 if (typeof instance.getSnapshotBeforeUpdate === 'function') { 39323 if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) { 39324 workInProgress.effectTag |= Snapshot; 39325 } 39326 } // If shouldComponentUpdate returned false, we should still update the 39327 // memoized props/state to indicate that this work can be reused. 39328 39329 39330 workInProgress.memoizedProps = newProps; 39331 workInProgress.memoizedState = newState; 39332 } // Update the existing instance's state, props, and context pointers even 39333 // if shouldComponentUpdate returns false. 39334 39335 39336 instance.props = newProps; 39337 instance.state = newState; 39338 instance.context = nextContext; 39339 return shouldUpdate; 39340} 39341 39342var didWarnAboutMaps; 39343var didWarnAboutGenerators; 39344var didWarnAboutStringRefs; 39345var ownerHasKeyUseWarning; 39346var ownerHasFunctionTypeWarning; 39347 39348var warnForMissingKey = function (child) {}; 39349 39350{ 39351 didWarnAboutMaps = false; 39352 didWarnAboutGenerators = false; 39353 didWarnAboutStringRefs = {}; 39354 /** 39355 * Warn if there's no key explicitly set on dynamic arrays of children or 39356 * object keys are not valid. This allows us to keep track of children between 39357 * updates. 39358 */ 39359 39360 ownerHasKeyUseWarning = {}; 39361 ownerHasFunctionTypeWarning = {}; 39362 39363 warnForMissingKey = function (child) { 39364 if (child === null || typeof child !== 'object') { 39365 return; 39366 } 39367 39368 if (!child._store || child._store.validated || child.key != null) { 39369 return; 39370 } 39371 39372 if (!(typeof child._store === 'object')) { 39373 { 39374 throw Error( "React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue." ); 39375 } 39376 } 39377 39378 child._store.validated = true; 39379 var currentComponentErrorInfo = 'Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.' + getCurrentFiberStackInDev(); 39380 39381 if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { 39382 return; 39383 } 39384 39385 ownerHasKeyUseWarning[currentComponentErrorInfo] = true; 39386 39387 error('Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.'); 39388 }; 39389} 39390 39391var isArray$1 = Array.isArray; 39392 39393function coerceRef(returnFiber, current, element) { 39394 var mixedRef = element.ref; 39395 39396 if (mixedRef !== null && typeof mixedRef !== 'function' && typeof mixedRef !== 'object') { 39397 { 39398 // TODO: Clean this up once we turn on the string ref warning for 39399 // everyone, because the strict mode case will no longer be relevant 39400 if ((returnFiber.mode & StrictMode || warnAboutStringRefs) && // We warn in ReactElement.js if owner and self are equal for string refs 39401 // because these cannot be automatically converted to an arrow function 39402 // using a codemod. Therefore, we don't have to warn about string refs again. 39403 !(element._owner && element._self && element._owner.stateNode !== element._self)) { 39404 var componentName = getComponentName(returnFiber.type) || 'Component'; 39405 39406 if (!didWarnAboutStringRefs[componentName]) { 39407 { 39408 error('A string ref, "%s", has been found within a strict mode tree. ' + 'String refs are a source of potential bugs and should be avoided. ' + 'We recommend using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-string-ref%s', mixedRef, getStackByFiberInDevAndProd(returnFiber)); 39409 } 39410 39411 didWarnAboutStringRefs[componentName] = true; 39412 } 39413 } 39414 } 39415 39416 if (element._owner) { 39417 var owner = element._owner; 39418 var inst; 39419 39420 if (owner) { 39421 var ownerFiber = owner; 39422 39423 if (!(ownerFiber.tag === ClassComponent)) { 39424 { 39425 throw Error( "Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://fb.me/react-strict-mode-string-ref" ); 39426 } 39427 } 39428 39429 inst = ownerFiber.stateNode; 39430 } 39431 39432 if (!inst) { 39433 { 39434 throw Error( "Missing owner for string ref " + mixedRef + ". This error is likely caused by a bug in React. Please file an issue." ); 39435 } 39436 } 39437 39438 var stringRef = '' + mixedRef; // Check if previous string ref matches new string ref 39439 39440 if (current !== null && current.ref !== null && typeof current.ref === 'function' && current.ref._stringRef === stringRef) { 39441 return current.ref; 39442 } 39443 39444 var ref = function (value) { 39445 var refs = inst.refs; 39446 39447 if (refs === emptyRefsObject) { 39448 // This is a lazy pooled frozen object, so we need to initialize. 39449 refs = inst.refs = {}; 39450 } 39451 39452 if (value === null) { 39453 delete refs[stringRef]; 39454 } else { 39455 refs[stringRef] = value; 39456 } 39457 }; 39458 39459 ref._stringRef = stringRef; 39460 return ref; 39461 } else { 39462 if (!(typeof mixedRef === 'string')) { 39463 { 39464 throw Error( "Expected ref to be a function, a string, an object returned by React.createRef(), or null." ); 39465 } 39466 } 39467 39468 if (!element._owner) { 39469 { 39470 throw Error( "Element ref was specified as a string (" + mixedRef + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information." ); 39471 } 39472 } 39473 } 39474 } 39475 39476 return mixedRef; 39477} 39478 39479function throwOnInvalidObjectType(returnFiber, newChild) { 39480 if (returnFiber.type !== 'textarea') { 39481 var addendum = ''; 39482 39483 { 39484 addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getCurrentFiberStackInDev(); 39485 } 39486 39487 { 39488 { 39489 throw Error( "Objects are not valid as a React child (found: " + (Object.prototype.toString.call(newChild) === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : newChild) + ")." + addendum ); 39490 } 39491 } 39492 } 39493} 39494 39495function warnOnFunctionType() { 39496 { 39497 var currentComponentErrorInfo = 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.' + getCurrentFiberStackInDev(); 39498 39499 if (ownerHasFunctionTypeWarning[currentComponentErrorInfo]) { 39500 return; 39501 } 39502 39503 ownerHasFunctionTypeWarning[currentComponentErrorInfo] = true; 39504 39505 error('Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.'); 39506 } 39507} // This wrapper function exists because I expect to clone the code in each path 39508// to be able to optimize each path individually by branching early. This needs 39509// a compiler or we can do it manually. Helpers that don't need this branching 39510// live outside of this function. 39511 39512 39513function ChildReconciler(shouldTrackSideEffects) { 39514 function deleteChild(returnFiber, childToDelete) { 39515 if (!shouldTrackSideEffects) { 39516 // Noop. 39517 return; 39518 } // Deletions are added in reversed order so we add it to the front. 39519 // At this point, the return fiber's effect list is empty except for 39520 // deletions, so we can just append the deletion to the list. The remaining 39521 // effects aren't added until the complete phase. Once we implement 39522 // resuming, this may not be true. 39523 39524 39525 var last = returnFiber.lastEffect; 39526 39527 if (last !== null) { 39528 last.nextEffect = childToDelete; 39529 returnFiber.lastEffect = childToDelete; 39530 } else { 39531 returnFiber.firstEffect = returnFiber.lastEffect = childToDelete; 39532 } 39533 39534 childToDelete.nextEffect = null; 39535 childToDelete.effectTag = Deletion; 39536 } 39537 39538 function deleteRemainingChildren(returnFiber, currentFirstChild) { 39539 if (!shouldTrackSideEffects) { 39540 // Noop. 39541 return null; 39542 } // TODO: For the shouldClone case, this could be micro-optimized a bit by 39543 // assuming that after the first child we've already added everything. 39544 39545 39546 var childToDelete = currentFirstChild; 39547 39548 while (childToDelete !== null) { 39549 deleteChild(returnFiber, childToDelete); 39550 childToDelete = childToDelete.sibling; 39551 } 39552 39553 return null; 39554 } 39555 39556 function mapRemainingChildren(returnFiber, currentFirstChild) { 39557 // Add the remaining children to a temporary map so that we can find them by 39558 // keys quickly. Implicit (null) keys get added to this set with their index 39559 // instead. 39560 var existingChildren = new Map(); 39561 var existingChild = currentFirstChild; 39562 39563 while (existingChild !== null) { 39564 if (existingChild.key !== null) { 39565 existingChildren.set(existingChild.key, existingChild); 39566 } else { 39567 existingChildren.set(existingChild.index, existingChild); 39568 } 39569 39570 existingChild = existingChild.sibling; 39571 } 39572 39573 return existingChildren; 39574 } 39575 39576 function useFiber(fiber, pendingProps) { 39577 // We currently set sibling to null and index to 0 here because it is easy 39578 // to forget to do before returning it. E.g. for the single child case. 39579 var clone = createWorkInProgress(fiber, pendingProps); 39580 clone.index = 0; 39581 clone.sibling = null; 39582 return clone; 39583 } 39584 39585 function placeChild(newFiber, lastPlacedIndex, newIndex) { 39586 newFiber.index = newIndex; 39587 39588 if (!shouldTrackSideEffects) { 39589 // Noop. 39590 return lastPlacedIndex; 39591 } 39592 39593 var current = newFiber.alternate; 39594 39595 if (current !== null) { 39596 var oldIndex = current.index; 39597 39598 if (oldIndex < lastPlacedIndex) { 39599 // This is a move. 39600 newFiber.effectTag = Placement; 39601 return lastPlacedIndex; 39602 } else { 39603 // This item can stay in place. 39604 return oldIndex; 39605 } 39606 } else { 39607 // This is an insertion. 39608 newFiber.effectTag = Placement; 39609 return lastPlacedIndex; 39610 } 39611 } 39612 39613 function placeSingleChild(newFiber) { 39614 // This is simpler for the single child case. We only need to do a 39615 // placement for inserting new children. 39616 if (shouldTrackSideEffects && newFiber.alternate === null) { 39617 newFiber.effectTag = Placement; 39618 } 39619 39620 return newFiber; 39621 } 39622 39623 function updateTextNode(returnFiber, current, textContent, expirationTime) { 39624 if (current === null || current.tag !== HostText) { 39625 // Insert 39626 var created = createFiberFromText(textContent, returnFiber.mode, expirationTime); 39627 created.return = returnFiber; 39628 return created; 39629 } else { 39630 // Update 39631 var existing = useFiber(current, textContent); 39632 existing.return = returnFiber; 39633 return existing; 39634 } 39635 } 39636 39637 function updateElement(returnFiber, current, element, expirationTime) { 39638 if (current !== null) { 39639 if (current.elementType === element.type || ( // Keep this check inline so it only runs on the false path: 39640 isCompatibleFamilyForHotReloading(current, element) )) { 39641 // Move based on index 39642 var existing = useFiber(current, element.props); 39643 existing.ref = coerceRef(returnFiber, current, element); 39644 existing.return = returnFiber; 39645 39646 { 39647 existing._debugSource = element._source; 39648 existing._debugOwner = element._owner; 39649 } 39650 39651 return existing; 39652 } 39653 } // Insert 39654 39655 39656 var created = createFiberFromElement(element, returnFiber.mode, expirationTime); 39657 created.ref = coerceRef(returnFiber, current, element); 39658 created.return = returnFiber; 39659 return created; 39660 } 39661 39662 function updatePortal(returnFiber, current, portal, expirationTime) { 39663 if (current === null || current.tag !== HostPortal || current.stateNode.containerInfo !== portal.containerInfo || current.stateNode.implementation !== portal.implementation) { 39664 // Insert 39665 var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime); 39666 created.return = returnFiber; 39667 return created; 39668 } else { 39669 // Update 39670 var existing = useFiber(current, portal.children || []); 39671 existing.return = returnFiber; 39672 return existing; 39673 } 39674 } 39675 39676 function updateFragment(returnFiber, current, fragment, expirationTime, key) { 39677 if (current === null || current.tag !== Fragment) { 39678 // Insert 39679 var created = createFiberFromFragment(fragment, returnFiber.mode, expirationTime, key); 39680 created.return = returnFiber; 39681 return created; 39682 } else { 39683 // Update 39684 var existing = useFiber(current, fragment); 39685 existing.return = returnFiber; 39686 return existing; 39687 } 39688 } 39689 39690 function createChild(returnFiber, newChild, expirationTime) { 39691 if (typeof newChild === 'string' || typeof newChild === 'number') { 39692 // Text nodes don't have keys. If the previous node is implicitly keyed 39693 // we can continue to replace it without aborting even if it is not a text 39694 // node. 39695 var created = createFiberFromText('' + newChild, returnFiber.mode, expirationTime); 39696 created.return = returnFiber; 39697 return created; 39698 } 39699 39700 if (typeof newChild === 'object' && newChild !== null) { 39701 switch (newChild.$$typeof) { 39702 case REACT_ELEMENT_TYPE: 39703 { 39704 var _created = createFiberFromElement(newChild, returnFiber.mode, expirationTime); 39705 39706 _created.ref = coerceRef(returnFiber, null, newChild); 39707 _created.return = returnFiber; 39708 return _created; 39709 } 39710 39711 case REACT_PORTAL_TYPE: 39712 { 39713 var _created2 = createFiberFromPortal(newChild, returnFiber.mode, expirationTime); 39714 39715 _created2.return = returnFiber; 39716 return _created2; 39717 } 39718 } 39719 39720 if (isArray$1(newChild) || getIteratorFn(newChild)) { 39721 var _created3 = createFiberFromFragment(newChild, returnFiber.mode, expirationTime, null); 39722 39723 _created3.return = returnFiber; 39724 return _created3; 39725 } 39726 39727 throwOnInvalidObjectType(returnFiber, newChild); 39728 } 39729 39730 { 39731 if (typeof newChild === 'function') { 39732 warnOnFunctionType(); 39733 } 39734 } 39735 39736 return null; 39737 } 39738 39739 function updateSlot(returnFiber, oldFiber, newChild, expirationTime) { 39740 // Update the fiber if the keys match, otherwise return null. 39741 var key = oldFiber !== null ? oldFiber.key : null; 39742 39743 if (typeof newChild === 'string' || typeof newChild === 'number') { 39744 // Text nodes don't have keys. If the previous node is implicitly keyed 39745 // we can continue to replace it without aborting even if it is not a text 39746 // node. 39747 if (key !== null) { 39748 return null; 39749 } 39750 39751 return updateTextNode(returnFiber, oldFiber, '' + newChild, expirationTime); 39752 } 39753 39754 if (typeof newChild === 'object' && newChild !== null) { 39755 switch (newChild.$$typeof) { 39756 case REACT_ELEMENT_TYPE: 39757 { 39758 if (newChild.key === key) { 39759 if (newChild.type === REACT_FRAGMENT_TYPE) { 39760 return updateFragment(returnFiber, oldFiber, newChild.props.children, expirationTime, key); 39761 } 39762 39763 return updateElement(returnFiber, oldFiber, newChild, expirationTime); 39764 } else { 39765 return null; 39766 } 39767 } 39768 39769 case REACT_PORTAL_TYPE: 39770 { 39771 if (newChild.key === key) { 39772 return updatePortal(returnFiber, oldFiber, newChild, expirationTime); 39773 } else { 39774 return null; 39775 } 39776 } 39777 } 39778 39779 if (isArray$1(newChild) || getIteratorFn(newChild)) { 39780 if (key !== null) { 39781 return null; 39782 } 39783 39784 return updateFragment(returnFiber, oldFiber, newChild, expirationTime, null); 39785 } 39786 39787 throwOnInvalidObjectType(returnFiber, newChild); 39788 } 39789 39790 { 39791 if (typeof newChild === 'function') { 39792 warnOnFunctionType(); 39793 } 39794 } 39795 39796 return null; 39797 } 39798 39799 function updateFromMap(existingChildren, returnFiber, newIdx, newChild, expirationTime) { 39800 if (typeof newChild === 'string' || typeof newChild === 'number') { 39801 // Text nodes don't have keys, so we neither have to check the old nor 39802 // new node for the key. If both are text nodes, they match. 39803 var matchedFiber = existingChildren.get(newIdx) || null; 39804 return updateTextNode(returnFiber, matchedFiber, '' + newChild, expirationTime); 39805 } 39806 39807 if (typeof newChild === 'object' && newChild !== null) { 39808 switch (newChild.$$typeof) { 39809 case REACT_ELEMENT_TYPE: 39810 { 39811 var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null; 39812 39813 if (newChild.type === REACT_FRAGMENT_TYPE) { 39814 return updateFragment(returnFiber, _matchedFiber, newChild.props.children, expirationTime, newChild.key); 39815 } 39816 39817 return updateElement(returnFiber, _matchedFiber, newChild, expirationTime); 39818 } 39819 39820 case REACT_PORTAL_TYPE: 39821 { 39822 var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null; 39823 39824 return updatePortal(returnFiber, _matchedFiber2, newChild, expirationTime); 39825 } 39826 } 39827 39828 if (isArray$1(newChild) || getIteratorFn(newChild)) { 39829 var _matchedFiber3 = existingChildren.get(newIdx) || null; 39830 39831 return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null); 39832 } 39833 39834 throwOnInvalidObjectType(returnFiber, newChild); 39835 } 39836 39837 { 39838 if (typeof newChild === 'function') { 39839 warnOnFunctionType(); 39840 } 39841 } 39842 39843 return null; 39844 } 39845 /** 39846 * Warns if there is a duplicate or missing key 39847 */ 39848 39849 39850 function warnOnInvalidKey(child, knownKeys) { 39851 { 39852 if (typeof child !== 'object' || child === null) { 39853 return knownKeys; 39854 } 39855 39856 switch (child.$$typeof) { 39857 case REACT_ELEMENT_TYPE: 39858 case REACT_PORTAL_TYPE: 39859 warnForMissingKey(child); 39860 var key = child.key; 39861 39862 if (typeof key !== 'string') { 39863 break; 39864 } 39865 39866 if (knownKeys === null) { 39867 knownKeys = new Set(); 39868 knownKeys.add(key); 39869 break; 39870 } 39871 39872 if (!knownKeys.has(key)) { 39873 knownKeys.add(key); 39874 break; 39875 } 39876 39877 error('Encountered two children with the same key, `%s`. ' + 'Keys should be unique so that components maintain their identity ' + 'across updates. Non-unique keys may cause children to be ' + 'duplicated and/or omitted â the behavior is unsupported and ' + 'could change in a future version.', key); 39878 39879 break; 39880 } 39881 } 39882 39883 return knownKeys; 39884 } 39885 39886 function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, expirationTime) { 39887 // This algorithm can't optimize by searching from both ends since we 39888 // don't have backpointers on fibers. I'm trying to see how far we can get 39889 // with that model. If it ends up not being worth the tradeoffs, we can 39890 // add it later. 39891 // Even with a two ended optimization, we'd want to optimize for the case 39892 // where there are few changes and brute force the comparison instead of 39893 // going for the Map. It'd like to explore hitting that path first in 39894 // forward-only mode and only go for the Map once we notice that we need 39895 // lots of look ahead. This doesn't handle reversal as well as two ended 39896 // search but that's unusual. Besides, for the two ended optimization to 39897 // work on Iterables, we'd need to copy the whole set. 39898 // In this first iteration, we'll just live with hitting the bad case 39899 // (adding everything to a Map) in for every insert/move. 39900 // If you change this code, also update reconcileChildrenIterator() which 39901 // uses the same algorithm. 39902 { 39903 // First, validate keys. 39904 var knownKeys = null; 39905 39906 for (var i = 0; i < newChildren.length; i++) { 39907 var child = newChildren[i]; 39908 knownKeys = warnOnInvalidKey(child, knownKeys); 39909 } 39910 } 39911 39912 var resultingFirstChild = null; 39913 var previousNewFiber = null; 39914 var oldFiber = currentFirstChild; 39915 var lastPlacedIndex = 0; 39916 var newIdx = 0; 39917 var nextOldFiber = null; 39918 39919 for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) { 39920 if (oldFiber.index > newIdx) { 39921 nextOldFiber = oldFiber; 39922 oldFiber = null; 39923 } else { 39924 nextOldFiber = oldFiber.sibling; 39925 } 39926 39927 var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], expirationTime); 39928 39929 if (newFiber === null) { 39930 // TODO: This breaks on empty slots like null children. That's 39931 // unfortunate because it triggers the slow path all the time. We need 39932 // a better way to communicate whether this was a miss or null, 39933 // boolean, undefined, etc. 39934 if (oldFiber === null) { 39935 oldFiber = nextOldFiber; 39936 } 39937 39938 break; 39939 } 39940 39941 if (shouldTrackSideEffects) { 39942 if (oldFiber && newFiber.alternate === null) { 39943 // We matched the slot, but we didn't reuse the existing fiber, so we 39944 // need to delete the existing child. 39945 deleteChild(returnFiber, oldFiber); 39946 } 39947 } 39948 39949 lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); 39950 39951 if (previousNewFiber === null) { 39952 // TODO: Move out of the loop. This only happens for the first run. 39953 resultingFirstChild = newFiber; 39954 } else { 39955 // TODO: Defer siblings if we're not at the right index for this slot. 39956 // I.e. if we had null values before, then we want to defer this 39957 // for each null value. However, we also don't want to call updateSlot 39958 // with the previous one. 39959 previousNewFiber.sibling = newFiber; 39960 } 39961 39962 previousNewFiber = newFiber; 39963 oldFiber = nextOldFiber; 39964 } 39965 39966 if (newIdx === newChildren.length) { 39967 // We've reached the end of the new children. We can delete the rest. 39968 deleteRemainingChildren(returnFiber, oldFiber); 39969 return resultingFirstChild; 39970 } 39971 39972 if (oldFiber === null) { 39973 // If we don't have any more existing children we can choose a fast path 39974 // since the rest will all be insertions. 39975 for (; newIdx < newChildren.length; newIdx++) { 39976 var _newFiber = createChild(returnFiber, newChildren[newIdx], expirationTime); 39977 39978 if (_newFiber === null) { 39979 continue; 39980 } 39981 39982 lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx); 39983 39984 if (previousNewFiber === null) { 39985 // TODO: Move out of the loop. This only happens for the first run. 39986 resultingFirstChild = _newFiber; 39987 } else { 39988 previousNewFiber.sibling = _newFiber; 39989 } 39990 39991 previousNewFiber = _newFiber; 39992 } 39993 39994 return resultingFirstChild; 39995 } // Add all children to a key map for quick lookups. 39996 39997 39998 var existingChildren = mapRemainingChildren(returnFiber, oldFiber); // Keep scanning and use the map to restore deleted items as moves. 39999 40000 for (; newIdx < newChildren.length; newIdx++) { 40001 var _newFiber2 = updateFromMap(existingChildren, returnFiber, newIdx, newChildren[newIdx], expirationTime); 40002 40003 if (_newFiber2 !== null) { 40004 if (shouldTrackSideEffects) { 40005 if (_newFiber2.alternate !== null) { 40006 // The new fiber is a work in progress, but if there exists a 40007 // current, that means that we reused the fiber. We need to delete 40008 // it from the child list so that we don't add it to the deletion 40009 // list. 40010 existingChildren.delete(_newFiber2.key === null ? newIdx : _newFiber2.key); 40011 } 40012 } 40013 40014 lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx); 40015 40016 if (previousNewFiber === null) { 40017 resultingFirstChild = _newFiber2; 40018 } else { 40019 previousNewFiber.sibling = _newFiber2; 40020 } 40021 40022 previousNewFiber = _newFiber2; 40023 } 40024 } 40025 40026 if (shouldTrackSideEffects) { 40027 // Any existing children that weren't consumed above were deleted. We need 40028 // to add them to the deletion list. 40029 existingChildren.forEach(function (child) { 40030 return deleteChild(returnFiber, child); 40031 }); 40032 } 40033 40034 return resultingFirstChild; 40035 } 40036 40037 function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, expirationTime) { 40038 // This is the same implementation as reconcileChildrenArray(), 40039 // but using the iterator instead. 40040 var iteratorFn = getIteratorFn(newChildrenIterable); 40041 40042 if (!(typeof iteratorFn === 'function')) { 40043 { 40044 throw Error( "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." ); 40045 } 40046 } 40047 40048 { 40049 // We don't support rendering Generators because it's a mutation. 40050 // See https://github.com/facebook/react/issues/12995 40051 if (typeof Symbol === 'function' && // $FlowFixMe Flow doesn't know about toStringTag 40052 newChildrenIterable[Symbol.toStringTag] === 'Generator') { 40053 if (!didWarnAboutGenerators) { 40054 error('Using Generators as children is unsupported and will likely yield ' + 'unexpected results because enumerating a generator mutates it. ' + 'You may convert it to an array with `Array.from()` or the ' + '`[...spread]` operator before rendering. Keep in mind ' + 'you might need to polyfill these features for older browsers.'); 40055 } 40056 40057 didWarnAboutGenerators = true; 40058 } // Warn about using Maps as children 40059 40060 40061 if (newChildrenIterable.entries === iteratorFn) { 40062 if (!didWarnAboutMaps) { 40063 error('Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.'); 40064 } 40065 40066 didWarnAboutMaps = true; 40067 } // First, validate keys. 40068 // We'll get a different iterator later for the main pass. 40069 40070 40071 var _newChildren = iteratorFn.call(newChildrenIterable); 40072 40073 if (_newChildren) { 40074 var knownKeys = null; 40075 40076 var _step = _newChildren.next(); 40077 40078 for (; !_step.done; _step = _newChildren.next()) { 40079 var child = _step.value; 40080 knownKeys = warnOnInvalidKey(child, knownKeys); 40081 } 40082 } 40083 } 40084 40085 var newChildren = iteratorFn.call(newChildrenIterable); 40086 40087 if (!(newChildren != null)) { 40088 { 40089 throw Error( "An iterable object provided no iterator." ); 40090 } 40091 } 40092 40093 var resultingFirstChild = null; 40094 var previousNewFiber = null; 40095 var oldFiber = currentFirstChild; 40096 var lastPlacedIndex = 0; 40097 var newIdx = 0; 40098 var nextOldFiber = null; 40099 var step = newChildren.next(); 40100 40101 for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) { 40102 if (oldFiber.index > newIdx) { 40103 nextOldFiber = oldFiber; 40104 oldFiber = null; 40105 } else { 40106 nextOldFiber = oldFiber.sibling; 40107 } 40108 40109 var newFiber = updateSlot(returnFiber, oldFiber, step.value, expirationTime); 40110 40111 if (newFiber === null) { 40112 // TODO: This breaks on empty slots like null children. That's 40113 // unfortunate because it triggers the slow path all the time. We need 40114 // a better way to communicate whether this was a miss or null, 40115 // boolean, undefined, etc. 40116 if (oldFiber === null) { 40117 oldFiber = nextOldFiber; 40118 } 40119 40120 break; 40121 } 40122 40123 if (shouldTrackSideEffects) { 40124 if (oldFiber && newFiber.alternate === null) { 40125 // We matched the slot, but we didn't reuse the existing fiber, so we 40126 // need to delete the existing child. 40127 deleteChild(returnFiber, oldFiber); 40128 } 40129 } 40130 40131 lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); 40132 40133 if (previousNewFiber === null) { 40134 // TODO: Move out of the loop. This only happens for the first run. 40135 resultingFirstChild = newFiber; 40136 } else { 40137 // TODO: Defer siblings if we're not at the right index for this slot. 40138 // I.e. if we had null values before, then we want to defer this 40139 // for each null value. However, we also don't want to call updateSlot 40140 // with the previous one. 40141 previousNewFiber.sibling = newFiber; 40142 } 40143 40144 previousNewFiber = newFiber; 40145 oldFiber = nextOldFiber; 40146 } 40147 40148 if (step.done) { 40149 // We've reached the end of the new children. We can delete the rest. 40150 deleteRemainingChildren(returnFiber, oldFiber); 40151 return resultingFirstChild; 40152 } 40153 40154 if (oldFiber === null) { 40155 // If we don't have any more existing children we can choose a fast path 40156 // since the rest will all be insertions. 40157 for (; !step.done; newIdx++, step = newChildren.next()) { 40158 var _newFiber3 = createChild(returnFiber, step.value, expirationTime); 40159 40160 if (_newFiber3 === null) { 40161 continue; 40162 } 40163 40164 lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx); 40165 40166 if (previousNewFiber === null) { 40167 // TODO: Move out of the loop. This only happens for the first run. 40168 resultingFirstChild = _newFiber3; 40169 } else { 40170 previousNewFiber.sibling = _newFiber3; 40171 } 40172 40173 previousNewFiber = _newFiber3; 40174 } 40175 40176 return resultingFirstChild; 40177 } // Add all children to a key map for quick lookups. 40178 40179 40180 var existingChildren = mapRemainingChildren(returnFiber, oldFiber); // Keep scanning and use the map to restore deleted items as moves. 40181 40182 for (; !step.done; newIdx++, step = newChildren.next()) { 40183 var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, expirationTime); 40184 40185 if (_newFiber4 !== null) { 40186 if (shouldTrackSideEffects) { 40187 if (_newFiber4.alternate !== null) { 40188 // The new fiber is a work in progress, but if there exists a 40189 // current, that means that we reused the fiber. We need to delete 40190 // it from the child list so that we don't add it to the deletion 40191 // list. 40192 existingChildren.delete(_newFiber4.key === null ? newIdx : _newFiber4.key); 40193 } 40194 } 40195 40196 lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx); 40197 40198 if (previousNewFiber === null) { 40199 resultingFirstChild = _newFiber4; 40200 } else { 40201 previousNewFiber.sibling = _newFiber4; 40202 } 40203 40204 previousNewFiber = _newFiber4; 40205 } 40206 } 40207 40208 if (shouldTrackSideEffects) { 40209 // Any existing children that weren't consumed above were deleted. We need 40210 // to add them to the deletion list. 40211 existingChildren.forEach(function (child) { 40212 return deleteChild(returnFiber, child); 40213 }); 40214 } 40215 40216 return resultingFirstChild; 40217 } 40218 40219 function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent, expirationTime) { 40220 // There's no need to check for keys on text nodes since we don't have a 40221 // way to define them. 40222 if (currentFirstChild !== null && currentFirstChild.tag === HostText) { 40223 // We already have an existing node so let's just update it and delete 40224 // the rest. 40225 deleteRemainingChildren(returnFiber, currentFirstChild.sibling); 40226 var existing = useFiber(currentFirstChild, textContent); 40227 existing.return = returnFiber; 40228 return existing; 40229 } // The existing first child is not a text node so we need to create one 40230 // and delete the existing ones. 40231 40232 40233 deleteRemainingChildren(returnFiber, currentFirstChild); 40234 var created = createFiberFromText(textContent, returnFiber.mode, expirationTime); 40235 created.return = returnFiber; 40236 return created; 40237 } 40238 40239 function reconcileSingleElement(returnFiber, currentFirstChild, element, expirationTime) { 40240 var key = element.key; 40241 var child = currentFirstChild; 40242 40243 while (child !== null) { 40244 // TODO: If key === null and child.key === null, then this only applies to 40245 // the first item in the list. 40246 if (child.key === key) { 40247 switch (child.tag) { 40248 case Fragment: 40249 { 40250 if (element.type === REACT_FRAGMENT_TYPE) { 40251 deleteRemainingChildren(returnFiber, child.sibling); 40252 var existing = useFiber(child, element.props.children); 40253 existing.return = returnFiber; 40254 40255 { 40256 existing._debugSource = element._source; 40257 existing._debugOwner = element._owner; 40258 } 40259 40260 return existing; 40261 } 40262 40263 break; 40264 } 40265 40266 case Block: 40267 40268 // We intentionally fallthrough here if enableBlocksAPI is not on. 40269 // eslint-disable-next-lined no-fallthrough 40270 40271 default: 40272 { 40273 if (child.elementType === element.type || ( // Keep this check inline so it only runs on the false path: 40274 isCompatibleFamilyForHotReloading(child, element) )) { 40275 deleteRemainingChildren(returnFiber, child.sibling); 40276 40277 var _existing3 = useFiber(child, element.props); 40278 40279 _existing3.ref = coerceRef(returnFiber, child, element); 40280 _existing3.return = returnFiber; 40281 40282 { 40283 _existing3._debugSource = element._source; 40284 _existing3._debugOwner = element._owner; 40285 } 40286 40287 return _existing3; 40288 } 40289 40290 break; 40291 } 40292 } // Didn't match. 40293 40294 40295 deleteRemainingChildren(returnFiber, child); 40296 break; 40297 } else { 40298 deleteChild(returnFiber, child); 40299 } 40300 40301 child = child.sibling; 40302 } 40303 40304 if (element.type === REACT_FRAGMENT_TYPE) { 40305 var created = createFiberFromFragment(element.props.children, returnFiber.mode, expirationTime, element.key); 40306 created.return = returnFiber; 40307 return created; 40308 } else { 40309 var _created4 = createFiberFromElement(element, returnFiber.mode, expirationTime); 40310 40311 _created4.ref = coerceRef(returnFiber, currentFirstChild, element); 40312 _created4.return = returnFiber; 40313 return _created4; 40314 } 40315 } 40316 40317 function reconcileSinglePortal(returnFiber, currentFirstChild, portal, expirationTime) { 40318 var key = portal.key; 40319 var child = currentFirstChild; 40320 40321 while (child !== null) { 40322 // TODO: If key === null and child.key === null, then this only applies to 40323 // the first item in the list. 40324 if (child.key === key) { 40325 if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) { 40326 deleteRemainingChildren(returnFiber, child.sibling); 40327 var existing = useFiber(child, portal.children || []); 40328 existing.return = returnFiber; 40329 return existing; 40330 } else { 40331 deleteRemainingChildren(returnFiber, child); 40332 break; 40333 } 40334 } else { 40335 deleteChild(returnFiber, child); 40336 } 40337 40338 child = child.sibling; 40339 } 40340 40341 var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime); 40342 created.return = returnFiber; 40343 return created; 40344 } // This API will tag the children with the side-effect of the reconciliation 40345 // itself. They will be added to the side-effect list as we pass through the 40346 // children and the parent. 40347 40348 40349 function reconcileChildFibers(returnFiber, currentFirstChild, newChild, expirationTime) { 40350 // This function is not recursive. 40351 // If the top level item is an array, we treat it as a set of children, 40352 // not as a fragment. Nested arrays on the other hand will be treated as 40353 // fragment nodes. Recursion happens at the normal flow. 40354 // Handle top level unkeyed fragments as if they were arrays. 40355 // This leads to an ambiguity between <>{[...]}</> and <>...</>. 40356 // We treat the ambiguous cases above the same. 40357 var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null; 40358 40359 if (isUnkeyedTopLevelFragment) { 40360 newChild = newChild.props.children; 40361 } // Handle object types 40362 40363 40364 var isObject = typeof newChild === 'object' && newChild !== null; 40365 40366 if (isObject) { 40367 switch (newChild.$$typeof) { 40368 case REACT_ELEMENT_TYPE: 40369 return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, expirationTime)); 40370 40371 case REACT_PORTAL_TYPE: 40372 return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, expirationTime)); 40373 } 40374 } 40375 40376 if (typeof newChild === 'string' || typeof newChild === 'number') { 40377 return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, '' + newChild, expirationTime)); 40378 } 40379 40380 if (isArray$1(newChild)) { 40381 return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, expirationTime); 40382 } 40383 40384 if (getIteratorFn(newChild)) { 40385 return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, expirationTime); 40386 } 40387 40388 if (isObject) { 40389 throwOnInvalidObjectType(returnFiber, newChild); 40390 } 40391 40392 { 40393 if (typeof newChild === 'function') { 40394 warnOnFunctionType(); 40395 } 40396 } 40397 40398 if (typeof newChild === 'undefined' && !isUnkeyedTopLevelFragment) { 40399 // If the new child is undefined, and the return fiber is a composite 40400 // component, throw an error. If Fiber return types are disabled, 40401 // we already threw above. 40402 switch (returnFiber.tag) { 40403 case ClassComponent: 40404 { 40405 { 40406 var instance = returnFiber.stateNode; 40407 40408 if (instance.render._isMockFunction) { 40409 // We allow auto-mocks to proceed as if they're returning null. 40410 break; 40411 } 40412 } 40413 } 40414 // Intentionally fall through to the next case, which handles both 40415 // functions and classes 40416 // eslint-disable-next-lined no-fallthrough 40417 40418 case FunctionComponent: 40419 { 40420 var Component = returnFiber.type; 40421 40422 { 40423 { 40424 throw Error( (Component.displayName || Component.name || 'Component') + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." ); 40425 } 40426 } 40427 } 40428 } 40429 } // Remaining cases are all treated as empty. 40430 40431 40432 return deleteRemainingChildren(returnFiber, currentFirstChild); 40433 } 40434 40435 return reconcileChildFibers; 40436} 40437 40438var reconcileChildFibers = ChildReconciler(true); 40439var mountChildFibers = ChildReconciler(false); 40440function cloneChildFibers(current, workInProgress) { 40441 if (!(current === null || workInProgress.child === current.child)) { 40442 { 40443 throw Error( "Resuming work not yet implemented." ); 40444 } 40445 } 40446 40447 if (workInProgress.child === null) { 40448 return; 40449 } 40450 40451 var currentChild = workInProgress.child; 40452 var newChild = createWorkInProgress(currentChild, currentChild.pendingProps); 40453 workInProgress.child = newChild; 40454 newChild.return = workInProgress; 40455 40456 while (currentChild.sibling !== null) { 40457 currentChild = currentChild.sibling; 40458 newChild = newChild.sibling = createWorkInProgress(currentChild, currentChild.pendingProps); 40459 newChild.return = workInProgress; 40460 } 40461 40462 newChild.sibling = null; 40463} // Reset a workInProgress child set to prepare it for a second pass. 40464 40465function resetChildFibers(workInProgress, renderExpirationTime) { 40466 var child = workInProgress.child; 40467 40468 while (child !== null) { 40469 resetWorkInProgress(child, renderExpirationTime); 40470 child = child.sibling; 40471 } 40472} 40473 40474var NO_CONTEXT = {}; 40475var contextStackCursor$1 = createCursor(NO_CONTEXT); 40476var contextFiberStackCursor = createCursor(NO_CONTEXT); 40477var rootInstanceStackCursor = createCursor(NO_CONTEXT); 40478 40479function requiredContext(c) { 40480 if (!(c !== NO_CONTEXT)) { 40481 { 40482 throw Error( "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." ); 40483 } 40484 } 40485 40486 return c; 40487} 40488 40489function getRootHostContainer() { 40490 var rootInstance = requiredContext(rootInstanceStackCursor.current); 40491 return rootInstance; 40492} 40493 40494function pushHostContainer(fiber, nextRootInstance) { 40495 // Push current root instance onto the stack; 40496 // This allows us to reset root when portals are popped. 40497 push(rootInstanceStackCursor, nextRootInstance, fiber); // Track the context and the Fiber that provided it. 40498 // This enables us to pop only Fibers that provide unique contexts. 40499 40500 push(contextFiberStackCursor, fiber, fiber); // Finally, we need to push the host context to the stack. 40501 // However, we can't just call getRootHostContext() and push it because 40502 // we'd have a different number of entries on the stack depending on 40503 // whether getRootHostContext() throws somewhere in renderer code or not. 40504 // So we push an empty value first. This lets us safely unwind on errors. 40505 40506 push(contextStackCursor$1, NO_CONTEXT, fiber); 40507 var nextRootContext = getRootHostContext(nextRootInstance); // Now that we know this function doesn't throw, replace it. 40508 40509 pop(contextStackCursor$1, fiber); 40510 push(contextStackCursor$1, nextRootContext, fiber); 40511} 40512 40513function popHostContainer(fiber) { 40514 pop(contextStackCursor$1, fiber); 40515 pop(contextFiberStackCursor, fiber); 40516 pop(rootInstanceStackCursor, fiber); 40517} 40518 40519function getHostContext() { 40520 var context = requiredContext(contextStackCursor$1.current); 40521 return context; 40522} 40523 40524function pushHostContext(fiber) { 40525 var rootInstance = requiredContext(rootInstanceStackCursor.current); 40526 var context = requiredContext(contextStackCursor$1.current); 40527 var nextContext = getChildHostContext(context, fiber.type); // Don't push this Fiber's context unless it's unique. 40528 40529 if (context === nextContext) { 40530 return; 40531 } // Track the context and the Fiber that provided it. 40532 // This enables us to pop only Fibers that provide unique contexts. 40533 40534 40535 push(contextFiberStackCursor, fiber, fiber); 40536 push(contextStackCursor$1, nextContext, fiber); 40537} 40538 40539function popHostContext(fiber) { 40540 // Do not pop unless this Fiber provided the current context. 40541 // pushHostContext() only pushes Fibers that provide unique contexts. 40542 if (contextFiberStackCursor.current !== fiber) { 40543 return; 40544 } 40545 40546 pop(contextStackCursor$1, fiber); 40547 pop(contextFiberStackCursor, fiber); 40548} 40549 40550var DefaultSuspenseContext = 0; // The Suspense Context is split into two parts. The lower bits is 40551// inherited deeply down the subtree. The upper bits only affect 40552// this immediate suspense boundary and gets reset each new 40553// boundary or suspense list. 40554 40555var SubtreeSuspenseContextMask = 1; // Subtree Flags: 40556// InvisibleParentSuspenseContext indicates that one of our parent Suspense 40557// boundaries is not currently showing visible main content. 40558// Either because it is already showing a fallback or is not mounted at all. 40559// We can use this to determine if it is desirable to trigger a fallback at 40560// the parent. If not, then we might need to trigger undesirable boundaries 40561// and/or suspend the commit to avoid hiding the parent content. 40562 40563var InvisibleParentSuspenseContext = 1; // Shallow Flags: 40564// ForceSuspenseFallback can be used by SuspenseList to force newly added 40565// items into their fallback state during one of the render passes. 40566 40567var ForceSuspenseFallback = 2; 40568var suspenseStackCursor = createCursor(DefaultSuspenseContext); 40569function hasSuspenseContext(parentContext, flag) { 40570 return (parentContext & flag) !== 0; 40571} 40572function setDefaultShallowSuspenseContext(parentContext) { 40573 return parentContext & SubtreeSuspenseContextMask; 40574} 40575function setShallowSuspenseContext(parentContext, shallowContext) { 40576 return parentContext & SubtreeSuspenseContextMask | shallowContext; 40577} 40578function addSubtreeSuspenseContext(parentContext, subtreeContext) { 40579 return parentContext | subtreeContext; 40580} 40581function pushSuspenseContext(fiber, newContext) { 40582 push(suspenseStackCursor, newContext, fiber); 40583} 40584function popSuspenseContext(fiber) { 40585 pop(suspenseStackCursor, fiber); 40586} 40587 40588function shouldCaptureSuspense(workInProgress, hasInvisibleParent) { 40589 // If it was the primary children that just suspended, capture and render the 40590 // fallback. Otherwise, don't capture and bubble to the next boundary. 40591 var nextState = workInProgress.memoizedState; 40592 40593 if (nextState !== null) { 40594 if (nextState.dehydrated !== null) { 40595 // A dehydrated boundary always captures. 40596 return true; 40597 } 40598 40599 return false; 40600 } 40601 40602 var props = workInProgress.memoizedProps; // In order to capture, the Suspense component must have a fallback prop. 40603 40604 if (props.fallback === undefined) { 40605 return false; 40606 } // Regular boundaries always capture. 40607 40608 40609 if (props.unstable_avoidThisFallback !== true) { 40610 return true; 40611 } // If it's a boundary we should avoid, then we prefer to bubble up to the 40612 // parent boundary if it is currently invisible. 40613 40614 40615 if (hasInvisibleParent) { 40616 return false; 40617 } // If the parent is not able to handle it, we must handle it. 40618 40619 40620 return true; 40621} 40622function findFirstSuspended(row) { 40623 var node = row; 40624 40625 while (node !== null) { 40626 if (node.tag === SuspenseComponent) { 40627 var state = node.memoizedState; 40628 40629 if (state !== null) { 40630 var dehydrated = state.dehydrated; 40631 40632 if (dehydrated === null || isSuspenseInstancePending(dehydrated) || isSuspenseInstanceFallback(dehydrated)) { 40633 return node; 40634 } 40635 } 40636 } else if (node.tag === SuspenseListComponent && // revealOrder undefined can't be trusted because it don't 40637 // keep track of whether it suspended or not. 40638 node.memoizedProps.revealOrder !== undefined) { 40639 var didSuspend = (node.effectTag & DidCapture) !== NoEffect; 40640 40641 if (didSuspend) { 40642 return node; 40643 } 40644 } else if (node.child !== null) { 40645 node.child.return = node; 40646 node = node.child; 40647 continue; 40648 } 40649 40650 if (node === row) { 40651 return null; 40652 } 40653 40654 while (node.sibling === null) { 40655 if (node.return === null || node.return === row) { 40656 return null; 40657 } 40658 40659 node = node.return; 40660 } 40661 40662 node.sibling.return = node.return; 40663 node = node.sibling; 40664 } 40665 40666 return null; 40667} 40668 40669function createDeprecatedResponderListener(responder, props) { 40670 var eventResponderListener = { 40671 responder: responder, 40672 props: props 40673 }; 40674 40675 { 40676 Object.freeze(eventResponderListener); 40677 } 40678 40679 return eventResponderListener; 40680} 40681 40682var HasEffect = 40683/* */ 406841; // Represents the phase in which the effect (not the clean-up) fires. 40685 40686var Layout = 40687/* */ 406882; 40689var Passive$1 = 40690/* */ 406914; 40692 40693var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, 40694 ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; 40695var didWarnAboutMismatchedHooksForComponent; 40696 40697{ 40698 didWarnAboutMismatchedHooksForComponent = new Set(); 40699} 40700 40701// These are set right before calling the component. 40702var renderExpirationTime = NoWork; // The work-in-progress fiber. I've named it differently to distinguish it from 40703// the work-in-progress hook. 40704 40705var currentlyRenderingFiber$1 = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The 40706// current hook list is the list that belongs to the current fiber. The 40707// work-in-progress hook list is a new list that will be added to the 40708// work-in-progress fiber. 40709 40710var currentHook = null; 40711var workInProgressHook = null; // Whether an update was scheduled at any point during the render phase. This 40712// does not get reset if we do another render pass; only when we're completely 40713// finished evaluating this component. This is an optimization so we know 40714// whether we need to clear render phase updates after a throw. 40715 40716var didScheduleRenderPhaseUpdate = false; 40717var RE_RENDER_LIMIT = 25; // In DEV, this is the name of the currently executing primitive hook 40718 40719var currentHookNameInDev = null; // In DEV, this list ensures that hooks are called in the same order between renders. 40720// The list stores the order of hooks used during the initial render (mount). 40721// Subsequent renders (updates) reference this list. 40722 40723var hookTypesDev = null; 40724var hookTypesUpdateIndexDev = -1; // In DEV, this tracks whether currently rendering component needs to ignore 40725// the dependencies for Hooks that need them (e.g. useEffect or useMemo). 40726// When true, such Hooks will always be "remounted". Only used during hot reload. 40727 40728var ignorePreviousDependencies = false; 40729 40730function mountHookTypesDev() { 40731 { 40732 var hookName = currentHookNameInDev; 40733 40734 if (hookTypesDev === null) { 40735 hookTypesDev = [hookName]; 40736 } else { 40737 hookTypesDev.push(hookName); 40738 } 40739 } 40740} 40741 40742function updateHookTypesDev() { 40743 { 40744 var hookName = currentHookNameInDev; 40745 40746 if (hookTypesDev !== null) { 40747 hookTypesUpdateIndexDev++; 40748 40749 if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) { 40750 warnOnHookMismatchInDev(hookName); 40751 } 40752 } 40753 } 40754} 40755 40756function checkDepsAreArrayDev(deps) { 40757 { 40758 if (deps !== undefined && deps !== null && !Array.isArray(deps)) { 40759 // Verify deps, but only on mount to avoid extra checks. 40760 // It's unlikely their type would change as usually you define them inline. 40761 error('%s received a final argument that is not an array (instead, received `%s`). When ' + 'specified, the final argument must be an array.', currentHookNameInDev, typeof deps); 40762 } 40763 } 40764} 40765 40766function warnOnHookMismatchInDev(currentHookName) { 40767 { 40768 var componentName = getComponentName(currentlyRenderingFiber$1.type); 40769 40770 if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) { 40771 didWarnAboutMismatchedHooksForComponent.add(componentName); 40772 40773 if (hookTypesDev !== null) { 40774 var table = ''; 40775 var secondColumnStart = 30; 40776 40777 for (var i = 0; i <= hookTypesUpdateIndexDev; i++) { 40778 var oldHookName = hookTypesDev[i]; 40779 var newHookName = i === hookTypesUpdateIndexDev ? currentHookName : oldHookName; 40780 var row = i + 1 + ". " + oldHookName; // Extra space so second column lines up 40781 // lol @ IE not supporting String#repeat 40782 40783 while (row.length < secondColumnStart) { 40784 row += ' '; 40785 } 40786 40787 row += newHookName + '\n'; 40788 table += row; 40789 } 40790 40791 error('React has detected a change in the order of Hooks called by %s. ' + 'This will lead to bugs and errors if not fixed. ' + 'For more information, read the Rules of Hooks: https://fb.me/rules-of-hooks\n\n' + ' Previous render Next render\n' + ' ------------------------------------------------------\n' + '%s' + ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n', componentName, table); 40792 } 40793 } 40794 } 40795} 40796 40797function throwInvalidHookError() { 40798 { 40799 { 40800 throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." ); 40801 } 40802 } 40803} 40804 40805function areHookInputsEqual(nextDeps, prevDeps) { 40806 { 40807 if (ignorePreviousDependencies) { 40808 // Only true when this component is being hot reloaded. 40809 return false; 40810 } 40811 } 40812 40813 if (prevDeps === null) { 40814 { 40815 error('%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev); 40816 } 40817 40818 return false; 40819 } 40820 40821 { 40822 // Don't bother comparing lengths in prod because these arrays should be 40823 // passed inline. 40824 if (nextDeps.length !== prevDeps.length) { 40825 error('The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, "[" + prevDeps.join(', ') + "]", "[" + nextDeps.join(', ') + "]"); 40826 } 40827 } 40828 40829 for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) { 40830 if (objectIs(nextDeps[i], prevDeps[i])) { 40831 continue; 40832 } 40833 40834 return false; 40835 } 40836 40837 return true; 40838} 40839 40840function renderWithHooks(current, workInProgress, Component, props, secondArg, nextRenderExpirationTime) { 40841 renderExpirationTime = nextRenderExpirationTime; 40842 currentlyRenderingFiber$1 = workInProgress; 40843 40844 { 40845 hookTypesDev = current !== null ? current._debugHookTypes : null; 40846 hookTypesUpdateIndexDev = -1; // Used for hot reloading: 40847 40848 ignorePreviousDependencies = current !== null && current.type !== workInProgress.type; 40849 } 40850 40851 workInProgress.memoizedState = null; 40852 workInProgress.updateQueue = null; 40853 workInProgress.expirationTime = NoWork; // The following should have already been reset 40854 // currentHook = null; 40855 // workInProgressHook = null; 40856 // didScheduleRenderPhaseUpdate = false; 40857 // TODO Warn if no hooks are used at all during mount, then some are used during update. 40858 // Currently we will identify the update render as a mount because memoizedState === null. 40859 // This is tricky because it's valid for certain types of components (e.g. React.lazy) 40860 // Using memoizedState to differentiate between mount/update only works if at least one stateful hook is used. 40861 // Non-stateful hooks (e.g. context) don't get added to memoizedState, 40862 // so memoizedState would be null during updates and mounts. 40863 40864 { 40865 if (current !== null && current.memoizedState !== null) { 40866 ReactCurrentDispatcher.current = HooksDispatcherOnUpdateInDEV; 40867 } else if (hookTypesDev !== null) { 40868 // This dispatcher handles an edge case where a component is updating, 40869 // but no stateful hooks have been used. 40870 // We want to match the production code behavior (which will use HooksDispatcherOnMount), 40871 // but with the extra DEV validation to ensure hooks ordering hasn't changed. 40872 // This dispatcher does that. 40873 ReactCurrentDispatcher.current = HooksDispatcherOnMountWithHookTypesInDEV; 40874 } else { 40875 ReactCurrentDispatcher.current = HooksDispatcherOnMountInDEV; 40876 } 40877 } 40878 40879 var children = Component(props, secondArg); // Check if there was a render phase update 40880 40881 if (workInProgress.expirationTime === renderExpirationTime) { 40882 // Keep rendering in a loop for as long as render phase updates continue to 40883 // be scheduled. Use a counter to prevent infinite loops. 40884 var numberOfReRenders = 0; 40885 40886 do { 40887 workInProgress.expirationTime = NoWork; 40888 40889 if (!(numberOfReRenders < RE_RENDER_LIMIT)) { 40890 { 40891 throw Error( "Too many re-renders. React limits the number of renders to prevent an infinite loop." ); 40892 } 40893 } 40894 40895 numberOfReRenders += 1; 40896 40897 { 40898 // Even when hot reloading, allow dependencies to stabilize 40899 // after first render to prevent infinite render phase updates. 40900 ignorePreviousDependencies = false; 40901 } // Start over from the beginning of the list 40902 40903 40904 currentHook = null; 40905 workInProgressHook = null; 40906 workInProgress.updateQueue = null; 40907 40908 { 40909 // Also validate hook order for cascading updates. 40910 hookTypesUpdateIndexDev = -1; 40911 } 40912 40913 ReactCurrentDispatcher.current = HooksDispatcherOnRerenderInDEV ; 40914 children = Component(props, secondArg); 40915 } while (workInProgress.expirationTime === renderExpirationTime); 40916 } // We can assume the previous dispatcher is always this one, since we set it 40917 // at the beginning of the render phase and there's no re-entrancy. 40918 40919 40920 ReactCurrentDispatcher.current = ContextOnlyDispatcher; 40921 40922 { 40923 workInProgress._debugHookTypes = hookTypesDev; 40924 } // This check uses currentHook so that it works the same in DEV and prod bundles. 40925 // hookTypesDev could catch more cases (e.g. context) but only in DEV bundles. 40926 40927 40928 var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null; 40929 renderExpirationTime = NoWork; 40930 currentlyRenderingFiber$1 = null; 40931 currentHook = null; 40932 workInProgressHook = null; 40933 40934 { 40935 currentHookNameInDev = null; 40936 hookTypesDev = null; 40937 hookTypesUpdateIndexDev = -1; 40938 } 40939 40940 didScheduleRenderPhaseUpdate = false; 40941 40942 if (!!didRenderTooFewHooks) { 40943 { 40944 throw Error( "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." ); 40945 } 40946 } 40947 40948 return children; 40949} 40950function bailoutHooks(current, workInProgress, expirationTime) { 40951 workInProgress.updateQueue = current.updateQueue; 40952 workInProgress.effectTag &= ~(Passive | Update); 40953 40954 if (current.expirationTime <= expirationTime) { 40955 current.expirationTime = NoWork; 40956 } 40957} 40958function resetHooksAfterThrow() { 40959 // We can assume the previous dispatcher is always this one, since we set it 40960 // at the beginning of the render phase and there's no re-entrancy. 40961 ReactCurrentDispatcher.current = ContextOnlyDispatcher; 40962 40963 if (didScheduleRenderPhaseUpdate) { 40964 // There were render phase updates. These are only valid for this render 40965 // phase, which we are now aborting. Remove the updates from the queues so 40966 // they do not persist to the next render. Do not remove updates from hooks 40967 // that weren't processed. 40968 // 40969 // Only reset the updates from the queue if it has a clone. If it does 40970 // not have a clone, that means it wasn't processed, and the updates were 40971 // scheduled before we entered the render phase. 40972 var hook = currentlyRenderingFiber$1.memoizedState; 40973 40974 while (hook !== null) { 40975 var queue = hook.queue; 40976 40977 if (queue !== null) { 40978 queue.pending = null; 40979 } 40980 40981 hook = hook.next; 40982 } 40983 } 40984 40985 renderExpirationTime = NoWork; 40986 currentlyRenderingFiber$1 = null; 40987 currentHook = null; 40988 workInProgressHook = null; 40989 40990 { 40991 hookTypesDev = null; 40992 hookTypesUpdateIndexDev = -1; 40993 currentHookNameInDev = null; 40994 } 40995 40996 didScheduleRenderPhaseUpdate = false; 40997} 40998 40999function mountWorkInProgressHook() { 41000 var hook = { 41001 memoizedState: null, 41002 baseState: null, 41003 baseQueue: null, 41004 queue: null, 41005 next: null 41006 }; 41007 41008 if (workInProgressHook === null) { 41009 // This is the first hook in the list 41010 currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook; 41011 } else { 41012 // Append to the end of the list 41013 workInProgressHook = workInProgressHook.next = hook; 41014 } 41015 41016 return workInProgressHook; 41017} 41018 41019function updateWorkInProgressHook() { 41020 // This function is used both for updates and for re-renders triggered by a 41021 // render phase update. It assumes there is either a current hook we can 41022 // clone, or a work-in-progress hook from a previous render pass that we can 41023 // use as a base. When we reach the end of the base list, we must switch to 41024 // the dispatcher used for mounts. 41025 var nextCurrentHook; 41026 41027 if (currentHook === null) { 41028 var current = currentlyRenderingFiber$1.alternate; 41029 41030 if (current !== null) { 41031 nextCurrentHook = current.memoizedState; 41032 } else { 41033 nextCurrentHook = null; 41034 } 41035 } else { 41036 nextCurrentHook = currentHook.next; 41037 } 41038 41039 var nextWorkInProgressHook; 41040 41041 if (workInProgressHook === null) { 41042 nextWorkInProgressHook = currentlyRenderingFiber$1.memoizedState; 41043 } else { 41044 nextWorkInProgressHook = workInProgressHook.next; 41045 } 41046 41047 if (nextWorkInProgressHook !== null) { 41048 // There's already a work-in-progress. Reuse it. 41049 workInProgressHook = nextWorkInProgressHook; 41050 nextWorkInProgressHook = workInProgressHook.next; 41051 currentHook = nextCurrentHook; 41052 } else { 41053 // Clone from the current hook. 41054 if (!(nextCurrentHook !== null)) { 41055 { 41056 throw Error( "Rendered more hooks than during the previous render." ); 41057 } 41058 } 41059 41060 currentHook = nextCurrentHook; 41061 var newHook = { 41062 memoizedState: currentHook.memoizedState, 41063 baseState: currentHook.baseState, 41064 baseQueue: currentHook.baseQueue, 41065 queue: currentHook.queue, 41066 next: null 41067 }; 41068 41069 if (workInProgressHook === null) { 41070 // This is the first hook in the list. 41071 currentlyRenderingFiber$1.memoizedState = workInProgressHook = newHook; 41072 } else { 41073 // Append to the end of the list. 41074 workInProgressHook = workInProgressHook.next = newHook; 41075 } 41076 } 41077 41078 return workInProgressHook; 41079} 41080 41081function createFunctionComponentUpdateQueue() { 41082 return { 41083 lastEffect: null 41084 }; 41085} 41086 41087function basicStateReducer(state, action) { 41088 // $FlowFixMe: Flow doesn't like mixed types 41089 return typeof action === 'function' ? action(state) : action; 41090} 41091 41092function mountReducer(reducer, initialArg, init) { 41093 var hook = mountWorkInProgressHook(); 41094 var initialState; 41095 41096 if (init !== undefined) { 41097 initialState = init(initialArg); 41098 } else { 41099 initialState = initialArg; 41100 } 41101 41102 hook.memoizedState = hook.baseState = initialState; 41103 var queue = hook.queue = { 41104 pending: null, 41105 dispatch: null, 41106 lastRenderedReducer: reducer, 41107 lastRenderedState: initialState 41108 }; 41109 var dispatch = queue.dispatch = dispatchAction.bind(null, currentlyRenderingFiber$1, queue); 41110 return [hook.memoizedState, dispatch]; 41111} 41112 41113function updateReducer(reducer, initialArg, init) { 41114 var hook = updateWorkInProgressHook(); 41115 var queue = hook.queue; 41116 41117 if (!(queue !== null)) { 41118 { 41119 throw Error( "Should have a queue. This is likely a bug in React. Please file an issue." ); 41120 } 41121 } 41122 41123 queue.lastRenderedReducer = reducer; 41124 var current = currentHook; // The last rebase update that is NOT part of the base state. 41125 41126 var baseQueue = current.baseQueue; // The last pending update that hasn't been processed yet. 41127 41128 var pendingQueue = queue.pending; 41129 41130 if (pendingQueue !== null) { 41131 // We have new updates that haven't been processed yet. 41132 // We'll add them to the base queue. 41133 if (baseQueue !== null) { 41134 // Merge the pending queue and the base queue. 41135 var baseFirst = baseQueue.next; 41136 var pendingFirst = pendingQueue.next; 41137 baseQueue.next = pendingFirst; 41138 pendingQueue.next = baseFirst; 41139 } 41140 41141 current.baseQueue = baseQueue = pendingQueue; 41142 queue.pending = null; 41143 } 41144 41145 if (baseQueue !== null) { 41146 // We have a queue to process. 41147 var first = baseQueue.next; 41148 var newState = current.baseState; 41149 var newBaseState = null; 41150 var newBaseQueueFirst = null; 41151 var newBaseQueueLast = null; 41152 var update = first; 41153 41154 do { 41155 var updateExpirationTime = update.expirationTime; 41156 41157 if (updateExpirationTime < renderExpirationTime) { 41158 // Priority is insufficient. Skip this update. If this is the first 41159 // skipped update, the previous update/state is the new base 41160 // update/state. 41161 var clone = { 41162 expirationTime: update.expirationTime, 41163 suspenseConfig: update.suspenseConfig, 41164 action: update.action, 41165 eagerReducer: update.eagerReducer, 41166 eagerState: update.eagerState, 41167 next: null 41168 }; 41169 41170 if (newBaseQueueLast === null) { 41171 newBaseQueueFirst = newBaseQueueLast = clone; 41172 newBaseState = newState; 41173 } else { 41174 newBaseQueueLast = newBaseQueueLast.next = clone; 41175 } // Update the remaining priority in the queue. 41176 41177 41178 if (updateExpirationTime > currentlyRenderingFiber$1.expirationTime) { 41179 currentlyRenderingFiber$1.expirationTime = updateExpirationTime; 41180 markUnprocessedUpdateTime(updateExpirationTime); 41181 } 41182 } else { 41183 // This update does have sufficient priority. 41184 if (newBaseQueueLast !== null) { 41185 var _clone = { 41186 expirationTime: Sync, 41187 // This update is going to be committed so we never want uncommit it. 41188 suspenseConfig: update.suspenseConfig, 41189 action: update.action, 41190 eagerReducer: update.eagerReducer, 41191 eagerState: update.eagerState, 41192 next: null 41193 }; 41194 newBaseQueueLast = newBaseQueueLast.next = _clone; 41195 } // Mark the event time of this update as relevant to this render pass. 41196 // TODO: This should ideally use the true event time of this update rather than 41197 // its priority which is a derived and not reverseable value. 41198 // TODO: We should skip this update if it was already committed but currently 41199 // we have no way of detecting the difference between a committed and suspended 41200 // update here. 41201 41202 41203 markRenderEventTimeAndConfig(updateExpirationTime, update.suspenseConfig); // Process this update. 41204 41205 if (update.eagerReducer === reducer) { 41206 // If this update was processed eagerly, and its reducer matches the 41207 // current reducer, we can use the eagerly computed state. 41208 newState = update.eagerState; 41209 } else { 41210 var action = update.action; 41211 newState = reducer(newState, action); 41212 } 41213 } 41214 41215 update = update.next; 41216 } while (update !== null && update !== first); 41217 41218 if (newBaseQueueLast === null) { 41219 newBaseState = newState; 41220 } else { 41221 newBaseQueueLast.next = newBaseQueueFirst; 41222 } // Mark that the fiber performed work, but only if the new state is 41223 // different from the current state. 41224 41225 41226 if (!objectIs(newState, hook.memoizedState)) { 41227 markWorkInProgressReceivedUpdate(); 41228 } 41229 41230 hook.memoizedState = newState; 41231 hook.baseState = newBaseState; 41232 hook.baseQueue = newBaseQueueLast; 41233 queue.lastRenderedState = newState; 41234 } 41235 41236 var dispatch = queue.dispatch; 41237 return [hook.memoizedState, dispatch]; 41238} 41239 41240function rerenderReducer(reducer, initialArg, init) { 41241 var hook = updateWorkInProgressHook(); 41242 var queue = hook.queue; 41243 41244 if (!(queue !== null)) { 41245 { 41246 throw Error( "Should have a queue. This is likely a bug in React. Please file an issue." ); 41247 } 41248 } 41249 41250 queue.lastRenderedReducer = reducer; // This is a re-render. Apply the new render phase updates to the previous 41251 // work-in-progress hook. 41252 41253 var dispatch = queue.dispatch; 41254 var lastRenderPhaseUpdate = queue.pending; 41255 var newState = hook.memoizedState; 41256 41257 if (lastRenderPhaseUpdate !== null) { 41258 // The queue doesn't persist past this render pass. 41259 queue.pending = null; 41260 var firstRenderPhaseUpdate = lastRenderPhaseUpdate.next; 41261 var update = firstRenderPhaseUpdate; 41262 41263 do { 41264 // Process this render phase update. We don't have to check the 41265 // priority because it will always be the same as the current 41266 // render's. 41267 var action = update.action; 41268 newState = reducer(newState, action); 41269 update = update.next; 41270 } while (update !== firstRenderPhaseUpdate); // Mark that the fiber performed work, but only if the new state is 41271 // different from the current state. 41272 41273 41274 if (!objectIs(newState, hook.memoizedState)) { 41275 markWorkInProgressReceivedUpdate(); 41276 } 41277 41278 hook.memoizedState = newState; // Don't persist the state accumulated from the render phase updates to 41279 // the base state unless the queue is empty. 41280 // TODO: Not sure if this is the desired semantics, but it's what we 41281 // do for gDSFP. I can't remember why. 41282 41283 if (hook.baseQueue === null) { 41284 hook.baseState = newState; 41285 } 41286 41287 queue.lastRenderedState = newState; 41288 } 41289 41290 return [newState, dispatch]; 41291} 41292 41293function mountState(initialState) { 41294 var hook = mountWorkInProgressHook(); 41295 41296 if (typeof initialState === 'function') { 41297 // $FlowFixMe: Flow doesn't like mixed types 41298 initialState = initialState(); 41299 } 41300 41301 hook.memoizedState = hook.baseState = initialState; 41302 var queue = hook.queue = { 41303 pending: null, 41304 dispatch: null, 41305 lastRenderedReducer: basicStateReducer, 41306 lastRenderedState: initialState 41307 }; 41308 var dispatch = queue.dispatch = dispatchAction.bind(null, currentlyRenderingFiber$1, queue); 41309 return [hook.memoizedState, dispatch]; 41310} 41311 41312function updateState(initialState) { 41313 return updateReducer(basicStateReducer); 41314} 41315 41316function rerenderState(initialState) { 41317 return rerenderReducer(basicStateReducer); 41318} 41319 41320function pushEffect(tag, create, destroy, deps) { 41321 var effect = { 41322 tag: tag, 41323 create: create, 41324 destroy: destroy, 41325 deps: deps, 41326 // Circular 41327 next: null 41328 }; 41329 var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; 41330 41331 if (componentUpdateQueue === null) { 41332 componentUpdateQueue = createFunctionComponentUpdateQueue(); 41333 currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; 41334 componentUpdateQueue.lastEffect = effect.next = effect; 41335 } else { 41336 var lastEffect = componentUpdateQueue.lastEffect; 41337 41338 if (lastEffect === null) { 41339 componentUpdateQueue.lastEffect = effect.next = effect; 41340 } else { 41341 var firstEffect = lastEffect.next; 41342 lastEffect.next = effect; 41343 effect.next = firstEffect; 41344 componentUpdateQueue.lastEffect = effect; 41345 } 41346 } 41347 41348 return effect; 41349} 41350 41351function mountRef(initialValue) { 41352 var hook = mountWorkInProgressHook(); 41353 var ref = { 41354 current: initialValue 41355 }; 41356 41357 { 41358 Object.seal(ref); 41359 } 41360 41361 hook.memoizedState = ref; 41362 return ref; 41363} 41364 41365function updateRef(initialValue) { 41366 var hook = updateWorkInProgressHook(); 41367 return hook.memoizedState; 41368} 41369 41370function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) { 41371 var hook = mountWorkInProgressHook(); 41372 var nextDeps = deps === undefined ? null : deps; 41373 currentlyRenderingFiber$1.effectTag |= fiberEffectTag; 41374 hook.memoizedState = pushEffect(HasEffect | hookEffectTag, create, undefined, nextDeps); 41375} 41376 41377function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps) { 41378 var hook = updateWorkInProgressHook(); 41379 var nextDeps = deps === undefined ? null : deps; 41380 var destroy = undefined; 41381 41382 if (currentHook !== null) { 41383 var prevEffect = currentHook.memoizedState; 41384 destroy = prevEffect.destroy; 41385 41386 if (nextDeps !== null) { 41387 var prevDeps = prevEffect.deps; 41388 41389 if (areHookInputsEqual(nextDeps, prevDeps)) { 41390 pushEffect(hookEffectTag, create, destroy, nextDeps); 41391 return; 41392 } 41393 } 41394 } 41395 41396 currentlyRenderingFiber$1.effectTag |= fiberEffectTag; 41397 hook.memoizedState = pushEffect(HasEffect | hookEffectTag, create, destroy, nextDeps); 41398} 41399 41400function mountEffect(create, deps) { 41401 { 41402 // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests 41403 if ('undefined' !== typeof jest) { 41404 warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1); 41405 } 41406 } 41407 41408 return mountEffectImpl(Update | Passive, Passive$1, create, deps); 41409} 41410 41411function updateEffect(create, deps) { 41412 { 41413 // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests 41414 if ('undefined' !== typeof jest) { 41415 warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1); 41416 } 41417 } 41418 41419 return updateEffectImpl(Update | Passive, Passive$1, create, deps); 41420} 41421 41422function mountLayoutEffect(create, deps) { 41423 return mountEffectImpl(Update, Layout, create, deps); 41424} 41425 41426function updateLayoutEffect(create, deps) { 41427 return updateEffectImpl(Update, Layout, create, deps); 41428} 41429 41430function imperativeHandleEffect(create, ref) { 41431 if (typeof ref === 'function') { 41432 var refCallback = ref; 41433 41434 var _inst = create(); 41435 41436 refCallback(_inst); 41437 return function () { 41438 refCallback(null); 41439 }; 41440 } else if (ref !== null && ref !== undefined) { 41441 var refObject = ref; 41442 41443 { 41444 if (!refObject.hasOwnProperty('current')) { 41445 error('Expected useImperativeHandle() first argument to either be a ' + 'ref callback or React.createRef() object. Instead received: %s.', 'an object with keys {' + Object.keys(refObject).join(', ') + '}'); 41446 } 41447 } 41448 41449 var _inst2 = create(); 41450 41451 refObject.current = _inst2; 41452 return function () { 41453 refObject.current = null; 41454 }; 41455 } 41456} 41457 41458function mountImperativeHandle(ref, create, deps) { 41459 { 41460 if (typeof create !== 'function') { 41461 error('Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null'); 41462 } 41463 } // TODO: If deps are provided, should we skip comparing the ref itself? 41464 41465 41466 var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null; 41467 return mountEffectImpl(Update, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps); 41468} 41469 41470function updateImperativeHandle(ref, create, deps) { 41471 { 41472 if (typeof create !== 'function') { 41473 error('Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null'); 41474 } 41475 } // TODO: If deps are provided, should we skip comparing the ref itself? 41476 41477 41478 var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null; 41479 return updateEffectImpl(Update, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps); 41480} 41481 41482function mountDebugValue(value, formatterFn) {// This hook is normally a no-op. 41483 // The react-debug-hooks package injects its own implementation 41484 // so that e.g. DevTools can display custom hook values. 41485} 41486 41487var updateDebugValue = mountDebugValue; 41488 41489function mountCallback(callback, deps) { 41490 var hook = mountWorkInProgressHook(); 41491 var nextDeps = deps === undefined ? null : deps; 41492 hook.memoizedState = [callback, nextDeps]; 41493 return callback; 41494} 41495 41496function updateCallback(callback, deps) { 41497 var hook = updateWorkInProgressHook(); 41498 var nextDeps = deps === undefined ? null : deps; 41499 var prevState = hook.memoizedState; 41500 41501 if (prevState !== null) { 41502 if (nextDeps !== null) { 41503 var prevDeps = prevState[1]; 41504 41505 if (areHookInputsEqual(nextDeps, prevDeps)) { 41506 return prevState[0]; 41507 } 41508 } 41509 } 41510 41511 hook.memoizedState = [callback, nextDeps]; 41512 return callback; 41513} 41514 41515function mountMemo(nextCreate, deps) { 41516 var hook = mountWorkInProgressHook(); 41517 var nextDeps = deps === undefined ? null : deps; 41518 var nextValue = nextCreate(); 41519 hook.memoizedState = [nextValue, nextDeps]; 41520 return nextValue; 41521} 41522 41523function updateMemo(nextCreate, deps) { 41524 var hook = updateWorkInProgressHook(); 41525 var nextDeps = deps === undefined ? null : deps; 41526 var prevState = hook.memoizedState; 41527 41528 if (prevState !== null) { 41529 // Assume these are defined. If they're not, areHookInputsEqual will warn. 41530 if (nextDeps !== null) { 41531 var prevDeps = prevState[1]; 41532 41533 if (areHookInputsEqual(nextDeps, prevDeps)) { 41534 return prevState[0]; 41535 } 41536 } 41537 } 41538 41539 var nextValue = nextCreate(); 41540 hook.memoizedState = [nextValue, nextDeps]; 41541 return nextValue; 41542} 41543 41544function mountDeferredValue(value, config) { 41545 var _mountState = mountState(value), 41546 prevValue = _mountState[0], 41547 setValue = _mountState[1]; 41548 41549 mountEffect(function () { 41550 var previousConfig = ReactCurrentBatchConfig$1.suspense; 41551 ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config; 41552 41553 try { 41554 setValue(value); 41555 } finally { 41556 ReactCurrentBatchConfig$1.suspense = previousConfig; 41557 } 41558 }, [value, config]); 41559 return prevValue; 41560} 41561 41562function updateDeferredValue(value, config) { 41563 var _updateState = updateState(), 41564 prevValue = _updateState[0], 41565 setValue = _updateState[1]; 41566 41567 updateEffect(function () { 41568 var previousConfig = ReactCurrentBatchConfig$1.suspense; 41569 ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config; 41570 41571 try { 41572 setValue(value); 41573 } finally { 41574 ReactCurrentBatchConfig$1.suspense = previousConfig; 41575 } 41576 }, [value, config]); 41577 return prevValue; 41578} 41579 41580function rerenderDeferredValue(value, config) { 41581 var _rerenderState = rerenderState(), 41582 prevValue = _rerenderState[0], 41583 setValue = _rerenderState[1]; 41584 41585 updateEffect(function () { 41586 var previousConfig = ReactCurrentBatchConfig$1.suspense; 41587 ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config; 41588 41589 try { 41590 setValue(value); 41591 } finally { 41592 ReactCurrentBatchConfig$1.suspense = previousConfig; 41593 } 41594 }, [value, config]); 41595 return prevValue; 41596} 41597 41598function startTransition(setPending, config, callback) { 41599 var priorityLevel = getCurrentPriorityLevel(); 41600 runWithPriority$1(priorityLevel < UserBlockingPriority$1 ? UserBlockingPriority$1 : priorityLevel, function () { 41601 setPending(true); 41602 }); 41603 runWithPriority$1(priorityLevel > NormalPriority ? NormalPriority : priorityLevel, function () { 41604 var previousConfig = ReactCurrentBatchConfig$1.suspense; 41605 ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config; 41606 41607 try { 41608 setPending(false); 41609 callback(); 41610 } finally { 41611 ReactCurrentBatchConfig$1.suspense = previousConfig; 41612 } 41613 }); 41614} 41615 41616function mountTransition(config) { 41617 var _mountState2 = mountState(false), 41618 isPending = _mountState2[0], 41619 setPending = _mountState2[1]; 41620 41621 var start = mountCallback(startTransition.bind(null, setPending, config), [setPending, config]); 41622 return [start, isPending]; 41623} 41624 41625function updateTransition(config) { 41626 var _updateState2 = updateState(), 41627 isPending = _updateState2[0], 41628 setPending = _updateState2[1]; 41629 41630 var start = updateCallback(startTransition.bind(null, setPending, config), [setPending, config]); 41631 return [start, isPending]; 41632} 41633 41634function rerenderTransition(config) { 41635 var _rerenderState2 = rerenderState(), 41636 isPending = _rerenderState2[0], 41637 setPending = _rerenderState2[1]; 41638 41639 var start = updateCallback(startTransition.bind(null, setPending, config), [setPending, config]); 41640 return [start, isPending]; 41641} 41642 41643function dispatchAction(fiber, queue, action) { 41644 { 41645 if (typeof arguments[3] === 'function') { 41646 error("State updates from the useState() and useReducer() Hooks don't support the " + 'second callback argument. To execute a side effect after ' + 'rendering, declare it in the component body with useEffect().'); 41647 } 41648 } 41649 41650 var currentTime = requestCurrentTimeForUpdate(); 41651 var suspenseConfig = requestCurrentSuspenseConfig(); 41652 var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig); 41653 var update = { 41654 expirationTime: expirationTime, 41655 suspenseConfig: suspenseConfig, 41656 action: action, 41657 eagerReducer: null, 41658 eagerState: null, 41659 next: null 41660 }; 41661 41662 { 41663 update.priority = getCurrentPriorityLevel(); 41664 } // Append the update to the end of the list. 41665 41666 41667 var pending = queue.pending; 41668 41669 if (pending === null) { 41670 // This is the first update. Create a circular list. 41671 update.next = update; 41672 } else { 41673 update.next = pending.next; 41674 pending.next = update; 41675 } 41676 41677 queue.pending = update; 41678 var alternate = fiber.alternate; 41679 41680 if (fiber === currentlyRenderingFiber$1 || alternate !== null && alternate === currentlyRenderingFiber$1) { 41681 // This is a render phase update. Stash it in a lazily-created map of 41682 // queue -> linked list of updates. After this render pass, we'll restart 41683 // and apply the stashed updates on top of the work-in-progress hook. 41684 didScheduleRenderPhaseUpdate = true; 41685 update.expirationTime = renderExpirationTime; 41686 currentlyRenderingFiber$1.expirationTime = renderExpirationTime; 41687 } else { 41688 if (fiber.expirationTime === NoWork && (alternate === null || alternate.expirationTime === NoWork)) { 41689 // The queue is currently empty, which means we can eagerly compute the 41690 // next state before entering the render phase. If the new state is the 41691 // same as the current state, we may be able to bail out entirely. 41692 var lastRenderedReducer = queue.lastRenderedReducer; 41693 41694 if (lastRenderedReducer !== null) { 41695 var prevDispatcher; 41696 41697 { 41698 prevDispatcher = ReactCurrentDispatcher.current; 41699 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV; 41700 } 41701 41702 try { 41703 var currentState = queue.lastRenderedState; 41704 var eagerState = lastRenderedReducer(currentState, action); // Stash the eagerly computed state, and the reducer used to compute 41705 // it, on the update object. If the reducer hasn't changed by the 41706 // time we enter the render phase, then the eager state can be used 41707 // without calling the reducer again. 41708 41709 update.eagerReducer = lastRenderedReducer; 41710 update.eagerState = eagerState; 41711 41712 if (objectIs(eagerState, currentState)) { 41713 // Fast path. We can bail out without scheduling React to re-render. 41714 // It's still possible that we'll need to rebase this update later, 41715 // if the component re-renders for a different reason and by that 41716 // time the reducer has changed. 41717 return; 41718 } 41719 } catch (error) {// Suppress the error. It will throw again in the render phase. 41720 } finally { 41721 { 41722 ReactCurrentDispatcher.current = prevDispatcher; 41723 } 41724 } 41725 } 41726 } 41727 41728 { 41729 // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests 41730 if ('undefined' !== typeof jest) { 41731 warnIfNotScopedWithMatchingAct(fiber); 41732 warnIfNotCurrentlyActingUpdatesInDev(fiber); 41733 } 41734 } 41735 41736 scheduleWork(fiber, expirationTime); 41737 } 41738} 41739 41740var ContextOnlyDispatcher = { 41741 readContext: readContext, 41742 useCallback: throwInvalidHookError, 41743 useContext: throwInvalidHookError, 41744 useEffect: throwInvalidHookError, 41745 useImperativeHandle: throwInvalidHookError, 41746 useLayoutEffect: throwInvalidHookError, 41747 useMemo: throwInvalidHookError, 41748 useReducer: throwInvalidHookError, 41749 useRef: throwInvalidHookError, 41750 useState: throwInvalidHookError, 41751 useDebugValue: throwInvalidHookError, 41752 useResponder: throwInvalidHookError, 41753 useDeferredValue: throwInvalidHookError, 41754 useTransition: throwInvalidHookError 41755}; 41756var HooksDispatcherOnMountInDEV = null; 41757var HooksDispatcherOnMountWithHookTypesInDEV = null; 41758var HooksDispatcherOnUpdateInDEV = null; 41759var HooksDispatcherOnRerenderInDEV = null; 41760var InvalidNestedHooksDispatcherOnMountInDEV = null; 41761var InvalidNestedHooksDispatcherOnUpdateInDEV = null; 41762var InvalidNestedHooksDispatcherOnRerenderInDEV = null; 41763 41764{ 41765 var warnInvalidContextAccess = function () { 41766 error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().'); 41767 }; 41768 41769 var warnInvalidHookAccess = function () { 41770 error('Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://fb.me/rules-of-hooks'); 41771 }; 41772 41773 HooksDispatcherOnMountInDEV = { 41774 readContext: function (context, observedBits) { 41775 return readContext(context, observedBits); 41776 }, 41777 useCallback: function (callback, deps) { 41778 currentHookNameInDev = 'useCallback'; 41779 mountHookTypesDev(); 41780 checkDepsAreArrayDev(deps); 41781 return mountCallback(callback, deps); 41782 }, 41783 useContext: function (context, observedBits) { 41784 currentHookNameInDev = 'useContext'; 41785 mountHookTypesDev(); 41786 return readContext(context, observedBits); 41787 }, 41788 useEffect: function (create, deps) { 41789 currentHookNameInDev = 'useEffect'; 41790 mountHookTypesDev(); 41791 checkDepsAreArrayDev(deps); 41792 return mountEffect(create, deps); 41793 }, 41794 useImperativeHandle: function (ref, create, deps) { 41795 currentHookNameInDev = 'useImperativeHandle'; 41796 mountHookTypesDev(); 41797 checkDepsAreArrayDev(deps); 41798 return mountImperativeHandle(ref, create, deps); 41799 }, 41800 useLayoutEffect: function (create, deps) { 41801 currentHookNameInDev = 'useLayoutEffect'; 41802 mountHookTypesDev(); 41803 checkDepsAreArrayDev(deps); 41804 return mountLayoutEffect(create, deps); 41805 }, 41806 useMemo: function (create, deps) { 41807 currentHookNameInDev = 'useMemo'; 41808 mountHookTypesDev(); 41809 checkDepsAreArrayDev(deps); 41810 var prevDispatcher = ReactCurrentDispatcher.current; 41811 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV; 41812 41813 try { 41814 return mountMemo(create, deps); 41815 } finally { 41816 ReactCurrentDispatcher.current = prevDispatcher; 41817 } 41818 }, 41819 useReducer: function (reducer, initialArg, init) { 41820 currentHookNameInDev = 'useReducer'; 41821 mountHookTypesDev(); 41822 var prevDispatcher = ReactCurrentDispatcher.current; 41823 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV; 41824 41825 try { 41826 return mountReducer(reducer, initialArg, init); 41827 } finally { 41828 ReactCurrentDispatcher.current = prevDispatcher; 41829 } 41830 }, 41831 useRef: function (initialValue) { 41832 currentHookNameInDev = 'useRef'; 41833 mountHookTypesDev(); 41834 return mountRef(initialValue); 41835 }, 41836 useState: function (initialState) { 41837 currentHookNameInDev = 'useState'; 41838 mountHookTypesDev(); 41839 var prevDispatcher = ReactCurrentDispatcher.current; 41840 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV; 41841 41842 try { 41843 return mountState(initialState); 41844 } finally { 41845 ReactCurrentDispatcher.current = prevDispatcher; 41846 } 41847 }, 41848 useDebugValue: function (value, formatterFn) { 41849 currentHookNameInDev = 'useDebugValue'; 41850 mountHookTypesDev(); 41851 return mountDebugValue(); 41852 }, 41853 useResponder: function (responder, props) { 41854 currentHookNameInDev = 'useResponder'; 41855 mountHookTypesDev(); 41856 return createDeprecatedResponderListener(responder, props); 41857 }, 41858 useDeferredValue: function (value, config) { 41859 currentHookNameInDev = 'useDeferredValue'; 41860 mountHookTypesDev(); 41861 return mountDeferredValue(value, config); 41862 }, 41863 useTransition: function (config) { 41864 currentHookNameInDev = 'useTransition'; 41865 mountHookTypesDev(); 41866 return mountTransition(config); 41867 } 41868 }; 41869 HooksDispatcherOnMountWithHookTypesInDEV = { 41870 readContext: function (context, observedBits) { 41871 return readContext(context, observedBits); 41872 }, 41873 useCallback: function (callback, deps) { 41874 currentHookNameInDev = 'useCallback'; 41875 updateHookTypesDev(); 41876 return mountCallback(callback, deps); 41877 }, 41878 useContext: function (context, observedBits) { 41879 currentHookNameInDev = 'useContext'; 41880 updateHookTypesDev(); 41881 return readContext(context, observedBits); 41882 }, 41883 useEffect: function (create, deps) { 41884 currentHookNameInDev = 'useEffect'; 41885 updateHookTypesDev(); 41886 return mountEffect(create, deps); 41887 }, 41888 useImperativeHandle: function (ref, create, deps) { 41889 currentHookNameInDev = 'useImperativeHandle'; 41890 updateHookTypesDev(); 41891 return mountImperativeHandle(ref, create, deps); 41892 }, 41893 useLayoutEffect: function (create, deps) { 41894 currentHookNameInDev = 'useLayoutEffect'; 41895 updateHookTypesDev(); 41896 return mountLayoutEffect(create, deps); 41897 }, 41898 useMemo: function (create, deps) { 41899 currentHookNameInDev = 'useMemo'; 41900 updateHookTypesDev(); 41901 var prevDispatcher = ReactCurrentDispatcher.current; 41902 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV; 41903 41904 try { 41905 return mountMemo(create, deps); 41906 } finally { 41907 ReactCurrentDispatcher.current = prevDispatcher; 41908 } 41909 }, 41910 useReducer: function (reducer, initialArg, init) { 41911 currentHookNameInDev = 'useReducer'; 41912 updateHookTypesDev(); 41913 var prevDispatcher = ReactCurrentDispatcher.current; 41914 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV; 41915 41916 try { 41917 return mountReducer(reducer, initialArg, init); 41918 } finally { 41919 ReactCurrentDispatcher.current = prevDispatcher; 41920 } 41921 }, 41922 useRef: function (initialValue) { 41923 currentHookNameInDev = 'useRef'; 41924 updateHookTypesDev(); 41925 return mountRef(initialValue); 41926 }, 41927 useState: function (initialState) { 41928 currentHookNameInDev = 'useState'; 41929 updateHookTypesDev(); 41930 var prevDispatcher = ReactCurrentDispatcher.current; 41931 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV; 41932 41933 try { 41934 return mountState(initialState); 41935 } finally { 41936 ReactCurrentDispatcher.current = prevDispatcher; 41937 } 41938 }, 41939 useDebugValue: function (value, formatterFn) { 41940 currentHookNameInDev = 'useDebugValue'; 41941 updateHookTypesDev(); 41942 return mountDebugValue(); 41943 }, 41944 useResponder: function (responder, props) { 41945 currentHookNameInDev = 'useResponder'; 41946 updateHookTypesDev(); 41947 return createDeprecatedResponderListener(responder, props); 41948 }, 41949 useDeferredValue: function (value, config) { 41950 currentHookNameInDev = 'useDeferredValue'; 41951 updateHookTypesDev(); 41952 return mountDeferredValue(value, config); 41953 }, 41954 useTransition: function (config) { 41955 currentHookNameInDev = 'useTransition'; 41956 updateHookTypesDev(); 41957 return mountTransition(config); 41958 } 41959 }; 41960 HooksDispatcherOnUpdateInDEV = { 41961 readContext: function (context, observedBits) { 41962 return readContext(context, observedBits); 41963 }, 41964 useCallback: function (callback, deps) { 41965 currentHookNameInDev = 'useCallback'; 41966 updateHookTypesDev(); 41967 return updateCallback(callback, deps); 41968 }, 41969 useContext: function (context, observedBits) { 41970 currentHookNameInDev = 'useContext'; 41971 updateHookTypesDev(); 41972 return readContext(context, observedBits); 41973 }, 41974 useEffect: function (create, deps) { 41975 currentHookNameInDev = 'useEffect'; 41976 updateHookTypesDev(); 41977 return updateEffect(create, deps); 41978 }, 41979 useImperativeHandle: function (ref, create, deps) { 41980 currentHookNameInDev = 'useImperativeHandle'; 41981 updateHookTypesDev(); 41982 return updateImperativeHandle(ref, create, deps); 41983 }, 41984 useLayoutEffect: function (create, deps) { 41985 currentHookNameInDev = 'useLayoutEffect'; 41986 updateHookTypesDev(); 41987 return updateLayoutEffect(create, deps); 41988 }, 41989 useMemo: function (create, deps) { 41990 currentHookNameInDev = 'useMemo'; 41991 updateHookTypesDev(); 41992 var prevDispatcher = ReactCurrentDispatcher.current; 41993 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV; 41994 41995 try { 41996 return updateMemo(create, deps); 41997 } finally { 41998 ReactCurrentDispatcher.current = prevDispatcher; 41999 } 42000 }, 42001 useReducer: function (reducer, initialArg, init) { 42002 currentHookNameInDev = 'useReducer'; 42003 updateHookTypesDev(); 42004 var prevDispatcher = ReactCurrentDispatcher.current; 42005 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV; 42006 42007 try { 42008 return updateReducer(reducer, initialArg, init); 42009 } finally { 42010 ReactCurrentDispatcher.current = prevDispatcher; 42011 } 42012 }, 42013 useRef: function (initialValue) { 42014 currentHookNameInDev = 'useRef'; 42015 updateHookTypesDev(); 42016 return updateRef(); 42017 }, 42018 useState: function (initialState) { 42019 currentHookNameInDev = 'useState'; 42020 updateHookTypesDev(); 42021 var prevDispatcher = ReactCurrentDispatcher.current; 42022 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV; 42023 42024 try { 42025 return updateState(initialState); 42026 } finally { 42027 ReactCurrentDispatcher.current = prevDispatcher; 42028 } 42029 }, 42030 useDebugValue: function (value, formatterFn) { 42031 currentHookNameInDev = 'useDebugValue'; 42032 updateHookTypesDev(); 42033 return updateDebugValue(); 42034 }, 42035 useResponder: function (responder, props) { 42036 currentHookNameInDev = 'useResponder'; 42037 updateHookTypesDev(); 42038 return createDeprecatedResponderListener(responder, props); 42039 }, 42040 useDeferredValue: function (value, config) { 42041 currentHookNameInDev = 'useDeferredValue'; 42042 updateHookTypesDev(); 42043 return updateDeferredValue(value, config); 42044 }, 42045 useTransition: function (config) { 42046 currentHookNameInDev = 'useTransition'; 42047 updateHookTypesDev(); 42048 return updateTransition(config); 42049 } 42050 }; 42051 HooksDispatcherOnRerenderInDEV = { 42052 readContext: function (context, observedBits) { 42053 return readContext(context, observedBits); 42054 }, 42055 useCallback: function (callback, deps) { 42056 currentHookNameInDev = 'useCallback'; 42057 updateHookTypesDev(); 42058 return updateCallback(callback, deps); 42059 }, 42060 useContext: function (context, observedBits) { 42061 currentHookNameInDev = 'useContext'; 42062 updateHookTypesDev(); 42063 return readContext(context, observedBits); 42064 }, 42065 useEffect: function (create, deps) { 42066 currentHookNameInDev = 'useEffect'; 42067 updateHookTypesDev(); 42068 return updateEffect(create, deps); 42069 }, 42070 useImperativeHandle: function (ref, create, deps) { 42071 currentHookNameInDev = 'useImperativeHandle'; 42072 updateHookTypesDev(); 42073 return updateImperativeHandle(ref, create, deps); 42074 }, 42075 useLayoutEffect: function (create, deps) { 42076 currentHookNameInDev = 'useLayoutEffect'; 42077 updateHookTypesDev(); 42078 return updateLayoutEffect(create, deps); 42079 }, 42080 useMemo: function (create, deps) { 42081 currentHookNameInDev = 'useMemo'; 42082 updateHookTypesDev(); 42083 var prevDispatcher = ReactCurrentDispatcher.current; 42084 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnRerenderInDEV; 42085 42086 try { 42087 return updateMemo(create, deps); 42088 } finally { 42089 ReactCurrentDispatcher.current = prevDispatcher; 42090 } 42091 }, 42092 useReducer: function (reducer, initialArg, init) { 42093 currentHookNameInDev = 'useReducer'; 42094 updateHookTypesDev(); 42095 var prevDispatcher = ReactCurrentDispatcher.current; 42096 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnRerenderInDEV; 42097 42098 try { 42099 return rerenderReducer(reducer, initialArg, init); 42100 } finally { 42101 ReactCurrentDispatcher.current = prevDispatcher; 42102 } 42103 }, 42104 useRef: function (initialValue) { 42105 currentHookNameInDev = 'useRef'; 42106 updateHookTypesDev(); 42107 return updateRef(); 42108 }, 42109 useState: function (initialState) { 42110 currentHookNameInDev = 'useState'; 42111 updateHookTypesDev(); 42112 var prevDispatcher = ReactCurrentDispatcher.current; 42113 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnRerenderInDEV; 42114 42115 try { 42116 return rerenderState(initialState); 42117 } finally { 42118 ReactCurrentDispatcher.current = prevDispatcher; 42119 } 42120 }, 42121 useDebugValue: function (value, formatterFn) { 42122 currentHookNameInDev = 'useDebugValue'; 42123 updateHookTypesDev(); 42124 return updateDebugValue(); 42125 }, 42126 useResponder: function (responder, props) { 42127 currentHookNameInDev = 'useResponder'; 42128 updateHookTypesDev(); 42129 return createDeprecatedResponderListener(responder, props); 42130 }, 42131 useDeferredValue: function (value, config) { 42132 currentHookNameInDev = 'useDeferredValue'; 42133 updateHookTypesDev(); 42134 return rerenderDeferredValue(value, config); 42135 }, 42136 useTransition: function (config) { 42137 currentHookNameInDev = 'useTransition'; 42138 updateHookTypesDev(); 42139 return rerenderTransition(config); 42140 } 42141 }; 42142 InvalidNestedHooksDispatcherOnMountInDEV = { 42143 readContext: function (context, observedBits) { 42144 warnInvalidContextAccess(); 42145 return readContext(context, observedBits); 42146 }, 42147 useCallback: function (callback, deps) { 42148 currentHookNameInDev = 'useCallback'; 42149 warnInvalidHookAccess(); 42150 mountHookTypesDev(); 42151 return mountCallback(callback, deps); 42152 }, 42153 useContext: function (context, observedBits) { 42154 currentHookNameInDev = 'useContext'; 42155 warnInvalidHookAccess(); 42156 mountHookTypesDev(); 42157 return readContext(context, observedBits); 42158 }, 42159 useEffect: function (create, deps) { 42160 currentHookNameInDev = 'useEffect'; 42161 warnInvalidHookAccess(); 42162 mountHookTypesDev(); 42163 return mountEffect(create, deps); 42164 }, 42165 useImperativeHandle: function (ref, create, deps) { 42166 currentHookNameInDev = 'useImperativeHandle'; 42167 warnInvalidHookAccess(); 42168 mountHookTypesDev(); 42169 return mountImperativeHandle(ref, create, deps); 42170 }, 42171 useLayoutEffect: function (create, deps) { 42172 currentHookNameInDev = 'useLayoutEffect'; 42173 warnInvalidHookAccess(); 42174 mountHookTypesDev(); 42175 return mountLayoutEffect(create, deps); 42176 }, 42177 useMemo: function (create, deps) { 42178 currentHookNameInDev = 'useMemo'; 42179 warnInvalidHookAccess(); 42180 mountHookTypesDev(); 42181 var prevDispatcher = ReactCurrentDispatcher.current; 42182 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV; 42183 42184 try { 42185 return mountMemo(create, deps); 42186 } finally { 42187 ReactCurrentDispatcher.current = prevDispatcher; 42188 } 42189 }, 42190 useReducer: function (reducer, initialArg, init) { 42191 currentHookNameInDev = 'useReducer'; 42192 warnInvalidHookAccess(); 42193 mountHookTypesDev(); 42194 var prevDispatcher = ReactCurrentDispatcher.current; 42195 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV; 42196 42197 try { 42198 return mountReducer(reducer, initialArg, init); 42199 } finally { 42200 ReactCurrentDispatcher.current = prevDispatcher; 42201 } 42202 }, 42203 useRef: function (initialValue) { 42204 currentHookNameInDev = 'useRef'; 42205 warnInvalidHookAccess(); 42206 mountHookTypesDev(); 42207 return mountRef(initialValue); 42208 }, 42209 useState: function (initialState) { 42210 currentHookNameInDev = 'useState'; 42211 warnInvalidHookAccess(); 42212 mountHookTypesDev(); 42213 var prevDispatcher = ReactCurrentDispatcher.current; 42214 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV; 42215 42216 try { 42217 return mountState(initialState); 42218 } finally { 42219 ReactCurrentDispatcher.current = prevDispatcher; 42220 } 42221 }, 42222 useDebugValue: function (value, formatterFn) { 42223 currentHookNameInDev = 'useDebugValue'; 42224 warnInvalidHookAccess(); 42225 mountHookTypesDev(); 42226 return mountDebugValue(); 42227 }, 42228 useResponder: function (responder, props) { 42229 currentHookNameInDev = 'useResponder'; 42230 warnInvalidHookAccess(); 42231 mountHookTypesDev(); 42232 return createDeprecatedResponderListener(responder, props); 42233 }, 42234 useDeferredValue: function (value, config) { 42235 currentHookNameInDev = 'useDeferredValue'; 42236 warnInvalidHookAccess(); 42237 mountHookTypesDev(); 42238 return mountDeferredValue(value, config); 42239 }, 42240 useTransition: function (config) { 42241 currentHookNameInDev = 'useTransition'; 42242 warnInvalidHookAccess(); 42243 mountHookTypesDev(); 42244 return mountTransition(config); 42245 } 42246 }; 42247 InvalidNestedHooksDispatcherOnUpdateInDEV = { 42248 readContext: function (context, observedBits) { 42249 warnInvalidContextAccess(); 42250 return readContext(context, observedBits); 42251 }, 42252 useCallback: function (callback, deps) { 42253 currentHookNameInDev = 'useCallback'; 42254 warnInvalidHookAccess(); 42255 updateHookTypesDev(); 42256 return updateCallback(callback, deps); 42257 }, 42258 useContext: function (context, observedBits) { 42259 currentHookNameInDev = 'useContext'; 42260 warnInvalidHookAccess(); 42261 updateHookTypesDev(); 42262 return readContext(context, observedBits); 42263 }, 42264 useEffect: function (create, deps) { 42265 currentHookNameInDev = 'useEffect'; 42266 warnInvalidHookAccess(); 42267 updateHookTypesDev(); 42268 return updateEffect(create, deps); 42269 }, 42270 useImperativeHandle: function (ref, create, deps) { 42271 currentHookNameInDev = 'useImperativeHandle'; 42272 warnInvalidHookAccess(); 42273 updateHookTypesDev(); 42274 return updateImperativeHandle(ref, create, deps); 42275 }, 42276 useLayoutEffect: function (create, deps) { 42277 currentHookNameInDev = 'useLayoutEffect'; 42278 warnInvalidHookAccess(); 42279 updateHookTypesDev(); 42280 return updateLayoutEffect(create, deps); 42281 }, 42282 useMemo: function (create, deps) { 42283 currentHookNameInDev = 'useMemo'; 42284 warnInvalidHookAccess(); 42285 updateHookTypesDev(); 42286 var prevDispatcher = ReactCurrentDispatcher.current; 42287 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV; 42288 42289 try { 42290 return updateMemo(create, deps); 42291 } finally { 42292 ReactCurrentDispatcher.current = prevDispatcher; 42293 } 42294 }, 42295 useReducer: function (reducer, initialArg, init) { 42296 currentHookNameInDev = 'useReducer'; 42297 warnInvalidHookAccess(); 42298 updateHookTypesDev(); 42299 var prevDispatcher = ReactCurrentDispatcher.current; 42300 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV; 42301 42302 try { 42303 return updateReducer(reducer, initialArg, init); 42304 } finally { 42305 ReactCurrentDispatcher.current = prevDispatcher; 42306 } 42307 }, 42308 useRef: function (initialValue) { 42309 currentHookNameInDev = 'useRef'; 42310 warnInvalidHookAccess(); 42311 updateHookTypesDev(); 42312 return updateRef(); 42313 }, 42314 useState: function (initialState) { 42315 currentHookNameInDev = 'useState'; 42316 warnInvalidHookAccess(); 42317 updateHookTypesDev(); 42318 var prevDispatcher = ReactCurrentDispatcher.current; 42319 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV; 42320 42321 try { 42322 return updateState(initialState); 42323 } finally { 42324 ReactCurrentDispatcher.current = prevDispatcher; 42325 } 42326 }, 42327 useDebugValue: function (value, formatterFn) { 42328 currentHookNameInDev = 'useDebugValue'; 42329 warnInvalidHookAccess(); 42330 updateHookTypesDev(); 42331 return updateDebugValue(); 42332 }, 42333 useResponder: function (responder, props) { 42334 currentHookNameInDev = 'useResponder'; 42335 warnInvalidHookAccess(); 42336 updateHookTypesDev(); 42337 return createDeprecatedResponderListener(responder, props); 42338 }, 42339 useDeferredValue: function (value, config) { 42340 currentHookNameInDev = 'useDeferredValue'; 42341 warnInvalidHookAccess(); 42342 updateHookTypesDev(); 42343 return updateDeferredValue(value, config); 42344 }, 42345 useTransition: function (config) { 42346 currentHookNameInDev = 'useTransition'; 42347 warnInvalidHookAccess(); 42348 updateHookTypesDev(); 42349 return updateTransition(config); 42350 } 42351 }; 42352 InvalidNestedHooksDispatcherOnRerenderInDEV = { 42353 readContext: function (context, observedBits) { 42354 warnInvalidContextAccess(); 42355 return readContext(context, observedBits); 42356 }, 42357 useCallback: function (callback, deps) { 42358 currentHookNameInDev = 'useCallback'; 42359 warnInvalidHookAccess(); 42360 updateHookTypesDev(); 42361 return updateCallback(callback, deps); 42362 }, 42363 useContext: function (context, observedBits) { 42364 currentHookNameInDev = 'useContext'; 42365 warnInvalidHookAccess(); 42366 updateHookTypesDev(); 42367 return readContext(context, observedBits); 42368 }, 42369 useEffect: function (create, deps) { 42370 currentHookNameInDev = 'useEffect'; 42371 warnInvalidHookAccess(); 42372 updateHookTypesDev(); 42373 return updateEffect(create, deps); 42374 }, 42375 useImperativeHandle: function (ref, create, deps) { 42376 currentHookNameInDev = 'useImperativeHandle'; 42377 warnInvalidHookAccess(); 42378 updateHookTypesDev(); 42379 return updateImperativeHandle(ref, create, deps); 42380 }, 42381 useLayoutEffect: function (create, deps) { 42382 currentHookNameInDev = 'useLayoutEffect'; 42383 warnInvalidHookAccess(); 42384 updateHookTypesDev(); 42385 return updateLayoutEffect(create, deps); 42386 }, 42387 useMemo: function (create, deps) { 42388 currentHookNameInDev = 'useMemo'; 42389 warnInvalidHookAccess(); 42390 updateHookTypesDev(); 42391 var prevDispatcher = ReactCurrentDispatcher.current; 42392 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV; 42393 42394 try { 42395 return updateMemo(create, deps); 42396 } finally { 42397 ReactCurrentDispatcher.current = prevDispatcher; 42398 } 42399 }, 42400 useReducer: function (reducer, initialArg, init) { 42401 currentHookNameInDev = 'useReducer'; 42402 warnInvalidHookAccess(); 42403 updateHookTypesDev(); 42404 var prevDispatcher = ReactCurrentDispatcher.current; 42405 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV; 42406 42407 try { 42408 return rerenderReducer(reducer, initialArg, init); 42409 } finally { 42410 ReactCurrentDispatcher.current = prevDispatcher; 42411 } 42412 }, 42413 useRef: function (initialValue) { 42414 currentHookNameInDev = 'useRef'; 42415 warnInvalidHookAccess(); 42416 updateHookTypesDev(); 42417 return updateRef(); 42418 }, 42419 useState: function (initialState) { 42420 currentHookNameInDev = 'useState'; 42421 warnInvalidHookAccess(); 42422 updateHookTypesDev(); 42423 var prevDispatcher = ReactCurrentDispatcher.current; 42424 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV; 42425 42426 try { 42427 return rerenderState(initialState); 42428 } finally { 42429 ReactCurrentDispatcher.current = prevDispatcher; 42430 } 42431 }, 42432 useDebugValue: function (value, formatterFn) { 42433 currentHookNameInDev = 'useDebugValue'; 42434 warnInvalidHookAccess(); 42435 updateHookTypesDev(); 42436 return updateDebugValue(); 42437 }, 42438 useResponder: function (responder, props) { 42439 currentHookNameInDev = 'useResponder'; 42440 warnInvalidHookAccess(); 42441 updateHookTypesDev(); 42442 return createDeprecatedResponderListener(responder, props); 42443 }, 42444 useDeferredValue: function (value, config) { 42445 currentHookNameInDev = 'useDeferredValue'; 42446 warnInvalidHookAccess(); 42447 updateHookTypesDev(); 42448 return rerenderDeferredValue(value, config); 42449 }, 42450 useTransition: function (config) { 42451 currentHookNameInDev = 'useTransition'; 42452 warnInvalidHookAccess(); 42453 updateHookTypesDev(); 42454 return rerenderTransition(config); 42455 } 42456 }; 42457} 42458 42459var now$1 = Scheduler.unstable_now; 42460var commitTime = 0; 42461var profilerStartTime = -1; 42462 42463function getCommitTime() { 42464 return commitTime; 42465} 42466 42467function recordCommitTime() { 42468 42469 commitTime = now$1(); 42470} 42471 42472function startProfilerTimer(fiber) { 42473 42474 profilerStartTime = now$1(); 42475 42476 if (fiber.actualStartTime < 0) { 42477 fiber.actualStartTime = now$1(); 42478 } 42479} 42480 42481function stopProfilerTimerIfRunning(fiber) { 42482 42483 profilerStartTime = -1; 42484} 42485 42486function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) { 42487 42488 if (profilerStartTime >= 0) { 42489 var elapsedTime = now$1() - profilerStartTime; 42490 fiber.actualDuration += elapsedTime; 42491 42492 if (overrideBaseTime) { 42493 fiber.selfBaseDuration = elapsedTime; 42494 } 42495 42496 profilerStartTime = -1; 42497 } 42498} 42499 42500// This may have been an insertion or a hydration. 42501 42502var hydrationParentFiber = null; 42503var nextHydratableInstance = null; 42504var isHydrating = false; 42505 42506function enterHydrationState(fiber) { 42507 42508 var parentInstance = fiber.stateNode.containerInfo; 42509 nextHydratableInstance = getFirstHydratableChild(parentInstance); 42510 hydrationParentFiber = fiber; 42511 isHydrating = true; 42512 return true; 42513} 42514 42515function deleteHydratableInstance(returnFiber, instance) { 42516 { 42517 switch (returnFiber.tag) { 42518 case HostRoot: 42519 didNotHydrateContainerInstance(returnFiber.stateNode.containerInfo, instance); 42520 break; 42521 42522 case HostComponent: 42523 didNotHydrateInstance(returnFiber.type, returnFiber.memoizedProps, returnFiber.stateNode, instance); 42524 break; 42525 } 42526 } 42527 42528 var childToDelete = createFiberFromHostInstanceForDeletion(); 42529 childToDelete.stateNode = instance; 42530 childToDelete.return = returnFiber; 42531 childToDelete.effectTag = Deletion; // This might seem like it belongs on progressedFirstDeletion. However, 42532 // these children are not part of the reconciliation list of children. 42533 // Even if we abort and rereconcile the children, that will try to hydrate 42534 // again and the nodes are still in the host tree so these will be 42535 // recreated. 42536 42537 if (returnFiber.lastEffect !== null) { 42538 returnFiber.lastEffect.nextEffect = childToDelete; 42539 returnFiber.lastEffect = childToDelete; 42540 } else { 42541 returnFiber.firstEffect = returnFiber.lastEffect = childToDelete; 42542 } 42543} 42544 42545function insertNonHydratedInstance(returnFiber, fiber) { 42546 fiber.effectTag = fiber.effectTag & ~Hydrating | Placement; 42547 42548 { 42549 switch (returnFiber.tag) { 42550 case HostRoot: 42551 { 42552 var parentContainer = returnFiber.stateNode.containerInfo; 42553 42554 switch (fiber.tag) { 42555 case HostComponent: 42556 var type = fiber.type; 42557 var props = fiber.pendingProps; 42558 didNotFindHydratableContainerInstance(parentContainer, type); 42559 break; 42560 42561 case HostText: 42562 var text = fiber.pendingProps; 42563 didNotFindHydratableContainerTextInstance(parentContainer, text); 42564 break; 42565 } 42566 42567 break; 42568 } 42569 42570 case HostComponent: 42571 { 42572 var parentType = returnFiber.type; 42573 var parentProps = returnFiber.memoizedProps; 42574 var parentInstance = returnFiber.stateNode; 42575 42576 switch (fiber.tag) { 42577 case HostComponent: 42578 var _type = fiber.type; 42579 var _props = fiber.pendingProps; 42580 didNotFindHydratableInstance(parentType, parentProps, parentInstance, _type); 42581 break; 42582 42583 case HostText: 42584 var _text = fiber.pendingProps; 42585 didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text); 42586 break; 42587 42588 case SuspenseComponent: 42589 didNotFindHydratableSuspenseInstance(parentType, parentProps); 42590 break; 42591 } 42592 42593 break; 42594 } 42595 42596 default: 42597 return; 42598 } 42599 } 42600} 42601 42602function tryHydrate(fiber, nextInstance) { 42603 switch (fiber.tag) { 42604 case HostComponent: 42605 { 42606 var type = fiber.type; 42607 var props = fiber.pendingProps; 42608 var instance = canHydrateInstance(nextInstance, type); 42609 42610 if (instance !== null) { 42611 fiber.stateNode = instance; 42612 return true; 42613 } 42614 42615 return false; 42616 } 42617 42618 case HostText: 42619 { 42620 var text = fiber.pendingProps; 42621 var textInstance = canHydrateTextInstance(nextInstance, text); 42622 42623 if (textInstance !== null) { 42624 fiber.stateNode = textInstance; 42625 return true; 42626 } 42627 42628 return false; 42629 } 42630 42631 case SuspenseComponent: 42632 { 42633 42634 return false; 42635 } 42636 42637 default: 42638 return false; 42639 } 42640} 42641 42642function tryToClaimNextHydratableInstance(fiber) { 42643 if (!isHydrating) { 42644 return; 42645 } 42646 42647 var nextInstance = nextHydratableInstance; 42648 42649 if (!nextInstance) { 42650 // Nothing to hydrate. Make it an insertion. 42651 insertNonHydratedInstance(hydrationParentFiber, fiber); 42652 isHydrating = false; 42653 hydrationParentFiber = fiber; 42654 return; 42655 } 42656 42657 var firstAttemptedInstance = nextInstance; 42658 42659 if (!tryHydrate(fiber, nextInstance)) { 42660 // If we can't hydrate this instance let's try the next one. 42661 // We use this as a heuristic. It's based on intuition and not data so it 42662 // might be flawed or unnecessary. 42663 nextInstance = getNextHydratableSibling(firstAttemptedInstance); 42664 42665 if (!nextInstance || !tryHydrate(fiber, nextInstance)) { 42666 // Nothing to hydrate. Make it an insertion. 42667 insertNonHydratedInstance(hydrationParentFiber, fiber); 42668 isHydrating = false; 42669 hydrationParentFiber = fiber; 42670 return; 42671 } // We matched the next one, we'll now assume that the first one was 42672 // superfluous and we'll delete it. Since we can't eagerly delete it 42673 // we'll have to schedule a deletion. To do that, this node needs a dummy 42674 // fiber associated with it. 42675 42676 42677 deleteHydratableInstance(hydrationParentFiber, firstAttemptedInstance); 42678 } 42679 42680 hydrationParentFiber = fiber; 42681 nextHydratableInstance = getFirstHydratableChild(nextInstance); 42682} 42683 42684function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) { 42685 42686 var instance = fiber.stateNode; 42687 var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber); // TODO: Type this specific to this type of component. 42688 42689 fiber.updateQueue = updatePayload; // If the update payload indicates that there is a change or if there 42690 // is a new ref we mark this as an update. 42691 42692 if (updatePayload !== null) { 42693 return true; 42694 } 42695 42696 return false; 42697} 42698 42699function prepareToHydrateHostTextInstance(fiber) { 42700 42701 var textInstance = fiber.stateNode; 42702 var textContent = fiber.memoizedProps; 42703 var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber); 42704 42705 { 42706 if (shouldUpdate) { 42707 // We assume that prepareToHydrateHostTextInstance is called in a context where the 42708 // hydration parent is the parent host component of this host text. 42709 var returnFiber = hydrationParentFiber; 42710 42711 if (returnFiber !== null) { 42712 switch (returnFiber.tag) { 42713 case HostRoot: 42714 { 42715 var parentContainer = returnFiber.stateNode.containerInfo; 42716 didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, textContent); 42717 break; 42718 } 42719 42720 case HostComponent: 42721 { 42722 var parentType = returnFiber.type; 42723 var parentProps = returnFiber.memoizedProps; 42724 var parentInstance = returnFiber.stateNode; 42725 didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, textContent); 42726 break; 42727 } 42728 } 42729 } 42730 } 42731 } 42732 42733 return shouldUpdate; 42734} 42735 42736function skipPastDehydratedSuspenseInstance(fiber) { 42737 42738 var suspenseState = fiber.memoizedState; 42739 var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null; 42740 42741 if (!suspenseInstance) { 42742 { 42743 throw Error( "Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue." ); 42744 } 42745 } 42746 42747 return getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance); 42748} 42749 42750function popToNextHostParent(fiber) { 42751 var parent = fiber.return; 42752 42753 while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot && parent.tag !== SuspenseComponent) { 42754 parent = parent.return; 42755 } 42756 42757 hydrationParentFiber = parent; 42758} 42759 42760function popHydrationState(fiber) { 42761 42762 if (fiber !== hydrationParentFiber) { 42763 // We're deeper than the current hydration context, inside an inserted 42764 // tree. 42765 return false; 42766 } 42767 42768 if (!isHydrating) { 42769 // If we're not currently hydrating but we're in a hydration context, then 42770 // we were an insertion and now need to pop up reenter hydration of our 42771 // siblings. 42772 popToNextHostParent(fiber); 42773 isHydrating = true; 42774 return false; 42775 } 42776 42777 var type = fiber.type; // If we have any remaining hydratable nodes, we need to delete them now. 42778 // We only do this deeper than head and body since they tend to have random 42779 // other nodes in them. We also ignore components with pure text content in 42780 // side of them. 42781 // TODO: Better heuristic. 42782 42783 if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) { 42784 var nextInstance = nextHydratableInstance; 42785 42786 while (nextInstance) { 42787 deleteHydratableInstance(fiber, nextInstance); 42788 nextInstance = getNextHydratableSibling(nextInstance); 42789 } 42790 } 42791 42792 popToNextHostParent(fiber); 42793 42794 if (fiber.tag === SuspenseComponent) { 42795 nextHydratableInstance = skipPastDehydratedSuspenseInstance(fiber); 42796 } else { 42797 nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null; 42798 } 42799 42800 return true; 42801} 42802 42803function resetHydrationState() { 42804 42805 hydrationParentFiber = null; 42806 nextHydratableInstance = null; 42807 isHydrating = false; 42808} 42809 42810var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; 42811var didReceiveUpdate = false; 42812var didWarnAboutBadClass; 42813var didWarnAboutModulePatternComponent; 42814var didWarnAboutContextTypeOnFunctionComponent; 42815var didWarnAboutGetDerivedStateOnFunctionComponent; 42816var didWarnAboutFunctionRefs; 42817var didWarnAboutReassigningProps; 42818var didWarnAboutRevealOrder; 42819var didWarnAboutTailOptions; 42820 42821{ 42822 didWarnAboutBadClass = {}; 42823 didWarnAboutModulePatternComponent = {}; 42824 didWarnAboutContextTypeOnFunctionComponent = {}; 42825 didWarnAboutGetDerivedStateOnFunctionComponent = {}; 42826 didWarnAboutFunctionRefs = {}; 42827 didWarnAboutReassigningProps = false; 42828 didWarnAboutRevealOrder = {}; 42829 didWarnAboutTailOptions = {}; 42830} 42831 42832function reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime) { 42833 if (current === null) { 42834 // If this is a fresh new component that hasn't been rendered yet, we 42835 // won't update its child set by applying minimal side-effects. Instead, 42836 // we will add them all to the child before it gets rendered. That means 42837 // we can optimize this reconciliation pass by not tracking side-effects. 42838 workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime); 42839 } else { 42840 // If the current child is the same as the work in progress, it means that 42841 // we haven't yet started any work on these children. Therefore, we use 42842 // the clone algorithm to create a copy of all the current children. 42843 // If we had any progressed work already, that is invalid at this point so 42844 // let's throw it out. 42845 workInProgress.child = reconcileChildFibers(workInProgress, current.child, nextChildren, renderExpirationTime); 42846 } 42847} 42848 42849function forceUnmountCurrentAndReconcile(current, workInProgress, nextChildren, renderExpirationTime) { 42850 // This function is fork of reconcileChildren. It's used in cases where we 42851 // want to reconcile without matching against the existing set. This has the 42852 // effect of all current children being unmounted; even if the type and key 42853 // are the same, the old child is unmounted and a new child is created. 42854 // 42855 // To do this, we're going to go through the reconcile algorithm twice. In 42856 // the first pass, we schedule a deletion for all the current children by 42857 // passing null. 42858 workInProgress.child = reconcileChildFibers(workInProgress, current.child, null, renderExpirationTime); // In the second pass, we mount the new children. The trick here is that we 42859 // pass null in place of where we usually pass the current child set. This has 42860 // the effect of remounting all children regardless of whether their 42861 // identities match. 42862 42863 workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime); 42864} 42865 42866function updateForwardRef(current, workInProgress, Component, nextProps, renderExpirationTime) { 42867 // TODO: current can be non-null here even if the component 42868 // hasn't yet mounted. This happens after the first render suspends. 42869 // We'll need to figure out if this is fine or can cause issues. 42870 { 42871 if (workInProgress.type !== workInProgress.elementType) { 42872 // Lazy component props can't be validated in createElement 42873 // because they're only guaranteed to be resolved here. 42874 var innerPropTypes = Component.propTypes; 42875 42876 if (innerPropTypes) { 42877 checkPropTypes(innerPropTypes, nextProps, // Resolved props 42878 'prop', getComponentName(Component), getCurrentFiberStackInDev); 42879 } 42880 } 42881 } 42882 42883 var render = Component.render; 42884 var ref = workInProgress.ref; // The rest is a fork of updateFunctionComponent 42885 42886 var nextChildren; 42887 prepareToReadContext(workInProgress, renderExpirationTime); 42888 42889 { 42890 ReactCurrentOwner$1.current = workInProgress; 42891 setIsRendering(true); 42892 nextChildren = renderWithHooks(current, workInProgress, render, nextProps, ref, renderExpirationTime); 42893 42894 if ( workInProgress.mode & StrictMode) { 42895 // Only double-render components with Hooks 42896 if (workInProgress.memoizedState !== null) { 42897 nextChildren = renderWithHooks(current, workInProgress, render, nextProps, ref, renderExpirationTime); 42898 } 42899 } 42900 42901 setIsRendering(false); 42902 } 42903 42904 if (current !== null && !didReceiveUpdate) { 42905 bailoutHooks(current, workInProgress, renderExpirationTime); 42906 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime); 42907 } // React DevTools reads this flag. 42908 42909 42910 workInProgress.effectTag |= PerformedWork; 42911 reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime); 42912 return workInProgress.child; 42913} 42914 42915function updateMemoComponent(current, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) { 42916 if (current === null) { 42917 var type = Component.type; 42918 42919 if (isSimpleFunctionComponent(type) && Component.compare === null && // SimpleMemoComponent codepath doesn't resolve outer props either. 42920 Component.defaultProps === undefined) { 42921 var resolvedType = type; 42922 42923 { 42924 resolvedType = resolveFunctionForHotReloading(type); 42925 } // If this is a plain function component without default props, 42926 // and with only the default shallow comparison, we upgrade it 42927 // to a SimpleMemoComponent to allow fast path updates. 42928 42929 42930 workInProgress.tag = SimpleMemoComponent; 42931 workInProgress.type = resolvedType; 42932 42933 { 42934 validateFunctionComponentInDev(workInProgress, type); 42935 } 42936 42937 return updateSimpleMemoComponent(current, workInProgress, resolvedType, nextProps, updateExpirationTime, renderExpirationTime); 42938 } 42939 42940 { 42941 var innerPropTypes = type.propTypes; 42942 42943 if (innerPropTypes) { 42944 // Inner memo component props aren't currently validated in createElement. 42945 // We could move it there, but we'd still need this for lazy code path. 42946 checkPropTypes(innerPropTypes, nextProps, // Resolved props 42947 'prop', getComponentName(type), getCurrentFiberStackInDev); 42948 } 42949 } 42950 42951 var child = createFiberFromTypeAndProps(Component.type, null, nextProps, null, workInProgress.mode, renderExpirationTime); 42952 child.ref = workInProgress.ref; 42953 child.return = workInProgress; 42954 workInProgress.child = child; 42955 return child; 42956 } 42957 42958 { 42959 var _type = Component.type; 42960 var _innerPropTypes = _type.propTypes; 42961 42962 if (_innerPropTypes) { 42963 // Inner memo component props aren't currently validated in createElement. 42964 // We could move it there, but we'd still need this for lazy code path. 42965 checkPropTypes(_innerPropTypes, nextProps, // Resolved props 42966 'prop', getComponentName(_type), getCurrentFiberStackInDev); 42967 } 42968 } 42969 42970 var currentChild = current.child; // This is always exactly one child 42971 42972 if (updateExpirationTime < renderExpirationTime) { 42973 // This will be the props with resolved defaultProps, 42974 // unlike current.memoizedProps which will be the unresolved ones. 42975 var prevProps = currentChild.memoizedProps; // Default to shallow comparison 42976 42977 var compare = Component.compare; 42978 compare = compare !== null ? compare : shallowEqual; 42979 42980 if (compare(prevProps, nextProps) && current.ref === workInProgress.ref) { 42981 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime); 42982 } 42983 } // React DevTools reads this flag. 42984 42985 42986 workInProgress.effectTag |= PerformedWork; 42987 var newChild = createWorkInProgress(currentChild, nextProps); 42988 newChild.ref = workInProgress.ref; 42989 newChild.return = workInProgress; 42990 workInProgress.child = newChild; 42991 return newChild; 42992} 42993 42994function updateSimpleMemoComponent(current, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) { 42995 // TODO: current can be non-null here even if the component 42996 // hasn't yet mounted. This happens when the inner render suspends. 42997 // We'll need to figure out if this is fine or can cause issues. 42998 { 42999 if (workInProgress.type !== workInProgress.elementType) { 43000 // Lazy component props can't be validated in createElement 43001 // because they're only guaranteed to be resolved here. 43002 var outerMemoType = workInProgress.elementType; 43003 43004 if (outerMemoType.$$typeof === REACT_LAZY_TYPE) { 43005 // We warn when you define propTypes on lazy() 43006 // so let's just skip over it to find memo() outer wrapper. 43007 // Inner props for memo are validated later. 43008 outerMemoType = refineResolvedLazyComponent(outerMemoType); 43009 } 43010 43011 var outerPropTypes = outerMemoType && outerMemoType.propTypes; 43012 43013 if (outerPropTypes) { 43014 checkPropTypes(outerPropTypes, nextProps, // Resolved (SimpleMemoComponent has no defaultProps) 43015 'prop', getComponentName(outerMemoType), getCurrentFiberStackInDev); 43016 } // Inner propTypes will be validated in the function component path. 43017 43018 } 43019 } 43020 43021 if (current !== null) { 43022 var prevProps = current.memoizedProps; 43023 43024 if (shallowEqual(prevProps, nextProps) && current.ref === workInProgress.ref && ( // Prevent bailout if the implementation changed due to hot reload. 43025 workInProgress.type === current.type )) { 43026 didReceiveUpdate = false; 43027 43028 if (updateExpirationTime < renderExpirationTime) { 43029 // The pending update priority was cleared at the beginning of 43030 // beginWork. We're about to bail out, but there might be additional 43031 // updates at a lower priority. Usually, the priority level of the 43032 // remaining updates is accumlated during the evaluation of the 43033 // component (i.e. when processing the update queue). But since since 43034 // we're bailing out early *without* evaluating the component, we need 43035 // to account for it here, too. Reset to the value of the current fiber. 43036 // NOTE: This only applies to SimpleMemoComponent, not MemoComponent, 43037 // because a MemoComponent fiber does not have hooks or an update queue; 43038 // rather, it wraps around an inner component, which may or may not 43039 // contains hooks. 43040 // TODO: Move the reset at in beginWork out of the common path so that 43041 // this is no longer necessary. 43042 workInProgress.expirationTime = current.expirationTime; 43043 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime); 43044 } 43045 } 43046 } 43047 43048 return updateFunctionComponent(current, workInProgress, Component, nextProps, renderExpirationTime); 43049} 43050 43051function updateFragment(current, workInProgress, renderExpirationTime) { 43052 var nextChildren = workInProgress.pendingProps; 43053 reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime); 43054 return workInProgress.child; 43055} 43056 43057function updateMode(current, workInProgress, renderExpirationTime) { 43058 var nextChildren = workInProgress.pendingProps.children; 43059 reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime); 43060 return workInProgress.child; 43061} 43062 43063function updateProfiler(current, workInProgress, renderExpirationTime) { 43064 { 43065 workInProgress.effectTag |= Update; 43066 } 43067 43068 var nextProps = workInProgress.pendingProps; 43069 var nextChildren = nextProps.children; 43070 reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime); 43071 return workInProgress.child; 43072} 43073 43074function markRef(current, workInProgress) { 43075 var ref = workInProgress.ref; 43076 43077 if (current === null && ref !== null || current !== null && current.ref !== ref) { 43078 // Schedule a Ref effect 43079 workInProgress.effectTag |= Ref; 43080 } 43081} 43082 43083function updateFunctionComponent(current, workInProgress, Component, nextProps, renderExpirationTime) { 43084 { 43085 if (workInProgress.type !== workInProgress.elementType) { 43086 // Lazy component props can't be validated in createElement 43087 // because they're only guaranteed to be resolved here. 43088 var innerPropTypes = Component.propTypes; 43089 43090 if (innerPropTypes) { 43091 checkPropTypes(innerPropTypes, nextProps, // Resolved props 43092 'prop', getComponentName(Component), getCurrentFiberStackInDev); 43093 } 43094 } 43095 } 43096 43097 var context; 43098 43099 { 43100 var unmaskedContext = getUnmaskedContext(workInProgress, Component, true); 43101 context = getMaskedContext(workInProgress, unmaskedContext); 43102 } 43103 43104 var nextChildren; 43105 prepareToReadContext(workInProgress, renderExpirationTime); 43106 43107 { 43108 ReactCurrentOwner$1.current = workInProgress; 43109 setIsRendering(true); 43110 nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderExpirationTime); 43111 43112 if ( workInProgress.mode & StrictMode) { 43113 // Only double-render components with Hooks 43114 if (workInProgress.memoizedState !== null) { 43115 nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderExpirationTime); 43116 } 43117 } 43118 43119 setIsRendering(false); 43120 } 43121 43122 if (current !== null && !didReceiveUpdate) { 43123 bailoutHooks(current, workInProgress, renderExpirationTime); 43124 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime); 43125 } // React DevTools reads this flag. 43126 43127 43128 workInProgress.effectTag |= PerformedWork; 43129 reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime); 43130 return workInProgress.child; 43131} 43132 43133function updateClassComponent(current, workInProgress, Component, nextProps, renderExpirationTime) { 43134 { 43135 if (workInProgress.type !== workInProgress.elementType) { 43136 // Lazy component props can't be validated in createElement 43137 // because they're only guaranteed to be resolved here. 43138 var innerPropTypes = Component.propTypes; 43139 43140 if (innerPropTypes) { 43141 checkPropTypes(innerPropTypes, nextProps, // Resolved props 43142 'prop', getComponentName(Component), getCurrentFiberStackInDev); 43143 } 43144 } 43145 } // Push context providers early to prevent context stack mismatches. 43146 // During mounting we don't know the child context yet as the instance doesn't exist. 43147 // We will invalidate the child context in finishClassComponent() right after rendering. 43148 43149 43150 var hasContext; 43151 43152 if (isContextProvider(Component)) { 43153 hasContext = true; 43154 pushContextProvider(workInProgress); 43155 } else { 43156 hasContext = false; 43157 } 43158 43159 prepareToReadContext(workInProgress, renderExpirationTime); 43160 var instance = workInProgress.stateNode; 43161 var shouldUpdate; 43162 43163 if (instance === null) { 43164 if (current !== null) { 43165 // A class component without an instance only mounts if it suspended 43166 // inside a non-concurrent tree, in an inconsistent state. We want to 43167 // treat it like a new mount, even though an empty version of it already 43168 // committed. Disconnect the alternate pointers. 43169 current.alternate = null; 43170 workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect 43171 43172 workInProgress.effectTag |= Placement; 43173 } // In the initial pass we might need to construct the instance. 43174 43175 43176 constructClassInstance(workInProgress, Component, nextProps); 43177 mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime); 43178 shouldUpdate = true; 43179 } else if (current === null) { 43180 // In a resume, we'll already have an instance we can reuse. 43181 shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderExpirationTime); 43182 } else { 43183 shouldUpdate = updateClassInstance(current, workInProgress, Component, nextProps, renderExpirationTime); 43184 } 43185 43186 var nextUnitOfWork = finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime); 43187 43188 { 43189 var inst = workInProgress.stateNode; 43190 43191 if (inst.props !== nextProps) { 43192 if (!didWarnAboutReassigningProps) { 43193 error('It looks like %s is reassigning its own `this.props` while rendering. ' + 'This is not supported and can lead to confusing bugs.', getComponentName(workInProgress.type) || 'a component'); 43194 } 43195 43196 didWarnAboutReassigningProps = true; 43197 } 43198 } 43199 43200 return nextUnitOfWork; 43201} 43202 43203function finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime) { 43204 // Refs should update even if shouldComponentUpdate returns false 43205 markRef(current, workInProgress); 43206 var didCaptureError = (workInProgress.effectTag & DidCapture) !== NoEffect; 43207 43208 if (!shouldUpdate && !didCaptureError) { 43209 // Context providers should defer to sCU for rendering 43210 if (hasContext) { 43211 invalidateContextProvider(workInProgress, Component, false); 43212 } 43213 43214 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime); 43215 } 43216 43217 var instance = workInProgress.stateNode; // Rerender 43218 43219 ReactCurrentOwner$1.current = workInProgress; 43220 var nextChildren; 43221 43222 if (didCaptureError && typeof Component.getDerivedStateFromError !== 'function') { 43223 // If we captured an error, but getDerivedStateFromError is not defined, 43224 // unmount all the children. componentDidCatch will schedule an update to 43225 // re-render a fallback. This is temporary until we migrate everyone to 43226 // the new API. 43227 // TODO: Warn in a future release. 43228 nextChildren = null; 43229 43230 { 43231 stopProfilerTimerIfRunning(); 43232 } 43233 } else { 43234 { 43235 setIsRendering(true); 43236 nextChildren = instance.render(); 43237 43238 if ( workInProgress.mode & StrictMode) { 43239 instance.render(); 43240 } 43241 43242 setIsRendering(false); 43243 } 43244 } // React DevTools reads this flag. 43245 43246 43247 workInProgress.effectTag |= PerformedWork; 43248 43249 if (current !== null && didCaptureError) { 43250 // If we're recovering from an error, reconcile without reusing any of 43251 // the existing children. Conceptually, the normal children and the children 43252 // that are shown on error are two different sets, so we shouldn't reuse 43253 // normal children even if their identities match. 43254 forceUnmountCurrentAndReconcile(current, workInProgress, nextChildren, renderExpirationTime); 43255 } else { 43256 reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime); 43257 } // Memoize state using the values we just used to render. 43258 // TODO: Restructure so we never read values from the instance. 43259 43260 43261 workInProgress.memoizedState = instance.state; // The context might have changed so we need to recalculate it. 43262 43263 if (hasContext) { 43264 invalidateContextProvider(workInProgress, Component, true); 43265 } 43266 43267 return workInProgress.child; 43268} 43269 43270function pushHostRootContext(workInProgress) { 43271 var root = workInProgress.stateNode; 43272 43273 if (root.pendingContext) { 43274 pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context); 43275 } else if (root.context) { 43276 // Should always be set 43277 pushTopLevelContextObject(workInProgress, root.context, false); 43278 } 43279 43280 pushHostContainer(workInProgress, root.containerInfo); 43281} 43282 43283function updateHostRoot(current, workInProgress, renderExpirationTime) { 43284 pushHostRootContext(workInProgress); 43285 var updateQueue = workInProgress.updateQueue; 43286 43287 if (!(current !== null && updateQueue !== null)) { 43288 { 43289 throw Error( "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." ); 43290 } 43291 } 43292 43293 var nextProps = workInProgress.pendingProps; 43294 var prevState = workInProgress.memoizedState; 43295 var prevChildren = prevState !== null ? prevState.element : null; 43296 cloneUpdateQueue(current, workInProgress); 43297 processUpdateQueue(workInProgress, nextProps, null, renderExpirationTime); 43298 var nextState = workInProgress.memoizedState; // Caution: React DevTools currently depends on this property 43299 // being called "element". 43300 43301 var nextChildren = nextState.element; 43302 43303 if (nextChildren === prevChildren) { 43304 // If the state is the same as before, that's a bailout because we had 43305 // no work that expires at this time. 43306 resetHydrationState(); 43307 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime); 43308 } 43309 43310 var root = workInProgress.stateNode; 43311 43312 if (root.hydrate && enterHydrationState(workInProgress)) { 43313 // If we don't have any current children this might be the first pass. 43314 // We always try to hydrate. If this isn't a hydration pass there won't 43315 // be any children to hydrate which is effectively the same thing as 43316 // not hydrating. 43317 var child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime); 43318 workInProgress.child = child; 43319 var node = child; 43320 43321 while (node) { 43322 // Mark each child as hydrating. This is a fast path to know whether this 43323 // tree is part of a hydrating tree. This is used to determine if a child 43324 // node has fully mounted yet, and for scheduling event replaying. 43325 // Conceptually this is similar to Placement in that a new subtree is 43326 // inserted into the React tree here. It just happens to not need DOM 43327 // mutations because it already exists. 43328 node.effectTag = node.effectTag & ~Placement | Hydrating; 43329 node = node.sibling; 43330 } 43331 } else { 43332 // Otherwise reset hydration state in case we aborted and resumed another 43333 // root. 43334 reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime); 43335 resetHydrationState(); 43336 } 43337 43338 return workInProgress.child; 43339} 43340 43341function updateHostComponent(current, workInProgress, renderExpirationTime) { 43342 pushHostContext(workInProgress); 43343 43344 if (current === null) { 43345 tryToClaimNextHydratableInstance(workInProgress); 43346 } 43347 43348 var type = workInProgress.type; 43349 var nextProps = workInProgress.pendingProps; 43350 var prevProps = current !== null ? current.memoizedProps : null; 43351 var nextChildren = nextProps.children; 43352 var isDirectTextChild = shouldSetTextContent(type, nextProps); 43353 43354 if (isDirectTextChild) { 43355 // We special case a direct text child of a host node. This is a common 43356 // case. We won't handle it as a reified child. We will instead handle 43357 // this in the host environment that also has access to this prop. That 43358 // avoids allocating another HostText fiber and traversing it. 43359 nextChildren = null; 43360 } else if (prevProps !== null && shouldSetTextContent(type, prevProps)) { 43361 // If we're switching from a direct text child to a normal child, or to 43362 // empty, we need to schedule the text content to be reset. 43363 workInProgress.effectTag |= ContentReset; 43364 } 43365 43366 markRef(current, workInProgress); // Check the host config to see if the children are offscreen/hidden. 43367 43368 if (workInProgress.mode & ConcurrentMode && renderExpirationTime !== Never && shouldDeprioritizeSubtree(type, nextProps)) { 43369 { 43370 markSpawnedWork(Never); 43371 } // Schedule this fiber to re-render at offscreen priority. Then bailout. 43372 43373 43374 workInProgress.expirationTime = workInProgress.childExpirationTime = Never; 43375 return null; 43376 } 43377 43378 reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime); 43379 return workInProgress.child; 43380} 43381 43382function updateHostText(current, workInProgress) { 43383 if (current === null) { 43384 tryToClaimNextHydratableInstance(workInProgress); 43385 } // Nothing to do here. This is terminal. We'll do the completion step 43386 // immediately after. 43387 43388 43389 return null; 43390} 43391 43392function mountLazyComponent(_current, workInProgress, elementType, updateExpirationTime, renderExpirationTime) { 43393 if (_current !== null) { 43394 // A lazy component only mounts if it suspended inside a non- 43395 // concurrent tree, in an inconsistent state. We want to treat it like 43396 // a new mount, even though an empty version of it already committed. 43397 // Disconnect the alternate pointers. 43398 _current.alternate = null; 43399 workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect 43400 43401 workInProgress.effectTag |= Placement; 43402 } 43403 43404 var props = workInProgress.pendingProps; // We can't start a User Timing measurement with correct label yet. 43405 // Cancel and resume right after we know the tag. 43406 43407 cancelWorkTimer(workInProgress); 43408 var Component = readLazyComponentType(elementType); // Store the unwrapped component in the type. 43409 43410 workInProgress.type = Component; 43411 var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component); 43412 startWorkTimer(workInProgress); 43413 var resolvedProps = resolveDefaultProps(Component, props); 43414 var child; 43415 43416 switch (resolvedTag) { 43417 case FunctionComponent: 43418 { 43419 { 43420 validateFunctionComponentInDev(workInProgress, Component); 43421 workInProgress.type = Component = resolveFunctionForHotReloading(Component); 43422 } 43423 43424 child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime); 43425 return child; 43426 } 43427 43428 case ClassComponent: 43429 { 43430 { 43431 workInProgress.type = Component = resolveClassForHotReloading(Component); 43432 } 43433 43434 child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime); 43435 return child; 43436 } 43437 43438 case ForwardRef: 43439 { 43440 { 43441 workInProgress.type = Component = resolveForwardRefForHotReloading(Component); 43442 } 43443 43444 child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderExpirationTime); 43445 return child; 43446 } 43447 43448 case MemoComponent: 43449 { 43450 { 43451 if (workInProgress.type !== workInProgress.elementType) { 43452 var outerPropTypes = Component.propTypes; 43453 43454 if (outerPropTypes) { 43455 checkPropTypes(outerPropTypes, resolvedProps, // Resolved for outer only 43456 'prop', getComponentName(Component), getCurrentFiberStackInDev); 43457 } 43458 } 43459 } 43460 43461 child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too 43462 updateExpirationTime, renderExpirationTime); 43463 return child; 43464 } 43465 } 43466 43467 var hint = ''; 43468 43469 { 43470 if (Component !== null && typeof Component === 'object' && Component.$$typeof === REACT_LAZY_TYPE) { 43471 hint = ' Did you wrap a component in React.lazy() more than once?'; 43472 } 43473 } // This message intentionally doesn't mention ForwardRef or MemoComponent 43474 // because the fact that it's a separate type of work is an 43475 // implementation detail. 43476 43477 43478 { 43479 { 43480 throw Error( "Element type is invalid. Received a promise that resolves to: " + Component + ". Lazy element type must resolve to a class or function." + hint ); 43481 } 43482 } 43483} 43484 43485function mountIncompleteClassComponent(_current, workInProgress, Component, nextProps, renderExpirationTime) { 43486 if (_current !== null) { 43487 // An incomplete component only mounts if it suspended inside a non- 43488 // concurrent tree, in an inconsistent state. We want to treat it like 43489 // a new mount, even though an empty version of it already committed. 43490 // Disconnect the alternate pointers. 43491 _current.alternate = null; 43492 workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect 43493 43494 workInProgress.effectTag |= Placement; 43495 } // Promote the fiber to a class and try rendering again. 43496 43497 43498 workInProgress.tag = ClassComponent; // The rest of this function is a fork of `updateClassComponent` 43499 // Push context providers early to prevent context stack mismatches. 43500 // During mounting we don't know the child context yet as the instance doesn't exist. 43501 // We will invalidate the child context in finishClassComponent() right after rendering. 43502 43503 var hasContext; 43504 43505 if (isContextProvider(Component)) { 43506 hasContext = true; 43507 pushContextProvider(workInProgress); 43508 } else { 43509 hasContext = false; 43510 } 43511 43512 prepareToReadContext(workInProgress, renderExpirationTime); 43513 constructClassInstance(workInProgress, Component, nextProps); 43514 mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime); 43515 return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime); 43516} 43517 43518function mountIndeterminateComponent(_current, workInProgress, Component, renderExpirationTime) { 43519 if (_current !== null) { 43520 // An indeterminate component only mounts if it suspended inside a non- 43521 // concurrent tree, in an inconsistent state. We want to treat it like 43522 // a new mount, even though an empty version of it already committed. 43523 // Disconnect the alternate pointers. 43524 _current.alternate = null; 43525 workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect 43526 43527 workInProgress.effectTag |= Placement; 43528 } 43529 43530 var props = workInProgress.pendingProps; 43531 var context; 43532 43533 { 43534 var unmaskedContext = getUnmaskedContext(workInProgress, Component, false); 43535 context = getMaskedContext(workInProgress, unmaskedContext); 43536 } 43537 43538 prepareToReadContext(workInProgress, renderExpirationTime); 43539 var value; 43540 43541 { 43542 if (Component.prototype && typeof Component.prototype.render === 'function') { 43543 var componentName = getComponentName(Component) || 'Unknown'; 43544 43545 if (!didWarnAboutBadClass[componentName]) { 43546 error("The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName); 43547 43548 didWarnAboutBadClass[componentName] = true; 43549 } 43550 } 43551 43552 if (workInProgress.mode & StrictMode) { 43553 ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null); 43554 } 43555 43556 setIsRendering(true); 43557 ReactCurrentOwner$1.current = workInProgress; 43558 value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime); 43559 setIsRendering(false); 43560 } // React DevTools reads this flag. 43561 43562 43563 workInProgress.effectTag |= PerformedWork; 43564 43565 if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) { 43566 { 43567 var _componentName = getComponentName(Component) || 'Unknown'; 43568 43569 if (!didWarnAboutModulePatternComponent[_componentName]) { 43570 error('The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName, _componentName, _componentName); 43571 43572 didWarnAboutModulePatternComponent[_componentName] = true; 43573 } 43574 } // Proceed under the assumption that this is a class instance 43575 43576 43577 workInProgress.tag = ClassComponent; // Throw out any hooks that were used. 43578 43579 workInProgress.memoizedState = null; 43580 workInProgress.updateQueue = null; // Push context providers early to prevent context stack mismatches. 43581 // During mounting we don't know the child context yet as the instance doesn't exist. 43582 // We will invalidate the child context in finishClassComponent() right after rendering. 43583 43584 var hasContext = false; 43585 43586 if (isContextProvider(Component)) { 43587 hasContext = true; 43588 pushContextProvider(workInProgress); 43589 } else { 43590 hasContext = false; 43591 } 43592 43593 workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null; 43594 initializeUpdateQueue(workInProgress); 43595 var getDerivedStateFromProps = Component.getDerivedStateFromProps; 43596 43597 if (typeof getDerivedStateFromProps === 'function') { 43598 applyDerivedStateFromProps(workInProgress, Component, getDerivedStateFromProps, props); 43599 } 43600 43601 adoptClassInstance(workInProgress, value); 43602 mountClassInstance(workInProgress, Component, props, renderExpirationTime); 43603 return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime); 43604 } else { 43605 // Proceed under the assumption that this is a function component 43606 workInProgress.tag = FunctionComponent; 43607 43608 { 43609 43610 if ( workInProgress.mode & StrictMode) { 43611 // Only double-render components with Hooks 43612 if (workInProgress.memoizedState !== null) { 43613 value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime); 43614 } 43615 } 43616 } 43617 43618 reconcileChildren(null, workInProgress, value, renderExpirationTime); 43619 43620 { 43621 validateFunctionComponentInDev(workInProgress, Component); 43622 } 43623 43624 return workInProgress.child; 43625 } 43626} 43627 43628function validateFunctionComponentInDev(workInProgress, Component) { 43629 { 43630 if (Component) { 43631 if (Component.childContextTypes) { 43632 error('%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component'); 43633 } 43634 } 43635 43636 if (workInProgress.ref !== null) { 43637 var info = ''; 43638 var ownerName = getCurrentFiberOwnerNameInDevOrNull(); 43639 43640 if (ownerName) { 43641 info += '\n\nCheck the render method of `' + ownerName + '`.'; 43642 } 43643 43644 var warningKey = ownerName || workInProgress._debugID || ''; 43645 var debugSource = workInProgress._debugSource; 43646 43647 if (debugSource) { 43648 warningKey = debugSource.fileName + ':' + debugSource.lineNumber; 43649 } 43650 43651 if (!didWarnAboutFunctionRefs[warningKey]) { 43652 didWarnAboutFunctionRefs[warningKey] = true; 43653 43654 error('Function components cannot be given refs. ' + 'Attempts to access this ref will fail. ' + 'Did you mean to use React.forwardRef()?%s', info); 43655 } 43656 } 43657 43658 if (typeof Component.getDerivedStateFromProps === 'function') { 43659 var _componentName2 = getComponentName(Component) || 'Unknown'; 43660 43661 if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2]) { 43662 error('%s: Function components do not support getDerivedStateFromProps.', _componentName2); 43663 43664 didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] = true; 43665 } 43666 } 43667 43668 if (typeof Component.contextType === 'object' && Component.contextType !== null) { 43669 var _componentName3 = getComponentName(Component) || 'Unknown'; 43670 43671 if (!didWarnAboutContextTypeOnFunctionComponent[_componentName3]) { 43672 error('%s: Function components do not support contextType.', _componentName3); 43673 43674 didWarnAboutContextTypeOnFunctionComponent[_componentName3] = true; 43675 } 43676 } 43677 } 43678} 43679 43680var SUSPENDED_MARKER = { 43681 dehydrated: null, 43682 retryTime: NoWork 43683}; 43684 43685function shouldRemainOnFallback(suspenseContext, current, workInProgress) { 43686 // If the context is telling us that we should show a fallback, and we're not 43687 // already showing content, then we should show the fallback instead. 43688 return hasSuspenseContext(suspenseContext, ForceSuspenseFallback) && (current === null || current.memoizedState !== null); 43689} 43690 43691function updateSuspenseComponent(current, workInProgress, renderExpirationTime) { 43692 var mode = workInProgress.mode; 43693 var nextProps = workInProgress.pendingProps; // This is used by DevTools to force a boundary to suspend. 43694 43695 { 43696 if (shouldSuspend(workInProgress)) { 43697 workInProgress.effectTag |= DidCapture; 43698 } 43699 } 43700 43701 var suspenseContext = suspenseStackCursor.current; 43702 var nextDidTimeout = false; 43703 var didSuspend = (workInProgress.effectTag & DidCapture) !== NoEffect; 43704 43705 if (didSuspend || shouldRemainOnFallback(suspenseContext, current)) { 43706 // Something in this boundary's subtree already suspended. Switch to 43707 // rendering the fallback children. 43708 nextDidTimeout = true; 43709 workInProgress.effectTag &= ~DidCapture; 43710 } else { 43711 // Attempting the main content 43712 if (current === null || current.memoizedState !== null) { 43713 // This is a new mount or this boundary is already showing a fallback state. 43714 // Mark this subtree context as having at least one invisible parent that could 43715 // handle the fallback state. 43716 // Boundaries without fallbacks or should be avoided are not considered since 43717 // they cannot handle preferred fallback states. 43718 if (nextProps.fallback !== undefined && nextProps.unstable_avoidThisFallback !== true) { 43719 suspenseContext = addSubtreeSuspenseContext(suspenseContext, InvisibleParentSuspenseContext); 43720 } 43721 } 43722 } 43723 43724 suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); 43725 pushSuspenseContext(workInProgress, suspenseContext); // This next part is a bit confusing. If the children timeout, we switch to 43726 // showing the fallback children in place of the "primary" children. 43727 // However, we don't want to delete the primary children because then their 43728 // state will be lost (both the React state and the host state, e.g. 43729 // uncontrolled form inputs). Instead we keep them mounted and hide them. 43730 // Both the fallback children AND the primary children are rendered at the 43731 // same time. Once the primary children are un-suspended, we can delete 43732 // the fallback children â don't need to preserve their state. 43733 // 43734 // The two sets of children are siblings in the host environment, but 43735 // semantically, for purposes of reconciliation, they are two separate sets. 43736 // So we store them using two fragment fibers. 43737 // 43738 // However, we want to avoid allocating extra fibers for every placeholder. 43739 // They're only necessary when the children time out, because that's the 43740 // only time when both sets are mounted. 43741 // 43742 // So, the extra fragment fibers are only used if the children time out. 43743 // Otherwise, we render the primary children directly. This requires some 43744 // custom reconciliation logic to preserve the state of the primary 43745 // children. It's essentially a very basic form of re-parenting. 43746 43747 if (current === null) { 43748 // If we're currently hydrating, try to hydrate this boundary. 43749 // But only if this has a fallback. 43750 if (nextProps.fallback !== undefined) { 43751 tryToClaimNextHydratableInstance(workInProgress); // This could've been a dehydrated suspense component. 43752 } // This is the initial mount. This branch is pretty simple because there's 43753 // no previous state that needs to be preserved. 43754 43755 43756 if (nextDidTimeout) { 43757 // Mount separate fragments for primary and fallback children. 43758 var nextFallbackChildren = nextProps.fallback; 43759 var primaryChildFragment = createFiberFromFragment(null, mode, NoWork, null); 43760 primaryChildFragment.return = workInProgress; 43761 43762 if ((workInProgress.mode & BlockingMode) === NoMode) { 43763 // Outside of blocking mode, we commit the effects from the 43764 // partially completed, timed-out tree, too. 43765 var progressedState = workInProgress.memoizedState; 43766 var progressedPrimaryChild = progressedState !== null ? workInProgress.child.child : workInProgress.child; 43767 primaryChildFragment.child = progressedPrimaryChild; 43768 var progressedChild = progressedPrimaryChild; 43769 43770 while (progressedChild !== null) { 43771 progressedChild.return = primaryChildFragment; 43772 progressedChild = progressedChild.sibling; 43773 } 43774 } 43775 43776 var fallbackChildFragment = createFiberFromFragment(nextFallbackChildren, mode, renderExpirationTime, null); 43777 fallbackChildFragment.return = workInProgress; 43778 primaryChildFragment.sibling = fallbackChildFragment; // Skip the primary children, and continue working on the 43779 // fallback children. 43780 43781 workInProgress.memoizedState = SUSPENDED_MARKER; 43782 workInProgress.child = primaryChildFragment; 43783 return fallbackChildFragment; 43784 } else { 43785 // Mount the primary children without an intermediate fragment fiber. 43786 var nextPrimaryChildren = nextProps.children; 43787 workInProgress.memoizedState = null; 43788 return workInProgress.child = mountChildFibers(workInProgress, null, nextPrimaryChildren, renderExpirationTime); 43789 } 43790 } else { 43791 // This is an update. This branch is more complicated because we need to 43792 // ensure the state of the primary children is preserved. 43793 var prevState = current.memoizedState; 43794 43795 if (prevState !== null) { 43796 // wrapped in a fragment fiber. 43797 43798 43799 var currentPrimaryChildFragment = current.child; 43800 var currentFallbackChildFragment = currentPrimaryChildFragment.sibling; 43801 43802 if (nextDidTimeout) { 43803 // Still timed out. Reuse the current primary children by cloning 43804 // its fragment. We're going to skip over these entirely. 43805 var _nextFallbackChildren2 = nextProps.fallback; 43806 43807 var _primaryChildFragment2 = createWorkInProgress(currentPrimaryChildFragment, currentPrimaryChildFragment.pendingProps); 43808 43809 _primaryChildFragment2.return = workInProgress; 43810 43811 if ((workInProgress.mode & BlockingMode) === NoMode) { 43812 // Outside of blocking mode, we commit the effects from the 43813 // partially completed, timed-out tree, too. 43814 var _progressedState = workInProgress.memoizedState; 43815 43816 var _progressedPrimaryChild = _progressedState !== null ? workInProgress.child.child : workInProgress.child; 43817 43818 if (_progressedPrimaryChild !== currentPrimaryChildFragment.child) { 43819 _primaryChildFragment2.child = _progressedPrimaryChild; 43820 var _progressedChild2 = _progressedPrimaryChild; 43821 43822 while (_progressedChild2 !== null) { 43823 _progressedChild2.return = _primaryChildFragment2; 43824 _progressedChild2 = _progressedChild2.sibling; 43825 } 43826 } 43827 } // Because primaryChildFragment is a new fiber that we're inserting as the 43828 // parent of a new tree, we need to set its treeBaseDuration. 43829 43830 43831 if ( workInProgress.mode & ProfileMode) { 43832 // treeBaseDuration is the sum of all the child tree base durations. 43833 var _treeBaseDuration = 0; 43834 var _hiddenChild = _primaryChildFragment2.child; 43835 43836 while (_hiddenChild !== null) { 43837 _treeBaseDuration += _hiddenChild.treeBaseDuration; 43838 _hiddenChild = _hiddenChild.sibling; 43839 } 43840 43841 _primaryChildFragment2.treeBaseDuration = _treeBaseDuration; 43842 } // Clone the fallback child fragment, too. These we'll continue 43843 // working on. 43844 43845 43846 var _fallbackChildFragment2 = createWorkInProgress(currentFallbackChildFragment, _nextFallbackChildren2); 43847 43848 _fallbackChildFragment2.return = workInProgress; 43849 _primaryChildFragment2.sibling = _fallbackChildFragment2; 43850 _primaryChildFragment2.childExpirationTime = NoWork; // Skip the primary children, and continue working on the 43851 // fallback children. 43852 43853 workInProgress.memoizedState = SUSPENDED_MARKER; 43854 workInProgress.child = _primaryChildFragment2; 43855 return _fallbackChildFragment2; 43856 } else { 43857 // No longer suspended. Switch back to showing the primary children, 43858 // and remove the intermediate fragment fiber. 43859 var _nextPrimaryChildren = nextProps.children; 43860 var currentPrimaryChild = currentPrimaryChildFragment.child; 43861 var primaryChild = reconcileChildFibers(workInProgress, currentPrimaryChild, _nextPrimaryChildren, renderExpirationTime); // If this render doesn't suspend, we need to delete the fallback 43862 // children. Wait until the complete phase, after we've confirmed the 43863 // fallback is no longer needed. 43864 // TODO: Would it be better to store the fallback fragment on 43865 // the stateNode? 43866 // Continue rendering the children, like we normally do. 43867 43868 workInProgress.memoizedState = null; 43869 return workInProgress.child = primaryChild; 43870 } 43871 } else { 43872 // The current tree has not already timed out. That means the primary 43873 // children are not wrapped in a fragment fiber. 43874 var _currentPrimaryChild = current.child; 43875 43876 if (nextDidTimeout) { 43877 // Timed out. Wrap the children in a fragment fiber to keep them 43878 // separate from the fallback children. 43879 var _nextFallbackChildren3 = nextProps.fallback; 43880 43881 var _primaryChildFragment3 = createFiberFromFragment( // It shouldn't matter what the pending props are because we aren't 43882 // going to render this fragment. 43883 null, mode, NoWork, null); 43884 43885 _primaryChildFragment3.return = workInProgress; 43886 _primaryChildFragment3.child = _currentPrimaryChild; 43887 43888 if (_currentPrimaryChild !== null) { 43889 _currentPrimaryChild.return = _primaryChildFragment3; 43890 } // Even though we're creating a new fiber, there are no new children, 43891 // because we're reusing an already mounted tree. So we don't need to 43892 // schedule a placement. 43893 // primaryChildFragment.effectTag |= Placement; 43894 43895 43896 if ((workInProgress.mode & BlockingMode) === NoMode) { 43897 // Outside of blocking mode, we commit the effects from the 43898 // partially completed, timed-out tree, too. 43899 var _progressedState2 = workInProgress.memoizedState; 43900 43901 var _progressedPrimaryChild2 = _progressedState2 !== null ? workInProgress.child.child : workInProgress.child; 43902 43903 _primaryChildFragment3.child = _progressedPrimaryChild2; 43904 var _progressedChild3 = _progressedPrimaryChild2; 43905 43906 while (_progressedChild3 !== null) { 43907 _progressedChild3.return = _primaryChildFragment3; 43908 _progressedChild3 = _progressedChild3.sibling; 43909 } 43910 } // Because primaryChildFragment is a new fiber that we're inserting as the 43911 // parent of a new tree, we need to set its treeBaseDuration. 43912 43913 43914 if ( workInProgress.mode & ProfileMode) { 43915 // treeBaseDuration is the sum of all the child tree base durations. 43916 var _treeBaseDuration2 = 0; 43917 var _hiddenChild2 = _primaryChildFragment3.child; 43918 43919 while (_hiddenChild2 !== null) { 43920 _treeBaseDuration2 += _hiddenChild2.treeBaseDuration; 43921 _hiddenChild2 = _hiddenChild2.sibling; 43922 } 43923 43924 _primaryChildFragment3.treeBaseDuration = _treeBaseDuration2; 43925 } // Create a fragment from the fallback children, too. 43926 43927 43928 var _fallbackChildFragment3 = createFiberFromFragment(_nextFallbackChildren3, mode, renderExpirationTime, null); 43929 43930 _fallbackChildFragment3.return = workInProgress; 43931 _primaryChildFragment3.sibling = _fallbackChildFragment3; 43932 _fallbackChildFragment3.effectTag |= Placement; 43933 _primaryChildFragment3.childExpirationTime = NoWork; // Skip the primary children, and continue working on the 43934 // fallback children. 43935 43936 workInProgress.memoizedState = SUSPENDED_MARKER; 43937 workInProgress.child = _primaryChildFragment3; 43938 return _fallbackChildFragment3; 43939 } else { 43940 // Still haven't timed out. Continue rendering the children, like we 43941 // normally do. 43942 workInProgress.memoizedState = null; 43943 var _nextPrimaryChildren2 = nextProps.children; 43944 return workInProgress.child = reconcileChildFibers(workInProgress, _currentPrimaryChild, _nextPrimaryChildren2, renderExpirationTime); 43945 } 43946 } 43947 } 43948} 43949 43950function scheduleWorkOnFiber(fiber, renderExpirationTime) { 43951 if (fiber.expirationTime < renderExpirationTime) { 43952 fiber.expirationTime = renderExpirationTime; 43953 } 43954 43955 var alternate = fiber.alternate; 43956 43957 if (alternate !== null && alternate.expirationTime < renderExpirationTime) { 43958 alternate.expirationTime = renderExpirationTime; 43959 } 43960 43961 scheduleWorkOnParentPath(fiber.return, renderExpirationTime); 43962} 43963 43964function propagateSuspenseContextChange(workInProgress, firstChild, renderExpirationTime) { 43965 // Mark any Suspense boundaries with fallbacks as having work to do. 43966 // If they were previously forced into fallbacks, they may now be able 43967 // to unblock. 43968 var node = firstChild; 43969 43970 while (node !== null) { 43971 if (node.tag === SuspenseComponent) { 43972 var state = node.memoizedState; 43973 43974 if (state !== null) { 43975 scheduleWorkOnFiber(node, renderExpirationTime); 43976 } 43977 } else if (node.tag === SuspenseListComponent) { 43978 // If the tail is hidden there might not be an Suspense boundaries 43979 // to schedule work on. In this case we have to schedule it on the 43980 // list itself. 43981 // We don't have to traverse to the children of the list since 43982 // the list will propagate the change when it rerenders. 43983 scheduleWorkOnFiber(node, renderExpirationTime); 43984 } else if (node.child !== null) { 43985 node.child.return = node; 43986 node = node.child; 43987 continue; 43988 } 43989 43990 if (node === workInProgress) { 43991 return; 43992 } 43993 43994 while (node.sibling === null) { 43995 if (node.return === null || node.return === workInProgress) { 43996 return; 43997 } 43998 43999 node = node.return; 44000 } 44001 44002 node.sibling.return = node.return; 44003 node = node.sibling; 44004 } 44005} 44006 44007function findLastContentRow(firstChild) { 44008 // This is going to find the last row among these children that is already 44009 // showing content on the screen, as opposed to being in fallback state or 44010 // new. If a row has multiple Suspense boundaries, any of them being in the 44011 // fallback state, counts as the whole row being in a fallback state. 44012 // Note that the "rows" will be workInProgress, but any nested children 44013 // will still be current since we haven't rendered them yet. The mounted 44014 // order may not be the same as the new order. We use the new order. 44015 var row = firstChild; 44016 var lastContentRow = null; 44017 44018 while (row !== null) { 44019 var currentRow = row.alternate; // New rows can't be content rows. 44020 44021 if (currentRow !== null && findFirstSuspended(currentRow) === null) { 44022 lastContentRow = row; 44023 } 44024 44025 row = row.sibling; 44026 } 44027 44028 return lastContentRow; 44029} 44030 44031function validateRevealOrder(revealOrder) { 44032 { 44033 if (revealOrder !== undefined && revealOrder !== 'forwards' && revealOrder !== 'backwards' && revealOrder !== 'together' && !didWarnAboutRevealOrder[revealOrder]) { 44034 didWarnAboutRevealOrder[revealOrder] = true; 44035 44036 if (typeof revealOrder === 'string') { 44037 switch (revealOrder.toLowerCase()) { 44038 case 'together': 44039 case 'forwards': 44040 case 'backwards': 44041 { 44042 error('"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'Use lowercase "%s" instead.', revealOrder, revealOrder.toLowerCase()); 44043 44044 break; 44045 } 44046 44047 case 'forward': 44048 case 'backward': 44049 { 44050 error('"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'React uses the -s suffix in the spelling. Use "%ss" instead.', revealOrder, revealOrder.toLowerCase()); 44051 44052 break; 44053 } 44054 44055 default: 44056 error('"%s" is not a supported revealOrder on <SuspenseList />. ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder); 44057 44058 break; 44059 } 44060 } else { 44061 error('%s is not a supported value for revealOrder on <SuspenseList />. ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder); 44062 } 44063 } 44064 } 44065} 44066 44067function validateTailOptions(tailMode, revealOrder) { 44068 { 44069 if (tailMode !== undefined && !didWarnAboutTailOptions[tailMode]) { 44070 if (tailMode !== 'collapsed' && tailMode !== 'hidden') { 44071 didWarnAboutTailOptions[tailMode] = true; 44072 44073 error('"%s" is not a supported value for tail on <SuspenseList />. ' + 'Did you mean "collapsed" or "hidden"?', tailMode); 44074 } else if (revealOrder !== 'forwards' && revealOrder !== 'backwards') { 44075 didWarnAboutTailOptions[tailMode] = true; 44076 44077 error('<SuspenseList tail="%s" /> is only valid if revealOrder is ' + '"forwards" or "backwards". ' + 'Did you mean to specify revealOrder="forwards"?', tailMode); 44078 } 44079 } 44080 } 44081} 44082 44083function validateSuspenseListNestedChild(childSlot, index) { 44084 { 44085 var isArray = Array.isArray(childSlot); 44086 var isIterable = !isArray && typeof getIteratorFn(childSlot) === 'function'; 44087 44088 if (isArray || isIterable) { 44089 var type = isArray ? 'array' : 'iterable'; 44090 44091 error('A nested %s was passed to row #%s in <SuspenseList />. Wrap it in ' + 'an additional SuspenseList to configure its revealOrder: ' + '<SuspenseList revealOrder=...> ... ' + '<SuspenseList revealOrder=...>{%s}</SuspenseList> ... ' + '</SuspenseList>', type, index, type); 44092 44093 return false; 44094 } 44095 } 44096 44097 return true; 44098} 44099 44100function validateSuspenseListChildren(children, revealOrder) { 44101 { 44102 if ((revealOrder === 'forwards' || revealOrder === 'backwards') && children !== undefined && children !== null && children !== false) { 44103 if (Array.isArray(children)) { 44104 for (var i = 0; i < children.length; i++) { 44105 if (!validateSuspenseListNestedChild(children[i], i)) { 44106 return; 44107 } 44108 } 44109 } else { 44110 var iteratorFn = getIteratorFn(children); 44111 44112 if (typeof iteratorFn === 'function') { 44113 var childrenIterator = iteratorFn.call(children); 44114 44115 if (childrenIterator) { 44116 var step = childrenIterator.next(); 44117 var _i = 0; 44118 44119 for (; !step.done; step = childrenIterator.next()) { 44120 if (!validateSuspenseListNestedChild(step.value, _i)) { 44121 return; 44122 } 44123 44124 _i++; 44125 } 44126 } 44127 } else { 44128 error('A single row was passed to a <SuspenseList revealOrder="%s" />. ' + 'This is not useful since it needs multiple rows. ' + 'Did you mean to pass multiple children or an array?', revealOrder); 44129 } 44130 } 44131 } 44132 } 44133} 44134 44135function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode, lastEffectBeforeRendering) { 44136 var renderState = workInProgress.memoizedState; 44137 44138 if (renderState === null) { 44139 workInProgress.memoizedState = { 44140 isBackwards: isBackwards, 44141 rendering: null, 44142 renderingStartTime: 0, 44143 last: lastContentRow, 44144 tail: tail, 44145 tailExpiration: 0, 44146 tailMode: tailMode, 44147 lastEffect: lastEffectBeforeRendering 44148 }; 44149 } else { 44150 // We can reuse the existing object from previous renders. 44151 renderState.isBackwards = isBackwards; 44152 renderState.rendering = null; 44153 renderState.renderingStartTime = 0; 44154 renderState.last = lastContentRow; 44155 renderState.tail = tail; 44156 renderState.tailExpiration = 0; 44157 renderState.tailMode = tailMode; 44158 renderState.lastEffect = lastEffectBeforeRendering; 44159 } 44160} // This can end up rendering this component multiple passes. 44161// The first pass splits the children fibers into two sets. A head and tail. 44162// We first render the head. If anything is in fallback state, we do another 44163// pass through beginWork to rerender all children (including the tail) with 44164// the force suspend context. If the first render didn't have anything in 44165// in fallback state. Then we render each row in the tail one-by-one. 44166// That happens in the completeWork phase without going back to beginWork. 44167 44168 44169function updateSuspenseListComponent(current, workInProgress, renderExpirationTime) { 44170 var nextProps = workInProgress.pendingProps; 44171 var revealOrder = nextProps.revealOrder; 44172 var tailMode = nextProps.tail; 44173 var newChildren = nextProps.children; 44174 validateRevealOrder(revealOrder); 44175 validateTailOptions(tailMode, revealOrder); 44176 validateSuspenseListChildren(newChildren, revealOrder); 44177 reconcileChildren(current, workInProgress, newChildren, renderExpirationTime); 44178 var suspenseContext = suspenseStackCursor.current; 44179 var shouldForceFallback = hasSuspenseContext(suspenseContext, ForceSuspenseFallback); 44180 44181 if (shouldForceFallback) { 44182 suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback); 44183 workInProgress.effectTag |= DidCapture; 44184 } else { 44185 var didSuspendBefore = current !== null && (current.effectTag & DidCapture) !== NoEffect; 44186 44187 if (didSuspendBefore) { 44188 // If we previously forced a fallback, we need to schedule work 44189 // on any nested boundaries to let them know to try to render 44190 // again. This is the same as context updating. 44191 propagateSuspenseContextChange(workInProgress, workInProgress.child, renderExpirationTime); 44192 } 44193 44194 suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); 44195 } 44196 44197 pushSuspenseContext(workInProgress, suspenseContext); 44198 44199 if ((workInProgress.mode & BlockingMode) === NoMode) { 44200 // Outside of blocking mode, SuspenseList doesn't work so we just 44201 // use make it a noop by treating it as the default revealOrder. 44202 workInProgress.memoizedState = null; 44203 } else { 44204 switch (revealOrder) { 44205 case 'forwards': 44206 { 44207 var lastContentRow = findLastContentRow(workInProgress.child); 44208 var tail; 44209 44210 if (lastContentRow === null) { 44211 // The whole list is part of the tail. 44212 // TODO: We could fast path by just rendering the tail now. 44213 tail = workInProgress.child; 44214 workInProgress.child = null; 44215 } else { 44216 // Disconnect the tail rows after the content row. 44217 // We're going to render them separately later. 44218 tail = lastContentRow.sibling; 44219 lastContentRow.sibling = null; 44220 } 44221 44222 initSuspenseListRenderState(workInProgress, false, // isBackwards 44223 tail, lastContentRow, tailMode, workInProgress.lastEffect); 44224 break; 44225 } 44226 44227 case 'backwards': 44228 { 44229 // We're going to find the first row that has existing content. 44230 // At the same time we're going to reverse the list of everything 44231 // we pass in the meantime. That's going to be our tail in reverse 44232 // order. 44233 var _tail = null; 44234 var row = workInProgress.child; 44235 workInProgress.child = null; 44236 44237 while (row !== null) { 44238 var currentRow = row.alternate; // New rows can't be content rows. 44239 44240 if (currentRow !== null && findFirstSuspended(currentRow) === null) { 44241 // This is the beginning of the main content. 44242 workInProgress.child = row; 44243 break; 44244 } 44245 44246 var nextRow = row.sibling; 44247 row.sibling = _tail; 44248 _tail = row; 44249 row = nextRow; 44250 } // TODO: If workInProgress.child is null, we can continue on the tail immediately. 44251 44252 44253 initSuspenseListRenderState(workInProgress, true, // isBackwards 44254 _tail, null, // last 44255 tailMode, workInProgress.lastEffect); 44256 break; 44257 } 44258 44259 case 'together': 44260 { 44261 initSuspenseListRenderState(workInProgress, false, // isBackwards 44262 null, // tail 44263 null, // last 44264 undefined, workInProgress.lastEffect); 44265 break; 44266 } 44267 44268 default: 44269 { 44270 // The default reveal order is the same as not having 44271 // a boundary. 44272 workInProgress.memoizedState = null; 44273 } 44274 } 44275 } 44276 44277 return workInProgress.child; 44278} 44279 44280function updatePortalComponent(current, workInProgress, renderExpirationTime) { 44281 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); 44282 var nextChildren = workInProgress.pendingProps; 44283 44284 if (current === null) { 44285 // Portals are special because we don't append the children during mount 44286 // but at commit. Therefore we need to track insertions which the normal 44287 // flow doesn't do during mount. This doesn't happen at the root because 44288 // the root always starts with a "current" with a null child. 44289 // TODO: Consider unifying this with how the root works. 44290 workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime); 44291 } else { 44292 reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime); 44293 } 44294 44295 return workInProgress.child; 44296} 44297 44298function updateContextProvider(current, workInProgress, renderExpirationTime) { 44299 var providerType = workInProgress.type; 44300 var context = providerType._context; 44301 var newProps = workInProgress.pendingProps; 44302 var oldProps = workInProgress.memoizedProps; 44303 var newValue = newProps.value; 44304 44305 { 44306 var providerPropTypes = workInProgress.type.propTypes; 44307 44308 if (providerPropTypes) { 44309 checkPropTypes(providerPropTypes, newProps, 'prop', 'Context.Provider', getCurrentFiberStackInDev); 44310 } 44311 } 44312 44313 pushProvider(workInProgress, newValue); 44314 44315 if (oldProps !== null) { 44316 var oldValue = oldProps.value; 44317 var changedBits = calculateChangedBits(context, newValue, oldValue); 44318 44319 if (changedBits === 0) { 44320 // No change. Bailout early if children are the same. 44321 if (oldProps.children === newProps.children && !hasContextChanged()) { 44322 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime); 44323 } 44324 } else { 44325 // The context value changed. Search for matching consumers and schedule 44326 // them to update. 44327 propagateContextChange(workInProgress, context, changedBits, renderExpirationTime); 44328 } 44329 } 44330 44331 var newChildren = newProps.children; 44332 reconcileChildren(current, workInProgress, newChildren, renderExpirationTime); 44333 return workInProgress.child; 44334} 44335 44336var hasWarnedAboutUsingContextAsConsumer = false; 44337 44338function updateContextConsumer(current, workInProgress, renderExpirationTime) { 44339 var context = workInProgress.type; // The logic below for Context differs depending on PROD or DEV mode. In 44340 // DEV mode, we create a separate object for Context.Consumer that acts 44341 // like a proxy to Context. This proxy object adds unnecessary code in PROD 44342 // so we use the old behaviour (Context.Consumer references Context) to 44343 // reduce size and overhead. The separate object references context via 44344 // a property called "_context", which also gives us the ability to check 44345 // in DEV mode if this property exists or not and warn if it does not. 44346 44347 { 44348 if (context._context === undefined) { 44349 // This may be because it's a Context (rather than a Consumer). 44350 // Or it may be because it's older React where they're the same thing. 44351 // We only want to warn if we're sure it's a new React. 44352 if (context !== context.Consumer) { 44353 if (!hasWarnedAboutUsingContextAsConsumer) { 44354 hasWarnedAboutUsingContextAsConsumer = true; 44355 44356 error('Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?'); 44357 } 44358 } 44359 } else { 44360 context = context._context; 44361 } 44362 } 44363 44364 var newProps = workInProgress.pendingProps; 44365 var render = newProps.children; 44366 44367 { 44368 if (typeof render !== 'function') { 44369 error('A context consumer was rendered with multiple children, or a child ' + "that isn't a function. A context consumer expects a single child " + 'that is a function. If you did pass a function, make sure there ' + 'is no trailing or leading whitespace around it.'); 44370 } 44371 } 44372 44373 prepareToReadContext(workInProgress, renderExpirationTime); 44374 var newValue = readContext(context, newProps.unstable_observedBits); 44375 var newChildren; 44376 44377 { 44378 ReactCurrentOwner$1.current = workInProgress; 44379 setIsRendering(true); 44380 newChildren = render(newValue); 44381 setIsRendering(false); 44382 } // React DevTools reads this flag. 44383 44384 44385 workInProgress.effectTag |= PerformedWork; 44386 reconcileChildren(current, workInProgress, newChildren, renderExpirationTime); 44387 return workInProgress.child; 44388} 44389 44390function markWorkInProgressReceivedUpdate() { 44391 didReceiveUpdate = true; 44392} 44393 44394function bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime) { 44395 cancelWorkTimer(workInProgress); 44396 44397 if (current !== null) { 44398 // Reuse previous dependencies 44399 workInProgress.dependencies = current.dependencies; 44400 } 44401 44402 { 44403 // Don't update "base" render times for bailouts. 44404 stopProfilerTimerIfRunning(); 44405 } 44406 44407 var updateExpirationTime = workInProgress.expirationTime; 44408 44409 if (updateExpirationTime !== NoWork) { 44410 markUnprocessedUpdateTime(updateExpirationTime); 44411 } // Check if the children have any pending work. 44412 44413 44414 var childExpirationTime = workInProgress.childExpirationTime; 44415 44416 if (childExpirationTime < renderExpirationTime) { 44417 // The children don't have any work either. We can skip them. 44418 // TODO: Once we add back resuming, we should check if the children are 44419 // a work-in-progress set. If so, we need to transfer their effects. 44420 return null; 44421 } else { 44422 // This fiber doesn't have work, but its subtree does. Clone the child 44423 // fibers and continue. 44424 cloneChildFibers(current, workInProgress); 44425 return workInProgress.child; 44426 } 44427} 44428 44429function remountFiber(current, oldWorkInProgress, newWorkInProgress) { 44430 { 44431 var returnFiber = oldWorkInProgress.return; 44432 44433 if (returnFiber === null) { 44434 throw new Error('Cannot swap the root fiber.'); 44435 } // Disconnect from the old current. 44436 // It will get deleted. 44437 44438 44439 current.alternate = null; 44440 oldWorkInProgress.alternate = null; // Connect to the new tree. 44441 44442 newWorkInProgress.index = oldWorkInProgress.index; 44443 newWorkInProgress.sibling = oldWorkInProgress.sibling; 44444 newWorkInProgress.return = oldWorkInProgress.return; 44445 newWorkInProgress.ref = oldWorkInProgress.ref; // Replace the child/sibling pointers above it. 44446 44447 if (oldWorkInProgress === returnFiber.child) { 44448 returnFiber.child = newWorkInProgress; 44449 } else { 44450 var prevSibling = returnFiber.child; 44451 44452 if (prevSibling === null) { 44453 throw new Error('Expected parent to have a child.'); 44454 } 44455 44456 while (prevSibling.sibling !== oldWorkInProgress) { 44457 prevSibling = prevSibling.sibling; 44458 44459 if (prevSibling === null) { 44460 throw new Error('Expected to find the previous sibling.'); 44461 } 44462 } 44463 44464 prevSibling.sibling = newWorkInProgress; 44465 } // Delete the old fiber and place the new one. 44466 // Since the old fiber is disconnected, we have to schedule it manually. 44467 44468 44469 var last = returnFiber.lastEffect; 44470 44471 if (last !== null) { 44472 last.nextEffect = current; 44473 returnFiber.lastEffect = current; 44474 } else { 44475 returnFiber.firstEffect = returnFiber.lastEffect = current; 44476 } 44477 44478 current.nextEffect = null; 44479 current.effectTag = Deletion; 44480 newWorkInProgress.effectTag |= Placement; // Restart work from the new fiber. 44481 44482 return newWorkInProgress; 44483 } 44484} 44485 44486function beginWork(current, workInProgress, renderExpirationTime) { 44487 var updateExpirationTime = workInProgress.expirationTime; 44488 44489 { 44490 if (workInProgress._debugNeedsRemount && current !== null) { 44491 // This will restart the begin phase with a new fiber. 44492 return remountFiber(current, workInProgress, createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.expirationTime)); 44493 } 44494 } 44495 44496 if (current !== null) { 44497 var oldProps = current.memoizedProps; 44498 var newProps = workInProgress.pendingProps; 44499 44500 if (oldProps !== newProps || hasContextChanged() || ( // Force a re-render if the implementation changed due to hot reload: 44501 workInProgress.type !== current.type )) { 44502 // If props or context changed, mark the fiber as having performed work. 44503 // This may be unset if the props are determined to be equal later (memo). 44504 didReceiveUpdate = true; 44505 } else if (updateExpirationTime < renderExpirationTime) { 44506 didReceiveUpdate = false; // This fiber does not have any pending work. Bailout without entering 44507 // the begin phase. There's still some bookkeeping we that needs to be done 44508 // in this optimized path, mostly pushing stuff onto the stack. 44509 44510 switch (workInProgress.tag) { 44511 case HostRoot: 44512 pushHostRootContext(workInProgress); 44513 resetHydrationState(); 44514 break; 44515 44516 case HostComponent: 44517 pushHostContext(workInProgress); 44518 44519 if (workInProgress.mode & ConcurrentMode && renderExpirationTime !== Never && shouldDeprioritizeSubtree(workInProgress.type, newProps)) { 44520 { 44521 markSpawnedWork(Never); 44522 } // Schedule this fiber to re-render at offscreen priority. Then bailout. 44523 44524 44525 workInProgress.expirationTime = workInProgress.childExpirationTime = Never; 44526 return null; 44527 } 44528 44529 break; 44530 44531 case ClassComponent: 44532 { 44533 var Component = workInProgress.type; 44534 44535 if (isContextProvider(Component)) { 44536 pushContextProvider(workInProgress); 44537 } 44538 44539 break; 44540 } 44541 44542 case HostPortal: 44543 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); 44544 break; 44545 44546 case ContextProvider: 44547 { 44548 var newValue = workInProgress.memoizedProps.value; 44549 pushProvider(workInProgress, newValue); 44550 break; 44551 } 44552 44553 case Profiler: 44554 { 44555 // Profiler should only call onRender when one of its descendants actually rendered. 44556 var hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime; 44557 44558 if (hasChildWork) { 44559 workInProgress.effectTag |= Update; 44560 } 44561 } 44562 44563 break; 44564 44565 case SuspenseComponent: 44566 { 44567 var state = workInProgress.memoizedState; 44568 44569 if (state !== null) { 44570 // whether to retry the primary children, or to skip over it and 44571 // go straight to the fallback. Check the priority of the primary 44572 // child fragment. 44573 44574 44575 var primaryChildFragment = workInProgress.child; 44576 var primaryChildExpirationTime = primaryChildFragment.childExpirationTime; 44577 44578 if (primaryChildExpirationTime !== NoWork && primaryChildExpirationTime >= renderExpirationTime) { 44579 // The primary children have pending work. Use the normal path 44580 // to attempt to render the primary children again. 44581 return updateSuspenseComponent(current, workInProgress, renderExpirationTime); 44582 } else { 44583 pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current)); // The primary children do not have pending work with sufficient 44584 // priority. Bailout. 44585 44586 var child = bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime); 44587 44588 if (child !== null) { 44589 // The fallback children have pending work. Skip over the 44590 // primary children and work on the fallback. 44591 return child.sibling; 44592 } else { 44593 return null; 44594 } 44595 } 44596 } else { 44597 pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current)); 44598 } 44599 44600 break; 44601 } 44602 44603 case SuspenseListComponent: 44604 { 44605 var didSuspendBefore = (current.effectTag & DidCapture) !== NoEffect; 44606 44607 var _hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime; 44608 44609 if (didSuspendBefore) { 44610 if (_hasChildWork) { 44611 // If something was in fallback state last time, and we have all the 44612 // same children then we're still in progressive loading state. 44613 // Something might get unblocked by state updates or retries in the 44614 // tree which will affect the tail. So we need to use the normal 44615 // path to compute the correct tail. 44616 return updateSuspenseListComponent(current, workInProgress, renderExpirationTime); 44617 } // If none of the children had any work, that means that none of 44618 // them got retried so they'll still be blocked in the same way 44619 // as before. We can fast bail out. 44620 44621 44622 workInProgress.effectTag |= DidCapture; 44623 } // If nothing suspended before and we're rendering the same children, 44624 // then the tail doesn't matter. Anything new that suspends will work 44625 // in the "together" mode, so we can continue from the state we had. 44626 44627 44628 var renderState = workInProgress.memoizedState; 44629 44630 if (renderState !== null) { 44631 // Reset to the "together" mode in case we've started a different 44632 // update in the past but didn't complete it. 44633 renderState.rendering = null; 44634 renderState.tail = null; 44635 } 44636 44637 pushSuspenseContext(workInProgress, suspenseStackCursor.current); 44638 44639 if (_hasChildWork) { 44640 break; 44641 } else { 44642 // If none of the children had any work, that means that none of 44643 // them got retried so they'll still be blocked in the same way 44644 // as before. We can fast bail out. 44645 return null; 44646 } 44647 } 44648 } 44649 44650 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime); 44651 } else { 44652 // An update was scheduled on this fiber, but there are no new props 44653 // nor legacy context. Set this to false. If an update queue or context 44654 // consumer produces a changed value, it will set this to true. Otherwise, 44655 // the component will assume the children have not changed and bail out. 44656 didReceiveUpdate = false; 44657 } 44658 } else { 44659 didReceiveUpdate = false; 44660 } // Before entering the begin phase, clear pending update priority. 44661 // TODO: This assumes that we're about to evaluate the component and process 44662 // the update queue. However, there's an exception: SimpleMemoComponent 44663 // sometimes bails out later in the begin phase. This indicates that we should 44664 // move this assignment out of the common path and into each branch. 44665 44666 44667 workInProgress.expirationTime = NoWork; 44668 44669 switch (workInProgress.tag) { 44670 case IndeterminateComponent: 44671 { 44672 return mountIndeterminateComponent(current, workInProgress, workInProgress.type, renderExpirationTime); 44673 } 44674 44675 case LazyComponent: 44676 { 44677 var elementType = workInProgress.elementType; 44678 return mountLazyComponent(current, workInProgress, elementType, updateExpirationTime, renderExpirationTime); 44679 } 44680 44681 case FunctionComponent: 44682 { 44683 var _Component = workInProgress.type; 44684 var unresolvedProps = workInProgress.pendingProps; 44685 var resolvedProps = workInProgress.elementType === _Component ? unresolvedProps : resolveDefaultProps(_Component, unresolvedProps); 44686 return updateFunctionComponent(current, workInProgress, _Component, resolvedProps, renderExpirationTime); 44687 } 44688 44689 case ClassComponent: 44690 { 44691 var _Component2 = workInProgress.type; 44692 var _unresolvedProps = workInProgress.pendingProps; 44693 44694 var _resolvedProps = workInProgress.elementType === _Component2 ? _unresolvedProps : resolveDefaultProps(_Component2, _unresolvedProps); 44695 44696 return updateClassComponent(current, workInProgress, _Component2, _resolvedProps, renderExpirationTime); 44697 } 44698 44699 case HostRoot: 44700 return updateHostRoot(current, workInProgress, renderExpirationTime); 44701 44702 case HostComponent: 44703 return updateHostComponent(current, workInProgress, renderExpirationTime); 44704 44705 case HostText: 44706 return updateHostText(current, workInProgress); 44707 44708 case SuspenseComponent: 44709 return updateSuspenseComponent(current, workInProgress, renderExpirationTime); 44710 44711 case HostPortal: 44712 return updatePortalComponent(current, workInProgress, renderExpirationTime); 44713 44714 case ForwardRef: 44715 { 44716 var type = workInProgress.type; 44717 var _unresolvedProps2 = workInProgress.pendingProps; 44718 44719 var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2); 44720 44721 return updateForwardRef(current, workInProgress, type, _resolvedProps2, renderExpirationTime); 44722 } 44723 44724 case Fragment: 44725 return updateFragment(current, workInProgress, renderExpirationTime); 44726 44727 case Mode: 44728 return updateMode(current, workInProgress, renderExpirationTime); 44729 44730 case Profiler: 44731 return updateProfiler(current, workInProgress, renderExpirationTime); 44732 44733 case ContextProvider: 44734 return updateContextProvider(current, workInProgress, renderExpirationTime); 44735 44736 case ContextConsumer: 44737 return updateContextConsumer(current, workInProgress, renderExpirationTime); 44738 44739 case MemoComponent: 44740 { 44741 var _type2 = workInProgress.type; 44742 var _unresolvedProps3 = workInProgress.pendingProps; // Resolve outer props first, then resolve inner props. 44743 44744 var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3); 44745 44746 { 44747 if (workInProgress.type !== workInProgress.elementType) { 44748 var outerPropTypes = _type2.propTypes; 44749 44750 if (outerPropTypes) { 44751 checkPropTypes(outerPropTypes, _resolvedProps3, // Resolved for outer only 44752 'prop', getComponentName(_type2), getCurrentFiberStackInDev); 44753 } 44754 } 44755 } 44756 44757 _resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3); 44758 return updateMemoComponent(current, workInProgress, _type2, _resolvedProps3, updateExpirationTime, renderExpirationTime); 44759 } 44760 44761 case SimpleMemoComponent: 44762 { 44763 return updateSimpleMemoComponent(current, workInProgress, workInProgress.type, workInProgress.pendingProps, updateExpirationTime, renderExpirationTime); 44764 } 44765 44766 case IncompleteClassComponent: 44767 { 44768 var _Component3 = workInProgress.type; 44769 var _unresolvedProps4 = workInProgress.pendingProps; 44770 44771 var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4); 44772 44773 return mountIncompleteClassComponent(current, workInProgress, _Component3, _resolvedProps4, renderExpirationTime); 44774 } 44775 44776 case SuspenseListComponent: 44777 { 44778 return updateSuspenseListComponent(current, workInProgress, renderExpirationTime); 44779 } 44780 } 44781 44782 { 44783 { 44784 throw Error( "Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue." ); 44785 } 44786 } 44787} 44788 44789function markUpdate(workInProgress) { 44790 // Tag the fiber with an update effect. This turns a Placement into 44791 // a PlacementAndUpdate. 44792 workInProgress.effectTag |= Update; 44793} 44794 44795function markRef$1(workInProgress) { 44796 workInProgress.effectTag |= Ref; 44797} 44798 44799var appendAllChildren; 44800var updateHostContainer; 44801var updateHostComponent$1; 44802var updateHostText$1; 44803 44804{ 44805 // Mutation mode 44806 appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) { 44807 // We only have the top Fiber that was created but we need recurse down its 44808 // children to find all the terminal nodes. 44809 var node = workInProgress.child; 44810 44811 while (node !== null) { 44812 if (node.tag === HostComponent || node.tag === HostText) { 44813 appendInitialChild(parent, node.stateNode); 44814 } else if (node.tag === HostPortal) ; else if (node.child !== null) { 44815 node.child.return = node; 44816 node = node.child; 44817 continue; 44818 } 44819 44820 if (node === workInProgress) { 44821 return; 44822 } 44823 44824 while (node.sibling === null) { 44825 if (node.return === null || node.return === workInProgress) { 44826 return; 44827 } 44828 44829 node = node.return; 44830 } 44831 44832 node.sibling.return = node.return; 44833 node = node.sibling; 44834 } 44835 }; 44836 44837 updateHostContainer = function (workInProgress) {// Noop 44838 }; 44839 44840 updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) { 44841 // If we have an alternate, that means this is an update and we need to 44842 // schedule a side-effect to do the updates. 44843 var oldProps = current.memoizedProps; 44844 44845 if (oldProps === newProps) { 44846 // In mutation mode, this is sufficient for a bailout because 44847 // we won't touch this node even if children changed. 44848 return; 44849 } // If we get updated because one of our children updated, we don't 44850 // have newProps so we'll have to reuse them. 44851 // TODO: Split the update API as separate for the props vs. children. 44852 // Even better would be if children weren't special cased at all tho. 44853 44854 44855 var instance = workInProgress.stateNode; 44856 var currentHostContext = getHostContext(); // TODO: Experiencing an error where oldProps is null. Suggests a host 44857 // component is hitting the resume path. Figure out why. Possibly 44858 // related to `hidden`. 44859 44860 var updatePayload = prepareUpdate(instance, type, oldProps, newProps, rootContainerInstance, currentHostContext); // TODO: Type this specific to this type of component. 44861 44862 workInProgress.updateQueue = updatePayload; // If the update payload indicates that there is a change or if there 44863 // is a new ref we mark this as an update. All the work is done in commitWork. 44864 44865 if (updatePayload) { 44866 markUpdate(workInProgress); 44867 } 44868 }; 44869 44870 updateHostText$1 = function (current, workInProgress, oldText, newText) { 44871 // If the text differs, mark it as an update. All the work in done in commitWork. 44872 if (oldText !== newText) { 44873 markUpdate(workInProgress); 44874 } 44875 }; 44876} 44877 44878function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { 44879 switch (renderState.tailMode) { 44880 case 'hidden': 44881 { 44882 // Any insertions at the end of the tail list after this point 44883 // should be invisible. If there are already mounted boundaries 44884 // anything before them are not considered for collapsing. 44885 // Therefore we need to go through the whole tail to find if 44886 // there are any. 44887 var tailNode = renderState.tail; 44888 var lastTailNode = null; 44889 44890 while (tailNode !== null) { 44891 if (tailNode.alternate !== null) { 44892 lastTailNode = tailNode; 44893 } 44894 44895 tailNode = tailNode.sibling; 44896 } // Next we're simply going to delete all insertions after the 44897 // last rendered item. 44898 44899 44900 if (lastTailNode === null) { 44901 // All remaining items in the tail are insertions. 44902 renderState.tail = null; 44903 } else { 44904 // Detach the insertion after the last node that was already 44905 // inserted. 44906 lastTailNode.sibling = null; 44907 } 44908 44909 break; 44910 } 44911 44912 case 'collapsed': 44913 { 44914 // Any insertions at the end of the tail list after this point 44915 // should be invisible. If there are already mounted boundaries 44916 // anything before them are not considered for collapsing. 44917 // Therefore we need to go through the whole tail to find if 44918 // there are any. 44919 var _tailNode = renderState.tail; 44920 var _lastTailNode = null; 44921 44922 while (_tailNode !== null) { 44923 if (_tailNode.alternate !== null) { 44924 _lastTailNode = _tailNode; 44925 } 44926 44927 _tailNode = _tailNode.sibling; 44928 } // Next we're simply going to delete all insertions after the 44929 // last rendered item. 44930 44931 44932 if (_lastTailNode === null) { 44933 // All remaining items in the tail are insertions. 44934 if (!hasRenderedATailFallback && renderState.tail !== null) { 44935 // We suspended during the head. We want to show at least one 44936 // row at the tail. So we'll keep on and cut off the rest. 44937 renderState.tail.sibling = null; 44938 } else { 44939 renderState.tail = null; 44940 } 44941 } else { 44942 // Detach the insertion after the last node that was already 44943 // inserted. 44944 _lastTailNode.sibling = null; 44945 } 44946 44947 break; 44948 } 44949 } 44950} 44951 44952function completeWork(current, workInProgress, renderExpirationTime) { 44953 var newProps = workInProgress.pendingProps; 44954 44955 switch (workInProgress.tag) { 44956 case IndeterminateComponent: 44957 case LazyComponent: 44958 case SimpleMemoComponent: 44959 case FunctionComponent: 44960 case ForwardRef: 44961 case Fragment: 44962 case Mode: 44963 case Profiler: 44964 case ContextConsumer: 44965 case MemoComponent: 44966 return null; 44967 44968 case ClassComponent: 44969 { 44970 var Component = workInProgress.type; 44971 44972 if (isContextProvider(Component)) { 44973 popContext(workInProgress); 44974 } 44975 44976 return null; 44977 } 44978 44979 case HostRoot: 44980 { 44981 popHostContainer(workInProgress); 44982 popTopLevelContextObject(workInProgress); 44983 var fiberRoot = workInProgress.stateNode; 44984 44985 if (fiberRoot.pendingContext) { 44986 fiberRoot.context = fiberRoot.pendingContext; 44987 fiberRoot.pendingContext = null; 44988 } 44989 44990 if (current === null || current.child === null) { 44991 // If we hydrated, pop so that we can delete any remaining children 44992 // that weren't hydrated. 44993 var wasHydrated = popHydrationState(workInProgress); 44994 44995 if (wasHydrated) { 44996 // If we hydrated, then we'll need to schedule an update for 44997 // the commit side-effects on the root. 44998 markUpdate(workInProgress); 44999 } 45000 } 45001 45002 updateHostContainer(workInProgress); 45003 return null; 45004 } 45005 45006 case HostComponent: 45007 { 45008 popHostContext(workInProgress); 45009 var rootContainerInstance = getRootHostContainer(); 45010 var type = workInProgress.type; 45011 45012 if (current !== null && workInProgress.stateNode != null) { 45013 updateHostComponent$1(current, workInProgress, type, newProps, rootContainerInstance); 45014 45015 if (current.ref !== workInProgress.ref) { 45016 markRef$1(workInProgress); 45017 } 45018 } else { 45019 if (!newProps) { 45020 if (!(workInProgress.stateNode !== null)) { 45021 { 45022 throw Error( "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." ); 45023 } 45024 } // This can happen when we abort work. 45025 45026 45027 return null; 45028 } 45029 45030 var currentHostContext = getHostContext(); // TODO: Move createInstance to beginWork and keep it on a context 45031 // "stack" as the parent. Then append children as we go in beginWork 45032 // or completeWork depending on whether we want to add them top->down or 45033 // bottom->up. Top->down is faster in IE11. 45034 45035 var _wasHydrated = popHydrationState(workInProgress); 45036 45037 if (_wasHydrated) { 45038 // TODO: Move this and createInstance step into the beginPhase 45039 // to consolidate. 45040 if (prepareToHydrateHostInstance(workInProgress, rootContainerInstance, currentHostContext)) { 45041 // If changes to the hydrated node need to be applied at the 45042 // commit-phase we mark this as such. 45043 markUpdate(workInProgress); 45044 } 45045 } else { 45046 var instance = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress); 45047 appendAllChildren(instance, workInProgress, false, false); // This needs to be set before we mount Flare event listeners 45048 45049 workInProgress.stateNode = instance; 45050 // (eg DOM renderer supports auto-focus for certain elements). 45051 // Make sure such renderers get scheduled for later work. 45052 45053 45054 if (finalizeInitialChildren(instance, type, newProps, rootContainerInstance)) { 45055 markUpdate(workInProgress); 45056 } 45057 } 45058 45059 if (workInProgress.ref !== null) { 45060 // If there is a ref on a host node we need to schedule a callback 45061 markRef$1(workInProgress); 45062 } 45063 } 45064 45065 return null; 45066 } 45067 45068 case HostText: 45069 { 45070 var newText = newProps; 45071 45072 if (current && workInProgress.stateNode != null) { 45073 var oldText = current.memoizedProps; // If we have an alternate, that means this is an update and we need 45074 // to schedule a side-effect to do the updates. 45075 45076 updateHostText$1(current, workInProgress, oldText, newText); 45077 } else { 45078 if (typeof newText !== 'string') { 45079 if (!(workInProgress.stateNode !== null)) { 45080 { 45081 throw Error( "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." ); 45082 } 45083 } // This can happen when we abort work. 45084 45085 } 45086 45087 var _rootContainerInstance = getRootHostContainer(); 45088 45089 var _currentHostContext = getHostContext(); 45090 45091 var _wasHydrated2 = popHydrationState(workInProgress); 45092 45093 if (_wasHydrated2) { 45094 if (prepareToHydrateHostTextInstance(workInProgress)) { 45095 markUpdate(workInProgress); 45096 } 45097 } else { 45098 workInProgress.stateNode = createTextInstance(newText, _rootContainerInstance, _currentHostContext, workInProgress); 45099 } 45100 } 45101 45102 return null; 45103 } 45104 45105 case SuspenseComponent: 45106 { 45107 popSuspenseContext(workInProgress); 45108 var nextState = workInProgress.memoizedState; 45109 45110 if ((workInProgress.effectTag & DidCapture) !== NoEffect) { 45111 // Something suspended. Re-render with the fallback children. 45112 workInProgress.expirationTime = renderExpirationTime; // Do not reset the effect list. 45113 45114 return workInProgress; 45115 } 45116 45117 var nextDidTimeout = nextState !== null; 45118 var prevDidTimeout = false; 45119 45120 if (current === null) { 45121 if (workInProgress.memoizedProps.fallback !== undefined) { 45122 popHydrationState(workInProgress); 45123 } 45124 } else { 45125 var prevState = current.memoizedState; 45126 prevDidTimeout = prevState !== null; 45127 45128 if (!nextDidTimeout && prevState !== null) { 45129 // We just switched from the fallback to the normal children. 45130 // Delete the fallback. 45131 // TODO: Would it be better to store the fallback fragment on 45132 // the stateNode during the begin phase? 45133 var currentFallbackChild = current.child.sibling; 45134 45135 if (currentFallbackChild !== null) { 45136 // Deletions go at the beginning of the return fiber's effect list 45137 var first = workInProgress.firstEffect; 45138 45139 if (first !== null) { 45140 workInProgress.firstEffect = currentFallbackChild; 45141 currentFallbackChild.nextEffect = first; 45142 } else { 45143 workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChild; 45144 currentFallbackChild.nextEffect = null; 45145 } 45146 45147 currentFallbackChild.effectTag = Deletion; 45148 } 45149 } 45150 } 45151 45152 if (nextDidTimeout && !prevDidTimeout) { 45153 // If this subtreee is running in blocking mode we can suspend, 45154 // otherwise we won't suspend. 45155 // TODO: This will still suspend a synchronous tree if anything 45156 // in the concurrent tree already suspended during this render. 45157 // This is a known bug. 45158 if ((workInProgress.mode & BlockingMode) !== NoMode) { 45159 // TODO: Move this back to throwException because this is too late 45160 // if this is a large tree which is common for initial loads. We 45161 // don't know if we should restart a render or not until we get 45162 // this marker, and this is too late. 45163 // If this render already had a ping or lower pri updates, 45164 // and this is the first time we know we're going to suspend we 45165 // should be able to immediately restart from within throwException. 45166 var hasInvisibleChildContext = current === null && workInProgress.memoizedProps.unstable_avoidThisFallback !== true; 45167 45168 if (hasInvisibleChildContext || hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext)) { 45169 // If this was in an invisible tree or a new render, then showing 45170 // this boundary is ok. 45171 renderDidSuspend(); 45172 } else { 45173 // Otherwise, we're going to have to hide content so we should 45174 // suspend for longer if possible. 45175 renderDidSuspendDelayIfPossible(); 45176 } 45177 } 45178 } 45179 45180 { 45181 // TODO: Only schedule updates if these values are non equal, i.e. it changed. 45182 if (nextDidTimeout || prevDidTimeout) { 45183 // If this boundary just timed out, schedule an effect to attach a 45184 // retry listener to the promise. This flag is also used to hide the 45185 // primary children. In mutation mode, we also need the flag to 45186 // *unhide* children that were previously hidden, so check if this 45187 // is currently timed out, too. 45188 workInProgress.effectTag |= Update; 45189 } 45190 } 45191 45192 return null; 45193 } 45194 45195 case HostPortal: 45196 popHostContainer(workInProgress); 45197 updateHostContainer(workInProgress); 45198 return null; 45199 45200 case ContextProvider: 45201 // Pop provider fiber 45202 popProvider(workInProgress); 45203 return null; 45204 45205 case IncompleteClassComponent: 45206 { 45207 // Same as class component case. I put it down here so that the tags are 45208 // sequential to ensure this switch is compiled to a jump table. 45209 var _Component = workInProgress.type; 45210 45211 if (isContextProvider(_Component)) { 45212 popContext(workInProgress); 45213 } 45214 45215 return null; 45216 } 45217 45218 case SuspenseListComponent: 45219 { 45220 popSuspenseContext(workInProgress); 45221 var renderState = workInProgress.memoizedState; 45222 45223 if (renderState === null) { 45224 // We're running in the default, "independent" mode. 45225 // We don't do anything in this mode. 45226 return null; 45227 } 45228 45229 var didSuspendAlready = (workInProgress.effectTag & DidCapture) !== NoEffect; 45230 var renderedTail = renderState.rendering; 45231 45232 if (renderedTail === null) { 45233 // We just rendered the head. 45234 if (!didSuspendAlready) { 45235 // This is the first pass. We need to figure out if anything is still 45236 // suspended in the rendered set. 45237 // If new content unsuspended, but there's still some content that 45238 // didn't. Then we need to do a second pass that forces everything 45239 // to keep showing their fallbacks. 45240 // We might be suspended if something in this render pass suspended, or 45241 // something in the previous committed pass suspended. Otherwise, 45242 // there's no chance so we can skip the expensive call to 45243 // findFirstSuspended. 45244 var cannotBeSuspended = renderHasNotSuspendedYet() && (current === null || (current.effectTag & DidCapture) === NoEffect); 45245 45246 if (!cannotBeSuspended) { 45247 var row = workInProgress.child; 45248 45249 while (row !== null) { 45250 var suspended = findFirstSuspended(row); 45251 45252 if (suspended !== null) { 45253 didSuspendAlready = true; 45254 workInProgress.effectTag |= DidCapture; 45255 cutOffTailIfNeeded(renderState, false); // If this is a newly suspended tree, it might not get committed as 45256 // part of the second pass. In that case nothing will subscribe to 45257 // its thennables. Instead, we'll transfer its thennables to the 45258 // SuspenseList so that it can retry if they resolve. 45259 // There might be multiple of these in the list but since we're 45260 // going to wait for all of them anyway, it doesn't really matter 45261 // which ones gets to ping. In theory we could get clever and keep 45262 // track of how many dependencies remain but it gets tricky because 45263 // in the meantime, we can add/remove/change items and dependencies. 45264 // We might bail out of the loop before finding any but that 45265 // doesn't matter since that means that the other boundaries that 45266 // we did find already has their listeners attached. 45267 45268 var newThennables = suspended.updateQueue; 45269 45270 if (newThennables !== null) { 45271 workInProgress.updateQueue = newThennables; 45272 workInProgress.effectTag |= Update; 45273 } // Rerender the whole list, but this time, we'll force fallbacks 45274 // to stay in place. 45275 // Reset the effect list before doing the second pass since that's now invalid. 45276 45277 45278 if (renderState.lastEffect === null) { 45279 workInProgress.firstEffect = null; 45280 } 45281 45282 workInProgress.lastEffect = renderState.lastEffect; // Reset the child fibers to their original state. 45283 45284 resetChildFibers(workInProgress, renderExpirationTime); // Set up the Suspense Context to force suspense and immediately 45285 // rerender the children. 45286 45287 pushSuspenseContext(workInProgress, setShallowSuspenseContext(suspenseStackCursor.current, ForceSuspenseFallback)); 45288 return workInProgress.child; 45289 } 45290 45291 row = row.sibling; 45292 } 45293 } 45294 } else { 45295 cutOffTailIfNeeded(renderState, false); 45296 } // Next we're going to render the tail. 45297 45298 } else { 45299 // Append the rendered row to the child list. 45300 if (!didSuspendAlready) { 45301 var _suspended = findFirstSuspended(renderedTail); 45302 45303 if (_suspended !== null) { 45304 workInProgress.effectTag |= DidCapture; 45305 didSuspendAlready = true; // Ensure we transfer the update queue to the parent so that it doesn't 45306 // get lost if this row ends up dropped during a second pass. 45307 45308 var _newThennables = _suspended.updateQueue; 45309 45310 if (_newThennables !== null) { 45311 workInProgress.updateQueue = _newThennables; 45312 workInProgress.effectTag |= Update; 45313 } 45314 45315 cutOffTailIfNeeded(renderState, true); // This might have been modified. 45316 45317 if (renderState.tail === null && renderState.tailMode === 'hidden' && !renderedTail.alternate) { 45318 // We need to delete the row we just rendered. 45319 // Reset the effect list to what it was before we rendered this 45320 // child. The nested children have already appended themselves. 45321 var lastEffect = workInProgress.lastEffect = renderState.lastEffect; // Remove any effects that were appended after this point. 45322 45323 if (lastEffect !== null) { 45324 lastEffect.nextEffect = null; 45325 } // We're done. 45326 45327 45328 return null; 45329 } 45330 } else if ( // The time it took to render last row is greater than time until 45331 // the expiration. 45332 now() * 2 - renderState.renderingStartTime > renderState.tailExpiration && renderExpirationTime > Never) { 45333 // We have now passed our CPU deadline and we'll just give up further 45334 // attempts to render the main content and only render fallbacks. 45335 // The assumption is that this is usually faster. 45336 workInProgress.effectTag |= DidCapture; 45337 didSuspendAlready = true; 45338 cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this 45339 // to get it started back up to attempt the next item. If we can show 45340 // them, then they really have the same priority as this render. 45341 // So we'll pick it back up the very next render pass once we've had 45342 // an opportunity to yield for paint. 45343 45344 var nextPriority = renderExpirationTime - 1; 45345 workInProgress.expirationTime = workInProgress.childExpirationTime = nextPriority; 45346 45347 { 45348 markSpawnedWork(nextPriority); 45349 } 45350 } 45351 } 45352 45353 if (renderState.isBackwards) { 45354 // The effect list of the backwards tail will have been added 45355 // to the end. This breaks the guarantee that life-cycles fire in 45356 // sibling order but that isn't a strong guarantee promised by React. 45357 // Especially since these might also just pop in during future commits. 45358 // Append to the beginning of the list. 45359 renderedTail.sibling = workInProgress.child; 45360 workInProgress.child = renderedTail; 45361 } else { 45362 var previousSibling = renderState.last; 45363 45364 if (previousSibling !== null) { 45365 previousSibling.sibling = renderedTail; 45366 } else { 45367 workInProgress.child = renderedTail; 45368 } 45369 45370 renderState.last = renderedTail; 45371 } 45372 } 45373 45374 if (renderState.tail !== null) { 45375 // We still have tail rows to render. 45376 if (renderState.tailExpiration === 0) { 45377 // Heuristic for how long we're willing to spend rendering rows 45378 // until we just give up and show what we have so far. 45379 var TAIL_EXPIRATION_TIMEOUT_MS = 500; 45380 renderState.tailExpiration = now() + TAIL_EXPIRATION_TIMEOUT_MS; // TODO: This is meant to mimic the train model or JND but this 45381 // is a per component value. It should really be since the start 45382 // of the total render or last commit. Consider using something like 45383 // globalMostRecentFallbackTime. That doesn't account for being 45384 // suspended for part of the time or when it's a new render. 45385 // It should probably use a global start time value instead. 45386 } // Pop a row. 45387 45388 45389 var next = renderState.tail; 45390 renderState.rendering = next; 45391 renderState.tail = next.sibling; 45392 renderState.lastEffect = workInProgress.lastEffect; 45393 renderState.renderingStartTime = now(); 45394 next.sibling = null; // Restore the context. 45395 // TODO: We can probably just avoid popping it instead and only 45396 // setting it the first time we go from not suspended to suspended. 45397 45398 var suspenseContext = suspenseStackCursor.current; 45399 45400 if (didSuspendAlready) { 45401 suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback); 45402 } else { 45403 suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); 45404 } 45405 45406 pushSuspenseContext(workInProgress, suspenseContext); // Do a pass over the next row. 45407 45408 return next; 45409 } 45410 45411 return null; 45412 } 45413 } 45414 45415 { 45416 { 45417 throw Error( "Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue." ); 45418 } 45419 } 45420} 45421 45422function unwindWork(workInProgress, renderExpirationTime) { 45423 switch (workInProgress.tag) { 45424 case ClassComponent: 45425 { 45426 var Component = workInProgress.type; 45427 45428 if (isContextProvider(Component)) { 45429 popContext(workInProgress); 45430 } 45431 45432 var effectTag = workInProgress.effectTag; 45433 45434 if (effectTag & ShouldCapture) { 45435 workInProgress.effectTag = effectTag & ~ShouldCapture | DidCapture; 45436 return workInProgress; 45437 } 45438 45439 return null; 45440 } 45441 45442 case HostRoot: 45443 { 45444 popHostContainer(workInProgress); 45445 popTopLevelContextObject(workInProgress); 45446 var _effectTag = workInProgress.effectTag; 45447 45448 if (!((_effectTag & DidCapture) === NoEffect)) { 45449 { 45450 throw Error( "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." ); 45451 } 45452 } 45453 45454 workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture; 45455 return workInProgress; 45456 } 45457 45458 case HostComponent: 45459 { 45460 // TODO: popHydrationState 45461 popHostContext(workInProgress); 45462 return null; 45463 } 45464 45465 case SuspenseComponent: 45466 { 45467 popSuspenseContext(workInProgress); 45468 45469 var _effectTag2 = workInProgress.effectTag; 45470 45471 if (_effectTag2 & ShouldCapture) { 45472 workInProgress.effectTag = _effectTag2 & ~ShouldCapture | DidCapture; // Captured a suspense effect. Re-render the boundary. 45473 45474 return workInProgress; 45475 } 45476 45477 return null; 45478 } 45479 45480 case SuspenseListComponent: 45481 { 45482 popSuspenseContext(workInProgress); // SuspenseList doesn't actually catch anything. It should've been 45483 // caught by a nested boundary. If not, it should bubble through. 45484 45485 return null; 45486 } 45487 45488 case HostPortal: 45489 popHostContainer(workInProgress); 45490 return null; 45491 45492 case ContextProvider: 45493 popProvider(workInProgress); 45494 return null; 45495 45496 default: 45497 return null; 45498 } 45499} 45500 45501function unwindInterruptedWork(interruptedWork) { 45502 switch (interruptedWork.tag) { 45503 case ClassComponent: 45504 { 45505 var childContextTypes = interruptedWork.type.childContextTypes; 45506 45507 if (childContextTypes !== null && childContextTypes !== undefined) { 45508 popContext(interruptedWork); 45509 } 45510 45511 break; 45512 } 45513 45514 case HostRoot: 45515 { 45516 popHostContainer(interruptedWork); 45517 popTopLevelContextObject(interruptedWork); 45518 break; 45519 } 45520 45521 case HostComponent: 45522 { 45523 popHostContext(interruptedWork); 45524 break; 45525 } 45526 45527 case HostPortal: 45528 popHostContainer(interruptedWork); 45529 break; 45530 45531 case SuspenseComponent: 45532 popSuspenseContext(interruptedWork); 45533 break; 45534 45535 case SuspenseListComponent: 45536 popSuspenseContext(interruptedWork); 45537 break; 45538 45539 case ContextProvider: 45540 popProvider(interruptedWork); 45541 break; 45542 } 45543} 45544 45545function createCapturedValue(value, source) { 45546 // If the value is an error, call this function immediately after it is thrown 45547 // so the stack is accurate. 45548 return { 45549 value: value, 45550 source: source, 45551 stack: getStackByFiberInDevAndProd(source) 45552 }; 45553} 45554 45555function logCapturedError(capturedError) { 45556 45557 var error = capturedError.error; 45558 45559 { 45560 var componentName = capturedError.componentName, 45561 componentStack = capturedError.componentStack, 45562 errorBoundaryName = capturedError.errorBoundaryName, 45563 errorBoundaryFound = capturedError.errorBoundaryFound, 45564 willRetry = capturedError.willRetry; // Browsers support silencing uncaught errors by calling 45565 // `preventDefault()` in window `error` handler. 45566 // We record this information as an expando on the error. 45567 45568 if (error != null && error._suppressLogging) { 45569 if (errorBoundaryFound && willRetry) { 45570 // The error is recoverable and was silenced. 45571 // Ignore it and don't print the stack addendum. 45572 // This is handy for testing error boundaries without noise. 45573 return; 45574 } // The error is fatal. Since the silencing might have 45575 // been accidental, we'll surface it anyway. 45576 // However, the browser would have silenced the original error 45577 // so we'll print it first, and then print the stack addendum. 45578 45579 45580 console['error'](error); // Don't transform to our wrapper 45581 // For a more detailed description of this block, see: 45582 // https://github.com/facebook/react/pull/13384 45583 } 45584 45585 var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : 'The above error occurred in one of your React components:'; 45586 var errorBoundaryMessage; // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow. 45587 45588 if (errorBoundaryFound && errorBoundaryName) { 45589 if (willRetry) { 45590 errorBoundaryMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + errorBoundaryName + "."); 45591 } else { 45592 errorBoundaryMessage = "This error was initially handled by the error boundary " + errorBoundaryName + ".\n" + "Recreating the tree from scratch failed so React will unmount the tree."; 45593 } 45594 } else { 45595 errorBoundaryMessage = 'Consider adding an error boundary to your tree to customize error handling behavior.\n' + 'Visit https://fb.me/react-error-boundaries to learn more about error boundaries.'; 45596 } 45597 45598 var combinedMessage = "" + componentNameMessage + componentStack + "\n\n" + ("" + errorBoundaryMessage); // In development, we provide our own message with just the component stack. 45599 // We don't include the original error message and JS stack because the browser 45600 // has already printed it. Even if the application swallows the error, it is still 45601 // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils. 45602 45603 console['error'](combinedMessage); // Don't transform to our wrapper 45604 } 45605} 45606 45607var didWarnAboutUndefinedSnapshotBeforeUpdate = null; 45608 45609{ 45610 didWarnAboutUndefinedSnapshotBeforeUpdate = new Set(); 45611} 45612 45613var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set; 45614function logError(boundary, errorInfo) { 45615 var source = errorInfo.source; 45616 var stack = errorInfo.stack; 45617 45618 if (stack === null && source !== null) { 45619 stack = getStackByFiberInDevAndProd(source); 45620 } 45621 45622 var capturedError = { 45623 componentName: source !== null ? getComponentName(source.type) : null, 45624 componentStack: stack !== null ? stack : '', 45625 error: errorInfo.value, 45626 errorBoundary: null, 45627 errorBoundaryName: null, 45628 errorBoundaryFound: false, 45629 willRetry: false 45630 }; 45631 45632 if (boundary !== null && boundary.tag === ClassComponent) { 45633 capturedError.errorBoundary = boundary.stateNode; 45634 capturedError.errorBoundaryName = getComponentName(boundary.type); 45635 capturedError.errorBoundaryFound = true; 45636 capturedError.willRetry = true; 45637 } 45638 45639 try { 45640 logCapturedError(capturedError); 45641 } catch (e) { 45642 // This method must not throw, or React internal state will get messed up. 45643 // If console.error is overridden, or logCapturedError() shows a dialog that throws, 45644 // we want to report this error outside of the normal stack as a last resort. 45645 // https://github.com/facebook/react/issues/13188 45646 setTimeout(function () { 45647 throw e; 45648 }); 45649 } 45650} 45651 45652var callComponentWillUnmountWithTimer = function (current, instance) { 45653 startPhaseTimer(current, 'componentWillUnmount'); 45654 instance.props = current.memoizedProps; 45655 instance.state = current.memoizedState; 45656 instance.componentWillUnmount(); 45657 stopPhaseTimer(); 45658}; // Capture errors so they don't interrupt unmounting. 45659 45660 45661function safelyCallComponentWillUnmount(current, instance) { 45662 { 45663 invokeGuardedCallback(null, callComponentWillUnmountWithTimer, null, current, instance); 45664 45665 if (hasCaughtError()) { 45666 var unmountError = clearCaughtError(); 45667 captureCommitPhaseError(current, unmountError); 45668 } 45669 } 45670} 45671 45672function safelyDetachRef(current) { 45673 var ref = current.ref; 45674 45675 if (ref !== null) { 45676 if (typeof ref === 'function') { 45677 { 45678 invokeGuardedCallback(null, ref, null, null); 45679 45680 if (hasCaughtError()) { 45681 var refError = clearCaughtError(); 45682 captureCommitPhaseError(current, refError); 45683 } 45684 } 45685 } else { 45686 ref.current = null; 45687 } 45688 } 45689} 45690 45691function safelyCallDestroy(current, destroy) { 45692 { 45693 invokeGuardedCallback(null, destroy, null); 45694 45695 if (hasCaughtError()) { 45696 var error = clearCaughtError(); 45697 captureCommitPhaseError(current, error); 45698 } 45699 } 45700} 45701 45702function commitBeforeMutationLifeCycles(current, finishedWork) { 45703 switch (finishedWork.tag) { 45704 case FunctionComponent: 45705 case ForwardRef: 45706 case SimpleMemoComponent: 45707 case Block: 45708 { 45709 return; 45710 } 45711 45712 case ClassComponent: 45713 { 45714 if (finishedWork.effectTag & Snapshot) { 45715 if (current !== null) { 45716 var prevProps = current.memoizedProps; 45717 var prevState = current.memoizedState; 45718 startPhaseTimer(finishedWork, 'getSnapshotBeforeUpdate'); 45719 var instance = finishedWork.stateNode; // We could update instance props and state here, 45720 // but instead we rely on them being set during last render. 45721 // TODO: revisit this when we implement resuming. 45722 45723 { 45724 if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { 45725 if (instance.props !== finishedWork.memoizedProps) { 45726 error('Expected %s props to match memoized props before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); 45727 } 45728 45729 if (instance.state !== finishedWork.memoizedState) { 45730 error('Expected %s state to match memoized state before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); 45731 } 45732 } 45733 } 45734 45735 var snapshot = instance.getSnapshotBeforeUpdate(finishedWork.elementType === finishedWork.type ? prevProps : resolveDefaultProps(finishedWork.type, prevProps), prevState); 45736 45737 { 45738 var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate; 45739 45740 if (snapshot === undefined && !didWarnSet.has(finishedWork.type)) { 45741 didWarnSet.add(finishedWork.type); 45742 45743 error('%s.getSnapshotBeforeUpdate(): A snapshot value (or null) ' + 'must be returned. You have returned undefined.', getComponentName(finishedWork.type)); 45744 } 45745 } 45746 45747 instance.__reactInternalSnapshotBeforeUpdate = snapshot; 45748 stopPhaseTimer(); 45749 } 45750 } 45751 45752 return; 45753 } 45754 45755 case HostRoot: 45756 case HostComponent: 45757 case HostText: 45758 case HostPortal: 45759 case IncompleteClassComponent: 45760 // Nothing to do for these component types 45761 return; 45762 } 45763 45764 { 45765 { 45766 throw Error( "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." ); 45767 } 45768 } 45769} 45770 45771function commitHookEffectListUnmount(tag, finishedWork) { 45772 var updateQueue = finishedWork.updateQueue; 45773 var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null; 45774 45775 if (lastEffect !== null) { 45776 var firstEffect = lastEffect.next; 45777 var effect = firstEffect; 45778 45779 do { 45780 if ((effect.tag & tag) === tag) { 45781 // Unmount 45782 var destroy = effect.destroy; 45783 effect.destroy = undefined; 45784 45785 if (destroy !== undefined) { 45786 destroy(); 45787 } 45788 } 45789 45790 effect = effect.next; 45791 } while (effect !== firstEffect); 45792 } 45793} 45794 45795function commitHookEffectListMount(tag, finishedWork) { 45796 var updateQueue = finishedWork.updateQueue; 45797 var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null; 45798 45799 if (lastEffect !== null) { 45800 var firstEffect = lastEffect.next; 45801 var effect = firstEffect; 45802 45803 do { 45804 if ((effect.tag & tag) === tag) { 45805 // Mount 45806 var create = effect.create; 45807 effect.destroy = create(); 45808 45809 { 45810 var destroy = effect.destroy; 45811 45812 if (destroy !== undefined && typeof destroy !== 'function') { 45813 var addendum = void 0; 45814 45815 if (destroy === null) { 45816 addendum = ' You returned null. If your effect does not require clean ' + 'up, return undefined (or nothing).'; 45817 } else if (typeof destroy.then === 'function') { 45818 addendum = '\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. ' + 'Instead, write the async function inside your effect ' + 'and call it immediately:\n\n' + 'useEffect(() => {\n' + ' async function fetchData() {\n' + ' // You can await here\n' + ' const response = await MyAPI.getData(someId);\n' + ' // ...\n' + ' }\n' + ' fetchData();\n' + "}, [someId]); // Or [] if effect doesn't need props or state\n\n" + 'Learn more about data fetching with Hooks: https://fb.me/react-hooks-data-fetching'; 45819 } else { 45820 addendum = ' You returned: ' + destroy; 45821 } 45822 45823 error('An effect function must not return anything besides a function, ' + 'which is used for clean-up.%s%s', addendum, getStackByFiberInDevAndProd(finishedWork)); 45824 } 45825 } 45826 } 45827 45828 effect = effect.next; 45829 } while (effect !== firstEffect); 45830 } 45831} 45832 45833function commitPassiveHookEffects(finishedWork) { 45834 if ((finishedWork.effectTag & Passive) !== NoEffect) { 45835 switch (finishedWork.tag) { 45836 case FunctionComponent: 45837 case ForwardRef: 45838 case SimpleMemoComponent: 45839 case Block: 45840 { 45841 // TODO (#17945) We should call all passive destroy functions (for all fibers) 45842 // before calling any create functions. The current approach only serializes 45843 // these for a single fiber. 45844 commitHookEffectListUnmount(Passive$1 | HasEffect, finishedWork); 45845 commitHookEffectListMount(Passive$1 | HasEffect, finishedWork); 45846 break; 45847 } 45848 } 45849 } 45850} 45851 45852function commitLifeCycles(finishedRoot, current, finishedWork, committedExpirationTime) { 45853 switch (finishedWork.tag) { 45854 case FunctionComponent: 45855 case ForwardRef: 45856 case SimpleMemoComponent: 45857 case Block: 45858 { 45859 // At this point layout effects have already been destroyed (during mutation phase). 45860 // This is done to prevent sibling component effects from interfering with each other, 45861 // e.g. a destroy function in one component should never override a ref set 45862 // by a create function in another component during the same commit. 45863 commitHookEffectListMount(Layout | HasEffect, finishedWork); 45864 45865 return; 45866 } 45867 45868 case ClassComponent: 45869 { 45870 var instance = finishedWork.stateNode; 45871 45872 if (finishedWork.effectTag & Update) { 45873 if (current === null) { 45874 startPhaseTimer(finishedWork, 'componentDidMount'); // We could update instance props and state here, 45875 // but instead we rely on them being set during last render. 45876 // TODO: revisit this when we implement resuming. 45877 45878 { 45879 if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { 45880 if (instance.props !== finishedWork.memoizedProps) { 45881 error('Expected %s props to match memoized props before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); 45882 } 45883 45884 if (instance.state !== finishedWork.memoizedState) { 45885 error('Expected %s state to match memoized state before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); 45886 } 45887 } 45888 } 45889 45890 instance.componentDidMount(); 45891 stopPhaseTimer(); 45892 } else { 45893 var prevProps = finishedWork.elementType === finishedWork.type ? current.memoizedProps : resolveDefaultProps(finishedWork.type, current.memoizedProps); 45894 var prevState = current.memoizedState; 45895 startPhaseTimer(finishedWork, 'componentDidUpdate'); // We could update instance props and state here, 45896 // but instead we rely on them being set during last render. 45897 // TODO: revisit this when we implement resuming. 45898 45899 { 45900 if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { 45901 if (instance.props !== finishedWork.memoizedProps) { 45902 error('Expected %s props to match memoized props before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); 45903 } 45904 45905 if (instance.state !== finishedWork.memoizedState) { 45906 error('Expected %s state to match memoized state before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); 45907 } 45908 } 45909 } 45910 45911 instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate); 45912 stopPhaseTimer(); 45913 } 45914 } 45915 45916 var updateQueue = finishedWork.updateQueue; 45917 45918 if (updateQueue !== null) { 45919 { 45920 if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { 45921 if (instance.props !== finishedWork.memoizedProps) { 45922 error('Expected %s props to match memoized props before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); 45923 } 45924 45925 if (instance.state !== finishedWork.memoizedState) { 45926 error('Expected %s state to match memoized state before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); 45927 } 45928 } 45929 } // We could update instance props and state here, 45930 // but instead we rely on them being set during last render. 45931 // TODO: revisit this when we implement resuming. 45932 45933 45934 commitUpdateQueue(finishedWork, updateQueue, instance); 45935 } 45936 45937 return; 45938 } 45939 45940 case HostRoot: 45941 { 45942 var _updateQueue = finishedWork.updateQueue; 45943 45944 if (_updateQueue !== null) { 45945 var _instance = null; 45946 45947 if (finishedWork.child !== null) { 45948 switch (finishedWork.child.tag) { 45949 case HostComponent: 45950 _instance = getPublicInstance(finishedWork.child.stateNode); 45951 break; 45952 45953 case ClassComponent: 45954 _instance = finishedWork.child.stateNode; 45955 break; 45956 } 45957 } 45958 45959 commitUpdateQueue(finishedWork, _updateQueue, _instance); 45960 } 45961 45962 return; 45963 } 45964 45965 case HostComponent: 45966 { 45967 var _instance2 = finishedWork.stateNode; // Renderers may schedule work to be done after host components are mounted 45968 // (eg DOM renderer may schedule auto-focus for inputs and form controls). 45969 // These effects should only be committed when components are first mounted, 45970 // aka when there is no current/alternate. 45971 45972 if (current === null && finishedWork.effectTag & Update) { 45973 var type = finishedWork.type; 45974 var props = finishedWork.memoizedProps; 45975 commitMount(_instance2, type, props); 45976 } 45977 45978 return; 45979 } 45980 45981 case HostText: 45982 { 45983 // We have no life-cycles associated with text. 45984 return; 45985 } 45986 45987 case HostPortal: 45988 { 45989 // We have no life-cycles associated with portals. 45990 return; 45991 } 45992 45993 case Profiler: 45994 { 45995 { 45996 var onRender = finishedWork.memoizedProps.onRender; 45997 45998 if (typeof onRender === 'function') { 45999 { 46000 onRender(finishedWork.memoizedProps.id, current === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, getCommitTime(), finishedRoot.memoizedInteractions); 46001 } 46002 } 46003 } 46004 46005 return; 46006 } 46007 46008 case SuspenseComponent: 46009 { 46010 commitSuspenseHydrationCallbacks(finishedRoot, finishedWork); 46011 return; 46012 } 46013 46014 case SuspenseListComponent: 46015 case IncompleteClassComponent: 46016 case FundamentalComponent: 46017 case ScopeComponent: 46018 return; 46019 } 46020 46021 { 46022 { 46023 throw Error( "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." ); 46024 } 46025 } 46026} 46027 46028function hideOrUnhideAllChildren(finishedWork, isHidden) { 46029 { 46030 // We only have the top Fiber that was inserted but we need to recurse down its 46031 // children to find all the terminal nodes. 46032 var node = finishedWork; 46033 46034 while (true) { 46035 if (node.tag === HostComponent) { 46036 var instance = node.stateNode; 46037 46038 if (isHidden) { 46039 hideInstance(instance); 46040 } else { 46041 unhideInstance(node.stateNode, node.memoizedProps); 46042 } 46043 } else if (node.tag === HostText) { 46044 var _instance3 = node.stateNode; 46045 46046 if (isHidden) { 46047 hideTextInstance(_instance3); 46048 } else { 46049 unhideTextInstance(_instance3, node.memoizedProps); 46050 } 46051 } else if (node.tag === SuspenseComponent && node.memoizedState !== null && node.memoizedState.dehydrated === null) { 46052 // Found a nested Suspense component that timed out. Skip over the 46053 // primary child fragment, which should remain hidden. 46054 var fallbackChildFragment = node.child.sibling; 46055 fallbackChildFragment.return = node; 46056 node = fallbackChildFragment; 46057 continue; 46058 } else if (node.child !== null) { 46059 node.child.return = node; 46060 node = node.child; 46061 continue; 46062 } 46063 46064 if (node === finishedWork) { 46065 return; 46066 } 46067 46068 while (node.sibling === null) { 46069 if (node.return === null || node.return === finishedWork) { 46070 return; 46071 } 46072 46073 node = node.return; 46074 } 46075 46076 node.sibling.return = node.return; 46077 node = node.sibling; 46078 } 46079 } 46080} 46081 46082function commitAttachRef(finishedWork) { 46083 var ref = finishedWork.ref; 46084 46085 if (ref !== null) { 46086 var instance = finishedWork.stateNode; 46087 var instanceToUse; 46088 46089 switch (finishedWork.tag) { 46090 case HostComponent: 46091 instanceToUse = getPublicInstance(instance); 46092 break; 46093 46094 default: 46095 instanceToUse = instance; 46096 } // Moved outside to ensure DCE works with this flag 46097 46098 if (typeof ref === 'function') { 46099 ref(instanceToUse); 46100 } else { 46101 { 46102 if (!ref.hasOwnProperty('current')) { 46103 error('Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().%s', getComponentName(finishedWork.type), getStackByFiberInDevAndProd(finishedWork)); 46104 } 46105 } 46106 46107 ref.current = instanceToUse; 46108 } 46109 } 46110} 46111 46112function commitDetachRef(current) { 46113 var currentRef = current.ref; 46114 46115 if (currentRef !== null) { 46116 if (typeof currentRef === 'function') { 46117 currentRef(null); 46118 } else { 46119 currentRef.current = null; 46120 } 46121 } 46122} // User-originating errors (lifecycles and refs) should not interrupt 46123// deletion, so don't let them throw. Host-originating errors should 46124// interrupt deletion, so it's okay 46125 46126 46127function commitUnmount(finishedRoot, current, renderPriorityLevel) { 46128 onCommitUnmount(current); 46129 46130 switch (current.tag) { 46131 case FunctionComponent: 46132 case ForwardRef: 46133 case MemoComponent: 46134 case SimpleMemoComponent: 46135 case Block: 46136 { 46137 var updateQueue = current.updateQueue; 46138 46139 if (updateQueue !== null) { 46140 var lastEffect = updateQueue.lastEffect; 46141 46142 if (lastEffect !== null) { 46143 var firstEffect = lastEffect.next; 46144 46145 { 46146 // When the owner fiber is deleted, the destroy function of a passive 46147 // effect hook is called during the synchronous commit phase. This is 46148 // a concession to implementation complexity. Calling it in the 46149 // passive effect phase (like they usually are, when dependencies 46150 // change during an update) would require either traversing the 46151 // children of the deleted fiber again, or including unmount effects 46152 // as part of the fiber effect list. 46153 // 46154 // Because this is during the sync commit phase, we need to change 46155 // the priority. 46156 // 46157 // TODO: Reconsider this implementation trade off. 46158 var priorityLevel = renderPriorityLevel > NormalPriority ? NormalPriority : renderPriorityLevel; 46159 runWithPriority$1(priorityLevel, function () { 46160 var effect = firstEffect; 46161 46162 do { 46163 var _destroy = effect.destroy; 46164 46165 if (_destroy !== undefined) { 46166 safelyCallDestroy(current, _destroy); 46167 } 46168 46169 effect = effect.next; 46170 } while (effect !== firstEffect); 46171 }); 46172 } 46173 } 46174 } 46175 46176 return; 46177 } 46178 46179 case ClassComponent: 46180 { 46181 safelyDetachRef(current); 46182 var instance = current.stateNode; 46183 46184 if (typeof instance.componentWillUnmount === 'function') { 46185 safelyCallComponentWillUnmount(current, instance); 46186 } 46187 46188 return; 46189 } 46190 46191 case HostComponent: 46192 { 46193 46194 safelyDetachRef(current); 46195 return; 46196 } 46197 46198 case HostPortal: 46199 { 46200 // TODO: this is recursive. 46201 // We are also not using this parent because 46202 // the portal will get pushed immediately. 46203 { 46204 unmountHostComponents(finishedRoot, current, renderPriorityLevel); 46205 } 46206 46207 return; 46208 } 46209 46210 case FundamentalComponent: 46211 { 46212 46213 return; 46214 } 46215 46216 case DehydratedFragment: 46217 { 46218 46219 return; 46220 } 46221 46222 case ScopeComponent: 46223 { 46224 46225 return; 46226 } 46227 } 46228} 46229 46230function commitNestedUnmounts(finishedRoot, root, renderPriorityLevel) { 46231 // While we're inside a removed host node we don't want to call 46232 // removeChild on the inner nodes because they're removed by the top 46233 // call anyway. We also want to call componentWillUnmount on all 46234 // composites before this host node is removed from the tree. Therefore 46235 // we do an inner loop while we're still inside the host node. 46236 var node = root; 46237 46238 while (true) { 46239 commitUnmount(finishedRoot, node, renderPriorityLevel); // Visit children because they may contain more composite or host nodes. 46240 // Skip portals because commitUnmount() currently visits them recursively. 46241 46242 if (node.child !== null && ( // If we use mutation we drill down into portals using commitUnmount above. 46243 // If we don't use mutation we drill down into portals here instead. 46244 node.tag !== HostPortal)) { 46245 node.child.return = node; 46246 node = node.child; 46247 continue; 46248 } 46249 46250 if (node === root) { 46251 return; 46252 } 46253 46254 while (node.sibling === null) { 46255 if (node.return === null || node.return === root) { 46256 return; 46257 } 46258 46259 node = node.return; 46260 } 46261 46262 node.sibling.return = node.return; 46263 node = node.sibling; 46264 } 46265} 46266 46267function detachFiber(current) { 46268 var alternate = current.alternate; // Cut off the return pointers to disconnect it from the tree. Ideally, we 46269 // should clear the child pointer of the parent alternate to let this 46270 // get GC:ed but we don't know which for sure which parent is the current 46271 // one so we'll settle for GC:ing the subtree of this child. This child 46272 // itself will be GC:ed when the parent updates the next time. 46273 46274 current.return = null; 46275 current.child = null; 46276 current.memoizedState = null; 46277 current.updateQueue = null; 46278 current.dependencies = null; 46279 current.alternate = null; 46280 current.firstEffect = null; 46281 current.lastEffect = null; 46282 current.pendingProps = null; 46283 current.memoizedProps = null; 46284 current.stateNode = null; 46285 46286 if (alternate !== null) { 46287 detachFiber(alternate); 46288 } 46289} 46290 46291function getHostParentFiber(fiber) { 46292 var parent = fiber.return; 46293 46294 while (parent !== null) { 46295 if (isHostParent(parent)) { 46296 return parent; 46297 } 46298 46299 parent = parent.return; 46300 } 46301 46302 { 46303 { 46304 throw Error( "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." ); 46305 } 46306 } 46307} 46308 46309function isHostParent(fiber) { 46310 return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal; 46311} 46312 46313function getHostSibling(fiber) { 46314 // We're going to search forward into the tree until we find a sibling host 46315 // node. Unfortunately, if multiple insertions are done in a row we have to 46316 // search past them. This leads to exponential search for the next sibling. 46317 // TODO: Find a more efficient way to do this. 46318 var node = fiber; 46319 46320 siblings: while (true) { 46321 // If we didn't find anything, let's try the next sibling. 46322 while (node.sibling === null) { 46323 if (node.return === null || isHostParent(node.return)) { 46324 // If we pop out of the root or hit the parent the fiber we are the 46325 // last sibling. 46326 return null; 46327 } 46328 46329 node = node.return; 46330 } 46331 46332 node.sibling.return = node.return; 46333 node = node.sibling; 46334 46335 while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedFragment) { 46336 // If it is not host node and, we might have a host node inside it. 46337 // Try to search down until we find one. 46338 if (node.effectTag & Placement) { 46339 // If we don't have a child, try the siblings instead. 46340 continue siblings; 46341 } // If we don't have a child, try the siblings instead. 46342 // We also skip portals because they are not part of this host tree. 46343 46344 46345 if (node.child === null || node.tag === HostPortal) { 46346 continue siblings; 46347 } else { 46348 node.child.return = node; 46349 node = node.child; 46350 } 46351 } // Check if this host node is stable or about to be placed. 46352 46353 46354 if (!(node.effectTag & Placement)) { 46355 // Found it! 46356 return node.stateNode; 46357 } 46358 } 46359} 46360 46361function commitPlacement(finishedWork) { 46362 46363 46364 var parentFiber = getHostParentFiber(finishedWork); // Note: these two variables *must* always be updated together. 46365 46366 var parent; 46367 var isContainer; 46368 var parentStateNode = parentFiber.stateNode; 46369 46370 switch (parentFiber.tag) { 46371 case HostComponent: 46372 parent = parentStateNode; 46373 isContainer = false; 46374 break; 46375 46376 case HostRoot: 46377 parent = parentStateNode.containerInfo; 46378 isContainer = true; 46379 break; 46380 46381 case HostPortal: 46382 parent = parentStateNode.containerInfo; 46383 isContainer = true; 46384 break; 46385 46386 case FundamentalComponent: 46387 46388 // eslint-disable-next-line-no-fallthrough 46389 46390 default: 46391 { 46392 { 46393 throw Error( "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." ); 46394 } 46395 } 46396 46397 } 46398 46399 if (parentFiber.effectTag & ContentReset) { 46400 // Reset the text content of the parent before doing any insertions 46401 resetTextContent(parent); // Clear ContentReset from the effect tag 46402 46403 parentFiber.effectTag &= ~ContentReset; 46404 } 46405 46406 var before = getHostSibling(finishedWork); // We only have the top Fiber that was inserted but we need to recurse down its 46407 // children to find all the terminal nodes. 46408 46409 if (isContainer) { 46410 insertOrAppendPlacementNodeIntoContainer(finishedWork, before, parent); 46411 } else { 46412 insertOrAppendPlacementNode(finishedWork, before, parent); 46413 } 46414} 46415 46416function insertOrAppendPlacementNodeIntoContainer(node, before, parent) { 46417 var tag = node.tag; 46418 var isHost = tag === HostComponent || tag === HostText; 46419 46420 if (isHost || enableFundamentalAPI ) { 46421 var stateNode = isHost ? node.stateNode : node.stateNode.instance; 46422 46423 if (before) { 46424 insertInContainerBefore(parent, stateNode, before); 46425 } else { 46426 appendChildToContainer(parent, stateNode); 46427 } 46428 } else if (tag === HostPortal) ; else { 46429 var child = node.child; 46430 46431 if (child !== null) { 46432 insertOrAppendPlacementNodeIntoContainer(child, before, parent); 46433 var sibling = child.sibling; 46434 46435 while (sibling !== null) { 46436 insertOrAppendPlacementNodeIntoContainer(sibling, before, parent); 46437 sibling = sibling.sibling; 46438 } 46439 } 46440 } 46441} 46442 46443function insertOrAppendPlacementNode(node, before, parent) { 46444 var tag = node.tag; 46445 var isHost = tag === HostComponent || tag === HostText; 46446 46447 if (isHost || enableFundamentalAPI ) { 46448 var stateNode = isHost ? node.stateNode : node.stateNode.instance; 46449 46450 if (before) { 46451 insertBefore(parent, stateNode, before); 46452 } else { 46453 appendChild(parent, stateNode); 46454 } 46455 } else if (tag === HostPortal) ; else { 46456 var child = node.child; 46457 46458 if (child !== null) { 46459 insertOrAppendPlacementNode(child, before, parent); 46460 var sibling = child.sibling; 46461 46462 while (sibling !== null) { 46463 insertOrAppendPlacementNode(sibling, before, parent); 46464 sibling = sibling.sibling; 46465 } 46466 } 46467 } 46468} 46469 46470function unmountHostComponents(finishedRoot, current, renderPriorityLevel) { 46471 // We only have the top Fiber that was deleted but we need to recurse down its 46472 // children to find all the terminal nodes. 46473 var node = current; // Each iteration, currentParent is populated with node's host parent if not 46474 // currentParentIsValid. 46475 46476 var currentParentIsValid = false; // Note: these two variables *must* always be updated together. 46477 46478 var currentParent; 46479 var currentParentIsContainer; 46480 46481 while (true) { 46482 if (!currentParentIsValid) { 46483 var parent = node.return; 46484 46485 findParent: while (true) { 46486 if (!(parent !== null)) { 46487 { 46488 throw Error( "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." ); 46489 } 46490 } 46491 46492 var parentStateNode = parent.stateNode; 46493 46494 switch (parent.tag) { 46495 case HostComponent: 46496 currentParent = parentStateNode; 46497 currentParentIsContainer = false; 46498 break findParent; 46499 46500 case HostRoot: 46501 currentParent = parentStateNode.containerInfo; 46502 currentParentIsContainer = true; 46503 break findParent; 46504 46505 case HostPortal: 46506 currentParent = parentStateNode.containerInfo; 46507 currentParentIsContainer = true; 46508 break findParent; 46509 46510 } 46511 46512 parent = parent.return; 46513 } 46514 46515 currentParentIsValid = true; 46516 } 46517 46518 if (node.tag === HostComponent || node.tag === HostText) { 46519 commitNestedUnmounts(finishedRoot, node, renderPriorityLevel); // After all the children have unmounted, it is now safe to remove the 46520 // node from the tree. 46521 46522 if (currentParentIsContainer) { 46523 removeChildFromContainer(currentParent, node.stateNode); 46524 } else { 46525 removeChild(currentParent, node.stateNode); 46526 } // Don't visit children because we already visited them. 46527 46528 } else if (node.tag === HostPortal) { 46529 if (node.child !== null) { 46530 // When we go into a portal, it becomes the parent to remove from. 46531 // We will reassign it back when we pop the portal on the way up. 46532 currentParent = node.stateNode.containerInfo; 46533 currentParentIsContainer = true; // Visit children because portals might contain host components. 46534 46535 node.child.return = node; 46536 node = node.child; 46537 continue; 46538 } 46539 } else { 46540 commitUnmount(finishedRoot, node, renderPriorityLevel); // Visit children because we may find more host components below. 46541 46542 if (node.child !== null) { 46543 node.child.return = node; 46544 node = node.child; 46545 continue; 46546 } 46547 } 46548 46549 if (node === current) { 46550 return; 46551 } 46552 46553 while (node.sibling === null) { 46554 if (node.return === null || node.return === current) { 46555 return; 46556 } 46557 46558 node = node.return; 46559 46560 if (node.tag === HostPortal) { 46561 // When we go out of the portal, we need to restore the parent. 46562 // Since we don't keep a stack of them, we will search for it. 46563 currentParentIsValid = false; 46564 } 46565 } 46566 46567 node.sibling.return = node.return; 46568 node = node.sibling; 46569 } 46570} 46571 46572function commitDeletion(finishedRoot, current, renderPriorityLevel) { 46573 { 46574 // Recursively delete all host nodes from the parent. 46575 // Detach refs and call componentWillUnmount() on the whole subtree. 46576 unmountHostComponents(finishedRoot, current, renderPriorityLevel); 46577 } 46578 46579 detachFiber(current); 46580} 46581 46582function commitWork(current, finishedWork) { 46583 46584 switch (finishedWork.tag) { 46585 case FunctionComponent: 46586 case ForwardRef: 46587 case MemoComponent: 46588 case SimpleMemoComponent: 46589 case Block: 46590 { 46591 // Layout effects are destroyed during the mutation phase so that all 46592 // destroy functions for all fibers are called before any create functions. 46593 // This prevents sibling component effects from interfering with each other, 46594 // e.g. a destroy function in one component should never override a ref set 46595 // by a create function in another component during the same commit. 46596 commitHookEffectListUnmount(Layout | HasEffect, finishedWork); 46597 return; 46598 } 46599 46600 case ClassComponent: 46601 { 46602 return; 46603 } 46604 46605 case HostComponent: 46606 { 46607 var instance = finishedWork.stateNode; 46608 46609 if (instance != null) { 46610 // Commit the work prepared earlier. 46611 var newProps = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps 46612 // as the newProps. The updatePayload will contain the real change in 46613 // this case. 46614 46615 var oldProps = current !== null ? current.memoizedProps : newProps; 46616 var type = finishedWork.type; // TODO: Type the updateQueue to be specific to host components. 46617 46618 var updatePayload = finishedWork.updateQueue; 46619 finishedWork.updateQueue = null; 46620 46621 if (updatePayload !== null) { 46622 commitUpdate(instance, updatePayload, type, oldProps, newProps); 46623 } 46624 } 46625 46626 return; 46627 } 46628 46629 case HostText: 46630 { 46631 if (!(finishedWork.stateNode !== null)) { 46632 { 46633 throw Error( "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." ); 46634 } 46635 } 46636 46637 var textInstance = finishedWork.stateNode; 46638 var newText = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps 46639 // as the newProps. The updatePayload will contain the real change in 46640 // this case. 46641 46642 var oldText = current !== null ? current.memoizedProps : newText; 46643 commitTextUpdate(textInstance, oldText, newText); 46644 return; 46645 } 46646 46647 case HostRoot: 46648 { 46649 { 46650 var _root = finishedWork.stateNode; 46651 46652 if (_root.hydrate) { 46653 // We've just hydrated. No need to hydrate again. 46654 _root.hydrate = false; 46655 commitHydratedContainer(_root.containerInfo); 46656 } 46657 } 46658 46659 return; 46660 } 46661 46662 case Profiler: 46663 { 46664 return; 46665 } 46666 46667 case SuspenseComponent: 46668 { 46669 commitSuspenseComponent(finishedWork); 46670 attachSuspenseRetryListeners(finishedWork); 46671 return; 46672 } 46673 46674 case SuspenseListComponent: 46675 { 46676 attachSuspenseRetryListeners(finishedWork); 46677 return; 46678 } 46679 46680 case IncompleteClassComponent: 46681 { 46682 return; 46683 } 46684 } 46685 46686 { 46687 { 46688 throw Error( "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." ); 46689 } 46690 } 46691} 46692 46693function commitSuspenseComponent(finishedWork) { 46694 var newState = finishedWork.memoizedState; 46695 var newDidTimeout; 46696 var primaryChildParent = finishedWork; 46697 46698 if (newState === null) { 46699 newDidTimeout = false; 46700 } else { 46701 newDidTimeout = true; 46702 primaryChildParent = finishedWork.child; 46703 markCommitTimeOfFallback(); 46704 } 46705 46706 if ( primaryChildParent !== null) { 46707 hideOrUnhideAllChildren(primaryChildParent, newDidTimeout); 46708 } 46709} 46710 46711function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) { 46712 46713 var newState = finishedWork.memoizedState; 46714 46715 if (newState === null) { 46716 var current = finishedWork.alternate; 46717 46718 if (current !== null) { 46719 var prevState = current.memoizedState; 46720 46721 if (prevState !== null) { 46722 var suspenseInstance = prevState.dehydrated; 46723 46724 if (suspenseInstance !== null) { 46725 commitHydratedSuspenseInstance(suspenseInstance); 46726 } 46727 } 46728 } 46729 } 46730} 46731 46732function attachSuspenseRetryListeners(finishedWork) { 46733 // If this boundary just timed out, then it will have a set of thenables. 46734 // For each thenable, attach a listener so that when it resolves, React 46735 // attempts to re-render the boundary in the primary (pre-timeout) state. 46736 var thenables = finishedWork.updateQueue; 46737 46738 if (thenables !== null) { 46739 finishedWork.updateQueue = null; 46740 var retryCache = finishedWork.stateNode; 46741 46742 if (retryCache === null) { 46743 retryCache = finishedWork.stateNode = new PossiblyWeakSet(); 46744 } 46745 46746 thenables.forEach(function (thenable) { 46747 // Memoize using the boundary fiber to prevent redundant listeners. 46748 var retry = resolveRetryThenable.bind(null, finishedWork, thenable); 46749 46750 if (!retryCache.has(thenable)) { 46751 { 46752 if (thenable.__reactDoNotTraceInteractions !== true) { 46753 retry = tracing.unstable_wrap(retry); 46754 } 46755 } 46756 46757 retryCache.add(thenable); 46758 thenable.then(retry, retry); 46759 } 46760 }); 46761 } 46762} 46763 46764function commitResetTextContent(current) { 46765 46766 resetTextContent(current.stateNode); 46767} 46768 46769var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map; 46770 46771function createRootErrorUpdate(fiber, errorInfo, expirationTime) { 46772 var update = createUpdate(expirationTime, null); // Unmount the root by rendering null. 46773 46774 update.tag = CaptureUpdate; // Caution: React DevTools currently depends on this property 46775 // being called "element". 46776 46777 update.payload = { 46778 element: null 46779 }; 46780 var error = errorInfo.value; 46781 46782 update.callback = function () { 46783 onUncaughtError(error); 46784 logError(fiber, errorInfo); 46785 }; 46786 46787 return update; 46788} 46789 46790function createClassErrorUpdate(fiber, errorInfo, expirationTime) { 46791 var update = createUpdate(expirationTime, null); 46792 update.tag = CaptureUpdate; 46793 var getDerivedStateFromError = fiber.type.getDerivedStateFromError; 46794 46795 if (typeof getDerivedStateFromError === 'function') { 46796 var error$1 = errorInfo.value; 46797 46798 update.payload = function () { 46799 logError(fiber, errorInfo); 46800 return getDerivedStateFromError(error$1); 46801 }; 46802 } 46803 46804 var inst = fiber.stateNode; 46805 46806 if (inst !== null && typeof inst.componentDidCatch === 'function') { 46807 update.callback = function callback() { 46808 { 46809 markFailedErrorBoundaryForHotReloading(fiber); 46810 } 46811 46812 if (typeof getDerivedStateFromError !== 'function') { 46813 // To preserve the preexisting retry behavior of error boundaries, 46814 // we keep track of which ones already failed during this batch. 46815 // This gets reset before we yield back to the browser. 46816 // TODO: Warn in strict mode if getDerivedStateFromError is 46817 // not defined. 46818 markLegacyErrorBoundaryAsFailed(this); // Only log here if componentDidCatch is the only error boundary method defined 46819 46820 logError(fiber, errorInfo); 46821 } 46822 46823 var error$1 = errorInfo.value; 46824 var stack = errorInfo.stack; 46825 this.componentDidCatch(error$1, { 46826 componentStack: stack !== null ? stack : '' 46827 }); 46828 46829 { 46830 if (typeof getDerivedStateFromError !== 'function') { 46831 // If componentDidCatch is the only error boundary method defined, 46832 // then it needs to call setState to recover from errors. 46833 // If no state update is scheduled then the boundary will swallow the error. 46834 if (fiber.expirationTime !== Sync) { 46835 error('%s: Error boundaries should implement getDerivedStateFromError(). ' + 'In that method, return a state update to display an error message or fallback UI.', getComponentName(fiber.type) || 'Unknown'); 46836 } 46837 } 46838 } 46839 }; 46840 } else { 46841 update.callback = function () { 46842 markFailedErrorBoundaryForHotReloading(fiber); 46843 }; 46844 } 46845 46846 return update; 46847} 46848 46849function attachPingListener(root, renderExpirationTime, thenable) { 46850 // Attach a listener to the promise to "ping" the root and retry. But 46851 // only if one does not already exist for the current render expiration 46852 // time (which acts like a "thread ID" here). 46853 var pingCache = root.pingCache; 46854 var threadIDs; 46855 46856 if (pingCache === null) { 46857 pingCache = root.pingCache = new PossiblyWeakMap$1(); 46858 threadIDs = new Set(); 46859 pingCache.set(thenable, threadIDs); 46860 } else { 46861 threadIDs = pingCache.get(thenable); 46862 46863 if (threadIDs === undefined) { 46864 threadIDs = new Set(); 46865 pingCache.set(thenable, threadIDs); 46866 } 46867 } 46868 46869 if (!threadIDs.has(renderExpirationTime)) { 46870 // Memoize using the thread ID to prevent redundant listeners. 46871 threadIDs.add(renderExpirationTime); 46872 var ping = pingSuspendedRoot.bind(null, root, thenable, renderExpirationTime); 46873 thenable.then(ping, ping); 46874 } 46875} 46876 46877function throwException(root, returnFiber, sourceFiber, value, renderExpirationTime) { 46878 // The source fiber did not complete. 46879 sourceFiber.effectTag |= Incomplete; // Its effect list is no longer valid. 46880 46881 sourceFiber.firstEffect = sourceFiber.lastEffect = null; 46882 46883 if (value !== null && typeof value === 'object' && typeof value.then === 'function') { 46884 // This is a thenable. 46885 var thenable = value; 46886 46887 if ((sourceFiber.mode & BlockingMode) === NoMode) { 46888 // Reset the memoizedState to what it was before we attempted 46889 // to render it. 46890 var currentSource = sourceFiber.alternate; 46891 46892 if (currentSource) { 46893 sourceFiber.updateQueue = currentSource.updateQueue; 46894 sourceFiber.memoizedState = currentSource.memoizedState; 46895 sourceFiber.expirationTime = currentSource.expirationTime; 46896 } else { 46897 sourceFiber.updateQueue = null; 46898 sourceFiber.memoizedState = null; 46899 } 46900 } 46901 46902 var hasInvisibleParentBoundary = hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext); // Schedule the nearest Suspense to re-render the timed out view. 46903 46904 var _workInProgress = returnFiber; 46905 46906 do { 46907 if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress, hasInvisibleParentBoundary)) { 46908 // Found the nearest boundary. 46909 // Stash the promise on the boundary fiber. If the boundary times out, we'll 46910 // attach another listener to flip the boundary back to its normal state. 46911 var thenables = _workInProgress.updateQueue; 46912 46913 if (thenables === null) { 46914 var updateQueue = new Set(); 46915 updateQueue.add(thenable); 46916 _workInProgress.updateQueue = updateQueue; 46917 } else { 46918 thenables.add(thenable); 46919 } // If the boundary is outside of blocking mode, we should *not* 46920 // suspend the commit. Pretend as if the suspended component rendered 46921 // null and keep rendering. In the commit phase, we'll schedule a 46922 // subsequent synchronous update to re-render the Suspense. 46923 // 46924 // Note: It doesn't matter whether the component that suspended was 46925 // inside a blocking mode tree. If the Suspense is outside of it, we 46926 // should *not* suspend the commit. 46927 46928 46929 if ((_workInProgress.mode & BlockingMode) === NoMode) { 46930 _workInProgress.effectTag |= DidCapture; // We're going to commit this fiber even though it didn't complete. 46931 // But we shouldn't call any lifecycle methods or callbacks. Remove 46932 // all lifecycle effect tags. 46933 46934 sourceFiber.effectTag &= ~(LifecycleEffectMask | Incomplete); 46935 46936 if (sourceFiber.tag === ClassComponent) { 46937 var currentSourceFiber = sourceFiber.alternate; 46938 46939 if (currentSourceFiber === null) { 46940 // This is a new mount. Change the tag so it's not mistaken for a 46941 // completed class component. For example, we should not call 46942 // componentWillUnmount if it is deleted. 46943 sourceFiber.tag = IncompleteClassComponent; 46944 } else { 46945 // When we try rendering again, we should not reuse the current fiber, 46946 // since it's known to be in an inconsistent state. Use a force update to 46947 // prevent a bail out. 46948 var update = createUpdate(Sync, null); 46949 update.tag = ForceUpdate; 46950 enqueueUpdate(sourceFiber, update); 46951 } 46952 } // The source fiber did not complete. Mark it with Sync priority to 46953 // indicate that it still has pending work. 46954 46955 46956 sourceFiber.expirationTime = Sync; // Exit without suspending. 46957 46958 return; 46959 } // Confirmed that the boundary is in a concurrent mode tree. Continue 46960 // with the normal suspend path. 46961 // 46962 // After this we'll use a set of heuristics to determine whether this 46963 // render pass will run to completion or restart or "suspend" the commit. 46964 // The actual logic for this is spread out in different places. 46965 // 46966 // This first principle is that if we're going to suspend when we complete 46967 // a root, then we should also restart if we get an update or ping that 46968 // might unsuspend it, and vice versa. The only reason to suspend is 46969 // because you think you might want to restart before committing. However, 46970 // it doesn't make sense to restart only while in the period we're suspended. 46971 // 46972 // Restarting too aggressively is also not good because it starves out any 46973 // intermediate loading state. So we use heuristics to determine when. 46974 // Suspense Heuristics 46975 // 46976 // If nothing threw a Promise or all the same fallbacks are already showing, 46977 // then don't suspend/restart. 46978 // 46979 // If this is an initial render of a new tree of Suspense boundaries and 46980 // those trigger a fallback, then don't suspend/restart. We want to ensure 46981 // that we can show the initial loading state as quickly as possible. 46982 // 46983 // If we hit a "Delayed" case, such as when we'd switch from content back into 46984 // a fallback, then we should always suspend/restart. SuspenseConfig applies to 46985 // this case. If none is defined, JND is used instead. 46986 // 46987 // If we're already showing a fallback and it gets "retried", allowing us to show 46988 // another level, but there's still an inner boundary that would show a fallback, 46989 // then we suspend/restart for 500ms since the last time we showed a fallback 46990 // anywhere in the tree. This effectively throttles progressive loading into a 46991 // consistent train of commits. This also gives us an opportunity to restart to 46992 // get to the completed state slightly earlier. 46993 // 46994 // If there's ambiguity due to batching it's resolved in preference of: 46995 // 1) "delayed", 2) "initial render", 3) "retry". 46996 // 46997 // We want to ensure that a "busy" state doesn't get force committed. We want to 46998 // ensure that new initial loading states can commit as soon as possible. 46999 47000 47001 attachPingListener(root, renderExpirationTime, thenable); 47002 _workInProgress.effectTag |= ShouldCapture; 47003 _workInProgress.expirationTime = renderExpirationTime; 47004 return; 47005 } // This boundary already captured during this render. Continue to the next 47006 // boundary. 47007 47008 47009 _workInProgress = _workInProgress.return; 47010 } while (_workInProgress !== null); // No boundary was found. Fallthrough to error mode. 47011 // TODO: Use invariant so the message is stripped in prod? 47012 47013 47014 value = new Error((getComponentName(sourceFiber.type) || 'A React component') + ' suspended while rendering, but no fallback UI was specified.\n' + '\n' + 'Add a <Suspense fallback=...> component higher in the tree to ' + 'provide a loading indicator or placeholder to display.' + getStackByFiberInDevAndProd(sourceFiber)); 47015 } // We didn't find a boundary that could handle this type of exception. Start 47016 // over and traverse parent path again, this time treating the exception 47017 // as an error. 47018 47019 47020 renderDidError(); 47021 value = createCapturedValue(value, sourceFiber); 47022 var workInProgress = returnFiber; 47023 47024 do { 47025 switch (workInProgress.tag) { 47026 case HostRoot: 47027 { 47028 var _errorInfo = value; 47029 workInProgress.effectTag |= ShouldCapture; 47030 workInProgress.expirationTime = renderExpirationTime; 47031 47032 var _update = createRootErrorUpdate(workInProgress, _errorInfo, renderExpirationTime); 47033 47034 enqueueCapturedUpdate(workInProgress, _update); 47035 return; 47036 } 47037 47038 case ClassComponent: 47039 // Capture and retry 47040 var errorInfo = value; 47041 var ctor = workInProgress.type; 47042 var instance = workInProgress.stateNode; 47043 47044 if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromError === 'function' || instance !== null && typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance))) { 47045 workInProgress.effectTag |= ShouldCapture; 47046 workInProgress.expirationTime = renderExpirationTime; // Schedule the error boundary to re-render using updated state 47047 47048 var _update2 = createClassErrorUpdate(workInProgress, errorInfo, renderExpirationTime); 47049 47050 enqueueCapturedUpdate(workInProgress, _update2); 47051 return; 47052 } 47053 47054 break; 47055 } 47056 47057 workInProgress = workInProgress.return; 47058 } while (workInProgress !== null); 47059} 47060 47061var ceil = Math.ceil; 47062var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, 47063 ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, 47064 IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing; 47065var NoContext = 47066/* */ 470670; 47068var BatchedContext = 47069/* */ 470701; 47071var EventContext = 47072/* */ 470732; 47074var DiscreteEventContext = 47075/* */ 470764; 47077var LegacyUnbatchedContext = 47078/* */ 470798; 47080var RenderContext = 47081/* */ 4708216; 47083var CommitContext = 47084/* */ 4708532; 47086var RootIncomplete = 0; 47087var RootFatalErrored = 1; 47088var RootErrored = 2; 47089var RootSuspended = 3; 47090var RootSuspendedWithDelay = 4; 47091var RootCompleted = 5; 47092// Describes where we are in the React execution stack 47093var executionContext = NoContext; // The root we're working on 47094 47095var workInProgressRoot = null; // The fiber we're working on 47096 47097var workInProgress = null; // The expiration time we're rendering 47098 47099var renderExpirationTime$1 = NoWork; // Whether to root completed, errored, suspended, etc. 47100 47101var workInProgressRootExitStatus = RootIncomplete; // A fatal error, if one is thrown 47102 47103var workInProgressRootFatalError = null; // Most recent event time among processed updates during this render. 47104// This is conceptually a time stamp but expressed in terms of an ExpirationTime 47105// because we deal mostly with expiration times in the hot path, so this avoids 47106// the conversion happening in the hot path. 47107 47108var workInProgressRootLatestProcessedExpirationTime = Sync; 47109var workInProgressRootLatestSuspenseTimeout = Sync; 47110var workInProgressRootCanSuspendUsingConfig = null; // The work left over by components that were visited during this render. Only 47111// includes unprocessed updates, not work in bailed out children. 47112 47113var workInProgressRootNextUnprocessedUpdateTime = NoWork; // If we're pinged while rendering we don't always restart immediately. 47114// This flag determines if it might be worthwhile to restart if an opportunity 47115// happens latere. 47116 47117var workInProgressRootHasPendingPing = false; // The most recent time we committed a fallback. This lets us ensure a train 47118// model where we don't commit new loading states in too quick succession. 47119 47120var globalMostRecentFallbackTime = 0; 47121var FALLBACK_THROTTLE_MS = 500; 47122var nextEffect = null; 47123var hasUncaughtError = false; 47124var firstUncaughtError = null; 47125var legacyErrorBoundariesThatAlreadyFailed = null; 47126var rootDoesHavePassiveEffects = false; 47127var rootWithPendingPassiveEffects = null; 47128var pendingPassiveEffectsRenderPriority = NoPriority; 47129var pendingPassiveEffectsExpirationTime = NoWork; 47130var rootsWithPendingDiscreteUpdates = null; // Use these to prevent an infinite loop of nested updates 47131 47132var NESTED_UPDATE_LIMIT = 50; 47133var nestedUpdateCount = 0; 47134var rootWithNestedUpdates = null; 47135var NESTED_PASSIVE_UPDATE_LIMIT = 50; 47136var nestedPassiveUpdateCount = 0; 47137var interruptedBy = null; // Marks the need to reschedule pending interactions at these expiration times 47138// during the commit phase. This enables them to be traced across components 47139// that spawn new work during render. E.g. hidden boundaries, suspended SSR 47140// hydration or SuspenseList. 47141 47142var spawnedWorkDuringRender = null; // Expiration times are computed by adding to the current time (the start 47143// time). However, if two updates are scheduled within the same event, we 47144// should treat their start times as simultaneous, even if the actual clock 47145// time has advanced between the first and second call. 47146// In other words, because expiration times determine how updates are batched, 47147// we want all updates of like priority that occur within the same event to 47148// receive the same expiration time. Otherwise we get tearing. 47149 47150var currentEventTime = NoWork; 47151function requestCurrentTimeForUpdate() { 47152 if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { 47153 // We're inside React, so it's fine to read the actual time. 47154 return msToExpirationTime(now()); 47155 } // We're not inside React, so we may be in the middle of a browser event. 47156 47157 47158 if (currentEventTime !== NoWork) { 47159 // Use the same start time for all updates until we enter React again. 47160 return currentEventTime; 47161 } // This is the first update since React yielded. Compute a new start time. 47162 47163 47164 currentEventTime = msToExpirationTime(now()); 47165 return currentEventTime; 47166} 47167function getCurrentTime() { 47168 return msToExpirationTime(now()); 47169} 47170function computeExpirationForFiber(currentTime, fiber, suspenseConfig) { 47171 var mode = fiber.mode; 47172 47173 if ((mode & BlockingMode) === NoMode) { 47174 return Sync; 47175 } 47176 47177 var priorityLevel = getCurrentPriorityLevel(); 47178 47179 if ((mode & ConcurrentMode) === NoMode) { 47180 return priorityLevel === ImmediatePriority ? Sync : Batched; 47181 } 47182 47183 if ((executionContext & RenderContext) !== NoContext) { 47184 // Use whatever time we're already rendering 47185 // TODO: Should there be a way to opt out, like with `runWithPriority`? 47186 return renderExpirationTime$1; 47187 } 47188 47189 var expirationTime; 47190 47191 if (suspenseConfig !== null) { 47192 // Compute an expiration time based on the Suspense timeout. 47193 expirationTime = computeSuspenseExpiration(currentTime, suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION); 47194 } else { 47195 // Compute an expiration time based on the Scheduler priority. 47196 switch (priorityLevel) { 47197 case ImmediatePriority: 47198 expirationTime = Sync; 47199 break; 47200 47201 case UserBlockingPriority$1: 47202 // TODO: Rename this to computeUserBlockingExpiration 47203 expirationTime = computeInteractiveExpiration(currentTime); 47204 break; 47205 47206 case NormalPriority: 47207 case LowPriority: 47208 // TODO: Handle LowPriority 47209 // TODO: Rename this to... something better. 47210 expirationTime = computeAsyncExpiration(currentTime); 47211 break; 47212 47213 case IdlePriority: 47214 expirationTime = Idle; 47215 break; 47216 47217 default: 47218 { 47219 { 47220 throw Error( "Expected a valid priority level" ); 47221 } 47222 } 47223 47224 } 47225 } // If we're in the middle of rendering a tree, do not update at the same 47226 // expiration time that is already rendering. 47227 // TODO: We shouldn't have to do this if the update is on a different root. 47228 // Refactor computeExpirationForFiber + scheduleUpdate so we have access to 47229 // the root when we check for this condition. 47230 47231 47232 if (workInProgressRoot !== null && expirationTime === renderExpirationTime$1) { 47233 // This is a trick to move this update into a separate batch 47234 expirationTime -= 1; 47235 } 47236 47237 return expirationTime; 47238} 47239function scheduleUpdateOnFiber(fiber, expirationTime) { 47240 checkForNestedUpdates(); 47241 warnAboutRenderPhaseUpdatesInDEV(fiber); 47242 var root = markUpdateTimeFromFiberToRoot(fiber, expirationTime); 47243 47244 if (root === null) { 47245 warnAboutUpdateOnUnmountedFiberInDEV(fiber); 47246 return; 47247 } 47248 47249 checkForInterruption(fiber, expirationTime); 47250 recordScheduleUpdate(); // TODO: computeExpirationForFiber also reads the priority. Pass the 47251 // priority as an argument to that function and this one. 47252 47253 var priorityLevel = getCurrentPriorityLevel(); 47254 47255 if (expirationTime === Sync) { 47256 if ( // Check if we're inside unbatchedUpdates 47257 (executionContext & LegacyUnbatchedContext) !== NoContext && // Check if we're not already rendering 47258 (executionContext & (RenderContext | CommitContext)) === NoContext) { 47259 // Register pending interactions on the root to avoid losing traced interaction data. 47260 schedulePendingInteractions(root, expirationTime); // This is a legacy edge case. The initial mount of a ReactDOM.render-ed 47261 // root inside of batchedUpdates should be synchronous, but layout updates 47262 // should be deferred until the end of the batch. 47263 47264 performSyncWorkOnRoot(root); 47265 } else { 47266 ensureRootIsScheduled(root); 47267 schedulePendingInteractions(root, expirationTime); 47268 47269 if (executionContext === NoContext) { 47270 // Flush the synchronous work now, unless we're already working or inside 47271 // a batch. This is intentionally inside scheduleUpdateOnFiber instead of 47272 // scheduleCallbackForFiber to preserve the ability to schedule a callback 47273 // without immediately flushing it. We only do this for user-initiated 47274 // updates, to preserve historical behavior of legacy mode. 47275 flushSyncCallbackQueue(); 47276 } 47277 } 47278 } else { 47279 ensureRootIsScheduled(root); 47280 schedulePendingInteractions(root, expirationTime); 47281 } 47282 47283 if ((executionContext & DiscreteEventContext) !== NoContext && ( // Only updates at user-blocking priority or greater are considered 47284 // discrete, even inside a discrete event. 47285 priorityLevel === UserBlockingPriority$1 || priorityLevel === ImmediatePriority)) { 47286 // This is the result of a discrete event. Track the lowest priority 47287 // discrete update per root so we can flush them early, if needed. 47288 if (rootsWithPendingDiscreteUpdates === null) { 47289 rootsWithPendingDiscreteUpdates = new Map([[root, expirationTime]]); 47290 } else { 47291 var lastDiscreteTime = rootsWithPendingDiscreteUpdates.get(root); 47292 47293 if (lastDiscreteTime === undefined || lastDiscreteTime > expirationTime) { 47294 rootsWithPendingDiscreteUpdates.set(root, expirationTime); 47295 } 47296 } 47297 } 47298} 47299var scheduleWork = scheduleUpdateOnFiber; // This is split into a separate function so we can mark a fiber with pending 47300// work without treating it as a typical update that originates from an event; 47301// e.g. retrying a Suspense boundary isn't an update, but it does schedule work 47302// on a fiber. 47303 47304function markUpdateTimeFromFiberToRoot(fiber, expirationTime) { 47305 // Update the source fiber's expiration time 47306 if (fiber.expirationTime < expirationTime) { 47307 fiber.expirationTime = expirationTime; 47308 } 47309 47310 var alternate = fiber.alternate; 47311 47312 if (alternate !== null && alternate.expirationTime < expirationTime) { 47313 alternate.expirationTime = expirationTime; 47314 } // Walk the parent path to the root and update the child expiration time. 47315 47316 47317 var node = fiber.return; 47318 var root = null; 47319 47320 if (node === null && fiber.tag === HostRoot) { 47321 root = fiber.stateNode; 47322 } else { 47323 while (node !== null) { 47324 alternate = node.alternate; 47325 47326 if (node.childExpirationTime < expirationTime) { 47327 node.childExpirationTime = expirationTime; 47328 47329 if (alternate !== null && alternate.childExpirationTime < expirationTime) { 47330 alternate.childExpirationTime = expirationTime; 47331 } 47332 } else if (alternate !== null && alternate.childExpirationTime < expirationTime) { 47333 alternate.childExpirationTime = expirationTime; 47334 } 47335 47336 if (node.return === null && node.tag === HostRoot) { 47337 root = node.stateNode; 47338 break; 47339 } 47340 47341 node = node.return; 47342 } 47343 } 47344 47345 if (root !== null) { 47346 if (workInProgressRoot === root) { 47347 // Received an update to a tree that's in the middle of rendering. Mark 47348 // that's unprocessed work on this root. 47349 markUnprocessedUpdateTime(expirationTime); 47350 47351 if (workInProgressRootExitStatus === RootSuspendedWithDelay) { 47352 // The root already suspended with a delay, which means this render 47353 // definitely won't finish. Since we have a new update, let's mark it as 47354 // suspended now, right before marking the incoming update. This has the 47355 // effect of interrupting the current render and switching to the update. 47356 // TODO: This happens to work when receiving an update during the render 47357 // phase, because of the trick inside computeExpirationForFiber to 47358 // subtract 1 from `renderExpirationTime` to move it into a 47359 // separate bucket. But we should probably model it with an exception, 47360 // using the same mechanism we use to force hydration of a subtree. 47361 // TODO: This does not account for low pri updates that were already 47362 // scheduled before the root started rendering. Need to track the next 47363 // pending expiration time (perhaps by backtracking the return path) and 47364 // then trigger a restart in the `renderDidSuspendDelayIfPossible` path. 47365 markRootSuspendedAtTime(root, renderExpirationTime$1); 47366 } 47367 } // Mark that the root has a pending update. 47368 47369 47370 markRootUpdatedAtTime(root, expirationTime); 47371 } 47372 47373 return root; 47374} 47375 47376function getNextRootExpirationTimeToWorkOn(root) { 47377 // Determines the next expiration time that the root should render, taking 47378 // into account levels that may be suspended, or levels that may have 47379 // received a ping. 47380 var lastExpiredTime = root.lastExpiredTime; 47381 47382 if (lastExpiredTime !== NoWork) { 47383 return lastExpiredTime; 47384 } // "Pending" refers to any update that hasn't committed yet, including if it 47385 // suspended. The "suspended" range is therefore a subset. 47386 47387 47388 var firstPendingTime = root.firstPendingTime; 47389 47390 if (!isRootSuspendedAtTime(root, firstPendingTime)) { 47391 // The highest priority pending time is not suspended. Let's work on that. 47392 return firstPendingTime; 47393 } // If the first pending time is suspended, check if there's a lower priority 47394 // pending level that we know about. Or check if we received a ping. Work 47395 // on whichever is higher priority. 47396 47397 47398 var lastPingedTime = root.lastPingedTime; 47399 var nextKnownPendingLevel = root.nextKnownPendingLevel; 47400 var nextLevel = lastPingedTime > nextKnownPendingLevel ? lastPingedTime : nextKnownPendingLevel; 47401 47402 if ( nextLevel <= Idle && firstPendingTime !== nextLevel) { 47403 // Don't work on Idle/Never priority unless everything else is committed. 47404 return NoWork; 47405 } 47406 47407 return nextLevel; 47408} // Use this function to schedule a task for a root. There's only one task per 47409// root; if a task was already scheduled, we'll check to make sure the 47410// expiration time of the existing task is the same as the expiration time of 47411// the next level that the root has work on. This function is called on every 47412// update, and right before exiting a task. 47413 47414 47415function ensureRootIsScheduled(root) { 47416 var lastExpiredTime = root.lastExpiredTime; 47417 47418 if (lastExpiredTime !== NoWork) { 47419 // Special case: Expired work should flush synchronously. 47420 root.callbackExpirationTime = Sync; 47421 root.callbackPriority = ImmediatePriority; 47422 root.callbackNode = scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root)); 47423 return; 47424 } 47425 47426 var expirationTime = getNextRootExpirationTimeToWorkOn(root); 47427 var existingCallbackNode = root.callbackNode; 47428 47429 if (expirationTime === NoWork) { 47430 // There's nothing to work on. 47431 if (existingCallbackNode !== null) { 47432 root.callbackNode = null; 47433 root.callbackExpirationTime = NoWork; 47434 root.callbackPriority = NoPriority; 47435 } 47436 47437 return; 47438 } // TODO: If this is an update, we already read the current time. Pass the 47439 // time as an argument. 47440 47441 47442 var currentTime = requestCurrentTimeForUpdate(); 47443 var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime); // If there's an existing render task, confirm it has the correct priority and 47444 // expiration time. Otherwise, we'll cancel it and schedule a new one. 47445 47446 if (existingCallbackNode !== null) { 47447 var existingCallbackPriority = root.callbackPriority; 47448 var existingCallbackExpirationTime = root.callbackExpirationTime; 47449 47450 if ( // Callback must have the exact same expiration time. 47451 existingCallbackExpirationTime === expirationTime && // Callback must have greater or equal priority. 47452 existingCallbackPriority >= priorityLevel) { 47453 // Existing callback is sufficient. 47454 return; 47455 } // Need to schedule a new task. 47456 // TODO: Instead of scheduling a new task, we should be able to change the 47457 // priority of the existing one. 47458 47459 47460 cancelCallback(existingCallbackNode); 47461 } 47462 47463 root.callbackExpirationTime = expirationTime; 47464 root.callbackPriority = priorityLevel; 47465 var callbackNode; 47466 47467 if (expirationTime === Sync) { 47468 // Sync React callbacks are scheduled on a special internal queue 47469 callbackNode = scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root)); 47470 } else { 47471 callbackNode = scheduleCallback(priorityLevel, performConcurrentWorkOnRoot.bind(null, root), // Compute a task timeout based on the expiration time. This also affects 47472 // ordering because tasks are processed in timeout order. 47473 { 47474 timeout: expirationTimeToMs(expirationTime) - now() 47475 }); 47476 } 47477 47478 root.callbackNode = callbackNode; 47479} // This is the entry point for every concurrent task, i.e. anything that 47480// goes through Scheduler. 47481 47482 47483function performConcurrentWorkOnRoot(root, didTimeout) { 47484 // Since we know we're in a React event, we can clear the current 47485 // event time. The next update will compute a new event time. 47486 currentEventTime = NoWork; 47487 47488 if (didTimeout) { 47489 // The render task took too long to complete. Mark the current time as 47490 // expired to synchronously render all expired work in a single batch. 47491 var currentTime = requestCurrentTimeForUpdate(); 47492 markRootExpiredAtTime(root, currentTime); // This will schedule a synchronous callback. 47493 47494 ensureRootIsScheduled(root); 47495 return null; 47496 } // Determine the next expiration time to work on, using the fields stored 47497 // on the root. 47498 47499 47500 var expirationTime = getNextRootExpirationTimeToWorkOn(root); 47501 47502 if (expirationTime !== NoWork) { 47503 var originalCallbackNode = root.callbackNode; 47504 47505 if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { 47506 { 47507 throw Error( "Should not already be working." ); 47508 } 47509 } 47510 47511 flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack 47512 // and prepare a fresh one. Otherwise we'll continue where we left off. 47513 47514 if (root !== workInProgressRoot || expirationTime !== renderExpirationTime$1) { 47515 prepareFreshStack(root, expirationTime); 47516 startWorkOnPendingInteractions(root, expirationTime); 47517 } // If we have a work-in-progress fiber, it means there's still work to do 47518 // in this root. 47519 47520 47521 if (workInProgress !== null) { 47522 var prevExecutionContext = executionContext; 47523 executionContext |= RenderContext; 47524 var prevDispatcher = pushDispatcher(); 47525 var prevInteractions = pushInteractions(root); 47526 startWorkLoopTimer(workInProgress); 47527 47528 do { 47529 try { 47530 workLoopConcurrent(); 47531 break; 47532 } catch (thrownValue) { 47533 handleError(root, thrownValue); 47534 } 47535 } while (true); 47536 47537 resetContextDependencies(); 47538 executionContext = prevExecutionContext; 47539 popDispatcher(prevDispatcher); 47540 47541 { 47542 popInteractions(prevInteractions); 47543 } 47544 47545 if (workInProgressRootExitStatus === RootFatalErrored) { 47546 var fatalError = workInProgressRootFatalError; 47547 stopInterruptedWorkLoopTimer(); 47548 prepareFreshStack(root, expirationTime); 47549 markRootSuspendedAtTime(root, expirationTime); 47550 ensureRootIsScheduled(root); 47551 throw fatalError; 47552 } 47553 47554 if (workInProgress !== null) { 47555 // There's still work left over. Exit without committing. 47556 stopInterruptedWorkLoopTimer(); 47557 } else { 47558 // We now have a consistent tree. The next step is either to commit it, 47559 // or, if something suspended, wait to commit it after a timeout. 47560 stopFinishedWorkLoopTimer(); 47561 var finishedWork = root.finishedWork = root.current.alternate; 47562 root.finishedExpirationTime = expirationTime; 47563 finishConcurrentRender(root, finishedWork, workInProgressRootExitStatus, expirationTime); 47564 } 47565 47566 ensureRootIsScheduled(root); 47567 47568 if (root.callbackNode === originalCallbackNode) { 47569 // The task node scheduled for this root is the same one that's 47570 // currently executed. Need to return a continuation. 47571 return performConcurrentWorkOnRoot.bind(null, root); 47572 } 47573 } 47574 } 47575 47576 return null; 47577} 47578 47579function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime) { 47580 // Set this to null to indicate there's no in-progress render. 47581 workInProgressRoot = null; 47582 47583 switch (exitStatus) { 47584 case RootIncomplete: 47585 case RootFatalErrored: 47586 { 47587 { 47588 { 47589 throw Error( "Root did not complete. This is a bug in React." ); 47590 } 47591 } 47592 } 47593 // Flow knows about invariant, so it complains if I add a break 47594 // statement, but eslint doesn't know about invariant, so it complains 47595 // if I do. eslint-disable-next-line no-fallthrough 47596 47597 case RootErrored: 47598 { 47599 // If this was an async render, the error may have happened due to 47600 // a mutation in a concurrent event. Try rendering one more time, 47601 // synchronously, to see if the error goes away. If there are 47602 // lower priority updates, let's include those, too, in case they 47603 // fix the inconsistency. Render at Idle to include all updates. 47604 // If it was Idle or Never or some not-yet-invented time, render 47605 // at that time. 47606 markRootExpiredAtTime(root, expirationTime > Idle ? Idle : expirationTime); // We assume that this second render pass will be synchronous 47607 // and therefore not hit this path again. 47608 47609 break; 47610 } 47611 47612 case RootSuspended: 47613 { 47614 markRootSuspendedAtTime(root, expirationTime); 47615 var lastSuspendedTime = root.lastSuspendedTime; 47616 47617 if (expirationTime === lastSuspendedTime) { 47618 root.nextKnownPendingLevel = getRemainingExpirationTime(finishedWork); 47619 } // We have an acceptable loading state. We need to figure out if we 47620 // should immediately commit it or wait a bit. 47621 // If we have processed new updates during this render, we may now 47622 // have a new loading state ready. We want to ensure that we commit 47623 // that as soon as possible. 47624 47625 47626 var hasNotProcessedNewUpdates = workInProgressRootLatestProcessedExpirationTime === Sync; 47627 47628 if (hasNotProcessedNewUpdates && // do not delay if we're inside an act() scope 47629 !( IsThisRendererActing.current)) { 47630 // If we have not processed any new updates during this pass, then 47631 // this is either a retry of an existing fallback state or a 47632 // hidden tree. Hidden trees shouldn't be batched with other work 47633 // and after that's fixed it can only be a retry. We're going to 47634 // throttle committing retries so that we don't show too many 47635 // loading states too quickly. 47636 var msUntilTimeout = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now(); // Don't bother with a very short suspense time. 47637 47638 if (msUntilTimeout > 10) { 47639 if (workInProgressRootHasPendingPing) { 47640 var lastPingedTime = root.lastPingedTime; 47641 47642 if (lastPingedTime === NoWork || lastPingedTime >= expirationTime) { 47643 // This render was pinged but we didn't get to restart 47644 // earlier so try restarting now instead. 47645 root.lastPingedTime = expirationTime; 47646 prepareFreshStack(root, expirationTime); 47647 break; 47648 } 47649 } 47650 47651 var nextTime = getNextRootExpirationTimeToWorkOn(root); 47652 47653 if (nextTime !== NoWork && nextTime !== expirationTime) { 47654 // There's additional work on this root. 47655 break; 47656 } 47657 47658 if (lastSuspendedTime !== NoWork && lastSuspendedTime !== expirationTime) { 47659 // We should prefer to render the fallback of at the last 47660 // suspended level. Ping the last suspended level to try 47661 // rendering it again. 47662 root.lastPingedTime = lastSuspendedTime; 47663 break; 47664 } // The render is suspended, it hasn't timed out, and there's no 47665 // lower priority work to do. Instead of committing the fallback 47666 // immediately, wait for more data to arrive. 47667 47668 47669 root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), msUntilTimeout); 47670 break; 47671 } 47672 } // The work expired. Commit immediately. 47673 47674 47675 commitRoot(root); 47676 break; 47677 } 47678 47679 case RootSuspendedWithDelay: 47680 { 47681 markRootSuspendedAtTime(root, expirationTime); 47682 var _lastSuspendedTime = root.lastSuspendedTime; 47683 47684 if (expirationTime === _lastSuspendedTime) { 47685 root.nextKnownPendingLevel = getRemainingExpirationTime(finishedWork); 47686 } 47687 47688 if ( // do not delay if we're inside an act() scope 47689 !( IsThisRendererActing.current)) { 47690 // We're suspended in a state that should be avoided. We'll try to 47691 // avoid committing it for as long as the timeouts let us. 47692 if (workInProgressRootHasPendingPing) { 47693 var _lastPingedTime = root.lastPingedTime; 47694 47695 if (_lastPingedTime === NoWork || _lastPingedTime >= expirationTime) { 47696 // This render was pinged but we didn't get to restart earlier 47697 // so try restarting now instead. 47698 root.lastPingedTime = expirationTime; 47699 prepareFreshStack(root, expirationTime); 47700 break; 47701 } 47702 } 47703 47704 var _nextTime = getNextRootExpirationTimeToWorkOn(root); 47705 47706 if (_nextTime !== NoWork && _nextTime !== expirationTime) { 47707 // There's additional work on this root. 47708 break; 47709 } 47710 47711 if (_lastSuspendedTime !== NoWork && _lastSuspendedTime !== expirationTime) { 47712 // We should prefer to render the fallback of at the last 47713 // suspended level. Ping the last suspended level to try 47714 // rendering it again. 47715 root.lastPingedTime = _lastSuspendedTime; 47716 break; 47717 } 47718 47719 var _msUntilTimeout; 47720 47721 if (workInProgressRootLatestSuspenseTimeout !== Sync) { 47722 // We have processed a suspense config whose expiration time we 47723 // can use as the timeout. 47724 _msUntilTimeout = expirationTimeToMs(workInProgressRootLatestSuspenseTimeout) - now(); 47725 } else if (workInProgressRootLatestProcessedExpirationTime === Sync) { 47726 // This should never normally happen because only new updates 47727 // cause delayed states, so we should have processed something. 47728 // However, this could also happen in an offscreen tree. 47729 _msUntilTimeout = 0; 47730 } else { 47731 // If we don't have a suspense config, we're going to use a 47732 // heuristic to determine how long we can suspend. 47733 var eventTimeMs = inferTimeFromExpirationTime(workInProgressRootLatestProcessedExpirationTime); 47734 var currentTimeMs = now(); 47735 var timeUntilExpirationMs = expirationTimeToMs(expirationTime) - currentTimeMs; 47736 var timeElapsed = currentTimeMs - eventTimeMs; 47737 47738 if (timeElapsed < 0) { 47739 // We get this wrong some time since we estimate the time. 47740 timeElapsed = 0; 47741 } 47742 47743 _msUntilTimeout = jnd(timeElapsed) - timeElapsed; // Clamp the timeout to the expiration time. TODO: Once the 47744 // event time is exact instead of inferred from expiration time 47745 // we don't need this. 47746 47747 if (timeUntilExpirationMs < _msUntilTimeout) { 47748 _msUntilTimeout = timeUntilExpirationMs; 47749 } 47750 } // Don't bother with a very short suspense time. 47751 47752 47753 if (_msUntilTimeout > 10) { 47754 // The render is suspended, it hasn't timed out, and there's no 47755 // lower priority work to do. Instead of committing the fallback 47756 // immediately, wait for more data to arrive. 47757 root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), _msUntilTimeout); 47758 break; 47759 } 47760 } // The work expired. Commit immediately. 47761 47762 47763 commitRoot(root); 47764 break; 47765 } 47766 47767 case RootCompleted: 47768 { 47769 // The work completed. Ready to commit. 47770 if ( // do not delay if we're inside an act() scope 47771 !( IsThisRendererActing.current) && workInProgressRootLatestProcessedExpirationTime !== Sync && workInProgressRootCanSuspendUsingConfig !== null) { 47772 // If we have exceeded the minimum loading delay, which probably 47773 // means we have shown a spinner already, we might have to suspend 47774 // a bit longer to ensure that the spinner is shown for 47775 // enough time. 47776 var _msUntilTimeout2 = computeMsUntilSuspenseLoadingDelay(workInProgressRootLatestProcessedExpirationTime, expirationTime, workInProgressRootCanSuspendUsingConfig); 47777 47778 if (_msUntilTimeout2 > 10) { 47779 markRootSuspendedAtTime(root, expirationTime); 47780 root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), _msUntilTimeout2); 47781 break; 47782 } 47783 } 47784 47785 commitRoot(root); 47786 break; 47787 } 47788 47789 default: 47790 { 47791 { 47792 { 47793 throw Error( "Unknown root exit status." ); 47794 } 47795 } 47796 } 47797 } 47798} // This is the entry point for synchronous tasks that don't go 47799// through Scheduler 47800 47801 47802function performSyncWorkOnRoot(root) { 47803 // Check if there's expired work on this root. Otherwise, render at Sync. 47804 var lastExpiredTime = root.lastExpiredTime; 47805 var expirationTime = lastExpiredTime !== NoWork ? lastExpiredTime : Sync; 47806 47807 if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { 47808 { 47809 throw Error( "Should not already be working." ); 47810 } 47811 } 47812 47813 flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack 47814 // and prepare a fresh one. Otherwise we'll continue where we left off. 47815 47816 if (root !== workInProgressRoot || expirationTime !== renderExpirationTime$1) { 47817 prepareFreshStack(root, expirationTime); 47818 startWorkOnPendingInteractions(root, expirationTime); 47819 } // If we have a work-in-progress fiber, it means there's still work to do 47820 // in this root. 47821 47822 47823 if (workInProgress !== null) { 47824 var prevExecutionContext = executionContext; 47825 executionContext |= RenderContext; 47826 var prevDispatcher = pushDispatcher(); 47827 var prevInteractions = pushInteractions(root); 47828 startWorkLoopTimer(workInProgress); 47829 47830 do { 47831 try { 47832 workLoopSync(); 47833 break; 47834 } catch (thrownValue) { 47835 handleError(root, thrownValue); 47836 } 47837 } while (true); 47838 47839 resetContextDependencies(); 47840 executionContext = prevExecutionContext; 47841 popDispatcher(prevDispatcher); 47842 47843 { 47844 popInteractions(prevInteractions); 47845 } 47846 47847 if (workInProgressRootExitStatus === RootFatalErrored) { 47848 var fatalError = workInProgressRootFatalError; 47849 stopInterruptedWorkLoopTimer(); 47850 prepareFreshStack(root, expirationTime); 47851 markRootSuspendedAtTime(root, expirationTime); 47852 ensureRootIsScheduled(root); 47853 throw fatalError; 47854 } 47855 47856 if (workInProgress !== null) { 47857 // This is a sync render, so we should have finished the whole tree. 47858 { 47859 { 47860 throw Error( "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." ); 47861 } 47862 } 47863 } else { 47864 // We now have a consistent tree. Because this is a sync render, we 47865 // will commit it even if something suspended. 47866 stopFinishedWorkLoopTimer(); 47867 root.finishedWork = root.current.alternate; 47868 root.finishedExpirationTime = expirationTime; 47869 finishSyncRender(root); 47870 } // Before exiting, make sure there's a callback scheduled for the next 47871 // pending level. 47872 47873 47874 ensureRootIsScheduled(root); 47875 } 47876 47877 return null; 47878} 47879 47880function finishSyncRender(root) { 47881 // Set this to null to indicate there's no in-progress render. 47882 workInProgressRoot = null; 47883 commitRoot(root); 47884} 47885function flushDiscreteUpdates() { 47886 // TODO: Should be able to flush inside batchedUpdates, but not inside `act`. 47887 // However, `act` uses `batchedUpdates`, so there's no way to distinguish 47888 // those two cases. Need to fix this before exposing flushDiscreteUpdates 47889 // as a public API. 47890 if ((executionContext & (BatchedContext | RenderContext | CommitContext)) !== NoContext) { 47891 { 47892 if ((executionContext & RenderContext) !== NoContext) { 47893 error('unstable_flushDiscreteUpdates: Cannot flush updates when React is ' + 'already rendering.'); 47894 } 47895 } // We're already rendering, so we can't synchronously flush pending work. 47896 // This is probably a nested event dispatch triggered by a lifecycle/effect, 47897 // like `el.focus()`. Exit. 47898 47899 47900 return; 47901 } 47902 47903 flushPendingDiscreteUpdates(); // If the discrete updates scheduled passive effects, flush them now so that 47904 // they fire before the next serial event. 47905 47906 flushPassiveEffects(); 47907} 47908function syncUpdates(fn, a, b, c) { 47909 return runWithPriority$1(ImmediatePriority, fn.bind(null, a, b, c)); 47910} 47911 47912function flushPendingDiscreteUpdates() { 47913 if (rootsWithPendingDiscreteUpdates !== null) { 47914 // For each root with pending discrete updates, schedule a callback to 47915 // immediately flush them. 47916 var roots = rootsWithPendingDiscreteUpdates; 47917 rootsWithPendingDiscreteUpdates = null; 47918 roots.forEach(function (expirationTime, root) { 47919 markRootExpiredAtTime(root, expirationTime); 47920 ensureRootIsScheduled(root); 47921 }); // Now flush the immediate queue. 47922 47923 flushSyncCallbackQueue(); 47924 } 47925} 47926 47927function batchedUpdates$1(fn, a) { 47928 var prevExecutionContext = executionContext; 47929 executionContext |= BatchedContext; 47930 47931 try { 47932 return fn(a); 47933 } finally { 47934 executionContext = prevExecutionContext; 47935 47936 if (executionContext === NoContext) { 47937 // Flush the immediate callbacks that were scheduled during this batch 47938 flushSyncCallbackQueue(); 47939 } 47940 } 47941} 47942function batchedEventUpdates$1(fn, a) { 47943 var prevExecutionContext = executionContext; 47944 executionContext |= EventContext; 47945 47946 try { 47947 return fn(a); 47948 } finally { 47949 executionContext = prevExecutionContext; 47950 47951 if (executionContext === NoContext) { 47952 // Flush the immediate callbacks that were scheduled during this batch 47953 flushSyncCallbackQueue(); 47954 } 47955 } 47956} 47957function discreteUpdates$1(fn, a, b, c, d) { 47958 var prevExecutionContext = executionContext; 47959 executionContext |= DiscreteEventContext; 47960 47961 try { 47962 // Should this 47963 return runWithPriority$1(UserBlockingPriority$1, fn.bind(null, a, b, c, d)); 47964 } finally { 47965 executionContext = prevExecutionContext; 47966 47967 if (executionContext === NoContext) { 47968 // Flush the immediate callbacks that were scheduled during this batch 47969 flushSyncCallbackQueue(); 47970 } 47971 } 47972} 47973function unbatchedUpdates(fn, a) { 47974 var prevExecutionContext = executionContext; 47975 executionContext &= ~BatchedContext; 47976 executionContext |= LegacyUnbatchedContext; 47977 47978 try { 47979 return fn(a); 47980 } finally { 47981 executionContext = prevExecutionContext; 47982 47983 if (executionContext === NoContext) { 47984 // Flush the immediate callbacks that were scheduled during this batch 47985 flushSyncCallbackQueue(); 47986 } 47987 } 47988} 47989function flushSync(fn, a) { 47990 if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { 47991 { 47992 { 47993 throw Error( "flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering." ); 47994 } 47995 } 47996 } 47997 47998 var prevExecutionContext = executionContext; 47999 executionContext |= BatchedContext; 48000 48001 try { 48002 return runWithPriority$1(ImmediatePriority, fn.bind(null, a)); 48003 } finally { 48004 executionContext = prevExecutionContext; // Flush the immediate callbacks that were scheduled during this batch. 48005 // Note that this will happen even if batchedUpdates is higher up 48006 // the stack. 48007 48008 flushSyncCallbackQueue(); 48009 } 48010} 48011 48012function prepareFreshStack(root, expirationTime) { 48013 root.finishedWork = null; 48014 root.finishedExpirationTime = NoWork; 48015 var timeoutHandle = root.timeoutHandle; 48016 48017 if (timeoutHandle !== noTimeout) { 48018 // The root previous suspended and scheduled a timeout to commit a fallback 48019 // state. Now that we have additional work, cancel the timeout. 48020 root.timeoutHandle = noTimeout; // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above 48021 48022 cancelTimeout(timeoutHandle); 48023 } 48024 48025 if (workInProgress !== null) { 48026 var interruptedWork = workInProgress.return; 48027 48028 while (interruptedWork !== null) { 48029 unwindInterruptedWork(interruptedWork); 48030 interruptedWork = interruptedWork.return; 48031 } 48032 } 48033 48034 workInProgressRoot = root; 48035 workInProgress = createWorkInProgress(root.current, null); 48036 renderExpirationTime$1 = expirationTime; 48037 workInProgressRootExitStatus = RootIncomplete; 48038 workInProgressRootFatalError = null; 48039 workInProgressRootLatestProcessedExpirationTime = Sync; 48040 workInProgressRootLatestSuspenseTimeout = Sync; 48041 workInProgressRootCanSuspendUsingConfig = null; 48042 workInProgressRootNextUnprocessedUpdateTime = NoWork; 48043 workInProgressRootHasPendingPing = false; 48044 48045 { 48046 spawnedWorkDuringRender = null; 48047 } 48048 48049 { 48050 ReactStrictModeWarnings.discardPendingWarnings(); 48051 } 48052} 48053 48054function handleError(root, thrownValue) { 48055 do { 48056 try { 48057 // Reset module-level state that was set during the render phase. 48058 resetContextDependencies(); 48059 resetHooksAfterThrow(); 48060 resetCurrentFiber(); 48061 48062 if (workInProgress === null || workInProgress.return === null) { 48063 // Expected to be working on a non-root fiber. This is a fatal error 48064 // because there's no ancestor that can handle it; the root is 48065 // supposed to capture all errors that weren't caught by an error 48066 // boundary. 48067 workInProgressRootExitStatus = RootFatalErrored; 48068 workInProgressRootFatalError = thrownValue; // Set `workInProgress` to null. This represents advancing to the next 48069 // sibling, or the parent if there are no siblings. But since the root 48070 // has no siblings nor a parent, we set it to null. Usually this is 48071 // handled by `completeUnitOfWork` or `unwindWork`, but since we're 48072 // interntionally not calling those, we need set it here. 48073 // TODO: Consider calling `unwindWork` to pop the contexts. 48074 48075 workInProgress = null; 48076 return null; 48077 } 48078 48079 if (enableProfilerTimer && workInProgress.mode & ProfileMode) { 48080 // Record the time spent rendering before an error was thrown. This 48081 // avoids inaccurate Profiler durations in the case of a 48082 // suspended render. 48083 stopProfilerTimerIfRunningAndRecordDelta(workInProgress, true); 48084 } 48085 48086 throwException(root, workInProgress.return, workInProgress, thrownValue, renderExpirationTime$1); 48087 workInProgress = completeUnitOfWork(workInProgress); 48088 } catch (yetAnotherThrownValue) { 48089 // Something in the return path also threw. 48090 thrownValue = yetAnotherThrownValue; 48091 continue; 48092 } // Return to the normal work loop. 48093 48094 48095 return; 48096 } while (true); 48097} 48098 48099function pushDispatcher(root) { 48100 var prevDispatcher = ReactCurrentDispatcher$1.current; 48101 ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; 48102 48103 if (prevDispatcher === null) { 48104 // The React isomorphic package does not include a default dispatcher. 48105 // Instead the first renderer will lazily attach one, in order to give 48106 // nicer error messages. 48107 return ContextOnlyDispatcher; 48108 } else { 48109 return prevDispatcher; 48110 } 48111} 48112 48113function popDispatcher(prevDispatcher) { 48114 ReactCurrentDispatcher$1.current = prevDispatcher; 48115} 48116 48117function pushInteractions(root) { 48118 { 48119 var prevInteractions = tracing.__interactionsRef.current; 48120 tracing.__interactionsRef.current = root.memoizedInteractions; 48121 return prevInteractions; 48122 } 48123} 48124 48125function popInteractions(prevInteractions) { 48126 { 48127 tracing.__interactionsRef.current = prevInteractions; 48128 } 48129} 48130 48131function markCommitTimeOfFallback() { 48132 globalMostRecentFallbackTime = now(); 48133} 48134function markRenderEventTimeAndConfig(expirationTime, suspenseConfig) { 48135 if (expirationTime < workInProgressRootLatestProcessedExpirationTime && expirationTime > Idle) { 48136 workInProgressRootLatestProcessedExpirationTime = expirationTime; 48137 } 48138 48139 if (suspenseConfig !== null) { 48140 if (expirationTime < workInProgressRootLatestSuspenseTimeout && expirationTime > Idle) { 48141 workInProgressRootLatestSuspenseTimeout = expirationTime; // Most of the time we only have one config and getting wrong is not bad. 48142 48143 workInProgressRootCanSuspendUsingConfig = suspenseConfig; 48144 } 48145 } 48146} 48147function markUnprocessedUpdateTime(expirationTime) { 48148 if (expirationTime > workInProgressRootNextUnprocessedUpdateTime) { 48149 workInProgressRootNextUnprocessedUpdateTime = expirationTime; 48150 } 48151} 48152function renderDidSuspend() { 48153 if (workInProgressRootExitStatus === RootIncomplete) { 48154 workInProgressRootExitStatus = RootSuspended; 48155 } 48156} 48157function renderDidSuspendDelayIfPossible() { 48158 if (workInProgressRootExitStatus === RootIncomplete || workInProgressRootExitStatus === RootSuspended) { 48159 workInProgressRootExitStatus = RootSuspendedWithDelay; 48160 } // Check if there's a lower priority update somewhere else in the tree. 48161 48162 48163 if (workInProgressRootNextUnprocessedUpdateTime !== NoWork && workInProgressRoot !== null) { 48164 // Mark the current render as suspended, and then mark that there's a 48165 // pending update. 48166 // TODO: This should immediately interrupt the current render, instead 48167 // of waiting until the next time we yield. 48168 markRootSuspendedAtTime(workInProgressRoot, renderExpirationTime$1); 48169 markRootUpdatedAtTime(workInProgressRoot, workInProgressRootNextUnprocessedUpdateTime); 48170 } 48171} 48172function renderDidError() { 48173 if (workInProgressRootExitStatus !== RootCompleted) { 48174 workInProgressRootExitStatus = RootErrored; 48175 } 48176} // Called during render to determine if anything has suspended. 48177// Returns false if we're not sure. 48178 48179function renderHasNotSuspendedYet() { 48180 // If something errored or completed, we can't really be sure, 48181 // so those are false. 48182 return workInProgressRootExitStatus === RootIncomplete; 48183} 48184 48185function inferTimeFromExpirationTime(expirationTime) { 48186 // We don't know exactly when the update was scheduled, but we can infer an 48187 // approximate start time from the expiration time. 48188 var earliestExpirationTimeMs = expirationTimeToMs(expirationTime); 48189 return earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION; 48190} 48191 48192function inferTimeFromExpirationTimeWithSuspenseConfig(expirationTime, suspenseConfig) { 48193 // We don't know exactly when the update was scheduled, but we can infer an 48194 // approximate start time from the expiration time by subtracting the timeout 48195 // that was added to the event time. 48196 var earliestExpirationTimeMs = expirationTimeToMs(expirationTime); 48197 return earliestExpirationTimeMs - (suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION); 48198} // The work loop is an extremely hot path. Tell Closure not to inline it. 48199 48200/** @noinline */ 48201 48202 48203function workLoopSync() { 48204 // Already timed out, so perform work without checking if we need to yield. 48205 while (workInProgress !== null) { 48206 workInProgress = performUnitOfWork(workInProgress); 48207 } 48208} 48209/** @noinline */ 48210 48211 48212function workLoopConcurrent() { 48213 // Perform work until Scheduler asks us to yield 48214 while (workInProgress !== null && !shouldYield()) { 48215 workInProgress = performUnitOfWork(workInProgress); 48216 } 48217} 48218 48219function performUnitOfWork(unitOfWork) { 48220 // The current, flushed, state of this fiber is the alternate. Ideally 48221 // nothing should rely on this, but relying on it here means that we don't 48222 // need an additional field on the work in progress. 48223 var current = unitOfWork.alternate; 48224 startWorkTimer(unitOfWork); 48225 setCurrentFiber(unitOfWork); 48226 var next; 48227 48228 if ( (unitOfWork.mode & ProfileMode) !== NoMode) { 48229 startProfilerTimer(unitOfWork); 48230 next = beginWork$1(current, unitOfWork, renderExpirationTime$1); 48231 stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true); 48232 } else { 48233 next = beginWork$1(current, unitOfWork, renderExpirationTime$1); 48234 } 48235 48236 resetCurrentFiber(); 48237 unitOfWork.memoizedProps = unitOfWork.pendingProps; 48238 48239 if (next === null) { 48240 // If this doesn't spawn new work, complete the current work. 48241 next = completeUnitOfWork(unitOfWork); 48242 } 48243 48244 ReactCurrentOwner$2.current = null; 48245 return next; 48246} 48247 48248function completeUnitOfWork(unitOfWork) { 48249 // Attempt to complete the current unit of work, then move to the next 48250 // sibling. If there are no more siblings, return to the parent fiber. 48251 workInProgress = unitOfWork; 48252 48253 do { 48254 // The current, flushed, state of this fiber is the alternate. Ideally 48255 // nothing should rely on this, but relying on it here means that we don't 48256 // need an additional field on the work in progress. 48257 var current = workInProgress.alternate; 48258 var returnFiber = workInProgress.return; // Check if the work completed or if something threw. 48259 48260 if ((workInProgress.effectTag & Incomplete) === NoEffect) { 48261 setCurrentFiber(workInProgress); 48262 var next = void 0; 48263 48264 if ( (workInProgress.mode & ProfileMode) === NoMode) { 48265 next = completeWork(current, workInProgress, renderExpirationTime$1); 48266 } else { 48267 startProfilerTimer(workInProgress); 48268 next = completeWork(current, workInProgress, renderExpirationTime$1); // Update render duration assuming we didn't error. 48269 48270 stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false); 48271 } 48272 48273 stopWorkTimer(workInProgress); 48274 resetCurrentFiber(); 48275 resetChildExpirationTime(workInProgress); 48276 48277 if (next !== null) { 48278 // Completing this fiber spawned new work. Work on that next. 48279 return next; 48280 } 48281 48282 if (returnFiber !== null && // Do not append effects to parents if a sibling failed to complete 48283 (returnFiber.effectTag & Incomplete) === NoEffect) { 48284 // Append all the effects of the subtree and this fiber onto the effect 48285 // list of the parent. The completion order of the children affects the 48286 // side-effect order. 48287 if (returnFiber.firstEffect === null) { 48288 returnFiber.firstEffect = workInProgress.firstEffect; 48289 } 48290 48291 if (workInProgress.lastEffect !== null) { 48292 if (returnFiber.lastEffect !== null) { 48293 returnFiber.lastEffect.nextEffect = workInProgress.firstEffect; 48294 } 48295 48296 returnFiber.lastEffect = workInProgress.lastEffect; 48297 } // If this fiber had side-effects, we append it AFTER the children's 48298 // side-effects. We can perform certain side-effects earlier if needed, 48299 // by doing multiple passes over the effect list. We don't want to 48300 // schedule our own side-effect on our own list because if end up 48301 // reusing children we'll schedule this effect onto itself since we're 48302 // at the end. 48303 48304 48305 var effectTag = workInProgress.effectTag; // Skip both NoWork and PerformedWork tags when creating the effect 48306 // list. PerformedWork effect is read by React DevTools but shouldn't be 48307 // committed. 48308 48309 if (effectTag > PerformedWork) { 48310 if (returnFiber.lastEffect !== null) { 48311 returnFiber.lastEffect.nextEffect = workInProgress; 48312 } else { 48313 returnFiber.firstEffect = workInProgress; 48314 } 48315 48316 returnFiber.lastEffect = workInProgress; 48317 } 48318 } 48319 } else { 48320 // This fiber did not complete because something threw. Pop values off 48321 // the stack without entering the complete phase. If this is a boundary, 48322 // capture values if possible. 48323 var _next = unwindWork(workInProgress); // Because this fiber did not complete, don't reset its expiration time. 48324 48325 48326 if ( (workInProgress.mode & ProfileMode) !== NoMode) { 48327 // Record the render duration for the fiber that errored. 48328 stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false); // Include the time spent working on failed children before continuing. 48329 48330 var actualDuration = workInProgress.actualDuration; 48331 var child = workInProgress.child; 48332 48333 while (child !== null) { 48334 actualDuration += child.actualDuration; 48335 child = child.sibling; 48336 } 48337 48338 workInProgress.actualDuration = actualDuration; 48339 } 48340 48341 if (_next !== null) { 48342 // If completing this work spawned new work, do that next. We'll come 48343 // back here again. 48344 // Since we're restarting, remove anything that is not a host effect 48345 // from the effect tag. 48346 // TODO: The name stopFailedWorkTimer is misleading because Suspense 48347 // also captures and restarts. 48348 stopFailedWorkTimer(workInProgress); 48349 _next.effectTag &= HostEffectMask; 48350 return _next; 48351 } 48352 48353 stopWorkTimer(workInProgress); 48354 48355 if (returnFiber !== null) { 48356 // Mark the parent fiber as incomplete and clear its effect list. 48357 returnFiber.firstEffect = returnFiber.lastEffect = null; 48358 returnFiber.effectTag |= Incomplete; 48359 } 48360 } 48361 48362 var siblingFiber = workInProgress.sibling; 48363 48364 if (siblingFiber !== null) { 48365 // If there is more work to do in this returnFiber, do that next. 48366 return siblingFiber; 48367 } // Otherwise, return to the parent 48368 48369 48370 workInProgress = returnFiber; 48371 } while (workInProgress !== null); // We've reached the root. 48372 48373 48374 if (workInProgressRootExitStatus === RootIncomplete) { 48375 workInProgressRootExitStatus = RootCompleted; 48376 } 48377 48378 return null; 48379} 48380 48381function getRemainingExpirationTime(fiber) { 48382 var updateExpirationTime = fiber.expirationTime; 48383 var childExpirationTime = fiber.childExpirationTime; 48384 return updateExpirationTime > childExpirationTime ? updateExpirationTime : childExpirationTime; 48385} 48386 48387function resetChildExpirationTime(completedWork) { 48388 if (renderExpirationTime$1 !== Never && completedWork.childExpirationTime === Never) { 48389 // The children of this component are hidden. Don't bubble their 48390 // expiration times. 48391 return; 48392 } 48393 48394 var newChildExpirationTime = NoWork; // Bubble up the earliest expiration time. 48395 48396 if ( (completedWork.mode & ProfileMode) !== NoMode) { 48397 // In profiling mode, resetChildExpirationTime is also used to reset 48398 // profiler durations. 48399 var actualDuration = completedWork.actualDuration; 48400 var treeBaseDuration = completedWork.selfBaseDuration; // When a fiber is cloned, its actualDuration is reset to 0. This value will 48401 // only be updated if work is done on the fiber (i.e. it doesn't bailout). 48402 // When work is done, it should bubble to the parent's actualDuration. If 48403 // the fiber has not been cloned though, (meaning no work was done), then 48404 // this value will reflect the amount of time spent working on a previous 48405 // render. In that case it should not bubble. We determine whether it was 48406 // cloned by comparing the child pointer. 48407 48408 var shouldBubbleActualDurations = completedWork.alternate === null || completedWork.child !== completedWork.alternate.child; 48409 var child = completedWork.child; 48410 48411 while (child !== null) { 48412 var childUpdateExpirationTime = child.expirationTime; 48413 var childChildExpirationTime = child.childExpirationTime; 48414 48415 if (childUpdateExpirationTime > newChildExpirationTime) { 48416 newChildExpirationTime = childUpdateExpirationTime; 48417 } 48418 48419 if (childChildExpirationTime > newChildExpirationTime) { 48420 newChildExpirationTime = childChildExpirationTime; 48421 } 48422 48423 if (shouldBubbleActualDurations) { 48424 actualDuration += child.actualDuration; 48425 } 48426 48427 treeBaseDuration += child.treeBaseDuration; 48428 child = child.sibling; 48429 } 48430 48431 completedWork.actualDuration = actualDuration; 48432 completedWork.treeBaseDuration = treeBaseDuration; 48433 } else { 48434 var _child = completedWork.child; 48435 48436 while (_child !== null) { 48437 var _childUpdateExpirationTime = _child.expirationTime; 48438 var _childChildExpirationTime = _child.childExpirationTime; 48439 48440 if (_childUpdateExpirationTime > newChildExpirationTime) { 48441 newChildExpirationTime = _childUpdateExpirationTime; 48442 } 48443 48444 if (_childChildExpirationTime > newChildExpirationTime) { 48445 newChildExpirationTime = _childChildExpirationTime; 48446 } 48447 48448 _child = _child.sibling; 48449 } 48450 } 48451 48452 completedWork.childExpirationTime = newChildExpirationTime; 48453} 48454 48455function commitRoot(root) { 48456 var renderPriorityLevel = getCurrentPriorityLevel(); 48457 runWithPriority$1(ImmediatePriority, commitRootImpl.bind(null, root, renderPriorityLevel)); 48458 return null; 48459} 48460 48461function commitRootImpl(root, renderPriorityLevel) { 48462 do { 48463 // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which 48464 // means `flushPassiveEffects` will sometimes result in additional 48465 // passive effects. So we need to keep flushing in a loop until there are 48466 // no more pending effects. 48467 // TODO: Might be better if `flushPassiveEffects` did not automatically 48468 // flush synchronous work at the end, to avoid factoring hazards like this. 48469 flushPassiveEffects(); 48470 } while (rootWithPendingPassiveEffects !== null); 48471 48472 flushRenderPhaseStrictModeWarningsInDEV(); 48473 48474 if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { 48475 { 48476 throw Error( "Should not already be working." ); 48477 } 48478 } 48479 48480 var finishedWork = root.finishedWork; 48481 var expirationTime = root.finishedExpirationTime; 48482 48483 if (finishedWork === null) { 48484 return null; 48485 } 48486 48487 root.finishedWork = null; 48488 root.finishedExpirationTime = NoWork; 48489 48490 if (!(finishedWork !== root.current)) { 48491 { 48492 throw Error( "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." ); 48493 } 48494 } // commitRoot never returns a continuation; it always finishes synchronously. 48495 // So we can clear these now to allow a new callback to be scheduled. 48496 48497 48498 root.callbackNode = null; 48499 root.callbackExpirationTime = NoWork; 48500 root.callbackPriority = NoPriority; 48501 root.nextKnownPendingLevel = NoWork; 48502 startCommitTimer(); // Update the first and last pending times on this root. The new first 48503 // pending time is whatever is left on the root fiber. 48504 48505 var remainingExpirationTimeBeforeCommit = getRemainingExpirationTime(finishedWork); 48506 markRootFinishedAtTime(root, expirationTime, remainingExpirationTimeBeforeCommit); 48507 48508 if (root === workInProgressRoot) { 48509 // We can reset these now that they are finished. 48510 workInProgressRoot = null; 48511 workInProgress = null; 48512 renderExpirationTime$1 = NoWork; 48513 } // This indicates that the last root we worked on is not the same one that 48514 // we're committing now. This most commonly happens when a suspended root 48515 // times out. 48516 // Get the list of effects. 48517 48518 48519 var firstEffect; 48520 48521 if (finishedWork.effectTag > PerformedWork) { 48522 // A fiber's effect list consists only of its children, not itself. So if 48523 // the root has an effect, we need to add it to the end of the list. The 48524 // resulting list is the set that would belong to the root's parent, if it 48525 // had one; that is, all the effects in the tree including the root. 48526 if (finishedWork.lastEffect !== null) { 48527 finishedWork.lastEffect.nextEffect = finishedWork; 48528 firstEffect = finishedWork.firstEffect; 48529 } else { 48530 firstEffect = finishedWork; 48531 } 48532 } else { 48533 // There is no effect on the root. 48534 firstEffect = finishedWork.firstEffect; 48535 } 48536 48537 if (firstEffect !== null) { 48538 var prevExecutionContext = executionContext; 48539 executionContext |= CommitContext; 48540 var prevInteractions = pushInteractions(root); // Reset this to null before calling lifecycles 48541 48542 ReactCurrentOwner$2.current = null; // The commit phase is broken into several sub-phases. We do a separate pass 48543 // of the effect list for each phase: all mutation effects come before all 48544 // layout effects, and so on. 48545 // The first phase a "before mutation" phase. We use this phase to read the 48546 // state of the host tree right before we mutate it. This is where 48547 // getSnapshotBeforeUpdate is called. 48548 48549 startCommitSnapshotEffectsTimer(); 48550 prepareForCommit(root.containerInfo); 48551 nextEffect = firstEffect; 48552 48553 do { 48554 { 48555 invokeGuardedCallback(null, commitBeforeMutationEffects, null); 48556 48557 if (hasCaughtError()) { 48558 if (!(nextEffect !== null)) { 48559 { 48560 throw Error( "Should be working on an effect." ); 48561 } 48562 } 48563 48564 var error = clearCaughtError(); 48565 captureCommitPhaseError(nextEffect, error); 48566 nextEffect = nextEffect.nextEffect; 48567 } 48568 } 48569 } while (nextEffect !== null); 48570 48571 stopCommitSnapshotEffectsTimer(); 48572 48573 { 48574 // Mark the current commit time to be shared by all Profilers in this 48575 // batch. This enables them to be grouped later. 48576 recordCommitTime(); 48577 } // The next phase is the mutation phase, where we mutate the host tree. 48578 48579 48580 startCommitHostEffectsTimer(); 48581 nextEffect = firstEffect; 48582 48583 do { 48584 { 48585 invokeGuardedCallback(null, commitMutationEffects, null, root, renderPriorityLevel); 48586 48587 if (hasCaughtError()) { 48588 if (!(nextEffect !== null)) { 48589 { 48590 throw Error( "Should be working on an effect." ); 48591 } 48592 } 48593 48594 var _error = clearCaughtError(); 48595 48596 captureCommitPhaseError(nextEffect, _error); 48597 nextEffect = nextEffect.nextEffect; 48598 } 48599 } 48600 } while (nextEffect !== null); 48601 48602 stopCommitHostEffectsTimer(); 48603 resetAfterCommit(root.containerInfo); // The work-in-progress tree is now the current tree. This must come after 48604 // the mutation phase, so that the previous tree is still current during 48605 // componentWillUnmount, but before the layout phase, so that the finished 48606 // work is current during componentDidMount/Update. 48607 48608 root.current = finishedWork; // The next phase is the layout phase, where we call effects that read 48609 // the host tree after it's been mutated. The idiomatic use case for this is 48610 // layout, but class component lifecycles also fire here for legacy reasons. 48611 48612 startCommitLifeCyclesTimer(); 48613 nextEffect = firstEffect; 48614 48615 do { 48616 { 48617 invokeGuardedCallback(null, commitLayoutEffects, null, root, expirationTime); 48618 48619 if (hasCaughtError()) { 48620 if (!(nextEffect !== null)) { 48621 { 48622 throw Error( "Should be working on an effect." ); 48623 } 48624 } 48625 48626 var _error2 = clearCaughtError(); 48627 48628 captureCommitPhaseError(nextEffect, _error2); 48629 nextEffect = nextEffect.nextEffect; 48630 } 48631 } 48632 } while (nextEffect !== null); 48633 48634 stopCommitLifeCyclesTimer(); 48635 nextEffect = null; // Tell Scheduler to yield at the end of the frame, so the browser has an 48636 // opportunity to paint. 48637 48638 requestPaint(); 48639 48640 { 48641 popInteractions(prevInteractions); 48642 } 48643 48644 executionContext = prevExecutionContext; 48645 } else { 48646 // No effects. 48647 root.current = finishedWork; // Measure these anyway so the flamegraph explicitly shows that there were 48648 // no effects. 48649 // TODO: Maybe there's a better way to report this. 48650 48651 startCommitSnapshotEffectsTimer(); 48652 stopCommitSnapshotEffectsTimer(); 48653 48654 { 48655 recordCommitTime(); 48656 } 48657 48658 startCommitHostEffectsTimer(); 48659 stopCommitHostEffectsTimer(); 48660 startCommitLifeCyclesTimer(); 48661 stopCommitLifeCyclesTimer(); 48662 } 48663 48664 stopCommitTimer(); 48665 var rootDidHavePassiveEffects = rootDoesHavePassiveEffects; 48666 48667 if (rootDoesHavePassiveEffects) { 48668 // This commit has passive effects. Stash a reference to them. But don't 48669 // schedule a callback until after flushing layout work. 48670 rootDoesHavePassiveEffects = false; 48671 rootWithPendingPassiveEffects = root; 48672 pendingPassiveEffectsExpirationTime = expirationTime; 48673 pendingPassiveEffectsRenderPriority = renderPriorityLevel; 48674 } else { 48675 // We are done with the effect chain at this point so let's clear the 48676 // nextEffect pointers to assist with GC. If we have passive effects, we'll 48677 // clear this in flushPassiveEffects. 48678 nextEffect = firstEffect; 48679 48680 while (nextEffect !== null) { 48681 var nextNextEffect = nextEffect.nextEffect; 48682 nextEffect.nextEffect = null; 48683 nextEffect = nextNextEffect; 48684 } 48685 } // Check if there's remaining work on this root 48686 48687 48688 var remainingExpirationTime = root.firstPendingTime; 48689 48690 if (remainingExpirationTime !== NoWork) { 48691 { 48692 if (spawnedWorkDuringRender !== null) { 48693 var expirationTimes = spawnedWorkDuringRender; 48694 spawnedWorkDuringRender = null; 48695 48696 for (var i = 0; i < expirationTimes.length; i++) { 48697 scheduleInteractions(root, expirationTimes[i], root.memoizedInteractions); 48698 } 48699 } 48700 48701 schedulePendingInteractions(root, remainingExpirationTime); 48702 } 48703 } else { 48704 // If there's no remaining work, we can clear the set of already failed 48705 // error boundaries. 48706 legacyErrorBoundariesThatAlreadyFailed = null; 48707 } 48708 48709 { 48710 if (!rootDidHavePassiveEffects) { 48711 // If there are no passive effects, then we can complete the pending interactions. 48712 // Otherwise, we'll wait until after the passive effects are flushed. 48713 // Wait to do this until after remaining work has been scheduled, 48714 // so that we don't prematurely signal complete for interactions when there's e.g. hidden work. 48715 finishPendingInteractions(root, expirationTime); 48716 } 48717 } 48718 48719 if (remainingExpirationTime === Sync) { 48720 // Count the number of times the root synchronously re-renders without 48721 // finishing. If there are too many, it indicates an infinite update loop. 48722 if (root === rootWithNestedUpdates) { 48723 nestedUpdateCount++; 48724 } else { 48725 nestedUpdateCount = 0; 48726 rootWithNestedUpdates = root; 48727 } 48728 } else { 48729 nestedUpdateCount = 0; 48730 } 48731 48732 onCommitRoot(finishedWork.stateNode, expirationTime); // Always call this before exiting `commitRoot`, to ensure that any 48733 // additional work on this root is scheduled. 48734 48735 ensureRootIsScheduled(root); 48736 48737 if (hasUncaughtError) { 48738 hasUncaughtError = false; 48739 var _error3 = firstUncaughtError; 48740 firstUncaughtError = null; 48741 throw _error3; 48742 } 48743 48744 if ((executionContext & LegacyUnbatchedContext) !== NoContext) { 48745 // This is a legacy edge case. We just committed the initial mount of 48746 // a ReactDOM.render-ed root inside of batchedUpdates. The commit fired 48747 // synchronously, but layout updates should be deferred until the end 48748 // of the batch. 48749 return null; 48750 } // If layout work was scheduled, flush it now. 48751 48752 48753 flushSyncCallbackQueue(); 48754 return null; 48755} 48756 48757function commitBeforeMutationEffects() { 48758 while (nextEffect !== null) { 48759 var effectTag = nextEffect.effectTag; 48760 48761 if ((effectTag & Snapshot) !== NoEffect) { 48762 setCurrentFiber(nextEffect); 48763 recordEffect(); 48764 var current = nextEffect.alternate; 48765 commitBeforeMutationLifeCycles(current, nextEffect); 48766 resetCurrentFiber(); 48767 } 48768 48769 if ((effectTag & Passive) !== NoEffect) { 48770 // If there are passive effects, schedule a callback to flush at 48771 // the earliest opportunity. 48772 if (!rootDoesHavePassiveEffects) { 48773 rootDoesHavePassiveEffects = true; 48774 scheduleCallback(NormalPriority, function () { 48775 flushPassiveEffects(); 48776 return null; 48777 }); 48778 } 48779 } 48780 48781 nextEffect = nextEffect.nextEffect; 48782 } 48783} 48784 48785function commitMutationEffects(root, renderPriorityLevel) { 48786 // TODO: Should probably move the bulk of this function to commitWork. 48787 while (nextEffect !== null) { 48788 setCurrentFiber(nextEffect); 48789 var effectTag = nextEffect.effectTag; 48790 48791 if (effectTag & ContentReset) { 48792 commitResetTextContent(nextEffect); 48793 } 48794 48795 if (effectTag & Ref) { 48796 var current = nextEffect.alternate; 48797 48798 if (current !== null) { 48799 commitDetachRef(current); 48800 } 48801 } // The following switch statement is only concerned about placement, 48802 // updates, and deletions. To avoid needing to add a case for every possible 48803 // bitmap value, we remove the secondary effects from the effect tag and 48804 // switch on that value. 48805 48806 48807 var primaryEffectTag = effectTag & (Placement | Update | Deletion | Hydrating); 48808 48809 switch (primaryEffectTag) { 48810 case Placement: 48811 { 48812 commitPlacement(nextEffect); // Clear the "placement" from effect tag so that we know that this is 48813 // inserted, before any life-cycles like componentDidMount gets called. 48814 // TODO: findDOMNode doesn't rely on this any more but isMounted does 48815 // and isMounted is deprecated anyway so we should be able to kill this. 48816 48817 nextEffect.effectTag &= ~Placement; 48818 break; 48819 } 48820 48821 case PlacementAndUpdate: 48822 { 48823 // Placement 48824 commitPlacement(nextEffect); // Clear the "placement" from effect tag so that we know that this is 48825 // inserted, before any life-cycles like componentDidMount gets called. 48826 48827 nextEffect.effectTag &= ~Placement; // Update 48828 48829 var _current = nextEffect.alternate; 48830 commitWork(_current, nextEffect); 48831 break; 48832 } 48833 48834 case Hydrating: 48835 { 48836 nextEffect.effectTag &= ~Hydrating; 48837 break; 48838 } 48839 48840 case HydratingAndUpdate: 48841 { 48842 nextEffect.effectTag &= ~Hydrating; // Update 48843 48844 var _current2 = nextEffect.alternate; 48845 commitWork(_current2, nextEffect); 48846 break; 48847 } 48848 48849 case Update: 48850 { 48851 var _current3 = nextEffect.alternate; 48852 commitWork(_current3, nextEffect); 48853 break; 48854 } 48855 48856 case Deletion: 48857 { 48858 commitDeletion(root, nextEffect, renderPriorityLevel); 48859 break; 48860 } 48861 } // TODO: Only record a mutation effect if primaryEffectTag is non-zero. 48862 48863 48864 recordEffect(); 48865 resetCurrentFiber(); 48866 nextEffect = nextEffect.nextEffect; 48867 } 48868} 48869 48870function commitLayoutEffects(root, committedExpirationTime) { 48871 // TODO: Should probably move the bulk of this function to commitWork. 48872 while (nextEffect !== null) { 48873 setCurrentFiber(nextEffect); 48874 var effectTag = nextEffect.effectTag; 48875 48876 if (effectTag & (Update | Callback)) { 48877 recordEffect(); 48878 var current = nextEffect.alternate; 48879 commitLifeCycles(root, current, nextEffect); 48880 } 48881 48882 if (effectTag & Ref) { 48883 recordEffect(); 48884 commitAttachRef(nextEffect); 48885 } 48886 48887 resetCurrentFiber(); 48888 nextEffect = nextEffect.nextEffect; 48889 } 48890} 48891 48892function flushPassiveEffects() { 48893 if (pendingPassiveEffectsRenderPriority !== NoPriority) { 48894 var priorityLevel = pendingPassiveEffectsRenderPriority > NormalPriority ? NormalPriority : pendingPassiveEffectsRenderPriority; 48895 pendingPassiveEffectsRenderPriority = NoPriority; 48896 return runWithPriority$1(priorityLevel, flushPassiveEffectsImpl); 48897 } 48898} 48899 48900function flushPassiveEffectsImpl() { 48901 if (rootWithPendingPassiveEffects === null) { 48902 return false; 48903 } 48904 48905 var root = rootWithPendingPassiveEffects; 48906 var expirationTime = pendingPassiveEffectsExpirationTime; 48907 rootWithPendingPassiveEffects = null; 48908 pendingPassiveEffectsExpirationTime = NoWork; 48909 48910 if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { 48911 { 48912 throw Error( "Cannot flush passive effects while already rendering." ); 48913 } 48914 } 48915 48916 var prevExecutionContext = executionContext; 48917 executionContext |= CommitContext; 48918 var prevInteractions = pushInteractions(root); 48919 48920 { 48921 // Note: This currently assumes there are no passive effects on the root fiber 48922 // because the root is not part of its own effect list. 48923 // This could change in the future. 48924 var _effect2 = root.current.firstEffect; 48925 48926 while (_effect2 !== null) { 48927 { 48928 setCurrentFiber(_effect2); 48929 invokeGuardedCallback(null, commitPassiveHookEffects, null, _effect2); 48930 48931 if (hasCaughtError()) { 48932 if (!(_effect2 !== null)) { 48933 { 48934 throw Error( "Should be working on an effect." ); 48935 } 48936 } 48937 48938 var _error5 = clearCaughtError(); 48939 48940 captureCommitPhaseError(_effect2, _error5); 48941 } 48942 48943 resetCurrentFiber(); 48944 } 48945 48946 var nextNextEffect = _effect2.nextEffect; // Remove nextEffect pointer to assist GC 48947 48948 _effect2.nextEffect = null; 48949 _effect2 = nextNextEffect; 48950 } 48951 } 48952 48953 { 48954 popInteractions(prevInteractions); 48955 finishPendingInteractions(root, expirationTime); 48956 } 48957 48958 executionContext = prevExecutionContext; 48959 flushSyncCallbackQueue(); // If additional passive effects were scheduled, increment a counter. If this 48960 // exceeds the limit, we'll fire a warning. 48961 48962 nestedPassiveUpdateCount = rootWithPendingPassiveEffects === null ? 0 : nestedPassiveUpdateCount + 1; 48963 return true; 48964} 48965 48966function isAlreadyFailedLegacyErrorBoundary(instance) { 48967 return legacyErrorBoundariesThatAlreadyFailed !== null && legacyErrorBoundariesThatAlreadyFailed.has(instance); 48968} 48969function markLegacyErrorBoundaryAsFailed(instance) { 48970 if (legacyErrorBoundariesThatAlreadyFailed === null) { 48971 legacyErrorBoundariesThatAlreadyFailed = new Set([instance]); 48972 } else { 48973 legacyErrorBoundariesThatAlreadyFailed.add(instance); 48974 } 48975} 48976 48977function prepareToThrowUncaughtError(error) { 48978 if (!hasUncaughtError) { 48979 hasUncaughtError = true; 48980 firstUncaughtError = error; 48981 } 48982} 48983 48984var onUncaughtError = prepareToThrowUncaughtError; 48985 48986function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { 48987 var errorInfo = createCapturedValue(error, sourceFiber); 48988 var update = createRootErrorUpdate(rootFiber, errorInfo, Sync); 48989 enqueueUpdate(rootFiber, update); 48990 var root = markUpdateTimeFromFiberToRoot(rootFiber, Sync); 48991 48992 if (root !== null) { 48993 ensureRootIsScheduled(root); 48994 schedulePendingInteractions(root, Sync); 48995 } 48996} 48997 48998function captureCommitPhaseError(sourceFiber, error) { 48999 if (sourceFiber.tag === HostRoot) { 49000 // Error was thrown at the root. There is no parent, so the root 49001 // itself should capture it. 49002 captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); 49003 return; 49004 } 49005 49006 var fiber = sourceFiber.return; 49007 49008 while (fiber !== null) { 49009 if (fiber.tag === HostRoot) { 49010 captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error); 49011 return; 49012 } else if (fiber.tag === ClassComponent) { 49013 var ctor = fiber.type; 49014 var instance = fiber.stateNode; 49015 49016 if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) { 49017 var errorInfo = createCapturedValue(error, sourceFiber); 49018 var update = createClassErrorUpdate(fiber, errorInfo, // TODO: This is always sync 49019 Sync); 49020 enqueueUpdate(fiber, update); 49021 var root = markUpdateTimeFromFiberToRoot(fiber, Sync); 49022 49023 if (root !== null) { 49024 ensureRootIsScheduled(root); 49025 schedulePendingInteractions(root, Sync); 49026 } 49027 49028 return; 49029 } 49030 } 49031 49032 fiber = fiber.return; 49033 } 49034} 49035function pingSuspendedRoot(root, thenable, suspendedTime) { 49036 var pingCache = root.pingCache; 49037 49038 if (pingCache !== null) { 49039 // The thenable resolved, so we no longer need to memoize, because it will 49040 // never be thrown again. 49041 pingCache.delete(thenable); 49042 } 49043 49044 if (workInProgressRoot === root && renderExpirationTime$1 === suspendedTime) { 49045 // Received a ping at the same priority level at which we're currently 49046 // rendering. We might want to restart this render. This should mirror 49047 // the logic of whether or not a root suspends once it completes. 49048 // TODO: If we're rendering sync either due to Sync, Batched or expired, 49049 // we should probably never restart. 49050 // If we're suspended with delay, we'll always suspend so we can always 49051 // restart. If we're suspended without any updates, it might be a retry. 49052 // If it's early in the retry we can restart. We can't know for sure 49053 // whether we'll eventually process an update during this render pass, 49054 // but it's somewhat unlikely that we get to a ping before that, since 49055 // getting to the root most update is usually very fast. 49056 if (workInProgressRootExitStatus === RootSuspendedWithDelay || workInProgressRootExitStatus === RootSuspended && workInProgressRootLatestProcessedExpirationTime === Sync && now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) { 49057 // Restart from the root. Don't need to schedule a ping because 49058 // we're already working on this tree. 49059 prepareFreshStack(root, renderExpirationTime$1); 49060 } else { 49061 // Even though we can't restart right now, we might get an 49062 // opportunity later. So we mark this render as having a ping. 49063 workInProgressRootHasPendingPing = true; 49064 } 49065 49066 return; 49067 } 49068 49069 if (!isRootSuspendedAtTime(root, suspendedTime)) { 49070 // The root is no longer suspended at this time. 49071 return; 49072 } 49073 49074 var lastPingedTime = root.lastPingedTime; 49075 49076 if (lastPingedTime !== NoWork && lastPingedTime < suspendedTime) { 49077 // There's already a lower priority ping scheduled. 49078 return; 49079 } // Mark the time at which this ping was scheduled. 49080 49081 49082 root.lastPingedTime = suspendedTime; 49083 49084 ensureRootIsScheduled(root); 49085 schedulePendingInteractions(root, suspendedTime); 49086} 49087 49088function retryTimedOutBoundary(boundaryFiber, retryTime) { 49089 // The boundary fiber (a Suspense component or SuspenseList component) 49090 // previously was rendered in its fallback state. One of the promises that 49091 // suspended it has resolved, which means at least part of the tree was 49092 // likely unblocked. Try rendering again, at a new expiration time. 49093 if (retryTime === NoWork) { 49094 var suspenseConfig = null; // Retries don't carry over the already committed update. 49095 49096 var currentTime = requestCurrentTimeForUpdate(); 49097 retryTime = computeExpirationForFiber(currentTime, boundaryFiber, suspenseConfig); 49098 } // TODO: Special case idle priority? 49099 49100 49101 var root = markUpdateTimeFromFiberToRoot(boundaryFiber, retryTime); 49102 49103 if (root !== null) { 49104 ensureRootIsScheduled(root); 49105 schedulePendingInteractions(root, retryTime); 49106 } 49107} 49108function resolveRetryThenable(boundaryFiber, thenable) { 49109 var retryTime = NoWork; // Default 49110 49111 var retryCache; 49112 49113 { 49114 retryCache = boundaryFiber.stateNode; 49115 } 49116 49117 if (retryCache !== null) { 49118 // The thenable resolved, so we no longer need to memoize, because it will 49119 // never be thrown again. 49120 retryCache.delete(thenable); 49121 } 49122 49123 retryTimedOutBoundary(boundaryFiber, retryTime); 49124} // Computes the next Just Noticeable Difference (JND) boundary. 49125// The theory is that a person can't tell the difference between small differences in time. 49126// Therefore, if we wait a bit longer than necessary that won't translate to a noticeable 49127// difference in the experience. However, waiting for longer might mean that we can avoid 49128// showing an intermediate loading state. The longer we have already waited, the harder it 49129// is to tell small differences in time. Therefore, the longer we've already waited, 49130// the longer we can wait additionally. At some point we have to give up though. 49131// We pick a train model where the next boundary commits at a consistent schedule. 49132// These particular numbers are vague estimates. We expect to adjust them based on research. 49133 49134function jnd(timeElapsed) { 49135 return timeElapsed < 120 ? 120 : timeElapsed < 480 ? 480 : timeElapsed < 1080 ? 1080 : timeElapsed < 1920 ? 1920 : timeElapsed < 3000 ? 3000 : timeElapsed < 4320 ? 4320 : ceil(timeElapsed / 1960) * 1960; 49136} 49137 49138function computeMsUntilSuspenseLoadingDelay(mostRecentEventTime, committedExpirationTime, suspenseConfig) { 49139 var busyMinDurationMs = suspenseConfig.busyMinDurationMs | 0; 49140 49141 if (busyMinDurationMs <= 0) { 49142 return 0; 49143 } 49144 49145 var busyDelayMs = suspenseConfig.busyDelayMs | 0; // Compute the time until this render pass would expire. 49146 49147 var currentTimeMs = now(); 49148 var eventTimeMs = inferTimeFromExpirationTimeWithSuspenseConfig(mostRecentEventTime, suspenseConfig); 49149 var timeElapsed = currentTimeMs - eventTimeMs; 49150 49151 if (timeElapsed <= busyDelayMs) { 49152 // If we haven't yet waited longer than the initial delay, we don't 49153 // have to wait any additional time. 49154 return 0; 49155 } 49156 49157 var msUntilTimeout = busyDelayMs + busyMinDurationMs - timeElapsed; // This is the value that is passed to `setTimeout`. 49158 49159 return msUntilTimeout; 49160} 49161 49162function checkForNestedUpdates() { 49163 if (nestedUpdateCount > NESTED_UPDATE_LIMIT) { 49164 nestedUpdateCount = 0; 49165 rootWithNestedUpdates = null; 49166 49167 { 49168 { 49169 throw Error( "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." ); 49170 } 49171 } 49172 } 49173 49174 { 49175 if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) { 49176 nestedPassiveUpdateCount = 0; 49177 49178 error('Maximum update depth exceeded. This can happen when a component ' + "calls setState inside useEffect, but useEffect either doesn't " + 'have a dependency array, or one of the dependencies changes on ' + 'every render.'); 49179 } 49180 } 49181} 49182 49183function flushRenderPhaseStrictModeWarningsInDEV() { 49184 { 49185 ReactStrictModeWarnings.flushLegacyContextWarning(); 49186 49187 { 49188 ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); 49189 } 49190 } 49191} 49192 49193function stopFinishedWorkLoopTimer() { 49194 var didCompleteRoot = true; 49195 stopWorkLoopTimer(interruptedBy, didCompleteRoot); 49196 interruptedBy = null; 49197} 49198 49199function stopInterruptedWorkLoopTimer() { 49200 // TODO: Track which fiber caused the interruption. 49201 var didCompleteRoot = false; 49202 stopWorkLoopTimer(interruptedBy, didCompleteRoot); 49203 interruptedBy = null; 49204} 49205 49206function checkForInterruption(fiberThatReceivedUpdate, updateExpirationTime) { 49207 if ( workInProgressRoot !== null && updateExpirationTime > renderExpirationTime$1) { 49208 interruptedBy = fiberThatReceivedUpdate; 49209 } 49210} 49211 49212var didWarnStateUpdateForUnmountedComponent = null; 49213 49214function warnAboutUpdateOnUnmountedFiberInDEV(fiber) { 49215 { 49216 var tag = fiber.tag; 49217 49218 if (tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent && tag !== Block) { 49219 // Only warn for user-defined components, not internal ones like Suspense. 49220 return; 49221 } 49222 // the problematic code almost always lies inside that component. 49223 49224 49225 var componentName = getComponentName(fiber.type) || 'ReactComponent'; 49226 49227 if (didWarnStateUpdateForUnmountedComponent !== null) { 49228 if (didWarnStateUpdateForUnmountedComponent.has(componentName)) { 49229 return; 49230 } 49231 49232 didWarnStateUpdateForUnmountedComponent.add(componentName); 49233 } else { 49234 didWarnStateUpdateForUnmountedComponent = new Set([componentName]); 49235 } 49236 49237 error("Can't perform a React state update on an unmounted component. This " + 'is a no-op, but it indicates a memory leak in your application. To ' + 'fix, cancel all subscriptions and asynchronous tasks in %s.%s', tag === ClassComponent ? 'the componentWillUnmount method' : 'a useEffect cleanup function', getStackByFiberInDevAndProd(fiber)); 49238 } 49239} 49240 49241var beginWork$1; 49242 49243{ 49244 var dummyFiber = null; 49245 49246 beginWork$1 = function (current, unitOfWork, expirationTime) { 49247 // If a component throws an error, we replay it again in a synchronously 49248 // dispatched event, so that the debugger will treat it as an uncaught 49249 // error See ReactErrorUtils for more information. 49250 // Before entering the begin phase, copy the work-in-progress onto a dummy 49251 // fiber. If beginWork throws, we'll use this to reset the state. 49252 var originalWorkInProgressCopy = assignFiberPropertiesInDEV(dummyFiber, unitOfWork); 49253 49254 try { 49255 return beginWork(current, unitOfWork, expirationTime); 49256 } catch (originalError) { 49257 if (originalError !== null && typeof originalError === 'object' && typeof originalError.then === 'function') { 49258 // Don't replay promises. Treat everything else like an error. 49259 throw originalError; 49260 } // Keep this code in sync with handleError; any changes here must have 49261 // corresponding changes there. 49262 49263 49264 resetContextDependencies(); 49265 resetHooksAfterThrow(); // Don't reset current debug fiber, since we're about to work on the 49266 // same fiber again. 49267 // Unwind the failed stack frame 49268 49269 unwindInterruptedWork(unitOfWork); // Restore the original properties of the fiber. 49270 49271 assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy); 49272 49273 if ( unitOfWork.mode & ProfileMode) { 49274 // Reset the profiler timer. 49275 startProfilerTimer(unitOfWork); 49276 } // Run beginWork again. 49277 49278 49279 invokeGuardedCallback(null, beginWork, null, current, unitOfWork, expirationTime); 49280 49281 if (hasCaughtError()) { 49282 var replayError = clearCaughtError(); // `invokeGuardedCallback` sometimes sets an expando `_suppressLogging`. 49283 // Rethrow this error instead of the original one. 49284 49285 throw replayError; 49286 } else { 49287 // This branch is reachable if the render phase is impure. 49288 throw originalError; 49289 } 49290 } 49291 }; 49292} 49293 49294var didWarnAboutUpdateInRender = false; 49295var didWarnAboutUpdateInRenderForAnotherComponent; 49296 49297{ 49298 didWarnAboutUpdateInRenderForAnotherComponent = new Set(); 49299} 49300 49301function warnAboutRenderPhaseUpdatesInDEV(fiber) { 49302 { 49303 if (isRendering && (executionContext & RenderContext) !== NoContext) { 49304 switch (fiber.tag) { 49305 case FunctionComponent: 49306 case ForwardRef: 49307 case SimpleMemoComponent: 49308 { 49309 var renderingComponentName = workInProgress && getComponentName(workInProgress.type) || 'Unknown'; // Dedupe by the rendering component because it's the one that needs to be fixed. 49310 49311 var dedupeKey = renderingComponentName; 49312 49313 if (!didWarnAboutUpdateInRenderForAnotherComponent.has(dedupeKey)) { 49314 didWarnAboutUpdateInRenderForAnotherComponent.add(dedupeKey); 49315 var setStateComponentName = getComponentName(fiber.type) || 'Unknown'; 49316 49317 error('Cannot update a component (`%s`) while rendering a ' + 'different component (`%s`). To locate the bad setState() call inside `%s`, ' + 'follow the stack trace as described in https://fb.me/setstate-in-render', setStateComponentName, renderingComponentName, renderingComponentName); 49318 } 49319 49320 break; 49321 } 49322 49323 case ClassComponent: 49324 { 49325 if (!didWarnAboutUpdateInRender) { 49326 error('Cannot update during an existing state transition (such as ' + 'within `render`). Render methods should be a pure ' + 'function of props and state.'); 49327 49328 didWarnAboutUpdateInRender = true; 49329 } 49330 49331 break; 49332 } 49333 } 49334 } 49335 } 49336} // a 'shared' variable that changes when act() opens/closes in tests. 49337 49338 49339var IsThisRendererActing = { 49340 current: false 49341}; 49342function warnIfNotScopedWithMatchingAct(fiber) { 49343 { 49344 if ( IsSomeRendererActing.current === true && IsThisRendererActing.current !== true) { 49345 error("It looks like you're using the wrong act() around your test interactions.\n" + 'Be sure to use the matching version of act() corresponding to your renderer:\n\n' + '// for react-dom:\n' + "import {act} from 'react-dom/test-utils';\n" + '// ...\n' + 'act(() => ...);\n\n' + '// for react-test-renderer:\n' + "import TestRenderer from 'react-test-renderer';\n" + 'const {act} = TestRenderer;\n' + '// ...\n' + 'act(() => ...);' + '%s', getStackByFiberInDevAndProd(fiber)); 49346 } 49347 } 49348} 49349function warnIfNotCurrentlyActingEffectsInDEV(fiber) { 49350 { 49351 if ( (fiber.mode & StrictMode) !== NoMode && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) { 49352 error('An update to %s ran an effect, but was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://fb.me/react-wrap-tests-with-act' + '%s', getComponentName(fiber.type), getStackByFiberInDevAndProd(fiber)); 49353 } 49354 } 49355} 49356 49357function warnIfNotCurrentlyActingUpdatesInDEV(fiber) { 49358 { 49359 if ( executionContext === NoContext && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) { 49360 error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://fb.me/react-wrap-tests-with-act' + '%s', getComponentName(fiber.type), getStackByFiberInDevAndProd(fiber)); 49361 } 49362 } 49363} 49364 49365var warnIfNotCurrentlyActingUpdatesInDev = warnIfNotCurrentlyActingUpdatesInDEV; // In tests, we want to enforce a mocked scheduler. 49366 49367var didWarnAboutUnmockedScheduler = false; // TODO Before we release concurrent mode, revisit this and decide whether a mocked 49368// scheduler is the actual recommendation. The alternative could be a testing build, 49369// a new lib, or whatever; we dunno just yet. This message is for early adopters 49370// to get their tests right. 49371 49372function warnIfUnmockedScheduler(fiber) { 49373 { 49374 if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) { 49375 if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) { 49376 didWarnAboutUnmockedScheduler = true; 49377 49378 error('In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \n' + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + 'For more info, visit https://fb.me/react-mock-scheduler'); 49379 } 49380 } 49381 } 49382} 49383 49384function computeThreadID(root, expirationTime) { 49385 // Interaction threads are unique per root and expiration time. 49386 return expirationTime * 1000 + root.interactionThreadID; 49387} 49388 49389function markSpawnedWork(expirationTime) { 49390 49391 if (spawnedWorkDuringRender === null) { 49392 spawnedWorkDuringRender = [expirationTime]; 49393 } else { 49394 spawnedWorkDuringRender.push(expirationTime); 49395 } 49396} 49397 49398function scheduleInteractions(root, expirationTime, interactions) { 49399 49400 if (interactions.size > 0) { 49401 var pendingInteractionMap = root.pendingInteractionMap; 49402 var pendingInteractions = pendingInteractionMap.get(expirationTime); 49403 49404 if (pendingInteractions != null) { 49405 interactions.forEach(function (interaction) { 49406 if (!pendingInteractions.has(interaction)) { 49407 // Update the pending async work count for previously unscheduled interaction. 49408 interaction.__count++; 49409 } 49410 49411 pendingInteractions.add(interaction); 49412 }); 49413 } else { 49414 pendingInteractionMap.set(expirationTime, new Set(interactions)); // Update the pending async work count for the current interactions. 49415 49416 interactions.forEach(function (interaction) { 49417 interaction.__count++; 49418 }); 49419 } 49420 49421 var subscriber = tracing.__subscriberRef.current; 49422 49423 if (subscriber !== null) { 49424 var threadID = computeThreadID(root, expirationTime); 49425 subscriber.onWorkScheduled(interactions, threadID); 49426 } 49427 } 49428} 49429 49430function schedulePendingInteractions(root, expirationTime) { 49431 49432 scheduleInteractions(root, expirationTime, tracing.__interactionsRef.current); 49433} 49434 49435function startWorkOnPendingInteractions(root, expirationTime) { 49436 // we can accurately attribute time spent working on it, And so that cascading 49437 // work triggered during the render phase will be associated with it. 49438 49439 49440 var interactions = new Set(); 49441 root.pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) { 49442 if (scheduledExpirationTime >= expirationTime) { 49443 scheduledInteractions.forEach(function (interaction) { 49444 return interactions.add(interaction); 49445 }); 49446 } 49447 }); // Store the current set of interactions on the FiberRoot for a few reasons: 49448 // We can re-use it in hot functions like performConcurrentWorkOnRoot() 49449 // without having to recalculate it. We will also use it in commitWork() to 49450 // pass to any Profiler onRender() hooks. This also provides DevTools with a 49451 // way to access it when the onCommitRoot() hook is called. 49452 49453 root.memoizedInteractions = interactions; 49454 49455 if (interactions.size > 0) { 49456 var subscriber = tracing.__subscriberRef.current; 49457 49458 if (subscriber !== null) { 49459 var threadID = computeThreadID(root, expirationTime); 49460 49461 try { 49462 subscriber.onWorkStarted(interactions, threadID); 49463 } catch (error) { 49464 // If the subscriber throws, rethrow it in a separate task 49465 scheduleCallback(ImmediatePriority, function () { 49466 throw error; 49467 }); 49468 } 49469 } 49470 } 49471} 49472 49473function finishPendingInteractions(root, committedExpirationTime) { 49474 49475 var earliestRemainingTimeAfterCommit = root.firstPendingTime; 49476 var subscriber; 49477 49478 try { 49479 subscriber = tracing.__subscriberRef.current; 49480 49481 if (subscriber !== null && root.memoizedInteractions.size > 0) { 49482 var threadID = computeThreadID(root, committedExpirationTime); 49483 subscriber.onWorkStopped(root.memoizedInteractions, threadID); 49484 } 49485 } catch (error) { 49486 // If the subscriber throws, rethrow it in a separate task 49487 scheduleCallback(ImmediatePriority, function () { 49488 throw error; 49489 }); 49490 } finally { 49491 // Clear completed interactions from the pending Map. 49492 // Unless the render was suspended or cascading work was scheduled, 49493 // In which caseâ leave pending interactions until the subsequent render. 49494 var pendingInteractionMap = root.pendingInteractionMap; 49495 pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) { 49496 // Only decrement the pending interaction count if we're done. 49497 // If there's still work at the current priority, 49498 // That indicates that we are waiting for suspense data. 49499 if (scheduledExpirationTime > earliestRemainingTimeAfterCommit) { 49500 pendingInteractionMap.delete(scheduledExpirationTime); 49501 scheduledInteractions.forEach(function (interaction) { 49502 interaction.__count--; 49503 49504 if (subscriber !== null && interaction.__count === 0) { 49505 try { 49506 subscriber.onInteractionScheduledWorkCompleted(interaction); 49507 } catch (error) { 49508 // If the subscriber throws, rethrow it in a separate task 49509 scheduleCallback(ImmediatePriority, function () { 49510 throw error; 49511 }); 49512 } 49513 } 49514 }); 49515 } 49516 }); 49517 } 49518} 49519 49520var onScheduleFiberRoot = null; 49521var onCommitFiberRoot = null; 49522var onCommitFiberUnmount = null; 49523var hasLoggedError = false; 49524var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined'; 49525function injectInternals(internals) { 49526 if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { 49527 // No DevTools 49528 return false; 49529 } 49530 49531 var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; 49532 49533 if (hook.isDisabled) { 49534 // This isn't a real property on the hook, but it can be set to opt out 49535 // of DevTools integration and associated warnings and logs. 49536 // https://github.com/facebook/react/issues/3877 49537 return true; 49538 } 49539 49540 if (!hook.supportsFiber) { 49541 { 49542 error('The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://fb.me/react-devtools'); 49543 } // DevTools exists, even though it doesn't support Fiber. 49544 49545 49546 return true; 49547 } 49548 49549 try { 49550 var rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks. 49551 49552 if (true) { 49553 // Only used by Fast Refresh 49554 if (typeof hook.onScheduleFiberRoot === 'function') { 49555 onScheduleFiberRoot = function (root, children) { 49556 try { 49557 hook.onScheduleFiberRoot(rendererID, root, children); 49558 } catch (err) { 49559 if ( true && !hasLoggedError) { 49560 hasLoggedError = true; 49561 49562 error('React instrumentation encountered an error: %s', err); 49563 } 49564 } 49565 }; 49566 } 49567 } 49568 49569 onCommitFiberRoot = function (root, expirationTime) { 49570 try { 49571 var didError = (root.current.effectTag & DidCapture) === DidCapture; 49572 49573 if (enableProfilerTimer) { 49574 var currentTime = getCurrentTime(); 49575 var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime); 49576 hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError); 49577 } else { 49578 hook.onCommitFiberRoot(rendererID, root, undefined, didError); 49579 } 49580 } catch (err) { 49581 if (true) { 49582 if (!hasLoggedError) { 49583 hasLoggedError = true; 49584 49585 error('React instrumentation encountered an error: %s', err); 49586 } 49587 } 49588 } 49589 }; 49590 49591 onCommitFiberUnmount = function (fiber) { 49592 try { 49593 hook.onCommitFiberUnmount(rendererID, fiber); 49594 } catch (err) { 49595 if (true) { 49596 if (!hasLoggedError) { 49597 hasLoggedError = true; 49598 49599 error('React instrumentation encountered an error: %s', err); 49600 } 49601 } 49602 } 49603 }; 49604 } catch (err) { 49605 // Catch all errors because it is unsafe to throw during initialization. 49606 { 49607 error('React instrumentation encountered an error: %s.', err); 49608 } 49609 } // DevTools exists 49610 49611 49612 return true; 49613} 49614function onScheduleRoot(root, children) { 49615 if (typeof onScheduleFiberRoot === 'function') { 49616 onScheduleFiberRoot(root, children); 49617 } 49618} 49619function onCommitRoot(root, expirationTime) { 49620 if (typeof onCommitFiberRoot === 'function') { 49621 onCommitFiberRoot(root, expirationTime); 49622 } 49623} 49624function onCommitUnmount(fiber) { 49625 if (typeof onCommitFiberUnmount === 'function') { 49626 onCommitFiberUnmount(fiber); 49627 } 49628} 49629 49630var hasBadMapPolyfill; 49631 49632{ 49633 hasBadMapPolyfill = false; 49634 49635 try { 49636 var nonExtensibleObject = Object.preventExtensions({}); 49637 var testMap = new Map([[nonExtensibleObject, null]]); 49638 var testSet = new Set([nonExtensibleObject]); // This is necessary for Rollup to not consider these unused. 49639 // https://github.com/rollup/rollup/issues/1771 49640 // TODO: we can remove these if Rollup fixes the bug. 49641 49642 testMap.set(0, 0); 49643 testSet.add(0); 49644 } catch (e) { 49645 // TODO: Consider warning about bad polyfills 49646 hasBadMapPolyfill = true; 49647 } 49648} 49649 49650var debugCounter = 1; 49651 49652function FiberNode(tag, pendingProps, key, mode) { 49653 // Instance 49654 this.tag = tag; 49655 this.key = key; 49656 this.elementType = null; 49657 this.type = null; 49658 this.stateNode = null; // Fiber 49659 49660 this.return = null; 49661 this.child = null; 49662 this.sibling = null; 49663 this.index = 0; 49664 this.ref = null; 49665 this.pendingProps = pendingProps; 49666 this.memoizedProps = null; 49667 this.updateQueue = null; 49668 this.memoizedState = null; 49669 this.dependencies = null; 49670 this.mode = mode; // Effects 49671 49672 this.effectTag = NoEffect; 49673 this.nextEffect = null; 49674 this.firstEffect = null; 49675 this.lastEffect = null; 49676 this.expirationTime = NoWork; 49677 this.childExpirationTime = NoWork; 49678 this.alternate = null; 49679 49680 { 49681 // Note: The following is done to avoid a v8 performance cliff. 49682 // 49683 // Initializing the fields below to smis and later updating them with 49684 // double values will cause Fibers to end up having separate shapes. 49685 // This behavior/bug has something to do with Object.preventExtension(). 49686 // Fortunately this only impacts DEV builds. 49687 // Unfortunately it makes React unusably slow for some applications. 49688 // To work around this, initialize the fields below with doubles. 49689 // 49690 // Learn more about this here: 49691 // https://github.com/facebook/react/issues/14365 49692 // https://bugs.chromium.org/p/v8/issues/detail?id=8538 49693 this.actualDuration = Number.NaN; 49694 this.actualStartTime = Number.NaN; 49695 this.selfBaseDuration = Number.NaN; 49696 this.treeBaseDuration = Number.NaN; // It's okay to replace the initial doubles with smis after initialization. 49697 // This won't trigger the performance cliff mentioned above, 49698 // and it simplifies other profiler code (including DevTools). 49699 49700 this.actualDuration = 0; 49701 this.actualStartTime = -1; 49702 this.selfBaseDuration = 0; 49703 this.treeBaseDuration = 0; 49704 } // This is normally DEV-only except www when it adds listeners. 49705 // TODO: remove the User Timing integration in favor of Root Events. 49706 49707 49708 { 49709 this._debugID = debugCounter++; 49710 this._debugIsCurrentlyTiming = false; 49711 } 49712 49713 { 49714 this._debugSource = null; 49715 this._debugOwner = null; 49716 this._debugNeedsRemount = false; 49717 this._debugHookTypes = null; 49718 49719 if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') { 49720 Object.preventExtensions(this); 49721 } 49722 } 49723} // This is a constructor function, rather than a POJO constructor, still 49724// please ensure we do the following: 49725// 1) Nobody should add any instance methods on this. Instance methods can be 49726// more difficult to predict when they get optimized and they are almost 49727// never inlined properly in static compilers. 49728// 2) Nobody should rely on `instanceof Fiber` for type testing. We should 49729// always know when it is a fiber. 49730// 3) We might want to experiment with using numeric keys since they are easier 49731// to optimize in a non-JIT environment. 49732// 4) We can easily go from a constructor to a createFiber object literal if that 49733// is faster. 49734// 5) It should be easy to port this to a C struct and keep a C implementation 49735// compatible. 49736 49737 49738var createFiber = function (tag, pendingProps, key, mode) { 49739 // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors 49740 return new FiberNode(tag, pendingProps, key, mode); 49741}; 49742 49743function shouldConstruct(Component) { 49744 var prototype = Component.prototype; 49745 return !!(prototype && prototype.isReactComponent); 49746} 49747 49748function isSimpleFunctionComponent(type) { 49749 return typeof type === 'function' && !shouldConstruct(type) && type.defaultProps === undefined; 49750} 49751function resolveLazyComponentTag(Component) { 49752 if (typeof Component === 'function') { 49753 return shouldConstruct(Component) ? ClassComponent : FunctionComponent; 49754 } else if (Component !== undefined && Component !== null) { 49755 var $$typeof = Component.$$typeof; 49756 49757 if ($$typeof === REACT_FORWARD_REF_TYPE) { 49758 return ForwardRef; 49759 } 49760 49761 if ($$typeof === REACT_MEMO_TYPE) { 49762 return MemoComponent; 49763 } 49764 } 49765 49766 return IndeterminateComponent; 49767} // This is used to create an alternate fiber to do work on. 49768 49769function createWorkInProgress(current, pendingProps) { 49770 var workInProgress = current.alternate; 49771 49772 if (workInProgress === null) { 49773 // We use a double buffering pooling technique because we know that we'll 49774 // only ever need at most two versions of a tree. We pool the "other" unused 49775 // node that we're free to reuse. This is lazily created to avoid allocating 49776 // extra objects for things that are never updated. It also allow us to 49777 // reclaim the extra memory if needed. 49778 workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode); 49779 workInProgress.elementType = current.elementType; 49780 workInProgress.type = current.type; 49781 workInProgress.stateNode = current.stateNode; 49782 49783 { 49784 // DEV-only fields 49785 { 49786 workInProgress._debugID = current._debugID; 49787 } 49788 49789 workInProgress._debugSource = current._debugSource; 49790 workInProgress._debugOwner = current._debugOwner; 49791 workInProgress._debugHookTypes = current._debugHookTypes; 49792 } 49793 49794 workInProgress.alternate = current; 49795 current.alternate = workInProgress; 49796 } else { 49797 workInProgress.pendingProps = pendingProps; // We already have an alternate. 49798 // Reset the effect tag. 49799 49800 workInProgress.effectTag = NoEffect; // The effect list is no longer valid. 49801 49802 workInProgress.nextEffect = null; 49803 workInProgress.firstEffect = null; 49804 workInProgress.lastEffect = null; 49805 49806 { 49807 // We intentionally reset, rather than copy, actualDuration & actualStartTime. 49808 // This prevents time from endlessly accumulating in new commits. 49809 // This has the downside of resetting values for different priority renders, 49810 // But works for yielding (the common case) and should support resuming. 49811 workInProgress.actualDuration = 0; 49812 workInProgress.actualStartTime = -1; 49813 } 49814 } 49815 49816 workInProgress.childExpirationTime = current.childExpirationTime; 49817 workInProgress.expirationTime = current.expirationTime; 49818 workInProgress.child = current.child; 49819 workInProgress.memoizedProps = current.memoizedProps; 49820 workInProgress.memoizedState = current.memoizedState; 49821 workInProgress.updateQueue = current.updateQueue; // Clone the dependencies object. This is mutated during the render phase, so 49822 // it cannot be shared with the current fiber. 49823 49824 var currentDependencies = current.dependencies; 49825 workInProgress.dependencies = currentDependencies === null ? null : { 49826 expirationTime: currentDependencies.expirationTime, 49827 firstContext: currentDependencies.firstContext, 49828 responders: currentDependencies.responders 49829 }; // These will be overridden during the parent's reconciliation 49830 49831 workInProgress.sibling = current.sibling; 49832 workInProgress.index = current.index; 49833 workInProgress.ref = current.ref; 49834 49835 { 49836 workInProgress.selfBaseDuration = current.selfBaseDuration; 49837 workInProgress.treeBaseDuration = current.treeBaseDuration; 49838 } 49839 49840 { 49841 workInProgress._debugNeedsRemount = current._debugNeedsRemount; 49842 49843 switch (workInProgress.tag) { 49844 case IndeterminateComponent: 49845 case FunctionComponent: 49846 case SimpleMemoComponent: 49847 workInProgress.type = resolveFunctionForHotReloading(current.type); 49848 break; 49849 49850 case ClassComponent: 49851 workInProgress.type = resolveClassForHotReloading(current.type); 49852 break; 49853 49854 case ForwardRef: 49855 workInProgress.type = resolveForwardRefForHotReloading(current.type); 49856 break; 49857 } 49858 } 49859 49860 return workInProgress; 49861} // Used to reuse a Fiber for a second pass. 49862 49863function resetWorkInProgress(workInProgress, renderExpirationTime) { 49864 // This resets the Fiber to what createFiber or createWorkInProgress would 49865 // have set the values to before during the first pass. Ideally this wouldn't 49866 // be necessary but unfortunately many code paths reads from the workInProgress 49867 // when they should be reading from current and writing to workInProgress. 49868 // We assume pendingProps, index, key, ref, return are still untouched to 49869 // avoid doing another reconciliation. 49870 // Reset the effect tag but keep any Placement tags, since that's something 49871 // that child fiber is setting, not the reconciliation. 49872 workInProgress.effectTag &= Placement; // The effect list is no longer valid. 49873 49874 workInProgress.nextEffect = null; 49875 workInProgress.firstEffect = null; 49876 workInProgress.lastEffect = null; 49877 var current = workInProgress.alternate; 49878 49879 if (current === null) { 49880 // Reset to createFiber's initial values. 49881 workInProgress.childExpirationTime = NoWork; 49882 workInProgress.expirationTime = renderExpirationTime; 49883 workInProgress.child = null; 49884 workInProgress.memoizedProps = null; 49885 workInProgress.memoizedState = null; 49886 workInProgress.updateQueue = null; 49887 workInProgress.dependencies = null; 49888 49889 { 49890 // Note: We don't reset the actualTime counts. It's useful to accumulate 49891 // actual time across multiple render passes. 49892 workInProgress.selfBaseDuration = 0; 49893 workInProgress.treeBaseDuration = 0; 49894 } 49895 } else { 49896 // Reset to the cloned values that createWorkInProgress would've. 49897 workInProgress.childExpirationTime = current.childExpirationTime; 49898 workInProgress.expirationTime = current.expirationTime; 49899 workInProgress.child = current.child; 49900 workInProgress.memoizedProps = current.memoizedProps; 49901 workInProgress.memoizedState = current.memoizedState; 49902 workInProgress.updateQueue = current.updateQueue; // Clone the dependencies object. This is mutated during the render phase, so 49903 // it cannot be shared with the current fiber. 49904 49905 var currentDependencies = current.dependencies; 49906 workInProgress.dependencies = currentDependencies === null ? null : { 49907 expirationTime: currentDependencies.expirationTime, 49908 firstContext: currentDependencies.firstContext, 49909 responders: currentDependencies.responders 49910 }; 49911 49912 { 49913 // Note: We don't reset the actualTime counts. It's useful to accumulate 49914 // actual time across multiple render passes. 49915 workInProgress.selfBaseDuration = current.selfBaseDuration; 49916 workInProgress.treeBaseDuration = current.treeBaseDuration; 49917 } 49918 } 49919 49920 return workInProgress; 49921} 49922function createHostRootFiber(tag) { 49923 var mode; 49924 49925 if (tag === ConcurrentRoot) { 49926 mode = ConcurrentMode | BlockingMode | StrictMode; 49927 } else if (tag === BlockingRoot) { 49928 mode = BlockingMode | StrictMode; 49929 } else { 49930 mode = NoMode; 49931 } 49932 49933 if ( isDevToolsPresent) { 49934 // Always collect profile timings when DevTools are present. 49935 // This enables DevTools to start capturing timing at any pointâ 49936 // Without some nodes in the tree having empty base times. 49937 mode |= ProfileMode; 49938 } 49939 49940 return createFiber(HostRoot, null, null, mode); 49941} 49942function createFiberFromTypeAndProps(type, // React$ElementType 49943key, pendingProps, owner, mode, expirationTime) { 49944 var fiber; 49945 var fiberTag = IndeterminateComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. 49946 49947 var resolvedType = type; 49948 49949 if (typeof type === 'function') { 49950 if (shouldConstruct(type)) { 49951 fiberTag = ClassComponent; 49952 49953 { 49954 resolvedType = resolveClassForHotReloading(resolvedType); 49955 } 49956 } else { 49957 { 49958 resolvedType = resolveFunctionForHotReloading(resolvedType); 49959 } 49960 } 49961 } else if (typeof type === 'string') { 49962 fiberTag = HostComponent; 49963 } else { 49964 getTag: switch (type) { 49965 case REACT_FRAGMENT_TYPE: 49966 return createFiberFromFragment(pendingProps.children, mode, expirationTime, key); 49967 49968 case REACT_CONCURRENT_MODE_TYPE: 49969 fiberTag = Mode; 49970 mode |= ConcurrentMode | BlockingMode | StrictMode; 49971 break; 49972 49973 case REACT_STRICT_MODE_TYPE: 49974 fiberTag = Mode; 49975 mode |= StrictMode; 49976 break; 49977 49978 case REACT_PROFILER_TYPE: 49979 return createFiberFromProfiler(pendingProps, mode, expirationTime, key); 49980 49981 case REACT_SUSPENSE_TYPE: 49982 return createFiberFromSuspense(pendingProps, mode, expirationTime, key); 49983 49984 case REACT_SUSPENSE_LIST_TYPE: 49985 return createFiberFromSuspenseList(pendingProps, mode, expirationTime, key); 49986 49987 default: 49988 { 49989 if (typeof type === 'object' && type !== null) { 49990 switch (type.$$typeof) { 49991 case REACT_PROVIDER_TYPE: 49992 fiberTag = ContextProvider; 49993 break getTag; 49994 49995 case REACT_CONTEXT_TYPE: 49996 // This is a consumer 49997 fiberTag = ContextConsumer; 49998 break getTag; 49999 50000 case REACT_FORWARD_REF_TYPE: 50001 fiberTag = ForwardRef; 50002 50003 { 50004 resolvedType = resolveForwardRefForHotReloading(resolvedType); 50005 } 50006 50007 break getTag; 50008 50009 case REACT_MEMO_TYPE: 50010 fiberTag = MemoComponent; 50011 break getTag; 50012 50013 case REACT_LAZY_TYPE: 50014 fiberTag = LazyComponent; 50015 resolvedType = null; 50016 break getTag; 50017 50018 case REACT_BLOCK_TYPE: 50019 fiberTag = Block; 50020 break getTag; 50021 50022 } 50023 } 50024 50025 var info = ''; 50026 50027 { 50028 if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { 50029 info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.'; 50030 } 50031 50032 var ownerName = owner ? getComponentName(owner.type) : null; 50033 50034 if (ownerName) { 50035 info += '\n\nCheck the render method of `' + ownerName + '`.'; 50036 } 50037 } 50038 50039 { 50040 { 50041 throw Error( "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + (type == null ? type : typeof type) + "." + info ); 50042 } 50043 } 50044 } 50045 } 50046 } 50047 50048 fiber = createFiber(fiberTag, pendingProps, key, mode); 50049 fiber.elementType = type; 50050 fiber.type = resolvedType; 50051 fiber.expirationTime = expirationTime; 50052 return fiber; 50053} 50054function createFiberFromElement(element, mode, expirationTime) { 50055 var owner = null; 50056 50057 { 50058 owner = element._owner; 50059 } 50060 50061 var type = element.type; 50062 var key = element.key; 50063 var pendingProps = element.props; 50064 var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, expirationTime); 50065 50066 { 50067 fiber._debugSource = element._source; 50068 fiber._debugOwner = element._owner; 50069 } 50070 50071 return fiber; 50072} 50073function createFiberFromFragment(elements, mode, expirationTime, key) { 50074 var fiber = createFiber(Fragment, elements, key, mode); 50075 fiber.expirationTime = expirationTime; 50076 return fiber; 50077} 50078 50079function createFiberFromProfiler(pendingProps, mode, expirationTime, key) { 50080 { 50081 if (typeof pendingProps.id !== 'string' || typeof pendingProps.onRender !== 'function') { 50082 error('Profiler must specify an "id" string and "onRender" function as props'); 50083 } 50084 } 50085 50086 var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode); // TODO: The Profiler fiber shouldn't have a type. It has a tag. 50087 50088 fiber.elementType = REACT_PROFILER_TYPE; 50089 fiber.type = REACT_PROFILER_TYPE; 50090 fiber.expirationTime = expirationTime; 50091 return fiber; 50092} 50093 50094function createFiberFromSuspense(pendingProps, mode, expirationTime, key) { 50095 var fiber = createFiber(SuspenseComponent, pendingProps, key, mode); // TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag. 50096 // This needs to be fixed in getComponentName so that it relies on the tag 50097 // instead. 50098 50099 fiber.type = REACT_SUSPENSE_TYPE; 50100 fiber.elementType = REACT_SUSPENSE_TYPE; 50101 fiber.expirationTime = expirationTime; 50102 return fiber; 50103} 50104function createFiberFromSuspenseList(pendingProps, mode, expirationTime, key) { 50105 var fiber = createFiber(SuspenseListComponent, pendingProps, key, mode); 50106 50107 { 50108 // TODO: The SuspenseListComponent fiber shouldn't have a type. It has a tag. 50109 // This needs to be fixed in getComponentName so that it relies on the tag 50110 // instead. 50111 fiber.type = REACT_SUSPENSE_LIST_TYPE; 50112 } 50113 50114 fiber.elementType = REACT_SUSPENSE_LIST_TYPE; 50115 fiber.expirationTime = expirationTime; 50116 return fiber; 50117} 50118function createFiberFromText(content, mode, expirationTime) { 50119 var fiber = createFiber(HostText, content, null, mode); 50120 fiber.expirationTime = expirationTime; 50121 return fiber; 50122} 50123function createFiberFromHostInstanceForDeletion() { 50124 var fiber = createFiber(HostComponent, null, null, NoMode); // TODO: These should not need a type. 50125 50126 fiber.elementType = 'DELETED'; 50127 fiber.type = 'DELETED'; 50128 return fiber; 50129} 50130function createFiberFromPortal(portal, mode, expirationTime) { 50131 var pendingProps = portal.children !== null ? portal.children : []; 50132 var fiber = createFiber(HostPortal, pendingProps, portal.key, mode); 50133 fiber.expirationTime = expirationTime; 50134 fiber.stateNode = { 50135 containerInfo: portal.containerInfo, 50136 pendingChildren: null, 50137 // Used by persistent updates 50138 implementation: portal.implementation 50139 }; 50140 return fiber; 50141} // Used for stashing WIP properties to replay failed work in DEV. 50142 50143function assignFiberPropertiesInDEV(target, source) { 50144 if (target === null) { 50145 // This Fiber's initial properties will always be overwritten. 50146 // We only use a Fiber to ensure the same hidden class so DEV isn't slow. 50147 target = createFiber(IndeterminateComponent, null, null, NoMode); 50148 } // This is intentionally written as a list of all properties. 50149 // We tried to use Object.assign() instead but this is called in 50150 // the hottest path, and Object.assign() was too slow: 50151 // https://github.com/facebook/react/issues/12502 50152 // This code is DEV-only so size is not a concern. 50153 50154 50155 target.tag = source.tag; 50156 target.key = source.key; 50157 target.elementType = source.elementType; 50158 target.type = source.type; 50159 target.stateNode = source.stateNode; 50160 target.return = source.return; 50161 target.child = source.child; 50162 target.sibling = source.sibling; 50163 target.index = source.index; 50164 target.ref = source.ref; 50165 target.pendingProps = source.pendingProps; 50166 target.memoizedProps = source.memoizedProps; 50167 target.updateQueue = source.updateQueue; 50168 target.memoizedState = source.memoizedState; 50169 target.dependencies = source.dependencies; 50170 target.mode = source.mode; 50171 target.effectTag = source.effectTag; 50172 target.nextEffect = source.nextEffect; 50173 target.firstEffect = source.firstEffect; 50174 target.lastEffect = source.lastEffect; 50175 target.expirationTime = source.expirationTime; 50176 target.childExpirationTime = source.childExpirationTime; 50177 target.alternate = source.alternate; 50178 50179 { 50180 target.actualDuration = source.actualDuration; 50181 target.actualStartTime = source.actualStartTime; 50182 target.selfBaseDuration = source.selfBaseDuration; 50183 target.treeBaseDuration = source.treeBaseDuration; 50184 } 50185 50186 { 50187 target._debugID = source._debugID; 50188 } 50189 50190 target._debugSource = source._debugSource; 50191 target._debugOwner = source._debugOwner; 50192 target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming; 50193 target._debugNeedsRemount = source._debugNeedsRemount; 50194 target._debugHookTypes = source._debugHookTypes; 50195 return target; 50196} 50197 50198function FiberRootNode(containerInfo, tag, hydrate) { 50199 this.tag = tag; 50200 this.current = null; 50201 this.containerInfo = containerInfo; 50202 this.pendingChildren = null; 50203 this.pingCache = null; 50204 this.finishedExpirationTime = NoWork; 50205 this.finishedWork = null; 50206 this.timeoutHandle = noTimeout; 50207 this.context = null; 50208 this.pendingContext = null; 50209 this.hydrate = hydrate; 50210 this.callbackNode = null; 50211 this.callbackPriority = NoPriority; 50212 this.firstPendingTime = NoWork; 50213 this.firstSuspendedTime = NoWork; 50214 this.lastSuspendedTime = NoWork; 50215 this.nextKnownPendingLevel = NoWork; 50216 this.lastPingedTime = NoWork; 50217 this.lastExpiredTime = NoWork; 50218 50219 { 50220 this.interactionThreadID = tracing.unstable_getThreadID(); 50221 this.memoizedInteractions = new Set(); 50222 this.pendingInteractionMap = new Map(); 50223 } 50224} 50225 50226function createFiberRoot(containerInfo, tag, hydrate, hydrationCallbacks) { 50227 var root = new FiberRootNode(containerInfo, tag, hydrate); 50228 // stateNode is any. 50229 50230 50231 var uninitializedFiber = createHostRootFiber(tag); 50232 root.current = uninitializedFiber; 50233 uninitializedFiber.stateNode = root; 50234 initializeUpdateQueue(uninitializedFiber); 50235 return root; 50236} 50237function isRootSuspendedAtTime(root, expirationTime) { 50238 var firstSuspendedTime = root.firstSuspendedTime; 50239 var lastSuspendedTime = root.lastSuspendedTime; 50240 return firstSuspendedTime !== NoWork && firstSuspendedTime >= expirationTime && lastSuspendedTime <= expirationTime; 50241} 50242function markRootSuspendedAtTime(root, expirationTime) { 50243 var firstSuspendedTime = root.firstSuspendedTime; 50244 var lastSuspendedTime = root.lastSuspendedTime; 50245 50246 if (firstSuspendedTime < expirationTime) { 50247 root.firstSuspendedTime = expirationTime; 50248 } 50249 50250 if (lastSuspendedTime > expirationTime || firstSuspendedTime === NoWork) { 50251 root.lastSuspendedTime = expirationTime; 50252 } 50253 50254 if (expirationTime <= root.lastPingedTime) { 50255 root.lastPingedTime = NoWork; 50256 } 50257 50258 if (expirationTime <= root.lastExpiredTime) { 50259 root.lastExpiredTime = NoWork; 50260 } 50261} 50262function markRootUpdatedAtTime(root, expirationTime) { 50263 // Update the range of pending times 50264 var firstPendingTime = root.firstPendingTime; 50265 50266 if (expirationTime > firstPendingTime) { 50267 root.firstPendingTime = expirationTime; 50268 } // Update the range of suspended times. Treat everything lower priority or 50269 // equal to this update as unsuspended. 50270 50271 50272 var firstSuspendedTime = root.firstSuspendedTime; 50273 50274 if (firstSuspendedTime !== NoWork) { 50275 if (expirationTime >= firstSuspendedTime) { 50276 // The entire suspended range is now unsuspended. 50277 root.firstSuspendedTime = root.lastSuspendedTime = root.nextKnownPendingLevel = NoWork; 50278 } else if (expirationTime >= root.lastSuspendedTime) { 50279 root.lastSuspendedTime = expirationTime + 1; 50280 } // This is a pending level. Check if it's higher priority than the next 50281 // known pending level. 50282 50283 50284 if (expirationTime > root.nextKnownPendingLevel) { 50285 root.nextKnownPendingLevel = expirationTime; 50286 } 50287 } 50288} 50289function markRootFinishedAtTime(root, finishedExpirationTime, remainingExpirationTime) { 50290 // Update the range of pending times 50291 root.firstPendingTime = remainingExpirationTime; // Update the range of suspended times. Treat everything higher priority or 50292 // equal to this update as unsuspended. 50293 50294 if (finishedExpirationTime <= root.lastSuspendedTime) { 50295 // The entire suspended range is now unsuspended. 50296 root.firstSuspendedTime = root.lastSuspendedTime = root.nextKnownPendingLevel = NoWork; 50297 } else if (finishedExpirationTime <= root.firstSuspendedTime) { 50298 // Part of the suspended range is now unsuspended. Narrow the range to 50299 // include everything between the unsuspended time (non-inclusive) and the 50300 // last suspended time. 50301 root.firstSuspendedTime = finishedExpirationTime - 1; 50302 } 50303 50304 if (finishedExpirationTime <= root.lastPingedTime) { 50305 // Clear the pinged time 50306 root.lastPingedTime = NoWork; 50307 } 50308 50309 if (finishedExpirationTime <= root.lastExpiredTime) { 50310 // Clear the expired time 50311 root.lastExpiredTime = NoWork; 50312 } 50313} 50314function markRootExpiredAtTime(root, expirationTime) { 50315 var lastExpiredTime = root.lastExpiredTime; 50316 50317 if (lastExpiredTime === NoWork || lastExpiredTime > expirationTime) { 50318 root.lastExpiredTime = expirationTime; 50319 } 50320} 50321 50322var didWarnAboutNestedUpdates; 50323var didWarnAboutFindNodeInStrictMode; 50324 50325{ 50326 didWarnAboutNestedUpdates = false; 50327 didWarnAboutFindNodeInStrictMode = {}; 50328} 50329 50330function getContextForSubtree(parentComponent) { 50331 if (!parentComponent) { 50332 return emptyContextObject; 50333 } 50334 50335 var fiber = get(parentComponent); 50336 var parentContext = findCurrentUnmaskedContext(fiber); 50337 50338 if (fiber.tag === ClassComponent) { 50339 var Component = fiber.type; 50340 50341 if (isContextProvider(Component)) { 50342 return processChildContext(fiber, Component, parentContext); 50343 } 50344 } 50345 50346 return parentContext; 50347} 50348 50349function findHostInstanceWithWarning(component, methodName) { 50350 { 50351 var fiber = get(component); 50352 50353 if (fiber === undefined) { 50354 if (typeof component.render === 'function') { 50355 { 50356 { 50357 throw Error( "Unable to find node on an unmounted component." ); 50358 } 50359 } 50360 } else { 50361 { 50362 { 50363 throw Error( "Argument appears to not be a ReactComponent. Keys: " + Object.keys(component) ); 50364 } 50365 } 50366 } 50367 } 50368 50369 var hostFiber = findCurrentHostFiber(fiber); 50370 50371 if (hostFiber === null) { 50372 return null; 50373 } 50374 50375 if (hostFiber.mode & StrictMode) { 50376 var componentName = getComponentName(fiber.type) || 'Component'; 50377 50378 if (!didWarnAboutFindNodeInStrictMode[componentName]) { 50379 didWarnAboutFindNodeInStrictMode[componentName] = true; 50380 50381 if (fiber.mode & StrictMode) { 50382 error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which is inside StrictMode. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-find-node%s', methodName, methodName, componentName, getStackByFiberInDevAndProd(hostFiber)); 50383 } else { 50384 error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which renders StrictMode children. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-find-node%s', methodName, methodName, componentName, getStackByFiberInDevAndProd(hostFiber)); 50385 } 50386 } 50387 } 50388 50389 return hostFiber.stateNode; 50390 } 50391} 50392 50393function createContainer(containerInfo, tag, hydrate, hydrationCallbacks) { 50394 return createFiberRoot(containerInfo, tag, hydrate); 50395} 50396function updateContainer(element, container, parentComponent, callback) { 50397 { 50398 onScheduleRoot(container, element); 50399 } 50400 50401 var current$1 = container.current; 50402 var currentTime = requestCurrentTimeForUpdate(); 50403 50404 { 50405 // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests 50406 if ('undefined' !== typeof jest) { 50407 warnIfUnmockedScheduler(current$1); 50408 warnIfNotScopedWithMatchingAct(current$1); 50409 } 50410 } 50411 50412 var suspenseConfig = requestCurrentSuspenseConfig(); 50413 var expirationTime = computeExpirationForFiber(currentTime, current$1, suspenseConfig); 50414 var context = getContextForSubtree(parentComponent); 50415 50416 if (container.context === null) { 50417 container.context = context; 50418 } else { 50419 container.pendingContext = context; 50420 } 50421 50422 { 50423 if (isRendering && current !== null && !didWarnAboutNestedUpdates) { 50424 didWarnAboutNestedUpdates = true; 50425 50426 error('Render methods should be a pure function of props and state; ' + 'triggering nested component updates from render is not allowed. ' + 'If necessary, trigger nested updates in componentDidUpdate.\n\n' + 'Check the render method of %s.', getComponentName(current.type) || 'Unknown'); 50427 } 50428 } 50429 50430 var update = createUpdate(expirationTime, suspenseConfig); // Caution: React DevTools currently depends on this property 50431 // being called "element". 50432 50433 update.payload = { 50434 element: element 50435 }; 50436 callback = callback === undefined ? null : callback; 50437 50438 if (callback !== null) { 50439 { 50440 if (typeof callback !== 'function') { 50441 error('render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback); 50442 } 50443 } 50444 50445 update.callback = callback; 50446 } 50447 50448 enqueueUpdate(current$1, update); 50449 scheduleWork(current$1, expirationTime); 50450 return expirationTime; 50451} 50452function getPublicRootInstance(container) { 50453 var containerFiber = container.current; 50454 50455 if (!containerFiber.child) { 50456 return null; 50457 } 50458 50459 switch (containerFiber.child.tag) { 50460 case HostComponent: 50461 return getPublicInstance(containerFiber.child.stateNode); 50462 50463 default: 50464 return containerFiber.child.stateNode; 50465 } 50466} 50467 50468function markRetryTimeImpl(fiber, retryTime) { 50469 var suspenseState = fiber.memoizedState; 50470 50471 if (suspenseState !== null && suspenseState.dehydrated !== null) { 50472 if (suspenseState.retryTime < retryTime) { 50473 suspenseState.retryTime = retryTime; 50474 } 50475 } 50476} // Increases the priority of thennables when they resolve within this boundary. 50477 50478 50479function markRetryTimeIfNotHydrated(fiber, retryTime) { 50480 markRetryTimeImpl(fiber, retryTime); 50481 var alternate = fiber.alternate; 50482 50483 if (alternate) { 50484 markRetryTimeImpl(alternate, retryTime); 50485 } 50486} 50487 50488function attemptUserBlockingHydration$1(fiber) { 50489 if (fiber.tag !== SuspenseComponent) { 50490 // We ignore HostRoots here because we can't increase 50491 // their priority and they should not suspend on I/O, 50492 // since you have to wrap anything that might suspend in 50493 // Suspense. 50494 return; 50495 } 50496 50497 var expTime = computeInteractiveExpiration(requestCurrentTimeForUpdate()); 50498 scheduleWork(fiber, expTime); 50499 markRetryTimeIfNotHydrated(fiber, expTime); 50500} 50501function attemptContinuousHydration$1(fiber) { 50502 if (fiber.tag !== SuspenseComponent) { 50503 // We ignore HostRoots here because we can't increase 50504 // their priority and they should not suspend on I/O, 50505 // since you have to wrap anything that might suspend in 50506 // Suspense. 50507 return; 50508 } 50509 50510 scheduleWork(fiber, ContinuousHydration); 50511 markRetryTimeIfNotHydrated(fiber, ContinuousHydration); 50512} 50513function attemptHydrationAtCurrentPriority$1(fiber) { 50514 if (fiber.tag !== SuspenseComponent) { 50515 // We ignore HostRoots here because we can't increase 50516 // their priority other than synchronously flush it. 50517 return; 50518 } 50519 50520 var currentTime = requestCurrentTimeForUpdate(); 50521 var expTime = computeExpirationForFiber(currentTime, fiber, null); 50522 scheduleWork(fiber, expTime); 50523 markRetryTimeIfNotHydrated(fiber, expTime); 50524} 50525function findHostInstanceWithNoPortals(fiber) { 50526 var hostFiber = findCurrentHostFiberWithNoPortals(fiber); 50527 50528 if (hostFiber === null) { 50529 return null; 50530 } 50531 50532 if (hostFiber.tag === FundamentalComponent) { 50533 return hostFiber.stateNode.instance; 50534 } 50535 50536 return hostFiber.stateNode; 50537} 50538 50539var shouldSuspendImpl = function (fiber) { 50540 return false; 50541}; 50542 50543function shouldSuspend(fiber) { 50544 return shouldSuspendImpl(fiber); 50545} 50546var overrideHookState = null; 50547var overrideProps = null; 50548var scheduleUpdate = null; 50549var setSuspenseHandler = null; 50550 50551{ 50552 var copyWithSetImpl = function (obj, path, idx, value) { 50553 if (idx >= path.length) { 50554 return value; 50555 } 50556 50557 var key = path[idx]; 50558 var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj); // $FlowFixMe number or string is fine here 50559 50560 updated[key] = copyWithSetImpl(obj[key], path, idx + 1, value); 50561 return updated; 50562 }; 50563 50564 var copyWithSet = function (obj, path, value) { 50565 return copyWithSetImpl(obj, path, 0, value); 50566 }; // Support DevTools editable values for useState and useReducer. 50567 50568 50569 overrideHookState = function (fiber, id, path, value) { 50570 // For now, the "id" of stateful hooks is just the stateful hook index. 50571 // This may change in the future with e.g. nested hooks. 50572 var currentHook = fiber.memoizedState; 50573 50574 while (currentHook !== null && id > 0) { 50575 currentHook = currentHook.next; 50576 id--; 50577 } 50578 50579 if (currentHook !== null) { 50580 var newState = copyWithSet(currentHook.memoizedState, path, value); 50581 currentHook.memoizedState = newState; 50582 currentHook.baseState = newState; // We aren't actually adding an update to the queue, 50583 // because there is no update we can add for useReducer hooks that won't trigger an error. 50584 // (There's no appropriate action type for DevTools overrides.) 50585 // As a result though, React will see the scheduled update as a noop and bailout. 50586 // Shallow cloning props works as a workaround for now to bypass the bailout check. 50587 50588 fiber.memoizedProps = _assign({}, fiber.memoizedProps); 50589 scheduleWork(fiber, Sync); 50590 } 50591 }; // Support DevTools props for function components, forwardRef, memo, host components, etc. 50592 50593 50594 overrideProps = function (fiber, path, value) { 50595 fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value); 50596 50597 if (fiber.alternate) { 50598 fiber.alternate.pendingProps = fiber.pendingProps; 50599 } 50600 50601 scheduleWork(fiber, Sync); 50602 }; 50603 50604 scheduleUpdate = function (fiber) { 50605 scheduleWork(fiber, Sync); 50606 }; 50607 50608 setSuspenseHandler = function (newShouldSuspendImpl) { 50609 shouldSuspendImpl = newShouldSuspendImpl; 50610 }; 50611} 50612 50613function injectIntoDevTools(devToolsConfig) { 50614 var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance; 50615 var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; 50616 return injectInternals(_assign({}, devToolsConfig, { 50617 overrideHookState: overrideHookState, 50618 overrideProps: overrideProps, 50619 setSuspenseHandler: setSuspenseHandler, 50620 scheduleUpdate: scheduleUpdate, 50621 currentDispatcherRef: ReactCurrentDispatcher, 50622 findHostInstanceByFiber: function (fiber) { 50623 var hostFiber = findCurrentHostFiber(fiber); 50624 50625 if (hostFiber === null) { 50626 return null; 50627 } 50628 50629 return hostFiber.stateNode; 50630 }, 50631 findFiberByHostInstance: function (instance) { 50632 if (!findFiberByHostInstance) { 50633 // Might not be implemented by the renderer. 50634 return null; 50635 } 50636 50637 return findFiberByHostInstance(instance); 50638 }, 50639 // React Refresh 50640 findHostInstancesForRefresh: findHostInstancesForRefresh , 50641 scheduleRefresh: scheduleRefresh , 50642 scheduleRoot: scheduleRoot , 50643 setRefreshHandler: setRefreshHandler , 50644 // Enables DevTools to append owner stacks to error messages in DEV mode. 50645 getCurrentFiber: function () { 50646 return current; 50647 } 50648 })); 50649} 50650var IsSomeRendererActing$1 = ReactSharedInternals.IsSomeRendererActing; 50651 50652function ReactDOMRoot(container, options) { 50653 this._internalRoot = createRootImpl(container, ConcurrentRoot, options); 50654} 50655 50656function ReactDOMBlockingRoot(container, tag, options) { 50657 this._internalRoot = createRootImpl(container, tag, options); 50658} 50659 50660ReactDOMRoot.prototype.render = ReactDOMBlockingRoot.prototype.render = function (children) { 50661 var root = this._internalRoot; 50662 50663 { 50664 if (typeof arguments[1] === 'function') { 50665 error('render(...): does not support the second callback argument. ' + 'To execute a side effect after rendering, declare it in a component body with useEffect().'); 50666 } 50667 50668 var container = root.containerInfo; 50669 50670 if (container.nodeType !== COMMENT_NODE) { 50671 var hostInstance = findHostInstanceWithNoPortals(root.current); 50672 50673 if (hostInstance) { 50674 if (hostInstance.parentNode !== container) { 50675 error('render(...): It looks like the React-rendered content of the ' + 'root container was removed without using React. This is not ' + 'supported and will cause errors. Instead, call ' + "root.unmount() to empty a root's container."); 50676 } 50677 } 50678 } 50679 } 50680 50681 updateContainer(children, root, null, null); 50682}; 50683 50684ReactDOMRoot.prototype.unmount = ReactDOMBlockingRoot.prototype.unmount = function () { 50685 { 50686 if (typeof arguments[0] === 'function') { 50687 error('unmount(...): does not support a callback argument. ' + 'To execute a side effect after rendering, declare it in a component body with useEffect().'); 50688 } 50689 } 50690 50691 var root = this._internalRoot; 50692 var container = root.containerInfo; 50693 updateContainer(null, root, null, function () { 50694 unmarkContainerAsRoot(container); 50695 }); 50696}; 50697 50698function createRootImpl(container, tag, options) { 50699 // Tag is either LegacyRoot or Concurrent Root 50700 var hydrate = options != null && options.hydrate === true; 50701 var hydrationCallbacks = options != null && options.hydrationOptions || null; 50702 var root = createContainer(container, tag, hydrate); 50703 markContainerAsRoot(root.current, container); 50704 50705 if (hydrate && tag !== LegacyRoot) { 50706 var doc = container.nodeType === DOCUMENT_NODE ? container : container.ownerDocument; 50707 eagerlyTrapReplayableEvents(container, doc); 50708 } 50709 50710 return root; 50711} 50712function createLegacyRoot(container, options) { 50713 return new ReactDOMBlockingRoot(container, LegacyRoot, options); 50714} 50715function isValidContainer(node) { 50716 return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || node.nodeType === COMMENT_NODE && node.nodeValue === ' react-mount-point-unstable ')); 50717} 50718 50719var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner; 50720var topLevelUpdateWarnings; 50721var warnedAboutHydrateAPI = false; 50722 50723{ 50724 topLevelUpdateWarnings = function (container) { 50725 if (container._reactRootContainer && container.nodeType !== COMMENT_NODE) { 50726 var hostInstance = findHostInstanceWithNoPortals(container._reactRootContainer._internalRoot.current); 50727 50728 if (hostInstance) { 50729 if (hostInstance.parentNode !== container) { 50730 error('render(...): It looks like the React-rendered content of this ' + 'container was removed without using React. This is not ' + 'supported and will cause errors. Instead, call ' + 'ReactDOM.unmountComponentAtNode to empty a container.'); 50731 } 50732 } 50733 } 50734 50735 var isRootRenderedBySomeReact = !!container._reactRootContainer; 50736 var rootEl = getReactRootElementInContainer(container); 50737 var hasNonRootReactChild = !!(rootEl && getInstanceFromNode$1(rootEl)); 50738 50739 if (hasNonRootReactChild && !isRootRenderedBySomeReact) { 50740 error('render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.'); 50741 } 50742 50743 if (container.nodeType === ELEMENT_NODE && container.tagName && container.tagName.toUpperCase() === 'BODY') { 50744 error('render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.'); 50745 } 50746 }; 50747} 50748 50749function getReactRootElementInContainer(container) { 50750 if (!container) { 50751 return null; 50752 } 50753 50754 if (container.nodeType === DOCUMENT_NODE) { 50755 return container.documentElement; 50756 } else { 50757 return container.firstChild; 50758 } 50759} 50760 50761function shouldHydrateDueToLegacyHeuristic(container) { 50762 var rootElement = getReactRootElementInContainer(container); 50763 return !!(rootElement && rootElement.nodeType === ELEMENT_NODE && rootElement.hasAttribute(ROOT_ATTRIBUTE_NAME)); 50764} 50765 50766function legacyCreateRootFromDOMContainer(container, forceHydrate) { 50767 var shouldHydrate = forceHydrate || shouldHydrateDueToLegacyHeuristic(container); // First clear any existing content. 50768 50769 if (!shouldHydrate) { 50770 var warned = false; 50771 var rootSibling; 50772 50773 while (rootSibling = container.lastChild) { 50774 { 50775 if (!warned && rootSibling.nodeType === ELEMENT_NODE && rootSibling.hasAttribute(ROOT_ATTRIBUTE_NAME)) { 50776 warned = true; 50777 50778 error('render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.'); 50779 } 50780 } 50781 50782 container.removeChild(rootSibling); 50783 } 50784 } 50785 50786 { 50787 if (shouldHydrate && !forceHydrate && !warnedAboutHydrateAPI) { 50788 warnedAboutHydrateAPI = true; 50789 50790 warn('render(): Calling ReactDOM.render() to hydrate server-rendered markup ' + 'will stop working in React v17. Replace the ReactDOM.render() call ' + 'with ReactDOM.hydrate() if you want React to attach to the server HTML.'); 50791 } 50792 } 50793 50794 return createLegacyRoot(container, shouldHydrate ? { 50795 hydrate: true 50796 } : undefined); 50797} 50798 50799function warnOnInvalidCallback$1(callback, callerName) { 50800 { 50801 if (callback !== null && typeof callback !== 'function') { 50802 error('%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback); 50803 } 50804 } 50805} 50806 50807function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) { 50808 { 50809 topLevelUpdateWarnings(container); 50810 warnOnInvalidCallback$1(callback === undefined ? null : callback, 'render'); 50811 } // TODO: Without `any` type, Flow says "Property cannot be accessed on any 50812 // member of intersection type." Whyyyyyy. 50813 50814 50815 var root = container._reactRootContainer; 50816 var fiberRoot; 50817 50818 if (!root) { 50819 // Initial mount 50820 root = container._reactRootContainer = legacyCreateRootFromDOMContainer(container, forceHydrate); 50821 fiberRoot = root._internalRoot; 50822 50823 if (typeof callback === 'function') { 50824 var originalCallback = callback; 50825 50826 callback = function () { 50827 var instance = getPublicRootInstance(fiberRoot); 50828 originalCallback.call(instance); 50829 }; 50830 } // Initial mount should not be batched. 50831 50832 50833 unbatchedUpdates(function () { 50834 updateContainer(children, fiberRoot, parentComponent, callback); 50835 }); 50836 } else { 50837 fiberRoot = root._internalRoot; 50838 50839 if (typeof callback === 'function') { 50840 var _originalCallback = callback; 50841 50842 callback = function () { 50843 var instance = getPublicRootInstance(fiberRoot); 50844 50845 _originalCallback.call(instance); 50846 }; 50847 } // Update 50848 50849 50850 updateContainer(children, fiberRoot, parentComponent, callback); 50851 } 50852 50853 return getPublicRootInstance(fiberRoot); 50854} 50855 50856function findDOMNode(componentOrElement) { 50857 { 50858 var owner = ReactCurrentOwner$3.current; 50859 50860 if (owner !== null && owner.stateNode !== null) { 50861 var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender; 50862 50863 if (!warnedAboutRefsInRender) { 50864 error('%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(owner.type) || 'A component'); 50865 } 50866 50867 owner.stateNode._warnedAboutRefsInRender = true; 50868 } 50869 } 50870 50871 if (componentOrElement == null) { 50872 return null; 50873 } 50874 50875 if (componentOrElement.nodeType === ELEMENT_NODE) { 50876 return componentOrElement; 50877 } 50878 50879 { 50880 return findHostInstanceWithWarning(componentOrElement, 'findDOMNode'); 50881 } 50882} 50883function hydrate(element, container, callback) { 50884 if (!isValidContainer(container)) { 50885 { 50886 throw Error( "Target container is not a DOM element." ); 50887 } 50888 } 50889 50890 { 50891 var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined; 50892 50893 if (isModernRoot) { 50894 error('You are calling ReactDOM.hydrate() on a container that was previously ' + 'passed to ReactDOM.createRoot(). This is not supported. ' + 'Did you mean to call createRoot(container, {hydrate: true}).render(element)?'); 50895 } 50896 } // TODO: throw or warn if we couldn't hydrate? 50897 50898 50899 return legacyRenderSubtreeIntoContainer(null, element, container, true, callback); 50900} 50901function render(element, container, callback) { 50902 if (!isValidContainer(container)) { 50903 { 50904 throw Error( "Target container is not a DOM element." ); 50905 } 50906 } 50907 50908 { 50909 var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined; 50910 50911 if (isModernRoot) { 50912 error('You are calling ReactDOM.render() on a container that was previously ' + 'passed to ReactDOM.createRoot(). This is not supported. ' + 'Did you mean to call root.render(element)?'); 50913 } 50914 } 50915 50916 return legacyRenderSubtreeIntoContainer(null, element, container, false, callback); 50917} 50918function unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) { 50919 if (!isValidContainer(containerNode)) { 50920 { 50921 throw Error( "Target container is not a DOM element." ); 50922 } 50923 } 50924 50925 if (!(parentComponent != null && has(parentComponent))) { 50926 { 50927 throw Error( "parentComponent must be a valid React Component" ); 50928 } 50929 } 50930 50931 return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback); 50932} 50933function unmountComponentAtNode(container) { 50934 if (!isValidContainer(container)) { 50935 { 50936 throw Error( "unmountComponentAtNode(...): Target container is not a DOM element." ); 50937 } 50938 } 50939 50940 { 50941 var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined; 50942 50943 if (isModernRoot) { 50944 error('You are calling ReactDOM.unmountComponentAtNode() on a container that was previously ' + 'passed to ReactDOM.createRoot(). This is not supported. Did you mean to call root.unmount()?'); 50945 } 50946 } 50947 50948 if (container._reactRootContainer) { 50949 { 50950 var rootEl = getReactRootElementInContainer(container); 50951 var renderedByDifferentReact = rootEl && !getInstanceFromNode$1(rootEl); 50952 50953 if (renderedByDifferentReact) { 50954 error("unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.'); 50955 } 50956 } // Unmount should not be batched. 50957 50958 50959 unbatchedUpdates(function () { 50960 legacyRenderSubtreeIntoContainer(null, null, container, false, function () { 50961 // $FlowFixMe This should probably use `delete container._reactRootContainer` 50962 container._reactRootContainer = null; 50963 unmarkContainerAsRoot(container); 50964 }); 50965 }); // If you call unmountComponentAtNode twice in quick succession, you'll 50966 // get `true` twice. That's probably fine? 50967 50968 return true; 50969 } else { 50970 { 50971 var _rootEl = getReactRootElementInContainer(container); 50972 50973 var hasNonRootReactChild = !!(_rootEl && getInstanceFromNode$1(_rootEl)); // Check if the container itself is a React root node. 50974 50975 var isContainerReactRoot = container.nodeType === ELEMENT_NODE && isValidContainer(container.parentNode) && !!container.parentNode._reactRootContainer; 50976 50977 if (hasNonRootReactChild) { 50978 error("unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.'); 50979 } 50980 } 50981 50982 return false; 50983 } 50984} 50985 50986function createPortal(children, containerInfo, // TODO: figure out the API for cross-renderer implementation. 50987implementation) { 50988 var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 50989 return { 50990 // This tag allow us to uniquely identify this as a React Portal 50991 $$typeof: REACT_PORTAL_TYPE, 50992 key: key == null ? null : '' + key, 50993 children: children, 50994 containerInfo: containerInfo, 50995 implementation: implementation 50996 }; 50997} 50998 50999var ReactVersion = '16.13.1'; 51000 51001setAttemptUserBlockingHydration(attemptUserBlockingHydration$1); 51002setAttemptContinuousHydration(attemptContinuousHydration$1); 51003setAttemptHydrationAtCurrentPriority(attemptHydrationAtCurrentPriority$1); 51004var didWarnAboutUnstableCreatePortal = false; 51005 51006{ 51007 if (typeof Map !== 'function' || // $FlowIssue Flow incorrectly thinks Map has no prototype 51008 Map.prototype == null || typeof Map.prototype.forEach !== 'function' || typeof Set !== 'function' || // $FlowIssue Flow incorrectly thinks Set has no prototype 51009 Set.prototype == null || typeof Set.prototype.clear !== 'function' || typeof Set.prototype.forEach !== 'function') { 51010 error('React depends on Map and Set built-in types. Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills'); 51011 } 51012} 51013 51014setRestoreImplementation(restoreControlledState$3); 51015setBatchingImplementation(batchedUpdates$1, discreteUpdates$1, flushDiscreteUpdates, batchedEventUpdates$1); 51016 51017function createPortal$1(children, container) { 51018 var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; 51019 51020 if (!isValidContainer(container)) { 51021 { 51022 throw Error( "Target container is not a DOM element." ); 51023 } 51024 } // TODO: pass ReactDOM portal implementation as third argument 51025 // $FlowFixMe The Flow type is opaque but there's no way to actually create it. 51026 51027 51028 return createPortal(children, container, null, key); 51029} 51030 51031function renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) { 51032 51033 return unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback); 51034} 51035 51036function unstable_createPortal(children, container) { 51037 var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; 51038 51039 { 51040 if (!didWarnAboutUnstableCreatePortal) { 51041 didWarnAboutUnstableCreatePortal = true; 51042 51043 warn('The ReactDOM.unstable_createPortal() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactDOM.createPortal() instead. It has the exact same API, ' + 'but without the "unstable_" prefix.'); 51044 } 51045 } 51046 51047 return createPortal$1(children, container, key); 51048} 51049 51050var Internals = { 51051 // Keep in sync with ReactDOMUnstableNativeDependencies.js 51052 // ReactTestUtils.js, and ReactTestUtilsAct.js. This is an array for better minification. 51053 Events: [getInstanceFromNode$1, getNodeFromInstance$1, getFiberCurrentPropsFromNode$1, injectEventPluginsByName, eventNameDispatchConfigs, accumulateTwoPhaseDispatches, accumulateDirectDispatches, enqueueStateRestore, restoreStateIfNeeded, dispatchEvent, runEventsInBatch, flushPassiveEffects, IsThisRendererActing] 51054}; 51055var foundDevTools = injectIntoDevTools({ 51056 findFiberByHostInstance: getClosestInstanceFromNode, 51057 bundleType: 1 , 51058 version: ReactVersion, 51059 rendererPackageName: 'react-dom' 51060}); 51061 51062{ 51063 if (!foundDevTools && canUseDOM && window.top === window.self) { 51064 // If we're in Chrome or Firefox, provide a download link if not installed. 51065 if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) { 51066 var protocol = window.location.protocol; // Don't warn in exotic cases like chrome-extension://. 51067 51068 if (/^(https?|file):$/.test(protocol)) { 51069 // eslint-disable-next-line react-internal/no-production-logging 51070 console.info('%cDownload the React DevTools ' + 'for a better development experience: ' + 'https://fb.me/react-devtools' + (protocol === 'file:' ? '\nYou might need to use a local HTTP server (instead of file://): ' + 'https://fb.me/react-devtools-faq' : ''), 'font-weight:bold'); 51071 } 51072 } 51073 } 51074} 51075 51076exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; 51077exports.createPortal = createPortal$1; 51078exports.findDOMNode = findDOMNode; 51079exports.flushSync = flushSync; 51080exports.hydrate = hydrate; 51081exports.render = render; 51082exports.unmountComponentAtNode = unmountComponentAtNode; 51083exports.unstable_batchedUpdates = batchedUpdates$1; 51084exports.unstable_createPortal = unstable_createPortal; 51085exports.unstable_renderSubtreeIntoContainer = renderSubtreeIntoContainer; 51086exports.version = ReactVersion; 51087 })(); 51088} 51089 51090 51091/***/ }), 51092
vendor: 1,200 bytes, lines 51093-51131
51093/***/ "./node_modules/react-dom/index.js": 51094/*!*****************************************!*\ 51095 !*** ./node_modules/react-dom/index.js ***! 51096 \*****************************************/ 51097/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 51098 51099"use strict"; 51100 51101 51102function checkDCE() { 51103 /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ 51104 if ( 51105 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' || 51106 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== 'function' 51107 ) { 51108 return; 51109 } 51110 if (true) { 51111 // This branch is unreachable because this function is only called 51112 // in production, but the condition is true only in development. 51113 // Therefore if the branch is still here, dead code elimination wasn't 51114 // properly applied. 51115 // Don't change the message. React DevTools relies on it. Also make sure 51116 // this message doesn't occur elsewhere in this function, or it will cause 51117 // a false positive. 51118 throw new Error('^_^'); 51119 } 51120 // removed by dead control flow 51121 51122} 51123 51124if (false) // removed by dead control flow 51125{} else { 51126 module.exports = __webpack_require__(/*! ./cjs/react-dom.development.js */ "./node_modules/react-dom/cjs/react-dom.development.js"); 51127} 51128 51129 51130/***/ }), 51131
vendor: 7,264 bytes, lines 51132-51323
51132/***/ "./node_modules/react-is/cjs/react-is.development.js": 51133/*!***********************************************************!*\ 51134 !*** ./node_modules/react-is/cjs/react-is.development.js ***! 51135 \***********************************************************/ 51136/***/ ((__unused_webpack_module, exports) => { 51137 51138"use strict"; 51139/** @license React v16.13.1 51140 * react-is.development.js 51141 * 51142 * Copyright (c) Facebook, Inc. and its affiliates. 51143 * 51144 * This source code is licensed under the MIT license found in the 51145 * LICENSE file in the root directory of this source tree. 51146 */ 51147 51148 51149 51150 51151 51152if (true) { 51153 (function() { 51154'use strict'; 51155 51156// The Symbol used to tag the ReactElement-like types. If there is no native Symbol 51157// nor polyfill, then a plain number is used for performance. 51158var hasSymbol = typeof Symbol === 'function' && Symbol.for; 51159var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; 51160var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; 51161var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; 51162var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; 51163var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; 51164var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; 51165var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary 51166// (unstable) APIs that have been removed. Can we remove the symbols? 51167 51168var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf; 51169var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; 51170var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; 51171var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; 51172var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; 51173var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; 51174var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; 51175var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; 51176var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; 51177var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; 51178var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; 51179 51180function isValidElementType(type) { 51181 return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. 51182 type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); 51183} 51184 51185function typeOf(object) { 51186 if (typeof object === 'object' && object !== null) { 51187 var $$typeof = object.$$typeof; 51188 51189 switch ($$typeof) { 51190 case REACT_ELEMENT_TYPE: 51191 var type = object.type; 51192 51193 switch (type) { 51194 case REACT_ASYNC_MODE_TYPE: 51195 case REACT_CONCURRENT_MODE_TYPE: 51196 case REACT_FRAGMENT_TYPE: 51197 case REACT_PROFILER_TYPE: 51198 case REACT_STRICT_MODE_TYPE: 51199 case REACT_SUSPENSE_TYPE: 51200 return type; 51201 51202 default: 51203 var $$typeofType = type && type.$$typeof; 51204 51205 switch ($$typeofType) { 51206 case REACT_CONTEXT_TYPE: 51207 case REACT_FORWARD_REF_TYPE: 51208 case REACT_LAZY_TYPE: 51209 case REACT_MEMO_TYPE: 51210 case REACT_PROVIDER_TYPE: 51211 return $$typeofType; 51212 51213 default: 51214 return $$typeof; 51215 } 51216 51217 } 51218 51219 case REACT_PORTAL_TYPE: 51220 return $$typeof; 51221 } 51222 } 51223 51224 return undefined; 51225} // AsyncMode is deprecated along with isAsyncMode 51226 51227var AsyncMode = REACT_ASYNC_MODE_TYPE; 51228var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; 51229var ContextConsumer = REACT_CONTEXT_TYPE; 51230var ContextProvider = REACT_PROVIDER_TYPE; 51231var Element = REACT_ELEMENT_TYPE; 51232var ForwardRef = REACT_FORWARD_REF_TYPE; 51233var Fragment = REACT_FRAGMENT_TYPE; 51234var Lazy = REACT_LAZY_TYPE; 51235var Memo = REACT_MEMO_TYPE; 51236var Portal = REACT_PORTAL_TYPE; 51237var Profiler = REACT_PROFILER_TYPE; 51238var StrictMode = REACT_STRICT_MODE_TYPE; 51239var Suspense = REACT_SUSPENSE_TYPE; 51240var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated 51241 51242function isAsyncMode(object) { 51243 { 51244 if (!hasWarnedAboutDeprecatedIsAsyncMode) { 51245 hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint 51246 51247 console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.'); 51248 } 51249 } 51250 51251 return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; 51252} 51253function isConcurrentMode(object) { 51254 return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; 51255} 51256function isContextConsumer(object) { 51257 return typeOf(object) === REACT_CONTEXT_TYPE; 51258} 51259function isContextProvider(object) { 51260 return typeOf(object) === REACT_PROVIDER_TYPE; 51261} 51262function isElement(object) { 51263 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; 51264} 51265function isForwardRef(object) { 51266 return typeOf(object) === REACT_FORWARD_REF_TYPE; 51267} 51268function isFragment(object) { 51269 return typeOf(object) === REACT_FRAGMENT_TYPE; 51270} 51271function isLazy(object) { 51272 return typeOf(object) === REACT_LAZY_TYPE; 51273} 51274function isMemo(object) { 51275 return typeOf(object) === REACT_MEMO_TYPE; 51276} 51277function isPortal(object) { 51278 return typeOf(object) === REACT_PORTAL_TYPE; 51279} 51280function isProfiler(object) { 51281 return typeOf(object) === REACT_PROFILER_TYPE; 51282} 51283function isStrictMode(object) { 51284 return typeOf(object) === REACT_STRICT_MODE_TYPE; 51285} 51286function isSuspense(object) { 51287 return typeOf(object) === REACT_SUSPENSE_TYPE; 51288} 51289 51290exports.AsyncMode = AsyncMode; 51291exports.ConcurrentMode = ConcurrentMode; 51292exports.ContextConsumer = ContextConsumer; 51293exports.ContextProvider = ContextProvider; 51294exports.Element = Element; 51295exports.ForwardRef = ForwardRef; 51296exports.Fragment = Fragment; 51297exports.Lazy = Lazy; 51298exports.Memo = Memo; 51299exports.Portal = Portal; 51300exports.Profiler = Profiler; 51301exports.StrictMode = StrictMode; 51302exports.Suspense = Suspense; 51303exports.isAsyncMode = isAsyncMode; 51304exports.isConcurrentMode = isConcurrentMode; 51305exports.isContextConsumer = isContextConsumer; 51306exports.isContextProvider = isContextProvider; 51307exports.isElement = isElement; 51308exports.isForwardRef = isForwardRef; 51309exports.isFragment = isFragment; 51310exports.isLazy = isLazy; 51311exports.isMemo = isMemo; 51312exports.isPortal = isPortal; 51313exports.isProfiler = isProfiler; 51314exports.isStrictMode = isStrictMode; 51315exports.isSuspense = isSuspense; 51316exports.isValidElementType = isValidElementType; 51317exports.typeOf = typeOf; 51318 })(); 51319} 51320 51321 51322/***/ }), 51323
vendor: 464 bytes, lines 51324-51340
51324/***/ "./node_modules/react-is/index.js": 51325/*!****************************************!*\ 51326 !*** ./node_modules/react-is/index.js ***! 51327 \****************************************/ 51328/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 51329 51330"use strict"; 51331 51332 51333if (false) // removed by dead control flow 51334{} else { 51335 module.exports = __webpack_require__(/*! ./cjs/react-is.development.js */ "./node_modules/react-is/cjs/react-is.development.js"); 51336} 51337 51338 51339/***/ }), 51340
vendor: 112,939 bytes, lines 51341-54035
51341/***/ "./node_modules/react-select/dist/Select-ef7c0426.esm.js": 51342/*!***************************************************************!*\ 51343 !*** ./node_modules/react-select/dist/Select-ef7c0426.esm.js ***! 51344 \***************************************************************/ 51345/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 51346 51347"use strict"; 51348__webpack_require__.r(__webpack_exports__); 51349/* harmony export */ __webpack_require__.d(__webpack_exports__, { 51350/* harmony export */ S: () => (/* binding */ Select), 51351/* harmony export */ a: () => (/* binding */ defaultProps), 51352/* harmony export */ b: () => (/* binding */ getOptionLabel$1), 51353/* harmony export */ c: () => (/* binding */ createFilter), 51354/* harmony export */ d: () => (/* binding */ defaultTheme), 51355/* harmony export */ g: () => (/* binding */ getOptionValue$1), 51356/* harmony export */ m: () => (/* binding */ mergeStyles) 51357/* harmony export */ }); 51358/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./node_modules/@babel/runtime/helpers/esm/extends.js"); 51359/* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ "./node_modules/@babel/runtime/helpers/esm/objectSpread2.js"); 51360/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/classCallCheck */ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js"); 51361/* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createClass */ "./node_modules/@babel/runtime/helpers/esm/createClass.js"); 51362/* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inherits */ "./node_modules/@babel/runtime/helpers/esm/inherits.js"); 51363/* harmony import */ var _babel_runtime_helpers_esm_createSuper__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createSuper */ "./node_modules/@babel/runtime/helpers/esm/createSuper.js"); 51364/* harmony import */ var _babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/esm/toConsumableArray */ "./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js"); 51365/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 51366/* harmony import */ var _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./index-641ee5b8.esm.js */ "./node_modules/react-select/dist/index-641ee5b8.esm.js"); 51367/* harmony import */ var _emotion_react__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @emotion/react */ "./node_modules/@emotion/react/dist/emotion-react.browser.development.esm.js"); 51368/* harmony import */ var memoize_one__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! memoize-one */ "./node_modules/memoize-one/dist/memoize-one.esm.js"); 51369/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutProperties */ "./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"); 51370 51371 51372 51373 51374 51375 51376 51377 51378 51379 51380 51381 51382 51383 51384function _EMOTION_STRINGIFIED_CSS_ERROR__$2() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } 51385 51386// Assistive text to describe visual elements. Hidden for sighted users. 51387var _ref = false ? 0 : { 51388 name: "1f43avz-a11yText-A11yText", 51389 styles: "label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap;label:A11yText;", 51390 map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkExMXlUZXh0LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPSSIsImZpbGUiOiJBMTF5VGV4dC50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKiogQGpzeCBqc3ggKi9cbmltcG9ydCB7IEpTWCB9IGZyb20gJ3JlYWN0JztcbmltcG9ydCB7IGpzeCB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuLy8gQXNzaXN0aXZlIHRleHQgdG8gZGVzY3JpYmUgdmlzdWFsIGVsZW1lbnRzLiBIaWRkZW4gZm9yIHNpZ2h0ZWQgdXNlcnMuXG5jb25zdCBBMTF5VGV4dCA9IChwcm9wczogSlNYLkludHJpbnNpY0VsZW1lbnRzWydzcGFuJ10pID0+IChcbiAgPHNwYW5cbiAgICBjc3M9e3tcbiAgICAgIGxhYmVsOiAnYTExeVRleHQnLFxuICAgICAgekluZGV4OiA5OTk5LFxuICAgICAgYm9yZGVyOiAwLFxuICAgICAgY2xpcDogJ3JlY3QoMXB4LCAxcHgsIDFweCwgMXB4KScsXG4gICAgICBoZWlnaHQ6IDEsXG4gICAgICB3aWR0aDogMSxcbiAgICAgIHBvc2l0aW9uOiAnYWJzb2x1dGUnLFxuICAgICAgb3ZlcmZsb3c6ICdoaWRkZW4nLFxuICAgICAgcGFkZGluZzogMCxcbiAgICAgIHdoaXRlU3BhY2U6ICdub3dyYXAnLFxuICAgIH19XG4gICAgey4uLnByb3BzfVxuICAvPlxuKTtcblxuZXhwb3J0IGRlZmF1bHQgQTExeVRleHQ7XG4iXX0= */", 51391 toString: _EMOTION_STRINGIFIED_CSS_ERROR__$2 51392}; 51393var A11yText = function A11yText(props) { 51394 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_9__.jsx)("span", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({ 51395 css: _ref 51396 }, props)); 51397}; 51398var A11yText$1 = A11yText; 51399 51400var defaultAriaLiveMessages = { 51401 guidance: function guidance(props) { 51402 var isSearchable = props.isSearchable, 51403 isMulti = props.isMulti, 51404 tabSelectsValue = props.tabSelectsValue, 51405 context = props.context, 51406 isInitialFocus = props.isInitialFocus; 51407 switch (context) { 51408 case 'menu': 51409 return "Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu".concat(tabSelectsValue ? ', press Tab to select the option and exit the menu' : '', "."); 51410 case 'input': 51411 return isInitialFocus ? "".concat(props['aria-label'] || 'Select', " is focused ").concat(isSearchable ? ',type to refine list' : '', ", press Down to open the menu, ").concat(isMulti ? ' press left to focus selected values' : '') : ''; 51412 case 'value': 51413 return 'Use left and right to toggle between focused values, press Backspace to remove the currently focused value'; 51414 default: 51415 return ''; 51416 } 51417 }, 51418 onChange: function onChange(props) { 51419 var action = props.action, 51420 _props$label = props.label, 51421 label = _props$label === void 0 ? '' : _props$label, 51422 labels = props.labels, 51423 isDisabled = props.isDisabled; 51424 switch (action) { 51425 case 'deselect-option': 51426 case 'pop-value': 51427 case 'remove-value': 51428 return "option ".concat(label, ", deselected."); 51429 case 'clear': 51430 return 'All selected options have been cleared.'; 51431 case 'initial-input-focus': 51432 return "option".concat(labels.length > 1 ? 's' : '', " ").concat(labels.join(','), ", selected."); 51433 case 'select-option': 51434 return isDisabled ? "option ".concat(label, " is disabled. Select another option.") : "option ".concat(label, ", selected."); 51435 default: 51436 return ''; 51437 } 51438 }, 51439 onFocus: function onFocus(props) { 51440 var context = props.context, 51441 focused = props.focused, 51442 options = props.options, 51443 _props$label2 = props.label, 51444 label = _props$label2 === void 0 ? '' : _props$label2, 51445 selectValue = props.selectValue, 51446 isDisabled = props.isDisabled, 51447 isSelected = props.isSelected, 51448 isAppleDevice = props.isAppleDevice; 51449 var getArrayIndex = function getArrayIndex(arr, item) { 51450 return arr && arr.length ? "".concat(arr.indexOf(item) + 1, " of ").concat(arr.length) : ''; 51451 }; 51452 if (context === 'value' && selectValue) { 51453 return "value ".concat(label, " focused, ").concat(getArrayIndex(selectValue, focused), "."); 51454 } 51455 if (context === 'menu' && isAppleDevice) { 51456 var disabled = isDisabled ? ' disabled' : ''; 51457 var status = "".concat(isSelected ? ' selected' : '').concat(disabled); 51458 return "".concat(label).concat(status, ", ").concat(getArrayIndex(options, focused), "."); 51459 } 51460 return ''; 51461 }, 51462 onFilter: function onFilter(props) { 51463 var inputValue = props.inputValue, 51464 resultsMessage = props.resultsMessage; 51465 return "".concat(resultsMessage).concat(inputValue ? ' for search term ' + inputValue : '', "."); 51466 } 51467}; 51468 51469var LiveRegion = function LiveRegion(props) { 51470 var ariaSelection = props.ariaSelection, 51471 focusedOption = props.focusedOption, 51472 focusedValue = props.focusedValue, 51473 focusableOptions = props.focusableOptions, 51474 isFocused = props.isFocused, 51475 selectValue = props.selectValue, 51476 selectProps = props.selectProps, 51477 id = props.id, 51478 isAppleDevice = props.isAppleDevice; 51479 var ariaLiveMessages = selectProps.ariaLiveMessages, 51480 getOptionLabel = selectProps.getOptionLabel, 51481 inputValue = selectProps.inputValue, 51482 isMulti = selectProps.isMulti, 51483 isOptionDisabled = selectProps.isOptionDisabled, 51484 isSearchable = selectProps.isSearchable, 51485 menuIsOpen = selectProps.menuIsOpen, 51486 options = selectProps.options, 51487 screenReaderStatus = selectProps.screenReaderStatus, 51488 tabSelectsValue = selectProps.tabSelectsValue, 51489 isLoading = selectProps.isLoading; 51490 var ariaLabel = selectProps['aria-label']; 51491 var ariaLive = selectProps['aria-live']; 51492 51493 // Update aria live message configuration when prop changes 51494 var messages = (0,react__WEBPACK_IMPORTED_MODULE_7__.useMemo)(function () { 51495 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])({}, defaultAriaLiveMessages), ariaLiveMessages || {}); 51496 }, [ariaLiveMessages]); 51497 51498 // Update aria live selected option when prop changes 51499 var ariaSelected = (0,react__WEBPACK_IMPORTED_MODULE_7__.useMemo)(function () { 51500 var message = ''; 51501 if (ariaSelection && messages.onChange) { 51502 var option = ariaSelection.option, 51503 selectedOptions = ariaSelection.options, 51504 removedValue = ariaSelection.removedValue, 51505 removedValues = ariaSelection.removedValues, 51506 value = ariaSelection.value; 51507 // select-option when !isMulti does not return option so we assume selected option is value 51508 var asOption = function asOption(val) { 51509 return !Array.isArray(val) ? val : null; 51510 }; 51511 51512 // If there is just one item from the action then get its label 51513 var selected = removedValue || option || asOption(value); 51514 var label = selected ? getOptionLabel(selected) : ''; 51515 51516 // If there are multiple items from the action then return an array of labels 51517 var multiSelected = selectedOptions || removedValues || undefined; 51518 var labels = multiSelected ? multiSelected.map(getOptionLabel) : []; 51519 var onChangeProps = (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])({ 51520 // multiSelected items are usually items that have already been selected 51521 // or set by the user as a default value so we assume they are not disabled 51522 isDisabled: selected && isOptionDisabled(selected, selectValue), 51523 label: label, 51524 labels: labels 51525 }, ariaSelection); 51526 message = messages.onChange(onChangeProps); 51527 } 51528 return message; 51529 }, [ariaSelection, messages, isOptionDisabled, selectValue, getOptionLabel]); 51530 var ariaFocused = (0,react__WEBPACK_IMPORTED_MODULE_7__.useMemo)(function () { 51531 var focusMsg = ''; 51532 var focused = focusedOption || focusedValue; 51533 var isSelected = !!(focusedOption && selectValue && selectValue.includes(focusedOption)); 51534 if (focused && messages.onFocus) { 51535 var onFocusProps = { 51536 focused: focused, 51537 label: getOptionLabel(focused), 51538 isDisabled: isOptionDisabled(focused, selectValue), 51539 isSelected: isSelected, 51540 options: focusableOptions, 51541 context: focused === focusedOption ? 'menu' : 'value', 51542 selectValue: selectValue, 51543 isAppleDevice: isAppleDevice 51544 }; 51545 focusMsg = messages.onFocus(onFocusProps); 51546 } 51547 return focusMsg; 51548 }, [focusedOption, focusedValue, getOptionLabel, isOptionDisabled, messages, focusableOptions, selectValue, isAppleDevice]); 51549 var ariaResults = (0,react__WEBPACK_IMPORTED_MODULE_7__.useMemo)(function () { 51550 var resultsMsg = ''; 51551 if (menuIsOpen && options.length && !isLoading && messages.onFilter) { 51552 var resultsMessage = screenReaderStatus({ 51553 count: focusableOptions.length 51554 }); 51555 resultsMsg = messages.onFilter({ 51556 inputValue: inputValue, 51557 resultsMessage: resultsMessage 51558 }); 51559 } 51560 return resultsMsg; 51561 }, [focusableOptions, inputValue, menuIsOpen, messages, options, screenReaderStatus, isLoading]); 51562 var isInitialFocus = (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === 'initial-input-focus'; 51563 var ariaGuidance = (0,react__WEBPACK_IMPORTED_MODULE_7__.useMemo)(function () { 51564 var guidanceMsg = ''; 51565 if (messages.guidance) { 51566 var context = focusedValue ? 'value' : menuIsOpen ? 'menu' : 'input'; 51567 guidanceMsg = messages.guidance({ 51568 'aria-label': ariaLabel, 51569 context: context, 51570 isDisabled: focusedOption && isOptionDisabled(focusedOption, selectValue), 51571 isMulti: isMulti, 51572 isSearchable: isSearchable, 51573 tabSelectsValue: tabSelectsValue, 51574 isInitialFocus: isInitialFocus 51575 }); 51576 } 51577 return guidanceMsg; 51578 }, [ariaLabel, focusedOption, focusedValue, isMulti, isOptionDisabled, isSearchable, menuIsOpen, messages, selectValue, tabSelectsValue, isInitialFocus]); 51579 var ScreenReaderText = (0,_emotion_react__WEBPACK_IMPORTED_MODULE_9__.jsx)(react__WEBPACK_IMPORTED_MODULE_7__.Fragment, null, (0,_emotion_react__WEBPACK_IMPORTED_MODULE_9__.jsx)("span", { 51580 id: "aria-selection" 51581 }, ariaSelected), (0,_emotion_react__WEBPACK_IMPORTED_MODULE_9__.jsx)("span", { 51582 id: "aria-focused" 51583 }, ariaFocused), (0,_emotion_react__WEBPACK_IMPORTED_MODULE_9__.jsx)("span", { 51584 id: "aria-results" 51585 }, ariaResults), (0,_emotion_react__WEBPACK_IMPORTED_MODULE_9__.jsx)("span", { 51586 id: "aria-guidance" 51587 }, ariaGuidance)); 51588 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_9__.jsx)(react__WEBPACK_IMPORTED_MODULE_7__.Fragment, null, (0,_emotion_react__WEBPACK_IMPORTED_MODULE_9__.jsx)(A11yText$1, { 51589 id: id 51590 }, isInitialFocus && ScreenReaderText), (0,_emotion_react__WEBPACK_IMPORTED_MODULE_9__.jsx)(A11yText$1, { 51591 "aria-live": ariaLive, 51592 "aria-atomic": "false", 51593 "aria-relevant": "additions text", 51594 role: "log" 51595 }, isFocused && !isInitialFocus && ScreenReaderText)); 51596}; 51597var LiveRegion$1 = LiveRegion; 51598 51599var diacritics = [{ 51600 base: 'A', 51601 letters: "A\u24B6\uFF21\xC0\xC1\xC2\u1EA6\u1EA4\u1EAA\u1EA8\xC3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\xC4\u01DE\u1EA2\xC5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F" 51602}, { 51603 base: 'AA', 51604 letters: "\uA732" 51605}, { 51606 base: 'AE', 51607 letters: "\xC6\u01FC\u01E2" 51608}, { 51609 base: 'AO', 51610 letters: "\uA734" 51611}, { 51612 base: 'AU', 51613 letters: "\uA736" 51614}, { 51615 base: 'AV', 51616 letters: "\uA738\uA73A" 51617}, { 51618 base: 'AY', 51619 letters: "\uA73C" 51620}, { 51621 base: 'B', 51622 letters: "B\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181" 51623}, { 51624 base: 'C', 51625 letters: "C\u24B8\uFF23\u0106\u0108\u010A\u010C\xC7\u1E08\u0187\u023B\uA73E" 51626}, { 51627 base: 'D', 51628 letters: "D\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779" 51629}, { 51630 base: 'DZ', 51631 letters: "\u01F1\u01C4" 51632}, { 51633 base: 'Dz', 51634 letters: "\u01F2\u01C5" 51635}, { 51636 base: 'E', 51637 letters: "E\u24BA\uFF25\xC8\xC9\xCA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\xCB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E" 51638}, { 51639 base: 'F', 51640 letters: "F\u24BB\uFF26\u1E1E\u0191\uA77B" 51641}, { 51642 base: 'G', 51643 letters: "G\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E" 51644}, { 51645 base: 'H', 51646 letters: "H\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D" 51647}, { 51648 base: 'I', 51649 letters: "I\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197" 51650}, { 51651 base: 'J', 51652 letters: "J\u24BF\uFF2A\u0134\u0248" 51653}, { 51654 base: 'K', 51655 letters: "K\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2" 51656}, { 51657 base: 'L', 51658 letters: "L\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780" 51659}, { 51660 base: 'LJ', 51661 letters: "\u01C7" 51662}, { 51663 base: 'Lj', 51664 letters: "\u01C8" 51665}, { 51666 base: 'M', 51667 letters: "M\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C" 51668}, { 51669 base: 'N', 51670 letters: "N\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4" 51671}, { 51672 base: 'NJ', 51673 letters: "\u01CA" 51674}, { 51675 base: 'Nj', 51676 letters: "\u01CB" 51677}, { 51678 base: 'O', 51679 letters: "O\u24C4\uFF2F\xD2\xD3\xD4\u1ED2\u1ED0\u1ED6\u1ED4\xD5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\xD6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\xD8\u01FE\u0186\u019F\uA74A\uA74C" 51680}, { 51681 base: 'OI', 51682 letters: "\u01A2" 51683}, { 51684 base: 'OO', 51685 letters: "\uA74E" 51686}, { 51687 base: 'OU', 51688 letters: "\u0222" 51689}, { 51690 base: 'P', 51691 letters: "P\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754" 51692}, { 51693 base: 'Q', 51694 letters: "Q\u24C6\uFF31\uA756\uA758\u024A" 51695}, { 51696 base: 'R', 51697 letters: "R\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782" 51698}, { 51699 base: 'S', 51700 letters: "S\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784" 51701}, { 51702 base: 'T', 51703 letters: "T\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786" 51704}, { 51705 base: 'TZ', 51706 letters: "\uA728" 51707}, { 51708 base: 'U', 51709 letters: "U\u24CA\uFF35\xD9\xDA\xDB\u0168\u1E78\u016A\u1E7A\u016C\xDC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244" 51710}, { 51711 base: 'V', 51712 letters: "V\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245" 51713}, { 51714 base: 'VY', 51715 letters: "\uA760" 51716}, { 51717 base: 'W', 51718 letters: "W\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72" 51719}, { 51720 base: 'X', 51721 letters: "X\u24CD\uFF38\u1E8A\u1E8C" 51722}, { 51723 base: 'Y', 51724 letters: "Y\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE" 51725}, { 51726 base: 'Z', 51727 letters: "Z\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762" 51728}, { 51729 base: 'a', 51730 letters: "a\u24D0\uFF41\u1E9A\xE0\xE1\xE2\u1EA7\u1EA5\u1EAB\u1EA9\xE3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\xE4\u01DF\u1EA3\xE5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250" 51731}, { 51732 base: 'aa', 51733 letters: "\uA733" 51734}, { 51735 base: 'ae', 51736 letters: "\xE6\u01FD\u01E3" 51737}, { 51738 base: 'ao', 51739 letters: "\uA735" 51740}, { 51741 base: 'au', 51742 letters: "\uA737" 51743}, { 51744 base: 'av', 51745 letters: "\uA739\uA73B" 51746}, { 51747 base: 'ay', 51748 letters: "\uA73D" 51749}, { 51750 base: 'b', 51751 letters: "b\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253" 51752}, { 51753 base: 'c', 51754 letters: "c\u24D2\uFF43\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184" 51755}, { 51756 base: 'd', 51757 letters: "d\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A" 51758}, { 51759 base: 'dz', 51760 letters: "\u01F3\u01C6" 51761}, { 51762 base: 'e', 51763 letters: "e\u24D4\uFF45\xE8\xE9\xEA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\xEB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD" 51764}, { 51765 base: 'f', 51766 letters: "f\u24D5\uFF46\u1E1F\u0192\uA77C" 51767}, { 51768 base: 'g', 51769 letters: "g\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F" 51770}, { 51771 base: 'h', 51772 letters: "h\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265" 51773}, { 51774 base: 'hv', 51775 letters: "\u0195" 51776}, { 51777 base: 'i', 51778 letters: "i\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131" 51779}, { 51780 base: 'j', 51781 letters: "j\u24D9\uFF4A\u0135\u01F0\u0249" 51782}, { 51783 base: 'k', 51784 letters: "k\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3" 51785}, { 51786 base: 'l', 51787 letters: "l\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747" 51788}, { 51789 base: 'lj', 51790 letters: "\u01C9" 51791}, { 51792 base: 'm', 51793 letters: "m\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F" 51794}, { 51795 base: 'n', 51796 letters: "n\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5" 51797}, { 51798 base: 'nj', 51799 letters: "\u01CC" 51800}, { 51801 base: 'o', 51802 letters: "o\u24DE\uFF4F\xF2\xF3\xF4\u1ED3\u1ED1\u1ED7\u1ED5\xF5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\xF6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\xF8\u01FF\u0254\uA74B\uA74D\u0275" 51803}, { 51804 base: 'oi', 51805 letters: "\u01A3" 51806}, { 51807 base: 'ou', 51808 letters: "\u0223" 51809}, { 51810 base: 'oo', 51811 letters: "\uA74F" 51812}, { 51813 base: 'p', 51814 letters: "p\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755" 51815}, { 51816 base: 'q', 51817 letters: "q\u24E0\uFF51\u024B\uA757\uA759" 51818}, { 51819 base: 'r', 51820 letters: "r\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783" 51821}, { 51822 base: 's', 51823 letters: "s\u24E2\uFF53\xDF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B" 51824}, { 51825 base: 't', 51826 letters: "t\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787" 51827}, { 51828 base: 'tz', 51829 letters: "\uA729" 51830}, { 51831 base: 'u', 51832 letters: "u\u24E4\uFF55\xF9\xFA\xFB\u0169\u1E79\u016B\u1E7B\u016D\xFC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289" 51833}, { 51834 base: 'v', 51835 letters: "v\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C" 51836}, { 51837 base: 'vy', 51838 letters: "\uA761" 51839}, { 51840 base: 'w', 51841 letters: "w\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73" 51842}, { 51843 base: 'x', 51844 letters: "x\u24E7\uFF58\u1E8B\u1E8D" 51845}, { 51846 base: 'y', 51847 letters: "y\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF" 51848}, { 51849 base: 'z', 51850 letters: "z\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763" 51851}]; 51852var anyDiacritic = new RegExp('[' + diacritics.map(function (d) { 51853 return d.letters; 51854}).join('') + ']', 'g'); 51855var diacriticToBase = {}; 51856for (var i = 0; i < diacritics.length; i++) { 51857 var diacritic = diacritics[i]; 51858 for (var j = 0; j < diacritic.letters.length; j++) { 51859 diacriticToBase[diacritic.letters[j]] = diacritic.base; 51860 } 51861} 51862var stripDiacritics = function stripDiacritics(str) { 51863 return str.replace(anyDiacritic, function (match) { 51864 return diacriticToBase[match]; 51865 }); 51866}; 51867 51868var memoizedStripDiacriticsForInput = (0,memoize_one__WEBPACK_IMPORTED_MODULE_10__["default"])(stripDiacritics); 51869var trimString = function trimString(str) { 51870 return str.replace(/^\s+|\s+$/g, ''); 51871}; 51872var defaultStringify = function defaultStringify(option) { 51873 return "".concat(option.label, " ").concat(option.value); 51874}; 51875var createFilter = function createFilter(config) { 51876 return function (option, rawInput) { 51877 // eslint-disable-next-line no-underscore-dangle 51878 if (option.data.__isNew__) return true; 51879 var _ignoreCase$ignoreAcc = (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])({ 51880 ignoreCase: true, 51881 ignoreAccents: true, 51882 stringify: defaultStringify, 51883 trim: true, 51884 matchFrom: 'any' 51885 }, config), 51886 ignoreCase = _ignoreCase$ignoreAcc.ignoreCase, 51887 ignoreAccents = _ignoreCase$ignoreAcc.ignoreAccents, 51888 stringify = _ignoreCase$ignoreAcc.stringify, 51889 trim = _ignoreCase$ignoreAcc.trim, 51890 matchFrom = _ignoreCase$ignoreAcc.matchFrom; 51891 var input = trim ? trimString(rawInput) : rawInput; 51892 var candidate = trim ? trimString(stringify(option)) : stringify(option); 51893 if (ignoreCase) { 51894 input = input.toLowerCase(); 51895 candidate = candidate.toLowerCase(); 51896 } 51897 if (ignoreAccents) { 51898 input = memoizedStripDiacriticsForInput(input); 51899 candidate = stripDiacritics(candidate); 51900 } 51901 return matchFrom === 'start' ? candidate.substr(0, input.length) === input : candidate.indexOf(input) > -1; 51902 }; 51903}; 51904 51905var _excluded = ["innerRef"]; 51906function DummyInput(_ref) { 51907 var innerRef = _ref.innerRef, 51908 props = (0,_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_11__["default"])(_ref, _excluded); 51909 // Remove animation props not meant for HTML elements 51910 var filteredProps = (0,_index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.r)(props, 'onExited', 'in', 'enter', 'exit', 'appear'); 51911 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_9__.jsx)("input", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({ 51912 ref: innerRef 51913 }, filteredProps, { 51914 css: /*#__PURE__*/(0,_emotion_react__WEBPACK_IMPORTED_MODULE_9__.css)({ 51915 label: 'dummyInput', 51916 // get rid of any default styles 51917 background: 0, 51918 border: 0, 51919 // important! this hides the flashing cursor 51920 caretColor: 'transparent', 51921 fontSize: 'inherit', 51922 gridArea: '1 / 1 / 2 / 3', 51923 outline: 0, 51924 padding: 0, 51925 // important! without `width` browsers won't allow focus 51926 width: 1, 51927 // remove cursor on desktop 51928 color: 'transparent', 51929 // remove cursor on mobile whilst maintaining "scroll into view" behaviour 51930 left: -100, 51931 opacity: 0, 51932 position: 'relative', 51933 transform: 'scale(.01)' 51934 }, false ? 0 : ";label:DummyInput;", false ? 0 : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkR1bW15SW5wdXQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXlCTSIsImZpbGUiOiJEdW1teUlucHV0LnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBAanN4IGpzeCAqL1xuaW1wb3J0IHsgSlNYLCBSZWYgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgeyBqc3ggfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5pbXBvcnQgeyByZW1vdmVQcm9wcyB9IGZyb20gJy4uL3V0aWxzJztcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gRHVtbXlJbnB1dCh7XG4gIGlubmVyUmVmLFxuICAuLi5wcm9wc1xufTogSlNYLkludHJpbnNpY0VsZW1lbnRzWydpbnB1dCddICYge1xuICByZWFkb25seSBpbm5lclJlZjogUmVmPEhUTUxJbnB1dEVsZW1lbnQ+O1xufSkge1xuICAvLyBSZW1vdmUgYW5pbWF0aW9uIHByb3BzIG5vdCBtZWFudCBmb3IgSFRNTCBlbGVtZW50c1xuICBjb25zdCBmaWx0ZXJlZFByb3BzID0gcmVtb3ZlUHJvcHMoXG4gICAgcHJvcHMsXG4gICAgJ29uRXhpdGVkJyxcbiAgICAnaW4nLFxuICAgICdlbnRlcicsXG4gICAgJ2V4aXQnLFxuICAgICdhcHBlYXInXG4gICk7XG5cbiAgcmV0dXJuIChcbiAgICA8aW5wdXRcbiAgICAgIHJlZj17aW5uZXJSZWZ9XG4gICAgICB7Li4uZmlsdGVyZWRQcm9wc31cbiAgICAgIGNzcz17e1xuICAgICAgICBsYWJlbDogJ2R1bW15SW5wdXQnLFxuICAgICAgICAvLyBnZXQgcmlkIG9mIGFueSBkZWZhdWx0IHN0eWxlc1xuICAgICAgICBiYWNrZ3JvdW5kOiAwLFxuICAgICAgICBib3JkZXI6IDAsXG4gICAgICAgIC8vIGltcG9ydGFudCEgdGhpcyBoaWRlcyB0aGUgZmxhc2hpbmcgY3Vyc29yXG4gICAgICAgIGNhcmV0Q29sb3I6ICd0cmFuc3BhcmVudCcsXG4gICAgICAgIGZvbnRTaXplOiAnaW5oZXJpdCcsXG4gICAgICAgIGdyaWRBcmVhOiAnMSAvIDEgLyAyIC8gMycsXG4gICAgICAgIG91dGxpbmU6IDAsXG4gICAgICAgIHBhZGRpbmc6IDAsXG4gICAgICAgIC8vIGltcG9ydGFudCEgd2l0aG91dCBgd2lkdGhgIGJyb3dzZXJzIHdvbid0IGFsbG93IGZvY3VzXG4gICAgICAgIHdpZHRoOiAxLFxuXG4gICAgICAgIC8vIHJlbW92ZSBjdXJzb3Igb24gZGVza3RvcFxuICAgICAgICBjb2xvcjogJ3RyYW5zcGFyZW50JyxcblxuICAgICAgICAvLyByZW1vdmUgY3Vyc29yIG9uIG1vYmlsZSB3aGlsc3QgbWFpbnRhaW5pbmcgXCJzY3JvbGwgaW50byB2aWV3XCIgYmVoYXZpb3VyXG4gICAgICAgIGxlZnQ6IC0xMDAsXG4gICAgICAgIG9wYWNpdHk6IDAsXG4gICAgICAgIHBvc2l0aW9uOiAncmVsYXRpdmUnLFxuICAgICAgICB0cmFuc2Zvcm06ICdzY2FsZSguMDEpJyxcbiAgICAgIH19XG4gICAgLz5cbiAgKTtcbn1cbiJdfQ== */") 51935 })); 51936} 51937 51938var cancelScroll = function cancelScroll(event) { 51939 if (event.cancelable) event.preventDefault(); 51940 event.stopPropagation(); 51941}; 51942function useScrollCapture(_ref) { 51943 var isEnabled = _ref.isEnabled, 51944 onBottomArrive = _ref.onBottomArrive, 51945 onBottomLeave = _ref.onBottomLeave, 51946 onTopArrive = _ref.onTopArrive, 51947 onTopLeave = _ref.onTopLeave; 51948 var isBottom = (0,react__WEBPACK_IMPORTED_MODULE_7__.useRef)(false); 51949 var isTop = (0,react__WEBPACK_IMPORTED_MODULE_7__.useRef)(false); 51950 var touchStart = (0,react__WEBPACK_IMPORTED_MODULE_7__.useRef)(0); 51951 var scrollTarget = (0,react__WEBPACK_IMPORTED_MODULE_7__.useRef)(null); 51952 var handleEventDelta = (0,react__WEBPACK_IMPORTED_MODULE_7__.useCallback)(function (event, delta) { 51953 if (scrollTarget.current === null) return; 51954 var _scrollTarget$current = scrollTarget.current, 51955 scrollTop = _scrollTarget$current.scrollTop, 51956 scrollHeight = _scrollTarget$current.scrollHeight, 51957 clientHeight = _scrollTarget$current.clientHeight; 51958 var target = scrollTarget.current; 51959 var isDeltaPositive = delta > 0; 51960 var availableScroll = scrollHeight - clientHeight - scrollTop; 51961 var shouldCancelScroll = false; 51962 51963 // reset bottom/top flags 51964 if (availableScroll > delta && isBottom.current) { 51965 if (onBottomLeave) onBottomLeave(event); 51966 isBottom.current = false; 51967 } 51968 if (isDeltaPositive && isTop.current) { 51969 if (onTopLeave) onTopLeave(event); 51970 isTop.current = false; 51971 } 51972 51973 // bottom limit 51974 if (isDeltaPositive && delta > availableScroll) { 51975 if (onBottomArrive && !isBottom.current) { 51976 onBottomArrive(event); 51977 } 51978 target.scrollTop = scrollHeight; 51979 shouldCancelScroll = true; 51980 isBottom.current = true; 51981 51982 // top limit 51983 } else if (!isDeltaPositive && -delta > scrollTop) { 51984 if (onTopArrive && !isTop.current) { 51985 onTopArrive(event); 51986 } 51987 target.scrollTop = 0; 51988 shouldCancelScroll = true; 51989 isTop.current = true; 51990 } 51991 51992 // cancel scroll 51993 if (shouldCancelScroll) { 51994 cancelScroll(event); 51995 } 51996 }, [onBottomArrive, onBottomLeave, onTopArrive, onTopLeave]); 51997 var onWheel = (0,react__WEBPACK_IMPORTED_MODULE_7__.useCallback)(function (event) { 51998 handleEventDelta(event, event.deltaY); 51999 }, [handleEventDelta]); 52000 var onTouchStart = (0,react__WEBPACK_IMPORTED_MODULE_7__.useCallback)(function (event) { 52001 // set touch start so we can calculate touchmove delta 52002 touchStart.current = event.changedTouches[0].clientY; 52003 }, []); 52004 var onTouchMove = (0,react__WEBPACK_IMPORTED_MODULE_7__.useCallback)(function (event) { 52005 var deltaY = touchStart.current - event.changedTouches[0].clientY; 52006 handleEventDelta(event, deltaY); 52007 }, [handleEventDelta]); 52008 var startListening = (0,react__WEBPACK_IMPORTED_MODULE_7__.useCallback)(function (el) { 52009 // bail early if no element is available to attach to 52010 if (!el) return; 52011 var notPassive = _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.s ? { 52012 passive: false 52013 } : false; 52014 el.addEventListener('wheel', onWheel, notPassive); 52015 el.addEventListener('touchstart', onTouchStart, notPassive); 52016 el.addEventListener('touchmove', onTouchMove, notPassive); 52017 }, [onTouchMove, onTouchStart, onWheel]); 52018 var stopListening = (0,react__WEBPACK_IMPORTED_MODULE_7__.useCallback)(function (el) { 52019 // bail early if no element is available to detach from 52020 if (!el) return; 52021 el.removeEventListener('wheel', onWheel, false); 52022 el.removeEventListener('touchstart', onTouchStart, false); 52023 el.removeEventListener('touchmove', onTouchMove, false); 52024 }, [onTouchMove, onTouchStart, onWheel]); 52025 (0,react__WEBPACK_IMPORTED_MODULE_7__.useEffect)(function () { 52026 if (!isEnabled) return; 52027 var element = scrollTarget.current; 52028 startListening(element); 52029 return function () { 52030 stopListening(element); 52031 }; 52032 }, [isEnabled, startListening, stopListening]); 52033 return function (element) { 52034 scrollTarget.current = element; 52035 }; 52036} 52037 52038var STYLE_KEYS = ['boxSizing', 'height', 'overflow', 'paddingRight', 'position']; 52039var LOCK_STYLES = { 52040 boxSizing: 'border-box', 52041 // account for possible declaration `width: 100%;` on body 52042 overflow: 'hidden', 52043 position: 'relative', 52044 height: '100%' 52045}; 52046function preventTouchMove(e) { 52047 if (e.cancelable) e.preventDefault(); 52048} 52049function allowTouchMove(e) { 52050 e.stopPropagation(); 52051} 52052function preventInertiaScroll() { 52053 var top = this.scrollTop; 52054 var totalScroll = this.scrollHeight; 52055 var currentScroll = top + this.offsetHeight; 52056 if (top === 0) { 52057 this.scrollTop = 1; 52058 } else if (currentScroll === totalScroll) { 52059 this.scrollTop = top - 1; 52060 } 52061} 52062 52063// `ontouchstart` check works on most browsers 52064// `maxTouchPoints` works on IE10/11 and Surface 52065function isTouchDevice() { 52066 return 'ontouchstart' in window || navigator.maxTouchPoints; 52067} 52068var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); 52069var activeScrollLocks = 0; 52070var listenerOptions = { 52071 capture: false, 52072 passive: false 52073}; 52074function useScrollLock(_ref) { 52075 var isEnabled = _ref.isEnabled, 52076 _ref$accountForScroll = _ref.accountForScrollbars, 52077 accountForScrollbars = _ref$accountForScroll === void 0 ? true : _ref$accountForScroll; 52078 var originalStyles = (0,react__WEBPACK_IMPORTED_MODULE_7__.useRef)({}); 52079 var scrollTarget = (0,react__WEBPACK_IMPORTED_MODULE_7__.useRef)(null); 52080 var addScrollLock = (0,react__WEBPACK_IMPORTED_MODULE_7__.useCallback)(function (touchScrollTarget) { 52081 if (!canUseDOM) return; 52082 var target = document.body; 52083 var targetStyle = target && target.style; 52084 if (accountForScrollbars) { 52085 // store any styles already applied to the body 52086 STYLE_KEYS.forEach(function (key) { 52087 var val = targetStyle && targetStyle[key]; 52088 originalStyles.current[key] = val; 52089 }); 52090 } 52091 52092 // apply the lock styles and padding if this is the first scroll lock 52093 if (accountForScrollbars && activeScrollLocks < 1) { 52094 var currentPadding = parseInt(originalStyles.current.paddingRight, 10) || 0; 52095 var clientWidth = document.body ? document.body.clientWidth : 0; 52096 var adjustedPadding = window.innerWidth - clientWidth + currentPadding || 0; 52097 Object.keys(LOCK_STYLES).forEach(function (key) { 52098 var val = LOCK_STYLES[key]; 52099 if (targetStyle) { 52100 targetStyle[key] = val; 52101 } 52102 }); 52103 if (targetStyle) { 52104 targetStyle.paddingRight = "".concat(adjustedPadding, "px"); 52105 } 52106 } 52107 52108 // account for touch devices 52109 if (target && isTouchDevice()) { 52110 // Mobile Safari ignores { overflow: hidden } declaration on the body. 52111 target.addEventListener('touchmove', preventTouchMove, listenerOptions); 52112 52113 // Allow scroll on provided target 52114 if (touchScrollTarget) { 52115 touchScrollTarget.addEventListener('touchstart', preventInertiaScroll, listenerOptions); 52116 touchScrollTarget.addEventListener('touchmove', allowTouchMove, listenerOptions); 52117 } 52118 } 52119 52120 // increment active scroll locks 52121 activeScrollLocks += 1; 52122 }, [accountForScrollbars]); 52123 var removeScrollLock = (0,react__WEBPACK_IMPORTED_MODULE_7__.useCallback)(function (touchScrollTarget) { 52124 if (!canUseDOM) return; 52125 var target = document.body; 52126 var targetStyle = target && target.style; 52127 52128 // safely decrement active scroll locks 52129 activeScrollLocks = Math.max(activeScrollLocks - 1, 0); 52130 52131 // reapply original body styles, if any 52132 if (accountForScrollbars && activeScrollLocks < 1) { 52133 STYLE_KEYS.forEach(function (key) { 52134 var val = originalStyles.current[key]; 52135 if (targetStyle) { 52136 targetStyle[key] = val; 52137 } 52138 }); 52139 } 52140 52141 // remove touch listeners 52142 if (target && isTouchDevice()) { 52143 target.removeEventListener('touchmove', preventTouchMove, listenerOptions); 52144 if (touchScrollTarget) { 52145 touchScrollTarget.removeEventListener('touchstart', preventInertiaScroll, listenerOptions); 52146 touchScrollTarget.removeEventListener('touchmove', allowTouchMove, listenerOptions); 52147 } 52148 } 52149 }, [accountForScrollbars]); 52150 (0,react__WEBPACK_IMPORTED_MODULE_7__.useEffect)(function () { 52151 if (!isEnabled) return; 52152 var element = scrollTarget.current; 52153 addScrollLock(element); 52154 return function () { 52155 removeScrollLock(element); 52156 }; 52157 }, [isEnabled, addScrollLock, removeScrollLock]); 52158 return function (element) { 52159 scrollTarget.current = element; 52160 }; 52161} 52162 52163function _EMOTION_STRINGIFIED_CSS_ERROR__$1() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } 52164var blurSelectInput = function blurSelectInput(event) { 52165 var element = event.target; 52166 return element.ownerDocument.activeElement && element.ownerDocument.activeElement.blur(); 52167}; 52168var _ref2$1 = false ? 0 : { 52169 name: "bp8cua-ScrollManager", 52170 styles: "position:fixed;left:0;bottom:0;right:0;top:0;label:ScrollManager;", 52171 map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlNjcm9sbE1hbmFnZXIudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQW9EVSIsImZpbGUiOiJTY3JvbGxNYW5hZ2VyLnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBAanN4IGpzeCAqL1xuaW1wb3J0IHsganN4IH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHsgRnJhZ21lbnQsIFJlYWN0RWxlbWVudCwgUmVmQ2FsbGJhY2ssIE1vdXNlRXZlbnQgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgdXNlU2Nyb2xsQ2FwdHVyZSBmcm9tICcuL3VzZVNjcm9sbENhcHR1cmUnO1xuaW1wb3J0IHVzZVNjcm9sbExvY2sgZnJvbSAnLi91c2VTY3JvbGxMb2NrJztcblxuaW50ZXJmYWNlIFByb3BzIHtcbiAgcmVhZG9ubHkgY2hpbGRyZW46IChyZWY6IFJlZkNhbGxiYWNrPEhUTUxFbGVtZW50PikgPT4gUmVhY3RFbGVtZW50O1xuICByZWFkb25seSBsb2NrRW5hYmxlZDogYm9vbGVhbjtcbiAgcmVhZG9ubHkgY2FwdHVyZUVuYWJsZWQ6IGJvb2xlYW47XG4gIHJlYWRvbmx5IG9uQm90dG9tQXJyaXZlPzogKGV2ZW50OiBXaGVlbEV2ZW50IHwgVG91Y2hFdmVudCkgPT4gdm9pZDtcbiAgcmVhZG9ubHkgb25Cb3R0b21MZWF2ZT86IChldmVudDogV2hlZWxFdmVudCB8IFRvdWNoRXZlbnQpID0+IHZvaWQ7XG4gIHJlYWRvbmx5IG9uVG9wQXJyaXZlPzogKGV2ZW50OiBXaGVlbEV2ZW50IHwgVG91Y2hFdmVudCkgPT4gdm9pZDtcbiAgcmVhZG9ubHkgb25Ub3BMZWF2ZT86IChldmVudDogV2hlZWxFdmVudCB8IFRvdWNoRXZlbnQpID0+IHZvaWQ7XG59XG5cbmNvbnN0IGJsdXJTZWxlY3RJbnB1dCA9IChldmVudDogTW91c2VFdmVudDxIVE1MRGl2RWxlbWVudD4pID0+IHtcbiAgY29uc3QgZWxlbWVudCA9IGV2ZW50LnRhcmdldCBhcyBIVE1MRGl2RWxlbWVudDtcbiAgcmV0dXJuIChcbiAgICBlbGVtZW50Lm93bmVyRG9jdW1lbnQuYWN0aXZlRWxlbWVudCAmJlxuICAgIChlbGVtZW50Lm93bmVyRG9jdW1lbnQuYWN0aXZlRWxlbWVudCBhcyBIVE1MRWxlbWVudCkuYmx1cigpXG4gICk7XG59O1xuXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBTY3JvbGxNYW5hZ2VyKHtcbiAgY2hpbGRyZW4sXG4gIGxvY2tFbmFibGVkLFxuICBjYXB0dXJlRW5hYmxlZCA9IHRydWUsXG4gIG9uQm90dG9tQXJyaXZlLFxuICBvbkJvdHRvbUxlYXZlLFxuICBvblRvcEFycml2ZSxcbiAgb25Ub3BMZWF2ZSxcbn06IFByb3BzKSB7XG4gIGNvbnN0IHNldFNjcm9sbENhcHR1cmVUYXJnZXQgPSB1c2VTY3JvbGxDYXB0dXJlKHtcbiAgICBpc0VuYWJsZWQ6IGNhcHR1cmVFbmFibGVkLFxuICAgIG9uQm90dG9tQXJyaXZlLFxuICAgIG9uQm90dG9tTGVhdmUsXG4gICAgb25Ub3BBcnJpdmUsXG4gICAgb25Ub3BMZWF2ZSxcbiAgfSk7XG4gIGNvbnN0IHNldFNjcm9sbExvY2tUYXJnZXQgPSB1c2VTY3JvbGxMb2NrKHsgaXNFbmFibGVkOiBsb2NrRW5hYmxlZCB9KTtcblxuICBjb25zdCB0YXJnZXRSZWY6IFJlZkNhbGxiYWNrPEhUTUxFbGVtZW50PiA9IChlbGVtZW50KSA9PiB7XG4gICAgc2V0U2Nyb2xsQ2FwdHVyZVRhcmdldChlbGVtZW50KTtcbiAgICBzZXRTY3JvbGxMb2NrVGFyZ2V0KGVsZW1lbnQpO1xuICB9O1xuXG4gIHJldHVybiAoXG4gICAgPEZyYWdtZW50PlxuICAgICAge2xvY2tFbmFibGVkICYmIChcbiAgICAgICAgPGRpdlxuICAgICAgICAgIG9uQ2xpY2s9e2JsdXJTZWxlY3RJbnB1dH1cbiAgICAgICAgICBjc3M9e3sgcG9zaXRpb246ICdmaXhlZCcsIGxlZnQ6IDAsIGJvdHRvbTogMCwgcmlnaHQ6IDAsIHRvcDogMCB9fVxuICAgICAgICAvPlxuICAgICAgKX1cbiAgICAgIHtjaGlsZHJlbih0YXJnZXRSZWYpfVxuICAgIDwvRnJhZ21lbnQ+XG4gICk7XG59XG4iXX0= */", 52172 toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1 52173}; 52174function ScrollManager(_ref) { 52175 var children = _ref.children, 52176 lockEnabled = _ref.lockEnabled, 52177 _ref$captureEnabled = _ref.captureEnabled, 52178 captureEnabled = _ref$captureEnabled === void 0 ? true : _ref$captureEnabled, 52179 onBottomArrive = _ref.onBottomArrive, 52180 onBottomLeave = _ref.onBottomLeave, 52181 onTopArrive = _ref.onTopArrive, 52182 onTopLeave = _ref.onTopLeave; 52183 var setScrollCaptureTarget = useScrollCapture({ 52184 isEnabled: captureEnabled, 52185 onBottomArrive: onBottomArrive, 52186 onBottomLeave: onBottomLeave, 52187 onTopArrive: onTopArrive, 52188 onTopLeave: onTopLeave 52189 }); 52190 var setScrollLockTarget = useScrollLock({ 52191 isEnabled: lockEnabled 52192 }); 52193 var targetRef = function targetRef(element) { 52194 setScrollCaptureTarget(element); 52195 setScrollLockTarget(element); 52196 }; 52197 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_9__.jsx)(react__WEBPACK_IMPORTED_MODULE_7__.Fragment, null, lockEnabled && (0,_emotion_react__WEBPACK_IMPORTED_MODULE_9__.jsx)("div", { 52198 onClick: blurSelectInput, 52199 css: _ref2$1 52200 }), children(targetRef)); 52201} 52202 52203function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } 52204var _ref2 = false ? 0 : { 52205 name: "5kkxb2-requiredInput-RequiredInput", 52206 styles: "label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%;label:RequiredInput;", 52207 map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlJlcXVpcmVkSW5wdXQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWNJIiwiZmlsZSI6IlJlcXVpcmVkSW5wdXQudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiLyoqIEBqc3gganN4ICovXG5pbXBvcnQgeyBGb2N1c0V2ZW50SGFuZGxlciwgRnVuY3Rpb25Db21wb25lbnQgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgeyBqc3ggfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbmNvbnN0IFJlcXVpcmVkSW5wdXQ6IEZ1bmN0aW9uQ29tcG9uZW50PHtcbiAgcmVhZG9ubHkgbmFtZT86IHN0cmluZztcbiAgcmVhZG9ubHkgb25Gb2N1czogRm9jdXNFdmVudEhhbmRsZXI8SFRNTElucHV0RWxlbWVudD47XG59PiA9ICh7IG5hbWUsIG9uRm9jdXMgfSkgPT4gKFxuICA8aW5wdXRcbiAgICByZXF1aXJlZFxuICAgIG5hbWU9e25hbWV9XG4gICAgdGFiSW5kZXg9ey0xfVxuICAgIGFyaWEtaGlkZGVuPVwidHJ1ZVwiXG4gICAgb25Gb2N1cz17b25Gb2N1c31cbiAgICBjc3M9e3tcbiAgICAgIGxhYmVsOiAncmVxdWlyZWRJbnB1dCcsXG4gICAgICBvcGFjaXR5OiAwLFxuICAgICAgcG9pbnRlckV2ZW50czogJ25vbmUnLFxuICAgICAgcG9zaXRpb246ICdhYnNvbHV0ZScsXG4gICAgICBib3R0b206IDAsXG4gICAgICBsZWZ0OiAwLFxuICAgICAgcmlnaHQ6IDAsXG4gICAgICB3aWR0aDogJzEwMCUnLFxuICAgIH19XG4gICAgLy8gUHJldmVudCBgU3dpdGNoaW5nIGZyb20gdW5jb250cm9sbGVkIHRvIGNvbnRyb2xsZWRgIGVycm9yXG4gICAgdmFsdWU9XCJcIlxuICAgIG9uQ2hhbmdlPXsoKSA9PiB7fX1cbiAgLz5cbik7XG5cbmV4cG9ydCBkZWZhdWx0IFJlcXVpcmVkSW5wdXQ7XG4iXX0= */", 52208 toString: _EMOTION_STRINGIFIED_CSS_ERROR__ 52209}; 52210var RequiredInput = function RequiredInput(_ref) { 52211 var name = _ref.name, 52212 onFocus = _ref.onFocus; 52213 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_9__.jsx)("input", { 52214 required: true, 52215 name: name, 52216 tabIndex: -1, 52217 "aria-hidden": "true", 52218 onFocus: onFocus, 52219 css: _ref2 52220 // Prevent `Switching from uncontrolled to controlled` error 52221 , 52222 value: "", 52223 onChange: function onChange() {} 52224 }); 52225}; 52226var RequiredInput$1 = RequiredInput; 52227 52228/// <reference types="user-agent-data-types" /> 52229 52230function testPlatform(re) { 52231 var _window$navigator$use; 52232 return typeof window !== 'undefined' && window.navigator != null ? re.test(((_window$navigator$use = window.navigator['userAgentData']) === null || _window$navigator$use === void 0 ? void 0 : _window$navigator$use.platform) || window.navigator.platform) : false; 52233} 52234function isIPhone() { 52235 return testPlatform(/^iPhone/i); 52236} 52237function isMac() { 52238 return testPlatform(/^Mac/i); 52239} 52240function isIPad() { 52241 return testPlatform(/^iPad/i) || 52242 // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support. 52243 isMac() && navigator.maxTouchPoints > 1; 52244} 52245function isIOS() { 52246 return isIPhone() || isIPad(); 52247} 52248function isAppleDevice() { 52249 return isMac() || isIOS(); 52250} 52251 52252var formatGroupLabel = function formatGroupLabel(group) { 52253 return group.label; 52254}; 52255var getOptionLabel$1 = function getOptionLabel(option) { 52256 return option.label; 52257}; 52258var getOptionValue$1 = function getOptionValue(option) { 52259 return option.value; 52260}; 52261var isOptionDisabled = function isOptionDisabled(option) { 52262 return !!option.isDisabled; 52263}; 52264 52265var defaultStyles = { 52266 clearIndicator: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.a, 52267 container: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.b, 52268 control: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.d, 52269 dropdownIndicator: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.e, 52270 group: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.g, 52271 groupHeading: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.f, 52272 indicatorsContainer: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.i, 52273 indicatorSeparator: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.h, 52274 input: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.j, 52275 loadingIndicator: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.l, 52276 loadingMessage: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.k, 52277 menu: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.m, 52278 menuList: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.n, 52279 menuPortal: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.o, 52280 multiValue: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.p, 52281 multiValueLabel: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.q, 52282 multiValueRemove: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.t, 52283 noOptionsMessage: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.u, 52284 option: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.v, 52285 placeholder: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.w, 52286 singleValue: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.x, 52287 valueContainer: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.y 52288}; 52289// Merge Utility 52290// Allows consumers to extend a base Select with additional styles 52291 52292function mergeStyles(source) { 52293 var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 52294 // initialize with source styles 52295 var styles = (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])({}, source); 52296 52297 // massage in target styles 52298 Object.keys(target).forEach(function (keyAsString) { 52299 var key = keyAsString; 52300 if (source[key]) { 52301 styles[key] = function (rsCss, props) { 52302 return target[key](source[key](rsCss, props), props); 52303 }; 52304 } else { 52305 styles[key] = target[key]; 52306 } 52307 }); 52308 return styles; 52309} 52310 52311var colors = { 52312 primary: '#2684FF', 52313 primary75: '#4C9AFF', 52314 primary50: '#B2D4FF', 52315 primary25: '#DEEBFF', 52316 danger: '#DE350B', 52317 dangerLight: '#FFBDAD', 52318 neutral0: 'hsl(0, 0%, 100%)', 52319 neutral5: 'hsl(0, 0%, 95%)', 52320 neutral10: 'hsl(0, 0%, 90%)', 52321 neutral20: 'hsl(0, 0%, 80%)', 52322 neutral30: 'hsl(0, 0%, 70%)', 52323 neutral40: 'hsl(0, 0%, 60%)', 52324 neutral50: 'hsl(0, 0%, 50%)', 52325 neutral60: 'hsl(0, 0%, 40%)', 52326 neutral70: 'hsl(0, 0%, 30%)', 52327 neutral80: 'hsl(0, 0%, 20%)', 52328 neutral90: 'hsl(0, 0%, 10%)' 52329}; 52330var borderRadius = 4; 52331// Used to calculate consistent margin/padding on elements 52332var baseUnit = 4; 52333// The minimum height of the control 52334var controlHeight = 38; 52335// The amount of space between the control and menu */ 52336var menuGutter = baseUnit * 2; 52337var spacing = { 52338 baseUnit: baseUnit, 52339 controlHeight: controlHeight, 52340 menuGutter: menuGutter 52341}; 52342var defaultTheme = { 52343 borderRadius: borderRadius, 52344 colors: colors, 52345 spacing: spacing 52346}; 52347 52348var defaultProps = { 52349 'aria-live': 'polite', 52350 backspaceRemovesValue: true, 52351 blurInputOnSelect: (0,_index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.z)(), 52352 captureMenuScroll: !(0,_index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.z)(), 52353 classNames: {}, 52354 closeMenuOnSelect: true, 52355 closeMenuOnScroll: false, 52356 components: {}, 52357 controlShouldRenderValue: true, 52358 escapeClearsValue: false, 52359 filterOption: createFilter(), 52360 formatGroupLabel: formatGroupLabel, 52361 getOptionLabel: getOptionLabel$1, 52362 getOptionValue: getOptionValue$1, 52363 isDisabled: false, 52364 isLoading: false, 52365 isMulti: false, 52366 isRtl: false, 52367 isSearchable: true, 52368 isOptionDisabled: isOptionDisabled, 52369 loadingMessage: function loadingMessage() { 52370 return 'Loading...'; 52371 }, 52372 maxMenuHeight: 300, 52373 minMenuHeight: 140, 52374 menuIsOpen: false, 52375 menuPlacement: 'bottom', 52376 menuPosition: 'absolute', 52377 menuShouldBlockScroll: false, 52378 menuShouldScrollIntoView: !(0,_index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.A)(), 52379 noOptionsMessage: function noOptionsMessage() { 52380 return 'No options'; 52381 }, 52382 openMenuOnFocus: false, 52383 openMenuOnClick: true, 52384 options: [], 52385 pageSize: 5, 52386 placeholder: 'Select...', 52387 screenReaderStatus: function screenReaderStatus(_ref) { 52388 var count = _ref.count; 52389 return "".concat(count, " result").concat(count !== 1 ? 's' : '', " available"); 52390 }, 52391 styles: {}, 52392 tabIndex: 0, 52393 tabSelectsValue: true, 52394 unstyled: false 52395}; 52396function toCategorizedOption(props, option, selectValue, index) { 52397 var isDisabled = _isOptionDisabled(props, option, selectValue); 52398 var isSelected = _isOptionSelected(props, option, selectValue); 52399 var label = getOptionLabel(props, option); 52400 var value = getOptionValue(props, option); 52401 return { 52402 type: 'option', 52403 data: option, 52404 isDisabled: isDisabled, 52405 isSelected: isSelected, 52406 label: label, 52407 value: value, 52408 index: index 52409 }; 52410} 52411function buildCategorizedOptions(props, selectValue) { 52412 return props.options.map(function (groupOrOption, groupOrOptionIndex) { 52413 if ('options' in groupOrOption) { 52414 var categorizedOptions = groupOrOption.options.map(function (option, optionIndex) { 52415 return toCategorizedOption(props, option, selectValue, optionIndex); 52416 }).filter(function (categorizedOption) { 52417 return isFocusable(props, categorizedOption); 52418 }); 52419 return categorizedOptions.length > 0 ? { 52420 type: 'group', 52421 data: groupOrOption, 52422 options: categorizedOptions, 52423 index: groupOrOptionIndex 52424 } : undefined; 52425 } 52426 var categorizedOption = toCategorizedOption(props, groupOrOption, selectValue, groupOrOptionIndex); 52427 return isFocusable(props, categorizedOption) ? categorizedOption : undefined; 52428 }).filter(_index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.K); 52429} 52430function buildFocusableOptionsFromCategorizedOptions(categorizedOptions) { 52431 return categorizedOptions.reduce(function (optionsAccumulator, categorizedOption) { 52432 if (categorizedOption.type === 'group') { 52433 optionsAccumulator.push.apply(optionsAccumulator, (0,_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_6__["default"])(categorizedOption.options.map(function (option) { 52434 return option.data; 52435 }))); 52436 } else { 52437 optionsAccumulator.push(categorizedOption.data); 52438 } 52439 return optionsAccumulator; 52440 }, []); 52441} 52442function buildFocusableOptionsWithIds(categorizedOptions, optionId) { 52443 return categorizedOptions.reduce(function (optionsAccumulator, categorizedOption) { 52444 if (categorizedOption.type === 'group') { 52445 optionsAccumulator.push.apply(optionsAccumulator, (0,_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_6__["default"])(categorizedOption.options.map(function (option) { 52446 return { 52447 data: option.data, 52448 id: "".concat(optionId, "-").concat(categorizedOption.index, "-").concat(option.index) 52449 }; 52450 }))); 52451 } else { 52452 optionsAccumulator.push({ 52453 data: categorizedOption.data, 52454 id: "".concat(optionId, "-").concat(categorizedOption.index) 52455 }); 52456 } 52457 return optionsAccumulator; 52458 }, []); 52459} 52460function buildFocusableOptions(props, selectValue) { 52461 return buildFocusableOptionsFromCategorizedOptions(buildCategorizedOptions(props, selectValue)); 52462} 52463function isFocusable(props, categorizedOption) { 52464 var _props$inputValue = props.inputValue, 52465 inputValue = _props$inputValue === void 0 ? '' : _props$inputValue; 52466 var data = categorizedOption.data, 52467 isSelected = categorizedOption.isSelected, 52468 label = categorizedOption.label, 52469 value = categorizedOption.value; 52470 return (!shouldHideSelectedOptions(props) || !isSelected) && _filterOption(props, { 52471 label: label, 52472 value: value, 52473 data: data 52474 }, inputValue); 52475} 52476function getNextFocusedValue(state, nextSelectValue) { 52477 var focusedValue = state.focusedValue, 52478 lastSelectValue = state.selectValue; 52479 var lastFocusedIndex = lastSelectValue.indexOf(focusedValue); 52480 if (lastFocusedIndex > -1) { 52481 var nextFocusedIndex = nextSelectValue.indexOf(focusedValue); 52482 if (nextFocusedIndex > -1) { 52483 // the focused value is still in the selectValue, return it 52484 return focusedValue; 52485 } else if (lastFocusedIndex < nextSelectValue.length) { 52486 // the focusedValue is not present in the next selectValue array by 52487 // reference, so return the new value at the same index 52488 return nextSelectValue[lastFocusedIndex]; 52489 } 52490 } 52491 return null; 52492} 52493function getNextFocusedOption(state, options) { 52494 var lastFocusedOption = state.focusedOption; 52495 return lastFocusedOption && options.indexOf(lastFocusedOption) > -1 ? lastFocusedOption : options[0]; 52496} 52497var getFocusedOptionId = function getFocusedOptionId(focusableOptionsWithIds, focusedOption) { 52498 var _focusableOptionsWith; 52499 var focusedOptionId = (_focusableOptionsWith = focusableOptionsWithIds.find(function (option) { 52500 return option.data === focusedOption; 52501 })) === null || _focusableOptionsWith === void 0 ? void 0 : _focusableOptionsWith.id; 52502 return focusedOptionId || null; 52503}; 52504var getOptionLabel = function getOptionLabel(props, data) { 52505 return props.getOptionLabel(data); 52506}; 52507var getOptionValue = function getOptionValue(props, data) { 52508 return props.getOptionValue(data); 52509}; 52510function _isOptionDisabled(props, option, selectValue) { 52511 return typeof props.isOptionDisabled === 'function' ? props.isOptionDisabled(option, selectValue) : false; 52512} 52513function _isOptionSelected(props, option, selectValue) { 52514 if (selectValue.indexOf(option) > -1) return true; 52515 if (typeof props.isOptionSelected === 'function') { 52516 return props.isOptionSelected(option, selectValue); 52517 } 52518 var candidate = getOptionValue(props, option); 52519 return selectValue.some(function (i) { 52520 return getOptionValue(props, i) === candidate; 52521 }); 52522} 52523function _filterOption(props, option, inputValue) { 52524 return props.filterOption ? props.filterOption(option, inputValue) : true; 52525} 52526var shouldHideSelectedOptions = function shouldHideSelectedOptions(props) { 52527 var hideSelectedOptions = props.hideSelectedOptions, 52528 isMulti = props.isMulti; 52529 if (hideSelectedOptions === undefined) return isMulti; 52530 return hideSelectedOptions; 52531}; 52532var instanceId = 1; 52533var Select = /*#__PURE__*/function (_Component) { 52534 (0,_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__["default"])(Select, _Component); 52535 var _super = (0,_babel_runtime_helpers_esm_createSuper__WEBPACK_IMPORTED_MODULE_5__["default"])(Select); 52536 // Misc. Instance Properties 52537 // ------------------------------ 52538 52539 // TODO 52540 52541 // Refs 52542 // ------------------------------ 52543 52544 // Lifecycle 52545 // ------------------------------ 52546 52547 function Select(_props) { 52548 var _this; 52549 (0,_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_2__["default"])(this, Select); 52550 _this = _super.call(this, _props); 52551 _this.state = { 52552 ariaSelection: null, 52553 focusedOption: null, 52554 focusedOptionId: null, 52555 focusableOptionsWithIds: [], 52556 focusedValue: null, 52557 inputIsHidden: false, 52558 isFocused: false, 52559 selectValue: [], 52560 clearFocusValueOnUpdate: false, 52561 prevWasFocused: false, 52562 inputIsHiddenAfterUpdate: undefined, 52563 prevProps: undefined, 52564 instancePrefix: '', 52565 isAppleDevice: false 52566 }; 52567 _this.blockOptionHover = false; 52568 _this.isComposing = false; 52569 _this.commonProps = void 0; 52570 _this.initialTouchX = 0; 52571 _this.initialTouchY = 0; 52572 _this.openAfterFocus = false; 52573 _this.scrollToFocusedOptionOnUpdate = false; 52574 _this.userIsDragging = void 0; 52575 _this.controlRef = null; 52576 _this.getControlRef = function (ref) { 52577 _this.controlRef = ref; 52578 }; 52579 _this.focusedOptionRef = null; 52580 _this.getFocusedOptionRef = function (ref) { 52581 _this.focusedOptionRef = ref; 52582 }; 52583 _this.menuListRef = null; 52584 _this.getMenuListRef = function (ref) { 52585 _this.menuListRef = ref; 52586 }; 52587 _this.inputRef = null; 52588 _this.getInputRef = function (ref) { 52589 _this.inputRef = ref; 52590 }; 52591 _this.focus = _this.focusInput; 52592 _this.blur = _this.blurInput; 52593 _this.onChange = function (newValue, actionMeta) { 52594 var _this$props = _this.props, 52595 onChange = _this$props.onChange, 52596 name = _this$props.name; 52597 actionMeta.name = name; 52598 _this.ariaOnChange(newValue, actionMeta); 52599 onChange(newValue, actionMeta); 52600 }; 52601 _this.setValue = function (newValue, action, option) { 52602 var _this$props2 = _this.props, 52603 closeMenuOnSelect = _this$props2.closeMenuOnSelect, 52604 isMulti = _this$props2.isMulti, 52605 inputValue = _this$props2.inputValue; 52606 _this.onInputChange('', { 52607 action: 'set-value', 52608 prevInputValue: inputValue 52609 }); 52610 if (closeMenuOnSelect) { 52611 _this.setState({ 52612 inputIsHiddenAfterUpdate: !isMulti 52613 }); 52614 _this.onMenuClose(); 52615 } 52616 // when the select value should change, we should reset focusedValue 52617 _this.setState({ 52618 clearFocusValueOnUpdate: true 52619 }); 52620 _this.onChange(newValue, { 52621 action: action, 52622 option: option 52623 }); 52624 }; 52625 _this.selectOption = function (newValue) { 52626 var _this$props3 = _this.props, 52627 blurInputOnSelect = _this$props3.blurInputOnSelect, 52628 isMulti = _this$props3.isMulti, 52629 name = _this$props3.name; 52630 var selectValue = _this.state.selectValue; 52631 var deselected = isMulti && _this.isOptionSelected(newValue, selectValue); 52632 var isDisabled = _this.isOptionDisabled(newValue, selectValue); 52633 if (deselected) { 52634 var candidate = _this.getOptionValue(newValue); 52635 _this.setValue((0,_index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.B)(selectValue.filter(function (i) { 52636 return _this.getOptionValue(i) !== candidate; 52637 })), 'deselect-option', newValue); 52638 } else if (!isDisabled) { 52639 // Select option if option is not disabled 52640 if (isMulti) { 52641 _this.setValue((0,_index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.B)([].concat((0,_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_6__["default"])(selectValue), [newValue])), 'select-option', newValue); 52642 } else { 52643 _this.setValue((0,_index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.C)(newValue), 'select-option'); 52644 } 52645 } else { 52646 _this.ariaOnChange((0,_index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.C)(newValue), { 52647 action: 'select-option', 52648 option: newValue, 52649 name: name 52650 }); 52651 return; 52652 } 52653 if (blurInputOnSelect) { 52654 _this.blurInput(); 52655 } 52656 }; 52657 _this.removeValue = function (removedValue) { 52658 var isMulti = _this.props.isMulti; 52659 var selectValue = _this.state.selectValue; 52660 var candidate = _this.getOptionValue(removedValue); 52661 var newValueArray = selectValue.filter(function (i) { 52662 return _this.getOptionValue(i) !== candidate; 52663 }); 52664 var newValue = (0,_index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.D)(isMulti, newValueArray, newValueArray[0] || null); 52665 _this.onChange(newValue, { 52666 action: 'remove-value', 52667 removedValue: removedValue 52668 }); 52669 _this.focusInput(); 52670 }; 52671 _this.clearValue = function () { 52672 var selectValue = _this.state.selectValue; 52673 _this.onChange((0,_index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.D)(_this.props.isMulti, [], null), { 52674 action: 'clear', 52675 removedValues: selectValue 52676 }); 52677 }; 52678 _this.popValue = function () { 52679 var isMulti = _this.props.isMulti; 52680 var selectValue = _this.state.selectValue; 52681 var lastSelectedValue = selectValue[selectValue.length - 1]; 52682 var newValueArray = selectValue.slice(0, selectValue.length - 1); 52683 var newValue = (0,_index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.D)(isMulti, newValueArray, newValueArray[0] || null); 52684 if (lastSelectedValue) { 52685 _this.onChange(newValue, { 52686 action: 'pop-value', 52687 removedValue: lastSelectedValue 52688 }); 52689 } 52690 }; 52691 _this.getFocusedOptionId = function (focusedOption) { 52692 return getFocusedOptionId(_this.state.focusableOptionsWithIds, focusedOption); 52693 }; 52694 _this.getFocusableOptionsWithIds = function () { 52695 return buildFocusableOptionsWithIds(buildCategorizedOptions(_this.props, _this.state.selectValue), _this.getElementId('option')); 52696 }; 52697 _this.getValue = function () { 52698 return _this.state.selectValue; 52699 }; 52700 _this.cx = function () { 52701 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 52702 args[_key] = arguments[_key]; 52703 } 52704 return _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.E.apply(void 0, [_this.props.classNamePrefix].concat(args)); 52705 }; 52706 _this.getOptionLabel = function (data) { 52707 return getOptionLabel(_this.props, data); 52708 }; 52709 _this.getOptionValue = function (data) { 52710 return getOptionValue(_this.props, data); 52711 }; 52712 _this.getStyles = function (key, props) { 52713 var unstyled = _this.props.unstyled; 52714 var base = defaultStyles[key](props, unstyled); 52715 base.boxSizing = 'border-box'; 52716 var custom = _this.props.styles[key]; 52717 return custom ? custom(base, props) : base; 52718 }; 52719 _this.getClassNames = function (key, props) { 52720 var _this$props$className, _this$props$className2; 52721 return (_this$props$className = (_this$props$className2 = _this.props.classNames)[key]) === null || _this$props$className === void 0 ? void 0 : _this$props$className.call(_this$props$className2, props); 52722 }; 52723 _this.getElementId = function (element) { 52724 return "".concat(_this.state.instancePrefix, "-").concat(element); 52725 }; 52726 _this.getComponents = function () { 52727 return (0,_index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.F)(_this.props); 52728 }; 52729 _this.buildCategorizedOptions = function () { 52730 return buildCategorizedOptions(_this.props, _this.state.selectValue); 52731 }; 52732 _this.getCategorizedOptions = function () { 52733 return _this.props.menuIsOpen ? _this.buildCategorizedOptions() : []; 52734 }; 52735 _this.buildFocusableOptions = function () { 52736 return buildFocusableOptionsFromCategorizedOptions(_this.buildCategorizedOptions()); 52737 }; 52738 _this.getFocusableOptions = function () { 52739 return _this.props.menuIsOpen ? _this.buildFocusableOptions() : []; 52740 }; 52741 _this.ariaOnChange = function (value, actionMeta) { 52742 _this.setState({ 52743 ariaSelection: (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])({ 52744 value: value 52745 }, actionMeta) 52746 }); 52747 }; 52748 _this.onMenuMouseDown = function (event) { 52749 if (event.button !== 0) { 52750 return; 52751 } 52752 event.stopPropagation(); 52753 event.preventDefault(); 52754 _this.focusInput(); 52755 }; 52756 _this.onMenuMouseMove = function (event) { 52757 _this.blockOptionHover = false; 52758 }; 52759 _this.onControlMouseDown = function (event) { 52760 // Event captured by dropdown indicator 52761 if (event.defaultPrevented) { 52762 return; 52763 } 52764 var openMenuOnClick = _this.props.openMenuOnClick; 52765 if (!_this.state.isFocused) { 52766 if (openMenuOnClick) { 52767 _this.openAfterFocus = true; 52768 } 52769 _this.focusInput(); 52770 } else if (!_this.props.menuIsOpen) { 52771 if (openMenuOnClick) { 52772 _this.openMenu('first'); 52773 } 52774 } else { 52775 if (event.target.tagName !== 'INPUT' && event.target.tagName !== 'TEXTAREA') { 52776 _this.onMenuClose(); 52777 } 52778 } 52779 if (event.target.tagName !== 'INPUT' && event.target.tagName !== 'TEXTAREA') { 52780 event.preventDefault(); 52781 } 52782 }; 52783 _this.onDropdownIndicatorMouseDown = function (event) { 52784 // ignore mouse events that weren't triggered by the primary button 52785 if (event && event.type === 'mousedown' && event.button !== 0) { 52786 return; 52787 } 52788 if (_this.props.isDisabled) return; 52789 var _this$props4 = _this.props, 52790 isMulti = _this$props4.isMulti, 52791 menuIsOpen = _this$props4.menuIsOpen; 52792 _this.focusInput(); 52793 if (menuIsOpen) { 52794 _this.setState({ 52795 inputIsHiddenAfterUpdate: !isMulti 52796 }); 52797 _this.onMenuClose(); 52798 } else { 52799 _this.openMenu('first'); 52800 } 52801 event.preventDefault(); 52802 }; 52803 _this.onClearIndicatorMouseDown = function (event) { 52804 // ignore mouse events that weren't triggered by the primary button 52805 if (event && event.type === 'mousedown' && event.button !== 0) { 52806 return; 52807 } 52808 _this.clearValue(); 52809 event.preventDefault(); 52810 _this.openAfterFocus = false; 52811 if (event.type === 'touchend') { 52812 _this.focusInput(); 52813 } else { 52814 setTimeout(function () { 52815 return _this.focusInput(); 52816 }); 52817 } 52818 }; 52819 _this.onScroll = function (event) { 52820 if (typeof _this.props.closeMenuOnScroll === 'boolean') { 52821 if (event.target instanceof HTMLElement && (0,_index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.G)(event.target)) { 52822 _this.props.onMenuClose(); 52823 } 52824 } else if (typeof _this.props.closeMenuOnScroll === 'function') { 52825 if (_this.props.closeMenuOnScroll(event)) { 52826 _this.props.onMenuClose(); 52827 } 52828 } 52829 }; 52830 _this.onCompositionStart = function () { 52831 _this.isComposing = true; 52832 }; 52833 _this.onCompositionEnd = function () { 52834 _this.isComposing = false; 52835 }; 52836 _this.onTouchStart = function (_ref2) { 52837 var touches = _ref2.touches; 52838 var touch = touches && touches.item(0); 52839 if (!touch) { 52840 return; 52841 } 52842 _this.initialTouchX = touch.clientX; 52843 _this.initialTouchY = touch.clientY; 52844 _this.userIsDragging = false; 52845 }; 52846 _this.onTouchMove = function (_ref3) { 52847 var touches = _ref3.touches; 52848 var touch = touches && touches.item(0); 52849 if (!touch) { 52850 return; 52851 } 52852 var deltaX = Math.abs(touch.clientX - _this.initialTouchX); 52853 var deltaY = Math.abs(touch.clientY - _this.initialTouchY); 52854 var moveThreshold = 5; 52855 _this.userIsDragging = deltaX > moveThreshold || deltaY > moveThreshold; 52856 }; 52857 _this.onTouchEnd = function (event) { 52858 if (_this.userIsDragging) return; 52859 52860 // close the menu if the user taps outside 52861 // we're checking on event.target here instead of event.currentTarget, because we want to assert information 52862 // on events on child elements, not the document (which we've attached this handler to). 52863 if (_this.controlRef && !_this.controlRef.contains(event.target) && _this.menuListRef && !_this.menuListRef.contains(event.target)) { 52864 _this.blurInput(); 52865 } 52866 52867 // reset move vars 52868 _this.initialTouchX = 0; 52869 _this.initialTouchY = 0; 52870 }; 52871 _this.onControlTouchEnd = function (event) { 52872 if (_this.userIsDragging) return; 52873 _this.onControlMouseDown(event); 52874 }; 52875 _this.onClearIndicatorTouchEnd = function (event) { 52876 if (_this.userIsDragging) return; 52877 _this.onClearIndicatorMouseDown(event); 52878 }; 52879 _this.onDropdownIndicatorTouchEnd = function (event) { 52880 if (_this.userIsDragging) return; 52881 _this.onDropdownIndicatorMouseDown(event); 52882 }; 52883 _this.handleInputChange = function (event) { 52884 var prevInputValue = _this.props.inputValue; 52885 var inputValue = event.currentTarget.value; 52886 _this.setState({ 52887 inputIsHiddenAfterUpdate: false 52888 }); 52889 _this.onInputChange(inputValue, { 52890 action: 'input-change', 52891 prevInputValue: prevInputValue 52892 }); 52893 if (!_this.props.menuIsOpen) { 52894 _this.onMenuOpen(); 52895 } 52896 }; 52897 _this.onInputFocus = function (event) { 52898 if (_this.props.onFocus) { 52899 _this.props.onFocus(event); 52900 } 52901 _this.setState({ 52902 inputIsHiddenAfterUpdate: false, 52903 isFocused: true 52904 }); 52905 if (_this.openAfterFocus || _this.props.openMenuOnFocus) { 52906 _this.openMenu('first'); 52907 } 52908 _this.openAfterFocus = false; 52909 }; 52910 _this.onInputBlur = function (event) { 52911 var prevInputValue = _this.props.inputValue; 52912 if (_this.menuListRef && _this.menuListRef.contains(document.activeElement)) { 52913 _this.inputRef.focus(); 52914 return; 52915 } 52916 if (_this.props.onBlur) { 52917 _this.props.onBlur(event); 52918 } 52919 _this.onInputChange('', { 52920 action: 'input-blur', 52921 prevInputValue: prevInputValue 52922 }); 52923 _this.onMenuClose(); 52924 _this.setState({ 52925 focusedValue: null, 52926 isFocused: false 52927 }); 52928 }; 52929 _this.onOptionHover = function (focusedOption) { 52930 if (_this.blockOptionHover || _this.state.focusedOption === focusedOption) { 52931 return; 52932 } 52933 var options = _this.getFocusableOptions(); 52934 var focusedOptionIndex = options.indexOf(focusedOption); 52935 _this.setState({ 52936 focusedOption: focusedOption, 52937 focusedOptionId: focusedOptionIndex > -1 ? _this.getFocusedOptionId(focusedOption) : null 52938 }); 52939 }; 52940 _this.shouldHideSelectedOptions = function () { 52941 return shouldHideSelectedOptions(_this.props); 52942 }; 52943 _this.onValueInputFocus = function (e) { 52944 e.preventDefault(); 52945 e.stopPropagation(); 52946 _this.focus(); 52947 }; 52948 _this.onKeyDown = function (event) { 52949 var _this$props5 = _this.props, 52950 isMulti = _this$props5.isMulti, 52951 backspaceRemovesValue = _this$props5.backspaceRemovesValue, 52952 escapeClearsValue = _this$props5.escapeClearsValue, 52953 inputValue = _this$props5.inputValue, 52954 isClearable = _this$props5.isClearable, 52955 isDisabled = _this$props5.isDisabled, 52956 menuIsOpen = _this$props5.menuIsOpen, 52957 onKeyDown = _this$props5.onKeyDown, 52958 tabSelectsValue = _this$props5.tabSelectsValue, 52959 openMenuOnFocus = _this$props5.openMenuOnFocus; 52960 var _this$state = _this.state, 52961 focusedOption = _this$state.focusedOption, 52962 focusedValue = _this$state.focusedValue, 52963 selectValue = _this$state.selectValue; 52964 if (isDisabled) return; 52965 if (typeof onKeyDown === 'function') { 52966 onKeyDown(event); 52967 if (event.defaultPrevented) { 52968 return; 52969 } 52970 } 52971 52972 // Block option hover events when the user has just pressed a key 52973 _this.blockOptionHover = true; 52974 switch (event.key) { 52975 case 'ArrowLeft': 52976 if (!isMulti || inputValue) return; 52977 _this.focusValue('previous'); 52978 break; 52979 case 'ArrowRight': 52980 if (!isMulti || inputValue) return; 52981 _this.focusValue('next'); 52982 break; 52983 case 'Delete': 52984 case 'Backspace': 52985 if (inputValue) return; 52986 if (focusedValue) { 52987 _this.removeValue(focusedValue); 52988 } else { 52989 if (!backspaceRemovesValue) return; 52990 if (isMulti) { 52991 _this.popValue(); 52992 } else if (isClearable) { 52993 _this.clearValue(); 52994 } 52995 } 52996 break; 52997 case 'Tab': 52998 if (_this.isComposing) return; 52999 if (event.shiftKey || !menuIsOpen || !tabSelectsValue || !focusedOption || 53000 // don't capture the event if the menu opens on focus and the focused 53001 // option is already selected; it breaks the flow of navigation 53002 openMenuOnFocus && _this.isOptionSelected(focusedOption, selectValue)) { 53003 return; 53004 } 53005 _this.selectOption(focusedOption); 53006 break; 53007 case 'Enter': 53008 if (event.keyCode === 229) { 53009 // ignore the keydown event from an Input Method Editor(IME) 53010 // ref. https://www.w3.org/TR/uievents/#determine-keydown-keyup-keyCode 53011 break; 53012 } 53013 if (menuIsOpen) { 53014 if (!focusedOption) return; 53015 if (_this.isComposing) return; 53016 _this.selectOption(focusedOption); 53017 break; 53018 } 53019 return; 53020 case 'Escape': 53021 if (menuIsOpen) { 53022 _this.setState({ 53023 inputIsHiddenAfterUpdate: false 53024 }); 53025 _this.onInputChange('', { 53026 action: 'menu-close', 53027 prevInputValue: inputValue 53028 }); 53029 _this.onMenuClose(); 53030 } else if (isClearable && escapeClearsValue) { 53031 _this.clearValue(); 53032 } 53033 break; 53034 case ' ': 53035 // space 53036 if (inputValue) { 53037 return; 53038 } 53039 if (!menuIsOpen) { 53040 _this.openMenu('first'); 53041 break; 53042 } 53043 if (!focusedOption) return; 53044 _this.selectOption(focusedOption); 53045 break; 53046 case 'ArrowUp': 53047 if (menuIsOpen) { 53048 _this.focusOption('up'); 53049 } else { 53050 _this.openMenu('last'); 53051 } 53052 break; 53053 case 'ArrowDown': 53054 if (menuIsOpen) { 53055 _this.focusOption('down'); 53056 } else { 53057 _this.openMenu('first'); 53058 } 53059 break; 53060 case 'PageUp': 53061 if (!menuIsOpen) return; 53062 _this.focusOption('pageup'); 53063 break; 53064 case 'PageDown': 53065 if (!menuIsOpen) return; 53066 _this.focusOption('pagedown'); 53067 break; 53068 case 'Home': 53069 if (!menuIsOpen) return; 53070 _this.focusOption('first'); 53071 break; 53072 case 'End': 53073 if (!menuIsOpen) return; 53074 _this.focusOption('last'); 53075 break; 53076 default: 53077 return; 53078 } 53079 event.preventDefault(); 53080 }; 53081 _this.state.instancePrefix = 'react-select-' + (_this.props.instanceId || ++instanceId); 53082 _this.state.selectValue = (0,_index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.H)(_props.value); 53083 // Set focusedOption if menuIsOpen is set on init (e.g. defaultMenuIsOpen) 53084 if (_props.menuIsOpen && _this.state.selectValue.length) { 53085 var focusableOptionsWithIds = _this.getFocusableOptionsWithIds(); 53086 var focusableOptions = _this.buildFocusableOptions(); 53087 var optionIndex = focusableOptions.indexOf(_this.state.selectValue[0]); 53088 _this.state.focusableOptionsWithIds = focusableOptionsWithIds; 53089 _this.state.focusedOption = focusableOptions[optionIndex]; 53090 _this.state.focusedOptionId = getFocusedOptionId(focusableOptionsWithIds, focusableOptions[optionIndex]); 53091 } 53092 return _this; 53093 } 53094 (0,_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_3__["default"])(Select, [{ 53095 key: "componentDidMount", 53096 value: function componentDidMount() { 53097 this.startListeningComposition(); 53098 this.startListeningToTouch(); 53099 if (this.props.closeMenuOnScroll && document && document.addEventListener) { 53100 // Listen to all scroll events, and filter them out inside of 'onScroll' 53101 document.addEventListener('scroll', this.onScroll, true); 53102 } 53103 if (this.props.autoFocus) { 53104 this.focusInput(); 53105 } 53106 53107 // Scroll focusedOption into view if menuIsOpen is set on mount (e.g. defaultMenuIsOpen) 53108 if (this.props.menuIsOpen && this.state.focusedOption && this.menuListRef && this.focusedOptionRef) { 53109 (0,_index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.I)(this.menuListRef, this.focusedOptionRef); 53110 } 53111 if (isAppleDevice()) { 53112 // eslint-disable-next-line react/no-did-mount-set-state 53113 this.setState({ 53114 isAppleDevice: true 53115 }); 53116 } 53117 } 53118 }, { 53119 key: "componentDidUpdate", 53120 value: function componentDidUpdate(prevProps) { 53121 var _this$props6 = this.props, 53122 isDisabled = _this$props6.isDisabled, 53123 menuIsOpen = _this$props6.menuIsOpen; 53124 var isFocused = this.state.isFocused; 53125 if ( 53126 // ensure focus is restored correctly when the control becomes enabled 53127 isFocused && !isDisabled && prevProps.isDisabled || 53128 // ensure focus is on the Input when the menu opens 53129 isFocused && menuIsOpen && !prevProps.menuIsOpen) { 53130 this.focusInput(); 53131 } 53132 if (isFocused && isDisabled && !prevProps.isDisabled) { 53133 // ensure select state gets blurred in case Select is programmatically disabled while focused 53134 // eslint-disable-next-line react/no-did-update-set-state 53135 this.setState({ 53136 isFocused: false 53137 }, this.onMenuClose); 53138 } else if (!isFocused && !isDisabled && prevProps.isDisabled && this.inputRef === document.activeElement) { 53139 // ensure select state gets focused in case Select is programatically re-enabled while focused (Firefox) 53140 // eslint-disable-next-line react/no-did-update-set-state 53141 this.setState({ 53142 isFocused: true 53143 }); 53144 } 53145 53146 // scroll the focused option into view if necessary 53147 if (this.menuListRef && this.focusedOptionRef && this.scrollToFocusedOptionOnUpdate) { 53148 (0,_index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.I)(this.menuListRef, this.focusedOptionRef); 53149 this.scrollToFocusedOptionOnUpdate = false; 53150 } 53151 } 53152 }, { 53153 key: "componentWillUnmount", 53154 value: function componentWillUnmount() { 53155 this.stopListeningComposition(); 53156 this.stopListeningToTouch(); 53157 document.removeEventListener('scroll', this.onScroll, true); 53158 } 53159 53160 // ============================== 53161 // Consumer Handlers 53162 // ============================== 53163 }, { 53164 key: "onMenuOpen", 53165 value: function onMenuOpen() { 53166 this.props.onMenuOpen(); 53167 } 53168 }, { 53169 key: "onMenuClose", 53170 value: function onMenuClose() { 53171 this.onInputChange('', { 53172 action: 'menu-close', 53173 prevInputValue: this.props.inputValue 53174 }); 53175 this.props.onMenuClose(); 53176 } 53177 }, { 53178 key: "onInputChange", 53179 value: function onInputChange(newValue, actionMeta) { 53180 this.props.onInputChange(newValue, actionMeta); 53181 } 53182 53183 // ============================== 53184 // Methods 53185 // ============================== 53186 }, { 53187 key: "focusInput", 53188 value: function focusInput() { 53189 if (!this.inputRef) return; 53190 this.inputRef.focus(); 53191 } 53192 }, { 53193 key: "blurInput", 53194 value: function blurInput() { 53195 if (!this.inputRef) return; 53196 this.inputRef.blur(); 53197 } 53198 53199 // aliased for consumers 53200 }, { 53201 key: "openMenu", 53202 value: function openMenu(focusOption) { 53203 var _this2 = this; 53204 var _this$state2 = this.state, 53205 selectValue = _this$state2.selectValue, 53206 isFocused = _this$state2.isFocused; 53207 var focusableOptions = this.buildFocusableOptions(); 53208 var openAtIndex = focusOption === 'first' ? 0 : focusableOptions.length - 1; 53209 if (!this.props.isMulti) { 53210 var selectedIndex = focusableOptions.indexOf(selectValue[0]); 53211 if (selectedIndex > -1) { 53212 openAtIndex = selectedIndex; 53213 } 53214 } 53215 53216 // only scroll if the menu isn't already open 53217 this.scrollToFocusedOptionOnUpdate = !(isFocused && this.menuListRef); 53218 this.setState({ 53219 inputIsHiddenAfterUpdate: false, 53220 focusedValue: null, 53221 focusedOption: focusableOptions[openAtIndex], 53222 focusedOptionId: this.getFocusedOptionId(focusableOptions[openAtIndex]) 53223 }, function () { 53224 return _this2.onMenuOpen(); 53225 }); 53226 } 53227 }, { 53228 key: "focusValue", 53229 value: function focusValue(direction) { 53230 var _this$state3 = this.state, 53231 selectValue = _this$state3.selectValue, 53232 focusedValue = _this$state3.focusedValue; 53233 53234 // Only multiselects support value focusing 53235 if (!this.props.isMulti) return; 53236 this.setState({ 53237 focusedOption: null 53238 }); 53239 var focusedIndex = selectValue.indexOf(focusedValue); 53240 if (!focusedValue) { 53241 focusedIndex = -1; 53242 } 53243 var lastIndex = selectValue.length - 1; 53244 var nextFocus = -1; 53245 if (!selectValue.length) return; 53246 switch (direction) { 53247 case 'previous': 53248 if (focusedIndex === 0) { 53249 // don't cycle from the start to the end 53250 nextFocus = 0; 53251 } else if (focusedIndex === -1) { 53252 // if nothing is focused, focus the last value first 53253 nextFocus = lastIndex; 53254 } else { 53255 nextFocus = focusedIndex - 1; 53256 } 53257 break; 53258 case 'next': 53259 if (focusedIndex > -1 && focusedIndex < lastIndex) { 53260 nextFocus = focusedIndex + 1; 53261 } 53262 break; 53263 } 53264 this.setState({ 53265 inputIsHidden: nextFocus !== -1, 53266 focusedValue: selectValue[nextFocus] 53267 }); 53268 } 53269 }, { 53270 key: "focusOption", 53271 value: function focusOption() { 53272 var direction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'first'; 53273 var pageSize = this.props.pageSize; 53274 var focusedOption = this.state.focusedOption; 53275 var options = this.getFocusableOptions(); 53276 if (!options.length) return; 53277 var nextFocus = 0; // handles 'first' 53278 var focusedIndex = options.indexOf(focusedOption); 53279 if (!focusedOption) { 53280 focusedIndex = -1; 53281 } 53282 if (direction === 'up') { 53283 nextFocus = focusedIndex > 0 ? focusedIndex - 1 : options.length - 1; 53284 } else if (direction === 'down') { 53285 nextFocus = (focusedIndex + 1) % options.length; 53286 } else if (direction === 'pageup') { 53287 nextFocus = focusedIndex - pageSize; 53288 if (nextFocus < 0) nextFocus = 0; 53289 } else if (direction === 'pagedown') { 53290 nextFocus = focusedIndex + pageSize; 53291 if (nextFocus > options.length - 1) nextFocus = options.length - 1; 53292 } else if (direction === 'last') { 53293 nextFocus = options.length - 1; 53294 } 53295 this.scrollToFocusedOptionOnUpdate = true; 53296 this.setState({ 53297 focusedOption: options[nextFocus], 53298 focusedValue: null, 53299 focusedOptionId: this.getFocusedOptionId(options[nextFocus]) 53300 }); 53301 } 53302 }, { 53303 key: "getTheme", 53304 value: 53305 // ============================== 53306 // Getters 53307 // ============================== 53308 53309 function getTheme() { 53310 // Use the default theme if there are no customisations. 53311 if (!this.props.theme) { 53312 return defaultTheme; 53313 } 53314 // If the theme prop is a function, assume the function 53315 // knows how to merge the passed-in default theme with 53316 // its own modifications. 53317 if (typeof this.props.theme === 'function') { 53318 return this.props.theme(defaultTheme); 53319 } 53320 // Otherwise, if a plain theme object was passed in, 53321 // overlay it with the default theme. 53322 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])({}, defaultTheme), this.props.theme); 53323 } 53324 }, { 53325 key: "getCommonProps", 53326 value: function getCommonProps() { 53327 var clearValue = this.clearValue, 53328 cx = this.cx, 53329 getStyles = this.getStyles, 53330 getClassNames = this.getClassNames, 53331 getValue = this.getValue, 53332 selectOption = this.selectOption, 53333 setValue = this.setValue, 53334 props = this.props; 53335 var isMulti = props.isMulti, 53336 isRtl = props.isRtl, 53337 options = props.options; 53338 var hasValue = this.hasValue(); 53339 return { 53340 clearValue: clearValue, 53341 cx: cx, 53342 getStyles: getStyles, 53343 getClassNames: getClassNames, 53344 getValue: getValue, 53345 hasValue: hasValue, 53346 isMulti: isMulti, 53347 isRtl: isRtl, 53348 options: options, 53349 selectOption: selectOption, 53350 selectProps: props, 53351 setValue: setValue, 53352 theme: this.getTheme() 53353 }; 53354 } 53355 }, { 53356 key: "hasValue", 53357 value: function hasValue() { 53358 var selectValue = this.state.selectValue; 53359 return selectValue.length > 0; 53360 } 53361 }, { 53362 key: "hasOptions", 53363 value: function hasOptions() { 53364 return !!this.getFocusableOptions().length; 53365 } 53366 }, { 53367 key: "isClearable", 53368 value: function isClearable() { 53369 var _this$props7 = this.props, 53370 isClearable = _this$props7.isClearable, 53371 isMulti = _this$props7.isMulti; 53372 53373 // single select, by default, IS NOT clearable 53374 // multi select, by default, IS clearable 53375 if (isClearable === undefined) return isMulti; 53376 return isClearable; 53377 } 53378 }, { 53379 key: "isOptionDisabled", 53380 value: function isOptionDisabled(option, selectValue) { 53381 return _isOptionDisabled(this.props, option, selectValue); 53382 } 53383 }, { 53384 key: "isOptionSelected", 53385 value: function isOptionSelected(option, selectValue) { 53386 return _isOptionSelected(this.props, option, selectValue); 53387 } 53388 }, { 53389 key: "filterOption", 53390 value: function filterOption(option, inputValue) { 53391 return _filterOption(this.props, option, inputValue); 53392 } 53393 }, { 53394 key: "formatOptionLabel", 53395 value: function formatOptionLabel(data, context) { 53396 if (typeof this.props.formatOptionLabel === 'function') { 53397 var _inputValue = this.props.inputValue; 53398 var _selectValue = this.state.selectValue; 53399 return this.props.formatOptionLabel(data, { 53400 context: context, 53401 inputValue: _inputValue, 53402 selectValue: _selectValue 53403 }); 53404 } else { 53405 return this.getOptionLabel(data); 53406 } 53407 } 53408 }, { 53409 key: "formatGroupLabel", 53410 value: function formatGroupLabel(data) { 53411 return this.props.formatGroupLabel(data); 53412 } 53413 53414 // ============================== 53415 // Mouse Handlers 53416 // ============================== 53417 }, { 53418 key: "startListeningComposition", 53419 value: 53420 // ============================== 53421 // Composition Handlers 53422 // ============================== 53423 53424 function startListeningComposition() { 53425 if (document && document.addEventListener) { 53426 document.addEventListener('compositionstart', this.onCompositionStart, false); 53427 document.addEventListener('compositionend', this.onCompositionEnd, false); 53428 } 53429 } 53430 }, { 53431 key: "stopListeningComposition", 53432 value: function stopListeningComposition() { 53433 if (document && document.removeEventListener) { 53434 document.removeEventListener('compositionstart', this.onCompositionStart); 53435 document.removeEventListener('compositionend', this.onCompositionEnd); 53436 } 53437 } 53438 }, { 53439 key: "startListeningToTouch", 53440 value: 53441 // ============================== 53442 // Touch Handlers 53443 // ============================== 53444 53445 function startListeningToTouch() { 53446 if (document && document.addEventListener) { 53447 document.addEventListener('touchstart', this.onTouchStart, false); 53448 document.addEventListener('touchmove', this.onTouchMove, false); 53449 document.addEventListener('touchend', this.onTouchEnd, false); 53450 } 53451 } 53452 }, { 53453 key: "stopListeningToTouch", 53454 value: function stopListeningToTouch() { 53455 if (document && document.removeEventListener) { 53456 document.removeEventListener('touchstart', this.onTouchStart); 53457 document.removeEventListener('touchmove', this.onTouchMove); 53458 document.removeEventListener('touchend', this.onTouchEnd); 53459 } 53460 } 53461 }, { 53462 key: "renderInput", 53463 value: 53464 // ============================== 53465 // Renderers 53466 // ============================== 53467 function renderInput() { 53468 var _this$props8 = this.props, 53469 isDisabled = _this$props8.isDisabled, 53470 isSearchable = _this$props8.isSearchable, 53471 inputId = _this$props8.inputId, 53472 inputValue = _this$props8.inputValue, 53473 tabIndex = _this$props8.tabIndex, 53474 form = _this$props8.form, 53475 menuIsOpen = _this$props8.menuIsOpen, 53476 required = _this$props8.required; 53477 var _this$getComponents = this.getComponents(), 53478 Input = _this$getComponents.Input; 53479 var _this$state4 = this.state, 53480 inputIsHidden = _this$state4.inputIsHidden, 53481 ariaSelection = _this$state4.ariaSelection; 53482 var commonProps = this.commonProps; 53483 var id = inputId || this.getElementId('input'); 53484 53485 // aria attributes makes the JSX "noisy", separated for clarity 53486 var ariaAttributes = (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])({ 53487 'aria-autocomplete': 'list', 53488 'aria-expanded': menuIsOpen, 53489 'aria-haspopup': true, 53490 'aria-errormessage': this.props['aria-errormessage'], 53491 'aria-invalid': this.props['aria-invalid'], 53492 'aria-label': this.props['aria-label'], 53493 'aria-labelledby': this.props['aria-labelledby'], 53494 'aria-required': required, 53495 role: 'combobox', 53496 'aria-activedescendant': this.state.isAppleDevice ? undefined : this.state.focusedOptionId || '' 53497 }, menuIsOpen && { 53498 'aria-controls': this.getElementId('listbox') 53499 }), !isSearchable && { 53500 'aria-readonly': true 53501 }), this.hasValue() ? (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === 'initial-input-focus' && { 53502 'aria-describedby': this.getElementId('live-region') 53503 } : { 53504 'aria-describedby': this.getElementId('placeholder') 53505 }); 53506 if (!isSearchable) { 53507 // use a dummy input to maintain focus/blur functionality 53508 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(DummyInput, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({ 53509 id: id, 53510 innerRef: this.getInputRef, 53511 onBlur: this.onInputBlur, 53512 onChange: _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.J, 53513 onFocus: this.onInputFocus, 53514 disabled: isDisabled, 53515 tabIndex: tabIndex, 53516 inputMode: "none", 53517 form: form, 53518 value: "" 53519 }, ariaAttributes)); 53520 } 53521 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(Input, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, commonProps, { 53522 autoCapitalize: "none", 53523 autoComplete: "off", 53524 autoCorrect: "off", 53525 id: id, 53526 innerRef: this.getInputRef, 53527 isDisabled: isDisabled, 53528 isHidden: inputIsHidden, 53529 onBlur: this.onInputBlur, 53530 onChange: this.handleInputChange, 53531 onFocus: this.onInputFocus, 53532 spellCheck: "false", 53533 tabIndex: tabIndex, 53534 form: form, 53535 type: "text", 53536 value: inputValue 53537 }, ariaAttributes)); 53538 } 53539 }, { 53540 key: "renderPlaceholderOrValue", 53541 value: function renderPlaceholderOrValue() { 53542 var _this3 = this; 53543 var _this$getComponents2 = this.getComponents(), 53544 MultiValue = _this$getComponents2.MultiValue, 53545 MultiValueContainer = _this$getComponents2.MultiValueContainer, 53546 MultiValueLabel = _this$getComponents2.MultiValueLabel, 53547 MultiValueRemove = _this$getComponents2.MultiValueRemove, 53548 SingleValue = _this$getComponents2.SingleValue, 53549 Placeholder = _this$getComponents2.Placeholder; 53550 var commonProps = this.commonProps; 53551 var _this$props9 = this.props, 53552 controlShouldRenderValue = _this$props9.controlShouldRenderValue, 53553 isDisabled = _this$props9.isDisabled, 53554 isMulti = _this$props9.isMulti, 53555 inputValue = _this$props9.inputValue, 53556 placeholder = _this$props9.placeholder; 53557 var _this$state5 = this.state, 53558 selectValue = _this$state5.selectValue, 53559 focusedValue = _this$state5.focusedValue, 53560 isFocused = _this$state5.isFocused; 53561 if (!this.hasValue() || !controlShouldRenderValue) { 53562 return inputValue ? null : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(Placeholder, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, commonProps, { 53563 key: "placeholder", 53564 isDisabled: isDisabled, 53565 isFocused: isFocused, 53566 innerProps: { 53567 id: this.getElementId('placeholder') 53568 } 53569 }), placeholder); 53570 } 53571 if (isMulti) { 53572 return selectValue.map(function (opt, index) { 53573 var isOptionFocused = opt === focusedValue; 53574 var key = "".concat(_this3.getOptionLabel(opt), "-").concat(_this3.getOptionValue(opt)); 53575 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(MultiValue, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, commonProps, { 53576 components: { 53577 Container: MultiValueContainer, 53578 Label: MultiValueLabel, 53579 Remove: MultiValueRemove 53580 }, 53581 isFocused: isOptionFocused, 53582 isDisabled: isDisabled, 53583 key: key, 53584 index: index, 53585 removeProps: { 53586 onClick: function onClick() { 53587 return _this3.removeValue(opt); 53588 }, 53589 onTouchEnd: function onTouchEnd() { 53590 return _this3.removeValue(opt); 53591 }, 53592 onMouseDown: function onMouseDown(e) { 53593 e.preventDefault(); 53594 } 53595 }, 53596 data: opt 53597 }), _this3.formatOptionLabel(opt, 'value')); 53598 }); 53599 } 53600 if (inputValue) { 53601 return null; 53602 } 53603 var singleValue = selectValue[0]; 53604 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(SingleValue, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, commonProps, { 53605 data: singleValue, 53606 isDisabled: isDisabled 53607 }), this.formatOptionLabel(singleValue, 'value')); 53608 } 53609 }, { 53610 key: "renderClearIndicator", 53611 value: function renderClearIndicator() { 53612 var _this$getComponents3 = this.getComponents(), 53613 ClearIndicator = _this$getComponents3.ClearIndicator; 53614 var commonProps = this.commonProps; 53615 var _this$props10 = this.props, 53616 isDisabled = _this$props10.isDisabled, 53617 isLoading = _this$props10.isLoading; 53618 var isFocused = this.state.isFocused; 53619 if (!this.isClearable() || !ClearIndicator || isDisabled || !this.hasValue() || isLoading) { 53620 return null; 53621 } 53622 var innerProps = { 53623 onMouseDown: this.onClearIndicatorMouseDown, 53624 onTouchEnd: this.onClearIndicatorTouchEnd, 53625 'aria-hidden': 'true' 53626 }; 53627 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(ClearIndicator, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, commonProps, { 53628 innerProps: innerProps, 53629 isFocused: isFocused 53630 })); 53631 } 53632 }, { 53633 key: "renderLoadingIndicator", 53634 value: function renderLoadingIndicator() { 53635 var _this$getComponents4 = this.getComponents(), 53636 LoadingIndicator = _this$getComponents4.LoadingIndicator; 53637 var commonProps = this.commonProps; 53638 var _this$props11 = this.props, 53639 isDisabled = _this$props11.isDisabled, 53640 isLoading = _this$props11.isLoading; 53641 var isFocused = this.state.isFocused; 53642 if (!LoadingIndicator || !isLoading) return null; 53643 var innerProps = { 53644 'aria-hidden': 'true' 53645 }; 53646 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(LoadingIndicator, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, commonProps, { 53647 innerProps: innerProps, 53648 isDisabled: isDisabled, 53649 isFocused: isFocused 53650 })); 53651 } 53652 }, { 53653 key: "renderIndicatorSeparator", 53654 value: function renderIndicatorSeparator() { 53655 var _this$getComponents5 = this.getComponents(), 53656 DropdownIndicator = _this$getComponents5.DropdownIndicator, 53657 IndicatorSeparator = _this$getComponents5.IndicatorSeparator; 53658 53659 // separator doesn't make sense without the dropdown indicator 53660 if (!DropdownIndicator || !IndicatorSeparator) return null; 53661 var commonProps = this.commonProps; 53662 var isDisabled = this.props.isDisabled; 53663 var isFocused = this.state.isFocused; 53664 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(IndicatorSeparator, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, commonProps, { 53665 isDisabled: isDisabled, 53666 isFocused: isFocused 53667 })); 53668 } 53669 }, { 53670 key: "renderDropdownIndicator", 53671 value: function renderDropdownIndicator() { 53672 var _this$getComponents6 = this.getComponents(), 53673 DropdownIndicator = _this$getComponents6.DropdownIndicator; 53674 if (!DropdownIndicator) return null; 53675 var commonProps = this.commonProps; 53676 var isDisabled = this.props.isDisabled; 53677 var isFocused = this.state.isFocused; 53678 var innerProps = { 53679 onMouseDown: this.onDropdownIndicatorMouseDown, 53680 onTouchEnd: this.onDropdownIndicatorTouchEnd, 53681 'aria-hidden': 'true' 53682 }; 53683 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(DropdownIndicator, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, commonProps, { 53684 innerProps: innerProps, 53685 isDisabled: isDisabled, 53686 isFocused: isFocused 53687 })); 53688 } 53689 }, { 53690 key: "renderMenu", 53691 value: function renderMenu() { 53692 var _this4 = this; 53693 var _this$getComponents7 = this.getComponents(), 53694 Group = _this$getComponents7.Group, 53695 GroupHeading = _this$getComponents7.GroupHeading, 53696 Menu = _this$getComponents7.Menu, 53697 MenuList = _this$getComponents7.MenuList, 53698 MenuPortal = _this$getComponents7.MenuPortal, 53699 LoadingMessage = _this$getComponents7.LoadingMessage, 53700 NoOptionsMessage = _this$getComponents7.NoOptionsMessage, 53701 Option = _this$getComponents7.Option; 53702 var commonProps = this.commonProps; 53703 var focusedOption = this.state.focusedOption; 53704 var _this$props12 = this.props, 53705 captureMenuScroll = _this$props12.captureMenuScroll, 53706 inputValue = _this$props12.inputValue, 53707 isLoading = _this$props12.isLoading, 53708 loadingMessage = _this$props12.loadingMessage, 53709 minMenuHeight = _this$props12.minMenuHeight, 53710 maxMenuHeight = _this$props12.maxMenuHeight, 53711 menuIsOpen = _this$props12.menuIsOpen, 53712 menuPlacement = _this$props12.menuPlacement, 53713 menuPosition = _this$props12.menuPosition, 53714 menuPortalTarget = _this$props12.menuPortalTarget, 53715 menuShouldBlockScroll = _this$props12.menuShouldBlockScroll, 53716 menuShouldScrollIntoView = _this$props12.menuShouldScrollIntoView, 53717 noOptionsMessage = _this$props12.noOptionsMessage, 53718 onMenuScrollToTop = _this$props12.onMenuScrollToTop, 53719 onMenuScrollToBottom = _this$props12.onMenuScrollToBottom; 53720 if (!menuIsOpen) return null; 53721 53722 // TODO: Internal Option Type here 53723 var render = function render(props, id) { 53724 var type = props.type, 53725 data = props.data, 53726 isDisabled = props.isDisabled, 53727 isSelected = props.isSelected, 53728 label = props.label, 53729 value = props.value; 53730 var isFocused = focusedOption === data; 53731 var onHover = isDisabled ? undefined : function () { 53732 return _this4.onOptionHover(data); 53733 }; 53734 var onSelect = isDisabled ? undefined : function () { 53735 return _this4.selectOption(data); 53736 }; 53737 var optionId = "".concat(_this4.getElementId('option'), "-").concat(id); 53738 var innerProps = { 53739 id: optionId, 53740 onClick: onSelect, 53741 onMouseMove: onHover, 53742 onMouseOver: onHover, 53743 tabIndex: -1, 53744 role: 'option', 53745 'aria-selected': _this4.state.isAppleDevice ? undefined : isSelected // is not supported on Apple devices 53746 }; 53747 53748 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(Option, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, commonProps, { 53749 innerProps: innerProps, 53750 data: data, 53751 isDisabled: isDisabled, 53752 isSelected: isSelected, 53753 key: optionId, 53754 label: label, 53755 type: type, 53756 value: value, 53757 isFocused: isFocused, 53758 innerRef: isFocused ? _this4.getFocusedOptionRef : undefined 53759 }), _this4.formatOptionLabel(props.data, 'menu')); 53760 }; 53761 var menuUI; 53762 if (this.hasOptions()) { 53763 menuUI = this.getCategorizedOptions().map(function (item) { 53764 if (item.type === 'group') { 53765 var _data = item.data, 53766 options = item.options, 53767 groupIndex = item.index; 53768 var groupId = "".concat(_this4.getElementId('group'), "-").concat(groupIndex); 53769 var headingId = "".concat(groupId, "-heading"); 53770 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(Group, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, commonProps, { 53771 key: groupId, 53772 data: _data, 53773 options: options, 53774 Heading: GroupHeading, 53775 headingProps: { 53776 id: headingId, 53777 data: item.data 53778 }, 53779 label: _this4.formatGroupLabel(item.data) 53780 }), item.options.map(function (option) { 53781 return render(option, "".concat(groupIndex, "-").concat(option.index)); 53782 })); 53783 } else if (item.type === 'option') { 53784 return render(item, "".concat(item.index)); 53785 } 53786 }); 53787 } else if (isLoading) { 53788 var message = loadingMessage({ 53789 inputValue: inputValue 53790 }); 53791 if (message === null) return null; 53792 menuUI = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(LoadingMessage, commonProps, message); 53793 } else { 53794 var _message = noOptionsMessage({ 53795 inputValue: inputValue 53796 }); 53797 if (_message === null) return null; 53798 menuUI = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(NoOptionsMessage, commonProps, _message); 53799 } 53800 var menuPlacementProps = { 53801 minMenuHeight: minMenuHeight, 53802 maxMenuHeight: maxMenuHeight, 53803 menuPlacement: menuPlacement, 53804 menuPosition: menuPosition, 53805 menuShouldScrollIntoView: menuShouldScrollIntoView 53806 }; 53807 var menuElement = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(_index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.M, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, commonProps, menuPlacementProps), function (_ref4) { 53808 var ref = _ref4.ref, 53809 _ref4$placerProps = _ref4.placerProps, 53810 placement = _ref4$placerProps.placement, 53811 maxHeight = _ref4$placerProps.maxHeight; 53812 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(Menu, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, commonProps, menuPlacementProps, { 53813 innerRef: ref, 53814 innerProps: { 53815 onMouseDown: _this4.onMenuMouseDown, 53816 onMouseMove: _this4.onMenuMouseMove 53817 }, 53818 isLoading: isLoading, 53819 placement: placement 53820 }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(ScrollManager, { 53821 captureEnabled: captureMenuScroll, 53822 onTopArrive: onMenuScrollToTop, 53823 onBottomArrive: onMenuScrollToBottom, 53824 lockEnabled: menuShouldBlockScroll 53825 }, function (scrollTargetRef) { 53826 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(MenuList, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, commonProps, { 53827 innerRef: function innerRef(instance) { 53828 _this4.getMenuListRef(instance); 53829 scrollTargetRef(instance); 53830 }, 53831 innerProps: { 53832 role: 'listbox', 53833 'aria-multiselectable': commonProps.isMulti, 53834 id: _this4.getElementId('listbox') 53835 }, 53836 isLoading: isLoading, 53837 maxHeight: maxHeight, 53838 focusedOption: focusedOption 53839 }), menuUI); 53840 })); 53841 }); 53842 53843 // positioning behaviour is almost identical for portalled and fixed, 53844 // so we use the same component. the actual portalling logic is forked 53845 // within the component based on `menuPosition` 53846 return menuPortalTarget || menuPosition === 'fixed' ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(MenuPortal, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, commonProps, { 53847 appendTo: menuPortalTarget, 53848 controlElement: this.controlRef, 53849 menuPlacement: menuPlacement, 53850 menuPosition: menuPosition 53851 }), menuElement) : menuElement; 53852 } 53853 }, { 53854 key: "renderFormField", 53855 value: function renderFormField() { 53856 var _this5 = this; 53857 var _this$props13 = this.props, 53858 delimiter = _this$props13.delimiter, 53859 isDisabled = _this$props13.isDisabled, 53860 isMulti = _this$props13.isMulti, 53861 name = _this$props13.name, 53862 required = _this$props13.required; 53863 var selectValue = this.state.selectValue; 53864 if (required && !this.hasValue() && !isDisabled) { 53865 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(RequiredInput$1, { 53866 name: name, 53867 onFocus: this.onValueInputFocus 53868 }); 53869 } 53870 if (!name || isDisabled) return; 53871 if (isMulti) { 53872 if (delimiter) { 53873 var value = selectValue.map(function (opt) { 53874 return _this5.getOptionValue(opt); 53875 }).join(delimiter); 53876 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement("input", { 53877 name: name, 53878 type: "hidden", 53879 value: value 53880 }); 53881 } else { 53882 var input = selectValue.length > 0 ? selectValue.map(function (opt, i) { 53883 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement("input", { 53884 key: "i-".concat(i), 53885 name: name, 53886 type: "hidden", 53887 value: _this5.getOptionValue(opt) 53888 }); 53889 }) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement("input", { 53890 name: name, 53891 type: "hidden", 53892 value: "" 53893 }); 53894 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement("div", null, input); 53895 } 53896 } else { 53897 var _value = selectValue[0] ? this.getOptionValue(selectValue[0]) : ''; 53898 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement("input", { 53899 name: name, 53900 type: "hidden", 53901 value: _value 53902 }); 53903 } 53904 } 53905 }, { 53906 key: "renderLiveRegion", 53907 value: function renderLiveRegion() { 53908 var commonProps = this.commonProps; 53909 var _this$state6 = this.state, 53910 ariaSelection = _this$state6.ariaSelection, 53911 focusedOption = _this$state6.focusedOption, 53912 focusedValue = _this$state6.focusedValue, 53913 isFocused = _this$state6.isFocused, 53914 selectValue = _this$state6.selectValue; 53915 var focusableOptions = this.getFocusableOptions(); 53916 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(LiveRegion$1, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, commonProps, { 53917 id: this.getElementId('live-region'), 53918 ariaSelection: ariaSelection, 53919 focusedOption: focusedOption, 53920 focusedValue: focusedValue, 53921 isFocused: isFocused, 53922 selectValue: selectValue, 53923 focusableOptions: focusableOptions, 53924 isAppleDevice: this.state.isAppleDevice 53925 })); 53926 } 53927 }, { 53928 key: "render", 53929 value: function render() { 53930 var _this$getComponents8 = this.getComponents(), 53931 Control = _this$getComponents8.Control, 53932 IndicatorsContainer = _this$getComponents8.IndicatorsContainer, 53933 SelectContainer = _this$getComponents8.SelectContainer, 53934 ValueContainer = _this$getComponents8.ValueContainer; 53935 var _this$props14 = this.props, 53936 className = _this$props14.className, 53937 id = _this$props14.id, 53938 isDisabled = _this$props14.isDisabled, 53939 menuIsOpen = _this$props14.menuIsOpen; 53940 var isFocused = this.state.isFocused; 53941 var commonProps = this.commonProps = this.getCommonProps(); 53942 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(SelectContainer, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, commonProps, { 53943 className: className, 53944 innerProps: { 53945 id: id, 53946 onKeyDown: this.onKeyDown 53947 }, 53948 isDisabled: isDisabled, 53949 isFocused: isFocused 53950 }), this.renderLiveRegion(), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(Control, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, commonProps, { 53951 innerRef: this.getControlRef, 53952 innerProps: { 53953 onMouseDown: this.onControlMouseDown, 53954 onTouchEnd: this.onControlTouchEnd 53955 }, 53956 isDisabled: isDisabled, 53957 isFocused: isFocused, 53958 menuIsOpen: menuIsOpen 53959 }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(ValueContainer, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, commonProps, { 53960 isDisabled: isDisabled 53961 }), this.renderPlaceholderOrValue(), this.renderInput()), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(IndicatorsContainer, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, commonProps, { 53962 isDisabled: isDisabled 53963 }), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderIndicatorSeparator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField()); 53964 } 53965 }], [{ 53966 key: "getDerivedStateFromProps", 53967 value: function getDerivedStateFromProps(props, state) { 53968 var prevProps = state.prevProps, 53969 clearFocusValueOnUpdate = state.clearFocusValueOnUpdate, 53970 inputIsHiddenAfterUpdate = state.inputIsHiddenAfterUpdate, 53971 ariaSelection = state.ariaSelection, 53972 isFocused = state.isFocused, 53973 prevWasFocused = state.prevWasFocused, 53974 instancePrefix = state.instancePrefix; 53975 var options = props.options, 53976 value = props.value, 53977 menuIsOpen = props.menuIsOpen, 53978 inputValue = props.inputValue, 53979 isMulti = props.isMulti; 53980 var selectValue = (0,_index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.H)(value); 53981 var newMenuOptionsState = {}; 53982 if (prevProps && (value !== prevProps.value || options !== prevProps.options || menuIsOpen !== prevProps.menuIsOpen || inputValue !== prevProps.inputValue)) { 53983 var focusableOptions = menuIsOpen ? buildFocusableOptions(props, selectValue) : []; 53984 var focusableOptionsWithIds = menuIsOpen ? buildFocusableOptionsWithIds(buildCategorizedOptions(props, selectValue), "".concat(instancePrefix, "-option")) : []; 53985 var focusedValue = clearFocusValueOnUpdate ? getNextFocusedValue(state, selectValue) : null; 53986 var focusedOption = getNextFocusedOption(state, focusableOptions); 53987 var focusedOptionId = getFocusedOptionId(focusableOptionsWithIds, focusedOption); 53988 newMenuOptionsState = { 53989 selectValue: selectValue, 53990 focusedOption: focusedOption, 53991 focusedOptionId: focusedOptionId, 53992 focusableOptionsWithIds: focusableOptionsWithIds, 53993 focusedValue: focusedValue, 53994 clearFocusValueOnUpdate: false 53995 }; 53996 } 53997 // some updates should toggle the state of the input visibility 53998 var newInputIsHiddenState = inputIsHiddenAfterUpdate != null && props !== prevProps ? { 53999 inputIsHidden: inputIsHiddenAfterUpdate, 54000 inputIsHiddenAfterUpdate: undefined 54001 } : {}; 54002 var newAriaSelection = ariaSelection; 54003 var hasKeptFocus = isFocused && prevWasFocused; 54004 if (isFocused && !hasKeptFocus) { 54005 // If `value` or `defaultValue` props are not empty then announce them 54006 // when the Select is initially focused 54007 newAriaSelection = { 54008 value: (0,_index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_8__.D)(isMulti, selectValue, selectValue[0] || null), 54009 options: selectValue, 54010 action: 'initial-input-focus' 54011 }; 54012 hasKeptFocus = !prevWasFocused; 54013 } 54014 54015 // If the 'initial-input-focus' action has been set already 54016 // then reset the ariaSelection to null 54017 if ((ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === 'initial-input-focus') { 54018 newAriaSelection = null; 54019 } 54020 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])({}, newMenuOptionsState), newInputIsHiddenState), {}, { 54021 prevProps: props, 54022 ariaSelection: newAriaSelection, 54023 prevWasFocused: hasKeptFocus 54024 }); 54025 } 54026 }]); 54027 return Select; 54028}(react__WEBPACK_IMPORTED_MODULE_7__.Component); 54029Select.defaultProps = defaultProps; 54030 54031 54032 54033 54034/***/ }), 54035
vendor: 81,217 bytes, lines 54036-55492
54036/***/ "./node_modules/react-select/dist/index-641ee5b8.esm.js": 54037/*!**************************************************************!*\ 54038 !*** ./node_modules/react-select/dist/index-641ee5b8.esm.js ***! 54039 \**************************************************************/ 54040/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 54041 54042"use strict"; 54043__webpack_require__.r(__webpack_exports__); 54044/* harmony export */ __webpack_require__.d(__webpack_exports__, { 54045/* harmony export */ A: () => (/* binding */ isMobileDevice), 54046/* harmony export */ B: () => (/* binding */ multiValueAsValue), 54047/* harmony export */ C: () => (/* binding */ singleValueAsValue), 54048/* harmony export */ D: () => (/* binding */ valueTernary), 54049/* harmony export */ E: () => (/* binding */ classNames), 54050/* harmony export */ F: () => (/* binding */ defaultComponents), 54051/* harmony export */ G: () => (/* binding */ isDocumentElement), 54052/* harmony export */ H: () => (/* binding */ cleanValue), 54053/* harmony export */ I: () => (/* binding */ scrollIntoView), 54054/* harmony export */ J: () => (/* binding */ noop), 54055/* harmony export */ K: () => (/* binding */ notNullish), 54056/* harmony export */ L: () => (/* binding */ handleInputChange), 54057/* harmony export */ M: () => (/* binding */ MenuPlacer), 54058/* harmony export */ a: () => (/* binding */ clearIndicatorCSS), 54059/* harmony export */ b: () => (/* binding */ containerCSS), 54060/* harmony export */ c: () => (/* binding */ components), 54061/* harmony export */ d: () => (/* binding */ css$1), 54062/* harmony export */ e: () => (/* binding */ dropdownIndicatorCSS), 54063/* harmony export */ f: () => (/* binding */ groupHeadingCSS), 54064/* harmony export */ g: () => (/* binding */ groupCSS), 54065/* harmony export */ h: () => (/* binding */ indicatorSeparatorCSS), 54066/* harmony export */ i: () => (/* binding */ indicatorsContainerCSS), 54067/* harmony export */ j: () => (/* binding */ inputCSS), 54068/* harmony export */ k: () => (/* binding */ loadingMessageCSS), 54069/* harmony export */ l: () => (/* binding */ loadingIndicatorCSS), 54070/* harmony export */ m: () => (/* binding */ menuCSS), 54071/* harmony export */ n: () => (/* binding */ menuListCSS), 54072/* harmony export */ o: () => (/* binding */ menuPortalCSS), 54073/* harmony export */ p: () => (/* binding */ multiValueCSS), 54074/* harmony export */ q: () => (/* binding */ multiValueLabelCSS), 54075/* harmony export */ r: () => (/* binding */ removeProps), 54076/* harmony export */ s: () => (/* binding */ supportsPassiveEvents), 54077/* harmony export */ t: () => (/* binding */ multiValueRemoveCSS), 54078/* harmony export */ u: () => (/* binding */ noOptionsMessageCSS), 54079/* harmony export */ v: () => (/* binding */ optionCSS), 54080/* harmony export */ w: () => (/* binding */ placeholderCSS), 54081/* harmony export */ x: () => (/* binding */ css), 54082/* harmony export */ y: () => (/* binding */ valueContainerCSS), 54083/* harmony export */ z: () => (/* binding */ isTouchCapable) 54084/* harmony export */ }); 54085/* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ "./node_modules/@babel/runtime/helpers/esm/objectSpread2.js"); 54086/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./node_modules/@babel/runtime/helpers/esm/extends.js"); 54087/* harmony import */ var _emotion_react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @emotion/react */ "./node_modules/@emotion/react/dist/emotion-react.browser.development.esm.js"); 54088/* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/slicedToArray */ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"); 54089/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutProperties */ "./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"); 54090/* harmony import */ var _babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/esm/typeof */ "./node_modules/@babel/runtime/helpers/esm/typeof.js"); 54091/* harmony import */ var _babel_runtime_helpers_esm_taggedTemplateLiteral__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/esm/taggedTemplateLiteral */ "./node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js"); 54092/* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/esm/defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js"); 54093/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 54094/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js"); 54095/* harmony import */ var _floating_ui_dom__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @floating-ui/dom */ "./node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs"); 54096/* harmony import */ var use_isomorphic_layout_effect__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! use-isomorphic-layout-effect */ "./node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js"); 54097 54098 54099 54100 54101 54102 54103 54104 54105 54106 54107 54108 54109 54110var _excluded$4 = ["className", "clearValue", "cx", "getStyles", "getClassNames", "getValue", "hasValue", "isMulti", "isRtl", "options", "selectOption", "selectProps", "setValue", "theme"]; 54111// ============================== 54112// NO OP 54113// ============================== 54114 54115var noop = function noop() {}; 54116 54117// ============================== 54118// Class Name Prefixer 54119// ============================== 54120 54121/** 54122 String representation of component state for styling with class names. 54123 54124 Expects an array of strings OR a string/object pair: 54125 - className(['comp', 'comp-arg', 'comp-arg-2']) 54126 @returns 'react-select__comp react-select__comp-arg react-select__comp-arg-2' 54127 - className('comp', { some: true, state: false }) 54128 @returns 'react-select__comp react-select__comp--some' 54129*/ 54130function applyPrefixToName(prefix, name) { 54131 if (!name) { 54132 return prefix; 54133 } else if (name[0] === '-') { 54134 return prefix + name; 54135 } else { 54136 return prefix + '__' + name; 54137 } 54138} 54139function classNames(prefix, state) { 54140 for (var _len = arguments.length, classNameList = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { 54141 classNameList[_key - 2] = arguments[_key]; 54142 } 54143 var arr = [].concat(classNameList); 54144 if (state && prefix) { 54145 for (var key in state) { 54146 if (state.hasOwnProperty(key) && state[key]) { 54147 arr.push("".concat(applyPrefixToName(prefix, key))); 54148 } 54149 } 54150 } 54151 return arr.filter(function (i) { 54152 return i; 54153 }).map(function (i) { 54154 return String(i).trim(); 54155 }).join(' '); 54156} 54157// ============================== 54158// Clean Value 54159// ============================== 54160 54161var cleanValue = function cleanValue(value) { 54162 if (isArray(value)) return value.filter(Boolean); 54163 if ((0,_babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_5__["default"])(value) === 'object' && value !== null) return [value]; 54164 return []; 54165}; 54166 54167// ============================== 54168// Clean Common Props 54169// ============================== 54170 54171var cleanCommonProps = function cleanCommonProps(props) { 54172 //className 54173 props.className; 54174 props.clearValue; 54175 props.cx; 54176 props.getStyles; 54177 props.getClassNames; 54178 props.getValue; 54179 props.hasValue; 54180 props.isMulti; 54181 props.isRtl; 54182 props.options; 54183 props.selectOption; 54184 props.selectProps; 54185 props.setValue; 54186 props.theme; 54187 var innerProps = (0,_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_4__["default"])(props, _excluded$4); 54188 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({}, innerProps); 54189}; 54190 54191// ============================== 54192// Get Style Props 54193// ============================== 54194 54195var getStyleProps = function getStyleProps(props, name, classNamesState) { 54196 var cx = props.cx, 54197 getStyles = props.getStyles, 54198 getClassNames = props.getClassNames, 54199 className = props.className; 54200 return { 54201 css: getStyles(name, props), 54202 className: cx(classNamesState !== null && classNamesState !== void 0 ? classNamesState : {}, getClassNames(name, props), className) 54203 }; 54204}; 54205 54206// ============================== 54207// Handle Input Change 54208// ============================== 54209 54210function handleInputChange(inputValue, actionMeta, onInputChange) { 54211 if (onInputChange) { 54212 var _newValue = onInputChange(inputValue, actionMeta); 54213 if (typeof _newValue === 'string') return _newValue; 54214 } 54215 return inputValue; 54216} 54217 54218// ============================== 54219// Scroll Helpers 54220// ============================== 54221 54222function isDocumentElement(el) { 54223 return [document.documentElement, document.body, window].indexOf(el) > -1; 54224} 54225 54226// Normalized Scroll Top 54227// ------------------------------ 54228 54229function normalizedHeight(el) { 54230 if (isDocumentElement(el)) { 54231 return window.innerHeight; 54232 } 54233 return el.clientHeight; 54234} 54235 54236// Normalized scrollTo & scrollTop 54237// ------------------------------ 54238 54239function getScrollTop(el) { 54240 if (isDocumentElement(el)) { 54241 return window.pageYOffset; 54242 } 54243 return el.scrollTop; 54244} 54245function scrollTo(el, top) { 54246 // with a scroll distance, we perform scroll on the element 54247 if (isDocumentElement(el)) { 54248 window.scrollTo(0, top); 54249 return; 54250 } 54251 el.scrollTop = top; 54252} 54253 54254// Get Scroll Parent 54255// ------------------------------ 54256 54257function getScrollParent(element) { 54258 var style = getComputedStyle(element); 54259 var excludeStaticParent = style.position === 'absolute'; 54260 var overflowRx = /(auto|scroll)/; 54261 if (style.position === 'fixed') return document.documentElement; 54262 for (var parent = element; parent = parent.parentElement;) { 54263 style = getComputedStyle(parent); 54264 if (excludeStaticParent && style.position === 'static') { 54265 continue; 54266 } 54267 if (overflowRx.test(style.overflow + style.overflowY + style.overflowX)) { 54268 return parent; 54269 } 54270 } 54271 return document.documentElement; 54272} 54273 54274// Animated Scroll To 54275// ------------------------------ 54276 54277/** 54278 @param t: time (elapsed) 54279 @param b: initial value 54280 @param c: amount of change 54281 @param d: duration 54282*/ 54283function easeOutCubic(t, b, c, d) { 54284 return c * ((t = t / d - 1) * t * t + 1) + b; 54285} 54286function animatedScrollTo(element, to) { 54287 var duration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 200; 54288 var callback = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : noop; 54289 var start = getScrollTop(element); 54290 var change = to - start; 54291 var increment = 10; 54292 var currentTime = 0; 54293 function animateScroll() { 54294 currentTime += increment; 54295 var val = easeOutCubic(currentTime, start, change, duration); 54296 scrollTo(element, val); 54297 if (currentTime < duration) { 54298 window.requestAnimationFrame(animateScroll); 54299 } else { 54300 callback(element); 54301 } 54302 } 54303 animateScroll(); 54304} 54305 54306// Scroll Into View 54307// ------------------------------ 54308 54309function scrollIntoView(menuEl, focusedEl) { 54310 var menuRect = menuEl.getBoundingClientRect(); 54311 var focusedRect = focusedEl.getBoundingClientRect(); 54312 var overScroll = focusedEl.offsetHeight / 3; 54313 if (focusedRect.bottom + overScroll > menuRect.bottom) { 54314 scrollTo(menuEl, Math.min(focusedEl.offsetTop + focusedEl.clientHeight - menuEl.offsetHeight + overScroll, menuEl.scrollHeight)); 54315 } else if (focusedRect.top - overScroll < menuRect.top) { 54316 scrollTo(menuEl, Math.max(focusedEl.offsetTop - overScroll, 0)); 54317 } 54318} 54319 54320// ============================== 54321// Get bounding client object 54322// ============================== 54323 54324// cannot get keys using array notation with DOMRect 54325function getBoundingClientObj(element) { 54326 var rect = element.getBoundingClientRect(); 54327 return { 54328 bottom: rect.bottom, 54329 height: rect.height, 54330 left: rect.left, 54331 right: rect.right, 54332 top: rect.top, 54333 width: rect.width 54334 }; 54335} 54336 54337// ============================== 54338// Touch Capability Detector 54339// ============================== 54340 54341function isTouchCapable() { 54342 try { 54343 document.createEvent('TouchEvent'); 54344 return true; 54345 } catch (e) { 54346 return false; 54347 } 54348} 54349 54350// ============================== 54351// Mobile Device Detector 54352// ============================== 54353 54354function isMobileDevice() { 54355 try { 54356 return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); 54357 } catch (e) { 54358 return false; 54359 } 54360} 54361 54362// ============================== 54363// Passive Event Detector 54364// ============================== 54365 54366// https://github.com/rafgraph/detect-it/blob/main/src/index.ts#L19-L36 54367var passiveOptionAccessed = false; 54368var options = { 54369 get passive() { 54370 return passiveOptionAccessed = true; 54371 } 54372}; 54373// check for SSR 54374var w = typeof window !== 'undefined' ? window : {}; 54375if (w.addEventListener && w.removeEventListener) { 54376 w.addEventListener('p', noop, options); 54377 w.removeEventListener('p', noop, false); 54378} 54379var supportsPassiveEvents = passiveOptionAccessed; 54380function notNullish(item) { 54381 return item != null; 54382} 54383function isArray(arg) { 54384 return Array.isArray(arg); 54385} 54386function valueTernary(isMulti, multiValue, singleValue) { 54387 return isMulti ? multiValue : singleValue; 54388} 54389function singleValueAsValue(singleValue) { 54390 return singleValue; 54391} 54392function multiValueAsValue(multiValue) { 54393 return multiValue; 54394} 54395var removeProps = function removeProps(propsObj) { 54396 for (var _len2 = arguments.length, properties = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { 54397 properties[_key2 - 1] = arguments[_key2]; 54398 } 54399 var propsMap = Object.entries(propsObj).filter(function (_ref) { 54400 var _ref2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_3__["default"])(_ref, 1), 54401 key = _ref2[0]; 54402 return !properties.includes(key); 54403 }); 54404 return propsMap.reduce(function (newProps, _ref3) { 54405 var _ref4 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_3__["default"])(_ref3, 2), 54406 key = _ref4[0], 54407 val = _ref4[1]; 54408 newProps[key] = val; 54409 return newProps; 54410 }, {}); 54411}; 54412 54413var _excluded$3 = ["children", "innerProps"], 54414 _excluded2$1 = ["children", "innerProps"]; 54415function getMenuPlacement(_ref) { 54416 var preferredMaxHeight = _ref.maxHeight, 54417 menuEl = _ref.menuEl, 54418 minHeight = _ref.minHeight, 54419 preferredPlacement = _ref.placement, 54420 shouldScroll = _ref.shouldScroll, 54421 isFixedPosition = _ref.isFixedPosition, 54422 controlHeight = _ref.controlHeight; 54423 var scrollParent = getScrollParent(menuEl); 54424 var defaultState = { 54425 placement: 'bottom', 54426 maxHeight: preferredMaxHeight 54427 }; 54428 54429 // something went wrong, return default state 54430 if (!menuEl || !menuEl.offsetParent) return defaultState; 54431 54432 // we can't trust `scrollParent.scrollHeight` --> it may increase when 54433 // the menu is rendered 54434 var _scrollParent$getBoun = scrollParent.getBoundingClientRect(), 54435 scrollHeight = _scrollParent$getBoun.height; 54436 var _menuEl$getBoundingCl = menuEl.getBoundingClientRect(), 54437 menuBottom = _menuEl$getBoundingCl.bottom, 54438 menuHeight = _menuEl$getBoundingCl.height, 54439 menuTop = _menuEl$getBoundingCl.top; 54440 var _menuEl$offsetParent$ = menuEl.offsetParent.getBoundingClientRect(), 54441 containerTop = _menuEl$offsetParent$.top; 54442 var viewHeight = isFixedPosition ? window.innerHeight : normalizedHeight(scrollParent); 54443 var scrollTop = getScrollTop(scrollParent); 54444 var marginBottom = parseInt(getComputedStyle(menuEl).marginBottom, 10); 54445 var marginTop = parseInt(getComputedStyle(menuEl).marginTop, 10); 54446 var viewSpaceAbove = containerTop - marginTop; 54447 var viewSpaceBelow = viewHeight - menuTop; 54448 var scrollSpaceAbove = viewSpaceAbove + scrollTop; 54449 var scrollSpaceBelow = scrollHeight - scrollTop - menuTop; 54450 var scrollDown = menuBottom - viewHeight + scrollTop + marginBottom; 54451 var scrollUp = scrollTop + menuTop - marginTop; 54452 var scrollDuration = 160; 54453 switch (preferredPlacement) { 54454 case 'auto': 54455 case 'bottom': 54456 // 1: the menu will fit, do nothing 54457 if (viewSpaceBelow >= menuHeight) { 54458 return { 54459 placement: 'bottom', 54460 maxHeight: preferredMaxHeight 54461 }; 54462 } 54463 54464 // 2: the menu will fit, if scrolled 54465 if (scrollSpaceBelow >= menuHeight && !isFixedPosition) { 54466 if (shouldScroll) { 54467 animatedScrollTo(scrollParent, scrollDown, scrollDuration); 54468 } 54469 return { 54470 placement: 'bottom', 54471 maxHeight: preferredMaxHeight 54472 }; 54473 } 54474 54475 // 3: the menu will fit, if constrained 54476 if (!isFixedPosition && scrollSpaceBelow >= minHeight || isFixedPosition && viewSpaceBelow >= minHeight) { 54477 if (shouldScroll) { 54478 animatedScrollTo(scrollParent, scrollDown, scrollDuration); 54479 } 54480 54481 // we want to provide as much of the menu as possible to the user, 54482 // so give them whatever is available below rather than the minHeight. 54483 var constrainedHeight = isFixedPosition ? viewSpaceBelow - marginBottom : scrollSpaceBelow - marginBottom; 54484 return { 54485 placement: 'bottom', 54486 maxHeight: constrainedHeight 54487 }; 54488 } 54489 54490 // 4. Forked beviour when there isn't enough space below 54491 54492 // AUTO: flip the menu, render above 54493 if (preferredPlacement === 'auto' || isFixedPosition) { 54494 // may need to be constrained after flipping 54495 var _constrainedHeight = preferredMaxHeight; 54496 var spaceAbove = isFixedPosition ? viewSpaceAbove : scrollSpaceAbove; 54497 if (spaceAbove >= minHeight) { 54498 _constrainedHeight = Math.min(spaceAbove - marginBottom - controlHeight, preferredMaxHeight); 54499 } 54500 return { 54501 placement: 'top', 54502 maxHeight: _constrainedHeight 54503 }; 54504 } 54505 54506 // BOTTOM: allow browser to increase scrollable area and immediately set scroll 54507 if (preferredPlacement === 'bottom') { 54508 if (shouldScroll) { 54509 scrollTo(scrollParent, scrollDown); 54510 } 54511 return { 54512 placement: 'bottom', 54513 maxHeight: preferredMaxHeight 54514 }; 54515 } 54516 break; 54517 case 'top': 54518 // 1: the menu will fit, do nothing 54519 if (viewSpaceAbove >= menuHeight) { 54520 return { 54521 placement: 'top', 54522 maxHeight: preferredMaxHeight 54523 }; 54524 } 54525 54526 // 2: the menu will fit, if scrolled 54527 if (scrollSpaceAbove >= menuHeight && !isFixedPosition) { 54528 if (shouldScroll) { 54529 animatedScrollTo(scrollParent, scrollUp, scrollDuration); 54530 } 54531 return { 54532 placement: 'top', 54533 maxHeight: preferredMaxHeight 54534 }; 54535 } 54536 54537 // 3: the menu will fit, if constrained 54538 if (!isFixedPosition && scrollSpaceAbove >= minHeight || isFixedPosition && viewSpaceAbove >= minHeight) { 54539 var _constrainedHeight2 = preferredMaxHeight; 54540 54541 // we want to provide as much of the menu as possible to the user, 54542 // so give them whatever is available below rather than the minHeight. 54543 if (!isFixedPosition && scrollSpaceAbove >= minHeight || isFixedPosition && viewSpaceAbove >= minHeight) { 54544 _constrainedHeight2 = isFixedPosition ? viewSpaceAbove - marginTop : scrollSpaceAbove - marginTop; 54545 } 54546 if (shouldScroll) { 54547 animatedScrollTo(scrollParent, scrollUp, scrollDuration); 54548 } 54549 return { 54550 placement: 'top', 54551 maxHeight: _constrainedHeight2 54552 }; 54553 } 54554 54555 // 4. not enough space, the browser WILL NOT increase scrollable area when 54556 // absolutely positioned element rendered above the viewport (only below). 54557 // Flip the menu, render below 54558 return { 54559 placement: 'bottom', 54560 maxHeight: preferredMaxHeight 54561 }; 54562 default: 54563 throw new Error("Invalid placement provided \"".concat(preferredPlacement, "\".")); 54564 } 54565 return defaultState; 54566} 54567 54568// Menu Component 54569// ------------------------------ 54570 54571function alignToControl(placement) { 54572 var placementToCSSProp = { 54573 bottom: 'top', 54574 top: 'bottom' 54575 }; 54576 return placement ? placementToCSSProp[placement] : 'bottom'; 54577} 54578var coercePlacement = function coercePlacement(p) { 54579 return p === 'auto' ? 'bottom' : p; 54580}; 54581var menuCSS = function menuCSS(_ref2, unstyled) { 54582 var _objectSpread2; 54583 var placement = _ref2.placement, 54584 _ref2$theme = _ref2.theme, 54585 borderRadius = _ref2$theme.borderRadius, 54586 spacing = _ref2$theme.spacing, 54587 colors = _ref2$theme.colors; 54588 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])((_objectSpread2 = { 54589 label: 'menu' 54590 }, (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_7__["default"])(_objectSpread2, alignToControl(placement), '100%'), (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_7__["default"])(_objectSpread2, "position", 'absolute'), (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_7__["default"])(_objectSpread2, "width", '100%'), (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_7__["default"])(_objectSpread2, "zIndex", 1), _objectSpread2), unstyled ? {} : { 54591 backgroundColor: colors.neutral0, 54592 borderRadius: borderRadius, 54593 boxShadow: '0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)', 54594 marginBottom: spacing.menuGutter, 54595 marginTop: spacing.menuGutter 54596 }); 54597}; 54598var PortalPlacementContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_8__.createContext)(null); 54599 54600// NOTE: internal only 54601var MenuPlacer = function MenuPlacer(props) { 54602 var children = props.children, 54603 minMenuHeight = props.minMenuHeight, 54604 maxMenuHeight = props.maxMenuHeight, 54605 menuPlacement = props.menuPlacement, 54606 menuPosition = props.menuPosition, 54607 menuShouldScrollIntoView = props.menuShouldScrollIntoView, 54608 theme = props.theme; 54609 var _ref3 = (0,react__WEBPACK_IMPORTED_MODULE_8__.useContext)(PortalPlacementContext) || {}, 54610 setPortalPlacement = _ref3.setPortalPlacement; 54611 var ref = (0,react__WEBPACK_IMPORTED_MODULE_8__.useRef)(null); 54612 var _useState = (0,react__WEBPACK_IMPORTED_MODULE_8__.useState)(maxMenuHeight), 54613 _useState2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_3__["default"])(_useState, 2), 54614 maxHeight = _useState2[0], 54615 setMaxHeight = _useState2[1]; 54616 var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_8__.useState)(null), 54617 _useState4 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_3__["default"])(_useState3, 2), 54618 placement = _useState4[0], 54619 setPlacement = _useState4[1]; 54620 var controlHeight = theme.spacing.controlHeight; 54621 (0,use_isomorphic_layout_effect__WEBPACK_IMPORTED_MODULE_11__["default"])(function () { 54622 var menuEl = ref.current; 54623 if (!menuEl) return; 54624 54625 // DO NOT scroll if position is fixed 54626 var isFixedPosition = menuPosition === 'fixed'; 54627 var shouldScroll = menuShouldScrollIntoView && !isFixedPosition; 54628 var state = getMenuPlacement({ 54629 maxHeight: maxMenuHeight, 54630 menuEl: menuEl, 54631 minHeight: minMenuHeight, 54632 placement: menuPlacement, 54633 shouldScroll: shouldScroll, 54634 isFixedPosition: isFixedPosition, 54635 controlHeight: controlHeight 54636 }); 54637 setMaxHeight(state.maxHeight); 54638 setPlacement(state.placement); 54639 setPortalPlacement === null || setPortalPlacement === void 0 ? void 0 : setPortalPlacement(state.placement); 54640 }, [maxMenuHeight, menuPlacement, menuPosition, menuShouldScrollIntoView, minMenuHeight, setPortalPlacement, controlHeight]); 54641 return children({ 54642 ref: ref, 54643 placerProps: (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({}, props), {}, { 54644 placement: placement || coercePlacement(menuPlacement), 54645 maxHeight: maxHeight 54646 }) 54647 }); 54648}; 54649var Menu = function Menu(props) { 54650 var children = props.children, 54651 innerRef = props.innerRef, 54652 innerProps = props.innerProps; 54653 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, getStyleProps(props, 'menu', { 54654 menu: true 54655 }), { 54656 ref: innerRef 54657 }, innerProps), children); 54658}; 54659var Menu$1 = Menu; 54660 54661// ============================== 54662// Menu List 54663// ============================== 54664 54665var menuListCSS = function menuListCSS(_ref4, unstyled) { 54666 var maxHeight = _ref4.maxHeight, 54667 baseUnit = _ref4.theme.spacing.baseUnit; 54668 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({ 54669 maxHeight: maxHeight, 54670 overflowY: 'auto', 54671 position: 'relative', 54672 // required for offset[Height, Top] > keyboard scroll 54673 WebkitOverflowScrolling: 'touch' 54674 }, unstyled ? {} : { 54675 paddingBottom: baseUnit, 54676 paddingTop: baseUnit 54677 }); 54678}; 54679var MenuList = function MenuList(props) { 54680 var children = props.children, 54681 innerProps = props.innerProps, 54682 innerRef = props.innerRef, 54683 isMulti = props.isMulti; 54684 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, getStyleProps(props, 'menuList', { 54685 'menu-list': true, 54686 'menu-list--is-multi': isMulti 54687 }), { 54688 ref: innerRef 54689 }, innerProps), children); 54690}; 54691 54692// ============================== 54693// Menu Notices 54694// ============================== 54695 54696var noticeCSS = function noticeCSS(_ref5, unstyled) { 54697 var _ref5$theme = _ref5.theme, 54698 baseUnit = _ref5$theme.spacing.baseUnit, 54699 colors = _ref5$theme.colors; 54700 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({ 54701 textAlign: 'center' 54702 }, unstyled ? {} : { 54703 color: colors.neutral40, 54704 padding: "".concat(baseUnit * 2, "px ").concat(baseUnit * 3, "px") 54705 }); 54706}; 54707var noOptionsMessageCSS = noticeCSS; 54708var loadingMessageCSS = noticeCSS; 54709var NoOptionsMessage = function NoOptionsMessage(_ref6) { 54710 var _ref6$children = _ref6.children, 54711 children = _ref6$children === void 0 ? 'No options' : _ref6$children, 54712 innerProps = _ref6.innerProps, 54713 restProps = (0,_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_4__["default"])(_ref6, _excluded$3); 54714 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, getStyleProps((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({}, restProps), {}, { 54715 children: children, 54716 innerProps: innerProps 54717 }), 'noOptionsMessage', { 54718 'menu-notice': true, 54719 'menu-notice--no-options': true 54720 }), innerProps), children); 54721}; 54722var LoadingMessage = function LoadingMessage(_ref7) { 54723 var _ref7$children = _ref7.children, 54724 children = _ref7$children === void 0 ? 'Loading...' : _ref7$children, 54725 innerProps = _ref7.innerProps, 54726 restProps = (0,_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_4__["default"])(_ref7, _excluded2$1); 54727 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, getStyleProps((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({}, restProps), {}, { 54728 children: children, 54729 innerProps: innerProps 54730 }), 'loadingMessage', { 54731 'menu-notice': true, 54732 'menu-notice--loading': true 54733 }), innerProps), children); 54734}; 54735 54736// ============================== 54737// Menu Portal 54738// ============================== 54739 54740var menuPortalCSS = function menuPortalCSS(_ref8) { 54741 var rect = _ref8.rect, 54742 offset = _ref8.offset, 54743 position = _ref8.position; 54744 return { 54745 left: rect.left, 54746 position: position, 54747 top: offset, 54748 width: rect.width, 54749 zIndex: 1 54750 }; 54751}; 54752var MenuPortal = function MenuPortal(props) { 54753 var appendTo = props.appendTo, 54754 children = props.children, 54755 controlElement = props.controlElement, 54756 innerProps = props.innerProps, 54757 menuPlacement = props.menuPlacement, 54758 menuPosition = props.menuPosition; 54759 var menuPortalRef = (0,react__WEBPACK_IMPORTED_MODULE_8__.useRef)(null); 54760 var cleanupRef = (0,react__WEBPACK_IMPORTED_MODULE_8__.useRef)(null); 54761 var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_8__.useState)(coercePlacement(menuPlacement)), 54762 _useState6 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_3__["default"])(_useState5, 2), 54763 placement = _useState6[0], 54764 setPortalPlacement = _useState6[1]; 54765 var portalPlacementContext = (0,react__WEBPACK_IMPORTED_MODULE_8__.useMemo)(function () { 54766 return { 54767 setPortalPlacement: setPortalPlacement 54768 }; 54769 }, []); 54770 var _useState7 = (0,react__WEBPACK_IMPORTED_MODULE_8__.useState)(null), 54771 _useState8 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_3__["default"])(_useState7, 2), 54772 computedPosition = _useState8[0], 54773 setComputedPosition = _useState8[1]; 54774 var updateComputedPosition = (0,react__WEBPACK_IMPORTED_MODULE_8__.useCallback)(function () { 54775 if (!controlElement) return; 54776 var rect = getBoundingClientObj(controlElement); 54777 var scrollDistance = menuPosition === 'fixed' ? 0 : window.pageYOffset; 54778 var offset = rect[placement] + scrollDistance; 54779 if (offset !== (computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.offset) || rect.left !== (computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.left) || rect.width !== (computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.width)) { 54780 setComputedPosition({ 54781 offset: offset, 54782 rect: rect 54783 }); 54784 } 54785 }, [controlElement, menuPosition, placement, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.offset, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.left, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.rect.width]); 54786 (0,use_isomorphic_layout_effect__WEBPACK_IMPORTED_MODULE_11__["default"])(function () { 54787 updateComputedPosition(); 54788 }, [updateComputedPosition]); 54789 var runAutoUpdate = (0,react__WEBPACK_IMPORTED_MODULE_8__.useCallback)(function () { 54790 if (typeof cleanupRef.current === 'function') { 54791 cleanupRef.current(); 54792 cleanupRef.current = null; 54793 } 54794 if (controlElement && menuPortalRef.current) { 54795 cleanupRef.current = (0,_floating_ui_dom__WEBPACK_IMPORTED_MODULE_10__.autoUpdate)(controlElement, menuPortalRef.current, updateComputedPosition, { 54796 elementResize: 'ResizeObserver' in window 54797 }); 54798 } 54799 }, [controlElement, updateComputedPosition]); 54800 (0,use_isomorphic_layout_effect__WEBPACK_IMPORTED_MODULE_11__["default"])(function () { 54801 runAutoUpdate(); 54802 }, [runAutoUpdate]); 54803 var setMenuPortalElement = (0,react__WEBPACK_IMPORTED_MODULE_8__.useCallback)(function (menuPortalElement) { 54804 menuPortalRef.current = menuPortalElement; 54805 runAutoUpdate(); 54806 }, [runAutoUpdate]); 54807 54808 // bail early if required elements aren't present 54809 if (!appendTo && menuPosition !== 'fixed' || !computedPosition) return null; 54810 54811 // same wrapper element whether fixed or portalled 54812 var menuWrapper = (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({ 54813 ref: setMenuPortalElement 54814 }, getStyleProps((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({}, props), {}, { 54815 offset: computedPosition.offset, 54816 position: menuPosition, 54817 rect: computedPosition.rect 54818 }), 'menuPortal', { 54819 'menu-portal': true 54820 }), innerProps), children); 54821 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)(PortalPlacementContext.Provider, { 54822 value: portalPlacementContext 54823 }, appendTo ? /*#__PURE__*/(0,react_dom__WEBPACK_IMPORTED_MODULE_9__.createPortal)(menuWrapper, appendTo) : menuWrapper); 54824}; 54825 54826// ============================== 54827// Root Container 54828// ============================== 54829 54830var containerCSS = function containerCSS(_ref) { 54831 var isDisabled = _ref.isDisabled, 54832 isRtl = _ref.isRtl; 54833 return { 54834 label: 'container', 54835 direction: isRtl ? 'rtl' : undefined, 54836 pointerEvents: isDisabled ? 'none' : undefined, 54837 // cancel mouse events when disabled 54838 position: 'relative' 54839 }; 54840}; 54841var SelectContainer = function SelectContainer(props) { 54842 var children = props.children, 54843 innerProps = props.innerProps, 54844 isDisabled = props.isDisabled, 54845 isRtl = props.isRtl; 54846 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, getStyleProps(props, 'container', { 54847 '--is-disabled': isDisabled, 54848 '--is-rtl': isRtl 54849 }), innerProps), children); 54850}; 54851 54852// ============================== 54853// Value Container 54854// ============================== 54855 54856var valueContainerCSS = function valueContainerCSS(_ref2, unstyled) { 54857 var spacing = _ref2.theme.spacing, 54858 isMulti = _ref2.isMulti, 54859 hasValue = _ref2.hasValue, 54860 controlShouldRenderValue = _ref2.selectProps.controlShouldRenderValue; 54861 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({ 54862 alignItems: 'center', 54863 display: isMulti && hasValue && controlShouldRenderValue ? 'flex' : 'grid', 54864 flex: 1, 54865 flexWrap: 'wrap', 54866 WebkitOverflowScrolling: 'touch', 54867 position: 'relative', 54868 overflow: 'hidden' 54869 }, unstyled ? {} : { 54870 padding: "".concat(spacing.baseUnit / 2, "px ").concat(spacing.baseUnit * 2, "px") 54871 }); 54872}; 54873var ValueContainer = function ValueContainer(props) { 54874 var children = props.children, 54875 innerProps = props.innerProps, 54876 isMulti = props.isMulti, 54877 hasValue = props.hasValue; 54878 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, getStyleProps(props, 'valueContainer', { 54879 'value-container': true, 54880 'value-container--is-multi': isMulti, 54881 'value-container--has-value': hasValue 54882 }), innerProps), children); 54883}; 54884 54885// ============================== 54886// Indicator Container 54887// ============================== 54888 54889var indicatorsContainerCSS = function indicatorsContainerCSS() { 54890 return { 54891 alignItems: 'center', 54892 alignSelf: 'stretch', 54893 display: 'flex', 54894 flexShrink: 0 54895 }; 54896}; 54897var IndicatorsContainer = function IndicatorsContainer(props) { 54898 var children = props.children, 54899 innerProps = props.innerProps; 54900 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, getStyleProps(props, 'indicatorsContainer', { 54901 indicators: true 54902 }), innerProps), children); 54903}; 54904 54905var _templateObject; 54906var _excluded$2 = ["size"], 54907 _excluded2 = ["innerProps", "isRtl", "size"]; 54908function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } 54909 54910// ============================== 54911// Dropdown & Clear Icons 54912// ============================== 54913var _ref2 = false ? 0 : { 54914 name: "tj5bde-Svg", 54915 styles: "display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0;label:Svg;", 54916 map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGljYXRvcnMudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXlCSSIsImZpbGUiOiJpbmRpY2F0b3JzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBAanN4IGpzeCAqL1xuaW1wb3J0IHsgSlNYLCBSZWFjdE5vZGUgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgeyBqc3gsIGtleWZyYW1lcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuaW1wb3J0IHtcbiAgQ29tbW9uUHJvcHNBbmRDbGFzc05hbWUsXG4gIENTU09iamVjdFdpdGhMYWJlbCxcbiAgR3JvdXBCYXNlLFxufSBmcm9tICcuLi90eXBlcyc7XG5pbXBvcnQgeyBnZXRTdHlsZVByb3BzIH0gZnJvbSAnLi4vdXRpbHMnO1xuXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbi8vIERyb3Bkb3duICYgQ2xlYXIgSWNvbnNcbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG5jb25zdCBTdmcgPSAoe1xuICBzaXplLFxuICAuLi5wcm9wc1xufTogSlNYLkludHJpbnNpY0VsZW1lbnRzWydzdmcnXSAmIHsgc2l6ZTogbnVtYmVyIH0pID0+IChcbiAgPHN2Z1xuICAgIGhlaWdodD17c2l6ZX1cbiAgICB3aWR0aD17c2l6ZX1cbiAgICB2aWV3Qm94PVwiMCAwIDIwIDIwXCJcbiAgICBhcmlhLWhpZGRlbj1cInRydWVcIlxuICAgIGZvY3VzYWJsZT1cImZhbHNlXCJcbiAgICBjc3M9e3tcbiAgICAgIGRpc3BsYXk6ICdpbmxpbmUtYmxvY2snLFxuICAgICAgZmlsbDogJ2N1cnJlbnRDb2xvcicsXG4gICAgICBsaW5lSGVpZ2h0OiAxLFxuICAgICAgc3Ryb2tlOiAnY3VycmVudENvbG9yJyxcbiAgICAgIHN0cm9rZVdpZHRoOiAwLFxuICAgIH19XG4gICAgey4uLnByb3BzfVxuICAvPlxuKTtcblxuZXhwb3J0IHR5cGUgQ3Jvc3NJY29uUHJvcHMgPSBKU1guSW50cmluc2ljRWxlbWVudHNbJ3N2ZyddICYgeyBzaXplPzogbnVtYmVyIH07XG5leHBvcnQgY29uc3QgQ3Jvc3NJY29uID0gKHByb3BzOiBDcm9zc0ljb25Qcm9wcykgPT4gKFxuICA8U3ZnIHNpemU9ezIwfSB7Li4ucHJvcHN9PlxuICAgIDxwYXRoIGQ9XCJNMTQuMzQ4IDE0Ljg0OWMtMC40NjkgMC40NjktMS4yMjkgMC40NjktMS42OTcgMGwtMi42NTEtMy4wMzAtMi42NTEgMy4wMjljLTAuNDY5IDAuNDY5LTEuMjI5IDAuNDY5LTEuNjk3IDAtMC40NjktMC40NjktMC40NjktMS4yMjkgMC0xLjY5N2wyLjc1OC0zLjE1LTIuNzU5LTMuMTUyYy0wLjQ2OS0wLjQ2OS0wLjQ2OS0xLjIyOCAwLTEuNjk3czEuMjI4LTAuNDY5IDEuNjk3IDBsMi42NTIgMy4wMzEgMi42NTEtMy4wMzFjMC40NjktMC40NjkgMS4yMjgtMC40NjkgMS42OTcgMHMwLjQ2OSAxLjIyOSAwIDEuNjk3bC0yLjc1OCAzLjE1MiAyLjc1OCAzLjE1YzAuNDY5IDAuNDY5IDAuNDY5IDEuMjI5IDAgMS42OTh6XCIgLz5cbiAgPC9Tdmc+XG4pO1xuZXhwb3J0IHR5cGUgRG93bkNoZXZyb25Qcm9wcyA9IEpTWC5JbnRyaW5zaWNFbGVtZW50c1snc3ZnJ10gJiB7IHNpemU/OiBudW1iZXIgfTtcbmV4cG9ydCBjb25zdCBEb3duQ2hldnJvbiA9IChwcm9wczogRG93bkNoZXZyb25Qcm9wcykgPT4gKFxuICA8U3ZnIHNpemU9ezIwfSB7Li4ucHJvcHN9PlxuICAgIDxwYXRoIGQ9XCJNNC41MTYgNy41NDhjMC40MzYtMC40NDYgMS4wNDMtMC40ODEgMS41NzYgMGwzLjkwOCAzLjc0NyAzLjkwOC0zLjc0N2MwLjUzMy0wLjQ4MSAxLjE0MS0wLjQ0NiAxLjU3NCAwIDAuNDM2IDAuNDQ1IDAuNDA4IDEuMTk3IDAgMS42MTUtMC40MDYgMC40MTgtNC42OTUgNC41MDItNC42OTUgNC41MDItMC4yMTcgMC4yMjMtMC41MDIgMC4zMzUtMC43ODcgMC4zMzVzLTAuNTctMC4xMTItMC43ODktMC4zMzVjMCAwLTQuMjg3LTQuMDg0LTQuNjk1LTQuNTAycy0wLjQzNi0xLjE3IDAtMS42MTV6XCIgLz5cbiAgPC9Tdmc+XG4pO1xuXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbi8vIERyb3Bkb3duICYgQ2xlYXIgQnV0dG9uc1xuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG5cbmV4cG9ydCBpbnRlcmZhY2UgRHJvcGRvd25JbmRpY2F0b3JQcm9wczxcbiAgT3B0aW9uID0gdW5rbm93bixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4gPSBib29sZWFuLFxuICBHcm91cCBleHRlbmRzIEdyb3VwQmFzZTxPcHRpb24+ID0gR3JvdXBCYXNlPE9wdGlvbj5cbj4gZXh0ZW5kcyBDb21tb25Qcm9wc0FuZENsYXNzTmFtZTxPcHRpb24sIElzTXVsdGksIEdyb3VwPiB7XG4gIC8qKiBUaGUgY2hpbGRyZW4gdG8gYmUgcmVuZGVyZWQgaW5zaWRlIHRoZSBpbmRpY2F0b3IuICovXG4gIGNoaWxkcmVuPzogUmVhY3ROb2RlO1xuICAvKiogUHJvcHMgdGhhdCB3aWxsIGJlIHBhc3NlZCBvbiB0byB0aGUgY2hpbGRyZW4uICovXG4gIGlubmVyUHJvcHM6IEpTWC5JbnRyaW5zaWNFbGVtZW50c1snZGl2J107XG4gIC8qKiBUaGUgZm9jdXNlZCBzdGF0ZSBvZiB0aGUgc2VsZWN0LiAqL1xuICBpc0ZvY3VzZWQ6IGJvb2xlYW47XG4gIGlzRGlzYWJsZWQ6IGJvb2xlYW47XG59XG5cbmNvbnN0IGJhc2VDU1MgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oXG4gIHtcbiAgICBpc0ZvY3VzZWQsXG4gICAgdGhlbWU6IHtcbiAgICAgIHNwYWNpbmc6IHsgYmFzZVVuaXQgfSxcbiAgICAgIGNvbG9ycyxcbiAgICB9LFxuICB9OlxuICAgIHwgRHJvcGRvd25JbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPlxuICAgIHwgQ2xlYXJJbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPixcbiAgdW5zdHlsZWQ6IGJvb2xlYW5cbik6IENTU09iamVjdFdpdGhMYWJlbCA9PiAoe1xuICBsYWJlbDogJ2luZGljYXRvckNvbnRhaW5lcicsXG4gIGRpc3BsYXk6ICdmbGV4JyxcbiAgdHJhbnNpdGlvbjogJ2NvbG9yIDE1MG1zJyxcbiAgLi4uKHVuc3R5bGVkXG4gICAgPyB7fVxuICAgIDoge1xuICAgICAgICBjb2xvcjogaXNGb2N1c2VkID8gY29sb3JzLm5ldXRyYWw2MCA6IGNvbG9ycy5uZXV0cmFsMjAsXG4gICAgICAgIHBhZGRpbmc6IGJhc2VVbml0ICogMixcbiAgICAgICAgJzpob3Zlcic6IHtcbiAgICAgICAgICBjb2xvcjogaXNGb2N1c2VkID8gY29sb3JzLm5ldXRyYWw4MCA6IGNvbG9ycy5uZXV0cmFsNDAsXG4gICAgICAgIH0sXG4gICAgICB9KSxcbn0pO1xuXG5leHBvcnQgY29uc3QgZHJvcGRvd25JbmRpY2F0b3JDU1MgPSBiYXNlQ1NTO1xuZXhwb3J0IGNvbnN0IERyb3Bkb3duSW5kaWNhdG9yID0gPFxuICBPcHRpb24sXG4gIElzTXVsdGkgZXh0ZW5kcyBib29sZWFuLFxuICBHcm91cCBleHRlbmRzIEdyb3VwQmFzZTxPcHRpb24+XG4+KFxuICBwcm9wczogRHJvcGRvd25JbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPlxuKSA9PiB7XG4gIGNvbnN0IHsgY2hpbGRyZW4sIGlubmVyUHJvcHMgfSA9IHByb3BzO1xuICByZXR1cm4gKFxuICAgIDxkaXZcbiAgICAgIHsuLi5nZXRTdHlsZVByb3BzKHByb3BzLCAnZHJvcGRvd25JbmRpY2F0b3InLCB7XG4gICAgICAgIGluZGljYXRvcjogdHJ1ZSxcbiAgICAgICAgJ2Ryb3Bkb3duLWluZGljYXRvcic6IHRydWUsXG4gICAgICB9KX1cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgID5cbiAgICAgIHtjaGlsZHJlbiB8fCA8RG93bkNoZXZyb24gLz59XG4gICAgPC9kaXY+XG4gICk7XG59O1xuXG5leHBvcnQgaW50ZXJmYWNlIENsZWFySW5kaWNhdG9yUHJvcHM8XG4gIE9wdGlvbiA9IHVua25vd24sXG4gIElzTXVsdGkgZXh0ZW5kcyBib29sZWFuID0gYm9vbGVhbixcbiAgR3JvdXAgZXh0ZW5kcyBHcm91cEJhc2U8T3B0aW9uPiA9IEdyb3VwQmFzZTxPcHRpb24+XG4+IGV4dGVuZHMgQ29tbW9uUHJvcHNBbmRDbGFzc05hbWU8T3B0aW9uLCBJc011bHRpLCBHcm91cD4ge1xuICAvKiogVGhlIGNoaWxkcmVuIHRvIGJlIHJlbmRlcmVkIGluc2lkZSB0aGUgaW5kaWNhdG9yLiAqL1xuICBjaGlsZHJlbj86IFJlYWN0Tm9kZTtcbiAgLyoqIFByb3BzIHRoYXQgd2lsbCBiZSBwYXNzZWQgb24gdG8gdGhlIGNoaWxkcmVuLiAqL1xuICBpbm5lclByb3BzOiBKU1guSW50cmluc2ljRWxlbWVudHNbJ2RpdiddO1xuICAvKiogVGhlIGZvY3VzZWQgc3RhdGUgb2YgdGhlIHNlbGVjdC4gKi9cbiAgaXNGb2N1c2VkOiBib29sZWFuO1xufVxuXG5leHBvcnQgY29uc3QgY2xlYXJJbmRpY2F0b3JDU1MgPSBiYXNlQ1NTO1xuZXhwb3J0IGNvbnN0IENsZWFySW5kaWNhdG9yID0gPFxuICBPcHRpb24sXG4gIElzTXVsdGkgZXh0ZW5kcyBib29sZWFuLFxuICBHcm91cCBleHRlbmRzIEdyb3VwQmFzZTxPcHRpb24+XG4+KFxuICBwcm9wczogQ2xlYXJJbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPlxuKSA9PiB7XG4gIGNvbnN0IHsgY2hpbGRyZW4sIGlubmVyUHJvcHMgfSA9IHByb3BzO1xuICByZXR1cm4gKFxuICAgIDxkaXZcbiAgICAgIHsuLi5nZXRTdHlsZVByb3BzKHByb3BzLCAnY2xlYXJJbmRpY2F0b3InLCB7XG4gICAgICAgIGluZGljYXRvcjogdHJ1ZSxcbiAgICAgICAgJ2NsZWFyLWluZGljYXRvcic6IHRydWUsXG4gICAgICB9KX1cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgID5cbiAgICAgIHtjaGlsZHJlbiB8fCA8Q3Jvc3NJY29uIC8+fVxuICAgIDwvZGl2PlxuICApO1xufTtcblxuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG4vLyBTZXBhcmF0b3Jcbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG5leHBvcnQgaW50ZXJmYWNlIEluZGljYXRvclNlcGFyYXRvclByb3BzPFxuICBPcHRpb24gPSB1bmtub3duLFxuICBJc011bHRpIGV4dGVuZHMgYm9vbGVhbiA9IGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj4gPSBHcm91cEJhc2U8T3B0aW9uPlxuPiBleHRlbmRzIENvbW1vblByb3BzQW5kQ2xhc3NOYW1lPE9wdGlvbiwgSXNNdWx0aSwgR3JvdXA+IHtcbiAgaXNEaXNhYmxlZDogYm9vbGVhbjtcbiAgaXNGb2N1c2VkOiBib29sZWFuO1xuICBpbm5lclByb3BzPzogSlNYLkludHJpbnNpY0VsZW1lbnRzWydzcGFuJ107XG59XG5cbmV4cG9ydCBjb25zdCBpbmRpY2F0b3JTZXBhcmF0b3JDU1MgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oXG4gIHtcbiAgICBpc0Rpc2FibGVkLFxuICAgIHRoZW1lOiB7XG4gICAgICBzcGFjaW5nOiB7IGJhc2VVbml0IH0sXG4gICAgICBjb2xvcnMsXG4gICAgfSxcbiAgfTogSW5kaWNhdG9yU2VwYXJhdG9yUHJvcHM8T3B0aW9uLCBJc011bHRpLCBHcm91cD4sXG4gIHVuc3R5bGVkOiBib29sZWFuXG4pOiBDU1NPYmplY3RXaXRoTGFiZWwgPT4gKHtcbiAgbGFiZWw6ICdpbmRpY2F0b3JTZXBhcmF0b3InLFxuICBhbGlnblNlbGY6ICdzdHJldGNoJyxcbiAgd2lkdGg6IDEsXG4gIC4uLih1bnN0eWxlZFxuICAgID8ge31cbiAgICA6IHtcbiAgICAgICAgYmFja2dyb3VuZENvbG9yOiBpc0Rpc2FibGVkID8gY29sb3JzLm5ldXRyYWwxMCA6IGNvbG9ycy5uZXV0cmFsMjAsXG4gICAgICAgIG1hcmdpbkJvdHRvbTogYmFzZVVuaXQgKiAyLFxuICAgICAgICBtYXJnaW5Ub3A6IGJhc2VVbml0ICogMixcbiAgICAgIH0pLFxufSk7XG5cbmV4cG9ydCBjb25zdCBJbmRpY2F0b3JTZXBhcmF0b3IgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oXG4gIHByb3BzOiBJbmRpY2F0b3JTZXBhcmF0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPlxuKSA9PiB7XG4gIGNvbnN0IHsgaW5uZXJQcm9wcyB9ID0gcHJvcHM7XG4gIHJldHVybiAoXG4gICAgPHNwYW5cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgICAgey4uLmdldFN0eWxlUHJvcHMocHJvcHMsICdpbmRpY2F0b3JTZXBhcmF0b3InLCB7XG4gICAgICAgICdpbmRpY2F0b3Itc2VwYXJhdG9yJzogdHJ1ZSxcbiAgICAgIH0pfVxuICAgIC8+XG4gICk7XG59O1xuXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbi8vIExvYWRpbmdcbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG5jb25zdCBsb2FkaW5nRG90QW5pbWF0aW9ucyA9IGtleWZyYW1lc2BcbiAgMCUsIDgwJSwgMTAwJSB7IG9wYWNpdHk6IDA7IH1cbiAgNDAlIHsgb3BhY2l0eTogMTsgfVxuYDtcblxuZXhwb3J0IGNvbnN0IGxvYWRpbmdJbmRpY2F0b3JDU1MgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oXG4gIHtcbiAgICBpc0ZvY3VzZWQsXG4gICAgc2l6ZSxcbiAgICB0aGVtZToge1xuICAgICAgY29sb3JzLFxuICAgICAgc3BhY2luZzogeyBiYXNlVW5pdCB9LFxuICAgIH0sXG4gIH06IExvYWRpbmdJbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPixcbiAgdW5zdHlsZWQ6IGJvb2xlYW5cbik6IENTU09iamVjdFdpdGhMYWJlbCA9PiAoe1xuICBsYWJlbDogJ2xvYWRpbmdJbmRpY2F0b3InLFxuICBkaXNwbGF5OiAnZmxleCcsXG4gIHRyYW5zaXRpb246ICdjb2xvciAxNTBtcycsXG4gIGFsaWduU2VsZjogJ2NlbnRlcicsXG4gIGZvbnRTaXplOiBzaXplLFxuICBsaW5lSGVpZ2h0OiAxLFxuICBtYXJnaW5SaWdodDogc2l6ZSxcbiAgdGV4dEFsaWduOiAnY2VudGVyJyxcbiAgdmVydGljYWxBbGlnbjogJ21pZGRsZScsXG4gIC4uLih1bnN0eWxlZFxuICAgID8ge31cbiAgICA6IHtcbiAgICAgICAgY29sb3I6IGlzRm9jdXNlZCA/IGNvbG9ycy5uZXV0cmFsNjAgOiBjb2xvcnMubmV1dHJhbDIwLFxuICAgICAgICBwYWRkaW5nOiBiYXNlVW5pdCAqIDIsXG4gICAgICB9KSxcbn0pO1xuXG5pbnRlcmZhY2UgTG9hZGluZ0RvdFByb3BzIHtcbiAgZGVsYXk6IG51bWJlcjtcbiAgb2Zmc2V0OiBib29sZWFuO1xufVxuY29uc3QgTG9hZGluZ0RvdCA9ICh7IGRlbGF5LCBvZmZzZXQgfTogTG9hZGluZ0RvdFByb3BzKSA9PiAoXG4gIDxzcGFuXG4gICAgY3NzPXt7XG4gICAgICBhbmltYXRpb246IGAke2xvYWRpbmdEb3RBbmltYXRpb25zfSAxcyBlYXNlLWluLW91dCAke2RlbGF5fW1zIGluZmluaXRlO2AsXG4gICAgICBiYWNrZ3JvdW5kQ29sb3I6ICdjdXJyZW50Q29sb3InLFxuICAgICAgYm9yZGVyUmFkaXVzOiAnMWVtJyxcbiAgICAgIGRpc3BsYXk6ICdpbmxpbmUtYmxvY2snLFxuICAgICAgbWFyZ2luTGVmdDogb2Zmc2V0ID8gJzFlbScgOiB1bmRlZmluZWQsXG4gICAgICBoZWlnaHQ6ICcxZW0nLFxuICAgICAgdmVydGljYWxBbGlnbjogJ3RvcCcsXG4gICAgICB3aWR0aDogJzFlbScsXG4gICAgfX1cbiAgLz5cbik7XG5cbmV4cG9ydCBpbnRlcmZhY2UgTG9hZGluZ0luZGljYXRvclByb3BzPFxuICBPcHRpb24gPSB1bmtub3duLFxuICBJc011bHRpIGV4dGVuZHMgYm9vbGVhbiA9IGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj4gPSBHcm91cEJhc2U8T3B0aW9uPlxuPiBleHRlbmRzIENvbW1vblByb3BzQW5kQ2xhc3NOYW1lPE9wdGlvbiwgSXNNdWx0aSwgR3JvdXA+IHtcbiAgLyoqIFByb3BzIHRoYXQgd2lsbCBiZSBwYXNzZWQgb24gdG8gdGhlIGNoaWxkcmVuLiAqL1xuICBpbm5lclByb3BzOiBKU1guSW50cmluc2ljRWxlbWVudHNbJ2RpdiddO1xuICAvKiogVGhlIGZvY3VzZWQgc3RhdGUgb2YgdGhlIHNlbGVjdC4gKi9cbiAgaXNGb2N1c2VkOiBib29sZWFuO1xuICBpc0Rpc2FibGVkOiBib29sZWFuO1xuICAvKiogU2V0IHNpemUgb2YgdGhlIGNvbnRhaW5lci4gKi9cbiAgc2l6ZTogbnVtYmVyO1xufVxuZXhwb3J0IGNvbnN0IExvYWRpbmdJbmRpY2F0b3IgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oe1xuICBpbm5lclByb3BzLFxuICBpc1J0bCxcbiAgc2l6ZSA9IDQsXG4gIC4uLnJlc3RQcm9wc1xufTogTG9hZGluZ0luZGljYXRvclByb3BzPE9wdGlvbiwgSXNNdWx0aSwgR3JvdXA+KSA9PiB7XG4gIHJldHVybiAoXG4gICAgPGRpdlxuICAgICAgey4uLmdldFN0eWxlUHJvcHMoXG4gICAgICAgIHsgLi4ucmVzdFByb3BzLCBpbm5lclByb3BzLCBpc1J0bCwgc2l6ZSB9LFxuICAgICAgICAnbG9hZGluZ0luZGljYXRvcicsXG4gICAgICAgIHtcbiAgICAgICAgICBpbmRpY2F0b3I6IHRydWUsXG4gICAgICAgICAgJ2xvYWRpbmctaW5kaWNhdG9yJzogdHJ1ZSxcbiAgICAgICAgfVxuICAgICAgKX1cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgID5cbiAgICAgIDxMb2FkaW5nRG90IGRlbGF5PXswfSBvZmZzZXQ9e2lzUnRsfSAvPlxuICAgICAgPExvYWRpbmdEb3QgZGVsYXk9ezE2MH0gb2Zmc2V0IC8+XG4gICAgICA8TG9hZGluZ0RvdCBkZWxheT17MzIwfSBvZmZzZXQ9eyFpc1J0bH0gLz5cbiAgICA8L2Rpdj5cbiAgKTtcbn07XG4iXX0= */", 54917 toString: _EMOTION_STRINGIFIED_CSS_ERROR__ 54918}; 54919var Svg = function Svg(_ref) { 54920 var size = _ref.size, 54921 props = (0,_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_4__["default"])(_ref, _excluded$2); 54922 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("svg", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({ 54923 height: size, 54924 width: size, 54925 viewBox: "0 0 20 20", 54926 "aria-hidden": "true", 54927 focusable: "false", 54928 css: _ref2 54929 }, props)); 54930}; 54931var CrossIcon = function CrossIcon(props) { 54932 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)(Svg, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({ 54933 size: 20 54934 }, props), (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("path", { 54935 d: "M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z" 54936 })); 54937}; 54938var DownChevron = function DownChevron(props) { 54939 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)(Svg, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({ 54940 size: 20 54941 }, props), (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("path", { 54942 d: "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z" 54943 })); 54944}; 54945 54946// ============================== 54947// Dropdown & Clear Buttons 54948// ============================== 54949 54950var baseCSS = function baseCSS(_ref3, unstyled) { 54951 var isFocused = _ref3.isFocused, 54952 _ref3$theme = _ref3.theme, 54953 baseUnit = _ref3$theme.spacing.baseUnit, 54954 colors = _ref3$theme.colors; 54955 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({ 54956 label: 'indicatorContainer', 54957 display: 'flex', 54958 transition: 'color 150ms' 54959 }, unstyled ? {} : { 54960 color: isFocused ? colors.neutral60 : colors.neutral20, 54961 padding: baseUnit * 2, 54962 ':hover': { 54963 color: isFocused ? colors.neutral80 : colors.neutral40 54964 } 54965 }); 54966}; 54967var dropdownIndicatorCSS = baseCSS; 54968var DropdownIndicator = function DropdownIndicator(props) { 54969 var children = props.children, 54970 innerProps = props.innerProps; 54971 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, getStyleProps(props, 'dropdownIndicator', { 54972 indicator: true, 54973 'dropdown-indicator': true 54974 }), innerProps), children || (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)(DownChevron, null)); 54975}; 54976var clearIndicatorCSS = baseCSS; 54977var ClearIndicator = function ClearIndicator(props) { 54978 var children = props.children, 54979 innerProps = props.innerProps; 54980 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, getStyleProps(props, 'clearIndicator', { 54981 indicator: true, 54982 'clear-indicator': true 54983 }), innerProps), children || (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)(CrossIcon, null)); 54984}; 54985 54986// ============================== 54987// Separator 54988// ============================== 54989 54990var indicatorSeparatorCSS = function indicatorSeparatorCSS(_ref4, unstyled) { 54991 var isDisabled = _ref4.isDisabled, 54992 _ref4$theme = _ref4.theme, 54993 baseUnit = _ref4$theme.spacing.baseUnit, 54994 colors = _ref4$theme.colors; 54995 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({ 54996 label: 'indicatorSeparator', 54997 alignSelf: 'stretch', 54998 width: 1 54999 }, unstyled ? {} : { 55000 backgroundColor: isDisabled ? colors.neutral10 : colors.neutral20, 55001 marginBottom: baseUnit * 2, 55002 marginTop: baseUnit * 2 55003 }); 55004}; 55005var IndicatorSeparator = function IndicatorSeparator(props) { 55006 var innerProps = props.innerProps; 55007 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("span", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, innerProps, getStyleProps(props, 'indicatorSeparator', { 55008 'indicator-separator': true 55009 }))); 55010}; 55011 55012// ============================== 55013// Loading 55014// ============================== 55015 55016var loadingDotAnimations = (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.keyframes)(_templateObject || (_templateObject = (0,_babel_runtime_helpers_esm_taggedTemplateLiteral__WEBPACK_IMPORTED_MODULE_6__["default"])(["\n 0%, 80%, 100% { opacity: 0; }\n 40% { opacity: 1; }\n"]))); 55017var loadingIndicatorCSS = function loadingIndicatorCSS(_ref5, unstyled) { 55018 var isFocused = _ref5.isFocused, 55019 size = _ref5.size, 55020 _ref5$theme = _ref5.theme, 55021 colors = _ref5$theme.colors, 55022 baseUnit = _ref5$theme.spacing.baseUnit; 55023 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({ 55024 label: 'loadingIndicator', 55025 display: 'flex', 55026 transition: 'color 150ms', 55027 alignSelf: 'center', 55028 fontSize: size, 55029 lineHeight: 1, 55030 marginRight: size, 55031 textAlign: 'center', 55032 verticalAlign: 'middle' 55033 }, unstyled ? {} : { 55034 color: isFocused ? colors.neutral60 : colors.neutral20, 55035 padding: baseUnit * 2 55036 }); 55037}; 55038var LoadingDot = function LoadingDot(_ref6) { 55039 var delay = _ref6.delay, 55040 offset = _ref6.offset; 55041 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("span", { 55042 css: /*#__PURE__*/(0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.css)({ 55043 animation: "".concat(loadingDotAnimations, " 1s ease-in-out ").concat(delay, "ms infinite;"), 55044 backgroundColor: 'currentColor', 55045 borderRadius: '1em', 55046 display: 'inline-block', 55047 marginLeft: offset ? '1em' : undefined, 55048 height: '1em', 55049 verticalAlign: 'top', 55050 width: '1em' 55051 }, false ? 0 : ";label:LoadingDot;", false ? 0 : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGljYXRvcnMudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQW1RSSIsImZpbGUiOiJpbmRpY2F0b3JzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBAanN4IGpzeCAqL1xuaW1wb3J0IHsgSlNYLCBSZWFjdE5vZGUgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgeyBqc3gsIGtleWZyYW1lcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuaW1wb3J0IHtcbiAgQ29tbW9uUHJvcHNBbmRDbGFzc05hbWUsXG4gIENTU09iamVjdFdpdGhMYWJlbCxcbiAgR3JvdXBCYXNlLFxufSBmcm9tICcuLi90eXBlcyc7XG5pbXBvcnQgeyBnZXRTdHlsZVByb3BzIH0gZnJvbSAnLi4vdXRpbHMnO1xuXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbi8vIERyb3Bkb3duICYgQ2xlYXIgSWNvbnNcbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG5jb25zdCBTdmcgPSAoe1xuICBzaXplLFxuICAuLi5wcm9wc1xufTogSlNYLkludHJpbnNpY0VsZW1lbnRzWydzdmcnXSAmIHsgc2l6ZTogbnVtYmVyIH0pID0+IChcbiAgPHN2Z1xuICAgIGhlaWdodD17c2l6ZX1cbiAgICB3aWR0aD17c2l6ZX1cbiAgICB2aWV3Qm94PVwiMCAwIDIwIDIwXCJcbiAgICBhcmlhLWhpZGRlbj1cInRydWVcIlxuICAgIGZvY3VzYWJsZT1cImZhbHNlXCJcbiAgICBjc3M9e3tcbiAgICAgIGRpc3BsYXk6ICdpbmxpbmUtYmxvY2snLFxuICAgICAgZmlsbDogJ2N1cnJlbnRDb2xvcicsXG4gICAgICBsaW5lSGVpZ2h0OiAxLFxuICAgICAgc3Ryb2tlOiAnY3VycmVudENvbG9yJyxcbiAgICAgIHN0cm9rZVdpZHRoOiAwLFxuICAgIH19XG4gICAgey4uLnByb3BzfVxuICAvPlxuKTtcblxuZXhwb3J0IHR5cGUgQ3Jvc3NJY29uUHJvcHMgPSBKU1guSW50cmluc2ljRWxlbWVudHNbJ3N2ZyddICYgeyBzaXplPzogbnVtYmVyIH07XG5leHBvcnQgY29uc3QgQ3Jvc3NJY29uID0gKHByb3BzOiBDcm9zc0ljb25Qcm9wcykgPT4gKFxuICA8U3ZnIHNpemU9ezIwfSB7Li4ucHJvcHN9PlxuICAgIDxwYXRoIGQ9XCJNMTQuMzQ4IDE0Ljg0OWMtMC40NjkgMC40NjktMS4yMjkgMC40NjktMS42OTcgMGwtMi42NTEtMy4wMzAtMi42NTEgMy4wMjljLTAuNDY5IDAuNDY5LTEuMjI5IDAuNDY5LTEuNjk3IDAtMC40NjktMC40NjktMC40NjktMS4yMjkgMC0xLjY5N2wyLjc1OC0zLjE1LTIuNzU5LTMuMTUyYy0wLjQ2OS0wLjQ2OS0wLjQ2OS0xLjIyOCAwLTEuNjk3czEuMjI4LTAuNDY5IDEuNjk3IDBsMi42NTIgMy4wMzEgMi42NTEtMy4wMzFjMC40NjktMC40NjkgMS4yMjgtMC40NjkgMS42OTcgMHMwLjQ2OSAxLjIyOSAwIDEuNjk3bC0yLjc1OCAzLjE1MiAyLjc1OCAzLjE1YzAuNDY5IDAuNDY5IDAuNDY5IDEuMjI5IDAgMS42OTh6XCIgLz5cbiAgPC9Tdmc+XG4pO1xuZXhwb3J0IHR5cGUgRG93bkNoZXZyb25Qcm9wcyA9IEpTWC5JbnRyaW5zaWNFbGVtZW50c1snc3ZnJ10gJiB7IHNpemU/OiBudW1iZXIgfTtcbmV4cG9ydCBjb25zdCBEb3duQ2hldnJvbiA9IChwcm9wczogRG93bkNoZXZyb25Qcm9wcykgPT4gKFxuICA8U3ZnIHNpemU9ezIwfSB7Li4ucHJvcHN9PlxuICAgIDxwYXRoIGQ9XCJNNC41MTYgNy41NDhjMC40MzYtMC40NDYgMS4wNDMtMC40ODEgMS41NzYgMGwzLjkwOCAzLjc0NyAzLjkwOC0zLjc0N2MwLjUzMy0wLjQ4MSAxLjE0MS0wLjQ0NiAxLjU3NCAwIDAuNDM2IDAuNDQ1IDAuNDA4IDEuMTk3IDAgMS42MTUtMC40MDYgMC40MTgtNC42OTUgNC41MDItNC42OTUgNC41MDItMC4yMTcgMC4yMjMtMC41MDIgMC4zMzUtMC43ODcgMC4zMzVzLTAuNTctMC4xMTItMC43ODktMC4zMzVjMCAwLTQuMjg3LTQuMDg0LTQuNjk1LTQuNTAycy0wLjQzNi0xLjE3IDAtMS42MTV6XCIgLz5cbiAgPC9Tdmc+XG4pO1xuXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbi8vIERyb3Bkb3duICYgQ2xlYXIgQnV0dG9uc1xuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG5cbmV4cG9ydCBpbnRlcmZhY2UgRHJvcGRvd25JbmRpY2F0b3JQcm9wczxcbiAgT3B0aW9uID0gdW5rbm93bixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4gPSBib29sZWFuLFxuICBHcm91cCBleHRlbmRzIEdyb3VwQmFzZTxPcHRpb24+ID0gR3JvdXBCYXNlPE9wdGlvbj5cbj4gZXh0ZW5kcyBDb21tb25Qcm9wc0FuZENsYXNzTmFtZTxPcHRpb24sIElzTXVsdGksIEdyb3VwPiB7XG4gIC8qKiBUaGUgY2hpbGRyZW4gdG8gYmUgcmVuZGVyZWQgaW5zaWRlIHRoZSBpbmRpY2F0b3IuICovXG4gIGNoaWxkcmVuPzogUmVhY3ROb2RlO1xuICAvKiogUHJvcHMgdGhhdCB3aWxsIGJlIHBhc3NlZCBvbiB0byB0aGUgY2hpbGRyZW4uICovXG4gIGlubmVyUHJvcHM6IEpTWC5JbnRyaW5zaWNFbGVtZW50c1snZGl2J107XG4gIC8qKiBUaGUgZm9jdXNlZCBzdGF0ZSBvZiB0aGUgc2VsZWN0LiAqL1xuICBpc0ZvY3VzZWQ6IGJvb2xlYW47XG4gIGlzRGlzYWJsZWQ6IGJvb2xlYW47XG59XG5cbmNvbnN0IGJhc2VDU1MgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oXG4gIHtcbiAgICBpc0ZvY3VzZWQsXG4gICAgdGhlbWU6IHtcbiAgICAgIHNwYWNpbmc6IHsgYmFzZVVuaXQgfSxcbiAgICAgIGNvbG9ycyxcbiAgICB9LFxuICB9OlxuICAgIHwgRHJvcGRvd25JbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPlxuICAgIHwgQ2xlYXJJbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPixcbiAgdW5zdHlsZWQ6IGJvb2xlYW5cbik6IENTU09iamVjdFdpdGhMYWJlbCA9PiAoe1xuICBsYWJlbDogJ2luZGljYXRvckNvbnRhaW5lcicsXG4gIGRpc3BsYXk6ICdmbGV4JyxcbiAgdHJhbnNpdGlvbjogJ2NvbG9yIDE1MG1zJyxcbiAgLi4uKHVuc3R5bGVkXG4gICAgPyB7fVxuICAgIDoge1xuICAgICAgICBjb2xvcjogaXNGb2N1c2VkID8gY29sb3JzLm5ldXRyYWw2MCA6IGNvbG9ycy5uZXV0cmFsMjAsXG4gICAgICAgIHBhZGRpbmc6IGJhc2VVbml0ICogMixcbiAgICAgICAgJzpob3Zlcic6IHtcbiAgICAgICAgICBjb2xvcjogaXNGb2N1c2VkID8gY29sb3JzLm5ldXRyYWw4MCA6IGNvbG9ycy5uZXV0cmFsNDAsXG4gICAgICAgIH0sXG4gICAgICB9KSxcbn0pO1xuXG5leHBvcnQgY29uc3QgZHJvcGRvd25JbmRpY2F0b3JDU1MgPSBiYXNlQ1NTO1xuZXhwb3J0IGNvbnN0IERyb3Bkb3duSW5kaWNhdG9yID0gPFxuICBPcHRpb24sXG4gIElzTXVsdGkgZXh0ZW5kcyBib29sZWFuLFxuICBHcm91cCBleHRlbmRzIEdyb3VwQmFzZTxPcHRpb24+XG4+KFxuICBwcm9wczogRHJvcGRvd25JbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPlxuKSA9PiB7XG4gIGNvbnN0IHsgY2hpbGRyZW4sIGlubmVyUHJvcHMgfSA9IHByb3BzO1xuICByZXR1cm4gKFxuICAgIDxkaXZcbiAgICAgIHsuLi5nZXRTdHlsZVByb3BzKHByb3BzLCAnZHJvcGRvd25JbmRpY2F0b3InLCB7XG4gICAgICAgIGluZGljYXRvcjogdHJ1ZSxcbiAgICAgICAgJ2Ryb3Bkb3duLWluZGljYXRvcic6IHRydWUsXG4gICAgICB9KX1cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgID5cbiAgICAgIHtjaGlsZHJlbiB8fCA8RG93bkNoZXZyb24gLz59XG4gICAgPC9kaXY+XG4gICk7XG59O1xuXG5leHBvcnQgaW50ZXJmYWNlIENsZWFySW5kaWNhdG9yUHJvcHM8XG4gIE9wdGlvbiA9IHVua25vd24sXG4gIElzTXVsdGkgZXh0ZW5kcyBib29sZWFuID0gYm9vbGVhbixcbiAgR3JvdXAgZXh0ZW5kcyBHcm91cEJhc2U8T3B0aW9uPiA9IEdyb3VwQmFzZTxPcHRpb24+XG4+IGV4dGVuZHMgQ29tbW9uUHJvcHNBbmRDbGFzc05hbWU8T3B0aW9uLCBJc011bHRpLCBHcm91cD4ge1xuICAvKiogVGhlIGNoaWxkcmVuIHRvIGJlIHJlbmRlcmVkIGluc2lkZSB0aGUgaW5kaWNhdG9yLiAqL1xuICBjaGlsZHJlbj86IFJlYWN0Tm9kZTtcbiAgLyoqIFByb3BzIHRoYXQgd2lsbCBiZSBwYXNzZWQgb24gdG8gdGhlIGNoaWxkcmVuLiAqL1xuICBpbm5lclByb3BzOiBKU1guSW50cmluc2ljRWxlbWVudHNbJ2RpdiddO1xuICAvKiogVGhlIGZvY3VzZWQgc3RhdGUgb2YgdGhlIHNlbGVjdC4gKi9cbiAgaXNGb2N1c2VkOiBib29sZWFuO1xufVxuXG5leHBvcnQgY29uc3QgY2xlYXJJbmRpY2F0b3JDU1MgPSBiYXNlQ1NTO1xuZXhwb3J0IGNvbnN0IENsZWFySW5kaWNhdG9yID0gPFxuICBPcHRpb24sXG4gIElzTXVsdGkgZXh0ZW5kcyBib29sZWFuLFxuICBHcm91cCBleHRlbmRzIEdyb3VwQmFzZTxPcHRpb24+XG4+KFxuICBwcm9wczogQ2xlYXJJbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPlxuKSA9PiB7XG4gIGNvbnN0IHsgY2hpbGRyZW4sIGlubmVyUHJvcHMgfSA9IHByb3BzO1xuICByZXR1cm4gKFxuICAgIDxkaXZcbiAgICAgIHsuLi5nZXRTdHlsZVByb3BzKHByb3BzLCAnY2xlYXJJbmRpY2F0b3InLCB7XG4gICAgICAgIGluZGljYXRvcjogdHJ1ZSxcbiAgICAgICAgJ2NsZWFyLWluZGljYXRvcic6IHRydWUsXG4gICAgICB9KX1cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgID5cbiAgICAgIHtjaGlsZHJlbiB8fCA8Q3Jvc3NJY29uIC8+fVxuICAgIDwvZGl2PlxuICApO1xufTtcblxuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG4vLyBTZXBhcmF0b3Jcbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG5leHBvcnQgaW50ZXJmYWNlIEluZGljYXRvclNlcGFyYXRvclByb3BzPFxuICBPcHRpb24gPSB1bmtub3duLFxuICBJc011bHRpIGV4dGVuZHMgYm9vbGVhbiA9IGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj4gPSBHcm91cEJhc2U8T3B0aW9uPlxuPiBleHRlbmRzIENvbW1vblByb3BzQW5kQ2xhc3NOYW1lPE9wdGlvbiwgSXNNdWx0aSwgR3JvdXA+IHtcbiAgaXNEaXNhYmxlZDogYm9vbGVhbjtcbiAgaXNGb2N1c2VkOiBib29sZWFuO1xuICBpbm5lclByb3BzPzogSlNYLkludHJpbnNpY0VsZW1lbnRzWydzcGFuJ107XG59XG5cbmV4cG9ydCBjb25zdCBpbmRpY2F0b3JTZXBhcmF0b3JDU1MgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oXG4gIHtcbiAgICBpc0Rpc2FibGVkLFxuICAgIHRoZW1lOiB7XG4gICAgICBzcGFjaW5nOiB7IGJhc2VVbml0IH0sXG4gICAgICBjb2xvcnMsXG4gICAgfSxcbiAgfTogSW5kaWNhdG9yU2VwYXJhdG9yUHJvcHM8T3B0aW9uLCBJc011bHRpLCBHcm91cD4sXG4gIHVuc3R5bGVkOiBib29sZWFuXG4pOiBDU1NPYmplY3RXaXRoTGFiZWwgPT4gKHtcbiAgbGFiZWw6ICdpbmRpY2F0b3JTZXBhcmF0b3InLFxuICBhbGlnblNlbGY6ICdzdHJldGNoJyxcbiAgd2lkdGg6IDEsXG4gIC4uLih1bnN0eWxlZFxuICAgID8ge31cbiAgICA6IHtcbiAgICAgICAgYmFja2dyb3VuZENvbG9yOiBpc0Rpc2FibGVkID8gY29sb3JzLm5ldXRyYWwxMCA6IGNvbG9ycy5uZXV0cmFsMjAsXG4gICAgICAgIG1hcmdpbkJvdHRvbTogYmFzZVVuaXQgKiAyLFxuICAgICAgICBtYXJnaW5Ub3A6IGJhc2VVbml0ICogMixcbiAgICAgIH0pLFxufSk7XG5cbmV4cG9ydCBjb25zdCBJbmRpY2F0b3JTZXBhcmF0b3IgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oXG4gIHByb3BzOiBJbmRpY2F0b3JTZXBhcmF0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPlxuKSA9PiB7XG4gIGNvbnN0IHsgaW5uZXJQcm9wcyB9ID0gcHJvcHM7XG4gIHJldHVybiAoXG4gICAgPHNwYW5cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgICAgey4uLmdldFN0eWxlUHJvcHMocHJvcHMsICdpbmRpY2F0b3JTZXBhcmF0b3InLCB7XG4gICAgICAgICdpbmRpY2F0b3Itc2VwYXJhdG9yJzogdHJ1ZSxcbiAgICAgIH0pfVxuICAgIC8+XG4gICk7XG59O1xuXG4vLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbi8vIExvYWRpbmdcbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG5jb25zdCBsb2FkaW5nRG90QW5pbWF0aW9ucyA9IGtleWZyYW1lc2BcbiAgMCUsIDgwJSwgMTAwJSB7IG9wYWNpdHk6IDA7IH1cbiAgNDAlIHsgb3BhY2l0eTogMTsgfVxuYDtcblxuZXhwb3J0IGNvbnN0IGxvYWRpbmdJbmRpY2F0b3JDU1MgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oXG4gIHtcbiAgICBpc0ZvY3VzZWQsXG4gICAgc2l6ZSxcbiAgICB0aGVtZToge1xuICAgICAgY29sb3JzLFxuICAgICAgc3BhY2luZzogeyBiYXNlVW5pdCB9LFxuICAgIH0sXG4gIH06IExvYWRpbmdJbmRpY2F0b3JQcm9wczxPcHRpb24sIElzTXVsdGksIEdyb3VwPixcbiAgdW5zdHlsZWQ6IGJvb2xlYW5cbik6IENTU09iamVjdFdpdGhMYWJlbCA9PiAoe1xuICBsYWJlbDogJ2xvYWRpbmdJbmRpY2F0b3InLFxuICBkaXNwbGF5OiAnZmxleCcsXG4gIHRyYW5zaXRpb246ICdjb2xvciAxNTBtcycsXG4gIGFsaWduU2VsZjogJ2NlbnRlcicsXG4gIGZvbnRTaXplOiBzaXplLFxuICBsaW5lSGVpZ2h0OiAxLFxuICBtYXJnaW5SaWdodDogc2l6ZSxcbiAgdGV4dEFsaWduOiAnY2VudGVyJyxcbiAgdmVydGljYWxBbGlnbjogJ21pZGRsZScsXG4gIC4uLih1bnN0eWxlZFxuICAgID8ge31cbiAgICA6IHtcbiAgICAgICAgY29sb3I6IGlzRm9jdXNlZCA/IGNvbG9ycy5uZXV0cmFsNjAgOiBjb2xvcnMubmV1dHJhbDIwLFxuICAgICAgICBwYWRkaW5nOiBiYXNlVW5pdCAqIDIsXG4gICAgICB9KSxcbn0pO1xuXG5pbnRlcmZhY2UgTG9hZGluZ0RvdFByb3BzIHtcbiAgZGVsYXk6IG51bWJlcjtcbiAgb2Zmc2V0OiBib29sZWFuO1xufVxuY29uc3QgTG9hZGluZ0RvdCA9ICh7IGRlbGF5LCBvZmZzZXQgfTogTG9hZGluZ0RvdFByb3BzKSA9PiAoXG4gIDxzcGFuXG4gICAgY3NzPXt7XG4gICAgICBhbmltYXRpb246IGAke2xvYWRpbmdEb3RBbmltYXRpb25zfSAxcyBlYXNlLWluLW91dCAke2RlbGF5fW1zIGluZmluaXRlO2AsXG4gICAgICBiYWNrZ3JvdW5kQ29sb3I6ICdjdXJyZW50Q29sb3InLFxuICAgICAgYm9yZGVyUmFkaXVzOiAnMWVtJyxcbiAgICAgIGRpc3BsYXk6ICdpbmxpbmUtYmxvY2snLFxuICAgICAgbWFyZ2luTGVmdDogb2Zmc2V0ID8gJzFlbScgOiB1bmRlZmluZWQsXG4gICAgICBoZWlnaHQ6ICcxZW0nLFxuICAgICAgdmVydGljYWxBbGlnbjogJ3RvcCcsXG4gICAgICB3aWR0aDogJzFlbScsXG4gICAgfX1cbiAgLz5cbik7XG5cbmV4cG9ydCBpbnRlcmZhY2UgTG9hZGluZ0luZGljYXRvclByb3BzPFxuICBPcHRpb24gPSB1bmtub3duLFxuICBJc011bHRpIGV4dGVuZHMgYm9vbGVhbiA9IGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj4gPSBHcm91cEJhc2U8T3B0aW9uPlxuPiBleHRlbmRzIENvbW1vblByb3BzQW5kQ2xhc3NOYW1lPE9wdGlvbiwgSXNNdWx0aSwgR3JvdXA+IHtcbiAgLyoqIFByb3BzIHRoYXQgd2lsbCBiZSBwYXNzZWQgb24gdG8gdGhlIGNoaWxkcmVuLiAqL1xuICBpbm5lclByb3BzOiBKU1guSW50cmluc2ljRWxlbWVudHNbJ2RpdiddO1xuICAvKiogVGhlIGZvY3VzZWQgc3RhdGUgb2YgdGhlIHNlbGVjdC4gKi9cbiAgaXNGb2N1c2VkOiBib29sZWFuO1xuICBpc0Rpc2FibGVkOiBib29sZWFuO1xuICAvKiogU2V0IHNpemUgb2YgdGhlIGNvbnRhaW5lci4gKi9cbiAgc2l6ZTogbnVtYmVyO1xufVxuZXhwb3J0IGNvbnN0IExvYWRpbmdJbmRpY2F0b3IgPSA8XG4gIE9wdGlvbixcbiAgSXNNdWx0aSBleHRlbmRzIGJvb2xlYW4sXG4gIEdyb3VwIGV4dGVuZHMgR3JvdXBCYXNlPE9wdGlvbj5cbj4oe1xuICBpbm5lclByb3BzLFxuICBpc1J0bCxcbiAgc2l6ZSA9IDQsXG4gIC4uLnJlc3RQcm9wc1xufTogTG9hZGluZ0luZGljYXRvclByb3BzPE9wdGlvbiwgSXNNdWx0aSwgR3JvdXA+KSA9PiB7XG4gIHJldHVybiAoXG4gICAgPGRpdlxuICAgICAgey4uLmdldFN0eWxlUHJvcHMoXG4gICAgICAgIHsgLi4ucmVzdFByb3BzLCBpbm5lclByb3BzLCBpc1J0bCwgc2l6ZSB9LFxuICAgICAgICAnbG9hZGluZ0luZGljYXRvcicsXG4gICAgICAgIHtcbiAgICAgICAgICBpbmRpY2F0b3I6IHRydWUsXG4gICAgICAgICAgJ2xvYWRpbmctaW5kaWNhdG9yJzogdHJ1ZSxcbiAgICAgICAgfVxuICAgICAgKX1cbiAgICAgIHsuLi5pbm5lclByb3BzfVxuICAgID5cbiAgICAgIDxMb2FkaW5nRG90IGRlbGF5PXswfSBvZmZzZXQ9e2lzUnRsfSAvPlxuICAgICAgPExvYWRpbmdEb3QgZGVsYXk9ezE2MH0gb2Zmc2V0IC8+XG4gICAgICA8TG9hZGluZ0RvdCBkZWxheT17MzIwfSBvZmZzZXQ9eyFpc1J0bH0gLz5cbiAgICA8L2Rpdj5cbiAgKTtcbn07XG4iXX0= */") 55052 }); 55053}; 55054var LoadingIndicator = function LoadingIndicator(_ref7) { 55055 var innerProps = _ref7.innerProps, 55056 isRtl = _ref7.isRtl, 55057 _ref7$size = _ref7.size, 55058 size = _ref7$size === void 0 ? 4 : _ref7$size, 55059 restProps = (0,_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_4__["default"])(_ref7, _excluded2); 55060 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, getStyleProps((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({}, restProps), {}, { 55061 innerProps: innerProps, 55062 isRtl: isRtl, 55063 size: size 55064 }), 'loadingIndicator', { 55065 indicator: true, 55066 'loading-indicator': true 55067 }), innerProps), (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)(LoadingDot, { 55068 delay: 0, 55069 offset: isRtl 55070 }), (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)(LoadingDot, { 55071 delay: 160, 55072 offset: true 55073 }), (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)(LoadingDot, { 55074 delay: 320, 55075 offset: !isRtl 55076 })); 55077}; 55078 55079var css$1 = function css(_ref, unstyled) { 55080 var isDisabled = _ref.isDisabled, 55081 isFocused = _ref.isFocused, 55082 _ref$theme = _ref.theme, 55083 colors = _ref$theme.colors, 55084 borderRadius = _ref$theme.borderRadius, 55085 spacing = _ref$theme.spacing; 55086 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({ 55087 label: 'control', 55088 alignItems: 'center', 55089 cursor: 'default', 55090 display: 'flex', 55091 flexWrap: 'wrap', 55092 justifyContent: 'space-between', 55093 minHeight: spacing.controlHeight, 55094 outline: '0 !important', 55095 position: 'relative', 55096 transition: 'all 100ms' 55097 }, unstyled ? {} : { 55098 backgroundColor: isDisabled ? colors.neutral5 : colors.neutral0, 55099 borderColor: isDisabled ? colors.neutral10 : isFocused ? colors.primary : colors.neutral20, 55100 borderRadius: borderRadius, 55101 borderStyle: 'solid', 55102 borderWidth: 1, 55103 boxShadow: isFocused ? "0 0 0 1px ".concat(colors.primary) : undefined, 55104 '&:hover': { 55105 borderColor: isFocused ? colors.primary : colors.neutral30 55106 } 55107 }); 55108}; 55109var Control = function Control(props) { 55110 var children = props.children, 55111 isDisabled = props.isDisabled, 55112 isFocused = props.isFocused, 55113 innerRef = props.innerRef, 55114 innerProps = props.innerProps, 55115 menuIsOpen = props.menuIsOpen; 55116 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({ 55117 ref: innerRef 55118 }, getStyleProps(props, 'control', { 55119 control: true, 55120 'control--is-disabled': isDisabled, 55121 'control--is-focused': isFocused, 55122 'control--menu-is-open': menuIsOpen 55123 }), innerProps, { 55124 "aria-disabled": isDisabled || undefined 55125 }), children); 55126}; 55127var Control$1 = Control; 55128 55129var _excluded$1 = ["data"]; 55130var groupCSS = function groupCSS(_ref, unstyled) { 55131 var spacing = _ref.theme.spacing; 55132 return unstyled ? {} : { 55133 paddingBottom: spacing.baseUnit * 2, 55134 paddingTop: spacing.baseUnit * 2 55135 }; 55136}; 55137var Group = function Group(props) { 55138 var children = props.children, 55139 cx = props.cx, 55140 getStyles = props.getStyles, 55141 getClassNames = props.getClassNames, 55142 Heading = props.Heading, 55143 headingProps = props.headingProps, 55144 innerProps = props.innerProps, 55145 label = props.label, 55146 theme = props.theme, 55147 selectProps = props.selectProps; 55148 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, getStyleProps(props, 'group', { 55149 group: true 55150 }), innerProps), (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)(Heading, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, headingProps, { 55151 selectProps: selectProps, 55152 theme: theme, 55153 getStyles: getStyles, 55154 getClassNames: getClassNames, 55155 cx: cx 55156 }), label), (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", null, children)); 55157}; 55158var groupHeadingCSS = function groupHeadingCSS(_ref2, unstyled) { 55159 var _ref2$theme = _ref2.theme, 55160 colors = _ref2$theme.colors, 55161 spacing = _ref2$theme.spacing; 55162 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({ 55163 label: 'group', 55164 cursor: 'default', 55165 display: 'block' 55166 }, unstyled ? {} : { 55167 color: colors.neutral40, 55168 fontSize: '75%', 55169 fontWeight: 500, 55170 marginBottom: '0.25em', 55171 paddingLeft: spacing.baseUnit * 3, 55172 paddingRight: spacing.baseUnit * 3, 55173 textTransform: 'uppercase' 55174 }); 55175}; 55176var GroupHeading = function GroupHeading(props) { 55177 var _cleanCommonProps = cleanCommonProps(props); 55178 _cleanCommonProps.data; 55179 var innerProps = (0,_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_4__["default"])(_cleanCommonProps, _excluded$1); 55180 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, getStyleProps(props, 'groupHeading', { 55181 'group-heading': true 55182 }), innerProps)); 55183}; 55184var Group$1 = Group; 55185 55186var _excluded = ["innerRef", "isDisabled", "isHidden", "inputClassName"]; 55187var inputCSS = function inputCSS(_ref, unstyled) { 55188 var isDisabled = _ref.isDisabled, 55189 value = _ref.value, 55190 _ref$theme = _ref.theme, 55191 spacing = _ref$theme.spacing, 55192 colors = _ref$theme.colors; 55193 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({ 55194 visibility: isDisabled ? 'hidden' : 'visible', 55195 // force css to recompute when value change due to @emotion bug. 55196 // We can remove it whenever the bug is fixed. 55197 transform: value ? 'translateZ(0)' : '' 55198 }, containerStyle), unstyled ? {} : { 55199 margin: spacing.baseUnit / 2, 55200 paddingBottom: spacing.baseUnit / 2, 55201 paddingTop: spacing.baseUnit / 2, 55202 color: colors.neutral80 55203 }); 55204}; 55205var spacingStyle = { 55206 gridArea: '1 / 2', 55207 font: 'inherit', 55208 minWidth: '2px', 55209 border: 0, 55210 margin: 0, 55211 outline: 0, 55212 padding: 0 55213}; 55214var containerStyle = { 55215 flex: '1 1 auto', 55216 display: 'inline-grid', 55217 gridArea: '1 / 1 / 2 / 3', 55218 gridTemplateColumns: '0 min-content', 55219 '&:after': (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({ 55220 content: 'attr(data-value) " "', 55221 visibility: 'hidden', 55222 whiteSpace: 'pre' 55223 }, spacingStyle) 55224}; 55225var inputStyle = function inputStyle(isHidden) { 55226 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({ 55227 label: 'input', 55228 color: 'inherit', 55229 background: 0, 55230 opacity: isHidden ? 0 : 1, 55231 width: '100%' 55232 }, spacingStyle); 55233}; 55234var Input = function Input(props) { 55235 var cx = props.cx, 55236 value = props.value; 55237 var _cleanCommonProps = cleanCommonProps(props), 55238 innerRef = _cleanCommonProps.innerRef, 55239 isDisabled = _cleanCommonProps.isDisabled, 55240 isHidden = _cleanCommonProps.isHidden, 55241 inputClassName = _cleanCommonProps.inputClassName, 55242 innerProps = (0,_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_4__["default"])(_cleanCommonProps, _excluded); 55243 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, getStyleProps(props, 'input', { 55244 'input-container': true 55245 }), { 55246 "data-value": value || '' 55247 }), (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("input", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({ 55248 className: cx({ 55249 input: true 55250 }, inputClassName), 55251 ref: innerRef, 55252 style: inputStyle(isHidden), 55253 disabled: isDisabled 55254 }, innerProps))); 55255}; 55256var Input$1 = Input; 55257 55258var multiValueCSS = function multiValueCSS(_ref, unstyled) { 55259 var _ref$theme = _ref.theme, 55260 spacing = _ref$theme.spacing, 55261 borderRadius = _ref$theme.borderRadius, 55262 colors = _ref$theme.colors; 55263 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({ 55264 label: 'multiValue', 55265 display: 'flex', 55266 minWidth: 0 55267 }, unstyled ? {} : { 55268 backgroundColor: colors.neutral10, 55269 borderRadius: borderRadius / 2, 55270 margin: spacing.baseUnit / 2 55271 }); 55272}; 55273var multiValueLabelCSS = function multiValueLabelCSS(_ref2, unstyled) { 55274 var _ref2$theme = _ref2.theme, 55275 borderRadius = _ref2$theme.borderRadius, 55276 colors = _ref2$theme.colors, 55277 cropWithEllipsis = _ref2.cropWithEllipsis; 55278 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({ 55279 overflow: 'hidden', 55280 textOverflow: cropWithEllipsis || cropWithEllipsis === undefined ? 'ellipsis' : undefined, 55281 whiteSpace: 'nowrap' 55282 }, unstyled ? {} : { 55283 borderRadius: borderRadius / 2, 55284 color: colors.neutral80, 55285 fontSize: '85%', 55286 padding: 3, 55287 paddingLeft: 6 55288 }); 55289}; 55290var multiValueRemoveCSS = function multiValueRemoveCSS(_ref3, unstyled) { 55291 var _ref3$theme = _ref3.theme, 55292 spacing = _ref3$theme.spacing, 55293 borderRadius = _ref3$theme.borderRadius, 55294 colors = _ref3$theme.colors, 55295 isFocused = _ref3.isFocused; 55296 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({ 55297 alignItems: 'center', 55298 display: 'flex' 55299 }, unstyled ? {} : { 55300 borderRadius: borderRadius / 2, 55301 backgroundColor: isFocused ? colors.dangerLight : undefined, 55302 paddingLeft: spacing.baseUnit, 55303 paddingRight: spacing.baseUnit, 55304 ':hover': { 55305 backgroundColor: colors.dangerLight, 55306 color: colors.danger 55307 } 55308 }); 55309}; 55310var MultiValueGeneric = function MultiValueGeneric(_ref4) { 55311 var children = _ref4.children, 55312 innerProps = _ref4.innerProps; 55313 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", innerProps, children); 55314}; 55315var MultiValueContainer = MultiValueGeneric; 55316var MultiValueLabel = MultiValueGeneric; 55317function MultiValueRemove(_ref5) { 55318 var children = _ref5.children, 55319 innerProps = _ref5.innerProps; 55320 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({ 55321 role: "button" 55322 }, innerProps), children || (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)(CrossIcon, { 55323 size: 14 55324 })); 55325} 55326var MultiValue = function MultiValue(props) { 55327 var children = props.children, 55328 components = props.components, 55329 data = props.data, 55330 innerProps = props.innerProps, 55331 isDisabled = props.isDisabled, 55332 removeProps = props.removeProps, 55333 selectProps = props.selectProps; 55334 var Container = components.Container, 55335 Label = components.Label, 55336 Remove = components.Remove; 55337 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)(Container, { 55338 data: data, 55339 innerProps: (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({}, getStyleProps(props, 'multiValue', { 55340 'multi-value': true, 55341 'multi-value--is-disabled': isDisabled 55342 })), innerProps), 55343 selectProps: selectProps 55344 }, (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)(Label, { 55345 data: data, 55346 innerProps: (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({}, getStyleProps(props, 'multiValueLabel', { 55347 'multi-value__label': true 55348 })), 55349 selectProps: selectProps 55350 }, children), (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)(Remove, { 55351 data: data, 55352 innerProps: (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({}, getStyleProps(props, 'multiValueRemove', { 55353 'multi-value__remove': true 55354 })), {}, { 55355 'aria-label': "Remove ".concat(children || 'option') 55356 }, removeProps), 55357 selectProps: selectProps 55358 })); 55359}; 55360var MultiValue$1 = MultiValue; 55361 55362var optionCSS = function optionCSS(_ref, unstyled) { 55363 var isDisabled = _ref.isDisabled, 55364 isFocused = _ref.isFocused, 55365 isSelected = _ref.isSelected, 55366 _ref$theme = _ref.theme, 55367 spacing = _ref$theme.spacing, 55368 colors = _ref$theme.colors; 55369 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({ 55370 label: 'option', 55371 cursor: 'default', 55372 display: 'block', 55373 fontSize: 'inherit', 55374 width: '100%', 55375 userSelect: 'none', 55376 WebkitTapHighlightColor: 'rgba(0, 0, 0, 0)' 55377 }, unstyled ? {} : { 55378 backgroundColor: isSelected ? colors.primary : isFocused ? colors.primary25 : 'transparent', 55379 color: isDisabled ? colors.neutral20 : isSelected ? colors.neutral0 : 'inherit', 55380 padding: "".concat(spacing.baseUnit * 2, "px ").concat(spacing.baseUnit * 3, "px"), 55381 // provide some affordance on touch devices 55382 ':active': { 55383 backgroundColor: !isDisabled ? isSelected ? colors.primary : colors.primary50 : undefined 55384 } 55385 }); 55386}; 55387var Option = function Option(props) { 55388 var children = props.children, 55389 isDisabled = props.isDisabled, 55390 isFocused = props.isFocused, 55391 isSelected = props.isSelected, 55392 innerRef = props.innerRef, 55393 innerProps = props.innerProps; 55394 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, getStyleProps(props, 'option', { 55395 option: true, 55396 'option--is-disabled': isDisabled, 55397 'option--is-focused': isFocused, 55398 'option--is-selected': isSelected 55399 }), { 55400 ref: innerRef, 55401 "aria-disabled": isDisabled 55402 }, innerProps), children); 55403}; 55404var Option$1 = Option; 55405 55406var placeholderCSS = function placeholderCSS(_ref, unstyled) { 55407 var _ref$theme = _ref.theme, 55408 spacing = _ref$theme.spacing, 55409 colors = _ref$theme.colors; 55410 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({ 55411 label: 'placeholder', 55412 gridArea: '1 / 1 / 2 / 3' 55413 }, unstyled ? {} : { 55414 color: colors.neutral50, 55415 marginLeft: spacing.baseUnit / 2, 55416 marginRight: spacing.baseUnit / 2 55417 }); 55418}; 55419var Placeholder = function Placeholder(props) { 55420 var children = props.children, 55421 innerProps = props.innerProps; 55422 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, getStyleProps(props, 'placeholder', { 55423 placeholder: true 55424 }), innerProps), children); 55425}; 55426var Placeholder$1 = Placeholder; 55427 55428var css = function css(_ref, unstyled) { 55429 var isDisabled = _ref.isDisabled, 55430 _ref$theme = _ref.theme, 55431 spacing = _ref$theme.spacing, 55432 colors = _ref$theme.colors; 55433 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({ 55434 label: 'singleValue', 55435 gridArea: '1 / 1 / 2 / 3', 55436 maxWidth: '100%', 55437 overflow: 'hidden', 55438 textOverflow: 'ellipsis', 55439 whiteSpace: 'nowrap' 55440 }, unstyled ? {} : { 55441 color: isDisabled ? colors.neutral40 : colors.neutral80, 55442 marginLeft: spacing.baseUnit / 2, 55443 marginRight: spacing.baseUnit / 2 55444 }); 55445}; 55446var SingleValue = function SingleValue(props) { 55447 var children = props.children, 55448 isDisabled = props.isDisabled, 55449 innerProps = props.innerProps; 55450 return (0,_emotion_react__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, getStyleProps(props, 'singleValue', { 55451 'single-value': true, 55452 'single-value--is-disabled': isDisabled 55453 }), innerProps), children); 55454}; 55455var SingleValue$1 = SingleValue; 55456 55457var components = { 55458 ClearIndicator: ClearIndicator, 55459 Control: Control$1, 55460 DropdownIndicator: DropdownIndicator, 55461 DownChevron: DownChevron, 55462 CrossIcon: CrossIcon, 55463 Group: Group$1, 55464 GroupHeading: GroupHeading, 55465 IndicatorsContainer: IndicatorsContainer, 55466 IndicatorSeparator: IndicatorSeparator, 55467 Input: Input$1, 55468 LoadingIndicator: LoadingIndicator, 55469 Menu: Menu$1, 55470 MenuList: MenuList, 55471 MenuPortal: MenuPortal, 55472 LoadingMessage: LoadingMessage, 55473 NoOptionsMessage: NoOptionsMessage, 55474 MultiValue: MultiValue$1, 55475 MultiValueContainer: MultiValueContainer, 55476 MultiValueLabel: MultiValueLabel, 55477 MultiValueRemove: MultiValueRemove, 55478 Option: Option$1, 55479 Placeholder: Placeholder$1, 55480 SelectContainer: SelectContainer, 55481 SingleValue: SingleValue$1, 55482 ValueContainer: ValueContainer 55483}; 55484var defaultComponents = function defaultComponents(props) { 55485 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({}, components), props.components); 55486}; 55487 55488 55489 55490 55491/***/ }), 55492
vendor: 6,489 bytes, lines 55493-55583
55493/***/ "./node_modules/react-select/dist/react-select.esm.js": 55494/*!************************************************************!*\ 55495 !*** ./node_modules/react-select/dist/react-select.esm.js ***! 55496 \************************************************************/ 55497/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 55498 55499"use strict"; 55500__webpack_require__.r(__webpack_exports__); 55501/* harmony export */ __webpack_require__.d(__webpack_exports__, { 55502/* harmony export */ NonceProvider: () => (/* binding */ NonceProvider), 55503/* harmony export */ components: () => (/* reexport safe */ _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_6__.c), 55504/* harmony export */ createFilter: () => (/* reexport safe */ _Select_ef7c0426_esm_js__WEBPACK_IMPORTED_MODULE_3__.c), 55505/* harmony export */ "default": () => (/* binding */ StateManagedSelect$1), 55506/* harmony export */ defaultTheme: () => (/* reexport safe */ _Select_ef7c0426_esm_js__WEBPACK_IMPORTED_MODULE_3__.d), 55507/* harmony export */ mergeStyles: () => (/* reexport safe */ _Select_ef7c0426_esm_js__WEBPACK_IMPORTED_MODULE_3__.m), 55508/* harmony export */ useStateManager: () => (/* reexport safe */ _useStateManager_7e1e8489_esm_js__WEBPACK_IMPORTED_MODULE_0__.u) 55509/* harmony export */ }); 55510/* harmony import */ var _useStateManager_7e1e8489_esm_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./useStateManager-7e1e8489.esm.js */ "./node_modules/react-select/dist/useStateManager-7e1e8489.esm.js"); 55511/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./node_modules/@babel/runtime/helpers/esm/extends.js"); 55512/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 55513/* harmony import */ var _Select_ef7c0426_esm_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Select-ef7c0426.esm.js */ "./node_modules/react-select/dist/Select-ef7c0426.esm.js"); 55514/* harmony import */ var _emotion_react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @emotion/react */ "./node_modules/@emotion/react/dist/emotion-element-489459f2.browser.development.esm.js"); 55515/* harmony import */ var _emotion_cache__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @emotion/cache */ "./node_modules/@emotion/cache/dist/emotion-cache.browser.development.esm.js"); 55516/* harmony import */ var _index_641ee5b8_esm_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./index-641ee5b8.esm.js */ "./node_modules/react-select/dist/index-641ee5b8.esm.js"); 55517/* harmony import */ var _babel_runtime_helpers_objectSpread2__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/objectSpread2 */ "./node_modules/@babel/runtime/helpers/esm/objectSpread2.js"); 55518/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"); 55519/* harmony import */ var _babel_runtime_helpers_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @babel/runtime/helpers/objectWithoutProperties */ "./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"); 55520/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js"); 55521/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/esm/createClass.js"); 55522/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/esm/inherits.js"); 55523/* harmony import */ var _babel_runtime_helpers_createSuper__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @babel/runtime/helpers/createSuper */ "./node_modules/@babel/runtime/helpers/esm/createSuper.js"); 55524/* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js"); 55525/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/esm/typeof.js"); 55526/* harmony import */ var _babel_runtime_helpers_taggedTemplateLiteral__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! @babel/runtime/helpers/taggedTemplateLiteral */ "./node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js"); 55527/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js"); 55528/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js"); 55529/* harmony import */ var use_isomorphic_layout_effect__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! use-isomorphic-layout-effect */ "./node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js"); 55530 55531 55532 55533 55534 55535 55536 55537 55538 55539 55540 55541 55542 55543 55544 55545 55546 55547 55548 55549 55550 55551 55552 55553 55554 55555 55556var StateManagedSelect = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_2__.forwardRef)(function (props, ref) { 55557 var baseSelectProps = (0,_useStateManager_7e1e8489_esm_js__WEBPACK_IMPORTED_MODULE_0__.u)(props); 55558 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2__.createElement(_Select_ef7c0426_esm_js__WEBPACK_IMPORTED_MODULE_3__.S, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({ 55559 ref: ref 55560 }, baseSelectProps)); 55561}); 55562var StateManagedSelect$1 = StateManagedSelect; 55563 55564var NonceProvider = (function (_ref) { 55565 var nonce = _ref.nonce, 55566 children = _ref.children, 55567 cacheKey = _ref.cacheKey; 55568 var emotionCache = (0,react__WEBPACK_IMPORTED_MODULE_2__.useMemo)(function () { 55569 return (0,_emotion_cache__WEBPACK_IMPORTED_MODULE_5__["default"])({ 55570 key: cacheKey, 55571 nonce: nonce 55572 }); 55573 }, [cacheKey, nonce]); 55574 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2__.createElement(_emotion_react__WEBPACK_IMPORTED_MODULE_4__.C, { 55575 value: emotionCache 55576 }, children); 55577}); 55578 55579 55580 55581 55582/***/ }), 55583
vendor: 5,098 bytes, lines 55584-55675
55584/***/ "./node_modules/react-select/dist/useStateManager-7e1e8489.esm.js": 55585/*!************************************************************************!*\ 55586 !*** ./node_modules/react-select/dist/useStateManager-7e1e8489.esm.js ***! 55587 \************************************************************************/ 55588/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 55589 55590"use strict"; 55591__webpack_require__.r(__webpack_exports__); 55592/* harmony export */ __webpack_require__.d(__webpack_exports__, { 55593/* harmony export */ u: () => (/* binding */ useStateManager) 55594/* harmony export */ }); 55595/* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ "./node_modules/@babel/runtime/helpers/esm/objectSpread2.js"); 55596/* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/slicedToArray */ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"); 55597/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutProperties */ "./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"); 55598/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 55599 55600 55601 55602 55603 55604var _excluded = ["defaultInputValue", "defaultMenuIsOpen", "defaultValue", "inputValue", "menuIsOpen", "onChange", "onInputChange", "onMenuClose", "onMenuOpen", "value"]; 55605function useStateManager(_ref) { 55606 var _ref$defaultInputValu = _ref.defaultInputValue, 55607 defaultInputValue = _ref$defaultInputValu === void 0 ? '' : _ref$defaultInputValu, 55608 _ref$defaultMenuIsOpe = _ref.defaultMenuIsOpen, 55609 defaultMenuIsOpen = _ref$defaultMenuIsOpe === void 0 ? false : _ref$defaultMenuIsOpe, 55610 _ref$defaultValue = _ref.defaultValue, 55611 defaultValue = _ref$defaultValue === void 0 ? null : _ref$defaultValue, 55612 propsInputValue = _ref.inputValue, 55613 propsMenuIsOpen = _ref.menuIsOpen, 55614 propsOnChange = _ref.onChange, 55615 propsOnInputChange = _ref.onInputChange, 55616 propsOnMenuClose = _ref.onMenuClose, 55617 propsOnMenuOpen = _ref.onMenuOpen, 55618 propsValue = _ref.value, 55619 restSelectProps = (0,_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2__["default"])(_ref, _excluded); 55620 var _useState = (0,react__WEBPACK_IMPORTED_MODULE_3__.useState)(propsInputValue !== undefined ? propsInputValue : defaultInputValue), 55621 _useState2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_1__["default"])(_useState, 2), 55622 stateInputValue = _useState2[0], 55623 setStateInputValue = _useState2[1]; 55624 var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_3__.useState)(propsMenuIsOpen !== undefined ? propsMenuIsOpen : defaultMenuIsOpen), 55625 _useState4 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_1__["default"])(_useState3, 2), 55626 stateMenuIsOpen = _useState4[0], 55627 setStateMenuIsOpen = _useState4[1]; 55628 var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_3__.useState)(propsValue !== undefined ? propsValue : defaultValue), 55629 _useState6 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_1__["default"])(_useState5, 2), 55630 stateValue = _useState6[0], 55631 setStateValue = _useState6[1]; 55632 var onChange = (0,react__WEBPACK_IMPORTED_MODULE_3__.useCallback)(function (value, actionMeta) { 55633 if (typeof propsOnChange === 'function') { 55634 propsOnChange(value, actionMeta); 55635 } 55636 setStateValue(value); 55637 }, [propsOnChange]); 55638 var onInputChange = (0,react__WEBPACK_IMPORTED_MODULE_3__.useCallback)(function (value, actionMeta) { 55639 var newValue; 55640 if (typeof propsOnInputChange === 'function') { 55641 newValue = propsOnInputChange(value, actionMeta); 55642 } 55643 setStateInputValue(newValue !== undefined ? newValue : value); 55644 }, [propsOnInputChange]); 55645 var onMenuOpen = (0,react__WEBPACK_IMPORTED_MODULE_3__.useCallback)(function () { 55646 if (typeof propsOnMenuOpen === 'function') { 55647 propsOnMenuOpen(); 55648 } 55649 setStateMenuIsOpen(true); 55650 }, [propsOnMenuOpen]); 55651 var onMenuClose = (0,react__WEBPACK_IMPORTED_MODULE_3__.useCallback)(function () { 55652 if (typeof propsOnMenuClose === 'function') { 55653 propsOnMenuClose(); 55654 } 55655 setStateMenuIsOpen(false); 55656 }, [propsOnMenuClose]); 55657 var inputValue = propsInputValue !== undefined ? propsInputValue : stateInputValue; 55658 var menuIsOpen = propsMenuIsOpen !== undefined ? propsMenuIsOpen : stateMenuIsOpen; 55659 var value = propsValue !== undefined ? propsValue : stateValue; 55660 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({}, restSelectProps), {}, { 55661 inputValue: inputValue, 55662 menuIsOpen: menuIsOpen, 55663 onChange: onChange, 55664 onInputChange: onInputChange, 55665 onMenuClose: onMenuClose, 55666 onMenuOpen: onMenuOpen, 55667 value: value 55668 }); 55669} 55670 55671 55672 55673 55674/***/ }), 55675
vendor: 61,046 bytes, lines 55676-57598
55676/***/ "./node_modules/react/cjs/react.development.js": 55677/*!*****************************************************!*\ 55678 !*** ./node_modules/react/cjs/react.development.js ***! 55679 \*****************************************************/ 55680/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 55681 55682"use strict"; 55683/** @license React v16.13.1 55684 * react.development.js 55685 * 55686 * Copyright (c) Facebook, Inc. and its affiliates. 55687 * 55688 * This source code is licensed under the MIT license found in the 55689 * LICENSE file in the root directory of this source tree. 55690 */ 55691 55692 55693 55694 55695 55696if (true) { 55697 (function() { 55698'use strict'; 55699 55700var _assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js"); 55701var checkPropTypes = __webpack_require__(/*! prop-types/checkPropTypes */ "./node_modules/prop-types/checkPropTypes.js"); 55702 55703var ReactVersion = '16.13.1'; 55704 55705// The Symbol used to tag the ReactElement-like types. If there is no native Symbol 55706// nor polyfill, then a plain number is used for performance. 55707var hasSymbol = typeof Symbol === 'function' && Symbol.for; 55708var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; 55709var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; 55710var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; 55711var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; 55712var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; 55713var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; 55714var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary 55715var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; 55716var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; 55717var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; 55718var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; 55719var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; 55720var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; 55721var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; 55722var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; 55723var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; 55724var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; 55725var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; 55726var FAUX_ITERATOR_SYMBOL = '@@iterator'; 55727function getIteratorFn(maybeIterable) { 55728 if (maybeIterable === null || typeof maybeIterable !== 'object') { 55729 return null; 55730 } 55731 55732 var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; 55733 55734 if (typeof maybeIterator === 'function') { 55735 return maybeIterator; 55736 } 55737 55738 return null; 55739} 55740 55741/** 55742 * Keeps track of the current dispatcher. 55743 */ 55744var ReactCurrentDispatcher = { 55745 /** 55746 * @internal 55747 * @type {ReactComponent} 55748 */ 55749 current: null 55750}; 55751 55752/** 55753 * Keeps track of the current batch's configuration such as how long an update 55754 * should suspend for if it needs to. 55755 */ 55756var ReactCurrentBatchConfig = { 55757 suspense: null 55758}; 55759 55760/** 55761 * Keeps track of the current owner. 55762 * 55763 * The current owner is the component who should own any components that are 55764 * currently being constructed. 55765 */ 55766var ReactCurrentOwner = { 55767 /** 55768 * @internal 55769 * @type {ReactComponent} 55770 */ 55771 current: null 55772}; 55773 55774var BEFORE_SLASH_RE = /^(.*)[\\\/]/; 55775function describeComponentFrame (name, source, ownerName) { 55776 var sourceInfo = ''; 55777 55778 if (source) { 55779 var path = source.fileName; 55780 var fileName = path.replace(BEFORE_SLASH_RE, ''); 55781 55782 { 55783 // In DEV, include code for a common special case: 55784 // prefer "folder/index.js" instead of just "index.js". 55785 if (/^index\./.test(fileName)) { 55786 var match = path.match(BEFORE_SLASH_RE); 55787 55788 if (match) { 55789 var pathBeforeSlash = match[1]; 55790 55791 if (pathBeforeSlash) { 55792 var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, ''); 55793 fileName = folderName + '/' + fileName; 55794 } 55795 } 55796 } 55797 } 55798 55799 sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')'; 55800 } else if (ownerName) { 55801 sourceInfo = ' (created by ' + ownerName + ')'; 55802 } 55803 55804 return '\n in ' + (name || 'Unknown') + sourceInfo; 55805} 55806 55807var Resolved = 1; 55808function refineResolvedLazyComponent(lazyComponent) { 55809 return lazyComponent._status === Resolved ? lazyComponent._result : null; 55810} 55811 55812function getWrappedName(outerType, innerType, wrapperName) { 55813 var functionName = innerType.displayName || innerType.name || ''; 55814 return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName); 55815} 55816 55817function getComponentName(type) { 55818 if (type == null) { 55819 // Host root, text node or just invalid type. 55820 return null; 55821 } 55822 55823 { 55824 if (typeof type.tag === 'number') { 55825 error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.'); 55826 } 55827 } 55828 55829 if (typeof type === 'function') { 55830 return type.displayName || type.name || null; 55831 } 55832 55833 if (typeof type === 'string') { 55834 return type; 55835 } 55836 55837 switch (type) { 55838 case REACT_FRAGMENT_TYPE: 55839 return 'Fragment'; 55840 55841 case REACT_PORTAL_TYPE: 55842 return 'Portal'; 55843 55844 case REACT_PROFILER_TYPE: 55845 return "Profiler"; 55846 55847 case REACT_STRICT_MODE_TYPE: 55848 return 'StrictMode'; 55849 55850 case REACT_SUSPENSE_TYPE: 55851 return 'Suspense'; 55852 55853 case REACT_SUSPENSE_LIST_TYPE: 55854 return 'SuspenseList'; 55855 } 55856 55857 if (typeof type === 'object') { 55858 switch (type.$$typeof) { 55859 case REACT_CONTEXT_TYPE: 55860 return 'Context.Consumer'; 55861 55862 case REACT_PROVIDER_TYPE: 55863 return 'Context.Provider'; 55864 55865 case REACT_FORWARD_REF_TYPE: 55866 return getWrappedName(type, type.render, 'ForwardRef'); 55867 55868 case REACT_MEMO_TYPE: 55869 return getComponentName(type.type); 55870 55871 case REACT_BLOCK_TYPE: 55872 return getComponentName(type.render); 55873 55874 case REACT_LAZY_TYPE: 55875 { 55876 var thenable = type; 55877 var resolvedThenable = refineResolvedLazyComponent(thenable); 55878 55879 if (resolvedThenable) { 55880 return getComponentName(resolvedThenable); 55881 } 55882 55883 break; 55884 } 55885 } 55886 } 55887 55888 return null; 55889} 55890 55891var ReactDebugCurrentFrame = {}; 55892var currentlyValidatingElement = null; 55893function setCurrentlyValidatingElement(element) { 55894 { 55895 currentlyValidatingElement = element; 55896 } 55897} 55898 55899{ 55900 // Stack implementation injected by the current renderer. 55901 ReactDebugCurrentFrame.getCurrentStack = null; 55902 55903 ReactDebugCurrentFrame.getStackAddendum = function () { 55904 var stack = ''; // Add an extra top frame while an element is being validated 55905 55906 if (currentlyValidatingElement) { 55907 var name = getComponentName(currentlyValidatingElement.type); 55908 var owner = currentlyValidatingElement._owner; 55909 stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type)); 55910 } // Delegate to the injected renderer-specific implementation 55911 55912 55913 var impl = ReactDebugCurrentFrame.getCurrentStack; 55914 55915 if (impl) { 55916 stack += impl() || ''; 55917 } 55918 55919 return stack; 55920 }; 55921} 55922 55923/** 55924 * Used by act() to track whether you're inside an act() scope. 55925 */ 55926var IsSomeRendererActing = { 55927 current: false 55928}; 55929 55930var ReactSharedInternals = { 55931 ReactCurrentDispatcher: ReactCurrentDispatcher, 55932 ReactCurrentBatchConfig: ReactCurrentBatchConfig, 55933 ReactCurrentOwner: ReactCurrentOwner, 55934 IsSomeRendererActing: IsSomeRendererActing, 55935 // Used by renderers to avoid bundling object-assign twice in UMD bundles: 55936 assign: _assign 55937}; 55938 55939{ 55940 _assign(ReactSharedInternals, { 55941 // These should not be included in production. 55942 ReactDebugCurrentFrame: ReactDebugCurrentFrame, 55943 // Shim for React DOM 16.0.0 which still destructured (but not used) this. 55944 // TODO: remove in React 17.0. 55945 ReactComponentTreeHook: {} 55946 }); 55947} 55948 55949// by calls to these methods by a Babel plugin. 55950// 55951// In PROD (or in packages without access to React internals), 55952// they are left as they are instead. 55953 55954function warn(format) { 55955 { 55956 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 55957 args[_key - 1] = arguments[_key]; 55958 } 55959 55960 printWarning('warn', format, args); 55961 } 55962} 55963function error(format) { 55964 { 55965 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { 55966 args[_key2 - 1] = arguments[_key2]; 55967 } 55968 55969 printWarning('error', format, args); 55970 } 55971} 55972 55973function printWarning(level, format, args) { 55974 // When changing this logic, you might want to also 55975 // update consoleWithStackDev.www.js as well. 55976 { 55977 var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0; 55978 55979 if (!hasExistingStack) { 55980 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; 55981 var stack = ReactDebugCurrentFrame.getStackAddendum(); 55982 55983 if (stack !== '') { 55984 format += '%s'; 55985 args = args.concat([stack]); 55986 } 55987 } 55988 55989 var argsWithFormat = args.map(function (item) { 55990 return '' + item; 55991 }); // Careful: RN currently depends on this prefix 55992 55993 argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it 55994 // breaks IE9: https://github.com/facebook/react/issues/13610 55995 // eslint-disable-next-line react-internal/no-production-logging 55996 55997 Function.prototype.apply.call(console[level], console, argsWithFormat); 55998 55999 try { 56000 // --- Welcome to debugging React --- 56001 // This error was thrown as a convenience so that you can use this stack 56002 // to find the callsite that caused this warning to fire. 56003 var argIndex = 0; 56004 var message = 'Warning: ' + format.replace(/%s/g, function () { 56005 return args[argIndex++]; 56006 }); 56007 throw new Error(message); 56008 } catch (x) {} 56009 } 56010} 56011 56012var didWarnStateUpdateForUnmountedComponent = {}; 56013 56014function warnNoop(publicInstance, callerName) { 56015 { 56016 var _constructor = publicInstance.constructor; 56017 var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass'; 56018 var warningKey = componentName + "." + callerName; 56019 56020 if (didWarnStateUpdateForUnmountedComponent[warningKey]) { 56021 return; 56022 } 56023 56024 error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName); 56025 56026 didWarnStateUpdateForUnmountedComponent[warningKey] = true; 56027 } 56028} 56029/** 56030 * This is the abstract API for an update queue. 56031 */ 56032 56033 56034var ReactNoopUpdateQueue = { 56035 /** 56036 * Checks whether or not this composite component is mounted. 56037 * @param {ReactClass} publicInstance The instance we want to test. 56038 * @return {boolean} True if mounted, false otherwise. 56039 * @protected 56040 * @final 56041 */ 56042 isMounted: function (publicInstance) { 56043 return false; 56044 }, 56045 56046 /** 56047 * Forces an update. This should only be invoked when it is known with 56048 * certainty that we are **not** in a DOM transaction. 56049 * 56050 * You may want to call this when you know that some deeper aspect of the 56051 * component's state has changed but `setState` was not called. 56052 * 56053 * This will not invoke `shouldComponentUpdate`, but it will invoke 56054 * `componentWillUpdate` and `componentDidUpdate`. 56055 * 56056 * @param {ReactClass} publicInstance The instance that should rerender. 56057 * @param {?function} callback Called after component is updated. 56058 * @param {?string} callerName name of the calling function in the public API. 56059 * @internal 56060 */ 56061 enqueueForceUpdate: function (publicInstance, callback, callerName) { 56062 warnNoop(publicInstance, 'forceUpdate'); 56063 }, 56064 56065 /** 56066 * Replaces all of the state. Always use this or `setState` to mutate state. 56067 * You should treat `this.state` as immutable. 56068 * 56069 * There is no guarantee that `this.state` will be immediately updated, so 56070 * accessing `this.state` after calling this method may return the old value. 56071 * 56072 * @param {ReactClass} publicInstance The instance that should rerender. 56073 * @param {object} completeState Next state. 56074 * @param {?function} callback Called after component is updated. 56075 * @param {?string} callerName name of the calling function in the public API. 56076 * @internal 56077 */ 56078 enqueueReplaceState: function (publicInstance, completeState, callback, callerName) { 56079 warnNoop(publicInstance, 'replaceState'); 56080 }, 56081 56082 /** 56083 * Sets a subset of the state. This only exists because _pendingState is 56084 * internal. This provides a merging strategy that is not available to deep 56085 * properties which is confusing. TODO: Expose pendingState or don't use it 56086 * during the merge. 56087 * 56088 * @param {ReactClass} publicInstance The instance that should rerender. 56089 * @param {object} partialState Next partial state to be merged with state. 56090 * @param {?function} callback Called after component is updated. 56091 * @param {?string} Name of the calling function in the public API. 56092 * @internal 56093 */ 56094 enqueueSetState: function (publicInstance, partialState, callback, callerName) { 56095 warnNoop(publicInstance, 'setState'); 56096 } 56097}; 56098 56099var emptyObject = {}; 56100 56101{ 56102 Object.freeze(emptyObject); 56103} 56104/** 56105 * Base class helpers for the updating state of a component. 56106 */ 56107 56108 56109function Component(props, context, updater) { 56110 this.props = props; 56111 this.context = context; // If a component has string refs, we will assign a different object later. 56112 56113 this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the 56114 // renderer. 56115 56116 this.updater = updater || ReactNoopUpdateQueue; 56117} 56118 56119Component.prototype.isReactComponent = {}; 56120/** 56121 * Sets a subset of the state. Always use this to mutate 56122 * state. You should treat `this.state` as immutable. 56123 * 56124 * There is no guarantee that `this.state` will be immediately updated, so 56125 * accessing `this.state` after calling this method may return the old value. 56126 * 56127 * There is no guarantee that calls to `setState` will run synchronously, 56128 * as they may eventually be batched together. You can provide an optional 56129 * callback that will be executed when the call to setState is actually 56130 * completed. 56131 * 56132 * When a function is provided to setState, it will be called at some point in 56133 * the future (not synchronously). It will be called with the up to date 56134 * component arguments (state, props, context). These values can be different 56135 * from this.* because your function may be called after receiveProps but before 56136 * shouldComponentUpdate, and this new state, props, and context will not yet be 56137 * assigned to this. 56138 * 56139 * @param {object|function} partialState Next partial state or function to 56140 * produce next partial state to be merged with current state. 56141 * @param {?function} callback Called after state is updated. 56142 * @final 56143 * @protected 56144 */ 56145 56146Component.prototype.setState = function (partialState, callback) { 56147 if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) { 56148 { 56149 throw Error( "setState(...): takes an object of state variables to update or a function which returns an object of state variables." ); 56150 } 56151 } 56152 56153 this.updater.enqueueSetState(this, partialState, callback, 'setState'); 56154}; 56155/** 56156 * Forces an update. This should only be invoked when it is known with 56157 * certainty that we are **not** in a DOM transaction. 56158 * 56159 * You may want to call this when you know that some deeper aspect of the 56160 * component's state has changed but `setState` was not called. 56161 * 56162 * This will not invoke `shouldComponentUpdate`, but it will invoke 56163 * `componentWillUpdate` and `componentDidUpdate`. 56164 * 56165 * @param {?function} callback Called after update is complete. 56166 * @final 56167 * @protected 56168 */ 56169 56170 56171Component.prototype.forceUpdate = function (callback) { 56172 this.updater.enqueueForceUpdate(this, callback, 'forceUpdate'); 56173}; 56174/** 56175 * Deprecated APIs. These APIs used to exist on classic React classes but since 56176 * we would like to deprecate them, we're not going to move them over to this 56177 * modern base class. Instead, we define a getter that warns if it's accessed. 56178 */ 56179 56180 56181{ 56182 var deprecatedAPIs = { 56183 isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], 56184 replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] 56185 }; 56186 56187 var defineDeprecationWarning = function (methodName, info) { 56188 Object.defineProperty(Component.prototype, methodName, { 56189 get: function () { 56190 warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]); 56191 56192 return undefined; 56193 } 56194 }); 56195 }; 56196 56197 for (var fnName in deprecatedAPIs) { 56198 if (deprecatedAPIs.hasOwnProperty(fnName)) { 56199 defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); 56200 } 56201 } 56202} 56203 56204function ComponentDummy() {} 56205 56206ComponentDummy.prototype = Component.prototype; 56207/** 56208 * Convenience component with default shallow equality check for sCU. 56209 */ 56210 56211function PureComponent(props, context, updater) { 56212 this.props = props; 56213 this.context = context; // If a component has string refs, we will assign a different object later. 56214 56215 this.refs = emptyObject; 56216 this.updater = updater || ReactNoopUpdateQueue; 56217} 56218 56219var pureComponentPrototype = PureComponent.prototype = new ComponentDummy(); 56220pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods. 56221 56222_assign(pureComponentPrototype, Component.prototype); 56223 56224pureComponentPrototype.isPureReactComponent = true; 56225 56226// an immutable object with a single mutable value 56227function createRef() { 56228 var refObject = { 56229 current: null 56230 }; 56231 56232 { 56233 Object.seal(refObject); 56234 } 56235 56236 return refObject; 56237} 56238 56239var hasOwnProperty = Object.prototype.hasOwnProperty; 56240var RESERVED_PROPS = { 56241 key: true, 56242 ref: true, 56243 __self: true, 56244 __source: true 56245}; 56246var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs; 56247 56248{ 56249 didWarnAboutStringRefs = {}; 56250} 56251 56252function hasValidRef(config) { 56253 { 56254 if (hasOwnProperty.call(config, 'ref')) { 56255 var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; 56256 56257 if (getter && getter.isReactWarning) { 56258 return false; 56259 } 56260 } 56261 } 56262 56263 return config.ref !== undefined; 56264} 56265 56266function hasValidKey(config) { 56267 { 56268 if (hasOwnProperty.call(config, 'key')) { 56269 var getter = Object.getOwnPropertyDescriptor(config, 'key').get; 56270 56271 if (getter && getter.isReactWarning) { 56272 return false; 56273 } 56274 } 56275 } 56276 56277 return config.key !== undefined; 56278} 56279 56280function defineKeyPropWarningGetter(props, displayName) { 56281 var warnAboutAccessingKey = function () { 56282 { 56283 if (!specialPropKeyWarningShown) { 56284 specialPropKeyWarningShown = true; 56285 56286 error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName); 56287 } 56288 } 56289 }; 56290 56291 warnAboutAccessingKey.isReactWarning = true; 56292 Object.defineProperty(props, 'key', { 56293 get: warnAboutAccessingKey, 56294 configurable: true 56295 }); 56296} 56297 56298function defineRefPropWarningGetter(props, displayName) { 56299 var warnAboutAccessingRef = function () { 56300 { 56301 if (!specialPropRefWarningShown) { 56302 specialPropRefWarningShown = true; 56303 56304 error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName); 56305 } 56306 } 56307 }; 56308 56309 warnAboutAccessingRef.isReactWarning = true; 56310 Object.defineProperty(props, 'ref', { 56311 get: warnAboutAccessingRef, 56312 configurable: true 56313 }); 56314} 56315 56316function warnIfStringRefCannotBeAutoConverted(config) { 56317 { 56318 if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) { 56319 var componentName = getComponentName(ReactCurrentOwner.current.type); 56320 56321 if (!didWarnAboutStringRefs[componentName]) { 56322 error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref); 56323 56324 didWarnAboutStringRefs[componentName] = true; 56325 } 56326 } 56327 } 56328} 56329/** 56330 * Factory method to create a new React element. This no longer adheres to 56331 * the class pattern, so do not use new to call it. Also, instanceof check 56332 * will not work. Instead test $$typeof field against Symbol.for('react.element') to check 56333 * if something is a React Element. 56334 * 56335 * @param {*} type 56336 * @param {*} props 56337 * @param {*} key 56338 * @param {string|object} ref 56339 * @param {*} owner 56340 * @param {*} self A *temporary* helper to detect places where `this` is 56341 * different from the `owner` when React.createElement is called, so that we 56342 * can warn. We want to get rid of owner and replace string `ref`s with arrow 56343 * functions, and as long as `this` and owner are the same, there will be no 56344 * change in behavior. 56345 * @param {*} source An annotation object (added by a transpiler or otherwise) 56346 * indicating filename, line number, and/or other information. 56347 * @internal 56348 */ 56349 56350 56351var ReactElement = function (type, key, ref, self, source, owner, props) { 56352 var element = { 56353 // This tag allows us to uniquely identify this as a React Element 56354 $$typeof: REACT_ELEMENT_TYPE, 56355 // Built-in properties that belong on the element 56356 type: type, 56357 key: key, 56358 ref: ref, 56359 props: props, 56360 // Record the component responsible for creating this element. 56361 _owner: owner 56362 }; 56363 56364 { 56365 // The validation flag is currently mutative. We put it on 56366 // an external backing store so that we can freeze the whole object. 56367 // This can be replaced with a WeakMap once they are implemented in 56368 // commonly used development environments. 56369 element._store = {}; // To make comparing ReactElements easier for testing purposes, we make 56370 // the validation flag non-enumerable (where possible, which should 56371 // include every environment we run tests in), so the test framework 56372 // ignores it. 56373 56374 Object.defineProperty(element._store, 'validated', { 56375 configurable: false, 56376 enumerable: false, 56377 writable: true, 56378 value: false 56379 }); // self and source are DEV only properties. 56380 56381 Object.defineProperty(element, '_self', { 56382 configurable: false, 56383 enumerable: false, 56384 writable: false, 56385 value: self 56386 }); // Two elements created in two different places should be considered 56387 // equal for testing purposes and therefore we hide it from enumeration. 56388 56389 Object.defineProperty(element, '_source', { 56390 configurable: false, 56391 enumerable: false, 56392 writable: false, 56393 value: source 56394 }); 56395 56396 if (Object.freeze) { 56397 Object.freeze(element.props); 56398 Object.freeze(element); 56399 } 56400 } 56401 56402 return element; 56403}; 56404/** 56405 * Create and return a new ReactElement of the given type. 56406 * See https://reactjs.org/docs/react-api.html#createelement 56407 */ 56408 56409function createElement(type, config, children) { 56410 var propName; // Reserved names are extracted 56411 56412 var props = {}; 56413 var key = null; 56414 var ref = null; 56415 var self = null; 56416 var source = null; 56417 56418 if (config != null) { 56419 if (hasValidRef(config)) { 56420 ref = config.ref; 56421 56422 { 56423 warnIfStringRefCannotBeAutoConverted(config); 56424 } 56425 } 56426 56427 if (hasValidKey(config)) { 56428 key = '' + config.key; 56429 } 56430 56431 self = config.__self === undefined ? null : config.__self; 56432 source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object 56433 56434 for (propName in config) { 56435 if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { 56436 props[propName] = config[propName]; 56437 } 56438 } 56439 } // Children can be more than one argument, and those are transferred onto 56440 // the newly allocated props object. 56441 56442 56443 var childrenLength = arguments.length - 2; 56444 56445 if (childrenLength === 1) { 56446 props.children = children; 56447 } else if (childrenLength > 1) { 56448 var childArray = Array(childrenLength); 56449 56450 for (var i = 0; i < childrenLength; i++) { 56451 childArray[i] = arguments[i + 2]; 56452 } 56453 56454 { 56455 if (Object.freeze) { 56456 Object.freeze(childArray); 56457 } 56458 } 56459 56460 props.children = childArray; 56461 } // Resolve default props 56462 56463 56464 if (type && type.defaultProps) { 56465 var defaultProps = type.defaultProps; 56466 56467 for (propName in defaultProps) { 56468 if (props[propName] === undefined) { 56469 props[propName] = defaultProps[propName]; 56470 } 56471 } 56472 } 56473 56474 { 56475 if (key || ref) { 56476 var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; 56477 56478 if (key) { 56479 defineKeyPropWarningGetter(props, displayName); 56480 } 56481 56482 if (ref) { 56483 defineRefPropWarningGetter(props, displayName); 56484 } 56485 } 56486 } 56487 56488 return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); 56489} 56490function cloneAndReplaceKey(oldElement, newKey) { 56491 var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); 56492 return newElement; 56493} 56494/** 56495 * Clone and return a new ReactElement using element as the starting point. 56496 * See https://reactjs.org/docs/react-api.html#cloneelement 56497 */ 56498 56499function cloneElement(element, config, children) { 56500 if (!!(element === null || element === undefined)) { 56501 { 56502 throw Error( "React.cloneElement(...): The argument must be a React element, but you passed " + element + "." ); 56503 } 56504 } 56505 56506 var propName; // Original props are copied 56507 56508 var props = _assign({}, element.props); // Reserved names are extracted 56509 56510 56511 var key = element.key; 56512 var ref = element.ref; // Self is preserved since the owner is preserved. 56513 56514 var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a 56515 // transpiler, and the original source is probably a better indicator of the 56516 // true owner. 56517 56518 var source = element._source; // Owner will be preserved, unless ref is overridden 56519 56520 var owner = element._owner; 56521 56522 if (config != null) { 56523 if (hasValidRef(config)) { 56524 // Silently steal the ref from the parent. 56525 ref = config.ref; 56526 owner = ReactCurrentOwner.current; 56527 } 56528 56529 if (hasValidKey(config)) { 56530 key = '' + config.key; 56531 } // Remaining properties override existing props 56532 56533 56534 var defaultProps; 56535 56536 if (element.type && element.type.defaultProps) { 56537 defaultProps = element.type.defaultProps; 56538 } 56539 56540 for (propName in config) { 56541 if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { 56542 if (config[propName] === undefined && defaultProps !== undefined) { 56543 // Resolve default props 56544 props[propName] = defaultProps[propName]; 56545 } else { 56546 props[propName] = config[propName]; 56547 } 56548 } 56549 } 56550 } // Children can be more than one argument, and those are transferred onto 56551 // the newly allocated props object. 56552 56553 56554 var childrenLength = arguments.length - 2; 56555 56556 if (childrenLength === 1) { 56557 props.children = children; 56558 } else if (childrenLength > 1) { 56559 var childArray = Array(childrenLength); 56560 56561 for (var i = 0; i < childrenLength; i++) { 56562 childArray[i] = arguments[i + 2]; 56563 } 56564 56565 props.children = childArray; 56566 } 56567 56568 return ReactElement(element.type, key, ref, self, source, owner, props); 56569} 56570/** 56571 * Verifies the object is a ReactElement. 56572 * See https://reactjs.org/docs/react-api.html#isvalidelement 56573 * @param {?object} object 56574 * @return {boolean} True if `object` is a ReactElement. 56575 * @final 56576 */ 56577 56578function isValidElement(object) { 56579 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; 56580} 56581 56582var SEPARATOR = '.'; 56583var SUBSEPARATOR = ':'; 56584/** 56585 * Escape and wrap key so it is safe to use as a reactid 56586 * 56587 * @param {string} key to be escaped. 56588 * @return {string} the escaped key. 56589 */ 56590 56591function escape(key) { 56592 var escapeRegex = /[=:]/g; 56593 var escaperLookup = { 56594 '=': '=0', 56595 ':': '=2' 56596 }; 56597 var escapedString = ('' + key).replace(escapeRegex, function (match) { 56598 return escaperLookup[match]; 56599 }); 56600 return '$' + escapedString; 56601} 56602/** 56603 * TODO: Test that a single child and an array with one item have the same key 56604 * pattern. 56605 */ 56606 56607 56608var didWarnAboutMaps = false; 56609var userProvidedKeyEscapeRegex = /\/+/g; 56610 56611function escapeUserProvidedKey(text) { 56612 return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/'); 56613} 56614 56615var POOL_SIZE = 10; 56616var traverseContextPool = []; 56617 56618function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) { 56619 if (traverseContextPool.length) { 56620 var traverseContext = traverseContextPool.pop(); 56621 traverseContext.result = mapResult; 56622 traverseContext.keyPrefix = keyPrefix; 56623 traverseContext.func = mapFunction; 56624 traverseContext.context = mapContext; 56625 traverseContext.count = 0; 56626 return traverseContext; 56627 } else { 56628 return { 56629 result: mapResult, 56630 keyPrefix: keyPrefix, 56631 func: mapFunction, 56632 context: mapContext, 56633 count: 0 56634 }; 56635 } 56636} 56637 56638function releaseTraverseContext(traverseContext) { 56639 traverseContext.result = null; 56640 traverseContext.keyPrefix = null; 56641 traverseContext.func = null; 56642 traverseContext.context = null; 56643 traverseContext.count = 0; 56644 56645 if (traverseContextPool.length < POOL_SIZE) { 56646 traverseContextPool.push(traverseContext); 56647 } 56648} 56649/** 56650 * @param {?*} children Children tree container. 56651 * @param {!string} nameSoFar Name of the key path so far. 56652 * @param {!function} callback Callback to invoke with each child found. 56653 * @param {?*} traverseContext Used to pass information throughout the traversal 56654 * process. 56655 * @return {!number} The number of children in this subtree. 56656 */ 56657 56658 56659function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { 56660 var type = typeof children; 56661 56662 if (type === 'undefined' || type === 'boolean') { 56663 // All of the above are perceived as null. 56664 children = null; 56665 } 56666 56667 var invokeCallback = false; 56668 56669 if (children === null) { 56670 invokeCallback = true; 56671 } else { 56672 switch (type) { 56673 case 'string': 56674 case 'number': 56675 invokeCallback = true; 56676 break; 56677 56678 case 'object': 56679 switch (children.$$typeof) { 56680 case REACT_ELEMENT_TYPE: 56681 case REACT_PORTAL_TYPE: 56682 invokeCallback = true; 56683 } 56684 56685 } 56686 } 56687 56688 if (invokeCallback) { 56689 callback(traverseContext, children, // If it's the only child, treat the name as if it was wrapped in an array 56690 // so that it's consistent if the number of children grows. 56691 nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); 56692 return 1; 56693 } 56694 56695 var child; 56696 var nextName; 56697 var subtreeCount = 0; // Count of children found in the current subtree. 56698 56699 var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; 56700 56701 if (Array.isArray(children)) { 56702 for (var i = 0; i < children.length; i++) { 56703 child = children[i]; 56704 nextName = nextNamePrefix + getComponentKey(child, i); 56705 subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); 56706 } 56707 } else { 56708 var iteratorFn = getIteratorFn(children); 56709 56710 if (typeof iteratorFn === 'function') { 56711 56712 { 56713 // Warn about using Maps as children 56714 if (iteratorFn === children.entries) { 56715 if (!didWarnAboutMaps) { 56716 warn('Using Maps as children is deprecated and will be removed in ' + 'a future major release. Consider converting children to ' + 'an array of keyed ReactElements instead.'); 56717 } 56718 56719 didWarnAboutMaps = true; 56720 } 56721 } 56722 56723 var iterator = iteratorFn.call(children); 56724 var step; 56725 var ii = 0; 56726 56727 while (!(step = iterator.next()).done) { 56728 child = step.value; 56729 nextName = nextNamePrefix + getComponentKey(child, ii++); 56730 subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); 56731 } 56732 } else if (type === 'object') { 56733 var addendum = ''; 56734 56735 { 56736 addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum(); 56737 } 56738 56739 var childrenString = '' + children; 56740 56741 { 56742 { 56743 throw Error( "Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + ")." + addendum ); 56744 } 56745 } 56746 } 56747 } 56748 56749 return subtreeCount; 56750} 56751/** 56752 * Traverses children that are typically specified as `props.children`, but 56753 * might also be specified through attributes: 56754 * 56755 * - `traverseAllChildren(this.props.children, ...)` 56756 * - `traverseAllChildren(this.props.leftPanelChildren, ...)` 56757 * 56758 * The `traverseContext` is an optional argument that is passed through the 56759 * entire traversal. It can be used to store accumulations or anything else that 56760 * the callback might find relevant. 56761 * 56762 * @param {?*} children Children tree object. 56763 * @param {!function} callback To invoke upon traversing each child. 56764 * @param {?*} traverseContext Context for traversal. 56765 * @return {!number} The number of children in this subtree. 56766 */ 56767 56768 56769function traverseAllChildren(children, callback, traverseContext) { 56770 if (children == null) { 56771 return 0; 56772 } 56773 56774 return traverseAllChildrenImpl(children, '', callback, traverseContext); 56775} 56776/** 56777 * Generate a key string that identifies a component within a set. 56778 * 56779 * @param {*} component A component that could contain a manual key. 56780 * @param {number} index Index that is used if a manual key is not provided. 56781 * @return {string} 56782 */ 56783 56784 56785function getComponentKey(component, index) { 56786 // Do some typechecking here since we call this blindly. We want to ensure 56787 // that we don't block potential future ES APIs. 56788 if (typeof component === 'object' && component !== null && component.key != null) { 56789 // Explicit key 56790 return escape(component.key); 56791 } // Implicit key determined by the index in the set 56792 56793 56794 return index.toString(36); 56795} 56796 56797function forEachSingleChild(bookKeeping, child, name) { 56798 var func = bookKeeping.func, 56799 context = bookKeeping.context; 56800 func.call(context, child, bookKeeping.count++); 56801} 56802/** 56803 * Iterates through children that are typically specified as `props.children`. 56804 * 56805 * See https://reactjs.org/docs/react-api.html#reactchildrenforeach 56806 * 56807 * The provided forEachFunc(child, index) will be called for each 56808 * leaf child. 56809 * 56810 * @param {?*} children Children tree container. 56811 * @param {function(*, int)} forEachFunc 56812 * @param {*} forEachContext Context for forEachContext. 56813 */ 56814 56815 56816function forEachChildren(children, forEachFunc, forEachContext) { 56817 if (children == null) { 56818 return children; 56819 } 56820 56821 var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext); 56822 traverseAllChildren(children, forEachSingleChild, traverseContext); 56823 releaseTraverseContext(traverseContext); 56824} 56825 56826function mapSingleChildIntoContext(bookKeeping, child, childKey) { 56827 var result = bookKeeping.result, 56828 keyPrefix = bookKeeping.keyPrefix, 56829 func = bookKeeping.func, 56830 context = bookKeeping.context; 56831 var mappedChild = func.call(context, child, bookKeeping.count++); 56832 56833 if (Array.isArray(mappedChild)) { 56834 mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) { 56835 return c; 56836 }); 56837 } else if (mappedChild != null) { 56838 if (isValidElement(mappedChild)) { 56839 mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as 56840 // traverseAllChildren used to do for objects as children 56841 keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey); 56842 } 56843 56844 result.push(mappedChild); 56845 } 56846} 56847 56848function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) { 56849 var escapedPrefix = ''; 56850 56851 if (prefix != null) { 56852 escapedPrefix = escapeUserProvidedKey(prefix) + '/'; 56853 } 56854 56855 var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context); 56856 traverseAllChildren(children, mapSingleChildIntoContext, traverseContext); 56857 releaseTraverseContext(traverseContext); 56858} 56859/** 56860 * Maps children that are typically specified as `props.children`. 56861 * 56862 * See https://reactjs.org/docs/react-api.html#reactchildrenmap 56863 * 56864 * The provided mapFunction(child, key, index) will be called for each 56865 * leaf child. 56866 * 56867 * @param {?*} children Children tree container. 56868 * @param {function(*, int)} func The map function. 56869 * @param {*} context Context for mapFunction. 56870 * @return {object} Object containing the ordered map of results. 56871 */ 56872 56873 56874function mapChildren(children, func, context) { 56875 if (children == null) { 56876 return children; 56877 } 56878 56879 var result = []; 56880 mapIntoWithKeyPrefixInternal(children, result, null, func, context); 56881 return result; 56882} 56883/** 56884 * Count the number of children that are typically specified as 56885 * `props.children`. 56886 * 56887 * See https://reactjs.org/docs/react-api.html#reactchildrencount 56888 * 56889 * @param {?*} children Children tree container. 56890 * @return {number} The number of children. 56891 */ 56892 56893 56894function countChildren(children) { 56895 return traverseAllChildren(children, function () { 56896 return null; 56897 }, null); 56898} 56899/** 56900 * Flatten a children object (typically specified as `props.children`) and 56901 * return an array with appropriately re-keyed children. 56902 * 56903 * See https://reactjs.org/docs/react-api.html#reactchildrentoarray 56904 */ 56905 56906 56907function toArray(children) { 56908 var result = []; 56909 mapIntoWithKeyPrefixInternal(children, result, null, function (child) { 56910 return child; 56911 }); 56912 return result; 56913} 56914/** 56915 * Returns the first child in a collection of children and verifies that there 56916 * is only one child in the collection. 56917 * 56918 * See https://reactjs.org/docs/react-api.html#reactchildrenonly 56919 * 56920 * The current implementation of this function assumes that a single child gets 56921 * passed without a wrapper, but the purpose of this helper function is to 56922 * abstract away the particular structure of children. 56923 * 56924 * @param {?object} children Child collection structure. 56925 * @return {ReactElement} The first and only `ReactElement` contained in the 56926 * structure. 56927 */ 56928 56929 56930function onlyChild(children) { 56931 if (!isValidElement(children)) { 56932 { 56933 throw Error( "React.Children.only expected to receive a single React element child." ); 56934 } 56935 } 56936 56937 return children; 56938} 56939 56940function createContext(defaultValue, calculateChangedBits) { 56941 if (calculateChangedBits === undefined) { 56942 calculateChangedBits = null; 56943 } else { 56944 { 56945 if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') { 56946 error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits); 56947 } 56948 } 56949 } 56950 56951 var context = { 56952 $$typeof: REACT_CONTEXT_TYPE, 56953 _calculateChangedBits: calculateChangedBits, 56954 // As a workaround to support multiple concurrent renderers, we categorize 56955 // some renderers as primary and others as secondary. We only expect 56956 // there to be two concurrent renderers at most: React Native (primary) and 56957 // Fabric (secondary); React DOM (primary) and React ART (secondary). 56958 // Secondary renderers store their context values on separate fields. 56959 _currentValue: defaultValue, 56960 _currentValue2: defaultValue, 56961 // Used to track how many concurrent renderers this context currently 56962 // supports within in a single renderer. Such as parallel server rendering. 56963 _threadCount: 0, 56964 // These are circular 56965 Provider: null, 56966 Consumer: null 56967 }; 56968 context.Provider = { 56969 $$typeof: REACT_PROVIDER_TYPE, 56970 _context: context 56971 }; 56972 var hasWarnedAboutUsingNestedContextConsumers = false; 56973 var hasWarnedAboutUsingConsumerProvider = false; 56974 56975 { 56976 // A separate object, but proxies back to the original context object for 56977 // backwards compatibility. It has a different $$typeof, so we can properly 56978 // warn for the incorrect usage of Context as a Consumer. 56979 var Consumer = { 56980 $$typeof: REACT_CONTEXT_TYPE, 56981 _context: context, 56982 _calculateChangedBits: context._calculateChangedBits 56983 }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here 56984 56985 Object.defineProperties(Consumer, { 56986 Provider: { 56987 get: function () { 56988 if (!hasWarnedAboutUsingConsumerProvider) { 56989 hasWarnedAboutUsingConsumerProvider = true; 56990 56991 error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?'); 56992 } 56993 56994 return context.Provider; 56995 }, 56996 set: function (_Provider) { 56997 context.Provider = _Provider; 56998 } 56999 }, 57000 _currentValue: { 57001 get: function () { 57002 return context._currentValue; 57003 }, 57004 set: function (_currentValue) { 57005 context._currentValue = _currentValue; 57006 } 57007 }, 57008 _currentValue2: { 57009 get: function () { 57010 return context._currentValue2; 57011 }, 57012 set: function (_currentValue2) { 57013 context._currentValue2 = _currentValue2; 57014 } 57015 }, 57016 _threadCount: { 57017 get: function () { 57018 return context._threadCount; 57019 }, 57020 set: function (_threadCount) { 57021 context._threadCount = _threadCount; 57022 } 57023 }, 57024 Consumer: { 57025 get: function () { 57026 if (!hasWarnedAboutUsingNestedContextConsumers) { 57027 hasWarnedAboutUsingNestedContextConsumers = true; 57028 57029 error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?'); 57030 } 57031 57032 return context.Consumer; 57033 } 57034 } 57035 }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty 57036 57037 context.Consumer = Consumer; 57038 } 57039 57040 { 57041 context._currentRenderer = null; 57042 context._currentRenderer2 = null; 57043 } 57044 57045 return context; 57046} 57047 57048function lazy(ctor) { 57049 var lazyType = { 57050 $$typeof: REACT_LAZY_TYPE, 57051 _ctor: ctor, 57052 // React uses these fields to store the result. 57053 _status: -1, 57054 _result: null 57055 }; 57056 57057 { 57058 // In production, this would just set it on the object. 57059 var defaultProps; 57060 var propTypes; 57061 Object.defineProperties(lazyType, { 57062 defaultProps: { 57063 configurable: true, 57064 get: function () { 57065 return defaultProps; 57066 }, 57067 set: function (newDefaultProps) { 57068 error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); 57069 57070 defaultProps = newDefaultProps; // Match production behavior more closely: 57071 57072 Object.defineProperty(lazyType, 'defaultProps', { 57073 enumerable: true 57074 }); 57075 } 57076 }, 57077 propTypes: { 57078 configurable: true, 57079 get: function () { 57080 return propTypes; 57081 }, 57082 set: function (newPropTypes) { 57083 error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); 57084 57085 propTypes = newPropTypes; // Match production behavior more closely: 57086 57087 Object.defineProperty(lazyType, 'propTypes', { 57088 enumerable: true 57089 }); 57090 } 57091 } 57092 }); 57093 } 57094 57095 return lazyType; 57096} 57097 57098function forwardRef(render) { 57099 { 57100 if (render != null && render.$$typeof === REACT_MEMO_TYPE) { 57101 error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).'); 57102 } else if (typeof render !== 'function') { 57103 error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render); 57104 } else { 57105 if (render.length !== 0 && render.length !== 2) { 57106 error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.'); 57107 } 57108 } 57109 57110 if (render != null) { 57111 if (render.defaultProps != null || render.propTypes != null) { 57112 error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?'); 57113 } 57114 } 57115 } 57116 57117 return { 57118 $$typeof: REACT_FORWARD_REF_TYPE, 57119 render: render 57120 }; 57121} 57122 57123function isValidElementType(type) { 57124 return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. 57125 type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); 57126} 57127 57128function memo(type, compare) { 57129 { 57130 if (!isValidElementType(type)) { 57131 error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type); 57132 } 57133 } 57134 57135 return { 57136 $$typeof: REACT_MEMO_TYPE, 57137 type: type, 57138 compare: compare === undefined ? null : compare 57139 }; 57140} 57141 57142function resolveDispatcher() { 57143 var dispatcher = ReactCurrentDispatcher.current; 57144 57145 if (!(dispatcher !== null)) { 57146 { 57147 throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." ); 57148 } 57149 } 57150 57151 return dispatcher; 57152} 57153 57154function useContext(Context, unstable_observedBits) { 57155 var dispatcher = resolveDispatcher(); 57156 57157 { 57158 if (unstable_observedBits !== undefined) { 57159 error('useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://fb.me/rules-of-hooks' : ''); 57160 } // TODO: add a more generic warning for invalid values. 57161 57162 57163 if (Context._context !== undefined) { 57164 var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs 57165 // and nobody should be using this in existing code. 57166 57167 if (realContext.Consumer === Context) { 57168 error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?'); 57169 } else if (realContext.Provider === Context) { 57170 error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?'); 57171 } 57172 } 57173 } 57174 57175 return dispatcher.useContext(Context, unstable_observedBits); 57176} 57177function useState(initialState) { 57178 var dispatcher = resolveDispatcher(); 57179 return dispatcher.useState(initialState); 57180} 57181function useReducer(reducer, initialArg, init) { 57182 var dispatcher = resolveDispatcher(); 57183 return dispatcher.useReducer(reducer, initialArg, init); 57184} 57185function useRef(initialValue) { 57186 var dispatcher = resolveDispatcher(); 57187 return dispatcher.useRef(initialValue); 57188} 57189function useEffect(create, deps) { 57190 var dispatcher = resolveDispatcher(); 57191 return dispatcher.useEffect(create, deps); 57192} 57193function useLayoutEffect(create, deps) { 57194 var dispatcher = resolveDispatcher(); 57195 return dispatcher.useLayoutEffect(create, deps); 57196} 57197function useCallback(callback, deps) { 57198 var dispatcher = resolveDispatcher(); 57199 return dispatcher.useCallback(callback, deps); 57200} 57201function useMemo(create, deps) { 57202 var dispatcher = resolveDispatcher(); 57203 return dispatcher.useMemo(create, deps); 57204} 57205function useImperativeHandle(ref, create, deps) { 57206 var dispatcher = resolveDispatcher(); 57207 return dispatcher.useImperativeHandle(ref, create, deps); 57208} 57209function useDebugValue(value, formatterFn) { 57210 { 57211 var dispatcher = resolveDispatcher(); 57212 return dispatcher.useDebugValue(value, formatterFn); 57213 } 57214} 57215 57216var propTypesMisspellWarningShown; 57217 57218{ 57219 propTypesMisspellWarningShown = false; 57220} 57221 57222function getDeclarationErrorAddendum() { 57223 if (ReactCurrentOwner.current) { 57224 var name = getComponentName(ReactCurrentOwner.current.type); 57225 57226 if (name) { 57227 return '\n\nCheck the render method of `' + name + '`.'; 57228 } 57229 } 57230 57231 return ''; 57232} 57233 57234function getSourceInfoErrorAddendum(source) { 57235 if (source !== undefined) { 57236 var fileName = source.fileName.replace(/^.*[\\\/]/, ''); 57237 var lineNumber = source.lineNumber; 57238 return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'; 57239 } 57240 57241 return ''; 57242} 57243 57244function getSourceInfoErrorAddendumForProps(elementProps) { 57245 if (elementProps !== null && elementProps !== undefined) { 57246 return getSourceInfoErrorAddendum(elementProps.__source); 57247 } 57248 57249 return ''; 57250} 57251/** 57252 * Warn if there's no key explicitly set on dynamic arrays of children or 57253 * object keys are not valid. This allows us to keep track of children between 57254 * updates. 57255 */ 57256 57257 57258var ownerHasKeyUseWarning = {}; 57259 57260function getCurrentComponentErrorInfo(parentType) { 57261 var info = getDeclarationErrorAddendum(); 57262 57263 if (!info) { 57264 var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; 57265 57266 if (parentName) { 57267 info = "\n\nCheck the top-level render call using <" + parentName + ">."; 57268 } 57269 } 57270 57271 return info; 57272} 57273/** 57274 * Warn if the element doesn't have an explicit key assigned to it. 57275 * This element is in an array. The array could grow and shrink or be 57276 * reordered. All children that haven't already been validated are required to 57277 * have a "key" property assigned to it. Error statuses are cached so a warning 57278 * will only be shown once. 57279 * 57280 * @internal 57281 * @param {ReactElement} element Element that requires a key. 57282 * @param {*} parentType element's parent's type. 57283 */ 57284 57285 57286function validateExplicitKey(element, parentType) { 57287 if (!element._store || element._store.validated || element.key != null) { 57288 return; 57289 } 57290 57291 element._store.validated = true; 57292 var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); 57293 57294 if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { 57295 return; 57296 } 57297 57298 ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a 57299 // property, it may be the creator of the child that's responsible for 57300 // assigning it a key. 57301 57302 var childOwner = ''; 57303 57304 if (element && element._owner && element._owner !== ReactCurrentOwner.current) { 57305 // Give the component that originally created this child. 57306 childOwner = " It was passed a child from " + getComponentName(element._owner.type) + "."; 57307 } 57308 57309 setCurrentlyValidatingElement(element); 57310 57311 { 57312 error('Each child in a list should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner); 57313 } 57314 57315 setCurrentlyValidatingElement(null); 57316} 57317/** 57318 * Ensure that every element either is passed in a static location, in an 57319 * array with an explicit keys property defined, or in an object literal 57320 * with valid key property. 57321 * 57322 * @internal 57323 * @param {ReactNode} node Statically passed child of any type. 57324 * @param {*} parentType node's parent's type. 57325 */ 57326 57327 57328function validateChildKeys(node, parentType) { 57329 if (typeof node !== 'object') { 57330 return; 57331 } 57332 57333 if (Array.isArray(node)) { 57334 for (var i = 0; i < node.length; i++) { 57335 var child = node[i]; 57336 57337 if (isValidElement(child)) { 57338 validateExplicitKey(child, parentType); 57339 } 57340 } 57341 } else if (isValidElement(node)) { 57342 // This element was passed in a valid location. 57343 if (node._store) { 57344 node._store.validated = true; 57345 } 57346 } else if (node) { 57347 var iteratorFn = getIteratorFn(node); 57348 57349 if (typeof iteratorFn === 'function') { 57350 // Entry iterators used to provide implicit keys, 57351 // but now we print a separate warning for them later. 57352 if (iteratorFn !== node.entries) { 57353 var iterator = iteratorFn.call(node); 57354 var step; 57355 57356 while (!(step = iterator.next()).done) { 57357 if (isValidElement(step.value)) { 57358 validateExplicitKey(step.value, parentType); 57359 } 57360 } 57361 } 57362 } 57363 } 57364} 57365/** 57366 * Given an element, validate that its props follow the propTypes definition, 57367 * provided by the type. 57368 * 57369 * @param {ReactElement} element 57370 */ 57371 57372 57373function validatePropTypes(element) { 57374 { 57375 var type = element.type; 57376 57377 if (type === null || type === undefined || typeof type === 'string') { 57378 return; 57379 } 57380 57381 var name = getComponentName(type); 57382 var propTypes; 57383 57384 if (typeof type === 'function') { 57385 propTypes = type.propTypes; 57386 } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here. 57387 // Inner props are checked in the reconciler. 57388 type.$$typeof === REACT_MEMO_TYPE)) { 57389 propTypes = type.propTypes; 57390 } else { 57391 return; 57392 } 57393 57394 if (propTypes) { 57395 setCurrentlyValidatingElement(element); 57396 checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum); 57397 setCurrentlyValidatingElement(null); 57398 } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) { 57399 propTypesMisspellWarningShown = true; 57400 57401 error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown'); 57402 } 57403 57404 if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) { 57405 error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.'); 57406 } 57407 } 57408} 57409/** 57410 * Given a fragment, validate that it can only be provided with fragment props 57411 * @param {ReactElement} fragment 57412 */ 57413 57414 57415function validateFragmentProps(fragment) { 57416 { 57417 setCurrentlyValidatingElement(fragment); 57418 var keys = Object.keys(fragment.props); 57419 57420 for (var i = 0; i < keys.length; i++) { 57421 var key = keys[i]; 57422 57423 if (key !== 'children' && key !== 'key') { 57424 error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); 57425 57426 break; 57427 } 57428 } 57429 57430 if (fragment.ref !== null) { 57431 error('Invalid attribute `ref` supplied to `React.Fragment`.'); 57432 } 57433 57434 setCurrentlyValidatingElement(null); 57435 } 57436} 57437function createElementWithValidation(type, props, children) { 57438 var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to 57439 // succeed and there will likely be errors in render. 57440 57441 if (!validType) { 57442 var info = ''; 57443 57444 if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { 57445 info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; 57446 } 57447 57448 var sourceInfo = getSourceInfoErrorAddendumForProps(props); 57449 57450 if (sourceInfo) { 57451 info += sourceInfo; 57452 } else { 57453 info += getDeclarationErrorAddendum(); 57454 } 57455 57456 var typeString; 57457 57458 if (type === null) { 57459 typeString = 'null'; 57460 } else if (Array.isArray(type)) { 57461 typeString = 'array'; 57462 } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { 57463 typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />"; 57464 info = ' Did you accidentally export a JSX literal instead of a component?'; 57465 } else { 57466 typeString = typeof type; 57467 } 57468 57469 { 57470 error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info); 57471 } 57472 } 57473 57474 var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used. 57475 // TODO: Drop this when these are no longer allowed as the type argument. 57476 57477 if (element == null) { 57478 return element; 57479 } // Skip key warning if the type isn't valid since our key validation logic 57480 // doesn't expect a non-string/function type and can throw confusing errors. 57481 // We don't want exception behavior to differ between dev and prod. 57482 // (Rendering will throw with a helpful message and as soon as the type is 57483 // fixed, the key warnings will appear.) 57484 57485 57486 if (validType) { 57487 for (var i = 2; i < arguments.length; i++) { 57488 validateChildKeys(arguments[i], type); 57489 } 57490 } 57491 57492 if (type === REACT_FRAGMENT_TYPE) { 57493 validateFragmentProps(element); 57494 } else { 57495 validatePropTypes(element); 57496 } 57497 57498 return element; 57499} 57500var didWarnAboutDeprecatedCreateFactory = false; 57501function createFactoryWithValidation(type) { 57502 var validatedFactory = createElementWithValidation.bind(null, type); 57503 validatedFactory.type = type; 57504 57505 { 57506 if (!didWarnAboutDeprecatedCreateFactory) { 57507 didWarnAboutDeprecatedCreateFactory = true; 57508 57509 warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.'); 57510 } // Legacy hook: remove it 57511 57512 57513 Object.defineProperty(validatedFactory, 'type', { 57514 enumerable: false, 57515 get: function () { 57516 warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.'); 57517 57518 Object.defineProperty(this, 'type', { 57519 value: type 57520 }); 57521 return type; 57522 } 57523 }); 57524 } 57525 57526 return validatedFactory; 57527} 57528function cloneElementWithValidation(element, props, children) { 57529 var newElement = cloneElement.apply(this, arguments); 57530 57531 for (var i = 2; i < arguments.length; i++) { 57532 validateChildKeys(arguments[i], newElement.type); 57533 } 57534 57535 validatePropTypes(newElement); 57536 return newElement; 57537} 57538 57539{ 57540 57541 try { 57542 var frozenObject = Object.freeze({}); 57543 var testMap = new Map([[frozenObject, null]]); 57544 var testSet = new Set([frozenObject]); // This is necessary for Rollup to not consider these unused. 57545 // https://github.com/rollup/rollup/issues/1771 57546 // TODO: we can remove these if Rollup fixes the bug. 57547 57548 testMap.set(0, 0); 57549 testSet.add(0); 57550 } catch (e) { 57551 } 57552} 57553 57554var createElement$1 = createElementWithValidation ; 57555var cloneElement$1 = cloneElementWithValidation ; 57556var createFactory = createFactoryWithValidation ; 57557var Children = { 57558 map: mapChildren, 57559 forEach: forEachChildren, 57560 count: countChildren, 57561 toArray: toArray, 57562 only: onlyChild 57563}; 57564 57565exports.Children = Children; 57566exports.Component = Component; 57567exports.Fragment = REACT_FRAGMENT_TYPE; 57568exports.Profiler = REACT_PROFILER_TYPE; 57569exports.PureComponent = PureComponent; 57570exports.StrictMode = REACT_STRICT_MODE_TYPE; 57571exports.Suspense = REACT_SUSPENSE_TYPE; 57572exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals; 57573exports.cloneElement = cloneElement$1; 57574exports.createContext = createContext; 57575exports.createElement = createElement$1; 57576exports.createFactory = createFactory; 57577exports.createRef = createRef; 57578exports.forwardRef = forwardRef; 57579exports.isValidElement = isValidElement; 57580exports.lazy = lazy; 57581exports.memo = memo; 57582exports.useCallback = useCallback; 57583exports.useContext = useContext; 57584exports.useDebugValue = useDebugValue; 57585exports.useEffect = useEffect; 57586exports.useImperativeHandle = useImperativeHandle; 57587exports.useLayoutEffect = useLayoutEffect; 57588exports.useMemo = useMemo; 57589exports.useReducer = useReducer; 57590exports.useRef = useRef; 57591exports.useState = useState; 57592exports.version = ReactVersion; 57593 })(); 57594} 57595 57596 57597/***/ }), 57598
vendor: 443 bytes, lines 57599-57615
57599/***/ "./node_modules/react/index.js": 57600/*!*************************************!*\ 57601 !*** ./node_modules/react/index.js ***! 57602 \*************************************/ 57603/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 57604 57605"use strict"; 57606 57607 57608if (false) // removed by dead control flow 57609{} else { 57610 module.exports = __webpack_require__(/*! ./cjs/react.development.js */ "./node_modules/react/cjs/react.development.js"); 57611} 57612 57613 57614/***/ }), 57615
vendor: 9,327 bytes, lines 57616-57975
57616/***/ "./node_modules/scheduler/cjs/scheduler-tracing.development.js": 57617/*!*********************************************************************!*\ 57618 !*** ./node_modules/scheduler/cjs/scheduler-tracing.development.js ***! 57619 \*********************************************************************/ 57620/***/ ((__unused_webpack_module, exports) => { 57621 57622"use strict"; 57623/** @license React v0.19.1 57624 * scheduler-tracing.development.js 57625 * 57626 * Copyright (c) Facebook, Inc. and its affiliates. 57627 * 57628 * This source code is licensed under the MIT license found in the 57629 * LICENSE file in the root directory of this source tree. 57630 */ 57631 57632 57633 57634 57635 57636if (true) { 57637 (function() { 57638'use strict'; 57639 57640var DEFAULT_THREAD_ID = 0; // Counters used to generate unique IDs. 57641 57642var interactionIDCounter = 0; 57643var threadIDCounter = 0; // Set of currently traced interactions. 57644// Interactions "stack"â 57645// Meaning that newly traced interactions are appended to the previously active set. 57646// When an interaction goes out of scope, the previous set (if any) is restored. 57647 57648exports.__interactionsRef = null; // Listener(s) to notify when interactions begin and end. 57649 57650exports.__subscriberRef = null; 57651 57652{ 57653 exports.__interactionsRef = { 57654 current: new Set() 57655 }; 57656 exports.__subscriberRef = { 57657 current: null 57658 }; 57659} 57660function unstable_clear(callback) { 57661 57662 var prevInteractions = exports.__interactionsRef.current; 57663 exports.__interactionsRef.current = new Set(); 57664 57665 try { 57666 return callback(); 57667 } finally { 57668 exports.__interactionsRef.current = prevInteractions; 57669 } 57670} 57671function unstable_getCurrent() { 57672 { 57673 return exports.__interactionsRef.current; 57674 } 57675} 57676function unstable_getThreadID() { 57677 return ++threadIDCounter; 57678} 57679function unstable_trace(name, timestamp, callback) { 57680 var threadID = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THREAD_ID; 57681 57682 var interaction = { 57683 __count: 1, 57684 id: interactionIDCounter++, 57685 name: name, 57686 timestamp: timestamp 57687 }; 57688 var prevInteractions = exports.__interactionsRef.current; // Traced interactions should stack/accumulate. 57689 // To do that, clone the current interactions. 57690 // The previous set will be restored upon completion. 57691 57692 var interactions = new Set(prevInteractions); 57693 interactions.add(interaction); 57694 exports.__interactionsRef.current = interactions; 57695 var subscriber = exports.__subscriberRef.current; 57696 var returnValue; 57697 57698 try { 57699 if (subscriber !== null) { 57700 subscriber.onInteractionTraced(interaction); 57701 } 57702 } finally { 57703 try { 57704 if (subscriber !== null) { 57705 subscriber.onWorkStarted(interactions, threadID); 57706 } 57707 } finally { 57708 try { 57709 returnValue = callback(); 57710 } finally { 57711 exports.__interactionsRef.current = prevInteractions; 57712 57713 try { 57714 if (subscriber !== null) { 57715 subscriber.onWorkStopped(interactions, threadID); 57716 } 57717 } finally { 57718 interaction.__count--; // If no async work was scheduled for this interaction, 57719 // Notify subscribers that it's completed. 57720 57721 if (subscriber !== null && interaction.__count === 0) { 57722 subscriber.onInteractionScheduledWorkCompleted(interaction); 57723 } 57724 } 57725 } 57726 } 57727 } 57728 57729 return returnValue; 57730} 57731function unstable_wrap(callback) { 57732 var threadID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_THREAD_ID; 57733 57734 var wrappedInteractions = exports.__interactionsRef.current; 57735 var subscriber = exports.__subscriberRef.current; 57736 57737 if (subscriber !== null) { 57738 subscriber.onWorkScheduled(wrappedInteractions, threadID); 57739 } // Update the pending async work count for the current interactions. 57740 // Update after calling subscribers in case of error. 57741 57742 57743 wrappedInteractions.forEach(function (interaction) { 57744 interaction.__count++; 57745 }); 57746 var hasRun = false; 57747 57748 function wrapped() { 57749 var prevInteractions = exports.__interactionsRef.current; 57750 exports.__interactionsRef.current = wrappedInteractions; 57751 subscriber = exports.__subscriberRef.current; 57752 57753 try { 57754 var returnValue; 57755 57756 try { 57757 if (subscriber !== null) { 57758 subscriber.onWorkStarted(wrappedInteractions, threadID); 57759 } 57760 } finally { 57761 try { 57762 returnValue = callback.apply(undefined, arguments); 57763 } finally { 57764 exports.__interactionsRef.current = prevInteractions; 57765 57766 if (subscriber !== null) { 57767 subscriber.onWorkStopped(wrappedInteractions, threadID); 57768 } 57769 } 57770 } 57771 57772 return returnValue; 57773 } finally { 57774 if (!hasRun) { 57775 // We only expect a wrapped function to be executed once, 57776 // But in the event that it's executed more than onceâ 57777 // Only decrement the outstanding interaction counts once. 57778 hasRun = true; // Update pending async counts for all wrapped interactions. 57779 // If this was the last scheduled async work for any of them, 57780 // Mark them as completed. 57781 57782 wrappedInteractions.forEach(function (interaction) { 57783 interaction.__count--; 57784 57785 if (subscriber !== null && interaction.__count === 0) { 57786 subscriber.onInteractionScheduledWorkCompleted(interaction); 57787 } 57788 }); 57789 } 57790 } 57791 } 57792 57793 wrapped.cancel = function cancel() { 57794 subscriber = exports.__subscriberRef.current; 57795 57796 try { 57797 if (subscriber !== null) { 57798 subscriber.onWorkCanceled(wrappedInteractions, threadID); 57799 } 57800 } finally { 57801 // Update pending async counts for all wrapped interactions. 57802 // If this was the last scheduled async work for any of them, 57803 // Mark them as completed. 57804 wrappedInteractions.forEach(function (interaction) { 57805 interaction.__count--; 57806 57807 if (subscriber && interaction.__count === 0) { 57808 subscriber.onInteractionScheduledWorkCompleted(interaction); 57809 } 57810 }); 57811 } 57812 }; 57813 57814 return wrapped; 57815} 57816 57817var subscribers = null; 57818 57819{ 57820 subscribers = new Set(); 57821} 57822 57823function unstable_subscribe(subscriber) { 57824 { 57825 subscribers.add(subscriber); 57826 57827 if (subscribers.size === 1) { 57828 exports.__subscriberRef.current = { 57829 onInteractionScheduledWorkCompleted: onInteractionScheduledWorkCompleted, 57830 onInteractionTraced: onInteractionTraced, 57831 onWorkCanceled: onWorkCanceled, 57832 onWorkScheduled: onWorkScheduled, 57833 onWorkStarted: onWorkStarted, 57834 onWorkStopped: onWorkStopped 57835 }; 57836 } 57837 } 57838} 57839function unstable_unsubscribe(subscriber) { 57840 { 57841 subscribers.delete(subscriber); 57842 57843 if (subscribers.size === 0) { 57844 exports.__subscriberRef.current = null; 57845 } 57846 } 57847} 57848 57849function onInteractionTraced(interaction) { 57850 var didCatchError = false; 57851 var caughtError = null; 57852 subscribers.forEach(function (subscriber) { 57853 try { 57854 subscriber.onInteractionTraced(interaction); 57855 } catch (error) { 57856 if (!didCatchError) { 57857 didCatchError = true; 57858 caughtError = error; 57859 } 57860 } 57861 }); 57862 57863 if (didCatchError) { 57864 throw caughtError; 57865 } 57866} 57867 57868function onInteractionScheduledWorkCompleted(interaction) { 57869 var didCatchError = false; 57870 var caughtError = null; 57871 subscribers.forEach(function (subscriber) { 57872 try { 57873 subscriber.onInteractionScheduledWorkCompleted(interaction); 57874 } catch (error) { 57875 if (!didCatchError) { 57876 didCatchError = true; 57877 caughtError = error; 57878 } 57879 } 57880 }); 57881 57882 if (didCatchError) { 57883 throw caughtError; 57884 } 57885} 57886 57887function onWorkScheduled(interactions, threadID) { 57888 var didCatchError = false; 57889 var caughtError = null; 57890 subscribers.forEach(function (subscriber) { 57891 try { 57892 subscriber.onWorkScheduled(interactions, threadID); 57893 } catch (error) { 57894 if (!didCatchError) { 57895 didCatchError = true; 57896 caughtError = error; 57897 } 57898 } 57899 }); 57900 57901 if (didCatchError) { 57902 throw caughtError; 57903 } 57904} 57905 57906function onWorkStarted(interactions, threadID) { 57907 var didCatchError = false; 57908 var caughtError = null; 57909 subscribers.forEach(function (subscriber) { 57910 try { 57911 subscriber.onWorkStarted(interactions, threadID); 57912 } catch (error) { 57913 if (!didCatchError) { 57914 didCatchError = true; 57915 caughtError = error; 57916 } 57917 } 57918 }); 57919 57920 if (didCatchError) { 57921 throw caughtError; 57922 } 57923} 57924 57925function onWorkStopped(interactions, threadID) { 57926 var didCatchError = false; 57927 var caughtError = null; 57928 subscribers.forEach(function (subscriber) { 57929 try { 57930 subscriber.onWorkStopped(interactions, threadID); 57931 } catch (error) { 57932 if (!didCatchError) { 57933 didCatchError = true; 57934 caughtError = error; 57935 } 57936 } 57937 }); 57938 57939 if (didCatchError) { 57940 throw caughtError; 57941 } 57942} 57943 57944function onWorkCanceled(interactions, threadID) { 57945 var didCatchError = false; 57946 var caughtError = null; 57947 subscribers.forEach(function (subscriber) { 57948 try { 57949 subscriber.onWorkCanceled(interactions, threadID); 57950 } catch (error) { 57951 if (!didCatchError) { 57952 didCatchError = true; 57953 caughtError = error; 57954 } 57955 } 57956 }); 57957 57958 if (didCatchError) { 57959 throw caughtError; 57960 } 57961} 57962 57963exports.unstable_clear = unstable_clear; 57964exports.unstable_getCurrent = unstable_getCurrent; 57965exports.unstable_getThreadID = unstable_getThreadID; 57966exports.unstable_subscribe = unstable_subscribe; 57967exports.unstable_trace = unstable_trace; 57968exports.unstable_unsubscribe = unstable_unsubscribe; 57969exports.unstable_wrap = unstable_wrap; 57970 })(); 57971} 57972 57973 57974/***/ }), 57975
vendor: 24,054 bytes, lines 57976-58844
57976/***/ "./node_modules/scheduler/cjs/scheduler.development.js": 57977/*!*************************************************************!*\ 57978 !*** ./node_modules/scheduler/cjs/scheduler.development.js ***! 57979 \*************************************************************/ 57980/***/ ((__unused_webpack_module, exports) => { 57981 57982"use strict"; 57983/** @license React v0.19.1 57984 * scheduler.development.js 57985 * 57986 * Copyright (c) Facebook, Inc. and its affiliates. 57987 * 57988 * This source code is licensed under the MIT license found in the 57989 * LICENSE file in the root directory of this source tree. 57990 */ 57991 57992 57993 57994 57995 57996if (true) { 57997 (function() { 57998'use strict'; 57999 58000var enableSchedulerDebugging = false; 58001var enableProfiling = true; 58002 58003var requestHostCallback; 58004var requestHostTimeout; 58005var cancelHostTimeout; 58006var shouldYieldToHost; 58007var requestPaint; 58008 58009if ( // If Scheduler runs in a non-DOM environment, it falls back to a naive 58010// implementation using setTimeout. 58011typeof window === 'undefined' || // Check if MessageChannel is supported, too. 58012typeof MessageChannel !== 'function') { 58013 // If this accidentally gets imported in a non-browser environment, e.g. JavaScriptCore, 58014 // fallback to a naive implementation. 58015 var _callback = null; 58016 var _timeoutID = null; 58017 58018 var _flushCallback = function () { 58019 if (_callback !== null) { 58020 try { 58021 var currentTime = exports.unstable_now(); 58022 var hasRemainingTime = true; 58023 58024 _callback(hasRemainingTime, currentTime); 58025 58026 _callback = null; 58027 } catch (e) { 58028 setTimeout(_flushCallback, 0); 58029 throw e; 58030 } 58031 } 58032 }; 58033 58034 var initialTime = Date.now(); 58035 58036 exports.unstable_now = function () { 58037 return Date.now() - initialTime; 58038 }; 58039 58040 requestHostCallback = function (cb) { 58041 if (_callback !== null) { 58042 // Protect against re-entrancy. 58043 setTimeout(requestHostCallback, 0, cb); 58044 } else { 58045 _callback = cb; 58046 setTimeout(_flushCallback, 0); 58047 } 58048 }; 58049 58050 requestHostTimeout = function (cb, ms) { 58051 _timeoutID = setTimeout(cb, ms); 58052 }; 58053 58054 cancelHostTimeout = function () { 58055 clearTimeout(_timeoutID); 58056 }; 58057 58058 shouldYieldToHost = function () { 58059 return false; 58060 }; 58061 58062 requestPaint = exports.unstable_forceFrameRate = function () {}; 58063} else { 58064 // Capture local references to native APIs, in case a polyfill overrides them. 58065 var performance = window.performance; 58066 var _Date = window.Date; 58067 var _setTimeout = window.setTimeout; 58068 var _clearTimeout = window.clearTimeout; 58069 58070 if (typeof console !== 'undefined') { 58071 // TODO: Scheduler no longer requires these methods to be polyfilled. But 58072 // maybe we want to continue warning if they don't exist, to preserve the 58073 // option to rely on it in the future? 58074 var requestAnimationFrame = window.requestAnimationFrame; 58075 var cancelAnimationFrame = window.cancelAnimationFrame; // TODO: Remove fb.me link 58076 58077 if (typeof requestAnimationFrame !== 'function') { 58078 // Using console['error'] to evade Babel and ESLint 58079 console['error']("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills'); 58080 } 58081 58082 if (typeof cancelAnimationFrame !== 'function') { 58083 // Using console['error'] to evade Babel and ESLint 58084 console['error']("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills'); 58085 } 58086 } 58087 58088 if (typeof performance === 'object' && typeof performance.now === 'function') { 58089 exports.unstable_now = function () { 58090 return performance.now(); 58091 }; 58092 } else { 58093 var _initialTime = _Date.now(); 58094 58095 exports.unstable_now = function () { 58096 return _Date.now() - _initialTime; 58097 }; 58098 } 58099 58100 var isMessageLoopRunning = false; 58101 var scheduledHostCallback = null; 58102 var taskTimeoutID = -1; // Scheduler periodically yields in case there is other work on the main 58103 // thread, like user events. By default, it yields multiple times per frame. 58104 // It does not attempt to align with frame boundaries, since most tasks don't 58105 // need to be frame aligned; for those that do, use requestAnimationFrame. 58106 58107 var yieldInterval = 5; 58108 var deadline = 0; // TODO: Make this configurable 58109 58110 { 58111 // `isInputPending` is not available. Since we have no way of knowing if 58112 // there's pending input, always yield at the end of the frame. 58113 shouldYieldToHost = function () { 58114 return exports.unstable_now() >= deadline; 58115 }; // Since we yield every frame regardless, `requestPaint` has no effect. 58116 58117 58118 requestPaint = function () {}; 58119 } 58120 58121 exports.unstable_forceFrameRate = function (fps) { 58122 if (fps < 0 || fps > 125) { 58123 // Using console['error'] to evade Babel and ESLint 58124 console['error']('forceFrameRate takes a positive int between 0 and 125, ' + 'forcing framerates higher than 125 fps is not unsupported'); 58125 return; 58126 } 58127 58128 if (fps > 0) { 58129 yieldInterval = Math.floor(1000 / fps); 58130 } else { 58131 // reset the framerate 58132 yieldInterval = 5; 58133 } 58134 }; 58135 58136 var performWorkUntilDeadline = function () { 58137 if (scheduledHostCallback !== null) { 58138 var currentTime = exports.unstable_now(); // Yield after `yieldInterval` ms, regardless of where we are in the vsync 58139 // cycle. This means there's always time remaining at the beginning of 58140 // the message event. 58141 58142 deadline = currentTime + yieldInterval; 58143 var hasTimeRemaining = true; 58144 58145 try { 58146 var hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime); 58147 58148 if (!hasMoreWork) { 58149 isMessageLoopRunning = false; 58150 scheduledHostCallback = null; 58151 } else { 58152 // If there's more work, schedule the next message event at the end 58153 // of the preceding one. 58154 port.postMessage(null); 58155 } 58156 } catch (error) { 58157 // If a scheduler task throws, exit the current browser task so the 58158 // error can be observed. 58159 port.postMessage(null); 58160 throw error; 58161 } 58162 } else { 58163 isMessageLoopRunning = false; 58164 } // Yielding to the browser will give it a chance to paint, so we can 58165 }; 58166 58167 var channel = new MessageChannel(); 58168 var port = channel.port2; 58169 channel.port1.onmessage = performWorkUntilDeadline; 58170 58171 requestHostCallback = function (callback) { 58172 scheduledHostCallback = callback; 58173 58174 if (!isMessageLoopRunning) { 58175 isMessageLoopRunning = true; 58176 port.postMessage(null); 58177 } 58178 }; 58179 58180 requestHostTimeout = function (callback, ms) { 58181 taskTimeoutID = _setTimeout(function () { 58182 callback(exports.unstable_now()); 58183 }, ms); 58184 }; 58185 58186 cancelHostTimeout = function () { 58187 _clearTimeout(taskTimeoutID); 58188 58189 taskTimeoutID = -1; 58190 }; 58191} 58192 58193function push(heap, node) { 58194 var index = heap.length; 58195 heap.push(node); 58196 siftUp(heap, node, index); 58197} 58198function peek(heap) { 58199 var first = heap[0]; 58200 return first === undefined ? null : first; 58201} 58202function pop(heap) { 58203 var first = heap[0]; 58204 58205 if (first !== undefined) { 58206 var last = heap.pop(); 58207 58208 if (last !== first) { 58209 heap[0] = last; 58210 siftDown(heap, last, 0); 58211 } 58212 58213 return first; 58214 } else { 58215 return null; 58216 } 58217} 58218 58219function siftUp(heap, node, i) { 58220 var index = i; 58221 58222 while (true) { 58223 var parentIndex = index - 1 >>> 1; 58224 var parent = heap[parentIndex]; 58225 58226 if (parent !== undefined && compare(parent, node) > 0) { 58227 // The parent is larger. Swap positions. 58228 heap[parentIndex] = node; 58229 heap[index] = parent; 58230 index = parentIndex; 58231 } else { 58232 // The parent is smaller. Exit. 58233 return; 58234 } 58235 } 58236} 58237 58238function siftDown(heap, node, i) { 58239 var index = i; 58240 var length = heap.length; 58241 58242 while (index < length) { 58243 var leftIndex = (index + 1) * 2 - 1; 58244 var left = heap[leftIndex]; 58245 var rightIndex = leftIndex + 1; 58246 var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those. 58247 58248 if (left !== undefined && compare(left, node) < 0) { 58249 if (right !== undefined && compare(right, left) < 0) { 58250 heap[index] = right; 58251 heap[rightIndex] = node; 58252 index = rightIndex; 58253 } else { 58254 heap[index] = left; 58255 heap[leftIndex] = node; 58256 index = leftIndex; 58257 } 58258 } else if (right !== undefined && compare(right, node) < 0) { 58259 heap[index] = right; 58260 heap[rightIndex] = node; 58261 index = rightIndex; 58262 } else { 58263 // Neither child is smaller. Exit. 58264 return; 58265 } 58266 } 58267} 58268 58269function compare(a, b) { 58270 // Compare sort index first, then task id. 58271 var diff = a.sortIndex - b.sortIndex; 58272 return diff !== 0 ? diff : a.id - b.id; 58273} 58274 58275// TODO: Use symbols? 58276var NoPriority = 0; 58277var ImmediatePriority = 1; 58278var UserBlockingPriority = 2; 58279var NormalPriority = 3; 58280var LowPriority = 4; 58281var IdlePriority = 5; 58282 58283var runIdCounter = 0; 58284var mainThreadIdCounter = 0; 58285var profilingStateSize = 4; 58286var sharedProfilingBuffer = // $FlowFixMe Flow doesn't know about SharedArrayBuffer 58287typeof SharedArrayBuffer === 'function' ? new SharedArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : // $FlowFixMe Flow doesn't know about ArrayBuffer 58288typeof ArrayBuffer === 'function' ? new ArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : null // Don't crash the init path on IE9 58289; 58290var profilingState = sharedProfilingBuffer !== null ? new Int32Array(sharedProfilingBuffer) : []; // We can't read this but it helps save bytes for null checks 58291 58292var PRIORITY = 0; 58293var CURRENT_TASK_ID = 1; 58294var CURRENT_RUN_ID = 2; 58295var QUEUE_SIZE = 3; 58296 58297{ 58298 profilingState[PRIORITY] = NoPriority; // This is maintained with a counter, because the size of the priority queue 58299 // array might include canceled tasks. 58300 58301 profilingState[QUEUE_SIZE] = 0; 58302 profilingState[CURRENT_TASK_ID] = 0; 58303} // Bytes per element is 4 58304 58305 58306var INITIAL_EVENT_LOG_SIZE = 131072; 58307var MAX_EVENT_LOG_SIZE = 524288; // Equivalent to 2 megabytes 58308 58309var eventLogSize = 0; 58310var eventLogBuffer = null; 58311var eventLog = null; 58312var eventLogIndex = 0; 58313var TaskStartEvent = 1; 58314var TaskCompleteEvent = 2; 58315var TaskErrorEvent = 3; 58316var TaskCancelEvent = 4; 58317var TaskRunEvent = 5; 58318var TaskYieldEvent = 6; 58319var SchedulerSuspendEvent = 7; 58320var SchedulerResumeEvent = 8; 58321 58322function logEvent(entries) { 58323 if (eventLog !== null) { 58324 var offset = eventLogIndex; 58325 eventLogIndex += entries.length; 58326 58327 if (eventLogIndex + 1 > eventLogSize) { 58328 eventLogSize *= 2; 58329 58330 if (eventLogSize > MAX_EVENT_LOG_SIZE) { 58331 // Using console['error'] to evade Babel and ESLint 58332 console['error']("Scheduler Profiling: Event log exceeded maximum size. Don't " + 'forget to call `stopLoggingProfilingEvents()`.'); 58333 stopLoggingProfilingEvents(); 58334 return; 58335 } 58336 58337 var newEventLog = new Int32Array(eventLogSize * 4); 58338 newEventLog.set(eventLog); 58339 eventLogBuffer = newEventLog.buffer; 58340 eventLog = newEventLog; 58341 } 58342 58343 eventLog.set(entries, offset); 58344 } 58345} 58346 58347function startLoggingProfilingEvents() { 58348 eventLogSize = INITIAL_EVENT_LOG_SIZE; 58349 eventLogBuffer = new ArrayBuffer(eventLogSize * 4); 58350 eventLog = new Int32Array(eventLogBuffer); 58351 eventLogIndex = 0; 58352} 58353function stopLoggingProfilingEvents() { 58354 var buffer = eventLogBuffer; 58355 eventLogSize = 0; 58356 eventLogBuffer = null; 58357 eventLog = null; 58358 eventLogIndex = 0; 58359 return buffer; 58360} 58361function markTaskStart(task, ms) { 58362 { 58363 profilingState[QUEUE_SIZE]++; 58364 58365 if (eventLog !== null) { 58366 // performance.now returns a float, representing milliseconds. When the 58367 // event is logged, it's coerced to an int. Convert to microseconds to 58368 // maintain extra degrees of precision. 58369 logEvent([TaskStartEvent, ms * 1000, task.id, task.priorityLevel]); 58370 } 58371 } 58372} 58373function markTaskCompleted(task, ms) { 58374 { 58375 profilingState[PRIORITY] = NoPriority; 58376 profilingState[CURRENT_TASK_ID] = 0; 58377 profilingState[QUEUE_SIZE]--; 58378 58379 if (eventLog !== null) { 58380 logEvent([TaskCompleteEvent, ms * 1000, task.id]); 58381 } 58382 } 58383} 58384function markTaskCanceled(task, ms) { 58385 { 58386 profilingState[QUEUE_SIZE]--; 58387 58388 if (eventLog !== null) { 58389 logEvent([TaskCancelEvent, ms * 1000, task.id]); 58390 } 58391 } 58392} 58393function markTaskErrored(task, ms) { 58394 { 58395 profilingState[PRIORITY] = NoPriority; 58396 profilingState[CURRENT_TASK_ID] = 0; 58397 profilingState[QUEUE_SIZE]--; 58398 58399 if (eventLog !== null) { 58400 logEvent([TaskErrorEvent, ms * 1000, task.id]); 58401 } 58402 } 58403} 58404function markTaskRun(task, ms) { 58405 { 58406 runIdCounter++; 58407 profilingState[PRIORITY] = task.priorityLevel; 58408 profilingState[CURRENT_TASK_ID] = task.id; 58409 profilingState[CURRENT_RUN_ID] = runIdCounter; 58410 58411 if (eventLog !== null) { 58412 logEvent([TaskRunEvent, ms * 1000, task.id, runIdCounter]); 58413 } 58414 } 58415} 58416function markTaskYield(task, ms) { 58417 { 58418 profilingState[PRIORITY] = NoPriority; 58419 profilingState[CURRENT_TASK_ID] = 0; 58420 profilingState[CURRENT_RUN_ID] = 0; 58421 58422 if (eventLog !== null) { 58423 logEvent([TaskYieldEvent, ms * 1000, task.id, runIdCounter]); 58424 } 58425 } 58426} 58427function markSchedulerSuspended(ms) { 58428 { 58429 mainThreadIdCounter++; 58430 58431 if (eventLog !== null) { 58432 logEvent([SchedulerSuspendEvent, ms * 1000, mainThreadIdCounter]); 58433 } 58434 } 58435} 58436function markSchedulerUnsuspended(ms) { 58437 { 58438 if (eventLog !== null) { 58439 logEvent([SchedulerResumeEvent, ms * 1000, mainThreadIdCounter]); 58440 } 58441 } 58442} 58443 58444/* eslint-disable no-var */ 58445// Math.pow(2, 30) - 1 58446// 0b111111111111111111111111111111 58447 58448var maxSigned31BitInt = 1073741823; // Times out immediately 58449 58450var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out 58451 58452var USER_BLOCKING_PRIORITY = 250; 58453var NORMAL_PRIORITY_TIMEOUT = 5000; 58454var LOW_PRIORITY_TIMEOUT = 10000; // Never times out 58455 58456var IDLE_PRIORITY = maxSigned31BitInt; // Tasks are stored on a min heap 58457 58458var taskQueue = []; 58459var timerQueue = []; // Incrementing id counter. Used to maintain insertion order. 58460 58461var taskIdCounter = 1; // Pausing the scheduler is useful for debugging. 58462var currentTask = null; 58463var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrancy. 58464 58465var isPerformingWork = false; 58466var isHostCallbackScheduled = false; 58467var isHostTimeoutScheduled = false; 58468 58469function advanceTimers(currentTime) { 58470 // Check for tasks that are no longer delayed and add them to the queue. 58471 var timer = peek(timerQueue); 58472 58473 while (timer !== null) { 58474 if (timer.callback === null) { 58475 // Timer was cancelled. 58476 pop(timerQueue); 58477 } else if (timer.startTime <= currentTime) { 58478 // Timer fired. Transfer to the task queue. 58479 pop(timerQueue); 58480 timer.sortIndex = timer.expirationTime; 58481 push(taskQueue, timer); 58482 58483 { 58484 markTaskStart(timer, currentTime); 58485 timer.isQueued = true; 58486 } 58487 } else { 58488 // Remaining timers are pending. 58489 return; 58490 } 58491 58492 timer = peek(timerQueue); 58493 } 58494} 58495 58496function handleTimeout(currentTime) { 58497 isHostTimeoutScheduled = false; 58498 advanceTimers(currentTime); 58499 58500 if (!isHostCallbackScheduled) { 58501 if (peek(taskQueue) !== null) { 58502 isHostCallbackScheduled = true; 58503 requestHostCallback(flushWork); 58504 } else { 58505 var firstTimer = peek(timerQueue); 58506 58507 if (firstTimer !== null) { 58508 requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); 58509 } 58510 } 58511 } 58512} 58513 58514function flushWork(hasTimeRemaining, initialTime) { 58515 { 58516 markSchedulerUnsuspended(initialTime); 58517 } // We'll need a host callback the next time work is scheduled. 58518 58519 58520 isHostCallbackScheduled = false; 58521 58522 if (isHostTimeoutScheduled) { 58523 // We scheduled a timeout but it's no longer needed. Cancel it. 58524 isHostTimeoutScheduled = false; 58525 cancelHostTimeout(); 58526 } 58527 58528 isPerformingWork = true; 58529 var previousPriorityLevel = currentPriorityLevel; 58530 58531 try { 58532 if (enableProfiling) { 58533 try { 58534 return workLoop(hasTimeRemaining, initialTime); 58535 } catch (error) { 58536 if (currentTask !== null) { 58537 var currentTime = exports.unstable_now(); 58538 markTaskErrored(currentTask, currentTime); 58539 currentTask.isQueued = false; 58540 } 58541 58542 throw error; 58543 } 58544 } else { 58545 // No catch in prod codepath. 58546 return workLoop(hasTimeRemaining, initialTime); 58547 } 58548 } finally { 58549 currentTask = null; 58550 currentPriorityLevel = previousPriorityLevel; 58551 isPerformingWork = false; 58552 58553 { 58554 var _currentTime = exports.unstable_now(); 58555 58556 markSchedulerSuspended(_currentTime); 58557 } 58558 } 58559} 58560 58561function workLoop(hasTimeRemaining, initialTime) { 58562 var currentTime = initialTime; 58563 advanceTimers(currentTime); 58564 currentTask = peek(taskQueue); 58565 58566 while (currentTask !== null && !(enableSchedulerDebugging )) { 58567 if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) { 58568 // This currentTask hasn't expired, and we've reached the deadline. 58569 break; 58570 } 58571 58572 var callback = currentTask.callback; 58573 58574 if (callback !== null) { 58575 currentTask.callback = null; 58576 currentPriorityLevel = currentTask.priorityLevel; 58577 var didUserCallbackTimeout = currentTask.expirationTime <= currentTime; 58578 markTaskRun(currentTask, currentTime); 58579 var continuationCallback = callback(didUserCallbackTimeout); 58580 currentTime = exports.unstable_now(); 58581 58582 if (typeof continuationCallback === 'function') { 58583 currentTask.callback = continuationCallback; 58584 markTaskYield(currentTask, currentTime); 58585 } else { 58586 { 58587 markTaskCompleted(currentTask, currentTime); 58588 currentTask.isQueued = false; 58589 } 58590 58591 if (currentTask === peek(taskQueue)) { 58592 pop(taskQueue); 58593 } 58594 } 58595 58596 advanceTimers(currentTime); 58597 } else { 58598 pop(taskQueue); 58599 } 58600 58601 currentTask = peek(taskQueue); 58602 } // Return whether there's additional work 58603 58604 58605 if (currentTask !== null) { 58606 return true; 58607 } else { 58608 var firstTimer = peek(timerQueue); 58609 58610 if (firstTimer !== null) { 58611 requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); 58612 } 58613 58614 return false; 58615 } 58616} 58617 58618function unstable_runWithPriority(priorityLevel, eventHandler) { 58619 switch (priorityLevel) { 58620 case ImmediatePriority: 58621 case UserBlockingPriority: 58622 case NormalPriority: 58623 case LowPriority: 58624 case IdlePriority: 58625 break; 58626 58627 default: 58628 priorityLevel = NormalPriority; 58629 } 58630 58631 var previousPriorityLevel = currentPriorityLevel; 58632 currentPriorityLevel = priorityLevel; 58633 58634 try { 58635 return eventHandler(); 58636 } finally { 58637 currentPriorityLevel = previousPriorityLevel; 58638 } 58639} 58640 58641function unstable_next(eventHandler) { 58642 var priorityLevel; 58643 58644 switch (currentPriorityLevel) { 58645 case ImmediatePriority: 58646 case UserBlockingPriority: 58647 case NormalPriority: 58648 // Shift down to normal priority 58649 priorityLevel = NormalPriority; 58650 break; 58651 58652 default: 58653 // Anything lower than normal priority should remain at the current level. 58654 priorityLevel = currentPriorityLevel; 58655 break; 58656 } 58657 58658 var previousPriorityLevel = currentPriorityLevel; 58659 currentPriorityLevel = priorityLevel; 58660 58661 try { 58662 return eventHandler(); 58663 } finally { 58664 currentPriorityLevel = previousPriorityLevel; 58665 } 58666} 58667 58668function unstable_wrapCallback(callback) { 58669 var parentPriorityLevel = currentPriorityLevel; 58670 return function () { 58671 // This is a fork of runWithPriority, inlined for performance. 58672 var previousPriorityLevel = currentPriorityLevel; 58673 currentPriorityLevel = parentPriorityLevel; 58674 58675 try { 58676 return callback.apply(this, arguments); 58677 } finally { 58678 currentPriorityLevel = previousPriorityLevel; 58679 } 58680 }; 58681} 58682 58683function timeoutForPriorityLevel(priorityLevel) { 58684 switch (priorityLevel) { 58685 case ImmediatePriority: 58686 return IMMEDIATE_PRIORITY_TIMEOUT; 58687 58688 case UserBlockingPriority: 58689 return USER_BLOCKING_PRIORITY; 58690 58691 case IdlePriority: 58692 return IDLE_PRIORITY; 58693 58694 case LowPriority: 58695 return LOW_PRIORITY_TIMEOUT; 58696 58697 case NormalPriority: 58698 default: 58699 return NORMAL_PRIORITY_TIMEOUT; 58700 } 58701} 58702 58703function unstable_scheduleCallback(priorityLevel, callback, options) { 58704 var currentTime = exports.unstable_now(); 58705 var startTime; 58706 var timeout; 58707 58708 if (typeof options === 'object' && options !== null) { 58709 var delay = options.delay; 58710 58711 if (typeof delay === 'number' && delay > 0) { 58712 startTime = currentTime + delay; 58713 } else { 58714 startTime = currentTime; 58715 } 58716 58717 timeout = typeof options.timeout === 'number' ? options.timeout : timeoutForPriorityLevel(priorityLevel); 58718 } else { 58719 timeout = timeoutForPriorityLevel(priorityLevel); 58720 startTime = currentTime; 58721 } 58722 58723 var expirationTime = startTime + timeout; 58724 var newTask = { 58725 id: taskIdCounter++, 58726 callback: callback, 58727 priorityLevel: priorityLevel, 58728 startTime: startTime, 58729 expirationTime: expirationTime, 58730 sortIndex: -1 58731 }; 58732 58733 { 58734 newTask.isQueued = false; 58735 } 58736 58737 if (startTime > currentTime) { 58738 // This is a delayed task. 58739 newTask.sortIndex = startTime; 58740 push(timerQueue, newTask); 58741 58742 if (peek(taskQueue) === null && newTask === peek(timerQueue)) { 58743 // All tasks are delayed, and this is the task with the earliest delay. 58744 if (isHostTimeoutScheduled) { 58745 // Cancel an existing timeout. 58746 cancelHostTimeout(); 58747 } else { 58748 isHostTimeoutScheduled = true; 58749 } // Schedule a timeout. 58750 58751 58752 requestHostTimeout(handleTimeout, startTime - currentTime); 58753 } 58754 } else { 58755 newTask.sortIndex = expirationTime; 58756 push(taskQueue, newTask); 58757 58758 { 58759 markTaskStart(newTask, currentTime); 58760 newTask.isQueued = true; 58761 } // Schedule a host callback, if needed. If we're already performing work, 58762 // wait until the next time we yield. 58763 58764 58765 if (!isHostCallbackScheduled && !isPerformingWork) { 58766 isHostCallbackScheduled = true; 58767 requestHostCallback(flushWork); 58768 } 58769 } 58770 58771 return newTask; 58772} 58773 58774function unstable_pauseExecution() { 58775} 58776 58777function unstable_continueExecution() { 58778 58779 if (!isHostCallbackScheduled && !isPerformingWork) { 58780 isHostCallbackScheduled = true; 58781 requestHostCallback(flushWork); 58782 } 58783} 58784 58785function unstable_getFirstCallbackNode() { 58786 return peek(taskQueue); 58787} 58788 58789function unstable_cancelCallback(task) { 58790 { 58791 if (task.isQueued) { 58792 var currentTime = exports.unstable_now(); 58793 markTaskCanceled(task, currentTime); 58794 task.isQueued = false; 58795 } 58796 } // Null out the callback to indicate the task has been canceled. (Can't 58797 // remove from the queue because you can't remove arbitrary nodes from an 58798 // array based heap, only the first one.) 58799 58800 58801 task.callback = null; 58802} 58803 58804function unstable_getCurrentPriorityLevel() { 58805 return currentPriorityLevel; 58806} 58807 58808function unstable_shouldYield() { 58809 var currentTime = exports.unstable_now(); 58810 advanceTimers(currentTime); 58811 var firstTask = peek(taskQueue); 58812 return firstTask !== currentTask && currentTask !== null && firstTask !== null && firstTask.callback !== null && firstTask.startTime <= currentTime && firstTask.expirationTime < currentTask.expirationTime || shouldYieldToHost(); 58813} 58814 58815var unstable_requestPaint = requestPaint; 58816var unstable_Profiling = { 58817 startLoggingProfilingEvents: startLoggingProfilingEvents, 58818 stopLoggingProfilingEvents: stopLoggingProfilingEvents, 58819 sharedProfilingBuffer: sharedProfilingBuffer 58820} ; 58821 58822exports.unstable_IdlePriority = IdlePriority; 58823exports.unstable_ImmediatePriority = ImmediatePriority; 58824exports.unstable_LowPriority = LowPriority; 58825exports.unstable_NormalPriority = NormalPriority; 58826exports.unstable_Profiling = unstable_Profiling; 58827exports.unstable_UserBlockingPriority = UserBlockingPriority; 58828exports.unstable_cancelCallback = unstable_cancelCallback; 58829exports.unstable_continueExecution = unstable_continueExecution; 58830exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel; 58831exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode; 58832exports.unstable_next = unstable_next; 58833exports.unstable_pauseExecution = unstable_pauseExecution; 58834exports.unstable_requestPaint = unstable_requestPaint; 58835exports.unstable_runWithPriority = unstable_runWithPriority; 58836exports.unstable_scheduleCallback = unstable_scheduleCallback; 58837exports.unstable_shouldYield = unstable_shouldYield; 58838exports.unstable_wrapCallback = unstable_wrapCallback; 58839 })(); 58840} 58841 58842 58843/***/ }), 58844
vendor: 471 bytes, lines 58845-58861
58845/***/ "./node_modules/scheduler/index.js": 58846/*!*****************************************!*\ 58847 !*** ./node_modules/scheduler/index.js ***! 58848 \*****************************************/ 58849/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 58850 58851"use strict"; 58852 58853 58854if (false) // removed by dead control flow 58855{} else { 58856 module.exports = __webpack_require__(/*! ./cjs/scheduler.development.js */ "./node_modules/scheduler/cjs/scheduler.development.js"); 58857} 58858 58859 58860/***/ }), 58861
vendor: 495 bytes, lines 58862-58878
58862/***/ "./node_modules/scheduler/tracing.js": 58863/*!*******************************************!*\ 58864 !*** ./node_modules/scheduler/tracing.js ***! 58865 \*******************************************/ 58866/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 58867 58868"use strict"; 58869 58870 58871if (false) // removed by dead control flow 58872{} else { 58873 module.exports = __webpack_require__(/*! ./cjs/scheduler-tracing.development.js */ "./node_modules/scheduler/cjs/scheduler-tracing.development.js"); 58874} 58875 58876 58877/***/ }), 58878
vendor: 2,839 bytes, lines 58879-58972
58879/***/ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js": 58880/*!****************************************************************************!*\ 58881 !*** ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js ***! 58882 \****************************************************************************/ 58883/***/ ((module) => { 58884 58885"use strict"; 58886 58887 58888var stylesInDOM = []; 58889function getIndexByIdentifier(identifier) { 58890 var result = -1; 58891 for (var i = 0; i < stylesInDOM.length; i++) { 58892 if (stylesInDOM[i].identifier === identifier) { 58893 result = i; 58894 break; 58895 } 58896 } 58897 return result; 58898} 58899function modulesToDom(list, options) { 58900 var idCountMap = {}; 58901 var identifiers = []; 58902 for (var i = 0; i < list.length; i++) { 58903 var item = list[i]; 58904 var id = options.base ? item[0] + options.base : item[0]; 58905 var count = idCountMap[id] || 0; 58906 var identifier = "".concat(id, " ").concat(count); 58907 idCountMap[id] = count + 1; 58908 var indexByIdentifier = getIndexByIdentifier(identifier); 58909 var obj = { 58910 css: item[1], 58911 media: item[2], 58912 sourceMap: item[3], 58913 supports: item[4], 58914 layer: item[5] 58915 }; 58916 if (indexByIdentifier !== -1) { 58917 stylesInDOM[indexByIdentifier].references++; 58918 stylesInDOM[indexByIdentifier].updater(obj); 58919 } else { 58920 var updater = addElementStyle(obj, options); 58921 options.byIndex = i; 58922 stylesInDOM.splice(i, 0, { 58923 identifier: identifier, 58924 updater: updater, 58925 references: 1 58926 }); 58927 } 58928 identifiers.push(identifier); 58929 } 58930 return identifiers; 58931} 58932function addElementStyle(obj, options) { 58933 var api = options.domAPI(options); 58934 api.update(obj); 58935 var updater = function updater(newObj) { 58936 if (newObj) { 58937 if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) { 58938 return; 58939 } 58940 api.update(obj = newObj); 58941 } else { 58942 api.remove(); 58943 } 58944 }; 58945 return updater; 58946} 58947module.exports = function (list, options) { 58948 options = options || {}; 58949 list = list || []; 58950 var lastIdentifiers = modulesToDom(list, options); 58951 return function update(newList) { 58952 newList = newList || []; 58953 for (var i = 0; i < lastIdentifiers.length; i++) { 58954 var identifier = lastIdentifiers[i]; 58955 var index = getIndexByIdentifier(identifier); 58956 stylesInDOM[index].references--; 58957 } 58958 var newLastIdentifiers = modulesToDom(newList, options); 58959 for (var _i = 0; _i < lastIdentifiers.length; _i++) { 58960 var _identifier = lastIdentifiers[_i]; 58961 var _index = getIndexByIdentifier(_identifier); 58962 if (stylesInDOM[_index].references === 0) { 58963 stylesInDOM[_index].updater(); 58964 stylesInDOM.splice(_index, 1); 58965 } 58966 } 58967 lastIdentifiers = newLastIdentifiers; 58968 }; 58969}; 58970 58971/***/ }), 58972
vendor: 1,330 bytes, lines 58973-59016
58973/***/ "./node_modules/style-loader/dist/runtime/insertBySelector.js": 58974/*!********************************************************************!*\ 58975 !*** ./node_modules/style-loader/dist/runtime/insertBySelector.js ***! 58976 \********************************************************************/ 58977/***/ ((module) => { 58978 58979"use strict"; 58980 58981 58982var memo = {}; 58983 58984/* istanbul ignore next */ 58985function getTarget(target) { 58986 if (typeof memo[target] === "undefined") { 58987 var styleTarget = document.querySelector(target); 58988 58989 // Special case to return head of iframe instead of iframe itself 58990 if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { 58991 try { 58992 // This will throw an exception if access to iframe is blocked 58993 // due to cross-origin restrictions 58994 styleTarget = styleTarget.contentDocument.head; 58995 } catch (e) { 58996 // istanbul ignore next 58997 styleTarget = null; 58998 } 58999 } 59000 memo[target] = styleTarget; 59001 } 59002 return memo[target]; 59003} 59004 59005/* istanbul ignore next */ 59006function insertBySelector(insert, style) { 59007 var target = getTarget(insert); 59008 if (!target) { 59009 throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."); 59010 } 59011 target.appendChild(style); 59012} 59013module.exports = insertBySelector; 59014 59015/***/ }), 59016
vendor: 620 bytes, lines 59017-59036
59017/***/ "./node_modules/style-loader/dist/runtime/insertStyleElement.js": 59018/*!**********************************************************************!*\ 59019 !*** ./node_modules/style-loader/dist/runtime/insertStyleElement.js ***! 59020 \**********************************************************************/ 59021/***/ ((module) => { 59022 59023"use strict"; 59024 59025 59026/* istanbul ignore next */ 59027function insertStyleElement(options) { 59028 var element = document.createElement("style"); 59029 options.setAttributes(element, options.attributes); 59030 options.insert(element, options.options); 59031 return element; 59032} 59033module.exports = insertStyleElement; 59034 59035/***/ }), 59036
vendor: 695 bytes, lines 59037-59056
59037/***/ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js": 59038/*!**********************************************************************************!*\ 59039 !*** ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js ***! 59040 \**********************************************************************************/ 59041/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 59042 59043"use strict"; 59044 59045 59046/* istanbul ignore next */ 59047function setAttributesWithoutAttributes(styleElement) { 59048 var nonce = true ? __webpack_require__.nc : 0; 59049 if (nonce) { 59050 styleElement.setAttribute("nonce", nonce); 59051 } 59052} 59053module.exports = setAttributesWithoutAttributes; 59054 59055/***/ }), 59056
vendor: 1,841 bytes, lines 59057-59127
59057/***/ "./node_modules/style-loader/dist/runtime/styleDomAPI.js": 59058/*!***************************************************************!*\ 59059 !*** ./node_modules/style-loader/dist/runtime/styleDomAPI.js ***! 59060 \***************************************************************/ 59061/***/ ((module) => { 59062 59063"use strict"; 59064 59065 59066/* istanbul ignore next */ 59067function apply(styleElement, options, obj) { 59068 var css = ""; 59069 if (obj.supports) { 59070 css += "@supports (".concat(obj.supports, ") {"); 59071 } 59072 if (obj.media) { 59073 css += "@media ".concat(obj.media, " {"); 59074 } 59075 var needLayer = typeof obj.layer !== "undefined"; 59076 if (needLayer) { 59077 css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {"); 59078 } 59079 css += obj.css; 59080 if (needLayer) { 59081 css += "}"; 59082 } 59083 if (obj.media) { 59084 css += "}"; 59085 } 59086 if (obj.supports) { 59087 css += "}"; 59088 } 59089 var sourceMap = obj.sourceMap; 59090 if (sourceMap && typeof btoa !== "undefined") { 59091 css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */"); 59092 } 59093 59094 // For old IE 59095 /* istanbul ignore if */ 59096 options.styleTagTransform(css, styleElement, options.options); 59097} 59098function removeStyleElement(styleElement) { 59099 // istanbul ignore if 59100 if (styleElement.parentNode === null) { 59101 return false; 59102 } 59103 styleElement.parentNode.removeChild(styleElement); 59104} 59105 59106/* istanbul ignore next */ 59107function domAPI(options) { 59108 if (typeof document === "undefined") { 59109 return { 59110 update: function update() {}, 59111 remove: function remove() {} 59112 }; 59113 } 59114 var styleElement = options.insertStyleElement(options); 59115 return { 59116 update: function update(obj) { 59117 apply(styleElement, options, obj); 59118 }, 59119 remove: function remove() { 59120 removeStyleElement(styleElement); 59121 } 59122 }; 59123} 59124module.exports = domAPI; 59125 59126/***/ }), 59127
vendor: 711 bytes, lines 59128-59151
59128/***/ "./node_modules/style-loader/dist/runtime/styleTagTransform.js": 59129/*!*********************************************************************!*\ 59130 !*** ./node_modules/style-loader/dist/runtime/styleTagTransform.js ***! 59131 \*********************************************************************/ 59132/***/ ((module) => { 59133 59134"use strict"; 59135 59136 59137/* istanbul ignore next */ 59138function styleTagTransform(css, styleElement) { 59139 if (styleElement.styleSheet) { 59140 styleElement.styleSheet.cssText = css; 59141 } else { 59142 while (styleElement.firstChild) { 59143 styleElement.removeChild(styleElement.firstChild); 59144 } 59145 styleElement.appendChild(document.createTextNode(css)); 59146 } 59147} 59148module.exports = styleTagTransform; 59149 59150/***/ }), 59151
vendor: 2,150 bytes, lines 59152-59205
59152/***/ "./node_modules/stylis/src/Enum.js": 59153/*!*****************************************!*\ 59154 !*** ./node_modules/stylis/src/Enum.js ***! 59155 \*****************************************/ 59156/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 59157 59158"use strict"; 59159__webpack_require__.r(__webpack_exports__); 59160/* harmony export */ __webpack_require__.d(__webpack_exports__, { 59161/* harmony export */ CHARSET: () => (/* binding */ CHARSET), 59162/* harmony export */ COMMENT: () => (/* binding */ COMMENT), 59163/* harmony export */ COUNTER_STYLE: () => (/* binding */ COUNTER_STYLE), 59164/* harmony export */ DECLARATION: () => (/* binding */ DECLARATION), 59165/* harmony export */ DOCUMENT: () => (/* binding */ DOCUMENT), 59166/* harmony export */ FONT_FACE: () => (/* binding */ FONT_FACE), 59167/* harmony export */ FONT_FEATURE_VALUES: () => (/* binding */ FONT_FEATURE_VALUES), 59168/* harmony export */ IMPORT: () => (/* binding */ IMPORT), 59169/* harmony export */ KEYFRAMES: () => (/* binding */ KEYFRAMES), 59170/* harmony export */ LAYER: () => (/* binding */ LAYER), 59171/* harmony export */ MEDIA: () => (/* binding */ MEDIA), 59172/* harmony export */ MOZ: () => (/* binding */ MOZ), 59173/* harmony export */ MS: () => (/* binding */ MS), 59174/* harmony export */ NAMESPACE: () => (/* binding */ NAMESPACE), 59175/* harmony export */ PAGE: () => (/* binding */ PAGE), 59176/* harmony export */ RULESET: () => (/* binding */ RULESET), 59177/* harmony export */ SUPPORTS: () => (/* binding */ SUPPORTS), 59178/* harmony export */ VIEWPORT: () => (/* binding */ VIEWPORT), 59179/* harmony export */ WEBKIT: () => (/* binding */ WEBKIT) 59180/* harmony export */ }); 59181var MS = '-ms-' 59182var MOZ = '-moz-' 59183var WEBKIT = '-webkit-' 59184 59185var COMMENT = 'comm' 59186var RULESET = 'rule' 59187var DECLARATION = 'decl' 59188 59189var PAGE = '@page' 59190var MEDIA = '@media' 59191var IMPORT = '@import' 59192var CHARSET = '@charset' 59193var VIEWPORT = '@viewport' 59194var SUPPORTS = '@supports' 59195var DOCUMENT = '@document' 59196var NAMESPACE = '@namespace' 59197var KEYFRAMES = '@keyframes' 59198var FONT_FACE = '@font-face' 59199var COUNTER_STYLE = '@counter-style' 59200var FONT_FEATURE_VALUES = '@font-feature-values' 59201var LAYER = '@layer' 59202 59203 59204/***/ }), 59205
vendor: 5,777 bytes, lines 59206-59336
59206/***/ "./node_modules/stylis/src/Middleware.js": 59207/*!***********************************************!*\ 59208 !*** ./node_modules/stylis/src/Middleware.js ***! 59209 \***********************************************/ 59210/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 59211 59212"use strict"; 59213__webpack_require__.r(__webpack_exports__); 59214/* harmony export */ __webpack_require__.d(__webpack_exports__, { 59215/* harmony export */ middleware: () => (/* binding */ middleware), 59216/* harmony export */ namespace: () => (/* binding */ namespace), 59217/* harmony export */ prefixer: () => (/* binding */ prefixer), 59218/* harmony export */ rulesheet: () => (/* binding */ rulesheet) 59219/* harmony export */ }); 59220/* harmony import */ var _Enum_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Enum.js */ "./node_modules/stylis/src/Enum.js"); 59221/* harmony import */ var _Utility_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utility.js */ "./node_modules/stylis/src/Utility.js"); 59222/* harmony import */ var _Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Tokenizer.js */ "./node_modules/stylis/src/Tokenizer.js"); 59223/* harmony import */ var _Serializer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Serializer.js */ "./node_modules/stylis/src/Serializer.js"); 59224/* harmony import */ var _Prefixer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Prefixer.js */ "./node_modules/stylis/src/Prefixer.js"); 59225 59226 59227 59228 59229 59230 59231/** 59232 * @param {function[]} collection 59233 * @return {function} 59234 */ 59235function middleware (collection) { 59236 var length = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.sizeof)(collection) 59237 59238 return function (element, index, children, callback) { 59239 var output = '' 59240 59241 for (var i = 0; i < length; i++) 59242 output += collection[i](element, index, children, callback) || '' 59243 59244 return output 59245 } 59246} 59247 59248/** 59249 * @param {function} callback 59250 * @return {function} 59251 */ 59252function rulesheet (callback) { 59253 return function (element) { 59254 if (!element.root) 59255 if (element = element.return) 59256 callback(element) 59257 } 59258} 59259 59260/** 59261 * @param {object} element 59262 * @param {number} index 59263 * @param {object[]} children 59264 * @param {function} callback 59265 */ 59266function prefixer (element, index, children, callback) { 59267 if (element.length > -1) 59268 if (!element.return) 59269 switch (element.type) { 59270 case _Enum_js__WEBPACK_IMPORTED_MODULE_0__.DECLARATION: element.return = (0,_Prefixer_js__WEBPACK_IMPORTED_MODULE_4__.prefix)(element.value, element.length, children) 59271 return 59272 case _Enum_js__WEBPACK_IMPORTED_MODULE_0__.KEYFRAMES: 59273 return (0,_Serializer_js__WEBPACK_IMPORTED_MODULE_3__.serialize)([(0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.copy)(element, {value: (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(element.value, '@', '@' + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT)})], callback) 59274 case _Enum_js__WEBPACK_IMPORTED_MODULE_0__.RULESET: 59275 if (element.length) 59276 return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.combine)(element.props, function (value) { 59277 switch ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.match)(value, /(::plac\w+|:read-\w+)/)) { 59278 // :read-(only|write) 59279 case ':read-only': case ':read-write': 59280 return (0,_Serializer_js__WEBPACK_IMPORTED_MODULE_3__.serialize)([(0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.copy)(element, {props: [(0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, /:(read-\w+)/, ':' + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MOZ + '$1')]})], callback) 59281 // :placeholder 59282 case '::placeholder': 59283 return (0,_Serializer_js__WEBPACK_IMPORTED_MODULE_3__.serialize)([ 59284 (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.copy)(element, {props: [(0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, /:(plac\w+)/, ':' + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + 'input-$1')]}), 59285 (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.copy)(element, {props: [(0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, /:(plac\w+)/, ':' + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MOZ + '$1')]}), 59286 (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.copy)(element, {props: [(0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, /:(plac\w+)/, _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + 'input-$1')]}) 59287 ], callback) 59288 } 59289 59290 return '' 59291 }) 59292 } 59293} 59294 59295/** 59296 * @param {object} element 59297 * @param {number} index 59298 * @param {object[]} children 59299 */ 59300function namespace (element) { 59301 switch (element.type) { 59302 case _Enum_js__WEBPACK_IMPORTED_MODULE_0__.RULESET: 59303 element.props = element.props.map(function (value) { 59304 return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.combine)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.tokenize)(value), function (value, index, children) { 59305 switch ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.charat)(value, 0)) { 59306 // \f 59307 case 12: 59308 return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.substr)(value, 1, (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(value)) 59309 // \0 ( + > ~ 59310 case 0: case 40: case 43: case 62: case 126: 59311 return value 59312 // : 59313 case 58: 59314 if (children[++index] === 'global') 59315 children[index] = '', children[++index] = '\f' + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.substr)(children[index], index = 1, -1) 59316 // \s 59317 case 32: 59318 return index === 1 ? '' : value 59319 default: 59320 switch (index) { 59321 case 0: element = value 59322 return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.sizeof)(children) > 1 ? '' : value 59323 case index = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.sizeof)(children) - 1: case 2: 59324 return index === 2 ? value + element + element : value + element 59325 default: 59326 return value 59327 } 59328 } 59329 }) 59330 }) 59331 } 59332} 59333 59334 59335/***/ }), 59336
vendor: 8,965 bytes, lines 59337-59549
59337/***/ "./node_modules/stylis/src/Parser.js": 59338/*!*******************************************!*\ 59339 !*** ./node_modules/stylis/src/Parser.js ***! 59340 \*******************************************/ 59341/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 59342 59343"use strict"; 59344__webpack_require__.r(__webpack_exports__); 59345/* harmony export */ __webpack_require__.d(__webpack_exports__, { 59346/* harmony export */ comment: () => (/* binding */ comment), 59347/* harmony export */ compile: () => (/* binding */ compile), 59348/* harmony export */ declaration: () => (/* binding */ declaration), 59349/* harmony export */ parse: () => (/* binding */ parse), 59350/* harmony export */ ruleset: () => (/* binding */ ruleset) 59351/* harmony export */ }); 59352/* harmony import */ var _Enum_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Enum.js */ "./node_modules/stylis/src/Enum.js"); 59353/* harmony import */ var _Utility_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utility.js */ "./node_modules/stylis/src/Utility.js"); 59354/* harmony import */ var _Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Tokenizer.js */ "./node_modules/stylis/src/Tokenizer.js"); 59355 59356 59357 59358 59359/** 59360 * @param {string} value 59361 * @return {object[]} 59362 */ 59363function compile (value) { 59364 return (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.dealloc)(parse('', null, null, null, [''], value = (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.alloc)(value), 0, [0], value)) 59365} 59366 59367/** 59368 * @param {string} value 59369 * @param {object} root 59370 * @param {object?} parent 59371 * @param {string[]} rule 59372 * @param {string[]} rules 59373 * @param {string[]} rulesets 59374 * @param {number[]} pseudo 59375 * @param {number[]} points 59376 * @param {string[]} declarations 59377 * @return {object} 59378 */ 59379function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) { 59380 var index = 0 59381 var offset = 0 59382 var length = pseudo 59383 var atrule = 0 59384 var property = 0 59385 var previous = 0 59386 var variable = 1 59387 var scanning = 1 59388 var ampersand = 1 59389 var character = 0 59390 var type = '' 59391 var props = rules 59392 var children = rulesets 59393 var reference = rule 59394 var characters = type 59395 59396 while (scanning) 59397 switch (previous = character, character = (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.next)()) { 59398 // ( 59399 case 40: 59400 if (previous != 108 && (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.charat)(characters, length - 1) == 58) { 59401 if ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.indexof)(characters += (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.delimit)(character), '&', '&\f'), '&\f') != -1) 59402 ampersand = -1 59403 break 59404 } 59405 // " ' [ 59406 case 34: case 39: case 91: 59407 characters += (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.delimit)(character) 59408 break 59409 // \t \n \r \s 59410 case 9: case 10: case 13: case 32: 59411 characters += (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.whitespace)(previous) 59412 break 59413 // \ 59414 case 92: 59415 characters += (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.escaping)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.caret)() - 1, 7) 59416 continue 59417 // / 59418 case 47: 59419 switch ((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.peek)()) { 59420 case 42: case 47: 59421 ;(0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.append)(comment((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.commenter)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.next)(), (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.caret)()), root, parent), declarations) 59422 break 59423 default: 59424 characters += '/' 59425 } 59426 break 59427 // { 59428 case 123 * variable: 59429 points[index++] = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(characters) * ampersand 59430 // } ; \0 59431 case 125 * variable: case 59: case 0: 59432 switch (character) { 59433 // \0 } 59434 case 0: case 125: scanning = 0 59435 // ; 59436 case 59 + offset: if (ampersand == -1) characters = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(characters, /\f/g, '') 59437 if (property > 0 && ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(characters) - length)) 59438 (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.append)(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(characters, ' ', '') + ';', rule, parent, length - 2), declarations) 59439 break 59440 // @ ; 59441 case 59: characters += ';' 59442 // { rule/at-rule 59443 default: 59444 ;(0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.append)(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets) 59445 59446 if (character === 123) 59447 if (offset === 0) 59448 parse(characters, root, reference, reference, props, rulesets, length, points, children) 59449 else 59450 switch (atrule === 99 && (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.charat)(characters, 3) === 110 ? 100 : atrule) { 59451 // d l m s 59452 case 100: case 108: case 109: case 115: 59453 parse(value, reference, reference, rule && (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.append)(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children) 59454 break 59455 default: 59456 parse(characters, reference, reference, reference, [''], children, 0, points, children) 59457 } 59458 } 59459 59460 index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo 59461 break 59462 // : 59463 case 58: 59464 length = 1 + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(characters), property = previous 59465 default: 59466 if (variable < 1) 59467 if (character == 123) 59468 --variable 59469 else if (character == 125 && variable++ == 0 && (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.prev)() == 125) 59470 continue 59471 59472 switch (characters += (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.from)(character), character * variable) { 59473 // & 59474 case 38: 59475 ampersand = offset > 0 ? 1 : (characters += '\f', -1) 59476 break 59477 // , 59478 case 44: 59479 points[index++] = ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(characters) - 1) * ampersand, ampersand = 1 59480 break 59481 // @ 59482 case 64: 59483 // - 59484 if ((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.peek)() === 45) 59485 characters += (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.delimit)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.next)()) 59486 59487 atrule = (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.peek)(), offset = length = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(type = characters += (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.identifier)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.caret)())), character++ 59488 break 59489 // - 59490 case 45: 59491 if (previous === 45 && (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(characters) == 2) 59492 variable = 0 59493 } 59494 } 59495 59496 return rulesets 59497} 59498 59499/** 59500 * @param {string} value 59501 * @param {object} root 59502 * @param {object?} parent 59503 * @param {number} index 59504 * @param {number} offset 59505 * @param {string[]} rules 59506 * @param {number[]} points 59507 * @param {string} type 59508 * @param {string[]} props 59509 * @param {string[]} children 59510 * @param {number} length 59511 * @return {object} 59512 */ 59513function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) { 59514 var post = offset - 1 59515 var rule = offset === 0 ? rules : [''] 59516 var size = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.sizeof)(rule) 59517 59518 for (var i = 0, j = 0, k = 0; i < index; ++i) 59519 for (var x = 0, y = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.substr)(value, post + 1, post = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.abs)(j = points[i])), z = value; x < size; ++x) 59520 if (z = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.trim)(j > 0 ? rule[x] + ' ' + y : (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(y, /&\f/g, rule[x]))) 59521 props[k++] = z 59522 59523 return (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.node)(value, root, parent, offset === 0 ? _Enum_js__WEBPACK_IMPORTED_MODULE_0__.RULESET : type, props, children, length) 59524} 59525 59526/** 59527 * @param {number} value 59528 * @param {object} root 59529 * @param {object?} parent 59530 * @return {object} 59531 */ 59532function comment (value, root, parent) { 59533 return (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.node)(value, root, parent, _Enum_js__WEBPACK_IMPORTED_MODULE_0__.COMMENT, (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.from)((0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.char)()), (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.substr)(value, 2, -2), 0) 59534} 59535 59536/** 59537 * @param {string} value 59538 * @param {object} root 59539 * @param {object?} parent 59540 * @param {number} length 59541 * @return {object} 59542 */ 59543function declaration (value, root, parent, length) { 59544 return (0,_Tokenizer_js__WEBPACK_IMPORTED_MODULE_2__.node)(value, root, parent, _Enum_js__WEBPACK_IMPORTED_MODULE_0__.DECLARATION, (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.substr)(value, 0, length), (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.substr)(value, length + 1, -1), length) 59545} 59546 59547 59548/***/ }), 59549
vendor: 11,621 bytes, lines 59550-59711
59550/***/ "./node_modules/stylis/src/Prefixer.js": 59551/*!*********************************************!*\ 59552 !*** ./node_modules/stylis/src/Prefixer.js ***! 59553 \*********************************************/ 59554/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 59555 59556"use strict"; 59557__webpack_require__.r(__webpack_exports__); 59558/* harmony export */ __webpack_require__.d(__webpack_exports__, { 59559/* harmony export */ prefix: () => (/* binding */ prefix) 59560/* harmony export */ }); 59561/* harmony import */ var _Enum_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Enum.js */ "./node_modules/stylis/src/Enum.js"); 59562/* harmony import */ var _Utility_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utility.js */ "./node_modules/stylis/src/Utility.js"); 59563 59564 59565 59566/** 59567 * @param {string} value 59568 * @param {number} length 59569 * @param {object[]} children 59570 * @return {string} 59571 */ 59572function prefix (value, length, children) { 59573 switch ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.hash)(value, length)) { 59574 // color-adjust 59575 case 5103: 59576 return _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + 'print-' + value + value 59577 // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function) 59578 case 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921: 59579 // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break 59580 case 5572: case 6356: case 5844: case 3191: case 6645: case 3005: 59581 // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite, 59582 case 6391: case 5879: case 5623: case 6135: case 4599: case 4855: 59583 // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width) 59584 case 4215: case 6389: case 5109: case 5365: case 5621: case 3829: 59585 return _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + value + value 59586 // tab-size 59587 case 4789: 59588 return _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MOZ + value + value 59589 // appearance, user-select, transform, hyphens, text-size-adjust 59590 case 5349: case 4246: case 4810: case 6968: case 2756: 59591 return _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MOZ + value + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + value + value 59592 // writing-mode 59593 case 5936: 59594 switch ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.charat)(value, length + 11)) { 59595 // vertical-l(r) 59596 case 114: 59597 return _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, /[svh]\w+-[tblr]{2}/, 'tb') + value 59598 // vertical-r(l) 59599 case 108: 59600 return _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value 59601 // horizontal(-)tb 59602 case 45: 59603 return _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, /[svh]\w+-[tblr]{2}/, 'lr') + value 59604 // default: fallthrough to below 59605 } 59606 // flex, flex-direction, scroll-snap-type, writing-mode 59607 case 6828: case 4268: case 2903: 59608 return _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + value + value 59609 // order 59610 case 6165: 59611 return _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + 'flex-' + value + value 59612 // align-items 59613 case 5187: 59614 return _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + value + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, /(\w+).+(:[^]+)/, _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + 'box-$1$2' + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + 'flex-$1$2') + value 59615 // align-self 59616 case 5443: 59617 return _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + 'flex-item-' + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, /flex-|-self/g, '') + (!(0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.match)(value, /flex-|baseline/) ? _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + 'grid-row-' + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, /flex-|-self/g, '') : '') + value 59618 // align-content 59619 case 4675: 59620 return _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + 'flex-line-pack' + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, /align-content|flex-|-self/g, '') + value 59621 // flex-shrink 59622 case 5548: 59623 return _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, 'shrink', 'negative') + value 59624 // flex-basis 59625 case 5292: 59626 return _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, 'basis', 'preferred-size') + value 59627 // flex-grow 59628 case 6060: 59629 return _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + 'box-' + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, '-grow', '') + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + value + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, 'grow', 'positive') + value 59630 // transition 59631 case 4554: 59632 return _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, /([^-])(transform)/g, '$1' + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + '$2') + value 59633 // cursor 59634 case 6187: 59635 return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, /(zoom-|grab)/, _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + '$1'), /(image-set)/, _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + '$1'), value, '') + value 59636 // background, background-image 59637 case 5495: case 3959: 59638 return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, /(image-set\([^]*)/, _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + '$1' + '$`$1') 59639 // justify-content 59640 case 4968: 59641 return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, /(.+:)(flex-)?(.*)/, _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + 'box-pack:$3' + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + value + value 59642 // justify-self 59643 case 4200: 59644 if (!(0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.match)(value, /flex-|baseline/)) return _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + 'grid-column-align' + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.substr)(value, length) + value 59645 break 59646 // grid-template-(columns|rows) 59647 case 2592: case 3360: 59648 return _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, 'template-', '') + value 59649 // grid-(row|column)-start 59650 case 4384: case 3616: 59651 if (children && children.some(function (element, index) { return length = index, (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.match)(element.props, /grid-\w+-end/) })) { 59652 return ~(0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.indexof)(value + (children = children[length].value), 'span') ? value : (_Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, '-start', '') + value + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + 'grid-row-span:' + (~(0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.indexof)(children, 'span') ? (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.match)(children, /\d+/) : +(0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.match)(children, /\d+/) - +(0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.match)(value, /\d+/)) + ';') 59653 } 59654 return _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, '-start', '') + value 59655 // grid-(row|column)-end 59656 case 4896: case 4128: 59657 return (children && children.some(function (element) { return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.match)(element.props, /grid-\w+-start/) })) ? value : _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, '-end', '-span'), 'span ', '') + value 59658 // (margin|padding)-inline-(start|end) 59659 case 4095: case 3583: case 4068: case 2532: 59660 return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, /(.+)-inline(.+)/, _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + '$1$2') + value 59661 // (min|max)?(width|height|inline-size|block-size) 59662 case 8116: case 7059: case 5753: case 5535: 59663 case 5445: case 5701: case 4933: case 4677: 59664 case 5533: case 5789: case 5021: case 4765: 59665 // stretch, max-content, min-content, fill-available 59666 if ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(value) - 1 - length > 6) 59667 switch ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.charat)(value, length + 1)) { 59668 // (m)ax-content, (m)in-content 59669 case 109: 59670 // - 59671 if ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.charat)(value, length + 4) !== 45) 59672 break 59673 // (f)ill-available, (f)it-content 59674 case 102: 59675 return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, /(.+:)(.+)-([^]+)/, '$1' + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + '$2-$3' + '$1' + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MOZ + ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.charat)(value, length + 3) == 108 ? '$3' : '$2-$3')) + value 59676 // (s)tretch 59677 case 115: 59678 return ~(0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.indexof)(value, 'stretch') ? prefix((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, 'stretch', 'fill-available'), length, children) + value : value 59679 } 59680 break 59681 // grid-(column|row) 59682 case 5152: case 5920: 59683 return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, /(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/, function (_, a, b, c, d, e, f) { return (_Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + a + ':' + b + f) + (c ? (_Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + a + '-span:' + (d ? e : +e - +b)) + f : '') + value }) 59684 // position: sticky 59685 case 4949: 59686 // stick(y)? 59687 if ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.charat)(value, length + 6) === 121) 59688 return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, ':', ':' + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT) + value 59689 break 59690 // display: (flex|inline-flex|grid|inline-grid) 59691 case 6444: 59692 switch ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.charat)(value, (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.charat)(value, 14) === 45 ? 18 : 11)) { 59693 // (inline-)?fle(x) 59694 case 120: 59695 return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, /(.+:)([^;\s!]+)(;|(\s+)?!.+)?/, '$1' + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + ((0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.charat)(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.WEBKIT + '$2$3' + '$1' + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS + '$2box$3') + value 59696 // (inline-)?gri(d) 59697 case 100: 59698 return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, ':', ':' + _Enum_js__WEBPACK_IMPORTED_MODULE_0__.MS) + value 59699 } 59700 break 59701 // scroll-margin, scroll-margin-(top|right|bottom|left) 59702 case 5719: case 2647: case 2135: case 3927: case 2391: 59703 return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.replace)(value, 'scroll-', 'scroll-snap-') + value 59704 } 59705 59706 return value 59707} 59708 59709 59710/***/ }), 59711
vendor: 2,183 bytes, lines 59712-59765
59712/***/ "./node_modules/stylis/src/Serializer.js": 59713/*!***********************************************!*\ 59714 !*** ./node_modules/stylis/src/Serializer.js ***! 59715 \***********************************************/ 59716/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 59717 59718"use strict"; 59719__webpack_require__.r(__webpack_exports__); 59720/* harmony export */ __webpack_require__.d(__webpack_exports__, { 59721/* harmony export */ serialize: () => (/* binding */ serialize), 59722/* harmony export */ stringify: () => (/* binding */ stringify) 59723/* harmony export */ }); 59724/* harmony import */ var _Enum_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Enum.js */ "./node_modules/stylis/src/Enum.js"); 59725/* harmony import */ var _Utility_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utility.js */ "./node_modules/stylis/src/Utility.js"); 59726 59727 59728 59729/** 59730 * @param {object[]} children 59731 * @param {function} callback 59732 * @return {string} 59733 */ 59734function serialize (children, callback) { 59735 var output = '' 59736 var length = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.sizeof)(children) 59737 59738 for (var i = 0; i < length; i++) 59739 output += callback(children[i], i, children, callback) || '' 59740 59741 return output 59742} 59743 59744/** 59745 * @param {object} element 59746 * @param {number} index 59747 * @param {object[]} children 59748 * @param {function} callback 59749 * @return {string} 59750 */ 59751function stringify (element, index, children, callback) { 59752 switch (element.type) { 59753 case _Enum_js__WEBPACK_IMPORTED_MODULE_0__.LAYER: if (element.children.length) break 59754 case _Enum_js__WEBPACK_IMPORTED_MODULE_0__.IMPORT: case _Enum_js__WEBPACK_IMPORTED_MODULE_0__.DECLARATION: return element.return = element.return || element.value 59755 case _Enum_js__WEBPACK_IMPORTED_MODULE_0__.COMMENT: return '' 59756 case _Enum_js__WEBPACK_IMPORTED_MODULE_0__.KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}' 59757 case _Enum_js__WEBPACK_IMPORTED_MODULE_0__.RULESET: element.value = element.props.join(',') 59758 } 59759 59760 return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_1__.strlen)(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : '' 59761} 59762 59763 59764/***/ }), 59765
vendor: 7,170 bytes, lines 59766-60051
59766/***/ "./node_modules/stylis/src/Tokenizer.js": 59767/*!**********************************************!*\ 59768 !*** ./node_modules/stylis/src/Tokenizer.js ***! 59769 \**********************************************/ 59770/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 59771 59772"use strict"; 59773__webpack_require__.r(__webpack_exports__); 59774/* harmony export */ __webpack_require__.d(__webpack_exports__, { 59775/* harmony export */ alloc: () => (/* binding */ alloc), 59776/* harmony export */ caret: () => (/* binding */ caret), 59777/* harmony export */ char: () => (/* binding */ char), 59778/* harmony export */ character: () => (/* binding */ character), 59779/* harmony export */ characters: () => (/* binding */ characters), 59780/* harmony export */ column: () => (/* binding */ column), 59781/* harmony export */ commenter: () => (/* binding */ commenter), 59782/* harmony export */ copy: () => (/* binding */ copy), 59783/* harmony export */ dealloc: () => (/* binding */ dealloc), 59784/* harmony export */ delimit: () => (/* binding */ delimit), 59785/* harmony export */ delimiter: () => (/* binding */ delimiter), 59786/* harmony export */ escaping: () => (/* binding */ escaping), 59787/* harmony export */ identifier: () => (/* binding */ identifier), 59788/* harmony export */ length: () => (/* binding */ length), 59789/* harmony export */ line: () => (/* binding */ line), 59790/* harmony export */ next: () => (/* binding */ next), 59791/* harmony export */ node: () => (/* binding */ node), 59792/* harmony export */ peek: () => (/* binding */ peek), 59793/* harmony export */ position: () => (/* binding */ position), 59794/* harmony export */ prev: () => (/* binding */ prev), 59795/* harmony export */ slice: () => (/* binding */ slice), 59796/* harmony export */ token: () => (/* binding */ token), 59797/* harmony export */ tokenize: () => (/* binding */ tokenize), 59798/* harmony export */ tokenizer: () => (/* binding */ tokenizer), 59799/* harmony export */ whitespace: () => (/* binding */ whitespace) 59800/* harmony export */ }); 59801/* harmony import */ var _Utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Utility.js */ "./node_modules/stylis/src/Utility.js"); 59802 59803 59804var line = 1 59805var column = 1 59806var length = 0 59807var position = 0 59808var character = 0 59809var characters = '' 59810 59811/** 59812 * @param {string} value 59813 * @param {object | null} root 59814 * @param {object | null} parent 59815 * @param {string} type 59816 * @param {string[] | string} props 59817 * @param {object[] | string} children 59818 * @param {number} length 59819 */ 59820function node (value, root, parent, type, props, children, length) { 59821 return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''} 59822} 59823 59824/** 59825 * @param {object} root 59826 * @param {object} props 59827 * @return {object} 59828 */ 59829function copy (root, props) { 59830 return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.assign)(node('', null, null, '', null, null, 0), root, {length: -root.length}, props) 59831} 59832 59833/** 59834 * @return {number} 59835 */ 59836function char () { 59837 return character 59838} 59839 59840/** 59841 * @return {number} 59842 */ 59843function prev () { 59844 character = position > 0 ? (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.charat)(characters, --position) : 0 59845 59846 if (column--, character === 10) 59847 column = 1, line-- 59848 59849 return character 59850} 59851 59852/** 59853 * @return {number} 59854 */ 59855function next () { 59856 character = position < length ? (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.charat)(characters, position++) : 0 59857 59858 if (column++, character === 10) 59859 column = 1, line++ 59860 59861 return character 59862} 59863 59864/** 59865 * @return {number} 59866 */ 59867function peek () { 59868 return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.charat)(characters, position) 59869} 59870 59871/** 59872 * @return {number} 59873 */ 59874function caret () { 59875 return position 59876} 59877 59878/** 59879 * @param {number} begin 59880 * @param {number} end 59881 * @return {string} 59882 */ 59883function slice (begin, end) { 59884 return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.substr)(characters, begin, end) 59885} 59886 59887/** 59888 * @param {number} type 59889 * @return {number} 59890 */ 59891function token (type) { 59892 switch (type) { 59893 // \0 \t \n \r \s whitespace token 59894 case 0: case 9: case 10: case 13: case 32: 59895 return 5 59896 // ! + , / > @ ~ isolate token 59897 case 33: case 43: case 44: case 47: case 62: case 64: case 126: 59898 // ; { } breakpoint token 59899 case 59: case 123: case 125: 59900 return 4 59901 // : accompanied token 59902 case 58: 59903 return 3 59904 // " ' ( [ opening delimit token 59905 case 34: case 39: case 40: case 91: 59906 return 2 59907 // ) ] closing delimit token 59908 case 41: case 93: 59909 return 1 59910 } 59911 59912 return 0 59913} 59914 59915/** 59916 * @param {string} value 59917 * @return {any[]} 59918 */ 59919function alloc (value) { 59920 return line = column = 1, length = (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.strlen)(characters = value), position = 0, [] 59921} 59922 59923/** 59924 * @param {any} value 59925 * @return {any} 59926 */ 59927function dealloc (value) { 59928 return characters = '', value 59929} 59930 59931/** 59932 * @param {number} type 59933 * @return {string} 59934 */ 59935function delimit (type) { 59936 return (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.trim)(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type))) 59937} 59938 59939/** 59940 * @param {string} value 59941 * @return {string[]} 59942 */ 59943function tokenize (value) { 59944 return dealloc(tokenizer(alloc(value))) 59945} 59946 59947/** 59948 * @param {number} type 59949 * @return {string} 59950 */ 59951function whitespace (type) { 59952 while (character = peek()) 59953 if (character < 33) 59954 next() 59955 else 59956 break 59957 59958 return token(type) > 2 || token(character) > 3 ? '' : ' ' 59959} 59960 59961/** 59962 * @param {string[]} children 59963 * @return {string[]} 59964 */ 59965function tokenizer (children) { 59966 while (next()) 59967 switch (token(character)) { 59968 case 0: (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.append)(identifier(position - 1), children) 59969 break 59970 case 2: ;(0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.append)(delimit(character), children) 59971 break 59972 default: ;(0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.append)((0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.from)(character), children) 59973 } 59974 59975 return children 59976} 59977 59978/** 59979 * @param {number} index 59980 * @param {number} count 59981 * @return {string} 59982 */ 59983function escaping (index, count) { 59984 while (--count && next()) 59985 // not 0-9 A-F a-f 59986 if (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97)) 59987 break 59988 59989 return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32)) 59990} 59991 59992/** 59993 * @param {number} type 59994 * @return {number} 59995 */ 59996function delimiter (type) { 59997 while (next()) 59998 switch (character) { 59999 // ] ) " ' 60000 case type: 60001 return position 60002 // " ' 60003 case 34: case 39: 60004 if (type !== 34 && type !== 39) 60005 delimiter(character) 60006 break 60007 // ( 60008 case 40: 60009 if (type === 41) 60010 delimiter(type) 60011 break 60012 // \ 60013 case 92: 60014 next() 60015 break 60016 } 60017 60018 return position 60019} 60020 60021/** 60022 * @param {number} type 60023 * @param {number} index 60024 * @return {number} 60025 */ 60026function commenter (type, index) { 60027 while (next()) 60028 // // 60029 if (type + character === 47 + 10) 60030 break 60031 // /* 60032 else if (type + character === 42 + 42 && peek() === 47) 60033 break 60034 60035 return '/*' + slice(index, position - 1) + '*' + (0,_Utility_js__WEBPACK_IMPORTED_MODULE_0__.from)(type === 47 ? type : next()) 60036} 60037 60038/** 60039 * @param {number} index 60040 * @return {string} 60041 */ 60042function identifier (index) { 60043 while (!token(peek())) 60044 next() 60045 60046 return slice(index, position) 60047} 60048 60049 60050/***/ }), 60051
vendor: 3,246 bytes, lines 60052-60194
60052/***/ "./node_modules/stylis/src/Utility.js": 60053/*!********************************************!*\ 60054 !*** ./node_modules/stylis/src/Utility.js ***! 60055 \********************************************/ 60056/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 60057 60058"use strict"; 60059__webpack_require__.r(__webpack_exports__); 60060/* harmony export */ __webpack_require__.d(__webpack_exports__, { 60061/* harmony export */ abs: () => (/* binding */ abs), 60062/* harmony export */ append: () => (/* binding */ append), 60063/* harmony export */ assign: () => (/* binding */ assign), 60064/* harmony export */ charat: () => (/* binding */ charat), 60065/* harmony export */ combine: () => (/* binding */ combine), 60066/* harmony export */ from: () => (/* binding */ from), 60067/* harmony export */ hash: () => (/* binding */ hash), 60068/* harmony export */ indexof: () => (/* binding */ indexof), 60069/* harmony export */ match: () => (/* binding */ match), 60070/* harmony export */ replace: () => (/* binding */ replace), 60071/* harmony export */ sizeof: () => (/* binding */ sizeof), 60072/* harmony export */ strlen: () => (/* binding */ strlen), 60073/* harmony export */ substr: () => (/* binding */ substr), 60074/* harmony export */ trim: () => (/* binding */ trim) 60075/* harmony export */ }); 60076/** 60077 * @param {number} 60078 * @return {number} 60079 */ 60080var abs = Math.abs 60081 60082/** 60083 * @param {number} 60084 * @return {string} 60085 */ 60086var from = String.fromCharCode 60087 60088/** 60089 * @param {object} 60090 * @return {object} 60091 */ 60092var assign = Object.assign 60093 60094/** 60095 * @param {string} value 60096 * @param {number} length 60097 * @return {number} 60098 */ 60099function hash (value, length) { 60100 return charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0 60101} 60102 60103/** 60104 * @param {string} value 60105 * @return {string} 60106 */ 60107function trim (value) { 60108 return value.trim() 60109} 60110 60111/** 60112 * @param {string} value 60113 * @param {RegExp} pattern 60114 * @return {string?} 60115 */ 60116function match (value, pattern) { 60117 return (value = pattern.exec(value)) ? value[0] : value 60118} 60119 60120/** 60121 * @param {string} value 60122 * @param {(string|RegExp)} pattern 60123 * @param {string} replacement 60124 * @return {string} 60125 */ 60126function replace (value, pattern, replacement) { 60127 return value.replace(pattern, replacement) 60128} 60129 60130/** 60131 * @param {string} value 60132 * @param {string} search 60133 * @return {number} 60134 */ 60135function indexof (value, search) { 60136 return value.indexOf(search) 60137} 60138 60139/** 60140 * @param {string} value 60141 * @param {number} index 60142 * @return {number} 60143 */ 60144function charat (value, index) { 60145 return value.charCodeAt(index) | 0 60146} 60147 60148/** 60149 * @param {string} value 60150 * @param {number} begin 60151 * @param {number} end 60152 * @return {string} 60153 */ 60154function substr (value, begin, end) { 60155 return value.slice(begin, end) 60156} 60157 60158/** 60159 * @param {string} value 60160 * @return {number} 60161 */ 60162function strlen (value) { 60163 return value.length 60164} 60165 60166/** 60167 * @param {any[]} value 60168 * @return {number} 60169 */ 60170function sizeof (value) { 60171 return value.length 60172} 60173 60174/** 60175 * @param {any} value 60176 * @param {any[]} array 60177 * @return {any} 60178 */ 60179function append (value, array) { 60180 return array.push(value), value 60181} 60182 60183/** 60184 * @param {string[]} array 60185 * @param {function} callback 60186 * @return {string} 60187 */ 60188function combine (array, callback) { 60189 return array.map(callback).join('') 60190} 60191 60192 60193/***/ }), 60194
vendor: 919 bytes, lines 60195-60214
60195/***/ "./node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js": 60196/*!****************************************************************************************************!*\ 60197 !*** ./node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js ***! 60198 \****************************************************************************************************/ 60199/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 60200 60201"use strict"; 60202__webpack_require__.r(__webpack_exports__); 60203/* harmony export */ __webpack_require__.d(__webpack_exports__, { 60204/* harmony export */ "default": () => (/* binding */ index) 60205/* harmony export */ }); 60206/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 60207 60208 60209var index = react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect ; 60210 60211 60212 60213 60214/***/ })
vendor: 6,121 bytes, lines 60214-60357
60214 60215 60216/******/ }); 60217/************************************************************************/ 60218/******/ // The module cache 60219/******/ var __webpack_module_cache__ = {}; 60220/******/ 60221/******/ // The require function 60222/******/ function __webpack_require__(moduleId) { 60223/******/ // Check if module is in cache 60224/******/ var cachedModule = __webpack_module_cache__[moduleId]; 60225/******/ if (cachedModule !== undefined) { 60226/******/ return cachedModule.exports; 60227/******/ } 60228/******/ // Create a new module (and put it into the cache) 60229/******/ var module = __webpack_module_cache__[moduleId] = { 60230/******/ id: moduleId, 60231/******/ loaded: false, 60232/******/ exports: {} 60233/******/ }; 60234/******/ 60235/******/ // Execute the module function 60236/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); 60237/******/ 60238/******/ // Flag the module as loaded 60239/******/ module.loaded = true; 60240/******/ 60241/******/ // Return the exports of the module 60242/******/ return module.exports; 60243/******/ } 60244/******/ 60245/******/ // expose the modules object (__webpack_modules__) 60246/******/ __webpack_require__.m = __webpack_modules__; 60247/******/ 60248/************************************************************************/ 60249/******/ /* webpack/runtime/compat get default export */ 60250/******/ (() => { 60251/******/ // getDefaultExport function for compatibility with non-harmony modules 60252/******/ __webpack_require__.n = (module) => { 60253/******/ var getter = module && module.__esModule ? 60254/******/ () => (module['default']) : 60255/******/ () => (module); 60256/******/ __webpack_require__.d(getter, { a: getter }); 60257/******/ return getter; 60258/******/ }; 60259/******/ })(); 60260/******/ 60261/******/ /* webpack/runtime/create fake namespace object */ 60262/******/ (() => { 60263/******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__); 60264/******/ var leafPrototypes; 60265/******/ // create a fake namespace object 60266/******/ // mode & 1: value is a module id, require it 60267/******/ // mode & 2: merge all properties of value into the ns 60268/******/ // mode & 4: return value when already ns object 60269/******/ // mode & 16: return value when it's Promise-like 60270/******/ // mode & 8|1: behave like require 60271/******/ __webpack_require__.t = function(value, mode) { 60272/******/ if(mode & 1) value = this(value); 60273/******/ if(mode & 8) return value; 60274/******/ if(typeof value === 'object' && value) { 60275/******/ if((mode & 4) && value.__esModule) return value; 60276/******/ if((mode & 16) && typeof value.then === 'function') return value; 60277/******/ } 60278/******/ var ns = Object.create(null); 60279/******/ __webpack_require__.r(ns); 60280/******/ var def = {}; 60281/******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)]; 60282/******/ for(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) { 60283/******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key]))); 60284/******/ } 60285/******/ def['default'] = () => (value); 60286/******/ __webpack_require__.d(ns, def); 60287/******/ return ns; 60288/******/ }; 60289/******/ })(); 60290/******/ 60291/******/ /* webpack/runtime/define property getters */ 60292/******/ (() => { 60293/******/ // define getter functions for harmony exports 60294/******/ __webpack_require__.d = (exports, definition) => { 60295/******/ for(var key in definition) { 60296/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 60297/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 60298/******/ } 60299/******/ } 60300/******/ }; 60301/******/ })(); 60302/******/ 60303/******/ /* webpack/runtime/global */ 60304/******/ (() => { 60305/******/ __webpack_require__.g = (function() { 60306/******/ if (typeof globalThis === 'object') return globalThis; 60307/******/ try { 60308/******/ return this || new Function('return this')(); 60309/******/ } catch (e) { 60310/******/ if (typeof window === 'object') return window; 60311/******/ } 60312/******/ })(); 60313/******/ })(); 60314/******/ 60315/******/ /* webpack/runtime/hasOwnProperty shorthand */ 60316/******/ (() => { 60317/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 60318/******/ })(); 60319/******/ 60320/******/ /* webpack/runtime/make namespace object */ 60321/******/ (() => { 60322/******/ // define __esModule on exports 60323/******/ __webpack_require__.r = (exports) => { 60324/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 60325/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 60326/******/ } 60327/******/ Object.defineProperty(exports, '__esModule', { value: true }); 60328/******/ }; 60329/******/ })(); 60330/******/ 60331/******/ /* webpack/runtime/node module decorator */ 60332/******/ (() => { 60333/******/ __webpack_require__.nmd = (module) => { 60334/******/ module.paths = []; 60335/******/ if (!module.children) module.children = []; 60336/******/ return module; 60337/******/ }; 60338/******/ })(); 60339/******/ 60340/******/ /* webpack/runtime/publicPath */ 60341/******/ (() => { 60342/******/ var scriptUrl; 60343/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + ""; 60344/******/ var document = __webpack_require__.g.document; 60345/******/ if (!scriptUrl && document) { 60346/******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') 60347/******/ scriptUrl = document.currentScript.src; 60348/******/ if (!scriptUrl) { 60349/******/ var scripts = document.getElementsByTagName("script"); 60350/******/ if(scripts.length) { 60351/******/ var i = scripts.length - 1; 60352/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src; 60353/******/ } 60354/******/ } 60355/******/ } 60356/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration 60357/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your co
60357de to use your own logic. 60358/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser"); 60359/******/ scriptUrl = scriptUrl.replace(/^blob:/, "").replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/"); 60360/******/ __webpack_require__.p = scriptUrl; 60361/******/ })(); 60362/******/ 60363/******/ /* webpack/runtime/jsonp chunk loading */ 60364/******/ (() => { 60365/******/ __webpack_require__.b = document.baseURI || self.location.href; 60366/******/ 60367/******/ // object to store loaded and loading chunks 60368/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched 60369/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded 60370/******/ var installedChunks = { 60371/******/ "main": 0 60372/******/ }; 60373/******/ 60374/******/ // no chunk on demand loading 60375/******/ 60376/******/ // no prefetching 60377/******/ 60378/******/ // no preloaded 60379/******/ 60380/******/ // no HMR 60381/******/ 60382/******/ // no HMR manifest 60383/******/ 60384/******/ // no on chunks loaded 60385/******/ 60386/******/ // no jsonp function 60387/******/ })(); 60388/******/ 60389/******/ /* webpack/runtime/nonce */ 60390/******/ (() => { 60391/******/ __webpack_require__.nc = undefined; 60392/******/ })(); 60393/******/ 60394/************************************************************************/ 60395var __webpack_exports__ = {}; 60396// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. 60397(() => { 60398"use strict"; 60399/*!**************************!*\ 60400 !*** ./js/src/index.jsx ***! 60401 \**************************/ 60402__webpack_require__.r(__webpack_exports__); 60403/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 60404/* harmony import */ var _GlobalSearch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GlobalSearch */ "./js/src/GlobalSearch.jsx"); 60405/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js"); 60406/* harmony import */ var _commonSearch_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./commonSearch.css */ "./js/src/commonSearch.css"); 60407 60408 60409 60410 60411var renderApp = function renderApp() { 60412 return react_dom__WEBPACK_IMPORTED_MODULE_2__.render(/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_GlobalSearch__WEBPACK_IMPORTED_MODULE_1__["default"], { 60413 CenterSearch: true 60414 }), document.getElementById('react-app')); 60415}; 60416var renderApp1 = function renderApp1() { 60417 return react_dom__WEBPACK_IMPORTED_MODULE_2__.render(/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_GlobalSearch__WEBPACK_IMPORTED_MODULE_1__["default"], null), document.getElementById('react-app-menu')); 60418}; 60419renderApp(); 60420renderApp1(); 60421})(); 60422 60423/******/ })() 60424; 60425//# sourceMappingURL=main.min.js.map
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.