[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/dist/ -> dom.js (source)

   1  this["wp"] = this["wp"] || {}; this["wp"]["dom"] =
   2  /******/ (function(modules) { // webpackBootstrap
   3  /******/     // The module cache
   4  /******/     var installedModules = {};
   5  /******/
   6  /******/     // The require function
   7  /******/ 	function __webpack_require__(moduleId) {
   8  /******/
   9  /******/         // Check if module is in cache
  10  /******/         if(installedModules[moduleId]) {
  11  /******/             return installedModules[moduleId].exports;
  12  /******/         }
  13  /******/         // Create a new module (and put it into the cache)
  14  /******/         var module = installedModules[moduleId] = {
  15  /******/             i: moduleId,
  16  /******/             l: false,
  17  /******/             exports: {}
  18  /******/         };
  19  /******/
  20  /******/         // Execute the module function
  21  /******/         modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22  /******/
  23  /******/         // Flag the module as loaded
  24  /******/         module.l = true;
  25  /******/
  26  /******/         // Return the exports of the module
  27  /******/         return module.exports;
  28  /******/     }
  29  /******/
  30  /******/
  31  /******/     // expose the modules object (__webpack_modules__)
  32  /******/     __webpack_require__.m = modules;
  33  /******/
  34  /******/     // expose the module cache
  35  /******/     __webpack_require__.c = installedModules;
  36  /******/
  37  /******/     // define getter function for harmony exports
  38  /******/     __webpack_require__.d = function(exports, name, getter) {
  39  /******/         if(!__webpack_require__.o(exports, name)) {
  40  /******/             Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41  /******/         }
  42  /******/     };
  43  /******/
  44  /******/     // define __esModule on exports
  45  /******/     __webpack_require__.r = function(exports) {
  46  /******/         if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47  /******/             Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48  /******/         }
  49  /******/         Object.defineProperty(exports, '__esModule', { value: true });
  50  /******/     };
  51  /******/
  52  /******/     // create a fake namespace object
  53  /******/     // mode & 1: value is a module id, require it
  54  /******/     // mode & 2: merge all properties of value into the ns
  55  /******/     // mode & 4: return value when already ns object
  56  /******/     // mode & 8|1: behave like require
  57  /******/     __webpack_require__.t = function(value, mode) {
  58  /******/         if(mode & 1) value = __webpack_require__(value);
  59  /******/         if(mode & 8) return value;
  60  /******/         if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61  /******/         var ns = Object.create(null);
  62  /******/         __webpack_require__.r(ns);
  63  /******/         Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64  /******/         if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65  /******/         return ns;
  66  /******/     };
  67  /******/
  68  /******/     // getDefaultExport function for compatibility with non-harmony modules
  69  /******/     __webpack_require__.n = function(module) {
  70  /******/         var getter = module && module.__esModule ?
  71  /******/ 			function getDefault() { return module['default']; } :
  72  /******/ 			function getModuleExports() { return module; };
  73  /******/         __webpack_require__.d(getter, 'a', getter);
  74  /******/         return getter;
  75  /******/     };
  76  /******/
  77  /******/     // Object.prototype.hasOwnProperty.call
  78  /******/     __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79  /******/
  80  /******/     // __webpack_public_path__
  81  /******/     __webpack_require__.p = "";
  82  /******/
  83  /******/
  84  /******/     // Load entry module and return exports
  85  /******/     return __webpack_require__(__webpack_require__.s = 455);
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ 15:
  91  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  92  
  93  "use strict";
  94  
  95  // EXPORTS
  96  __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; });
  97  
  98  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
  99  var arrayLikeToArray = __webpack_require__(24);
 100  
 101  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
 102  
 103  function _arrayWithoutHoles(arr) {
 104    if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr);
 105  }
 106  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
 107  var iterableToArray = __webpack_require__(42);
 108  
 109  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
 110  var unsupportedIterableToArray = __webpack_require__(28);
 111  
 112  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
 113  function _nonIterableSpread() {
 114    throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
 115  }
 116  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
 117  
 118  
 119  
 120  
 121  function _toConsumableArray(arr) {
 122    return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread();
 123  }
 124  
 125  /***/ }),
 126  
 127  /***/ 2:
 128  /***/ (function(module, exports) {
 129  
 130  (function() { module.exports = window["lodash"]; }());
 131  
 132  /***/ }),
 133  
 134  /***/ 24:
 135  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 136  
 137  "use strict";
 138  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; });
 139  function _arrayLikeToArray(arr, len) {
 140    if (len == null || len > arr.length) len = arr.length;
 141  
 142    for (var i = 0, arr2 = new Array(len); i < len; i++) {
 143      arr2[i] = arr[i];
 144    }
 145  
 146    return arr2;
 147  }
 148  
 149  /***/ }),
 150  
 151  /***/ 28:
 152  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 153  
 154  "use strict";
 155  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; });
 156  /* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(24);
 157  
 158  function _unsupportedIterableToArray(o, minLen) {
 159    if (!o) return;
 160    if (typeof o === "string") return Object(_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
 161    var n = Object.prototype.toString.call(o).slice(8, -1);
 162    if (n === "Object" && o.constructor) n = o.constructor.name;
 163    if (n === "Map" || n === "Set") return Array.from(o);
 164    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
 165  }
 166  
 167  /***/ }),
 168  
 169  /***/ 42:
 170  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 171  
 172  "use strict";
 173  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
 174  function _iterableToArray(iter) {
 175    if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
 176  }
 177  
 178  /***/ }),
 179  
 180  /***/ 455:
 181  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 182  
 183  "use strict";
 184  // ESM COMPAT FLAG
 185  __webpack_require__.r(__webpack_exports__);
 186  
 187  // EXPORTS
 188  __webpack_require__.d(__webpack_exports__, "focus", function() { return /* binding */ build_module_focus; });
 189  __webpack_require__.d(__webpack_exports__, "computeCaretRect", function() { return /* reexport */ computeCaretRect; });
 190  __webpack_require__.d(__webpack_exports__, "documentHasTextSelection", function() { return /* reexport */ documentHasTextSelection; });
 191  __webpack_require__.d(__webpack_exports__, "documentHasUncollapsedSelection", function() { return /* reexport */ documentHasUncollapsedSelection; });
 192  __webpack_require__.d(__webpack_exports__, "documentHasSelection", function() { return /* reexport */ documentHasSelection; });
 193  __webpack_require__.d(__webpack_exports__, "getRectangleFromRange", function() { return /* reexport */ getRectangleFromRange; });
 194  __webpack_require__.d(__webpack_exports__, "getScrollContainer", function() { return /* reexport */ getScrollContainer; });
 195  __webpack_require__.d(__webpack_exports__, "getOffsetParent", function() { return /* reexport */ getOffsetParent; });
 196  __webpack_require__.d(__webpack_exports__, "isEntirelySelected", function() { return /* reexport */ isEntirelySelected; });
 197  __webpack_require__.d(__webpack_exports__, "isHorizontalEdge", function() { return /* reexport */ isHorizontalEdge; });
 198  __webpack_require__.d(__webpack_exports__, "isNumberInput", function() { return /* reexport */ isNumberInput; });
 199  __webpack_require__.d(__webpack_exports__, "isTextField", function() { return /* reexport */ isTextField; });
 200  __webpack_require__.d(__webpack_exports__, "isVerticalEdge", function() { return /* reexport */ isVerticalEdge; });
 201  __webpack_require__.d(__webpack_exports__, "placeCaretAtHorizontalEdge", function() { return /* reexport */ placeCaretAtHorizontalEdge; });
 202  __webpack_require__.d(__webpack_exports__, "placeCaretAtVerticalEdge", function() { return /* reexport */ placeCaretAtVerticalEdge; });
 203  __webpack_require__.d(__webpack_exports__, "replace", function() { return /* reexport */ replace; });
 204  __webpack_require__.d(__webpack_exports__, "remove", function() { return /* reexport */ remove; });
 205  __webpack_require__.d(__webpack_exports__, "insertAfter", function() { return /* reexport */ insertAfter; });
 206  __webpack_require__.d(__webpack_exports__, "unwrap", function() { return /* reexport */ unwrap; });
 207  __webpack_require__.d(__webpack_exports__, "replaceTag", function() { return /* reexport */ replaceTag; });
 208  __webpack_require__.d(__webpack_exports__, "wrap", function() { return /* reexport */ wrap; });
 209  __webpack_require__.d(__webpack_exports__, "__unstableStripHTML", function() { return /* reexport */ stripHTML; });
 210  __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return /* reexport */ isEmpty; });
 211  __webpack_require__.d(__webpack_exports__, "removeInvalidHTML", function() { return /* reexport */ removeInvalidHTML; });
 212  __webpack_require__.d(__webpack_exports__, "getPhrasingContentSchema", function() { return /* reexport */ getPhrasingContentSchema; });
 213  __webpack_require__.d(__webpack_exports__, "isPhrasingContent", function() { return /* reexport */ isPhrasingContent; });
 214  __webpack_require__.d(__webpack_exports__, "isTextContent", function() { return /* reexport */ isTextContent; });
 215  __webpack_require__.d(__webpack_exports__, "getFilesFromDataTransfer", function() { return /* reexport */ getFilesFromDataTransfer; });
 216  
 217  // NAMESPACE OBJECT: ./node_modules/@wordpress/dom/build-module/focusable.js
 218  var focusable_namespaceObject = {};
 219  __webpack_require__.r(focusable_namespaceObject);
 220  __webpack_require__.d(focusable_namespaceObject, "find", function() { return find; });
 221  
 222  // NAMESPACE OBJECT: ./node_modules/@wordpress/dom/build-module/tabbable.js
 223  var tabbable_namespaceObject = {};
 224  __webpack_require__.r(tabbable_namespaceObject);
 225  __webpack_require__.d(tabbable_namespaceObject, "isTabbableIndex", function() { return isTabbableIndex; });
 226  __webpack_require__.d(tabbable_namespaceObject, "find", function() { return tabbable_find; });
 227  __webpack_require__.d(tabbable_namespaceObject, "findPrevious", function() { return findPrevious; });
 228  __webpack_require__.d(tabbable_namespaceObject, "findNext", function() { return findNext; });
 229  
 230  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/focusable.js
 231  /**
 232   * References:
 233   *
 234   * Focusable:
 235   *  - https://www.w3.org/TR/html5/editing.html#focus-management
 236   *
 237   * Sequential focus navigation:
 238   *  - https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute
 239   *
 240   * Disabled elements:
 241   *  - https://www.w3.org/TR/html5/disabled-elements.html#disabled-elements
 242   *
 243   * getClientRects algorithm (requiring layout box):
 244   *  - https://www.w3.org/TR/cssom-view-1/#extension-to-the-element-interface
 245   *
 246   * AREA elements associated with an IMG:
 247   *  - https://w3c.github.io/html/editing.html#data-model
 248   */
 249  var SELECTOR = ['[tabindex]', 'a[href]', 'button:not([disabled])', 'input:not([type="hidden"]):not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', 'iframe', 'object', 'embed', 'area[href]', '[contenteditable]:not([contenteditable=false])'].join(',');
 250  /**
 251   * Returns true if the specified element is visible (i.e. neither display: none
 252   * nor visibility: hidden).
 253   *
 254   * @param {HTMLElement} element DOM element to test.
 255   *
 256   * @return {boolean} Whether element is visible.
 257   */
 258  
 259  function isVisible(element) {
 260    return element.offsetWidth > 0 || element.offsetHeight > 0 || element.getClientRects().length > 0;
 261  }
 262  /**
 263   * Returns true if the specified element should be skipped from focusable elements.
 264   * For now it rather specific for `iframes` and  if tabindex attribute is set to -1.
 265   *
 266   * @param {Element} element DOM element to test.
 267   *
 268   * @return {boolean} Whether element should be skipped from focusable elements.
 269   */
 270  
 271  
 272  function skipFocus(element) {
 273    return element.nodeName.toLowerCase() === 'iframe' && element.getAttribute('tabindex') === '-1';
 274  }
 275  /**
 276   * Returns true if the specified area element is a valid focusable element, or
 277   * false otherwise. Area is only focusable if within a map where a named map
 278   * referenced by an image somewhere in the document.
 279   *
 280   * @param {HTMLAreaElement} element DOM area element to test.
 281   *
 282   * @return {boolean} Whether area element is valid for focus.
 283   */
 284  
 285  
 286  function isValidFocusableArea(element) {
 287    /** @type {HTMLMapElement | null} */
 288    var map = element.closest('map[name]');
 289  
 290    if (!map) {
 291      return false;
 292    }
 293    /** @type {HTMLImageElement | null} */
 294  
 295  
 296    var img = element.ownerDocument.querySelector('img[usemap="#' + map.name + '"]');
 297    return !!img && isVisible(img);
 298  }
 299  /**
 300   * Returns all focusable elements within a given context.
 301   *
 302   * @param {Element} context Element in which to search.
 303   *
 304   * @return {Element[]} Focusable elements.
 305   */
 306  
 307  
 308  function find(context) {
 309    /* eslint-disable jsdoc/no-undefined-types */
 310  
 311    /** @type {NodeListOf<HTMLElement>} */
 312  
 313    /* eslint-enable jsdoc/no-undefined-types */
 314    var elements = context.querySelectorAll(SELECTOR);
 315    return Array.from(elements).filter(function (element) {
 316      if (!isVisible(element) || skipFocus(element)) {
 317        return false;
 318      }
 319  
 320      var nodeName = element.nodeName;
 321  
 322      if ('AREA' === nodeName) {
 323        return isValidFocusableArea(
 324        /** @type {HTMLAreaElement} */
 325        element);
 326      }
 327  
 328      return true;
 329    });
 330  }
 331  
 332  // EXTERNAL MODULE: external "lodash"
 333  var external_lodash_ = __webpack_require__(2);
 334  
 335  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/tabbable.js
 336  /**
 337   * External dependencies
 338   */
 339  
 340  /**
 341   * Internal dependencies
 342   */
 343  
 344  
 345  /**
 346   * Returns the tab index of the given element. In contrast with the tabIndex
 347   * property, this normalizes the default (0) to avoid browser inconsistencies,
 348   * operating under the assumption that this function is only ever called with a
 349   * focusable node.
 350   *
 351   * @see https://bugzilla.mozilla.org/show_bug.cgi?id=1190261
 352   *
 353   * @param {Element} element Element from which to retrieve.
 354   *
 355   * @return {number} Tab index of element (default 0).
 356   */
 357  
 358  function getTabIndex(element) {
 359    var tabIndex = element.getAttribute('tabindex');
 360    return tabIndex === null ? 0 : parseInt(tabIndex, 10);
 361  }
 362  /**
 363   * Returns true if the specified element is tabbable, or false otherwise.
 364   *
 365   * @param {Element} element Element to test.
 366   *
 367   * @return {boolean} Whether element is tabbable.
 368   */
 369  
 370  
 371  function isTabbableIndex(element) {
 372    return getTabIndex(element) !== -1;
 373  }
 374  /** @typedef {Element & { type?: string, checked?: boolean, name?: string }} MaybeHTMLInputElement */
 375  
 376  /**
 377   * Returns a stateful reducer function which constructs a filtered array of
 378   * tabbable elements, where at most one radio input is selected for a given
 379   * name, giving priority to checked input, falling back to the first
 380   * encountered.
 381   *
 382   * @return {(acc: MaybeHTMLInputElement[], el: MaybeHTMLInputElement) => MaybeHTMLInputElement[]} Radio group collapse reducer.
 383   */
 384  
 385  function createStatefulCollapseRadioGroup() {
 386    /** @type {Record<string, MaybeHTMLInputElement>} */
 387    var CHOSEN_RADIO_BY_NAME = {};
 388    return function collapseRadioGroup(
 389    /** @type {MaybeHTMLInputElement[]} */
 390    result,
 391    /** @type {MaybeHTMLInputElement} */
 392    element) {
 393      var nodeName = element.nodeName,
 394          type = element.type,
 395          checked = element.checked,
 396          name = element.name; // For all non-radio tabbables, construct to array by concatenating.
 397  
 398      if (nodeName !== 'INPUT' || type !== 'radio' || !name) {
 399        return result.concat(element);
 400      }
 401  
 402      var hasChosen = CHOSEN_RADIO_BY_NAME.hasOwnProperty(name); // Omit by skipping concatenation if the radio element is not chosen.
 403  
 404      var isChosen = checked || !hasChosen;
 405  
 406      if (!isChosen) {
 407        return result;
 408      } // At this point, if there had been a chosen element, the current
 409      // element is checked and should take priority. Retroactively remove
 410      // the element which had previously been considered the chosen one.
 411  
 412  
 413      if (hasChosen) {
 414        var hadChosenElement = CHOSEN_RADIO_BY_NAME[name];
 415        result = Object(external_lodash_["without"])(result, hadChosenElement);
 416      }
 417  
 418      CHOSEN_RADIO_BY_NAME[name] = element;
 419      return result.concat(element);
 420    };
 421  }
 422  /**
 423   * An array map callback, returning an object with the element value and its
 424   * array index location as properties. This is used to emulate a proper stable
 425   * sort where equal tabIndex should be left in order of their occurrence in the
 426   * document.
 427   *
 428   * @param {Element} element Element.
 429   * @param {number}  index   Array index of element.
 430   *
 431   * @return {{ element: Element, index: number }} Mapped object with element, index.
 432   */
 433  
 434  
 435  function mapElementToObjectTabbable(element, index) {
 436    return {
 437      element: element,
 438      index: index
 439    };
 440  }
 441  /**
 442   * An array map callback, returning an element of the given mapped object's
 443   * element value.
 444   *
 445   * @param {{ element: Element }} object Mapped object with element.
 446   *
 447   * @return {Element} Mapped object element.
 448   */
 449  
 450  
 451  function mapObjectTabbableToElement(object) {
 452    return object.element;
 453  }
 454  /**
 455   * A sort comparator function used in comparing two objects of mapped elements.
 456   *
 457   * @see mapElementToObjectTabbable
 458   *
 459   * @param {{ element: Element, index: number }} a First object to compare.
 460   * @param {{ element: Element, index: number }} b Second object to compare.
 461   *
 462   * @return {number} Comparator result.
 463   */
 464  
 465  
 466  function compareObjectTabbables(a, b) {
 467    var aTabIndex = getTabIndex(a.element);
 468    var bTabIndex = getTabIndex(b.element);
 469  
 470    if (aTabIndex === bTabIndex) {
 471      return a.index - b.index;
 472    }
 473  
 474    return aTabIndex - bTabIndex;
 475  }
 476  /**
 477   * Givin focusable elements, filters out tabbable element.
 478   *
 479   * @param {Element[]} focusables Focusable elements to filter.
 480   *
 481   * @return {Element[]} Tabbable elements.
 482   */
 483  
 484  
 485  function filterTabbable(focusables) {
 486    return focusables.filter(isTabbableIndex).map(mapElementToObjectTabbable).sort(compareObjectTabbables).map(mapObjectTabbableToElement).reduce(createStatefulCollapseRadioGroup(), []);
 487  }
 488  /**
 489   * @param {Element} context
 490   * @return {Element[]} Tabbable elements within the context.
 491   */
 492  
 493  
 494  function tabbable_find(context) {
 495    return filterTabbable(find(context));
 496  }
 497  /**
 498   * Given a focusable element, find the preceding tabbable element.
 499   *
 500   * @param {Element} element The focusable element before which to look. Defaults
 501   *                          to the active element.
 502   */
 503  
 504  function findPrevious(element) {
 505    var focusables = find(element.ownerDocument.body);
 506    var index = focusables.indexOf(element); // Remove all focusables after and including `element`.
 507  
 508    focusables.length = index;
 509    return Object(external_lodash_["last"])(filterTabbable(focusables));
 510  }
 511  /**
 512   * Given a focusable element, find the next tabbable element.
 513   *
 514   * @param {Element} element The focusable element after which to look. Defaults
 515   *                          to the active element.
 516   */
 517  
 518  function findNext(element) {
 519    var focusables = find(element.ownerDocument.body);
 520    var index = focusables.indexOf(element); // Remove all focusables before and inside `element`.
 521  
 522    var remaining = focusables.slice(index + 1).filter(function (node) {
 523      return !element.contains(node);
 524    });
 525    return Object(external_lodash_["first"])(filterTabbable(remaining));
 526  }
 527  
 528  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/utils/assert-is-defined.js
 529  function assertIsDefined(val, name) {
 530    if (false) {}
 531  }
 532  
 533  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/get-rectangle-from-range.js
 534  /**
 535   * Internal dependencies
 536   */
 537  
 538  /**
 539   * Get the rectangle of a given Range.
 540   *
 541   * @param {Range} range The range.
 542   *
 543   * @return {DOMRect} The rectangle.
 544   */
 545  
 546  function getRectangleFromRange(range) {
 547    // For uncollapsed ranges, get the rectangle that bounds the contents of the
 548    // range; this a rectangle enclosing the union of the bounding rectangles
 549    // for all the elements in the range.
 550    if (!range.collapsed) {
 551      return range.getBoundingClientRect();
 552    }
 553  
 554    var _range = range,
 555        startContainer = _range.startContainer;
 556    var ownerDocument = startContainer.ownerDocument; // Correct invalid "BR" ranges. The cannot contain any children.
 557  
 558    if (startContainer.nodeName === 'BR') {
 559      var parentNode = startContainer.parentNode;
 560      assertIsDefined(parentNode, 'parentNode');
 561      var index =
 562      /** @type {Node[]} */
 563      Array.from(parentNode.childNodes).indexOf(startContainer);
 564      assertIsDefined(ownerDocument, 'ownerDocument');
 565      range = ownerDocument.createRange();
 566      range.setStart(parentNode, index);
 567      range.setEnd(parentNode, index);
 568    }
 569  
 570    var rect = range.getClientRects()[0]; // If the collapsed range starts (and therefore ends) at an element node,
 571    // `getClientRects` can be empty in some browsers. This can be resolved
 572    // by adding a temporary text node with zero-width space to the range.
 573    //
 574    // See: https://stackoverflow.com/a/6847328/995445
 575  
 576    if (!rect) {
 577      assertIsDefined(ownerDocument, 'ownerDocument');
 578      var padNode = ownerDocument.createTextNode("\u200B"); // Do not modify the live range.
 579  
 580      range = range.cloneRange();
 581      range.insertNode(padNode);
 582      rect = range.getClientRects()[0];
 583      assertIsDefined(padNode.parentNode, 'padNode.parentNode');
 584      padNode.parentNode.removeChild(padNode);
 585    }
 586  
 587    return rect;
 588  }
 589  
 590  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/compute-caret-rect.js
 591  /**
 592   * Internal dependencies
 593   */
 594  
 595  
 596  /**
 597   * Get the rectangle for the selection in a container.
 598   *
 599   * @param {Window} win The window of the selection.
 600   *
 601   * @return {DOMRect | null} The rectangle.
 602   */
 603  
 604  function computeCaretRect(win) {
 605    var selection = win.getSelection();
 606    assertIsDefined(selection, 'selection');
 607    var range = selection.rangeCount ? selection.getRangeAt(0) : null;
 608  
 609    if (!range) {
 610      return null;
 611    }
 612  
 613    return getRectangleFromRange(range);
 614  }
 615  
 616  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/document-has-text-selection.js
 617  /**
 618   * Internal dependencies
 619   */
 620  
 621  /**
 622   * Check whether the current document has selected text. This applies to ranges
 623   * of text in the document, and not selection inside <input> and <textarea>
 624   * elements.
 625   *
 626   * See: https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection#Related_objects.
 627   *
 628   * @param {Document} doc The document to check.
 629   *
 630   * @return {boolean} True if there is selection, false if not.
 631   */
 632  
 633  function documentHasTextSelection(doc) {
 634    assertIsDefined(doc.defaultView, 'doc.defaultView');
 635    var selection = doc.defaultView.getSelection();
 636    assertIsDefined(selection, 'selection');
 637    var range = selection.rangeCount ? selection.getRangeAt(0) : null;
 638    return !!range && !range.collapsed;
 639  }
 640  
 641  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-html-input-element.js
 642  /* eslint-disable jsdoc/valid-types */
 643  
 644  /**
 645   * @param {Node} node
 646   * @return {node is HTMLInputElement} Whether the node is an HTMLInputElement.
 647   */
 648  function isHTMLInputElement(node) {
 649    /* eslint-enable jsdoc/valid-types */
 650    return !!node && node.nodeName === 'INPUT';
 651  }
 652  
 653  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-text-field.js
 654  /**
 655   * Internal dependencies
 656   */
 657  
 658  /* eslint-disable jsdoc/valid-types */
 659  
 660  /**
 661   * Check whether the given element is a text field, where text field is defined
 662   * by the ability to select within the input, or that it is contenteditable.
 663   *
 664   * See: https://html.spec.whatwg.org/#textFieldSelection
 665   *
 666   * @param {Node} node The HTML element.
 667   * @return {element is HTMLElement} True if the element is an text field, false if not.
 668   */
 669  
 670  function isTextField(node) {
 671    /* eslint-enable jsdoc/valid-types */
 672    var nonTextInputs = ['button', 'checkbox', 'hidden', 'file', 'radio', 'image', 'range', 'reset', 'submit', 'number'];
 673    return isHTMLInputElement(node) && node.type && !nonTextInputs.includes(node.type) || node.nodeName === 'TEXTAREA' ||
 674    /** @type {HTMLElement} */
 675    node.contentEditable === 'true';
 676  }
 677  
 678  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-number-input.js
 679  /**
 680   * Internal dependencies
 681   */
 682  
 683  /* eslint-disable jsdoc/valid-types */
 684  
 685  /**
 686   * Check whether the given element is an input field of type number
 687   * and has a valueAsNumber
 688   *
 689   * @param {Node} node The HTML node.
 690   *
 691   * @return {node is HTMLInputElement} True if the node is input and holds a number.
 692   */
 693  
 694  function isNumberInput(node) {
 695    /* eslint-enable jsdoc/valid-types */
 696    return isHTMLInputElement(node) && node.type === 'number' && !!node.valueAsNumber;
 697  }
 698  
 699  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/input-field-has-uncollapsed-selection.js
 700  /**
 701   * Internal dependencies
 702   */
 703  
 704  
 705  /**
 706   * Check whether the given element, assumed an input field or textarea,
 707   * contains a (uncollapsed) selection of text.
 708   *
 709   * Note: this is perhaps an abuse of the term "selection", since these elements
 710   * manage selection differently and aren't covered by Selection#collapsed.
 711   *
 712   * See: https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection#Related_objects.
 713   *
 714   * @param {Element} element The HTML element.
 715   *
 716   * @return {boolean} Whether the input/textareaa element has some "selection".
 717   */
 718  
 719  function inputFieldHasUncollapsedSelection(element) {
 720    if (!isTextField(element) && !isNumberInput(element)) {
 721      return false;
 722    }
 723  
 724    try {
 725      var selectionStart =
 726      /** @type {HTMLInputElement | HTMLTextAreaElement} */
 727      element.selectionStart,
 728          selectionEnd = element.selectionEnd;
 729      return selectionStart !== null && selectionStart !== selectionEnd;
 730    } catch (error) {
 731      // Safari throws an exception when trying to get `selectionStart`
 732      // on non-text <input> elements (which, understandably, don't
 733      // have the text selection API). We catch this via a try/catch
 734      // block, as opposed to a more explicit check of the element's
 735      // input types, because of Safari's non-standard behavior. This
 736      // also means we don't have to worry about the list of input
 737      // types that support `selectionStart` changing as the HTML spec
 738      // evolves over time.
 739      return false;
 740    }
 741  }
 742  
 743  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/document-has-uncollapsed-selection.js
 744  /**
 745   * Internal dependencies
 746   */
 747  
 748  
 749  /**
 750   * Check whether the current document has any sort of selection. This includes
 751   * ranges of text across elements and any selection inside <input> and
 752   * <textarea> elements.
 753   *
 754   * @param {Document} doc The document to check.
 755   *
 756   * @return {boolean} Whether there is any sort of "selection" in the document.
 757   */
 758  
 759  function documentHasUncollapsedSelection(doc) {
 760    return documentHasTextSelection(doc) || !!doc.activeElement && inputFieldHasUncollapsedSelection(doc.activeElement);
 761  }
 762  
 763  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/document-has-selection.js
 764  /**
 765   * Internal dependencies
 766   */
 767  
 768  
 769  
 770  /**
 771   * Check whether the current document has a selection. This checks for both
 772   * focus in an input field and general text selection.
 773   *
 774   * @param {Document} doc The document to check.
 775   *
 776   * @return {boolean} True if there is selection, false if not.
 777   */
 778  
 779  function documentHasSelection(doc) {
 780    return !!doc.activeElement && (isTextField(doc.activeElement) || isNumberInput(doc.activeElement) || documentHasTextSelection(doc));
 781  }
 782  
 783  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/get-computed-style.js
 784  /**
 785   * Internal dependencies
 786   */
 787  
 788  /* eslint-disable jsdoc/valid-types */
 789  
 790  /**
 791   * @param {Element} element
 792   * @return {ReturnType<Window['getComputedStyle']>} The computed style for the element.
 793   */
 794  
 795  function getComputedStyle(element) {
 796    /* eslint-enable jsdoc/valid-types */
 797    assertIsDefined(element.ownerDocument.defaultView, 'element.ownerDocument.defaultView');
 798    return element.ownerDocument.defaultView.getComputedStyle(element);
 799  }
 800  
 801  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/get-scroll-container.js
 802  /**
 803   * Internal dependencies
 804   */
 805  
 806  /**
 807   * Given a DOM node, finds the closest scrollable container node.
 808   *
 809   * @param {Element | null} node Node from which to start.
 810   *
 811   * @return {Element | undefined} Scrollable container node, if found.
 812   */
 813  
 814  function getScrollContainer(node) {
 815    if (!node) {
 816      return undefined;
 817    } // Scrollable if scrollable height exceeds displayed...
 818  
 819  
 820    if (node.scrollHeight > node.clientHeight) {
 821      // ...except when overflow is defined to be hidden or visible
 822      var _getComputedStyle = getComputedStyle(node),
 823          overflowY = _getComputedStyle.overflowY;
 824  
 825      if (/(auto|scroll)/.test(overflowY)) {
 826        return node;
 827      }
 828    } // Continue traversing
 829  
 830  
 831    return getScrollContainer(
 832    /** @type {Element} */
 833    node.parentNode);
 834  }
 835  
 836  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/get-offset-parent.js
 837  /**
 838   * Internal dependencies
 839   */
 840  
 841  /**
 842   * Returns the closest positioned element, or null under any of the conditions
 843   * of the offsetParent specification. Unlike offsetParent, this function is not
 844   * limited to HTMLElement and accepts any Node (e.g. Node.TEXT_NODE).
 845   *
 846   * @see https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetparent
 847   *
 848   * @param {Node} node Node from which to find offset parent.
 849   *
 850   * @return {Node | null} Offset parent.
 851   */
 852  
 853  function getOffsetParent(node) {
 854    // Cannot retrieve computed style or offset parent only anything other than
 855    // an element node, so find the closest element node.
 856    var closestElement;
 857  
 858    while (closestElement =
 859    /** @type {Node} */
 860    node.parentNode) {
 861      if (closestElement.nodeType === closestElement.ELEMENT_NODE) {
 862        break;
 863      }
 864    }
 865  
 866    if (!closestElement) {
 867      return null;
 868    } // If the closest element is already positioned, return it, as offsetParent
 869    // does not otherwise consider the node itself.
 870  
 871  
 872    if (getComputedStyle(
 873    /** @type {Element} */
 874    closestElement).position !== 'static') {
 875      return closestElement;
 876    } // offsetParent is undocumented/draft
 877  
 878  
 879    return (
 880      /** @type {Node & { offsetParent: Node }} */
 881      closestElement.offsetParent
 882    );
 883  }
 884  
 885  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-input-or-text-area.js
 886  /* eslint-disable jsdoc/valid-types */
 887  
 888  /**
 889   * @param {Element} element
 890   * @return {element is HTMLInputElement | HTMLTextAreaElement} Whether the element is an input or textarea
 891   */
 892  function isInputOrTextArea(element) {
 893    /* eslint-enable jsdoc/valid-types */
 894    return element.tagName === 'INPUT' || element.tagName === 'TEXTAREA';
 895  }
 896  
 897  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-entirely-selected.js
 898  /**
 899   * Internal dependencies
 900   */
 901  
 902  
 903  /**
 904   * Check whether the contents of the element have been entirely selected.
 905   * Returns true if there is no possibility of selection.
 906   *
 907   * @param {HTMLElement} element The element to check.
 908   *
 909   * @return {boolean} True if entirely selected, false if not.
 910   */
 911  
 912  function isEntirelySelected(element) {
 913    if (isInputOrTextArea(element)) {
 914      return element.selectionStart === 0 && element.value.length === element.selectionEnd;
 915    }
 916  
 917    if (!element.isContentEditable) {
 918      return true;
 919    }
 920  
 921    var ownerDocument = element.ownerDocument;
 922    var defaultView = ownerDocument.defaultView;
 923    assertIsDefined(defaultView, 'defaultView');
 924    var selection = defaultView.getSelection();
 925    assertIsDefined(selection, 'selection');
 926    var range = selection.rangeCount ? selection.getRangeAt(0) : null;
 927  
 928    if (!range) {
 929      return true;
 930    }
 931  
 932    var startContainer = range.startContainer,
 933        endContainer = range.endContainer,
 934        startOffset = range.startOffset,
 935        endOffset = range.endOffset;
 936  
 937    if (startContainer === element && endContainer === element && startOffset === 0 && endOffset === element.childNodes.length) {
 938      return true;
 939    }
 940  
 941    var lastChild = element.lastChild;
 942    assertIsDefined(lastChild, 'lastChild');
 943    var lastChildContentLength = lastChild.nodeType === lastChild.TEXT_NODE ?
 944    /** @type {Text} */
 945    lastChild.data.length : lastChild.childNodes.length;
 946    return startContainer === element.firstChild && endContainer === element.lastChild && startOffset === 0 && endOffset === lastChildContentLength;
 947  }
 948  
 949  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
 950  var toConsumableArray = __webpack_require__(15);
 951  
 952  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/get-range-height.js
 953  
 954  
 955  /**
 956   * Gets the height of the range without ignoring zero width rectangles, which
 957   * some browsers ignore when creating a union.
 958   *
 959   * @param {Range} range The range to check.
 960   * @return {number | undefined} Height of the range or undefined if the range has no client rectangles.
 961   */
 962  function getRangeHeight(range) {
 963    var rects = Array.from(range.getClientRects());
 964  
 965    if (!rects.length) {
 966      return;
 967    }
 968  
 969    var highestTop = Math.min.apply(Math, Object(toConsumableArray["a" /* default */])(rects.map(function (_ref) {
 970      var top = _ref.top;
 971      return top;
 972    })));
 973    var lowestBottom = Math.max.apply(Math, Object(toConsumableArray["a" /* default */])(rects.map(function (_ref2) {
 974      var bottom = _ref2.bottom;
 975      return bottom;
 976    })));
 977    return lowestBottom - highestTop;
 978  }
 979  
 980  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-selection-forward.js
 981  /**
 982   * Internal dependencies
 983   */
 984  
 985  /**
 986   * Returns true if the given selection object is in the forward direction, or
 987   * false otherwise.
 988   *
 989   * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
 990   *
 991   * @param {Selection} selection Selection object to check.
 992   *
 993   * @return {boolean} Whether the selection is forward.
 994   */
 995  
 996  function isSelectionForward(selection) {
 997    var anchorNode = selection.anchorNode,
 998        focusNode = selection.focusNode,
 999        anchorOffset = selection.anchorOffset,
1000        focusOffset = selection.focusOffset;
1001    assertIsDefined(anchorNode, 'anchorNode');
1002    assertIsDefined(focusNode, 'focusNode');
1003    var position = anchorNode.compareDocumentPosition(focusNode); // Disable reason: `Node#compareDocumentPosition` returns a bitmask value,
1004    // so bitwise operators are intended.
1005  
1006    /* eslint-disable no-bitwise */
1007    // Compare whether anchor node precedes focus node. If focus node (where
1008    // end of selection occurs) is after the anchor node, it is forward.
1009  
1010    if (position & anchorNode.DOCUMENT_POSITION_PRECEDING) {
1011      return false;
1012    }
1013  
1014    if (position & anchorNode.DOCUMENT_POSITION_FOLLOWING) {
1015      return true;
1016    }
1017    /* eslint-enable no-bitwise */
1018    // `compareDocumentPosition` returns 0 when passed the same node, in which
1019    // case compare offsets.
1020  
1021  
1022    if (position === 0) {
1023      return anchorOffset <= focusOffset;
1024    } // This should never be reached, but return true as default case.
1025  
1026  
1027    return true;
1028  }
1029  
1030  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/caret-range-from-point.js
1031  /**
1032   * Polyfill.
1033   * Get a collapsed range for a given point.
1034   *
1035   * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/caretRangeFromPoint
1036   *
1037   * @param {Document} doc  The document of the range.
1038   * @param {number}   x    Horizontal position within the current viewport.
1039   * @param {number}   y    Vertical position within the current viewport.
1040   *
1041   * @return {Range | null} The best range for the given point.
1042   */
1043  function caretRangeFromPoint(doc, x, y) {
1044    if (doc.caretRangeFromPoint) {
1045      return doc.caretRangeFromPoint(x, y);
1046    }
1047  
1048    if (!doc.caretPositionFromPoint) {
1049      return null;
1050    }
1051  
1052    var point = doc.caretPositionFromPoint(x, y); // If x or y are negative, outside viewport, or there is no text entry node.
1053    // https://developer.mozilla.org/en-US/docs/Web/API/Document/caretRangeFromPoint
1054  
1055    if (!point) {
1056      return null;
1057    }
1058  
1059    var range = doc.createRange();
1060    range.setStart(point.offsetNode, point.offset);
1061    range.collapse(true);
1062    return range;
1063  }
1064  
1065  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/hidden-caret-range-from-point.js
1066  /**
1067   * Internal dependencies
1068   */
1069  
1070  
1071  /**
1072   * Get a collapsed range for a given point.
1073   * Gives the container a temporary high z-index (above any UI).
1074   * This is preferred over getting the UI nodes and set styles there.
1075   *
1076   * @param {Document} doc       The document of the range.
1077   * @param {number}    x         Horizontal position within the current viewport.
1078   * @param {number}    y         Vertical position within the current viewport.
1079   * @param {HTMLElement}  container Container in which the range is expected to be found.
1080   *
1081   * @return {?Range} The best range for the given point.
1082   */
1083  
1084  function hiddenCaretRangeFromPoint(doc, x, y, container) {
1085    var originalZIndex = container.style.zIndex;
1086    var originalPosition = container.style.position;
1087  
1088    var _getComputedStyle = getComputedStyle(container),
1089        _getComputedStyle$pos = _getComputedStyle.position,
1090        position = _getComputedStyle$pos === void 0 ? 'static' : _getComputedStyle$pos; // A z-index only works if the element position is not static.
1091  
1092  
1093    if (position === 'static') {
1094      container.style.position = 'relative';
1095    }
1096  
1097    container.style.zIndex = '10000';
1098    var range = caretRangeFromPoint(doc, x, y);
1099    container.style.zIndex = originalZIndex;
1100    container.style.position = originalPosition;
1101    return range;
1102  }
1103  
1104  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-edge.js
1105  /**
1106   * Internal dependencies
1107   */
1108  
1109  
1110  
1111  
1112  
1113  
1114  
1115  /**
1116   * Check whether the selection is at the edge of the container. Checks for
1117   * horizontal position by default. Set `onlyVertical` to true to check only
1118   * vertically.
1119   *
1120   * @param {Element} container Focusable element.
1121   * @param {boolean} isReverse Set to true to check left, false to check right.
1122   * @param {boolean} [onlyVertical=false] Set to true to check only vertical position.
1123   *
1124   * @return {boolean} True if at the edge, false if not.
1125   */
1126  
1127  function isEdge(container, isReverse) {
1128    var onlyVertical = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1129  
1130    if (isInputOrTextArea(container)) {
1131      if (container.selectionStart !== container.selectionEnd) {
1132        return false;
1133      }
1134  
1135      if (isReverse) {
1136        return container.selectionStart === 0;
1137      }
1138  
1139      return container.value.length === container.selectionStart;
1140    }
1141  
1142    if (!
1143    /** @type {HTMLElement} */
1144    container.isContentEditable) {
1145      return true;
1146    }
1147  
1148    var ownerDocument = container.ownerDocument;
1149    var defaultView = ownerDocument.defaultView;
1150    assertIsDefined(defaultView, 'defaultView');
1151    var selection = defaultView.getSelection();
1152  
1153    if (!selection || !selection.rangeCount) {
1154      return false;
1155    }
1156  
1157    var range = selection.getRangeAt(0);
1158    var collapsedRange = range.cloneRange();
1159    var isForward = isSelectionForward(selection);
1160    var isCollapsed = selection.isCollapsed; // Collapse in direction of selection.
1161  
1162    if (!isCollapsed) {
1163      collapsedRange.collapse(!isForward);
1164    }
1165  
1166    var collapsedRangeRect = getRectangleFromRange(collapsedRange);
1167    var rangeRect = getRectangleFromRange(range);
1168  
1169    if (!collapsedRangeRect || !rangeRect) {
1170      return false;
1171    } // Only consider the multiline selection at the edge if the direction is
1172    // towards the edge. The selection is multiline if it is taller than the
1173    // collapsed  selection.
1174  
1175  
1176    var rangeHeight = getRangeHeight(range);
1177  
1178    if (!isCollapsed && rangeHeight && rangeHeight > collapsedRangeRect.height && isForward === isReverse) {
1179      return false;
1180    } // In the case of RTL scripts, the horizontal edge is at the opposite side.
1181  
1182  
1183    var _getComputedStyle = getComputedStyle(container),
1184        direction = _getComputedStyle.direction;
1185  
1186    var isReverseDir = direction === 'rtl' ? !isReverse : isReverse;
1187    var containerRect = container.getBoundingClientRect(); // To check if a selection is at the edge, we insert a test selection at the
1188    // edge of the container and check if the selections have the same vertical
1189    // or horizontal position. If they do, the selection is at the edge.
1190    // This method proves to be better than a DOM-based calculation for the
1191    // horizontal edge, since it ignores empty textnodes and a trailing line
1192    // break element. In other words, we need to check visual positioning, not
1193    // DOM positioning.
1194    // It also proves better than using the computed style for the vertical
1195    // edge, because we cannot know the padding and line height reliably in
1196    // pixels. `getComputedStyle` may return a value with different units.
1197  
1198    var x = isReverseDir ? containerRect.left + 1 : containerRect.right - 1;
1199    var y = isReverse ? containerRect.top + 1 : containerRect.bottom - 1;
1200    var testRange = hiddenCaretRangeFromPoint(ownerDocument, x, y,
1201    /** @type {HTMLElement} */
1202    container);
1203  
1204    if (!testRange) {
1205      return false;
1206    }
1207  
1208    var testRect = getRectangleFromRange(testRange);
1209  
1210    if (!testRect) {
1211      return false;
1212    }
1213  
1214    var verticalSide = isReverse ? 'top' : 'bottom';
1215    var horizontalSide = isReverseDir ? 'left' : 'right';
1216    var verticalDiff = testRect[verticalSide] - rangeRect[verticalSide];
1217    var horizontalDiff = testRect[horizontalSide] - collapsedRangeRect[horizontalSide]; // Allow the position to be 1px off.
1218  
1219    var hasVerticalDiff = Math.abs(verticalDiff) <= 1;
1220    var hasHorizontalDiff = Math.abs(horizontalDiff) <= 1;
1221    return onlyVertical ? hasVerticalDiff : hasVerticalDiff && hasHorizontalDiff;
1222  }
1223  
1224  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-horizontal-edge.js
1225  /**
1226   * Internal dependencies
1227   */
1228  
1229  /**
1230   * Check whether the selection is horizontally at the edge of the container.
1231   *
1232   * @param {Element} container Focusable element.
1233   * @param {boolean} isReverse Set to true to check left, false for right.
1234   *
1235   * @return {boolean} True if at the horizontal edge, false if not.
1236   */
1237  
1238  function isHorizontalEdge(container, isReverse) {
1239    return isEdge(container, isReverse);
1240  }
1241  
1242  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-vertical-edge.js
1243  /**
1244   * Internal dependencies
1245   */
1246  
1247  /**
1248   * Check whether the selection is vertically at the edge of the container.
1249   *
1250   * @param {Element} container Focusable element.
1251   * @param {boolean} isReverse Set to true to check top, false for bottom.
1252   *
1253   * @return {boolean} True if at the vertical edge, false if not.
1254   */
1255  
1256  function isVerticalEdge(container, isReverse) {
1257    return isEdge(container, isReverse, true);
1258  }
1259  
1260  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/place-caret-at-horizontal-edge.js
1261  /**
1262   * Internal dependencies
1263   */
1264  
1265  /**
1266   * Internal dependencies
1267   */
1268  
1269  
1270  
1271  /**
1272   * Places the caret at start or end of a given element.
1273   *
1274   * @param {HTMLElement} container    Focusable element.
1275   * @param {boolean} isReverse    True for end, false for start.
1276   * @param {boolean} [mayUseScroll=false] Whether to allow scrolling.
1277   */
1278  
1279  function placeCaretAtHorizontalEdge(container, isReverse) {
1280    var mayUseScroll = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1281  
1282    if (!container) {
1283      return;
1284    }
1285  
1286    container.focus();
1287  
1288    if (isInputOrTextArea(container)) {
1289      // The element may not support selection setting.
1290      if (typeof container.selectionStart !== 'number') {
1291        return;
1292      }
1293  
1294      if (isReverse) {
1295        container.selectionStart = container.value.length;
1296        container.selectionEnd = container.value.length;
1297      } else {
1298        container.selectionStart = 0;
1299        container.selectionEnd = 0;
1300      }
1301  
1302      return;
1303    }
1304  
1305    if (!container.isContentEditable) {
1306      return;
1307    }
1308  
1309    var ownerDocument = container.ownerDocument;
1310    var containerRect = container.getBoundingClientRect(); // When placing at the end (isReverse), find the closest range to the bottom
1311    // right corner. When placing at the start, to the top left corner.
1312  
1313    var x = isReverse ? containerRect.right - 1 : containerRect.left + 1;
1314    var y = isReverse ? containerRect.bottom - 1 : containerRect.top + 1;
1315    var range = hiddenCaretRangeFromPoint(ownerDocument, x, y, container); // If no range range can be created or it is outside the container, the
1316    // element may be out of view.
1317  
1318    if (!range || !range.startContainer || !container.contains(range.startContainer)) {
1319      if (!mayUseScroll) {
1320        return;
1321      } // Only try to scroll into view once to avoid an infinite loop.
1322  
1323  
1324      mayUseScroll = false;
1325      container.scrollIntoView(isReverse);
1326      placeCaretAtHorizontalEdge(container, isReverse, mayUseScroll);
1327      return;
1328    }
1329  
1330    var defaultView = ownerDocument.defaultView;
1331    assertIsDefined(defaultView, 'defaultView');
1332    var selection = defaultView.getSelection();
1333    assertIsDefined(selection, 'selection');
1334    selection.removeAllRanges();
1335    selection.addRange(range);
1336  }
1337  
1338  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/place-caret-at-vertical-edge.js
1339  /**
1340   * Internal dependencies
1341   */
1342  
1343  
1344  
1345  /**
1346   * Places the caret at the top or bottom of a given element.
1347   *
1348   * @param {HTMLElement} container           Focusable element.
1349   * @param {boolean} isReverse           True for bottom, false for top.
1350   * @param {DOMRect} [rect]              The rectangle to position the caret with.
1351   * @param {boolean} [mayUseScroll=true] True to allow scrolling, false to disallow.
1352   */
1353  
1354  function placeCaretAtVerticalEdge(container, isReverse, rect) {
1355    var mayUseScroll = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
1356  
1357    if (!container) {
1358      return;
1359    }
1360  
1361    if (!rect || !container.isContentEditable) {
1362      placeCaretAtHorizontalEdge(container, isReverse);
1363      return;
1364    } // Offset by a buffer half the height of the caret rect. This is needed
1365    // because caretRangeFromPoint may default to the end of the selection if
1366    // offset is too close to the edge. It's unclear how to precisely calculate
1367    // this threshold; it may be the padded area of some combination of line
1368    // height, caret height, and font size. The buffer offset is effectively
1369    // equivalent to a point at half the height of a line of text.
1370  
1371  
1372    var buffer = rect.height / 2;
1373    var editableRect = container.getBoundingClientRect();
1374    var x = rect.left;
1375    var y = isReverse ? editableRect.bottom - buffer : editableRect.top + buffer;
1376    var ownerDocument = container.ownerDocument;
1377    var defaultView = ownerDocument.defaultView;
1378    var range = hiddenCaretRangeFromPoint(ownerDocument, x, y, container);
1379  
1380    if (!range || !container.contains(range.startContainer)) {
1381      if (mayUseScroll && (!range || !range.startContainer || !range.startContainer.contains(container))) {
1382        // Might be out of view.
1383        // Easier than attempting to calculate manually.
1384        container.scrollIntoView(isReverse);
1385        placeCaretAtVerticalEdge(container, isReverse, rect, false);
1386        return;
1387      }
1388  
1389      placeCaretAtHorizontalEdge(container, isReverse);
1390      return;
1391    }
1392  
1393    assertIsDefined(defaultView, 'defaultView');
1394    var selection = defaultView.getSelection();
1395    assertIsDefined(selection, 'selection');
1396    selection.removeAllRanges();
1397    selection.addRange(range);
1398    container.focus(); // Editable was already focussed, it goes back to old range...
1399    // This fixes it.
1400  
1401    selection.removeAllRanges();
1402    selection.addRange(range);
1403  }
1404  
1405  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/insert-after.js
1406  /**
1407   * Internal dependencies
1408   */
1409  
1410  /**
1411   * Given two DOM nodes, inserts the former in the DOM as the next sibling of
1412   * the latter.
1413   *
1414   * @param {Node} newNode       Node to be inserted.
1415   * @param {Node} referenceNode Node after which to perform the insertion.
1416   * @return {void}
1417   */
1418  
1419  function insertAfter(newNode, referenceNode) {
1420    assertIsDefined(referenceNode.parentNode, 'referenceNode.parentNode');
1421    referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
1422  }
1423  
1424  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/remove.js
1425  /**
1426   * Internal dependencies
1427   */
1428  
1429  /**
1430   * Given a DOM node, removes it from the DOM.
1431   *
1432   * @param {Node} node Node to be removed.
1433   * @return {void}
1434   */
1435  
1436  function remove(node) {
1437    assertIsDefined(node.parentNode, 'node.parentNode');
1438    node.parentNode.removeChild(node);
1439  }
1440  
1441  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/replace.js
1442  /**
1443   * Internal dependencies
1444   */
1445  
1446  
1447  
1448  /**
1449   * Given two DOM nodes, replaces the former with the latter in the DOM.
1450   *
1451   * @param {Element} processedNode Node to be removed.
1452   * @param {Element} newNode       Node to be inserted in its place.
1453   * @return {void}
1454   */
1455  
1456  function replace(processedNode, newNode) {
1457    assertIsDefined(processedNode.parentNode, 'processedNode.parentNode');
1458    insertAfter(newNode, processedNode.parentNode);
1459    remove(processedNode);
1460  }
1461  
1462  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/unwrap.js
1463  /**
1464   * Internal dependencies
1465   */
1466  
1467  /**
1468   * Unwrap the given node. This means any child nodes are moved to the parent.
1469   *
1470   * @param {Node} node The node to unwrap.
1471   *
1472   * @return {void}
1473   */
1474  
1475  function unwrap(node) {
1476    var parent = node.parentNode;
1477    assertIsDefined(parent, 'node.parentNode');
1478  
1479    while (node.firstChild) {
1480      parent.insertBefore(node.firstChild, node);
1481    }
1482  
1483    parent.removeChild(node);
1484  }
1485  
1486  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/replace-tag.js
1487  /**
1488   * Internal dependencies
1489   */
1490  
1491  /**
1492   * Replaces the given node with a new node with the given tag name.
1493   *
1494   * @param {Element}  node    The node to replace
1495   * @param {string}   tagName The new tag name.
1496   *
1497   * @return {Element} The new node.
1498   */
1499  
1500  function replaceTag(node, tagName) {
1501    var newNode = node.ownerDocument.createElement(tagName);
1502  
1503    while (node.firstChild) {
1504      newNode.appendChild(node.firstChild);
1505    }
1506  
1507    assertIsDefined(node.parentNode, 'node.parentNode');
1508    node.parentNode.replaceChild(newNode, node);
1509    return newNode;
1510  }
1511  
1512  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/wrap.js
1513  /**
1514   * Internal dependencies
1515   */
1516  
1517  /**
1518   * Wraps the given node with a new node with the given tag name.
1519   *
1520   * @param {Element} newNode       The node to insert.
1521   * @param {Element} referenceNode The node to wrap.
1522   */
1523  
1524  function wrap(newNode, referenceNode) {
1525    assertIsDefined(referenceNode.parentNode, 'referenceNode.parentNode');
1526    referenceNode.parentNode.insertBefore(newNode, referenceNode);
1527    newNode.appendChild(referenceNode);
1528  }
1529  
1530  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/strip-html.js
1531  /**
1532   * Removes any HTML tags from the provided string.
1533   *
1534   * @param {string} html The string containing html.
1535   *
1536   * @return {string} The text content with any html removed.
1537   */
1538  function stripHTML(html) {
1539    var document = new window.DOMParser().parseFromString(html, 'text/html');
1540    return document.body.textContent || '';
1541  }
1542  
1543  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-empty.js
1544  /**
1545   * Recursively checks if an element is empty. An element is not empty if it
1546   * contains text or contains elements with attributes such as images.
1547   *
1548   * @param {Element} element The element to check.
1549   *
1550   * @return {boolean} Whether or not the element is empty.
1551   */
1552  function isEmpty(element) {
1553    switch (element.nodeType) {
1554      case element.TEXT_NODE:
1555        // We cannot use \s since it includes special spaces which we want
1556        // to preserve.
1557        return /^[ \f\n\r\t\v\u00a0]*$/.test(element.nodeValue || '');
1558  
1559      case element.ELEMENT_NODE:
1560        if (element.hasAttributes()) {
1561          return false;
1562        } else if (!element.hasChildNodes()) {
1563          return true;
1564        }
1565  
1566        return (
1567          /** @type {Element[]} */
1568          Array.from(element.childNodes).every(isEmpty)
1569        );
1570  
1571      default:
1572        return true;
1573    }
1574  }
1575  
1576  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
1577  var defineProperty = __webpack_require__(5);
1578  
1579  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/phrasing-content.js
1580  
1581  
1582  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
1583  
1584  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1585  
1586  /**
1587   * External dependencies
1588   */
1589  
1590  /**
1591   * All phrasing content elements.
1592   *
1593   * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0
1594   */
1595  
1596  /**
1597   * @typedef {Record<string,SemanticElementDefinition>} ContentSchema
1598   */
1599  
1600  /**
1601   * @typedef SemanticElementDefinition
1602   * @property {string[]} [attributes] Content attributes
1603   * @property {ContentSchema} [children] Content attributes
1604   */
1605  
1606  /**
1607   * All text-level semantic elements.
1608   *
1609   * @see https://html.spec.whatwg.org/multipage/text-level-semantics.html
1610   *
1611   * @type {ContentSchema}
1612   */
1613  
1614  var textContentSchema = {
1615    strong: {},
1616    em: {},
1617    s: {},
1618    del: {},
1619    ins: {},
1620    a: {
1621      attributes: ['href', 'target', 'rel']
1622    },
1623    code: {},
1624    abbr: {
1625      attributes: ['title']
1626    },
1627    sub: {},
1628    sup: {},
1629    br: {},
1630    small: {},
1631    // To do: fix blockquote.
1632    // cite: {},
1633    q: {
1634      attributes: ['cite']
1635    },
1636    dfn: {
1637      attributes: ['title']
1638    },
1639    data: {
1640      attributes: ['value']
1641    },
1642    time: {
1643      attributes: ['datetime']
1644    },
1645    var: {},
1646    samp: {},
1647    kbd: {},
1648    i: {},
1649    b: {},
1650    u: {},
1651    mark: {},
1652    ruby: {},
1653    rt: {},
1654    rp: {},
1655    bdi: {
1656      attributes: ['dir']
1657    },
1658    bdo: {
1659      attributes: ['dir']
1660    },
1661    wbr: {},
1662    '#text': {}
1663  }; // Recursion is needed.
1664  // Possible: strong > em > strong.
1665  // Impossible: strong > strong.
1666  
1667  Object(external_lodash_["without"])(Object.keys(textContentSchema), '#text', 'br').forEach(function (tag) {
1668    textContentSchema[tag].children = Object(external_lodash_["omit"])(textContentSchema, tag);
1669  });
1670  /**
1671   * Embedded content elements.
1672   *
1673   * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#embedded-content-0
1674   *
1675   * @type {ContentSchema}
1676   */
1677  
1678  var embeddedContentSchema = {
1679    audio: {
1680      attributes: ['src', 'preload', 'autoplay', 'mediagroup', 'loop', 'muted']
1681    },
1682    canvas: {
1683      attributes: ['width', 'height']
1684    },
1685    embed: {
1686      attributes: ['src', 'type', 'width', 'height']
1687    },
1688    img: {
1689      attributes: ['alt', 'src', 'srcset', 'usemap', 'ismap', 'width', 'height']
1690    },
1691    object: {
1692      attributes: ['data', 'type', 'name', 'usemap', 'form', 'width', 'height']
1693    },
1694    video: {
1695      attributes: ['src', 'poster', 'preload', 'autoplay', 'mediagroup', 'loop', 'muted', 'controls', 'width', 'height']
1696    }
1697  };
1698  /**
1699   * Phrasing content elements.
1700   *
1701   * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0
1702   */
1703  
1704  var phrasingContentSchema = _objectSpread(_objectSpread({}, textContentSchema), embeddedContentSchema);
1705  /**
1706   * Get schema of possible paths for phrasing content.
1707   *
1708   * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content
1709   *
1710   * @param {string} [context] Set to "paste" to exclude invisible elements and
1711   *                         sensitive data.
1712   *
1713   * @return {Partial<ContentSchema>} Schema.
1714   */
1715  
1716  
1717  function getPhrasingContentSchema(context) {
1718    if (context !== 'paste') {
1719      return phrasingContentSchema;
1720    }
1721  
1722    return Object(external_lodash_["omit"])(_objectSpread(_objectSpread({}, phrasingContentSchema), {}, {
1723      // We shouldn't paste potentially sensitive information which is not
1724      // visible to the user when pasted, so strip the attributes.
1725      ins: {
1726        children: phrasingContentSchema.ins.children
1727      },
1728      del: {
1729        children: phrasingContentSchema.del.children
1730      }
1731    }), ['u', // Used to mark misspelling. Shouldn't be pasted.
1732    'abbr', // Invisible.
1733    'data', // Invisible.
1734    'time', // Invisible.
1735    'wbr', // Invisible.
1736    'bdi', // Invisible.
1737    'bdo' // Invisible.
1738    ]);
1739  }
1740  /**
1741   * Find out whether or not the given node is phrasing content.
1742   *
1743   * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content
1744   *
1745   * @param {Node} node The node to test.
1746   *
1747   * @return {boolean} True if phrasing content, false if not.
1748   */
1749  
1750  function isPhrasingContent(node) {
1751    var tag = node.nodeName.toLowerCase();
1752    return getPhrasingContentSchema().hasOwnProperty(tag) || tag === 'span';
1753  }
1754  /**
1755   * @param {Node} node
1756   * @return {boolean} Node is text content
1757   */
1758  
1759  function isTextContent(node) {
1760    var tag = node.nodeName.toLowerCase();
1761    return textContentSchema.hasOwnProperty(tag) || tag === 'span';
1762  }
1763  
1764  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/is-element.js
1765  /* eslint-disable jsdoc/valid-types */
1766  
1767  /**
1768   * @param {Node | null | undefined} node
1769   * @return {node is Element} True if node is an Element node
1770   */
1771  function isElement(node) {
1772    /* eslint-enable jsdoc/valid-types */
1773    return !!node && node.nodeType === node.ELEMENT_NODE;
1774  }
1775  
1776  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/clean-node-list.js
1777  /**
1778   * External dependencies
1779   */
1780  
1781  /**
1782   * Internal dependencies
1783   */
1784  
1785  
1786  
1787  
1788  
1789  
1790  
1791  /* eslint-disable jsdoc/valid-types */
1792  
1793  /**
1794   * @typedef SchemaItem
1795   * @property {string[]} [attributes] Attributes.
1796   * @property {(string | RegExp)[]} [classes] Classnames or RegExp to test against.
1797   * @property {'*' | { [tag: string]: SchemaItem }} [children] Child schemas.
1798   * @property {string[]} [require] Selectors to test required children against. Leave empty or undefined if there are no requirements.
1799   * @property {boolean} allowEmpty Whether to allow nodes without children.
1800   * @property {(node: Node) => boolean} [isMatch] Function to test whether a node is a match. If left undefined any node will be assumed to match.
1801   */
1802  
1803  /** @typedef {{ [tag: string]: SchemaItem }} Schema */
1804  
1805  /* eslint-enable jsdoc/valid-types */
1806  
1807  /**
1808   * Given a schema, unwraps or removes nodes, attributes and classes on a node
1809   * list.
1810   *
1811   * @param {NodeList} nodeList The nodeList to filter.
1812   * @param {Document} doc      The document of the nodeList.
1813   * @param {Schema}   schema   An array of functions that can mutate with the provided node.
1814   * @param {boolean}  inline   Whether to clean for inline mode.
1815   */
1816  
1817  function cleanNodeList(nodeList, doc, schema, inline) {
1818    Array.from(nodeList).forEach(function (
1819    /** @type {Node & { nextElementSibling?: unknown }} */
1820    node) {
1821      var _schema$tag$isMatch, _schema$tag;
1822  
1823      var tag = node.nodeName.toLowerCase(); // It's a valid child, if the tag exists in the schema without an isMatch
1824      // function, or with an isMatch function that matches the node.
1825  
1826      if (schema.hasOwnProperty(tag) && (!schema[tag].isMatch || (_schema$tag$isMatch = (_schema$tag = schema[tag]).isMatch) !== null && _schema$tag$isMatch !== void 0 && _schema$tag$isMatch.call(_schema$tag, node))) {
1827        if (isElement(node)) {
1828          var _schema$tag2 = schema[tag],
1829              _schema$tag2$attribut = _schema$tag2.attributes,
1830              attributes = _schema$tag2$attribut === void 0 ? [] : _schema$tag2$attribut,
1831              _schema$tag2$classes = _schema$tag2.classes,
1832              classes = _schema$tag2$classes === void 0 ? [] : _schema$tag2$classes,
1833              children = _schema$tag2.children,
1834              _schema$tag2$require = _schema$tag2.require,
1835              require = _schema$tag2$require === void 0 ? [] : _schema$tag2$require,
1836              allowEmpty = _schema$tag2.allowEmpty; // If the node is empty and it's supposed to have children,
1837          // remove the node.
1838  
1839  
1840          if (children && !allowEmpty && isEmpty(node)) {
1841            remove(node);
1842            return;
1843          }
1844  
1845          if (node.hasAttributes()) {
1846            // Strip invalid attributes.
1847            Array.from(node.attributes).forEach(function (_ref) {
1848              var name = _ref.name;
1849  
1850              if (name !== 'class' && !Object(external_lodash_["includes"])(attributes, name)) {
1851                node.removeAttribute(name);
1852              }
1853            }); // Strip invalid classes.
1854            // In jsdom-jscore, 'node.classList' can be undefined.
1855            // TODO: Explore patching this in jsdom-jscore.
1856  
1857            if (node.classList && node.classList.length) {
1858              var mattchers = classes.map(function (item) {
1859                if (typeof item === 'string') {
1860                  return function (
1861                  /** @type {string} */
1862                  className) {
1863                    return className === item;
1864                  };
1865                } else if (item instanceof RegExp) {
1866                  return function (
1867                  /** @type {string} */
1868                  className) {
1869                    return item.test(className);
1870                  };
1871                }
1872  
1873                return external_lodash_["noop"];
1874              });
1875              Array.from(node.classList).forEach(function (name) {
1876                if (!mattchers.some(function (isMatch) {
1877                  return isMatch(name);
1878                })) {
1879                  node.classList.remove(name);
1880                }
1881              });
1882  
1883              if (!node.classList.length) {
1884                node.removeAttribute('class');
1885              }
1886            }
1887          }
1888  
1889          if (node.hasChildNodes()) {
1890            // Do not filter any content.
1891            if (children === '*') {
1892              return;
1893            } // Continue if the node is supposed to have children.
1894  
1895  
1896            if (children) {
1897              // If a parent requires certain children, but it does
1898              // not have them, drop the parent and continue.
1899              if (require.length && !node.querySelector(require.join(','))) {
1900                cleanNodeList(node.childNodes, doc, schema, inline);
1901                unwrap(node); // If the node is at the top, phrasing content, and
1902                // contains children that are block content, unwrap
1903                // the node because it is invalid.
1904              } else if (node.parentNode && node.parentNode.nodeName === 'BODY' && isPhrasingContent(node)) {
1905                cleanNodeList(node.childNodes, doc, schema, inline);
1906  
1907                if (Array.from(node.childNodes).some(function (child) {
1908                  return !isPhrasingContent(child);
1909                })) {
1910                  unwrap(node);
1911                }
1912              } else {
1913                cleanNodeList(node.childNodes, doc, children, inline);
1914              } // Remove children if the node is not supposed to have any.
1915  
1916            } else {
1917              while (node.firstChild) {
1918                remove(node.firstChild);
1919              }
1920            }
1921          }
1922        } // Invalid child. Continue with schema at the same place and unwrap.
1923  
1924      } else {
1925        cleanNodeList(node.childNodes, doc, schema, inline); // For inline mode, insert a line break when unwrapping nodes that
1926        // are not phrasing content.
1927  
1928        if (inline && !isPhrasingContent(node) && node.nextElementSibling) {
1929          insertAfter(doc.createElement('br'), node);
1930        }
1931  
1932        unwrap(node);
1933      }
1934    });
1935  }
1936  
1937  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/remove-invalid-html.js
1938  /**
1939   * Internal dependencies
1940   */
1941  
1942  /**
1943   * Given a schema, unwraps or removes nodes, attributes and classes on HTML.
1944   *
1945   * @param {string} HTML   The HTML to clean up.
1946   * @param {import('./clean-node-list').Schema} schema Schema for the HTML.
1947   * @param {boolean} inline Whether to clean for inline mode.
1948   *
1949   * @return {string} The cleaned up HTML.
1950   */
1951  
1952  function removeInvalidHTML(HTML, schema, inline) {
1953    var doc = document.implementation.createHTMLDocument('');
1954    doc.body.innerHTML = HTML;
1955    cleanNodeList(doc.body.childNodes, doc, schema, inline);
1956    return doc.body.innerHTML;
1957  }
1958  
1959  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/index.js
1960  
1961  
1962  
1963  
1964  
1965  
1966  
1967  
1968  
1969  
1970  
1971  
1972  
1973  
1974  
1975  
1976  
1977  
1978  
1979  
1980  
1981  
1982  
1983  
1984  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/data-transfer.js
1985  /**
1986   * Gets all files from a DataTransfer object.
1987   *
1988   * @param {DataTransfer} dataTransfer DataTransfer object to inspect.
1989   *
1990   * @return {File[]} An array containing all files.
1991   */
1992  function getFilesFromDataTransfer(dataTransfer) {
1993    var files = Array.from(dataTransfer.files);
1994    Array.from(dataTransfer.items).forEach(function (item) {
1995      var file = item.getAsFile();
1996  
1997      if (file && !files.find(function (_ref) {
1998        var name = _ref.name,
1999            type = _ref.type,
2000            size = _ref.size;
2001        return name === file.name && type === file.type && size === file.size;
2002      })) {
2003        files.push(file);
2004      }
2005    });
2006    return files;
2007  }
2008  
2009  // CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/index.js
2010  /**
2011   * Internal dependencies
2012   */
2013  
2014  
2015  /**
2016   * Object grouping `focusable` and `tabbable` utils
2017   * under the keys with the same name.
2018   */
2019  
2020  var build_module_focus = {
2021    focusable: focusable_namespaceObject,
2022    tabbable: tabbable_namespaceObject
2023  };
2024  
2025  
2026  
2027  
2028  
2029  /***/ }),
2030  
2031  /***/ 5:
2032  /***/ (function(module, __webpack_exports__, __webpack_require__) {
2033  
2034  "use strict";
2035  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
2036  function _defineProperty(obj, key, value) {
2037    if (key in obj) {
2038      Object.defineProperty(obj, key, {
2039        value: value,
2040        enumerable: true,
2041        configurable: true,
2042        writable: true
2043      });
2044    } else {
2045      obj[key] = value;
2046    }
2047  
2048    return obj;
2049  }
2050  
2051  /***/ })
2052  
2053  /******/ });


Generated: Sat May 15 01:00:05 2021 Cross-referenced by PHPXref 0.7.1