| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /******/ (() => { // webpackBootstrap 2 /******/ "use strict"; 3 /******/ var __webpack_modules__ = ({ 4 5 /***/ 644 6 /*!*****************************************************************************!*\ 7 !*** ./node_modules/react-refresh/cjs/react-refresh-runtime.development.js ***! 8 \*****************************************************************************/ 9 (__unused_webpack_module, exports) { 10 11 /** 12 * @license React 13 * react-refresh-runtime.development.js 14 * 15 * Copyright (c) Facebook, Inc. and its affiliates. 16 * 17 * This source code is licensed under the MIT license found in the 18 * LICENSE file in the root directory of this source tree. 19 */ 20 21 22 23 if (true) { 24 (function() { 25 'use strict'; 26 27 // ATTENTION 28 var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); 29 var REACT_MEMO_TYPE = Symbol.for('react.memo'); 30 31 var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; // We never remove these associations. 32 // It's OK to reference families, but use WeakMap/Set for types. 33 34 var allFamiliesByID = new Map(); 35 var allFamiliesByType = new PossiblyWeakMap(); 36 var allSignaturesByType = new PossiblyWeakMap(); // This WeakMap is read by React, so we only put families 37 // that have actually been edited here. This keeps checks fast. 38 // $FlowIssue 39 40 var updatedFamiliesByType = new PossiblyWeakMap(); // This is cleared on every performReactRefresh() call. 41 // It is an array of [Family, NextType] tuples. 42 43 var pendingUpdates = []; // This is injected by the renderer via DevTools global hook. 44 45 var helpersByRendererID = new Map(); 46 var helpersByRoot = new Map(); // We keep track of mounted roots so we can schedule updates. 47 48 var mountedRoots = new Set(); // If a root captures an error, we remember it so we can retry on edit. 49 50 var failedRoots = new Set(); // In environments that support WeakMap, we also remember the last element for every root. 51 // It needs to be weak because we do this even for roots that failed to mount. 52 // If there is no WeakMap, we won't attempt to do retrying. 53 // $FlowIssue 54 55 var rootElements = // $FlowIssue 56 typeof WeakMap === 'function' ? new WeakMap() : null; 57 var isPerformingRefresh = false; 58 59 function computeFullKey(signature) { 60 if (signature.fullKey !== null) { 61 return signature.fullKey; 62 } 63 64 var fullKey = signature.ownKey; 65 var hooks; 66 67 try { 68 hooks = signature.getCustomHooks(); 69 } catch (err) { 70 // This can happen in an edge case, e.g. if expression like Foo.useSomething 71 // depends on Foo which is lazily initialized during rendering. 72 // In that case just assume we'll have to remount. 73 signature.forceReset = true; 74 signature.fullKey = fullKey; 75 return fullKey; 76 } 77 78 for (var i = 0; i < hooks.length; i++) { 79 var hook = hooks[i]; 80 81 if (typeof hook !== 'function') { 82 // Something's wrong. Assume we need to remount. 83 signature.forceReset = true; 84 signature.fullKey = fullKey; 85 return fullKey; 86 } 87 88 var nestedHookSignature = allSignaturesByType.get(hook); 89 90 if (nestedHookSignature === undefined) { 91 // No signature means Hook wasn't in the source code, e.g. in a library. 92 // We'll skip it because we can assume it won't change during this session. 93 continue; 94 } 95 96 var nestedHookKey = computeFullKey(nestedHookSignature); 97 98 if (nestedHookSignature.forceReset) { 99 signature.forceReset = true; 100 } 101 102 fullKey += '\n---\n' + nestedHookKey; 103 } 104 105 signature.fullKey = fullKey; 106 return fullKey; 107 } 108 109 function haveEqualSignatures(prevType, nextType) { 110 var prevSignature = allSignaturesByType.get(prevType); 111 var nextSignature = allSignaturesByType.get(nextType); 112 113 if (prevSignature === undefined && nextSignature === undefined) { 114 return true; 115 } 116 117 if (prevSignature === undefined || nextSignature === undefined) { 118 return false; 119 } 120 121 if (computeFullKey(prevSignature) !== computeFullKey(nextSignature)) { 122 return false; 123 } 124 125 if (nextSignature.forceReset) { 126 return false; 127 } 128 129 return true; 130 } 131 132 function isReactClass(type) { 133 return type.prototype && type.prototype.isReactComponent; 134 } 135 136 function canPreserveStateBetween(prevType, nextType) { 137 if (isReactClass(prevType) || isReactClass(nextType)) { 138 return false; 139 } 140 141 if (haveEqualSignatures(prevType, nextType)) { 142 return true; 143 } 144 145 return false; 146 } 147 148 function resolveFamily(type) { 149 // Only check updated types to keep lookups fast. 150 return updatedFamiliesByType.get(type); 151 } // If we didn't care about IE11, we could use new Map/Set(iterable). 152 153 154 function cloneMap(map) { 155 var clone = new Map(); 156 map.forEach(function (value, key) { 157 clone.set(key, value); 158 }); 159 return clone; 160 } 161 162 function cloneSet(set) { 163 var clone = new Set(); 164 set.forEach(function (value) { 165 clone.add(value); 166 }); 167 return clone; 168 } // This is a safety mechanism to protect against rogue getters and Proxies. 169 170 171 function getProperty(object, property) { 172 try { 173 return object[property]; 174 } catch (err) { 175 // Intentionally ignore. 176 return undefined; 177 } 178 } 179 180 function performReactRefresh() { 181 182 if (pendingUpdates.length === 0) { 183 return null; 184 } 185 186 if (isPerformingRefresh) { 187 return null; 188 } 189 190 isPerformingRefresh = true; 191 192 try { 193 var staleFamilies = new Set(); 194 var updatedFamilies = new Set(); 195 var updates = pendingUpdates; 196 pendingUpdates = []; 197 updates.forEach(function (_ref) { 198 var family = _ref[0], 199 nextType = _ref[1]; 200 // Now that we got a real edit, we can create associations 201 // that will be read by the React reconciler. 202 var prevType = family.current; 203 updatedFamiliesByType.set(prevType, family); 204 updatedFamiliesByType.set(nextType, family); 205 family.current = nextType; // Determine whether this should be a re-render or a re-mount. 206 207 if (canPreserveStateBetween(prevType, nextType)) { 208 updatedFamilies.add(family); 209 } else { 210 staleFamilies.add(family); 211 } 212 }); // TODO: rename these fields to something more meaningful. 213 214 var update = { 215 updatedFamilies: updatedFamilies, 216 // Families that will re-render preserving state 217 staleFamilies: staleFamilies // Families that will be remounted 218 219 }; 220 helpersByRendererID.forEach(function (helpers) { 221 // Even if there are no roots, set the handler on first update. 222 // This ensures that if *new* roots are mounted, they'll use the resolve handler. 223 helpers.setRefreshHandler(resolveFamily); 224 }); 225 var didError = false; 226 var firstError = null; // We snapshot maps and sets that are mutated during commits. 227 // If we don't do this, there is a risk they will be mutated while 228 // we iterate over them. For example, trying to recover a failed root 229 // may cause another root to be added to the failed list -- an infinite loop. 230 231 var failedRootsSnapshot = cloneSet(failedRoots); 232 var mountedRootsSnapshot = cloneSet(mountedRoots); 233 var helpersByRootSnapshot = cloneMap(helpersByRoot); 234 failedRootsSnapshot.forEach(function (root) { 235 var helpers = helpersByRootSnapshot.get(root); 236 237 if (helpers === undefined) { 238 throw new Error('Could not find helpers for a root. This is a bug in React Refresh.'); 239 } 240 241 if (!failedRoots.has(root)) {// No longer failed. 242 } 243 244 if (rootElements === null) { 245 return; 246 } 247 248 if (!rootElements.has(root)) { 249 return; 250 } 251 252 var element = rootElements.get(root); 253 254 try { 255 helpers.scheduleRoot(root, element); 256 } catch (err) { 257 if (!didError) { 258 didError = true; 259 firstError = err; 260 } // Keep trying other roots. 261 262 } 263 }); 264 mountedRootsSnapshot.forEach(function (root) { 265 var helpers = helpersByRootSnapshot.get(root); 266 267 if (helpers === undefined) { 268 throw new Error('Could not find helpers for a root. This is a bug in React Refresh.'); 269 } 270 271 if (!mountedRoots.has(root)) {// No longer mounted. 272 } 273 274 try { 275 helpers.scheduleRefresh(root, update); 276 } catch (err) { 277 if (!didError) { 278 didError = true; 279 firstError = err; 280 } // Keep trying other roots. 281 282 } 283 }); 284 285 if (didError) { 286 throw firstError; 287 } 288 289 return update; 290 } finally { 291 isPerformingRefresh = false; 292 } 293 } 294 function register(type, id) { 295 { 296 if (type === null) { 297 return; 298 } 299 300 if (typeof type !== 'function' && typeof type !== 'object') { 301 return; 302 } // This can happen in an edge case, e.g. if we register 303 // return value of a HOC but it returns a cached component. 304 // Ignore anything but the first registration for each type. 305 306 307 if (allFamiliesByType.has(type)) { 308 return; 309 } // Create family or remember to update it. 310 // None of this bookkeeping affects reconciliation 311 // until the first performReactRefresh() call above. 312 313 314 var family = allFamiliesByID.get(id); 315 316 if (family === undefined) { 317 family = { 318 current: type 319 }; 320 allFamiliesByID.set(id, family); 321 } else { 322 pendingUpdates.push([family, type]); 323 } 324 325 allFamiliesByType.set(type, family); // Visit inner types because we might not have registered them. 326 327 if (typeof type === 'object' && type !== null) { 328 switch (getProperty(type, '$$typeof')) { 329 case REACT_FORWARD_REF_TYPE: 330 register(type.render, id + '$render'); 331 break; 332 333 case REACT_MEMO_TYPE: 334 register(type.type, id + '$type'); 335 break; 336 } 337 } 338 } 339 } 340 function setSignature(type, key) { 341 var forceReset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 342 var getCustomHooks = arguments.length > 3 ? arguments[3] : undefined; 343 344 { 345 if (!allSignaturesByType.has(type)) { 346 allSignaturesByType.set(type, { 347 forceReset: forceReset, 348 ownKey: key, 349 fullKey: null, 350 getCustomHooks: getCustomHooks || function () { 351 return []; 352 } 353 }); 354 } // Visit inner types because we might not have signed them. 355 356 357 if (typeof type === 'object' && type !== null) { 358 switch (getProperty(type, '$$typeof')) { 359 case REACT_FORWARD_REF_TYPE: 360 setSignature(type.render, key, forceReset, getCustomHooks); 361 break; 362 363 case REACT_MEMO_TYPE: 364 setSignature(type.type, key, forceReset, getCustomHooks); 365 break; 366 } 367 } 368 } 369 } // This is lazily called during first render for a type. 370 // It captures Hook list at that time so inline requires don't break comparisons. 371 372 function collectCustomHooksForSignature(type) { 373 { 374 var signature = allSignaturesByType.get(type); 375 376 if (signature !== undefined) { 377 computeFullKey(signature); 378 } 379 } 380 } 381 function getFamilyByID(id) { 382 { 383 return allFamiliesByID.get(id); 384 } 385 } 386 function getFamilyByType(type) { 387 { 388 return allFamiliesByType.get(type); 389 } 390 } 391 function findAffectedHostInstances(families) { 392 { 393 var affectedInstances = new Set(); 394 mountedRoots.forEach(function (root) { 395 var helpers = helpersByRoot.get(root); 396 397 if (helpers === undefined) { 398 throw new Error('Could not find helpers for a root. This is a bug in React Refresh.'); 399 } 400 401 var instancesForRoot = helpers.findHostInstancesForRefresh(root, families); 402 instancesForRoot.forEach(function (inst) { 403 affectedInstances.add(inst); 404 }); 405 }); 406 return affectedInstances; 407 } 408 } 409 function injectIntoGlobalHook(globalObject) { 410 { 411 // For React Native, the global hook will be set up by require('react-devtools-core'). 412 // That code will run before us. So we need to monkeypatch functions on existing hook. 413 // For React Web, the global hook will be set up by the extension. 414 // This will also run before us. 415 var hook = globalObject.__REACT_DEVTOOLS_GLOBAL_HOOK__; 416 417 if (hook === undefined) { 418 // However, if there is no DevTools extension, we'll need to set up the global hook ourselves. 419 // Note that in this case it's important that renderer code runs *after* this method call. 420 // Otherwise, the renderer will think that there is no global hook, and won't do the injection. 421 var nextID = 0; 422 globalObject.__REACT_DEVTOOLS_GLOBAL_HOOK__ = hook = { 423 renderers: new Map(), 424 supportsFiber: true, 425 inject: function (injected) { 426 return nextID++; 427 }, 428 onScheduleFiberRoot: function (id, root, children) {}, 429 onCommitFiberRoot: function (id, root, maybePriorityLevel, didError) {}, 430 onCommitFiberUnmount: function () {} 431 }; 432 } 433 434 if (hook.isDisabled) { 435 // This isn't a real property on the hook, but it can be set to opt out 436 // of DevTools integration and associated warnings and logs. 437 // Using console['warn'] to evade Babel and ESLint 438 console['warn']('Something has shimmed the React DevTools global hook (__REACT_DEVTOOLS_GLOBAL_HOOK__). ' + 'Fast Refresh is not compatible with this shim and will be disabled.'); 439 return; 440 } // Here, we just want to get a reference to scheduleRefresh. 441 442 443 var oldInject = hook.inject; 444 445 hook.inject = function (injected) { 446 var id = oldInject.apply(this, arguments); 447 448 if (typeof injected.scheduleRefresh === 'function' && typeof injected.setRefreshHandler === 'function') { 449 // This version supports React Refresh. 450 helpersByRendererID.set(id, injected); 451 } 452 453 return id; 454 }; // Do the same for any already injected roots. 455 // This is useful if ReactDOM has already been initialized. 456 // https://github.com/facebook/react/issues/17626 457 458 459 hook.renderers.forEach(function (injected, id) { 460 if (typeof injected.scheduleRefresh === 'function' && typeof injected.setRefreshHandler === 'function') { 461 // This version supports React Refresh. 462 helpersByRendererID.set(id, injected); 463 } 464 }); // We also want to track currently mounted roots. 465 466 var oldOnCommitFiberRoot = hook.onCommitFiberRoot; 467 468 var oldOnScheduleFiberRoot = hook.onScheduleFiberRoot || function () {}; 469 470 hook.onScheduleFiberRoot = function (id, root, children) { 471 if (!isPerformingRefresh) { 472 // If it was intentionally scheduled, don't attempt to restore. 473 // This includes intentionally scheduled unmounts. 474 failedRoots.delete(root); 475 476 if (rootElements !== null) { 477 rootElements.set(root, children); 478 } 479 } 480 481 return oldOnScheduleFiberRoot.apply(this, arguments); 482 }; 483 484 hook.onCommitFiberRoot = function (id, root, maybePriorityLevel, didError) { 485 var helpers = helpersByRendererID.get(id); 486 487 if (helpers !== undefined) { 488 helpersByRoot.set(root, helpers); 489 var current = root.current; 490 var alternate = current.alternate; // We need to determine whether this root has just (un)mounted. 491 // This logic is copy-pasted from similar logic in the DevTools backend. 492 // If this breaks with some refactoring, you'll want to update DevTools too. 493 494 if (alternate !== null) { 495 var wasMounted = alternate.memoizedState != null && alternate.memoizedState.element != null && mountedRoots.has(root); 496 var isMounted = current.memoizedState != null && current.memoizedState.element != null; 497 498 if (!wasMounted && isMounted) { 499 // Mount a new root. 500 mountedRoots.add(root); 501 failedRoots.delete(root); 502 } else if (wasMounted && isMounted) ; else if (wasMounted && !isMounted) { 503 // Unmount an existing root. 504 mountedRoots.delete(root); 505 506 if (didError) { 507 // We'll remount it on future edits. 508 failedRoots.add(root); 509 } else { 510 helpersByRoot.delete(root); 511 } 512 } else if (!wasMounted && !isMounted) { 513 if (didError) { 514 // We'll remount it on future edits. 515 failedRoots.add(root); 516 } 517 } 518 } else { 519 // Mount a new root. 520 mountedRoots.add(root); 521 } 522 } // Always call the decorated DevTools hook. 523 524 525 return oldOnCommitFiberRoot.apply(this, arguments); 526 }; 527 } 528 } 529 function hasUnrecoverableErrors() { 530 // TODO: delete this after removing dependency in RN. 531 return false; 532 } // Exposed for testing. 533 534 function _getMountedRootCount() { 535 { 536 return mountedRoots.size; 537 } 538 } // This is a wrapper over more primitive functions for setting signature. 539 // Signatures let us decide whether the Hook order has changed on refresh. 540 // 541 // This function is intended to be used as a transform target, e.g.: 542 // var _s = createSignatureFunctionForTransform() 543 // 544 // function Hello() { 545 // const [foo, setFoo] = useState(0); 546 // const value = useCustomHook(); 547 // _s(); /* Call without arguments triggers collecting the custom Hook list. 548 // * This doesn't happen during the module evaluation because we 549 // * don't want to change the module order with inline requires. 550 // * Next calls are noops. */ 551 // return <h1>Hi</h1>; 552 // } 553 // 554 // /* Call with arguments attaches the signature to the type: */ 555 // _s( 556 // Hello, 557 // 'useState{[foo, setFoo]}(0)', 558 // () => [useCustomHook], /* Lazy to avoid triggering inline requires */ 559 // ); 560 561 function createSignatureFunctionForTransform() { 562 { 563 var savedType; 564 var hasCustomHooks; 565 var didCollectHooks = false; 566 return function (type, key, forceReset, getCustomHooks) { 567 if (typeof key === 'string') { 568 // We're in the initial phase that associates signatures 569 // with the functions. Note this may be called multiple times 570 // in HOC chains like _s(hoc1(_s(hoc2(_s(actualFunction))))). 571 if (!savedType) { 572 // We're in the innermost call, so this is the actual type. 573 savedType = type; 574 hasCustomHooks = typeof getCustomHooks === 'function'; 575 } // Set the signature for all types (even wrappers!) in case 576 // they have no signatures of their own. This is to prevent 577 // problems like https://github.com/facebook/react/issues/20417. 578 579 580 if (type != null && (typeof type === 'function' || typeof type === 'object')) { 581 setSignature(type, key, forceReset, getCustomHooks); 582 } 583 584 return type; 585 } else { 586 // We're in the _s() call without arguments, which means 587 // this is the time to collect custom Hook signatures. 588 // Only do this once. This path is hot and runs *inside* every render! 589 if (!didCollectHooks && hasCustomHooks) { 590 didCollectHooks = true; 591 collectCustomHooksForSignature(savedType); 592 } 593 } 594 }; 595 } 596 } 597 function isLikelyComponentType(type) { 598 { 599 switch (typeof type) { 600 case 'function': 601 { 602 // First, deal with classes. 603 if (type.prototype != null) { 604 if (type.prototype.isReactComponent) { 605 // React class. 606 return true; 607 } 608 609 var ownNames = Object.getOwnPropertyNames(type.prototype); 610 611 if (ownNames.length > 1 || ownNames[0] !== 'constructor') { 612 // This looks like a class. 613 return false; 614 } // eslint-disable-next-line no-proto 615 616 617 if (type.prototype.__proto__ !== Object.prototype) { 618 // It has a superclass. 619 return false; 620 } // Pass through. 621 // This looks like a regular function with empty prototype. 622 623 } // For plain functions and arrows, use name as a heuristic. 624 625 626 var name = type.name || type.displayName; 627 return typeof name === 'string' && /^[A-Z]/.test(name); 628 } 629 630 case 'object': 631 { 632 if (type != null) { 633 switch (getProperty(type, '$$typeof')) { 634 case REACT_FORWARD_REF_TYPE: 635 case REACT_MEMO_TYPE: 636 // Definitely React components. 637 return true; 638 639 default: 640 return false; 641 } 642 } 643 644 return false; 645 } 646 647 default: 648 { 649 return false; 650 } 651 } 652 } 653 } 654 655 exports._getMountedRootCount = _getMountedRootCount; 656 exports.collectCustomHooksForSignature = collectCustomHooksForSignature; 657 exports.createSignatureFunctionForTransform = createSignatureFunctionForTransform; 658 exports.findAffectedHostInstances = findAffectedHostInstances; 659 exports.getFamilyByID = getFamilyByID; 660 exports.getFamilyByType = getFamilyByType; 661 exports.hasUnrecoverableErrors = hasUnrecoverableErrors; 662 exports.injectIntoGlobalHook = injectIntoGlobalHook; 663 exports.isLikelyComponentType = isLikelyComponentType; 664 exports.performReactRefresh = performReactRefresh; 665 exports.register = register; 666 exports.setSignature = setSignature; 667 })(); 668 } 669 670 671 /***/ }, 672 673 /***/ 206 674 /*!***********************************************!*\ 675 !*** ./node_modules/react-refresh/runtime.js ***! 676 \***********************************************/ 677 (module, __unused_webpack_exports, __webpack_require__) { 678 679 680 681 if (false) // removed by dead control flow 682 {} else { 683 module.exports = __webpack_require__(/*! ./cjs/react-refresh-runtime.development.js */ 644); 684 } 685 686 687 /***/ } 688 689 /******/ }); 690 /************************************************************************/ 691 /******/ // The module cache 692 /******/ var __webpack_module_cache__ = {}; 693 /******/ 694 /******/ // The require function 695 /******/ function __webpack_require__(moduleId) { 696 /******/ // Check if module is in cache 697 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 698 /******/ if (cachedModule !== undefined) { 699 /******/ return cachedModule.exports; 700 /******/ } 701 /******/ // Create a new module (and put it into the cache) 702 /******/ var module = __webpack_module_cache__[moduleId] = { 703 /******/ // no module.id needed 704 /******/ // no module.loaded needed 705 /******/ exports: {} 706 /******/ }; 707 /******/ 708 /******/ // Execute the module function 709 /******/ if (!(moduleId in __webpack_modules__)) { 710 /******/ delete __webpack_module_cache__[moduleId]; 711 /******/ var e = new Error("Cannot find module '" + moduleId + "'"); 712 /******/ e.code = 'MODULE_NOT_FOUND'; 713 /******/ throw e; 714 /******/ } 715 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 716 /******/ 717 /******/ // Return the exports of the module 718 /******/ return module.exports; 719 /******/ } 720 /******/ 721 /************************************************************************/ 722 /******/ 723 /******/ // startup 724 /******/ // Load entry module and return exports 725 /******/ // This entry module used 'module' so it can't be inlined 726 /******/ var __webpack_exports__ = __webpack_require__(206); 727 /******/ window.ReactRefreshRuntime = __webpack_exports__; 728 /******/ 729 /******/ })() 730 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Sat Jun 13 09:38:55 2026 | Cross-referenced by PHPXref |