[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /******/ (() => { // webpackBootstrap 2 /******/ "use strict"; 3 /******/ // The require scope 4 /******/ var __webpack_require__ = {}; 5 /******/ 6 /************************************************************************/ 7 /******/ /* webpack/runtime/define property getters */ 8 /******/ (() => { 9 /******/ // define getter functions for harmony exports 10 /******/ __webpack_require__.d = (exports, definition) => { 11 /******/ for(var key in definition) { 12 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 13 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 14 /******/ } 15 /******/ } 16 /******/ }; 17 /******/ })(); 18 /******/ 19 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 20 /******/ (() => { 21 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 22 /******/ })(); 23 /******/ 24 /******/ /* webpack/runtime/make namespace object */ 25 /******/ (() => { 26 /******/ // define __esModule on exports 27 /******/ __webpack_require__.r = (exports) => { 28 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 29 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 30 /******/ } 31 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 32 /******/ }; 33 /******/ })(); 34 /******/ 35 /************************************************************************/ 36 var __webpack_exports__ = {}; 37 // ESM COMPAT FLAG 38 __webpack_require__.r(__webpack_exports__); 39 40 // EXPORTS 41 __webpack_require__.d(__webpack_exports__, { 42 privateApis: () => (/* reexport */ privateApis) 43 }); 44 45 ;// CONCATENATED MODULE: external "React" 46 const external_React_namespaceObject = window["React"]; 47 ;// CONCATENATED MODULE: external ["wp","element"] 48 const external_wp_element_namespaceObject = window["wp"]["element"]; 49 ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js 50 function extends_extends() { 51 extends_extends = Object.assign ? Object.assign.bind() : function (target) { 52 for (var i = 1; i < arguments.length; i++) { 53 var source = arguments[i]; 54 for (var key in source) { 55 if (Object.prototype.hasOwnProperty.call(source, key)) { 56 target[key] = source[key]; 57 } 58 } 59 } 60 return target; 61 }; 62 return extends_extends.apply(this, arguments); 63 } 64 ;// CONCATENATED MODULE: ./node_modules/history/index.js 65 66 67 /** 68 * Actions represent the type of change to a location value. 69 * 70 * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action 71 */ 72 var Action; 73 74 (function (Action) { 75 /** 76 * A POP indicates a change to an arbitrary index in the history stack, such 77 * as a back or forward navigation. It does not describe the direction of the 78 * navigation, only that the current index changed. 79 * 80 * Note: This is the default action for newly created history objects. 81 */ 82 Action["Pop"] = "POP"; 83 /** 84 * A PUSH indicates a new entry being added to the history stack, such as when 85 * a link is clicked and a new page loads. When this happens, all subsequent 86 * entries in the stack are lost. 87 */ 88 89 Action["Push"] = "PUSH"; 90 /** 91 * A REPLACE indicates the entry at the current index in the history stack 92 * being replaced by a new one. 93 */ 94 95 Action["Replace"] = "REPLACE"; 96 })(Action || (Action = {})); 97 98 var readOnly = false ? 0 : function (obj) { 99 return obj; 100 }; 101 102 function warning(cond, message) { 103 if (!cond) { 104 // eslint-disable-next-line no-console 105 if (typeof console !== 'undefined') console.warn(message); 106 107 try { 108 // Welcome to debugging history! 109 // 110 // This error is thrown as a convenience so you can more easily 111 // find the source for a warning that appears in the console by 112 // enabling "pause on exceptions" in your JavaScript debugger. 113 throw new Error(message); // eslint-disable-next-line no-empty 114 } catch (e) {} 115 } 116 } 117 118 var BeforeUnloadEventType = 'beforeunload'; 119 var HashChangeEventType = 'hashchange'; 120 var PopStateEventType = 'popstate'; 121 /** 122 * Browser history stores the location in regular URLs. This is the standard for 123 * most web apps, but it requires some configuration on the server to ensure you 124 * serve the same app at multiple URLs. 125 * 126 * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory 127 */ 128 129 function createBrowserHistory(options) { 130 if (options === void 0) { 131 options = {}; 132 } 133 134 var _options = options, 135 _options$window = _options.window, 136 window = _options$window === void 0 ? document.defaultView : _options$window; 137 var globalHistory = window.history; 138 139 function getIndexAndLocation() { 140 var _window$location = window.location, 141 pathname = _window$location.pathname, 142 search = _window$location.search, 143 hash = _window$location.hash; 144 var state = globalHistory.state || {}; 145 return [state.idx, readOnly({ 146 pathname: pathname, 147 search: search, 148 hash: hash, 149 state: state.usr || null, 150 key: state.key || 'default' 151 })]; 152 } 153 154 var blockedPopTx = null; 155 156 function handlePop() { 157 if (blockedPopTx) { 158 blockers.call(blockedPopTx); 159 blockedPopTx = null; 160 } else { 161 var nextAction = Action.Pop; 162 163 var _getIndexAndLocation = getIndexAndLocation(), 164 nextIndex = _getIndexAndLocation[0], 165 nextLocation = _getIndexAndLocation[1]; 166 167 if (blockers.length) { 168 if (nextIndex != null) { 169 var delta = index - nextIndex; 170 171 if (delta) { 172 // Revert the POP 173 blockedPopTx = { 174 action: nextAction, 175 location: nextLocation, 176 retry: function retry() { 177 go(delta * -1); 178 } 179 }; 180 go(delta); 181 } 182 } else { 183 // Trying to POP to a location with no index. We did not create 184 // this location, so we can't effectively block the navigation. 185 false ? 0 : void 0; 186 } 187 } else { 188 applyTx(nextAction); 189 } 190 } 191 } 192 193 window.addEventListener(PopStateEventType, handlePop); 194 var action = Action.Pop; 195 196 var _getIndexAndLocation2 = getIndexAndLocation(), 197 index = _getIndexAndLocation2[0], 198 location = _getIndexAndLocation2[1]; 199 200 var listeners = createEvents(); 201 var blockers = createEvents(); 202 203 if (index == null) { 204 index = 0; 205 globalHistory.replaceState(extends_extends({}, globalHistory.state, { 206 idx: index 207 }), ''); 208 } 209 210 function createHref(to) { 211 return typeof to === 'string' ? to : createPath(to); 212 } // state defaults to `null` because `window.history.state` does 213 214 215 function getNextLocation(to, state) { 216 if (state === void 0) { 217 state = null; 218 } 219 220 return readOnly(extends_extends({ 221 pathname: location.pathname, 222 hash: '', 223 search: '' 224 }, typeof to === 'string' ? parsePath(to) : to, { 225 state: state, 226 key: createKey() 227 })); 228 } 229 230 function getHistoryStateAndUrl(nextLocation, index) { 231 return [{ 232 usr: nextLocation.state, 233 key: nextLocation.key, 234 idx: index 235 }, createHref(nextLocation)]; 236 } 237 238 function allowTx(action, location, retry) { 239 return !blockers.length || (blockers.call({ 240 action: action, 241 location: location, 242 retry: retry 243 }), false); 244 } 245 246 function applyTx(nextAction) { 247 action = nextAction; 248 249 var _getIndexAndLocation3 = getIndexAndLocation(); 250 251 index = _getIndexAndLocation3[0]; 252 location = _getIndexAndLocation3[1]; 253 listeners.call({ 254 action: action, 255 location: location 256 }); 257 } 258 259 function push(to, state) { 260 var nextAction = Action.Push; 261 var nextLocation = getNextLocation(to, state); 262 263 function retry() { 264 push(to, state); 265 } 266 267 if (allowTx(nextAction, nextLocation, retry)) { 268 var _getHistoryStateAndUr = getHistoryStateAndUrl(nextLocation, index + 1), 269 historyState = _getHistoryStateAndUr[0], 270 url = _getHistoryStateAndUr[1]; // TODO: Support forced reloading 271 // try...catch because iOS limits us to 100 pushState calls :/ 272 273 274 try { 275 globalHistory.pushState(historyState, '', url); 276 } catch (error) { 277 // They are going to lose state here, but there is no real 278 // way to warn them about it since the page will refresh... 279 window.location.assign(url); 280 } 281 282 applyTx(nextAction); 283 } 284 } 285 286 function replace(to, state) { 287 var nextAction = Action.Replace; 288 var nextLocation = getNextLocation(to, state); 289 290 function retry() { 291 replace(to, state); 292 } 293 294 if (allowTx(nextAction, nextLocation, retry)) { 295 var _getHistoryStateAndUr2 = getHistoryStateAndUrl(nextLocation, index), 296 historyState = _getHistoryStateAndUr2[0], 297 url = _getHistoryStateAndUr2[1]; // TODO: Support forced reloading 298 299 300 globalHistory.replaceState(historyState, '', url); 301 applyTx(nextAction); 302 } 303 } 304 305 function go(delta) { 306 globalHistory.go(delta); 307 } 308 309 var history = { 310 get action() { 311 return action; 312 }, 313 314 get location() { 315 return location; 316 }, 317 318 createHref: createHref, 319 push: push, 320 replace: replace, 321 go: go, 322 back: function back() { 323 go(-1); 324 }, 325 forward: function forward() { 326 go(1); 327 }, 328 listen: function listen(listener) { 329 return listeners.push(listener); 330 }, 331 block: function block(blocker) { 332 var unblock = blockers.push(blocker); 333 334 if (blockers.length === 1) { 335 window.addEventListener(BeforeUnloadEventType, promptBeforeUnload); 336 } 337 338 return function () { 339 unblock(); // Remove the beforeunload listener so the document may 340 // still be salvageable in the pagehide event. 341 // See https://html.spec.whatwg.org/#unloading-documents 342 343 if (!blockers.length) { 344 window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload); 345 } 346 }; 347 } 348 }; 349 return history; 350 } 351 /** 352 * Hash history stores the location in window.location.hash. This makes it ideal 353 * for situations where you don't want to send the location to the server for 354 * some reason, either because you do cannot configure it or the URL space is 355 * reserved for something else. 356 * 357 * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory 358 */ 359 360 function createHashHistory(options) { 361 if (options === void 0) { 362 options = {}; 363 } 364 365 var _options2 = options, 366 _options2$window = _options2.window, 367 window = _options2$window === void 0 ? document.defaultView : _options2$window; 368 var globalHistory = window.history; 369 370 function getIndexAndLocation() { 371 var _parsePath = parsePath(window.location.hash.substr(1)), 372 _parsePath$pathname = _parsePath.pathname, 373 pathname = _parsePath$pathname === void 0 ? '/' : _parsePath$pathname, 374 _parsePath$search = _parsePath.search, 375 search = _parsePath$search === void 0 ? '' : _parsePath$search, 376 _parsePath$hash = _parsePath.hash, 377 hash = _parsePath$hash === void 0 ? '' : _parsePath$hash; 378 379 var state = globalHistory.state || {}; 380 return [state.idx, readOnly({ 381 pathname: pathname, 382 search: search, 383 hash: hash, 384 state: state.usr || null, 385 key: state.key || 'default' 386 })]; 387 } 388 389 var blockedPopTx = null; 390 391 function handlePop() { 392 if (blockedPopTx) { 393 blockers.call(blockedPopTx); 394 blockedPopTx = null; 395 } else { 396 var nextAction = Action.Pop; 397 398 var _getIndexAndLocation4 = getIndexAndLocation(), 399 nextIndex = _getIndexAndLocation4[0], 400 nextLocation = _getIndexAndLocation4[1]; 401 402 if (blockers.length) { 403 if (nextIndex != null) { 404 var delta = index - nextIndex; 405 406 if (delta) { 407 // Revert the POP 408 blockedPopTx = { 409 action: nextAction, 410 location: nextLocation, 411 retry: function retry() { 412 go(delta * -1); 413 } 414 }; 415 go(delta); 416 } 417 } else { 418 // Trying to POP to a location with no index. We did not create 419 // this location, so we can't effectively block the navigation. 420 false ? 0 : void 0; 421 } 422 } else { 423 applyTx(nextAction); 424 } 425 } 426 } 427 428 window.addEventListener(PopStateEventType, handlePop); // popstate does not fire on hashchange in IE 11 and old (trident) Edge 429 // https://developer.mozilla.org/de/docs/Web/API/Window/popstate_event 430 431 window.addEventListener(HashChangeEventType, function () { 432 var _getIndexAndLocation5 = getIndexAndLocation(), 433 nextLocation = _getIndexAndLocation5[1]; // Ignore extraneous hashchange events. 434 435 436 if (createPath(nextLocation) !== createPath(location)) { 437 handlePop(); 438 } 439 }); 440 var action = Action.Pop; 441 442 var _getIndexAndLocation6 = getIndexAndLocation(), 443 index = _getIndexAndLocation6[0], 444 location = _getIndexAndLocation6[1]; 445 446 var listeners = createEvents(); 447 var blockers = createEvents(); 448 449 if (index == null) { 450 index = 0; 451 globalHistory.replaceState(_extends({}, globalHistory.state, { 452 idx: index 453 }), ''); 454 } 455 456 function getBaseHref() { 457 var base = document.querySelector('base'); 458 var href = ''; 459 460 if (base && base.getAttribute('href')) { 461 var url = window.location.href; 462 var hashIndex = url.indexOf('#'); 463 href = hashIndex === -1 ? url : url.slice(0, hashIndex); 464 } 465 466 return href; 467 } 468 469 function createHref(to) { 470 return getBaseHref() + '#' + (typeof to === 'string' ? to : createPath(to)); 471 } 472 473 function getNextLocation(to, state) { 474 if (state === void 0) { 475 state = null; 476 } 477 478 return readOnly(_extends({ 479 pathname: location.pathname, 480 hash: '', 481 search: '' 482 }, typeof to === 'string' ? parsePath(to) : to, { 483 state: state, 484 key: createKey() 485 })); 486 } 487 488 function getHistoryStateAndUrl(nextLocation, index) { 489 return [{ 490 usr: nextLocation.state, 491 key: nextLocation.key, 492 idx: index 493 }, createHref(nextLocation)]; 494 } 495 496 function allowTx(action, location, retry) { 497 return !blockers.length || (blockers.call({ 498 action: action, 499 location: location, 500 retry: retry 501 }), false); 502 } 503 504 function applyTx(nextAction) { 505 action = nextAction; 506 507 var _getIndexAndLocation7 = getIndexAndLocation(); 508 509 index = _getIndexAndLocation7[0]; 510 location = _getIndexAndLocation7[1]; 511 listeners.call({ 512 action: action, 513 location: location 514 }); 515 } 516 517 function push(to, state) { 518 var nextAction = Action.Push; 519 var nextLocation = getNextLocation(to, state); 520 521 function retry() { 522 push(to, state); 523 } 524 525 false ? 0 : void 0; 526 527 if (allowTx(nextAction, nextLocation, retry)) { 528 var _getHistoryStateAndUr3 = getHistoryStateAndUrl(nextLocation, index + 1), 529 historyState = _getHistoryStateAndUr3[0], 530 url = _getHistoryStateAndUr3[1]; // TODO: Support forced reloading 531 // try...catch because iOS limits us to 100 pushState calls :/ 532 533 534 try { 535 globalHistory.pushState(historyState, '', url); 536 } catch (error) { 537 // They are going to lose state here, but there is no real 538 // way to warn them about it since the page will refresh... 539 window.location.assign(url); 540 } 541 542 applyTx(nextAction); 543 } 544 } 545 546 function replace(to, state) { 547 var nextAction = Action.Replace; 548 var nextLocation = getNextLocation(to, state); 549 550 function retry() { 551 replace(to, state); 552 } 553 554 false ? 0 : void 0; 555 556 if (allowTx(nextAction, nextLocation, retry)) { 557 var _getHistoryStateAndUr4 = getHistoryStateAndUrl(nextLocation, index), 558 historyState = _getHistoryStateAndUr4[0], 559 url = _getHistoryStateAndUr4[1]; // TODO: Support forced reloading 560 561 562 globalHistory.replaceState(historyState, '', url); 563 applyTx(nextAction); 564 } 565 } 566 567 function go(delta) { 568 globalHistory.go(delta); 569 } 570 571 var history = { 572 get action() { 573 return action; 574 }, 575 576 get location() { 577 return location; 578 }, 579 580 createHref: createHref, 581 push: push, 582 replace: replace, 583 go: go, 584 back: function back() { 585 go(-1); 586 }, 587 forward: function forward() { 588 go(1); 589 }, 590 listen: function listen(listener) { 591 return listeners.push(listener); 592 }, 593 block: function block(blocker) { 594 var unblock = blockers.push(blocker); 595 596 if (blockers.length === 1) { 597 window.addEventListener(BeforeUnloadEventType, promptBeforeUnload); 598 } 599 600 return function () { 601 unblock(); // Remove the beforeunload listener so the document may 602 // still be salvageable in the pagehide event. 603 // See https://html.spec.whatwg.org/#unloading-documents 604 605 if (!blockers.length) { 606 window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload); 607 } 608 }; 609 } 610 }; 611 return history; 612 } 613 /** 614 * Memory history stores the current location in memory. It is designed for use 615 * in stateful non-browser environments like tests and React Native. 616 * 617 * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#creatememoryhistory 618 */ 619 620 function createMemoryHistory(options) { 621 if (options === void 0) { 622 options = {}; 623 } 624 625 var _options3 = options, 626 _options3$initialEntr = _options3.initialEntries, 627 initialEntries = _options3$initialEntr === void 0 ? ['/'] : _options3$initialEntr, 628 initialIndex = _options3.initialIndex; 629 var entries = initialEntries.map(function (entry) { 630 var location = readOnly(_extends({ 631 pathname: '/', 632 search: '', 633 hash: '', 634 state: null, 635 key: createKey() 636 }, typeof entry === 'string' ? parsePath(entry) : entry)); 637 false ? 0 : void 0; 638 return location; 639 }); 640 var index = clamp(initialIndex == null ? entries.length - 1 : initialIndex, 0, entries.length - 1); 641 var action = Action.Pop; 642 var location = entries[index]; 643 var listeners = createEvents(); 644 var blockers = createEvents(); 645 646 function createHref(to) { 647 return typeof to === 'string' ? to : createPath(to); 648 } 649 650 function getNextLocation(to, state) { 651 if (state === void 0) { 652 state = null; 653 } 654 655 return readOnly(_extends({ 656 pathname: location.pathname, 657 search: '', 658 hash: '' 659 }, typeof to === 'string' ? parsePath(to) : to, { 660 state: state, 661 key: createKey() 662 })); 663 } 664 665 function allowTx(action, location, retry) { 666 return !blockers.length || (blockers.call({ 667 action: action, 668 location: location, 669 retry: retry 670 }), false); 671 } 672 673 function applyTx(nextAction, nextLocation) { 674 action = nextAction; 675 location = nextLocation; 676 listeners.call({ 677 action: action, 678 location: location 679 }); 680 } 681 682 function push(to, state) { 683 var nextAction = Action.Push; 684 var nextLocation = getNextLocation(to, state); 685 686 function retry() { 687 push(to, state); 688 } 689 690 false ? 0 : void 0; 691 692 if (allowTx(nextAction, nextLocation, retry)) { 693 index += 1; 694 entries.splice(index, entries.length, nextLocation); 695 applyTx(nextAction, nextLocation); 696 } 697 } 698 699 function replace(to, state) { 700 var nextAction = Action.Replace; 701 var nextLocation = getNextLocation(to, state); 702 703 function retry() { 704 replace(to, state); 705 } 706 707 false ? 0 : void 0; 708 709 if (allowTx(nextAction, nextLocation, retry)) { 710 entries[index] = nextLocation; 711 applyTx(nextAction, nextLocation); 712 } 713 } 714 715 function go(delta) { 716 var nextIndex = clamp(index + delta, 0, entries.length - 1); 717 var nextAction = Action.Pop; 718 var nextLocation = entries[nextIndex]; 719 720 function retry() { 721 go(delta); 722 } 723 724 if (allowTx(nextAction, nextLocation, retry)) { 725 index = nextIndex; 726 applyTx(nextAction, nextLocation); 727 } 728 } 729 730 var history = { 731 get index() { 732 return index; 733 }, 734 735 get action() { 736 return action; 737 }, 738 739 get location() { 740 return location; 741 }, 742 743 createHref: createHref, 744 push: push, 745 replace: replace, 746 go: go, 747 back: function back() { 748 go(-1); 749 }, 750 forward: function forward() { 751 go(1); 752 }, 753 listen: function listen(listener) { 754 return listeners.push(listener); 755 }, 756 block: function block(blocker) { 757 return blockers.push(blocker); 758 } 759 }; 760 return history; 761 } //////////////////////////////////////////////////////////////////////////////// 762 // UTILS 763 //////////////////////////////////////////////////////////////////////////////// 764 765 function clamp(n, lowerBound, upperBound) { 766 return Math.min(Math.max(n, lowerBound), upperBound); 767 } 768 769 function promptBeforeUnload(event) { 770 // Cancel the event. 771 event.preventDefault(); // Chrome (and legacy IE) requires returnValue to be set. 772 773 event.returnValue = ''; 774 } 775 776 function createEvents() { 777 var handlers = []; 778 return { 779 get length() { 780 return handlers.length; 781 }, 782 783 push: function push(fn) { 784 handlers.push(fn); 785 return function () { 786 handlers = handlers.filter(function (handler) { 787 return handler !== fn; 788 }); 789 }; 790 }, 791 call: function call(arg) { 792 handlers.forEach(function (fn) { 793 return fn && fn(arg); 794 }); 795 } 796 }; 797 } 798 799 function createKey() { 800 return Math.random().toString(36).substr(2, 8); 801 } 802 /** 803 * Creates a string URL path from the given pathname, search, and hash components. 804 * 805 * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createpath 806 */ 807 808 809 function createPath(_ref) { 810 var _ref$pathname = _ref.pathname, 811 pathname = _ref$pathname === void 0 ? '/' : _ref$pathname, 812 _ref$search = _ref.search, 813 search = _ref$search === void 0 ? '' : _ref$search, 814 _ref$hash = _ref.hash, 815 hash = _ref$hash === void 0 ? '' : _ref$hash; 816 if (search && search !== '?') pathname += search.charAt(0) === '?' ? search : '?' + search; 817 if (hash && hash !== '#') pathname += hash.charAt(0) === '#' ? hash : '#' + hash; 818 return pathname; 819 } 820 /** 821 * Parses a string URL path into its separate pathname, search, and hash components. 822 * 823 * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#parsepath 824 */ 825 826 function parsePath(path) { 827 var parsedPath = {}; 828 829 if (path) { 830 var hashIndex = path.indexOf('#'); 831 832 if (hashIndex >= 0) { 833 parsedPath.hash = path.substr(hashIndex); 834 path = path.substr(0, hashIndex); 835 } 836 837 var searchIndex = path.indexOf('?'); 838 839 if (searchIndex >= 0) { 840 parsedPath.search = path.substr(searchIndex); 841 path = path.substr(0, searchIndex); 842 } 843 844 if (path) { 845 parsedPath.pathname = path; 846 } 847 } 848 849 return parsedPath; 850 } 851 852 853 854 ;// CONCATENATED MODULE: external ["wp","url"] 855 const external_wp_url_namespaceObject = window["wp"]["url"]; 856 ;// CONCATENATED MODULE: ./node_modules/@wordpress/router/build-module/history.js 857 /** 858 * External dependencies 859 */ 860 861 862 /** 863 * WordPress dependencies 864 */ 865 866 const history_history = createBrowserHistory(); 867 const originalHistoryPush = history_history.push; 868 const originalHistoryReplace = history_history.replace; 869 function push(params, state) { 870 const currentArgs = (0,external_wp_url_namespaceObject.getQueryArgs)(window.location.href); 871 const currentUrlWithoutArgs = (0,external_wp_url_namespaceObject.removeQueryArgs)(window.location.href, ...Object.keys(currentArgs)); 872 const newUrl = (0,external_wp_url_namespaceObject.addQueryArgs)(currentUrlWithoutArgs, params); 873 return originalHistoryPush.call(history_history, newUrl, state); 874 } 875 function replace(params, state) { 876 const currentArgs = (0,external_wp_url_namespaceObject.getQueryArgs)(window.location.href); 877 const currentUrlWithoutArgs = (0,external_wp_url_namespaceObject.removeQueryArgs)(window.location.href, ...Object.keys(currentArgs)); 878 const newUrl = (0,external_wp_url_namespaceObject.addQueryArgs)(currentUrlWithoutArgs, params); 879 return originalHistoryReplace.call(history_history, newUrl, state); 880 } 881 history_history.push = push; 882 history_history.replace = replace; 883 /* harmony default export */ const build_module_history = (history_history); 884 885 ;// CONCATENATED MODULE: ./node_modules/@wordpress/router/build-module/router.js 886 887 /** 888 * WordPress dependencies 889 */ 890 891 892 /** 893 * Internal dependencies 894 */ 895 896 const RoutesContext = (0,external_wp_element_namespaceObject.createContext)(); 897 const HistoryContext = (0,external_wp_element_namespaceObject.createContext)(); 898 function useLocation() { 899 return (0,external_wp_element_namespaceObject.useContext)(RoutesContext); 900 } 901 function useHistory() { 902 return (0,external_wp_element_namespaceObject.useContext)(HistoryContext); 903 } 904 function getLocationWithParams(location) { 905 const searchParams = new URLSearchParams(location.search); 906 return { 907 ...location, 908 params: Object.fromEntries(searchParams.entries()) 909 }; 910 } 911 function RouterProvider({ 912 children 913 }) { 914 const [location, setLocation] = (0,external_wp_element_namespaceObject.useState)(() => getLocationWithParams(build_module_history.location)); 915 (0,external_wp_element_namespaceObject.useEffect)(() => { 916 return build_module_history.listen(({ 917 location: updatedLocation 918 }) => { 919 setLocation(getLocationWithParams(updatedLocation)); 920 }); 921 }, []); 922 return (0,external_React_namespaceObject.createElement)(HistoryContext.Provider, { 923 value: build_module_history 924 }, (0,external_React_namespaceObject.createElement)(RoutesContext.Provider, { 925 value: location 926 }, children)); 927 } 928 929 ;// CONCATENATED MODULE: external ["wp","privateApis"] 930 const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; 931 ;// CONCATENATED MODULE: ./node_modules/@wordpress/router/build-module/lock-unlock.js 932 /** 933 * WordPress dependencies 934 */ 935 936 const { 937 lock, 938 unlock 939 } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/router'); 940 941 ;// CONCATENATED MODULE: ./node_modules/@wordpress/router/build-module/private-apis.js 942 /** 943 * Internal dependencies 944 */ 945 946 947 const privateApis = {}; 948 lock(privateApis, { 949 useHistory: useHistory, 950 useLocation: useLocation, 951 RouterProvider: RouterProvider 952 }); 953 954 ;// CONCATENATED MODULE: ./node_modules/@wordpress/router/build-module/index.js 955 956 957 (window.wp = window.wp || {}).router = __webpack_exports__; 958 /******/ })() 959 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Sat Apr 27 08:20:02 2024 | Cross-referenced by PHPXref |