[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/dist/ -> rich-text.js (source)

   1  this["wp"] = this["wp"] || {}; this["wp"]["richText"] =
   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 = 441);
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ 0:
  91  /***/ (function(module, exports) {
  92  
  93  (function() { module.exports = this["wp"]["element"]; }());
  94  
  95  /***/ }),
  96  
  97  /***/ 11:
  98  /***/ (function(module, exports, __webpack_require__) {
  99  
 100  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
 101    Copyright (c) 2017 Jed Watson.
 102    Licensed under the MIT License (MIT), see
 103    http://jedwatson.github.io/classnames
 104  */
 105  /* global define */
 106  
 107  (function () {
 108      'use strict';
 109  
 110      var hasOwn = {}.hasOwnProperty;
 111  
 112  	function classNames () {
 113          var classes = [];
 114  
 115          for (var i = 0; i < arguments.length; i++) {
 116              var arg = arguments[i];
 117              if (!arg) continue;
 118  
 119              var argType = typeof arg;
 120  
 121              if (argType === 'string' || argType === 'number') {
 122                  classes.push(arg);
 123              } else if (Array.isArray(arg) && arg.length) {
 124                  var inner = classNames.apply(null, arg);
 125                  if (inner) {
 126                      classes.push(inner);
 127                  }
 128              } else if (argType === 'object') {
 129                  for (var key in arg) {
 130                      if (hasOwn.call(arg, key) && arg[key]) {
 131                          classes.push(key);
 132                      }
 133                  }
 134              }
 135          }
 136  
 137          return classes.join(' ');
 138      }
 139  
 140      if ( true && module.exports) {
 141          classNames.default = classNames;
 142          module.exports = classNames;
 143      } else if (true) {
 144          // register as 'classnames', consistent with npm package name
 145          !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
 146              return classNames;
 147          }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
 148                  __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
 149      } else {}
 150  }());
 151  
 152  
 153  /***/ }),
 154  
 155  /***/ 14:
 156  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 157  
 158  "use strict";
 159  
 160  // EXPORTS
 161  __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _slicedToArray; });
 162  
 163  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
 164  var arrayWithHoles = __webpack_require__(38);
 165  
 166  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
 167  function _iterableToArrayLimit(arr, i) {
 168    if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
 169    var _arr = [];
 170    var _n = true;
 171    var _d = false;
 172    var _e = undefined;
 173  
 174    try {
 175      for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
 176        _arr.push(_s.value);
 177  
 178        if (i && _arr.length === i) break;
 179      }
 180    } catch (err) {
 181      _d = true;
 182      _e = err;
 183    } finally {
 184      try {
 185        if (!_n && _i["return"] != null) _i["return"]();
 186      } finally {
 187        if (_d) throw _e;
 188      }
 189    }
 190  
 191    return _arr;
 192  }
 193  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
 194  var unsupportedIterableToArray = __webpack_require__(29);
 195  
 196  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
 197  var nonIterableRest = __webpack_require__(39);
 198  
 199  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
 200  
 201  
 202  
 203  
 204  function _slicedToArray(arr, i) {
 205    return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])();
 206  }
 207  
 208  /***/ }),
 209  
 210  /***/ 15:
 211  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 212  
 213  "use strict";
 214  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutProperties; });
 215  /* harmony import */ var _objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(41);
 216  
 217  function _objectWithoutProperties(source, excluded) {
 218    if (source == null) return {};
 219    var target = Object(_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(source, excluded);
 220    var key, i;
 221  
 222    if (Object.getOwnPropertySymbols) {
 223      var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
 224  
 225      for (i = 0; i < sourceSymbolKeys.length; i++) {
 226        key = sourceSymbolKeys[i];
 227        if (excluded.indexOf(key) >= 0) continue;
 228        if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
 229        target[key] = source[key];
 230      }
 231    }
 232  
 233    return target;
 234  }
 235  
 236  /***/ }),
 237  
 238  /***/ 18:
 239  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 240  
 241  "use strict";
 242  
 243  // EXPORTS
 244  __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; });
 245  
 246  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
 247  var arrayLikeToArray = __webpack_require__(26);
 248  
 249  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
 250  
 251  function _arrayWithoutHoles(arr) {
 252    if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr);
 253  }
 254  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
 255  var iterableToArray = __webpack_require__(35);
 256  
 257  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
 258  var unsupportedIterableToArray = __webpack_require__(29);
 259  
 260  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
 261  function _nonIterableSpread() {
 262    throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
 263  }
 264  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
 265  
 266  
 267  
 268  
 269  function _toConsumableArray(arr) {
 270    return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread();
 271  }
 272  
 273  /***/ }),
 274  
 275  /***/ 2:
 276  /***/ (function(module, exports) {
 277  
 278  (function() { module.exports = this["lodash"]; }());
 279  
 280  /***/ }),
 281  
 282  /***/ 21:
 283  /***/ (function(module, exports) {
 284  
 285  (function() { module.exports = this["wp"]["keycodes"]; }());
 286  
 287  /***/ }),
 288  
 289  /***/ 26:
 290  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 291  
 292  "use strict";
 293  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; });
 294  function _arrayLikeToArray(arr, len) {
 295    if (len == null || len > arr.length) len = arr.length;
 296  
 297    for (var i = 0, arr2 = new Array(len); i < len; i++) {
 298      arr2[i] = arr[i];
 299    }
 300  
 301    return arr2;
 302  }
 303  
 304  /***/ }),
 305  
 306  /***/ 29:
 307  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 308  
 309  "use strict";
 310  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; });
 311  /* harmony import */ var _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26);
 312  
 313  function _unsupportedIterableToArray(o, minLen) {
 314    if (!o) return;
 315    if (typeof o === "string") return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
 316    var n = Object.prototype.toString.call(o).slice(8, -1);
 317    if (n === "Object" && o.constructor) n = o.constructor.name;
 318    if (n === "Map" || n === "Set") return Array.from(o);
 319    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
 320  }
 321  
 322  /***/ }),
 323  
 324  /***/ 35:
 325  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 326  
 327  "use strict";
 328  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
 329  function _iterableToArray(iter) {
 330    if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
 331  }
 332  
 333  /***/ }),
 334  
 335  /***/ 37:
 336  /***/ (function(module, exports) {
 337  
 338  (function() { module.exports = this["wp"]["deprecated"]; }());
 339  
 340  /***/ }),
 341  
 342  /***/ 38:
 343  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 344  
 345  "use strict";
 346  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; });
 347  function _arrayWithHoles(arr) {
 348    if (Array.isArray(arr)) return arr;
 349  }
 350  
 351  /***/ }),
 352  
 353  /***/ 39:
 354  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 355  
 356  "use strict";
 357  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; });
 358  function _nonIterableRest() {
 359    throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
 360  }
 361  
 362  /***/ }),
 363  
 364  /***/ 4:
 365  /***/ (function(module, exports) {
 366  
 367  (function() { module.exports = this["wp"]["data"]; }());
 368  
 369  /***/ }),
 370  
 371  /***/ 40:
 372  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 373  
 374  "use strict";
 375  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; });
 376  function _typeof(obj) {
 377    "@babel/helpers - typeof";
 378  
 379    if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
 380      _typeof = function _typeof(obj) {
 381        return typeof obj;
 382      };
 383    } else {
 384      _typeof = function _typeof(obj) {
 385        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
 386      };
 387    }
 388  
 389    return _typeof(obj);
 390  }
 391  
 392  /***/ }),
 393  
 394  /***/ 41:
 395  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 396  
 397  "use strict";
 398  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutPropertiesLoose; });
 399  function _objectWithoutPropertiesLoose(source, excluded) {
 400    if (source == null) return {};
 401    var target = {};
 402    var sourceKeys = Object.keys(source);
 403    var key, i;
 404  
 405    for (i = 0; i < sourceKeys.length; i++) {
 406      key = sourceKeys[i];
 407      if (excluded.indexOf(key) >= 0) continue;
 408      target[key] = source[key];
 409    }
 410  
 411    return target;
 412  }
 413  
 414  /***/ }),
 415  
 416  /***/ 42:
 417  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 418  
 419  "use strict";
 420  
 421  
 422  var LEAF_KEY, hasWeakMap;
 423  
 424  /**
 425   * Arbitrary value used as key for referencing cache object in WeakMap tree.
 426   *
 427   * @type {Object}
 428   */
 429  LEAF_KEY = {};
 430  
 431  /**
 432   * Whether environment supports WeakMap.
 433   *
 434   * @type {boolean}
 435   */
 436  hasWeakMap = typeof WeakMap !== 'undefined';
 437  
 438  /**
 439   * Returns the first argument as the sole entry in an array.
 440   *
 441   * @param {*} value Value to return.
 442   *
 443   * @return {Array} Value returned as entry in array.
 444   */
 445  function arrayOf( value ) {
 446      return [ value ];
 447  }
 448  
 449  /**
 450   * Returns true if the value passed is object-like, or false otherwise. A value
 451   * is object-like if it can support property assignment, e.g. object or array.
 452   *
 453   * @param {*} value Value to test.
 454   *
 455   * @return {boolean} Whether value is object-like.
 456   */
 457  function isObjectLike( value ) {
 458      return !! value && 'object' === typeof value;
 459  }
 460  
 461  /**
 462   * Creates and returns a new cache object.
 463   *
 464   * @return {Object} Cache object.
 465   */
 466  function createCache() {
 467      var cache = {
 468          clear: function() {
 469              cache.head = null;
 470          },
 471      };
 472  
 473      return cache;
 474  }
 475  
 476  /**
 477   * Returns true if entries within the two arrays are strictly equal by
 478   * reference from a starting index.
 479   *
 480   * @param {Array}  a         First array.
 481   * @param {Array}  b         Second array.
 482   * @param {number} fromIndex Index from which to start comparison.
 483   *
 484   * @return {boolean} Whether arrays are shallowly equal.
 485   */
 486  function isShallowEqual( a, b, fromIndex ) {
 487      var i;
 488  
 489      if ( a.length !== b.length ) {
 490          return false;
 491      }
 492  
 493      for ( i = fromIndex; i < a.length; i++ ) {
 494          if ( a[ i ] !== b[ i ] ) {
 495              return false;
 496          }
 497      }
 498  
 499      return true;
 500  }
 501  
 502  /**
 503   * Returns a memoized selector function. The getDependants function argument is
 504   * called before the memoized selector and is expected to return an immutable
 505   * reference or array of references on which the selector depends for computing
 506   * its own return value. The memoize cache is preserved only as long as those
 507   * dependant references remain the same. If getDependants returns a different
 508   * reference(s), the cache is cleared and the selector value regenerated.
 509   *
 510   * @param {Function} selector      Selector function.
 511   * @param {Function} getDependants Dependant getter returning an immutable
 512   *                                 reference or array of reference used in
 513   *                                 cache bust consideration.
 514   *
 515   * @return {Function} Memoized selector.
 516   */
 517  /* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) {
 518      var rootCache, getCache;
 519  
 520      // Use object source as dependant if getter not provided
 521      if ( ! getDependants ) {
 522          getDependants = arrayOf;
 523      }
 524  
 525      /**
 526       * Returns the root cache. If WeakMap is supported, this is assigned to the
 527       * root WeakMap cache set, otherwise it is a shared instance of the default
 528       * cache object.
 529       *
 530       * @return {(WeakMap|Object)} Root cache object.
 531       */
 532  	function getRootCache() {
 533          return rootCache;
 534      }
 535  
 536      /**
 537       * Returns the cache for a given dependants array. When possible, a WeakMap
 538       * will be used to create a unique cache for each set of dependants. This
 539       * is feasible due to the nature of WeakMap in allowing garbage collection
 540       * to occur on entries where the key object is no longer referenced. Since
 541       * WeakMap requires the key to be an object, this is only possible when the
 542       * dependant is object-like. The root cache is created as a hierarchy where
 543       * each top-level key is the first entry in a dependants set, the value a
 544       * WeakMap where each key is the next dependant, and so on. This continues
 545       * so long as the dependants are object-like. If no dependants are object-
 546       * like, then the cache is shared across all invocations.
 547       *
 548       * @see isObjectLike
 549       *
 550       * @param {Array} dependants Selector dependants.
 551       *
 552       * @return {Object} Cache object.
 553       */
 554  	function getWeakMapCache( dependants ) {
 555          var caches = rootCache,
 556              isUniqueByDependants = true,
 557              i, dependant, map, cache;
 558  
 559          for ( i = 0; i < dependants.length; i++ ) {
 560              dependant = dependants[ i ];
 561  
 562              // Can only compose WeakMap from object-like key.
 563              if ( ! isObjectLike( dependant ) ) {
 564                  isUniqueByDependants = false;
 565                  break;
 566              }
 567  
 568              // Does current segment of cache already have a WeakMap?
 569              if ( caches.has( dependant ) ) {
 570                  // Traverse into nested WeakMap.
 571                  caches = caches.get( dependant );
 572              } else {
 573                  // Create, set, and traverse into a new one.
 574                  map = new WeakMap();
 575                  caches.set( dependant, map );
 576                  caches = map;
 577              }
 578          }
 579  
 580          // We use an arbitrary (but consistent) object as key for the last item
 581          // in the WeakMap to serve as our running cache.
 582          if ( ! caches.has( LEAF_KEY ) ) {
 583              cache = createCache();
 584              cache.isUniqueByDependants = isUniqueByDependants;
 585              caches.set( LEAF_KEY, cache );
 586          }
 587  
 588          return caches.get( LEAF_KEY );
 589      }
 590  
 591      // Assign cache handler by availability of WeakMap
 592      getCache = hasWeakMap ? getWeakMapCache : getRootCache;
 593  
 594      /**
 595       * Resets root memoization cache.
 596       */
 597  	function clear() {
 598          rootCache = hasWeakMap ? new WeakMap() : createCache();
 599      }
 600  
 601      // eslint-disable-next-line jsdoc/check-param-names
 602      /**
 603       * The augmented selector call, considering first whether dependants have
 604       * changed before passing it to underlying memoize function.
 605       *
 606       * @param {Object} source    Source object for derivation.
 607       * @param {...*}   extraArgs Additional arguments to pass to selector.
 608       *
 609       * @return {*} Selector result.
 610       */
 611  	function callSelector( /* source, ...extraArgs */ ) {
 612          var len = arguments.length,
 613              cache, node, i, args, dependants;
 614  
 615          // Create copy of arguments (avoid leaking deoptimization).
 616          args = new Array( len );
 617          for ( i = 0; i < len; i++ ) {
 618              args[ i ] = arguments[ i ];
 619          }
 620  
 621          dependants = getDependants.apply( null, args );
 622          cache = getCache( dependants );
 623  
 624          // If not guaranteed uniqueness by dependants (primitive type or lack
 625          // of WeakMap support), shallow compare against last dependants and, if
 626          // references have changed, destroy cache to recalculate result.
 627          if ( ! cache.isUniqueByDependants ) {
 628              if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) {
 629                  cache.clear();
 630              }
 631  
 632              cache.lastDependants = dependants;
 633          }
 634  
 635          node = cache.head;
 636          while ( node ) {
 637              // Check whether node arguments match arguments
 638              if ( ! isShallowEqual( node.args, args, 1 ) ) {
 639                  node = node.next;
 640                  continue;
 641              }
 642  
 643              // At this point we can assume we've found a match
 644  
 645              // Surface matched node to head if not already
 646              if ( node !== cache.head ) {
 647                  // Adjust siblings to point to each other.
 648                  node.prev.next = node.next;
 649                  if ( node.next ) {
 650                      node.next.prev = node.prev;
 651                  }
 652  
 653                  node.next = cache.head;
 654                  node.prev = null;
 655                  cache.head.prev = node;
 656                  cache.head = node;
 657              }
 658  
 659              // Return immediately
 660              return node.val;
 661          }
 662  
 663          // No cached value found. Continue to insertion phase:
 664  
 665          node = {
 666              // Generate the result from original function
 667              val: selector.apply( null, args ),
 668          };
 669  
 670          // Avoid including the source object in the cache.
 671          args[ 0 ] = null;
 672          node.args = args;
 673  
 674          // Don't need to check whether node is already head, since it would
 675          // have been returned above already if it was
 676  
 677          // Shift existing head down list
 678          if ( cache.head ) {
 679              cache.head.prev = node;
 680              node.next = cache.head;
 681          }
 682  
 683          cache.head = node;
 684  
 685          return node.val;
 686      }
 687  
 688      callSelector.getDependants = getDependants;
 689      callSelector.clear = clear;
 690      clear();
 691  
 692      return callSelector;
 693  });
 694  
 695  
 696  /***/ }),
 697  
 698  /***/ 441:
 699  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 700  
 701  "use strict";
 702  // ESM COMPAT FLAG
 703  __webpack_require__.r(__webpack_exports__);
 704  
 705  // EXPORTS
 706  __webpack_require__.d(__webpack_exports__, "applyFormat", function() { return /* reexport */ applyFormat; });
 707  __webpack_require__.d(__webpack_exports__, "concat", function() { return /* reexport */ concat; });
 708  __webpack_require__.d(__webpack_exports__, "create", function() { return /* reexport */ create; });
 709  __webpack_require__.d(__webpack_exports__, "getActiveFormat", function() { return /* reexport */ getActiveFormat; });
 710  __webpack_require__.d(__webpack_exports__, "getActiveObject", function() { return /* reexport */ getActiveObject; });
 711  __webpack_require__.d(__webpack_exports__, "getTextContent", function() { return /* reexport */ getTextContent; });
 712  __webpack_require__.d(__webpack_exports__, "__unstableIsListRootSelected", function() { return /* reexport */ isListRootSelected; });
 713  __webpack_require__.d(__webpack_exports__, "__unstableIsActiveListType", function() { return /* reexport */ isActiveListType; });
 714  __webpack_require__.d(__webpack_exports__, "isCollapsed", function() { return /* reexport */ isCollapsed; });
 715  __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return /* reexport */ isEmpty; });
 716  __webpack_require__.d(__webpack_exports__, "__unstableIsEmptyLine", function() { return /* reexport */ isEmptyLine; });
 717  __webpack_require__.d(__webpack_exports__, "join", function() { return /* reexport */ join; });
 718  __webpack_require__.d(__webpack_exports__, "registerFormatType", function() { return /* reexport */ registerFormatType; });
 719  __webpack_require__.d(__webpack_exports__, "removeFormat", function() { return /* reexport */ removeFormat; });
 720  __webpack_require__.d(__webpack_exports__, "remove", function() { return /* reexport */ remove_remove; });
 721  __webpack_require__.d(__webpack_exports__, "replace", function() { return /* reexport */ replace_replace; });
 722  __webpack_require__.d(__webpack_exports__, "insert", function() { return /* reexport */ insert; });
 723  __webpack_require__.d(__webpack_exports__, "__unstableInsertLineSeparator", function() { return /* reexport */ insertLineSeparator; });
 724  __webpack_require__.d(__webpack_exports__, "__unstableRemoveLineSeparator", function() { return /* reexport */ removeLineSeparator; });
 725  __webpack_require__.d(__webpack_exports__, "insertObject", function() { return /* reexport */ insertObject; });
 726  __webpack_require__.d(__webpack_exports__, "slice", function() { return /* reexport */ slice; });
 727  __webpack_require__.d(__webpack_exports__, "split", function() { return /* reexport */ split; });
 728  __webpack_require__.d(__webpack_exports__, "__unstableToDom", function() { return /* reexport */ toDom; });
 729  __webpack_require__.d(__webpack_exports__, "toHTMLString", function() { return /* reexport */ toHTMLString; });
 730  __webpack_require__.d(__webpack_exports__, "toggleFormat", function() { return /* reexport */ toggleFormat; });
 731  __webpack_require__.d(__webpack_exports__, "__UNSTABLE_LINE_SEPARATOR", function() { return /* reexport */ LINE_SEPARATOR; });
 732  __webpack_require__.d(__webpack_exports__, "unregisterFormatType", function() { return /* reexport */ unregisterFormatType; });
 733  __webpack_require__.d(__webpack_exports__, "__unstableCanIndentListItems", function() { return /* reexport */ canIndentListItems; });
 734  __webpack_require__.d(__webpack_exports__, "__unstableCanOutdentListItems", function() { return /* reexport */ canOutdentListItems; });
 735  __webpack_require__.d(__webpack_exports__, "__unstableIndentListItems", function() { return /* reexport */ indentListItems; });
 736  __webpack_require__.d(__webpack_exports__, "__unstableOutdentListItems", function() { return /* reexport */ outdentListItems; });
 737  __webpack_require__.d(__webpack_exports__, "__unstableChangeListType", function() { return /* reexport */ changeListType; });
 738  __webpack_require__.d(__webpack_exports__, "__unstableCreateElement", function() { return /* reexport */ createElement; });
 739  __webpack_require__.d(__webpack_exports__, "__experimentalRichText", function() { return /* reexport */ component; });
 740  __webpack_require__.d(__webpack_exports__, "__unstableFormatEdit", function() { return /* reexport */ FormatEdit; });
 741  
 742  // NAMESPACE OBJECT: ./node_modules/@wordpress/rich-text/build-module/store/selectors.js
 743  var selectors_namespaceObject = {};
 744  __webpack_require__.r(selectors_namespaceObject);
 745  __webpack_require__.d(selectors_namespaceObject, "getFormatTypes", function() { return getFormatTypes; });
 746  __webpack_require__.d(selectors_namespaceObject, "getFormatType", function() { return getFormatType; });
 747  __webpack_require__.d(selectors_namespaceObject, "getFormatTypeForBareElement", function() { return getFormatTypeForBareElement; });
 748  __webpack_require__.d(selectors_namespaceObject, "getFormatTypeForClassName", function() { return getFormatTypeForClassName; });
 749  
 750  // NAMESPACE OBJECT: ./node_modules/@wordpress/rich-text/build-module/store/actions.js
 751  var actions_namespaceObject = {};
 752  __webpack_require__.r(actions_namespaceObject);
 753  __webpack_require__.d(actions_namespaceObject, "addFormatTypes", function() { return addFormatTypes; });
 754  __webpack_require__.d(actions_namespaceObject, "removeFormatTypes", function() { return removeFormatTypes; });
 755  
 756  // EXTERNAL MODULE: external {"this":["wp","data"]}
 757  var external_this_wp_data_ = __webpack_require__(4);
 758  
 759  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
 760  var defineProperty = __webpack_require__(5);
 761  
 762  // EXTERNAL MODULE: external {"this":"lodash"}
 763  var external_this_lodash_ = __webpack_require__(2);
 764  
 765  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/store/reducer.js
 766  
 767  
 768  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; }
 769  
 770  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; }
 771  
 772  /**
 773   * External dependencies
 774   */
 775  
 776  /**
 777   * WordPress dependencies
 778   */
 779  
 780  
 781  /**
 782   * Reducer managing the format types
 783   *
 784   * @param {Object} state  Current state.
 785   * @param {Object} action Dispatched action.
 786   *
 787   * @return {Object} Updated state.
 788   */
 789  
 790  function reducer_formatTypes() {
 791    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
 792    var action = arguments.length > 1 ? arguments[1] : undefined;
 793  
 794    switch (action.type) {
 795      case 'ADD_FORMAT_TYPES':
 796        return _objectSpread({}, state, {}, Object(external_this_lodash_["keyBy"])(action.formatTypes, 'name'));
 797  
 798      case 'REMOVE_FORMAT_TYPES':
 799        return Object(external_this_lodash_["omit"])(state, action.names);
 800    }
 801  
 802    return state;
 803  }
 804  /* harmony default export */ var reducer = (Object(external_this_wp_data_["combineReducers"])({
 805    formatTypes: reducer_formatTypes
 806  }));
 807  
 808  // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
 809  var rememo = __webpack_require__(42);
 810  
 811  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/store/selectors.js
 812  /**
 813   * External dependencies
 814   */
 815  
 816  
 817  /**
 818   * Returns all the available format types.
 819   *
 820   * @param {Object} state Data state.
 821   *
 822   * @return {Array} Format types.
 823   */
 824  
 825  var getFormatTypes = Object(rememo["a" /* default */])(function (state) {
 826    return Object.values(state.formatTypes);
 827  }, function (state) {
 828    return [state.formatTypes];
 829  });
 830  /**
 831   * Returns a format type by name.
 832   *
 833   * @param {Object} state Data state.
 834   * @param {string} name Format type name.
 835   *
 836   * @return {Object?} Format type.
 837   */
 838  
 839  function getFormatType(state, name) {
 840    return state.formatTypes[name];
 841  }
 842  /**
 843   * Gets the format type, if any, that can handle a bare element (without a
 844   * data-format-type attribute), given the tag name of this element.
 845   *
 846   * @param {Object} state              Data state.
 847   * @param {string} bareElementTagName The tag name of the element to find a
 848   *                                    format type for.
 849   * @return {?Object} Format type.
 850   */
 851  
 852  function getFormatTypeForBareElement(state, bareElementTagName) {
 853    return Object(external_this_lodash_["find"])(getFormatTypes(state), function (_ref) {
 854      var className = _ref.className,
 855          tagName = _ref.tagName;
 856      return className === null && bareElementTagName === tagName;
 857    });
 858  }
 859  /**
 860   * Gets the format type, if any, that can handle an element, given its classes.
 861   *
 862   * @param {Object} state            Data state.
 863   * @param {string} elementClassName The classes of the element to find a format
 864   *                                  type for.
 865   * @return {?Object} Format type.
 866   */
 867  
 868  function getFormatTypeForClassName(state, elementClassName) {
 869    return Object(external_this_lodash_["find"])(getFormatTypes(state), function (_ref2) {
 870      var className = _ref2.className;
 871  
 872      if (className === null) {
 873        return false;
 874      }
 875  
 876      return " ".concat(elementClassName, " ").indexOf(" ".concat(className, " ")) >= 0;
 877    });
 878  }
 879  
 880  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/store/actions.js
 881  /**
 882   * External dependencies
 883   */
 884  
 885  /**
 886   * Returns an action object used in signalling that format types have been
 887   * added.
 888   *
 889   * @param {Array|Object} formatTypes Format types received.
 890   *
 891   * @return {Object} Action object.
 892   */
 893  
 894  function addFormatTypes(formatTypes) {
 895    return {
 896      type: 'ADD_FORMAT_TYPES',
 897      formatTypes: Object(external_this_lodash_["castArray"])(formatTypes)
 898    };
 899  }
 900  /**
 901   * Returns an action object used to remove a registered format type.
 902   *
 903   * @param {string|Array} names Format name.
 904   *
 905   * @return {Object} Action object.
 906   */
 907  
 908  function removeFormatTypes(names) {
 909    return {
 910      type: 'REMOVE_FORMAT_TYPES',
 911      names: Object(external_this_lodash_["castArray"])(names)
 912    };
 913  }
 914  
 915  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/store/index.js
 916  /**
 917   * WordPress dependencies
 918   */
 919  
 920  /**
 921   * Internal dependencies
 922   */
 923  
 924  
 925  
 926  
 927  Object(external_this_wp_data_["registerStore"])('core/rich-text', {
 928    reducer: reducer,
 929    selectors: selectors_namespaceObject,
 930    actions: actions_namespaceObject
 931  });
 932  
 933  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
 934  var toConsumableArray = __webpack_require__(18);
 935  
 936  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/is-format-equal.js
 937  /**
 938   * Optimised equality check for format objects.
 939   *
 940   * @param {?Object} format1 Format to compare.
 941   * @param {?Object} format2 Format to compare.
 942   *
 943   * @return {boolean} True if formats are equal, false if not.
 944   */
 945  function isFormatEqual(format1, format2) {
 946    // Both not defined.
 947    if (format1 === format2) {
 948      return true;
 949    } // Either not defined.
 950  
 951  
 952    if (!format1 || !format2) {
 953      return false;
 954    }
 955  
 956    if (format1.type !== format2.type) {
 957      return false;
 958    }
 959  
 960    var attributes1 = format1.attributes;
 961    var attributes2 = format2.attributes; // Both not defined.
 962  
 963    if (attributes1 === attributes2) {
 964      return true;
 965    } // Either not defined.
 966  
 967  
 968    if (!attributes1 || !attributes2) {
 969      return false;
 970    }
 971  
 972    var keys1 = Object.keys(attributes1);
 973    var keys2 = Object.keys(attributes2);
 974  
 975    if (keys1.length !== keys2.length) {
 976      return false;
 977    }
 978  
 979    var length = keys1.length; // Optimise for speed.
 980  
 981    for (var i = 0; i < length; i++) {
 982      var name = keys1[i];
 983  
 984      if (attributes1[name] !== attributes2[name]) {
 985        return false;
 986      }
 987    }
 988  
 989    return true;
 990  }
 991  
 992  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/normalise-formats.js
 993  
 994  
 995  function normalise_formats_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; }
 996  
 997  function normalise_formats_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { normalise_formats_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 { normalise_formats_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
 998  
 999  /**
1000   * Internal dependencies
1001   */
1002  
1003  /**
1004   * Normalises formats: ensures subsequent adjacent equal formats have the same
1005   * reference.
1006   *
1007   * @param {Object} value Value to normalise formats of.
1008   *
1009   * @return {Object} New value with normalised formats.
1010   */
1011  
1012  function normaliseFormats(value) {
1013    var newFormats = value.formats.slice();
1014    newFormats.forEach(function (formatsAtIndex, index) {
1015      var formatsAtPreviousIndex = newFormats[index - 1];
1016  
1017      if (formatsAtPreviousIndex) {
1018        var newFormatsAtIndex = formatsAtIndex.slice();
1019        newFormatsAtIndex.forEach(function (format, formatIndex) {
1020          var previousFormat = formatsAtPreviousIndex[formatIndex];
1021  
1022          if (isFormatEqual(format, previousFormat)) {
1023            newFormatsAtIndex[formatIndex] = previousFormat;
1024          }
1025        });
1026        newFormats[index] = newFormatsAtIndex;
1027      }
1028    });
1029    return normalise_formats_objectSpread({}, value, {
1030      formats: newFormats
1031    });
1032  }
1033  
1034  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/apply-format.js
1035  
1036  
1037  
1038  function apply_format_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; }
1039  
1040  function apply_format_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { apply_format_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 { apply_format_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1041  
1042  /**
1043   * External dependencies
1044   */
1045  
1046  /**
1047   * Internal dependencies
1048   */
1049  
1050  
1051  
1052  function replace(array, index, value) {
1053    array = array.slice();
1054    array[index] = value;
1055    return array;
1056  }
1057  /**
1058   * Apply a format object to a Rich Text value from the given `startIndex` to the
1059   * given `endIndex`. Indices are retrieved from the selection if none are
1060   * provided.
1061   *
1062   * @param {Object} value        Value to modify.
1063   * @param {Object} format       Format to apply.
1064   * @param {number} [startIndex] Start index.
1065   * @param {number} [endIndex]   End index.
1066   *
1067   * @return {Object} A new value with the format applied.
1068   */
1069  
1070  
1071  function applyFormat(value, format) {
1072    var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : value.start;
1073    var endIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : value.end;
1074    var formats = value.formats,
1075        activeFormats = value.activeFormats;
1076    var newFormats = formats.slice(); // The selection is collapsed.
1077  
1078    if (startIndex === endIndex) {
1079      var startFormat = Object(external_this_lodash_["find"])(newFormats[startIndex], {
1080        type: format.type
1081      }); // If the caret is at a format of the same type, expand start and end to
1082      // the edges of the format. This is useful to apply new attributes.
1083  
1084      if (startFormat) {
1085        var index = newFormats[startIndex].indexOf(startFormat);
1086  
1087        while (newFormats[startIndex] && newFormats[startIndex][index] === startFormat) {
1088          newFormats[startIndex] = replace(newFormats[startIndex], index, format);
1089          startIndex--;
1090        }
1091  
1092        endIndex++;
1093  
1094        while (newFormats[endIndex] && newFormats[endIndex][index] === startFormat) {
1095          newFormats[endIndex] = replace(newFormats[endIndex], index, format);
1096          endIndex++;
1097        }
1098      }
1099    } else {
1100      // Determine the highest position the new format can be inserted at.
1101      var position = +Infinity;
1102  
1103      for (var _index = startIndex; _index < endIndex; _index++) {
1104        if (newFormats[_index]) {
1105          newFormats[_index] = newFormats[_index].filter(function (_ref) {
1106            var type = _ref.type;
1107            return type !== format.type;
1108          });
1109          var length = newFormats[_index].length;
1110  
1111          if (length < position) {
1112            position = length;
1113          }
1114        } else {
1115          newFormats[_index] = [];
1116          position = 0;
1117        }
1118      }
1119  
1120      for (var _index2 = startIndex; _index2 < endIndex; _index2++) {
1121        newFormats[_index2].splice(position, 0, format);
1122      }
1123    }
1124  
1125    return normaliseFormats(apply_format_objectSpread({}, value, {
1126      formats: newFormats,
1127      // Always revise active formats. This serves as a placeholder for new
1128      // inputs with the format so new input appears with the format applied,
1129      // and ensures a format of the same type uses the latest values.
1130      activeFormats: [].concat(Object(toConsumableArray["a" /* default */])(Object(external_this_lodash_["reject"])(activeFormats, {
1131        type: format.type
1132      })), [format])
1133    }));
1134  }
1135  
1136  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
1137  var esm_typeof = __webpack_require__(40);
1138  
1139  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/create-element.js
1140  /**
1141   * Parse the given HTML into a body element.
1142   *
1143   * Note: The current implementation will return a shared reference, reset on
1144   * each call to `createElement`. Therefore, you should not hold a reference to
1145   * the value to operate upon asynchronously, as it may have unexpected results.
1146   *
1147   * @param {HTMLDocument} document The HTML document to use to parse.
1148   * @param {string}       html     The HTML to parse.
1149   *
1150   * @return {HTMLBodyElement} Body element with parsed HTML.
1151   */
1152  function createElement(_ref, html) {
1153    var implementation = _ref.implementation;
1154  
1155    // Because `createHTMLDocument` is an expensive operation, and with this
1156    // function being internal to `rich-text` (full control in avoiding a risk
1157    // of asynchronous operations on the shared reference), a single document
1158    // is reused and reset for each call to the function.
1159    if (!createElement.body) {
1160      createElement.body = implementation.createHTMLDocument('').body;
1161    }
1162  
1163    createElement.body.innerHTML = html;
1164    return createElement.body;
1165  }
1166  
1167  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/special-characters.js
1168  /**
1169   * Line separator character, used for multiline text.
1170   */
1171  var LINE_SEPARATOR = "\u2028";
1172  /**
1173   * Object replacement character, used as a placeholder for objects.
1174   */
1175  
1176  var OBJECT_REPLACEMENT_CHARACTER = "\uFFFC";
1177  /**
1178   * Zero width non-breaking space, used as padding in the editable DOM tree when
1179   * it is empty otherwise.
1180   */
1181  
1182  var ZWNBSP = "\uFEFF";
1183  
1184  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/create.js
1185  
1186  
1187  
1188  
1189  function create_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; }
1190  
1191  function create_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { create_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 { create_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1192  
1193  /**
1194   * WordPress dependencies
1195   */
1196  
1197  /**
1198   * Internal dependencies
1199   */
1200  
1201  
1202  
1203  
1204  
1205  
1206  function createEmptyValue() {
1207    return {
1208      formats: [],
1209      replacements: [],
1210      text: ''
1211    };
1212  }
1213  
1214  function simpleFindKey(object, value) {
1215    for (var key in object) {
1216      if (object[key] === value) {
1217        return key;
1218      }
1219    }
1220  }
1221  
1222  function toFormat(_ref) {
1223    var type = _ref.type,
1224        attributes = _ref.attributes;
1225    var formatType;
1226  
1227    if (attributes && attributes.class) {
1228      formatType = Object(external_this_wp_data_["select"])('core/rich-text').getFormatTypeForClassName(attributes.class);
1229  
1230      if (formatType) {
1231        // Preserve any additional classes.
1232        attributes.class = " ".concat(attributes.class, " ").replace(" ".concat(formatType.className, " "), ' ').trim();
1233  
1234        if (!attributes.class) {
1235          delete attributes.class;
1236        }
1237      }
1238    }
1239  
1240    if (!formatType) {
1241      formatType = Object(external_this_wp_data_["select"])('core/rich-text').getFormatTypeForBareElement(type);
1242    }
1243  
1244    if (!formatType) {
1245      return attributes ? {
1246        type: type,
1247        attributes: attributes
1248      } : {
1249        type: type
1250      };
1251    }
1252  
1253    if (formatType.__experimentalCreatePrepareEditableTree && !formatType.__experimentalCreateOnChangeEditableValue) {
1254      return null;
1255    }
1256  
1257    if (!attributes) {
1258      return {
1259        type: formatType.name
1260      };
1261    }
1262  
1263    var registeredAttributes = {};
1264    var unregisteredAttributes = {};
1265  
1266    for (var name in attributes) {
1267      var key = simpleFindKey(formatType.attributes, name);
1268  
1269      if (key) {
1270        registeredAttributes[key] = attributes[name];
1271      } else {
1272        unregisteredAttributes[name] = attributes[name];
1273      }
1274    }
1275  
1276    return {
1277      type: formatType.name,
1278      attributes: registeredAttributes,
1279      unregisteredAttributes: unregisteredAttributes
1280    };
1281  }
1282  /**
1283   * Create a RichText value from an `Element` tree (DOM), an HTML string or a
1284   * plain text string, with optionally a `Range` object to set the selection. If
1285   * called without any input, an empty value will be created. If
1286   * `multilineTag` is provided, any content of direct children whose type matches
1287   * `multilineTag` will be separated by two newlines. The optional functions can
1288   * be used to filter out content.
1289   *
1290   * A value will have the following shape, which you are strongly encouraged not
1291   * to modify without the use of helper functions:
1292   *
1293   * ```js
1294   * {
1295   *   text: string,
1296   *   formats: Array,
1297   *   replacements: Array,
1298   *   ?start: number,
1299   *   ?end: number,
1300   * }
1301   * ```
1302   *
1303   * As you can see, text and formatting are separated. `text` holds the text,
1304   * including any replacement characters for objects and lines. `formats`,
1305   * `objects` and `lines` are all sparse arrays of the same length as `text`. It
1306   * holds information about the formatting at the relevant text indices. Finally
1307   * `start` and `end` state which text indices are selected. They are only
1308   * provided if a `Range` was given.
1309   *
1310   * @param {Object}  [$1]                      Optional named arguments.
1311   * @param {Element} [$1.element]              Element to create value from.
1312   * @param {string}  [$1.text]                 Text to create value from.
1313   * @param {string}  [$1.html]                 HTML to create value from.
1314   * @param {Range}   [$1.range]                Range to create value from.
1315   * @param {string}  [$1.multilineTag]         Multiline tag if the structure is
1316   *                                            multiline.
1317   * @param {Array}   [$1.multilineWrapperTags] Tags where lines can be found if
1318   *                                            nesting is possible.
1319   * @param {?boolean} [$1.preserveWhiteSpace]  Whether or not to collapse white
1320   *                                            space characters.
1321   *
1322   * @return {Object} A rich text value.
1323   */
1324  
1325  
1326  function create() {
1327    var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1328        element = _ref2.element,
1329        text = _ref2.text,
1330        html = _ref2.html,
1331        range = _ref2.range,
1332        multilineTag = _ref2.multilineTag,
1333        multilineWrapperTags = _ref2.multilineWrapperTags,
1334        isEditableTree = _ref2.__unstableIsEditableTree,
1335        preserveWhiteSpace = _ref2.preserveWhiteSpace;
1336  
1337    if (typeof text === 'string' && text.length > 0) {
1338      return {
1339        formats: Array(text.length),
1340        replacements: Array(text.length),
1341        text: text
1342      };
1343    }
1344  
1345    if (typeof html === 'string' && html.length > 0) {
1346      // It does not matter which document this is, we're just using it to
1347      // parse.
1348      element = createElement(document, html);
1349    }
1350  
1351    if (Object(esm_typeof["a" /* default */])(element) !== 'object') {
1352      return createEmptyValue();
1353    }
1354  
1355    if (!multilineTag) {
1356      return createFromElement({
1357        element: element,
1358        range: range,
1359        isEditableTree: isEditableTree,
1360        preserveWhiteSpace: preserveWhiteSpace
1361      });
1362    }
1363  
1364    return createFromMultilineElement({
1365      element: element,
1366      range: range,
1367      multilineTag: multilineTag,
1368      multilineWrapperTags: multilineWrapperTags,
1369      isEditableTree: isEditableTree,
1370      preserveWhiteSpace: preserveWhiteSpace
1371    });
1372  }
1373  /**
1374   * Helper to accumulate the value's selection start and end from the current
1375   * node and range.
1376   *
1377   * @param {Object} accumulator Object to accumulate into.
1378   * @param {Node}   node        Node to create value with.
1379   * @param {Range}  range       Range to create value with.
1380   * @param {Object} value       Value that is being accumulated.
1381   */
1382  
1383  function accumulateSelection(accumulator, node, range, value) {
1384    if (!range) {
1385      return;
1386    }
1387  
1388    var parentNode = node.parentNode;
1389    var startContainer = range.startContainer,
1390        startOffset = range.startOffset,
1391        endContainer = range.endContainer,
1392        endOffset = range.endOffset;
1393    var currentLength = accumulator.text.length; // Selection can be extracted from value.
1394  
1395    if (value.start !== undefined) {
1396      accumulator.start = currentLength + value.start; // Range indicates that the current node has selection.
1397    } else if (node === startContainer && node.nodeType === node.TEXT_NODE) {
1398      accumulator.start = currentLength + startOffset; // Range indicates that the current node is selected.
1399    } else if (parentNode === startContainer && node === startContainer.childNodes[startOffset]) {
1400      accumulator.start = currentLength; // Range indicates that the selection is after the current node.
1401    } else if (parentNode === startContainer && node === startContainer.childNodes[startOffset - 1]) {
1402      accumulator.start = currentLength + value.text.length; // Fallback if no child inside handled the selection.
1403    } else if (node === startContainer) {
1404      accumulator.start = currentLength;
1405    } // Selection can be extracted from value.
1406  
1407  
1408    if (value.end !== undefined) {
1409      accumulator.end = currentLength + value.end; // Range indicates that the current node has selection.
1410    } else if (node === endContainer && node.nodeType === node.TEXT_NODE) {
1411      accumulator.end = currentLength + endOffset; // Range indicates that the current node is selected.
1412    } else if (parentNode === endContainer && node === endContainer.childNodes[endOffset - 1]) {
1413      accumulator.end = currentLength + value.text.length; // Range indicates that the selection is before the current node.
1414    } else if (parentNode === endContainer && node === endContainer.childNodes[endOffset]) {
1415      accumulator.end = currentLength; // Fallback if no child inside handled the selection.
1416    } else if (node === endContainer) {
1417      accumulator.end = currentLength + endOffset;
1418    }
1419  }
1420  /**
1421   * Adjusts the start and end offsets from a range based on a text filter.
1422   *
1423   * @param {Node}     node   Node of which the text should be filtered.
1424   * @param {Range}    range  The range to filter.
1425   * @param {Function} filter Function to use to filter the text.
1426   *
1427   * @return {?Object} Object containing range properties.
1428   */
1429  
1430  
1431  function filterRange(node, range, filter) {
1432    if (!range) {
1433      return;
1434    }
1435  
1436    var startContainer = range.startContainer,
1437        endContainer = range.endContainer;
1438    var startOffset = range.startOffset,
1439        endOffset = range.endOffset;
1440  
1441    if (node === startContainer) {
1442      startOffset = filter(node.nodeValue.slice(0, startOffset)).length;
1443    }
1444  
1445    if (node === endContainer) {
1446      endOffset = filter(node.nodeValue.slice(0, endOffset)).length;
1447    }
1448  
1449    return {
1450      startContainer: startContainer,
1451      startOffset: startOffset,
1452      endContainer: endContainer,
1453      endOffset: endOffset
1454    };
1455  }
1456  /**
1457   * Collapse any whitespace used for HTML formatting to one space character,
1458   * because it will also be displayed as such by the browser.
1459   *
1460   * @param {string} string
1461   */
1462  
1463  
1464  function collapseWhiteSpace(string) {
1465    return string.replace(/[\n\r\t]+/g, ' ');
1466  }
1467  
1468  var ZWNBSPRegExp = new RegExp(ZWNBSP, 'g');
1469  /**
1470   * Removes padding (zero width non breaking spaces) added by `toTree`.
1471   *
1472   * @param {string} string
1473   */
1474  
1475  function removePadding(string) {
1476    return string.replace(ZWNBSPRegExp, '');
1477  }
1478  /**
1479   * Creates a Rich Text value from a DOM element and range.
1480   *
1481   * @param {Object}    $1                      Named argements.
1482   * @param {?Element}  $1.element              Element to create value from.
1483   * @param {?Range}    $1.range                Range to create value from.
1484   * @param {?string}   $1.multilineTag         Multiline tag if the structure is
1485   *                                            multiline.
1486   * @param {?Array}    $1.multilineWrapperTags Tags where lines can be found if
1487   *                                            nesting is possible.
1488   * @param {?boolean} $1.preserveWhiteSpace    Whether or not to collapse white
1489   *                                            space characters.
1490   *
1491   * @return {Object} A rich text value.
1492   */
1493  
1494  
1495  function createFromElement(_ref3) {
1496    var element = _ref3.element,
1497        range = _ref3.range,
1498        multilineTag = _ref3.multilineTag,
1499        multilineWrapperTags = _ref3.multilineWrapperTags,
1500        _ref3$currentWrapperT = _ref3.currentWrapperTags,
1501        currentWrapperTags = _ref3$currentWrapperT === void 0 ? [] : _ref3$currentWrapperT,
1502        isEditableTree = _ref3.isEditableTree,
1503        preserveWhiteSpace = _ref3.preserveWhiteSpace;
1504    var accumulator = createEmptyValue();
1505  
1506    if (!element) {
1507      return accumulator;
1508    }
1509  
1510    if (!element.hasChildNodes()) {
1511      accumulateSelection(accumulator, element, range, createEmptyValue());
1512      return accumulator;
1513    }
1514  
1515    var length = element.childNodes.length; // Optimise for speed.
1516  
1517    var _loop = function _loop(index) {
1518      var node = element.childNodes[index];
1519      var type = node.nodeName.toLowerCase();
1520  
1521      if (node.nodeType === node.TEXT_NODE) {
1522        var filter = removePadding;
1523  
1524        if (!preserveWhiteSpace) {
1525          filter = function filter(string) {
1526            return removePadding(collapseWhiteSpace(string));
1527          };
1528        }
1529  
1530        var text = filter(node.nodeValue);
1531        range = filterRange(node, range, filter);
1532        accumulateSelection(accumulator, node, range, {
1533          text: text
1534        }); // Create a sparse array of the same length as `text`, in which
1535        // formats can be added.
1536  
1537        accumulator.formats.length += text.length;
1538        accumulator.replacements.length += text.length;
1539        accumulator.text += text;
1540        return "continue";
1541      }
1542  
1543      if (node.nodeType !== node.ELEMENT_NODE) {
1544        return "continue";
1545      }
1546  
1547      if (isEditableTree && ( // Ignore any placeholders.
1548      node.getAttribute('data-rich-text-placeholder') || // Ignore any line breaks that are not inserted by us.
1549      type === 'br' && !node.getAttribute('data-rich-text-line-break'))) {
1550        accumulateSelection(accumulator, node, range, createEmptyValue());
1551        return "continue";
1552      }
1553  
1554      if (type === 'br') {
1555        accumulateSelection(accumulator, node, range, createEmptyValue());
1556        mergePair(accumulator, create({
1557          text: '\n'
1558        }));
1559        return "continue";
1560      }
1561  
1562      var lastFormats = accumulator.formats[accumulator.formats.length - 1];
1563      var lastFormat = lastFormats && lastFormats[lastFormats.length - 1];
1564      var newFormat = toFormat({
1565        type: type,
1566        attributes: getAttributes({
1567          element: node
1568        })
1569      });
1570      var format = isFormatEqual(newFormat, lastFormat) ? lastFormat : newFormat;
1571  
1572      if (multilineWrapperTags && multilineWrapperTags.indexOf(type) !== -1) {
1573        var _value = createFromMultilineElement({
1574          element: node,
1575          range: range,
1576          multilineTag: multilineTag,
1577          multilineWrapperTags: multilineWrapperTags,
1578          currentWrapperTags: [].concat(Object(toConsumableArray["a" /* default */])(currentWrapperTags), [format]),
1579          isEditableTree: isEditableTree,
1580          preserveWhiteSpace: preserveWhiteSpace
1581        });
1582  
1583        accumulateSelection(accumulator, node, range, _value);
1584        mergePair(accumulator, _value);
1585        return "continue";
1586      }
1587  
1588      var value = createFromElement({
1589        element: node,
1590        range: range,
1591        multilineTag: multilineTag,
1592        multilineWrapperTags: multilineWrapperTags,
1593        isEditableTree: isEditableTree,
1594        preserveWhiteSpace: preserveWhiteSpace
1595      });
1596      accumulateSelection(accumulator, node, range, value);
1597  
1598      if (!format) {
1599        mergePair(accumulator, value);
1600      } else if (value.text.length === 0) {
1601        if (format.attributes) {
1602          mergePair(accumulator, {
1603            formats: [,],
1604            replacements: [format],
1605            text: OBJECT_REPLACEMENT_CHARACTER
1606          });
1607        }
1608      } else {
1609        // Indices should share a reference to the same formats array.
1610        // Only create a new reference if `formats` changes.
1611        function mergeFormats(formats) {
1612          if (mergeFormats.formats === formats) {
1613            return mergeFormats.newFormats;
1614          }
1615  
1616          var newFormats = formats ? [format].concat(Object(toConsumableArray["a" /* default */])(formats)) : [format];
1617          mergeFormats.formats = formats;
1618          mergeFormats.newFormats = newFormats;
1619          return newFormats;
1620        } // Since the formats parameter can be `undefined`, preset
1621        // `mergeFormats` with a new reference.
1622  
1623  
1624        mergeFormats.newFormats = [format];
1625        mergePair(accumulator, create_objectSpread({}, value, {
1626          formats: Array.from(value.formats, mergeFormats)
1627        }));
1628      }
1629    };
1630  
1631    for (var index = 0; index < length; index++) {
1632      var _ret = _loop(index);
1633  
1634      if (_ret === "continue") continue;
1635    }
1636  
1637    return accumulator;
1638  }
1639  /**
1640   * Creates a rich text value from a DOM element and range that should be
1641   * multiline.
1642   *
1643   * @param {Object}   $1                      Named argements.
1644   * @param {?Element} $1.element              Element to create value from.
1645   * @param {?Range}   $1.range                Range to create value from.
1646   * @param {?string}  $1.multilineTag         Multiline tag if the structure is
1647   *                                           multiline.
1648   * @param {?Array}   $1.multilineWrapperTags Tags where lines can be found if
1649   *                                           nesting is possible.
1650   * @param {boolean}  $1.currentWrapperTags   Whether to prepend a line
1651   *                                           separator.
1652   * @param {?boolean} $1.preserveWhiteSpace   Whether or not to collapse white
1653   *                                           space characters.
1654   *
1655   * @return {Object} A rich text value.
1656   */
1657  
1658  
1659  function createFromMultilineElement(_ref4) {
1660    var element = _ref4.element,
1661        range = _ref4.range,
1662        multilineTag = _ref4.multilineTag,
1663        multilineWrapperTags = _ref4.multilineWrapperTags,
1664        _ref4$currentWrapperT = _ref4.currentWrapperTags,
1665        currentWrapperTags = _ref4$currentWrapperT === void 0 ? [] : _ref4$currentWrapperT,
1666        isEditableTree = _ref4.isEditableTree,
1667        preserveWhiteSpace = _ref4.preserveWhiteSpace;
1668    var accumulator = createEmptyValue();
1669  
1670    if (!element || !element.hasChildNodes()) {
1671      return accumulator;
1672    }
1673  
1674    var length = element.children.length; // Optimise for speed.
1675  
1676    for (var index = 0; index < length; index++) {
1677      var node = element.children[index];
1678  
1679      if (node.nodeName.toLowerCase() !== multilineTag) {
1680        continue;
1681      }
1682  
1683      var value = createFromElement({
1684        element: node,
1685        range: range,
1686        multilineTag: multilineTag,
1687        multilineWrapperTags: multilineWrapperTags,
1688        currentWrapperTags: currentWrapperTags,
1689        isEditableTree: isEditableTree,
1690        preserveWhiteSpace: preserveWhiteSpace
1691      }); // Multiline value text should be separated by a line separator.
1692  
1693      if (index !== 0 || currentWrapperTags.length > 0) {
1694        mergePair(accumulator, {
1695          formats: [,],
1696          replacements: currentWrapperTags.length > 0 ? [currentWrapperTags] : [,],
1697          text: LINE_SEPARATOR
1698        });
1699      }
1700  
1701      accumulateSelection(accumulator, node, range, value);
1702      mergePair(accumulator, value);
1703    }
1704  
1705    return accumulator;
1706  }
1707  /**
1708   * Gets the attributes of an element in object shape.
1709   *
1710   * @param {Object}    $1                 Named argements.
1711   * @param {Element}   $1.element         Element to get attributes from.
1712   *
1713   * @return {?Object} Attribute object or `undefined` if the element has no
1714   *                   attributes.
1715   */
1716  
1717  
1718  function getAttributes(_ref5) {
1719    var element = _ref5.element;
1720  
1721    if (!element.hasAttributes()) {
1722      return;
1723    }
1724  
1725    var length = element.attributes.length;
1726    var accumulator; // Optimise for speed.
1727  
1728    for (var i = 0; i < length; i++) {
1729      var _element$attributes$i = element.attributes[i],
1730          name = _element$attributes$i.name,
1731          value = _element$attributes$i.value;
1732  
1733      if (name.indexOf('data-rich-text-') === 0) {
1734        continue;
1735      }
1736  
1737      accumulator = accumulator || {};
1738      accumulator[name] = value;
1739    }
1740  
1741    return accumulator;
1742  }
1743  
1744  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/concat.js
1745  /**
1746   * Internal dependencies
1747   */
1748  
1749  
1750  /**
1751   * Concats a pair of rich text values. Not that this mutates `a` and does NOT
1752   * normalise formats!
1753   *
1754   * @param  {Object} a Value to mutate.
1755   * @param  {Object} b Value to add read from.
1756   *
1757   * @return {Object} `a`, mutated.
1758   */
1759  
1760  function mergePair(a, b) {
1761    a.formats = a.formats.concat(b.formats);
1762    a.replacements = a.replacements.concat(b.replacements);
1763    a.text += b.text;
1764    return a;
1765  }
1766  /**
1767   * Combine all Rich Text values into one. This is similar to
1768   * `String.prototype.concat`.
1769   *
1770   * @param {...Object} values Objects to combine.
1771   *
1772   * @return {Object} A new value combining all given records.
1773   */
1774  
1775  function concat() {
1776    for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
1777      values[_key] = arguments[_key];
1778    }
1779  
1780    return normaliseFormats(values.reduce(mergePair, create()));
1781  }
1782  
1783  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-active-formats.js
1784  /**
1785   * Gets the all format objects at the start of the selection.
1786   *
1787   * @param {Object}        value                Value to inspect.
1788   * @param {Array<Array>}  value.formats        Formats object data values.
1789   * @param {number}        value.start          Index to start from.
1790   * @param {number}        value.end            Index to end.
1791   * @param {Array}         value.activeFormats  Array to return if there are active formats.
1792   * @param {Array}         EMPTY_ACTIVE_FORMATS Array to return if there are no active
1793   *                                             formats.
1794   *
1795   * @return {?Object} Active format objects.
1796   */
1797  function getActiveFormats(_ref) {
1798    var formats = _ref.formats,
1799        start = _ref.start,
1800        end = _ref.end,
1801        activeFormats = _ref.activeFormats;
1802    var EMPTY_ACTIVE_FORMATS = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
1803  
1804    if (start === undefined) {
1805      return EMPTY_ACTIVE_FORMATS;
1806    }
1807  
1808    if (start === end) {
1809      // For a collapsed caret, it is possible to override the active formats.
1810      if (activeFormats) {
1811        return activeFormats;
1812      }
1813  
1814      var formatsBefore = formats[start - 1] || EMPTY_ACTIVE_FORMATS;
1815      var formatsAfter = formats[start] || EMPTY_ACTIVE_FORMATS; // By default, select the lowest amount of formats possible (which means
1816      // the caret is positioned outside the format boundary). The user can
1817      // then use arrow keys to define `activeFormats`.
1818  
1819      if (formatsBefore.length < formatsAfter.length) {
1820        return formatsBefore;
1821      }
1822  
1823      return formatsAfter;
1824    }
1825  
1826    return formats[start] || EMPTY_ACTIVE_FORMATS;
1827  }
1828  
1829  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-active-format.js
1830  /**
1831   * External dependencies
1832   */
1833  
1834  /**
1835   * Internal dependencies
1836   */
1837  
1838  
1839  /**
1840   * Gets the format object by type at the start of the selection. This can be
1841   * used to get e.g. the URL of a link format at the current selection, but also
1842   * to check if a format is active at the selection. Returns undefined if there
1843   * is no format at the selection.
1844   *
1845   * @param {Object} value      Value to inspect.
1846   * @param {string} formatType Format type to look for.
1847   *
1848   * @return {Object|undefined} Active format object of the specified type, or undefined.
1849   */
1850  
1851  function getActiveFormat(value, formatType) {
1852    return Object(external_this_lodash_["find"])(getActiveFormats(value), {
1853      type: formatType
1854    });
1855  }
1856  
1857  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-active-object.js
1858  /**
1859   * Internal dependencies
1860   */
1861  
1862  /**
1863   * Gets the active object, if there is any.
1864   *
1865   * @param {Object} value Value to inspect.
1866   *
1867   * @return {?Object} Active object, or undefined.
1868   */
1869  
1870  function getActiveObject(_ref) {
1871    var start = _ref.start,
1872        end = _ref.end,
1873        replacements = _ref.replacements,
1874        text = _ref.text;
1875  
1876    if (start + 1 !== end || text[start] !== OBJECT_REPLACEMENT_CHARACTER) {
1877      return;
1878    }
1879  
1880    return replacements[start];
1881  }
1882  
1883  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-text-content.js
1884  /**
1885   * Get the textual content of a Rich Text value. This is similar to
1886   * `Element.textContent`.
1887   *
1888   * @param {Object} value Value to use.
1889   *
1890   * @return {string} The text content.
1891   */
1892  function getTextContent(_ref) {
1893    var text = _ref.text;
1894    return text;
1895  }
1896  
1897  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-line-index.js
1898  /**
1899   * Internal dependencies
1900   */
1901  
1902  /**
1903   * Gets the currently selected line index, or the first line index if the
1904   * selection spans over multiple items.
1905   *
1906   * @param {Object}  value      Value to get the line index from.
1907   * @param {boolean} startIndex Optional index that should be contained by the
1908   *                             line. Defaults to the selection start of the
1909   *                             value.
1910   *
1911   * @return {?boolean} The line index. Undefined if not found.
1912   */
1913  
1914  function getLineIndex(_ref) {
1915    var start = _ref.start,
1916        text = _ref.text;
1917    var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : start;
1918    var index = startIndex;
1919  
1920    while (index--) {
1921      if (text[index] === LINE_SEPARATOR) {
1922        return index;
1923      }
1924    }
1925  }
1926  
1927  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/is-list-root-selected.js
1928  /**
1929   * Internal dependencies
1930   */
1931  
1932  /**
1933   * Whether or not the root list is selected.
1934   *
1935   * @param {Object} value The value to check.
1936   *
1937   * @return {boolean} True if the root list or nothing is selected, false if an
1938   *                   inner list is selected.
1939   */
1940  
1941  function isListRootSelected(value) {
1942    var replacements = value.replacements,
1943        start = value.start;
1944    var lineIndex = getLineIndex(value, start);
1945    var replacement = replacements[lineIndex];
1946    return !replacement || replacement.length < 1;
1947  }
1948  
1949  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/is-active-list-type.js
1950  /**
1951   * Internal dependencies
1952   */
1953  
1954  /**
1955   * Wether or not the selected list has the given tag name.
1956   *
1957   * @param {Object}  value    The value to check.
1958   * @param {string}  type     The tag name the list should have.
1959   * @param {string}  rootType The current root tag name, to compare with in case
1960   *                           nothing is selected.
1961   *
1962   * @return {boolean} True if the current list type matches `type`, false if not.
1963   */
1964  
1965  function isActiveListType(value, type, rootType) {
1966    var replacements = value.replacements,
1967        start = value.start;
1968    var lineIndex = getLineIndex(value, start);
1969    var replacement = replacements[lineIndex];
1970  
1971    if (!replacement || replacement.length === 0) {
1972      return type === rootType;
1973    }
1974  
1975    var lastFormat = replacement[replacement.length - 1];
1976    return lastFormat.type === type;
1977  }
1978  
1979  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/is-collapsed.js
1980  /**
1981   * Check if the selection of a Rich Text value is collapsed or not. Collapsed
1982   * means that no characters are selected, but there is a caret present. If there
1983   * is no selection, `undefined` will be returned. This is similar to
1984   * `window.getSelection().isCollapsed()`.
1985   *
1986   * @param {Object} value The rich text value to check.
1987   *
1988   * @return {boolean|undefined} True if the selection is collapsed, false if not,
1989   *                             undefined if there is no selection.
1990   */
1991  function isCollapsed(_ref) {
1992    var start = _ref.start,
1993        end = _ref.end;
1994  
1995    if (start === undefined || end === undefined) {
1996      return;
1997    }
1998  
1999    return start === end;
2000  }
2001  
2002  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/is-empty.js
2003  /**
2004   * Internal dependencies
2005   */
2006  
2007  /**
2008   * Check if a Rich Text value is Empty, meaning it contains no text or any
2009   * objects (such as images).
2010   *
2011   * @param {Object} value Value to use.
2012   *
2013   * @return {boolean} True if the value is empty, false if not.
2014   */
2015  
2016  function isEmpty(_ref) {
2017    var text = _ref.text;
2018    return text.length === 0;
2019  }
2020  /**
2021   * Check if the current collapsed selection is on an empty line in case of a
2022   * multiline value.
2023   *
2024   * @param  {Object} value Value te check.
2025   *
2026   * @return {boolean} True if the line is empty, false if not.
2027   */
2028  
2029  function isEmptyLine(_ref2) {
2030    var text = _ref2.text,
2031        start = _ref2.start,
2032        end = _ref2.end;
2033  
2034    if (start !== end) {
2035      return false;
2036    }
2037  
2038    if (text.length === 0) {
2039      return true;
2040    }
2041  
2042    if (start === 0 && text.slice(0, 1) === LINE_SEPARATOR) {
2043      return true;
2044    }
2045  
2046    if (start === text.length && text.slice(-1) === LINE_SEPARATOR) {
2047      return true;
2048    }
2049  
2050    return text.slice(start - 1, end + 1) === "".concat(LINE_SEPARATOR).concat(LINE_SEPARATOR);
2051  }
2052  
2053  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/join.js
2054  /**
2055   * Internal dependencies
2056   */
2057  
2058  
2059  /**
2060   * Combine an array of Rich Text values into one, optionally separated by
2061   * `separator`, which can be a Rich Text value, HTML string, or plain text
2062   * string. This is similar to `Array.prototype.join`.
2063   *
2064   * @param {Array<Object>} values      An array of values to join.
2065   * @param {string|Object} [separator] Separator string or value.
2066   *
2067   * @return {Object} A new combined value.
2068   */
2069  
2070  function join(values) {
2071    var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
2072  
2073    if (typeof separator === 'string') {
2074      separator = create({
2075        text: separator
2076      });
2077    }
2078  
2079    return normaliseFormats(values.reduce(function (accumlator, _ref) {
2080      var formats = _ref.formats,
2081          replacements = _ref.replacements,
2082          text = _ref.text;
2083      return {
2084        formats: accumlator.formats.concat(separator.formats, formats),
2085        replacements: accumlator.replacements.concat(separator.replacements, replacements),
2086        text: accumlator.text + separator.text + text
2087      };
2088    }));
2089  }
2090  
2091  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/register-format-type.js
2092  
2093  
2094  function register_format_type_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; }
2095  
2096  function register_format_type_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { register_format_type_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 { register_format_type_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2097  
2098  /**
2099   * WordPress dependencies
2100   */
2101  
2102  /**
2103   * @typedef {Object} WPFormat
2104   *
2105   * @property {string}   name        A string identifying the format. Must be
2106   *                                  unique across all registered formats.
2107   * @property {string}   tagName     The HTML tag this format will wrap the
2108   *                                  selection with.
2109   * @property {string}   [className] A class to match the format.
2110   * @property {string}   title       Name of the format.
2111   * @property {Function} edit        Should return a component for the user to
2112   *                                  interact with the new registered format.
2113   */
2114  
2115  /**
2116   * Registers a new format provided a unique name and an object defining its
2117   * behavior.
2118   *
2119   * @param {string}   name                 Format name.
2120   * @param {WPFormat} settings             Format settings.
2121   *
2122   * @return {WPFormat|undefined} The format, if it has been successfully registered;
2123   *                              otherwise `undefined`.
2124   */
2125  
2126  function registerFormatType(name, settings) {
2127    settings = register_format_type_objectSpread({
2128      name: name
2129    }, settings);
2130  
2131    if (typeof settings.name !== 'string') {
2132      window.console.error('Format names must be strings.');
2133      return;
2134    }
2135  
2136    if (!/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(settings.name)) {
2137      window.console.error('Format names must contain a namespace prefix, include only lowercase alphanumeric characters or dashes, and start with a letter. Example: my-plugin/my-custom-format');
2138      return;
2139    }
2140  
2141    if (Object(external_this_wp_data_["select"])('core/rich-text').getFormatType(settings.name)) {
2142      window.console.error('Format "' + settings.name + '" is already registered.');
2143      return;
2144    }
2145  
2146    if (typeof settings.tagName !== 'string' || settings.tagName === '') {
2147      window.console.error('Format tag names must be a string.');
2148      return;
2149    }
2150  
2151    if ((typeof settings.className !== 'string' || settings.className === '') && settings.className !== null) {
2152      window.console.error('Format class names must be a string, or null to handle bare elements.');
2153      return;
2154    }
2155  
2156    if (!/^[_a-zA-Z]+[a-zA-Z0-9-]*$/.test(settings.className)) {
2157      window.console.error('A class name must begin with a letter, followed by any number of hyphens, letters, or numbers.');
2158      return;
2159    }
2160  
2161    if (settings.className === null) {
2162      var formatTypeForBareElement = Object(external_this_wp_data_["select"])('core/rich-text').getFormatTypeForBareElement(settings.tagName);
2163  
2164      if (formatTypeForBareElement) {
2165        window.console.error("Format \"".concat(formatTypeForBareElement.name, "\" is already registered to handle bare tag name \"").concat(settings.tagName, "\"."));
2166        return;
2167      }
2168    } else {
2169      var formatTypeForClassName = Object(external_this_wp_data_["select"])('core/rich-text').getFormatTypeForClassName(settings.className);
2170  
2171      if (formatTypeForClassName) {
2172        window.console.error("Format \"".concat(formatTypeForClassName.name, "\" is already registered to handle class name \"").concat(settings.className, "\"."));
2173        return;
2174      }
2175    }
2176  
2177    if (!('title' in settings) || settings.title === '') {
2178      window.console.error('The format "' + settings.name + '" must have a title.');
2179      return;
2180    }
2181  
2182    if ('keywords' in settings && settings.keywords.length > 3) {
2183      window.console.error('The format "' + settings.name + '" can have a maximum of 3 keywords.');
2184      return;
2185    }
2186  
2187    if (typeof settings.title !== 'string') {
2188      window.console.error('Format titles must be strings.');
2189      return;
2190    }
2191  
2192    Object(external_this_wp_data_["dispatch"])('core/rich-text').addFormatTypes(settings);
2193    return settings;
2194  }
2195  
2196  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/remove-format.js
2197  
2198  
2199  function remove_format_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; }
2200  
2201  function remove_format_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { remove_format_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 { remove_format_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2202  
2203  /**
2204   * External dependencies
2205   */
2206  
2207  /**
2208   * Internal dependencies
2209   */
2210  
2211  
2212  /**
2213   * Remove any format object from a Rich Text value by type from the given
2214   * `startIndex` to the given `endIndex`. Indices are retrieved from the
2215   * selection if none are provided.
2216   *
2217   * @param {Object} value        Value to modify.
2218   * @param {string} formatType   Format type to remove.
2219   * @param {number} [startIndex] Start index.
2220   * @param {number} [endIndex]   End index.
2221   *
2222   * @return {Object} A new value with the format applied.
2223   */
2224  
2225  function removeFormat(value, formatType) {
2226    var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : value.start;
2227    var endIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : value.end;
2228    var formats = value.formats,
2229        activeFormats = value.activeFormats;
2230    var newFormats = formats.slice(); // If the selection is collapsed, expand start and end to the edges of the
2231    // format.
2232  
2233    if (startIndex === endIndex) {
2234      var format = Object(external_this_lodash_["find"])(newFormats[startIndex], {
2235        type: formatType
2236      });
2237  
2238      if (format) {
2239        while (Object(external_this_lodash_["find"])(newFormats[startIndex], format)) {
2240          filterFormats(newFormats, startIndex, formatType);
2241          startIndex--;
2242        }
2243  
2244        endIndex++;
2245  
2246        while (Object(external_this_lodash_["find"])(newFormats[endIndex], format)) {
2247          filterFormats(newFormats, endIndex, formatType);
2248          endIndex++;
2249        }
2250      }
2251    } else {
2252      for (var i = startIndex; i < endIndex; i++) {
2253        if (newFormats[i]) {
2254          filterFormats(newFormats, i, formatType);
2255        }
2256      }
2257    }
2258  
2259    return normaliseFormats(remove_format_objectSpread({}, value, {
2260      formats: newFormats,
2261      activeFormats: Object(external_this_lodash_["reject"])(activeFormats, {
2262        type: formatType
2263      })
2264    }));
2265  }
2266  
2267  function filterFormats(formats, index, formatType) {
2268    var newFormats = formats[index].filter(function (_ref) {
2269      var type = _ref.type;
2270      return type !== formatType;
2271    });
2272  
2273    if (newFormats.length) {
2274      formats[index] = newFormats;
2275    } else {
2276      delete formats[index];
2277    }
2278  }
2279  
2280  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/insert.js
2281  /**
2282   * Internal dependencies
2283   */
2284  
2285  
2286  /**
2287   * Insert a Rich Text value, an HTML string, or a plain text string, into a
2288   * Rich Text value at the given `startIndex`. Any content between `startIndex`
2289   * and `endIndex` will be removed. Indices are retrieved from the selection if
2290   * none are provided.
2291   *
2292   * @param {Object}        value         Value to modify.
2293   * @param {Object|string} valueToInsert Value to insert.
2294   * @param {number}        [startIndex]  Start index.
2295   * @param {number}        [endIndex]    End index.
2296   *
2297   * @return {Object} A new value with the value inserted.
2298   */
2299  
2300  function insert(value, valueToInsert) {
2301    var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : value.start;
2302    var endIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : value.end;
2303    var formats = value.formats,
2304        replacements = value.replacements,
2305        text = value.text;
2306  
2307    if (typeof valueToInsert === 'string') {
2308      valueToInsert = create({
2309        text: valueToInsert
2310      });
2311    }
2312  
2313    var index = startIndex + valueToInsert.text.length;
2314    return normaliseFormats({
2315      formats: formats.slice(0, startIndex).concat(valueToInsert.formats, formats.slice(endIndex)),
2316      replacements: replacements.slice(0, startIndex).concat(valueToInsert.replacements, replacements.slice(endIndex)),
2317      text: text.slice(0, startIndex) + valueToInsert.text + text.slice(endIndex),
2318      start: index,
2319      end: index
2320    });
2321  }
2322  
2323  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/remove.js
2324  /**
2325   * Internal dependencies
2326   */
2327  
2328  
2329  /**
2330   * Remove content from a Rich Text value between the given `startIndex` and
2331   * `endIndex`. Indices are retrieved from the selection if none are provided.
2332   *
2333   * @param {Object} value        Value to modify.
2334   * @param {number} [startIndex] Start index.
2335   * @param {number} [endIndex]   End index.
2336   *
2337   * @return {Object} A new value with the content removed.
2338   */
2339  
2340  function remove_remove(value, startIndex, endIndex) {
2341    return insert(value, create(), startIndex, endIndex);
2342  }
2343  
2344  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/replace.js
2345  
2346  
2347  /**
2348   * Internal dependencies
2349   */
2350  
2351  /**
2352   * Search a Rich Text value and replace the match(es) with `replacement`. This
2353   * is similar to `String.prototype.replace`.
2354   *
2355   * @param {Object}         value        The value to modify.
2356   * @param {RegExp|string}  pattern      A RegExp object or literal. Can also be
2357   *                                      a string. It is treated as a verbatim
2358   *                                      string and is not interpreted as a
2359   *                                      regular expression. Only the first
2360   *                                      occurrence will be replaced.
2361   * @param {Function|string} replacement The match or matches are replaced with
2362   *                                      the specified or the value returned by
2363   *                                      the specified function.
2364   *
2365   * @return {Object} A new value with replacements applied.
2366   */
2367  
2368  function replace_replace(_ref, pattern, replacement) {
2369    var formats = _ref.formats,
2370        replacements = _ref.replacements,
2371        text = _ref.text,
2372        start = _ref.start,
2373        end = _ref.end;
2374    text = text.replace(pattern, function (match) {
2375      for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2376        rest[_key - 1] = arguments[_key];
2377      }
2378  
2379      var offset = rest[rest.length - 2];
2380      var newText = replacement;
2381      var newFormats;
2382      var newReplacements;
2383  
2384      if (typeof newText === 'function') {
2385        newText = replacement.apply(void 0, [match].concat(rest));
2386      }
2387  
2388      if (Object(esm_typeof["a" /* default */])(newText) === 'object') {
2389        newFormats = newText.formats;
2390        newReplacements = newText.replacements;
2391        newText = newText.text;
2392      } else {
2393        newFormats = Array(newText.length);
2394        newReplacements = Array(newText.length);
2395  
2396        if (formats[offset]) {
2397          newFormats = newFormats.fill(formats[offset]);
2398        }
2399      }
2400  
2401      formats = formats.slice(0, offset).concat(newFormats, formats.slice(offset + match.length));
2402      replacements = replacements.slice(0, offset).concat(newReplacements, replacements.slice(offset + match.length));
2403  
2404      if (start) {
2405        start = end = offset + newText.length;
2406      }
2407  
2408      return newText;
2409    });
2410    return normaliseFormats({
2411      formats: formats,
2412      replacements: replacements,
2413      text: text,
2414      start: start,
2415      end: end
2416    });
2417  }
2418  
2419  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/insert-line-separator.js
2420  /**
2421   * Internal dependencies
2422   */
2423  
2424  
2425  
2426  /**
2427   * Insert a line break character into a Rich Text value at the given
2428   * `startIndex`. Any content between `startIndex` and `endIndex` will be
2429   * removed. Indices are retrieved from the selection if none are provided.
2430   *
2431   * @param {Object} value        Value to modify.
2432   * @param {number} [startIndex] Start index.
2433   * @param {number} [endIndex]   End index.
2434   *
2435   * @return {Object} A new value with the value inserted.
2436   */
2437  
2438  function insertLineSeparator(value) {
2439    var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : value.start;
2440    var endIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : value.end;
2441    var beforeText = getTextContent(value).slice(0, startIndex);
2442    var previousLineSeparatorIndex = beforeText.lastIndexOf(LINE_SEPARATOR);
2443    var previousLineSeparatorFormats = value.replacements[previousLineSeparatorIndex];
2444    var replacements = [,];
2445  
2446    if (previousLineSeparatorFormats) {
2447      replacements = [previousLineSeparatorFormats];
2448    }
2449  
2450    var valueToInsert = {
2451      formats: [,],
2452      replacements: replacements,
2453      text: LINE_SEPARATOR
2454    };
2455    return insert(value, valueToInsert, startIndex, endIndex);
2456  }
2457  
2458  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/remove-line-separator.js
2459  
2460  
2461  function remove_line_separator_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; }
2462  
2463  function remove_line_separator_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { remove_line_separator_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 { remove_line_separator_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2464  
2465  /**
2466   * Internal dependencies
2467   */
2468  
2469  
2470  
2471  /**
2472   * Removes a line separator character, if existing, from a Rich Text value at the current
2473   * indices. If no line separator exists on the indices it will return undefined.
2474   *
2475   * @param {Object} value Value to modify.
2476   * @param {boolean} backward indicates if are removing from the start index or the end index.
2477   *
2478   * @return {Object|undefined} A new value with the line separator removed. Or undefined if no line separator is found on the position.
2479   */
2480  
2481  function removeLineSeparator(value) {
2482    var backward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2483    var replacements = value.replacements,
2484        text = value.text,
2485        start = value.start,
2486        end = value.end;
2487    var collapsed = isCollapsed(value);
2488    var index = start - 1;
2489    var removeStart = collapsed ? start - 1 : start;
2490    var removeEnd = end;
2491  
2492    if (!backward) {
2493      index = end;
2494      removeStart = start;
2495      removeEnd = collapsed ? end + 1 : end;
2496    }
2497  
2498    if (text[index] !== LINE_SEPARATOR) {
2499      return;
2500    }
2501  
2502    var newValue; // If the line separator that is about te be removed
2503    // contains wrappers, remove the wrappers first.
2504  
2505    if (collapsed && replacements[index] && replacements[index].length) {
2506      var newReplacements = replacements.slice();
2507      newReplacements[index] = replacements[index].slice(0, -1);
2508      newValue = remove_line_separator_objectSpread({}, value, {
2509        replacements: newReplacements
2510      });
2511    } else {
2512      newValue = remove_remove(value, removeStart, removeEnd);
2513    }
2514  
2515    return newValue;
2516  }
2517  
2518  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/insert-object.js
2519  /**
2520   * Internal dependencies
2521   */
2522  
2523  var insert_object_OBJECT_REPLACEMENT_CHARACTER = "\uFFFC";
2524  /**
2525   * Insert a format as an object into a Rich Text value at the given
2526   * `startIndex`. Any content between `startIndex` and `endIndex` will be
2527   * removed. Indices are retrieved from the selection if none are provided.
2528   *
2529   * @param {Object} value          Value to modify.
2530   * @param {Object} formatToInsert Format to insert as object.
2531   * @param {number} [startIndex]   Start index.
2532   * @param {number} [endIndex]     End index.
2533   *
2534   * @return {Object} A new value with the object inserted.
2535   */
2536  
2537  function insertObject(value, formatToInsert, startIndex, endIndex) {
2538    var valueToInsert = {
2539      formats: [,],
2540      replacements: [formatToInsert],
2541      text: insert_object_OBJECT_REPLACEMENT_CHARACTER
2542    };
2543    return insert(value, valueToInsert, startIndex, endIndex);
2544  }
2545  
2546  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/slice.js
2547  
2548  
2549  function slice_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; }
2550  
2551  function slice_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { slice_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 { slice_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2552  
2553  /**
2554   * Slice a Rich Text value from `startIndex` to `endIndex`. Indices are
2555   * retrieved from the selection if none are provided. This is similar to
2556   * `String.prototype.slice`.
2557   *
2558   * @param {Object} value        Value to modify.
2559   * @param {number} [startIndex] Start index.
2560   * @param {number} [endIndex]   End index.
2561   *
2562   * @return {Object} A new extracted value.
2563   */
2564  function slice(value) {
2565    var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : value.start;
2566    var endIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : value.end;
2567    var formats = value.formats,
2568        replacements = value.replacements,
2569        text = value.text;
2570  
2571    if (startIndex === undefined || endIndex === undefined) {
2572      return slice_objectSpread({}, value);
2573    }
2574  
2575    return {
2576      formats: formats.slice(startIndex, endIndex),
2577      replacements: replacements.slice(startIndex, endIndex),
2578      text: text.slice(startIndex, endIndex)
2579    };
2580  }
2581  
2582  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/split.js
2583  /**
2584   * Internal dependencies
2585   */
2586  
2587  /**
2588   * Split a Rich Text value in two at the given `startIndex` and `endIndex`, or
2589   * split at the given separator. This is similar to `String.prototype.split`.
2590   * Indices are retrieved from the selection if none are provided.
2591   *
2592   * @param {Object}        value
2593   * @param {Object[]}      value.formats
2594   * @param {Object[]}      value.replacements
2595   * @param {string}        value.text
2596   * @param {number}        value.start
2597   * @param {number}        value.end
2598   * @param {number|string} [string] Start index, or string at which to split.
2599   *
2600   * @return {Array} An array of new values.
2601   */
2602  
2603  function split(_ref, string) {
2604    var formats = _ref.formats,
2605        replacements = _ref.replacements,
2606        text = _ref.text,
2607        start = _ref.start,
2608        end = _ref.end;
2609  
2610    if (typeof string !== 'string') {
2611      return splitAtSelection.apply(void 0, arguments);
2612    }
2613  
2614    var nextStart = 0;
2615    return text.split(string).map(function (substring) {
2616      var startIndex = nextStart;
2617      var value = {
2618        formats: formats.slice(startIndex, startIndex + substring.length),
2619        replacements: replacements.slice(startIndex, startIndex + substring.length),
2620        text: substring
2621      };
2622      nextStart += string.length + substring.length;
2623  
2624      if (start !== undefined && end !== undefined) {
2625        if (start >= startIndex && start < nextStart) {
2626          value.start = start - startIndex;
2627        } else if (start < startIndex && end > startIndex) {
2628          value.start = 0;
2629        }
2630  
2631        if (end >= startIndex && end < nextStart) {
2632          value.end = end - startIndex;
2633        } else if (start < nextStart && end > nextStart) {
2634          value.end = substring.length;
2635        }
2636      }
2637  
2638      return value;
2639    });
2640  }
2641  
2642  function splitAtSelection(_ref2) {
2643    var formats = _ref2.formats,
2644        replacements = _ref2.replacements,
2645        text = _ref2.text,
2646        start = _ref2.start,
2647        end = _ref2.end;
2648    var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : start;
2649    var endIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : end;
2650    var before = {
2651      formats: formats.slice(0, startIndex),
2652      replacements: replacements.slice(0, startIndex),
2653      text: text.slice(0, startIndex)
2654    };
2655    var after = {
2656      formats: formats.slice(endIndex),
2657      replacements: replacements.slice(endIndex),
2658      text: text.slice(endIndex),
2659      start: 0,
2660      end: 0
2661    };
2662    return [// Ensure newlines are trimmed.
2663    replace_replace(before, /\u2028+$/, ''), replace_replace(after, /^\u2028+/, '')];
2664  }
2665  
2666  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-format-type.js
2667  /**
2668   * WordPress dependencies
2669   */
2670  
2671  /**
2672   * Returns a registered format type.
2673   *
2674   * @param {string} name Format name.
2675   *
2676   * @return {?Object} Format type.
2677   */
2678  
2679  function get_format_type_getFormatType(name) {
2680    return Object(external_this_wp_data_["select"])('core/rich-text').getFormatType(name);
2681  }
2682  
2683  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/to-tree.js
2684  
2685  
2686  
2687  function to_tree_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; }
2688  
2689  function to_tree_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { to_tree_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 { to_tree_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2690  
2691  /**
2692   * Internal dependencies
2693   */
2694  
2695  
2696  
2697  /**
2698   * Converts a format object to information that can be used to create an element
2699   * from (type, attributes and object).
2700   *
2701   * @param  {Object}  $1                        Named parameters.
2702   * @param  {string}  $1.type                   The format type.
2703   * @param  {Object}  $1.attributes             The format attributes.
2704   * @param  {Object}  $1.unregisteredAttributes The unregistered format
2705   *                                             attributes.
2706   * @param  {boolean} $1.object                 Wether or not it is an object
2707   *                                             format.
2708   * @param  {boolean} $1.boundaryClass          Wether or not to apply a boundary
2709   *                                             class.
2710   * @return {Object}                            Information to be used for
2711   *                                             element creation.
2712   */
2713  
2714  function fromFormat(_ref) {
2715    var type = _ref.type,
2716        attributes = _ref.attributes,
2717        unregisteredAttributes = _ref.unregisteredAttributes,
2718        object = _ref.object,
2719        boundaryClass = _ref.boundaryClass;
2720    var formatType = get_format_type_getFormatType(type);
2721    var elementAttributes = {};
2722  
2723    if (boundaryClass) {
2724      elementAttributes['data-rich-text-format-boundary'] = 'true';
2725    }
2726  
2727    if (!formatType) {
2728      if (attributes) {
2729        elementAttributes = to_tree_objectSpread({}, attributes, {}, elementAttributes);
2730      }
2731  
2732      return {
2733        type: type,
2734        attributes: elementAttributes,
2735        object: object
2736      };
2737    }
2738  
2739    elementAttributes = to_tree_objectSpread({}, unregisteredAttributes, {}, elementAttributes);
2740  
2741    for (var name in attributes) {
2742      var key = formatType.attributes ? formatType.attributes[name] : false;
2743  
2744      if (key) {
2745        elementAttributes[key] = attributes[name];
2746      } else {
2747        elementAttributes[name] = attributes[name];
2748      }
2749    }
2750  
2751    if (formatType.className) {
2752      if (elementAttributes.class) {
2753        elementAttributes.class = "".concat(formatType.className, " ").concat(elementAttributes.class);
2754      } else {
2755        elementAttributes.class = formatType.className;
2756      }
2757    }
2758  
2759    return {
2760      type: formatType.tagName,
2761      object: formatType.object,
2762      attributes: elementAttributes
2763    };
2764  }
2765  /**
2766   * Checks if both arrays of formats up until a certain index are equal.
2767   *
2768   * @param {Array}  a     Array of formats to compare.
2769   * @param {Array}  b     Array of formats to compare.
2770   * @param {number} index Index to check until.
2771   */
2772  
2773  
2774  function isEqualUntil(a, b, index) {
2775    do {
2776      if (a[index] !== b[index]) {
2777        return false;
2778      }
2779    } while (index--);
2780  
2781    return true;
2782  }
2783  
2784  function toTree(_ref2) {
2785    var value = _ref2.value,
2786        multilineTag = _ref2.multilineTag,
2787        preserveWhiteSpace = _ref2.preserveWhiteSpace,
2788        createEmpty = _ref2.createEmpty,
2789        append = _ref2.append,
2790        getLastChild = _ref2.getLastChild,
2791        getParent = _ref2.getParent,
2792        isText = _ref2.isText,
2793        getText = _ref2.getText,
2794        remove = _ref2.remove,
2795        appendText = _ref2.appendText,
2796        onStartIndex = _ref2.onStartIndex,
2797        onEndIndex = _ref2.onEndIndex,
2798        isEditableTree = _ref2.isEditableTree,
2799        placeholder = _ref2.placeholder;
2800    var formats = value.formats,
2801        replacements = value.replacements,
2802        text = value.text,
2803        start = value.start,
2804        end = value.end;
2805    var formatsLength = formats.length + 1;
2806    var tree = createEmpty();
2807    var multilineFormat = {
2808      type: multilineTag
2809    };
2810    var activeFormats = getActiveFormats(value);
2811    var deepestActiveFormat = activeFormats[activeFormats.length - 1];
2812    var lastSeparatorFormats;
2813    var lastCharacterFormats;
2814    var lastCharacter; // If we're building a multiline tree, start off with a multiline element.
2815  
2816    if (multilineTag) {
2817      append(append(tree, {
2818        type: multilineTag
2819      }), '');
2820      lastCharacterFormats = lastSeparatorFormats = [multilineFormat];
2821    } else {
2822      append(tree, '');
2823    }
2824  
2825    var _loop = function _loop(i) {
2826      var character = text.charAt(i);
2827      var shouldInsertPadding = isEditableTree && ( // Pad the line if the line is empty.
2828      !lastCharacter || lastCharacter === LINE_SEPARATOR || // Pad the line if the previous character is a line break, otherwise
2829      // the line break won't be visible.
2830      lastCharacter === '\n');
2831      var characterFormats = formats[i]; // Set multiline tags in queue for building the tree.
2832  
2833      if (multilineTag) {
2834        if (character === LINE_SEPARATOR) {
2835          characterFormats = lastSeparatorFormats = (replacements[i] || []).reduce(function (accumulator, format) {
2836            accumulator.push(format, multilineFormat);
2837            return accumulator;
2838          }, [multilineFormat]);
2839        } else {
2840          characterFormats = [].concat(Object(toConsumableArray["a" /* default */])(lastSeparatorFormats), Object(toConsumableArray["a" /* default */])(characterFormats || []));
2841        }
2842      }
2843  
2844      var pointer = getLastChild(tree);
2845  
2846      if (shouldInsertPadding && character === LINE_SEPARATOR) {
2847        var node = pointer;
2848  
2849        while (!isText(node)) {
2850          node = getLastChild(node);
2851        }
2852  
2853        append(getParent(node), ZWNBSP);
2854      } // Set selection for the start of line.
2855  
2856  
2857      if (lastCharacter === LINE_SEPARATOR) {
2858        var _node = pointer;
2859  
2860        while (!isText(_node)) {
2861          _node = getLastChild(_node);
2862        }
2863  
2864        if (onStartIndex && start === i) {
2865          onStartIndex(tree, _node);
2866        }
2867  
2868        if (onEndIndex && end === i) {
2869          onEndIndex(tree, _node);
2870        }
2871      }
2872  
2873      if (characterFormats) {
2874        characterFormats.forEach(function (format, formatIndex) {
2875          if (pointer && lastCharacterFormats && // Reuse the last element if all formats remain the same.
2876          isEqualUntil(characterFormats, lastCharacterFormats, formatIndex) && ( // Do not reuse the last element if the character is a
2877          // line separator.
2878          character !== LINE_SEPARATOR || characterFormats.length - 1 !== formatIndex)) {
2879            pointer = getLastChild(pointer);
2880            return;
2881          }
2882  
2883          var type = format.type,
2884              attributes = format.attributes,
2885              unregisteredAttributes = format.unregisteredAttributes;
2886          var boundaryClass = isEditableTree && character !== LINE_SEPARATOR && format === deepestActiveFormat;
2887          var parent = getParent(pointer);
2888          var newNode = append(parent, fromFormat({
2889            type: type,
2890            attributes: attributes,
2891            unregisteredAttributes: unregisteredAttributes,
2892            boundaryClass: boundaryClass
2893          }));
2894  
2895          if (isText(pointer) && getText(pointer).length === 0) {
2896            remove(pointer);
2897          }
2898  
2899          pointer = append(newNode, '');
2900        });
2901      } // No need for further processing if the character is a line separator.
2902  
2903  
2904      if (character === LINE_SEPARATOR) {
2905        lastCharacterFormats = characterFormats;
2906        lastCharacter = character;
2907        return "continue";
2908      } // If there is selection at 0, handle it before characters are inserted.
2909  
2910  
2911      if (i === 0) {
2912        if (onStartIndex && start === 0) {
2913          onStartIndex(tree, pointer);
2914        }
2915  
2916        if (onEndIndex && end === 0) {
2917          onEndIndex(tree, pointer);
2918        }
2919      }
2920  
2921      if (character === OBJECT_REPLACEMENT_CHARACTER) {
2922        pointer = append(getParent(pointer), fromFormat(to_tree_objectSpread({}, replacements[i], {
2923          object: true
2924        }))); // Ensure pointer is text node.
2925  
2926        pointer = append(getParent(pointer), '');
2927      } else if (!preserveWhiteSpace && character === '\n') {
2928        pointer = append(getParent(pointer), {
2929          type: 'br',
2930          attributes: isEditableTree ? {
2931            'data-rich-text-line-break': 'true'
2932          } : undefined,
2933          object: true
2934        }); // Ensure pointer is text node.
2935  
2936        pointer = append(getParent(pointer), '');
2937      } else if (!isText(pointer)) {
2938        pointer = append(getParent(pointer), character);
2939      } else {
2940        appendText(pointer, character);
2941      }
2942  
2943      if (onStartIndex && start === i + 1) {
2944        onStartIndex(tree, pointer);
2945      }
2946  
2947      if (onEndIndex && end === i + 1) {
2948        onEndIndex(tree, pointer);
2949      }
2950  
2951      if (shouldInsertPadding && i === text.length) {
2952        append(getParent(pointer), ZWNBSP);
2953  
2954        if (placeholder && text.length === 0) {
2955          append(getParent(pointer), {
2956            type: 'span',
2957            attributes: {
2958              'data-rich-text-placeholder': placeholder,
2959              // Necessary to prevent the placeholder from catching
2960              // selection. The placeholder is also not editable after
2961              // all.
2962              contenteditable: 'false'
2963            }
2964          });
2965        }
2966      }
2967  
2968      lastCharacterFormats = characterFormats;
2969      lastCharacter = character;
2970    };
2971  
2972    for (var i = 0; i < formatsLength; i++) {
2973      var _ret = _loop(i);
2974  
2975      if (_ret === "continue") continue;
2976    }
2977  
2978    return tree;
2979  }
2980  
2981  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/to-dom.js
2982  
2983  
2984  
2985  function to_dom_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; }
2986  
2987  function to_dom_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { to_dom_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 { to_dom_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2988  
2989  /**
2990   * Internal dependencies
2991   */
2992  
2993  
2994  /**
2995   * Creates a path as an array of indices from the given root node to the given
2996   * node.
2997   *
2998   * @param {Node}        node     Node to find the path of.
2999   * @param {HTMLElement} rootNode Root node to find the path from.
3000   * @param {Array}       path     Initial path to build on.
3001   *
3002   * @return {Array} The path from the root node to the node.
3003   */
3004  
3005  function createPathToNode(node, rootNode, path) {
3006    var parentNode = node.parentNode;
3007    var i = 0;
3008  
3009    while (node = node.previousSibling) {
3010      i++;
3011    }
3012  
3013    path = [i].concat(Object(toConsumableArray["a" /* default */])(path));
3014  
3015    if (parentNode !== rootNode) {
3016      path = createPathToNode(parentNode, rootNode, path);
3017    }
3018  
3019    return path;
3020  }
3021  /**
3022   * Gets a node given a path (array of indices) from the given node.
3023   *
3024   * @param {HTMLElement} node Root node to find the wanted node in.
3025   * @param {Array}       path Path (indices) to the wanted node.
3026   *
3027   * @return {Object} Object with the found node and the remaining offset (if any).
3028   */
3029  
3030  
3031  function getNodeByPath(node, path) {
3032    path = Object(toConsumableArray["a" /* default */])(path);
3033  
3034    while (node && path.length > 1) {
3035      node = node.childNodes[path.shift()];
3036    }
3037  
3038    return {
3039      node: node,
3040      offset: path[0]
3041    };
3042  }
3043  
3044  function to_dom_append(element, child) {
3045    if (typeof child === 'string') {
3046      child = element.ownerDocument.createTextNode(child);
3047    }
3048  
3049    var _child = child,
3050        type = _child.type,
3051        attributes = _child.attributes;
3052  
3053    if (type) {
3054      child = element.ownerDocument.createElement(type);
3055  
3056      for (var key in attributes) {
3057        child.setAttribute(key, attributes[key]);
3058      }
3059    }
3060  
3061    return element.appendChild(child);
3062  }
3063  
3064  function to_dom_appendText(node, text) {
3065    node.appendData(text);
3066  }
3067  
3068  function to_dom_getLastChild(_ref) {
3069    var lastChild = _ref.lastChild;
3070    return lastChild;
3071  }
3072  
3073  function to_dom_getParent(_ref2) {
3074    var parentNode = _ref2.parentNode;
3075    return parentNode;
3076  }
3077  
3078  function to_dom_isText(node) {
3079    return node.nodeType === node.TEXT_NODE;
3080  }
3081  
3082  function to_dom_getText(_ref3) {
3083    var nodeValue = _ref3.nodeValue;
3084    return nodeValue;
3085  }
3086  
3087  function to_dom_remove(node) {
3088    return node.parentNode.removeChild(node);
3089  }
3090  
3091  function toDom(_ref4) {
3092    var value = _ref4.value,
3093        multilineTag = _ref4.multilineTag,
3094        prepareEditableTree = _ref4.prepareEditableTree,
3095        _ref4$isEditableTree = _ref4.isEditableTree,
3096        isEditableTree = _ref4$isEditableTree === void 0 ? true : _ref4$isEditableTree,
3097        placeholder = _ref4.placeholder,
3098        _ref4$doc = _ref4.doc,
3099        doc = _ref4$doc === void 0 ? document : _ref4$doc;
3100    var startPath = [];
3101    var endPath = [];
3102  
3103    if (prepareEditableTree) {
3104      value = to_dom_objectSpread({}, value, {
3105        formats: prepareEditableTree(value)
3106      });
3107    }
3108    /**
3109     * Returns a new instance of a DOM tree upon which RichText operations can be
3110     * applied.
3111     *
3112     * Note: The current implementation will return a shared reference, reset on
3113     * each call to `createEmpty`. Therefore, you should not hold a reference to
3114     * the value to operate upon asynchronously, as it may have unexpected results.
3115     *
3116     * @return {Object} RichText tree.
3117     */
3118  
3119  
3120    var createEmpty = function createEmpty() {
3121      return createElement(doc, '');
3122    };
3123  
3124    var tree = toTree({
3125      value: value,
3126      multilineTag: multilineTag,
3127      createEmpty: createEmpty,
3128      append: to_dom_append,
3129      getLastChild: to_dom_getLastChild,
3130      getParent: to_dom_getParent,
3131      isText: to_dom_isText,
3132      getText: to_dom_getText,
3133      remove: to_dom_remove,
3134      appendText: to_dom_appendText,
3135      onStartIndex: function onStartIndex(body, pointer) {
3136        startPath = createPathToNode(pointer, body, [pointer.nodeValue.length]);
3137      },
3138      onEndIndex: function onEndIndex(body, pointer) {
3139        endPath = createPathToNode(pointer, body, [pointer.nodeValue.length]);
3140      },
3141      isEditableTree: isEditableTree,
3142      placeholder: placeholder
3143    });
3144    return {
3145      body: tree,
3146      selection: {
3147        startPath: startPath,
3148        endPath: endPath
3149      }
3150    };
3151  }
3152  /**
3153   * Create an `Element` tree from a Rich Text value and applies the difference to
3154   * the `Element` tree contained by `current`. If a `multilineTag` is provided,
3155   * text separated by two new lines will be wrapped in an `Element` of that type.
3156   *
3157   * @param {Object}      $1                        Named arguments.
3158   * @param {Object}      $1.value                  Value to apply.
3159   * @param {HTMLElement} $1.current                The live root node to apply the element tree to.
3160   * @param {string}      [$1.multilineTag]         Multiline tag.
3161   * @param {Array}       [$1.multilineWrapperTags] Tags where lines can be found if nesting is possible.
3162   */
3163  
3164  function apply(_ref5) {
3165    var value = _ref5.value,
3166        current = _ref5.current,
3167        multilineTag = _ref5.multilineTag,
3168        prepareEditableTree = _ref5.prepareEditableTree,
3169        __unstableDomOnly = _ref5.__unstableDomOnly,
3170        placeholder = _ref5.placeholder;
3171  
3172    // Construct a new element tree in memory.
3173    var _toDom = toDom({
3174      value: value,
3175      multilineTag: multilineTag,
3176      prepareEditableTree: prepareEditableTree,
3177      placeholder: placeholder,
3178      doc: current.ownerDocument
3179    }),
3180        body = _toDom.body,
3181        selection = _toDom.selection;
3182  
3183    applyValue(body, current);
3184  
3185    if (value.start !== undefined && !__unstableDomOnly) {
3186      applySelection(selection, current);
3187    }
3188  }
3189  function applyValue(future, current) {
3190    var i = 0;
3191    var futureChild;
3192  
3193    while (futureChild = future.firstChild) {
3194      var currentChild = current.childNodes[i];
3195  
3196      if (!currentChild) {
3197        current.appendChild(futureChild);
3198      } else if (!currentChild.isEqualNode(futureChild)) {
3199        if (currentChild.nodeName !== futureChild.nodeName || currentChild.nodeType === currentChild.TEXT_NODE && currentChild.data !== futureChild.data) {
3200          current.replaceChild(futureChild, currentChild);
3201        } else {
3202          var currentAttributes = currentChild.attributes;
3203          var futureAttributes = futureChild.attributes;
3204  
3205          if (currentAttributes) {
3206            var ii = currentAttributes.length; // Reverse loop because `removeAttribute` on `currentChild`
3207            // changes `currentAttributes`.
3208  
3209            while (ii--) {
3210              var name = currentAttributes[ii].name;
3211  
3212              if (!futureChild.getAttribute(name)) {
3213                currentChild.removeAttribute(name);
3214              }
3215            }
3216          }
3217  
3218          if (futureAttributes) {
3219            for (var _ii = 0; _ii < futureAttributes.length; _ii++) {
3220              var _futureAttributes$_ii = futureAttributes[_ii],
3221                  _name = _futureAttributes$_ii.name,
3222                  value = _futureAttributes$_ii.value;
3223  
3224              if (currentChild.getAttribute(_name) !== value) {
3225                currentChild.setAttribute(_name, value);
3226              }
3227            }
3228          }
3229  
3230          applyValue(futureChild, currentChild);
3231          future.removeChild(futureChild);
3232        }
3233      } else {
3234        future.removeChild(futureChild);
3235      }
3236  
3237      i++;
3238    }
3239  
3240    while (current.childNodes[i]) {
3241      current.removeChild(current.childNodes[i]);
3242    }
3243  }
3244  /**
3245   * Returns true if two ranges are equal, or false otherwise. Ranges are
3246   * considered equal if their start and end occur in the same container and
3247   * offset.
3248   *
3249   * @param {Range} a First range object to test.
3250   * @param {Range} b First range object to test.
3251   *
3252   * @return {boolean} Whether the two ranges are equal.
3253   */
3254  
3255  function isRangeEqual(a, b) {
3256    return a.startContainer === b.startContainer && a.startOffset === b.startOffset && a.endContainer === b.endContainer && a.endOffset === b.endOffset;
3257  }
3258  
3259  function applySelection(_ref6, current) {
3260    var startPath = _ref6.startPath,
3261        endPath = _ref6.endPath;
3262  
3263    var _getNodeByPath = getNodeByPath(current, startPath),
3264        startContainer = _getNodeByPath.node,
3265        startOffset = _getNodeByPath.offset;
3266  
3267    var _getNodeByPath2 = getNodeByPath(current, endPath),
3268        endContainer = _getNodeByPath2.node,
3269        endOffset = _getNodeByPath2.offset;
3270  
3271    var ownerDocument = current.ownerDocument;
3272    var defaultView = ownerDocument.defaultView;
3273    var selection = defaultView.getSelection();
3274    var range = ownerDocument.createRange();
3275    range.setStart(startContainer, startOffset);
3276    range.setEnd(endContainer, endOffset);
3277    var activeElement = ownerDocument.activeElement;
3278  
3279    if (selection.rangeCount > 0) {
3280      // If the to be added range and the live range are the same, there's no
3281      // need to remove the live range and add the equivalent range.
3282      if (isRangeEqual(range, selection.getRangeAt(0))) {
3283        return;
3284      }
3285  
3286      selection.removeAllRanges();
3287    }
3288  
3289    selection.addRange(range); // This function is not intended to cause a shift in focus. Since the above
3290    // selection manipulations may shift focus, ensure that focus is restored to
3291    // its previous state.
3292  
3293    if (activeElement !== ownerDocument.activeElement) {
3294      // The `instanceof` checks protect against edge cases where the focused
3295      // element is not of the interface HTMLElement (does not have a `focus`
3296      // or `blur` property).
3297      //
3298      // See: https://github.com/Microsoft/TypeScript/issues/5901#issuecomment-431649653
3299      if (activeElement instanceof defaultView.HTMLElement) {
3300        activeElement.focus();
3301      }
3302    }
3303  }
3304  
3305  // EXTERNAL MODULE: external {"this":["wp","escapeHtml"]}
3306  var external_this_wp_escapeHtml_ = __webpack_require__(89);
3307  
3308  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/to-html-string.js
3309  /**
3310   * WordPress dependencies
3311   */
3312  
3313  /**
3314   * Internal dependencies
3315   */
3316  
3317  
3318  /**
3319   * Create an HTML string from a Rich Text value. If a `multilineTag` is
3320   * provided, text separated by a line separator will be wrapped in it.
3321   *
3322   * @param {Object}   $1                      Named argements.
3323   * @param {Object}   $1.value                Rich text value.
3324   * @param {string}   [$1.multilineTag]       Multiline tag.
3325   * @param {?boolean} [$1.preserveWhiteSpace] Whether or not to use newline
3326   *                                           characters for line breaks.
3327   *
3328   * @return {string} HTML string.
3329   */
3330  
3331  function toHTMLString(_ref) {
3332    var value = _ref.value,
3333        multilineTag = _ref.multilineTag,
3334        preserveWhiteSpace = _ref.preserveWhiteSpace;
3335    var tree = toTree({
3336      value: value,
3337      multilineTag: multilineTag,
3338      preserveWhiteSpace: preserveWhiteSpace,
3339      createEmpty: to_html_string_createEmpty,
3340      append: to_html_string_append,
3341      getLastChild: to_html_string_getLastChild,
3342      getParent: to_html_string_getParent,
3343      isText: to_html_string_isText,
3344      getText: to_html_string_getText,
3345      remove: to_html_string_remove,
3346      appendText: to_html_string_appendText
3347    });
3348    return createChildrenHTML(tree.children);
3349  }
3350  
3351  function to_html_string_createEmpty() {
3352    return {};
3353  }
3354  
3355  function to_html_string_getLastChild(_ref2) {
3356    var children = _ref2.children;
3357    return children && children[children.length - 1];
3358  }
3359  
3360  function to_html_string_append(parent, object) {
3361    if (typeof object === 'string') {
3362      object = {
3363        text: object
3364      };
3365    }
3366  
3367    object.parent = parent;
3368    parent.children = parent.children || [];
3369    parent.children.push(object);
3370    return object;
3371  }
3372  
3373  function to_html_string_appendText(object, text) {
3374    object.text += text;
3375  }
3376  
3377  function to_html_string_getParent(_ref3) {
3378    var parent = _ref3.parent;
3379    return parent;
3380  }
3381  
3382  function to_html_string_isText(_ref4) {
3383    var text = _ref4.text;
3384    return typeof text === 'string';
3385  }
3386  
3387  function to_html_string_getText(_ref5) {
3388    var text = _ref5.text;
3389    return text;
3390  }
3391  
3392  function to_html_string_remove(object) {
3393    var index = object.parent.children.indexOf(object);
3394  
3395    if (index !== -1) {
3396      object.parent.children.splice(index, 1);
3397    }
3398  
3399    return object;
3400  }
3401  
3402  function createElementHTML(_ref6) {
3403    var type = _ref6.type,
3404        attributes = _ref6.attributes,
3405        object = _ref6.object,
3406        children = _ref6.children;
3407    var attributeString = '';
3408  
3409    for (var key in attributes) {
3410      if (!Object(external_this_wp_escapeHtml_["isValidAttributeName"])(key)) {
3411        continue;
3412      }
3413  
3414      attributeString += " ".concat(key, "=\"").concat(Object(external_this_wp_escapeHtml_["escapeAttribute"])(attributes[key]), "\"");
3415    }
3416  
3417    if (object) {
3418      return "<".concat(type).concat(attributeString, ">");
3419    }
3420  
3421    return "<".concat(type).concat(attributeString, ">").concat(createChildrenHTML(children), "</").concat(type, ">");
3422  }
3423  
3424  function createChildrenHTML() {
3425    var children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
3426    return children.map(function (child) {
3427      return child.text === undefined ? createElementHTML(child) : Object(external_this_wp_escapeHtml_["escapeEditableHTML"])(child.text);
3428    }).join('');
3429  }
3430  
3431  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/toggle-format.js
3432  /**
3433   * Internal dependencies
3434   */
3435  
3436  
3437  
3438  /**
3439   * Toggles a format object to a Rich Text value at the current selection.
3440   *
3441   * @param {Object} value  Value to modify.
3442   * @param {Object} format Format to apply or remove.
3443   *
3444   * @return {Object} A new value with the format applied or removed.
3445   */
3446  
3447  function toggleFormat(value, format) {
3448    if (getActiveFormat(value, format.type)) {
3449      return removeFormat(value, format.type);
3450    }
3451  
3452    return applyFormat(value, format);
3453  }
3454  
3455  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/unregister-format-type.js
3456  /**
3457   * WordPress dependencies
3458   */
3459  
3460  /** @typedef {import('./register-format-type').WPFormat} WPFormat */
3461  
3462  /**
3463   * Unregisters a format.
3464   *
3465   * @param {string} name Format name.
3466   *
3467   * @return {WPFormat|undefined} The previous format value, if it has been successfully
3468   *                              unregistered; otherwise `undefined`.
3469   */
3470  
3471  function unregisterFormatType(name) {
3472    var oldFormat = Object(external_this_wp_data_["select"])('core/rich-text').getFormatType(name);
3473  
3474    if (!oldFormat) {
3475      window.console.error("Format ".concat(name, " is not registered."));
3476      return;
3477    }
3478  
3479    Object(external_this_wp_data_["dispatch"])('core/rich-text').removeFormatTypes(name);
3480    return oldFormat;
3481  }
3482  
3483  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/can-indent-list-items.js
3484  /**
3485   * Internal dependencies
3486   */
3487  
3488  /**
3489   * Checks if the selected list item can be indented.
3490   *
3491   * @param {Object} value Value to check.
3492   *
3493   * @return {boolean} Whether or not the selected list item can be indented.
3494   */
3495  
3496  function canIndentListItems(value) {
3497    var lineIndex = getLineIndex(value); // There is only one line, so the line cannot be indented.
3498  
3499    if (lineIndex === undefined) {
3500      return false;
3501    }
3502  
3503    var replacements = value.replacements;
3504    var previousLineIndex = getLineIndex(value, lineIndex);
3505    var formatsAtLineIndex = replacements[lineIndex] || [];
3506    var formatsAtPreviousLineIndex = replacements[previousLineIndex] || []; // If the indentation of the current line is greater than previous line,
3507    // then the line cannot be furter indented.
3508  
3509    return formatsAtLineIndex.length <= formatsAtPreviousLineIndex.length;
3510  }
3511  
3512  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/can-outdent-list-items.js
3513  /**
3514   * Internal dependencies
3515   */
3516  
3517  /**
3518   * Checks if the selected list item can be outdented.
3519   *
3520   * @param {Object} value Value to check.
3521   *
3522   * @return {boolean} Whether or not the selected list item can be outdented.
3523   */
3524  
3525  function canOutdentListItems(value) {
3526    var replacements = value.replacements,
3527        start = value.start;
3528    var startingLineIndex = getLineIndex(value, start);
3529    return replacements[startingLineIndex] !== undefined;
3530  }
3531  
3532  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/indent-list-items.js
3533  
3534  
3535  function indent_list_items_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; }
3536  
3537  function indent_list_items_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { indent_list_items_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 { indent_list_items_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3538  
3539  /**
3540   * Internal dependencies
3541   */
3542  
3543  
3544  
3545  /**
3546   * Gets the line index of the first previous list item with higher indentation.
3547   *
3548   * @param {Object} value      Value to search.
3549   * @param {number} lineIndex  Line index of the list item to compare with.
3550   *
3551   * @return {boolean} The line index.
3552   */
3553  
3554  function getTargetLevelLineIndex(_ref, lineIndex) {
3555    var text = _ref.text,
3556        replacements = _ref.replacements;
3557    var startFormats = replacements[lineIndex] || [];
3558    var index = lineIndex;
3559  
3560    while (index-- >= 0) {
3561      if (text[index] !== LINE_SEPARATOR) {
3562        continue;
3563      }
3564  
3565      var formatsAtIndex = replacements[index] || []; // Return the first line index that is one level higher. If the level is
3566      // lower or equal, there is no result.
3567  
3568      if (formatsAtIndex.length === startFormats.length + 1) {
3569        return index;
3570      } else if (formatsAtIndex.length <= startFormats.length) {
3571        return;
3572      }
3573    }
3574  }
3575  /**
3576   * Indents any selected list items if possible.
3577   *
3578   * @param {Object} value      Value to change.
3579   * @param {Object} rootFormat Root format.
3580   *
3581   * @return {Object} The changed value.
3582   */
3583  
3584  
3585  function indentListItems(value, rootFormat) {
3586    if (!canIndentListItems(value)) {
3587      return value;
3588    }
3589  
3590    var lineIndex = getLineIndex(value);
3591    var previousLineIndex = getLineIndex(value, lineIndex);
3592    var text = value.text,
3593        replacements = value.replacements,
3594        end = value.end;
3595    var newFormats = replacements.slice();
3596    var targetLevelLineIndex = getTargetLevelLineIndex(value, lineIndex);
3597  
3598    for (var index = lineIndex; index < end; index++) {
3599      if (text[index] !== LINE_SEPARATOR) {
3600        continue;
3601      } // Get the previous list, and if there's a child list, take over the
3602      // formats. If not, duplicate the last level and create a new level.
3603  
3604  
3605      if (targetLevelLineIndex) {
3606        var targetFormats = replacements[targetLevelLineIndex] || [];
3607        newFormats[index] = targetFormats.concat((newFormats[index] || []).slice(targetFormats.length - 1));
3608      } else {
3609        var _targetFormats = replacements[previousLineIndex] || [];
3610  
3611        var lastformat = _targetFormats[_targetFormats.length - 1] || rootFormat;
3612        newFormats[index] = _targetFormats.concat([lastformat], (newFormats[index] || []).slice(_targetFormats.length));
3613      }
3614    }
3615  
3616    return indent_list_items_objectSpread({}, value, {
3617      replacements: newFormats
3618    });
3619  }
3620  
3621  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-parent-line-index.js
3622  /**
3623   * Internal dependencies
3624   */
3625  
3626  /**
3627   * Gets the index of the first parent list. To get the parent list formats, we
3628   * go through every list item until we find one with exactly one format type
3629   * less.
3630   *
3631   * @param {Object} value     Value to search.
3632   * @param {number} lineIndex Line index of a child list item.
3633   *
3634   * @return {Array} The parent list line index.
3635   */
3636  
3637  function getParentLineIndex(_ref, lineIndex) {
3638    var text = _ref.text,
3639        replacements = _ref.replacements;
3640    var startFormats = replacements[lineIndex] || [];
3641    var index = lineIndex;
3642  
3643    while (index-- >= 0) {
3644      if (text[index] !== LINE_SEPARATOR) {
3645        continue;
3646      }
3647  
3648      var formatsAtIndex = replacements[index] || [];
3649  
3650      if (formatsAtIndex.length === startFormats.length - 1) {
3651        return index;
3652      }
3653    }
3654  }
3655  
3656  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-last-child-index.js
3657  /**
3658   * Internal dependencies
3659   */
3660  
3661  /**
3662   * Gets the line index of the last child in the list.
3663   *
3664   * @param {Object} value     Value to search.
3665   * @param {number} lineIndex Line index of a list item in the list.
3666   *
3667   * @return {Array} The index of the last child.
3668   */
3669  
3670  function getLastChildIndex(_ref, lineIndex) {
3671    var text = _ref.text,
3672        replacements = _ref.replacements;
3673    var lineFormats = replacements[lineIndex] || []; // Use the given line index in case there are no next children.
3674  
3675    var childIndex = lineIndex; // `lineIndex` could be `undefined` if it's the first line.
3676  
3677    for (var index = lineIndex || 0; index < text.length; index++) {
3678      // We're only interested in line indices.
3679      if (text[index] !== LINE_SEPARATOR) {
3680        continue;
3681      }
3682  
3683      var formatsAtIndex = replacements[index] || []; // If the amout of formats is equal or more, store it, then return the
3684      // last one if the amount of formats is less.
3685  
3686      if (formatsAtIndex.length >= lineFormats.length) {
3687        childIndex = index;
3688      } else {
3689        return childIndex;
3690      }
3691    } // If the end of the text is reached, return the last child index.
3692  
3693  
3694    return childIndex;
3695  }
3696  
3697  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/outdent-list-items.js
3698  
3699  
3700  function outdent_list_items_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; }
3701  
3702  function outdent_list_items_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { outdent_list_items_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 { outdent_list_items_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3703  
3704  /**
3705   * Internal dependencies
3706   */
3707  
3708  
3709  
3710  
3711  
3712  /**
3713   * Outdents any selected list items if possible.
3714   *
3715   * @param {Object} value Value to change.
3716   *
3717   * @return {Object} The changed value.
3718   */
3719  
3720  function outdentListItems(value) {
3721    if (!canOutdentListItems(value)) {
3722      return value;
3723    }
3724  
3725    var text = value.text,
3726        replacements = value.replacements,
3727        start = value.start,
3728        end = value.end;
3729    var startingLineIndex = getLineIndex(value, start);
3730    var newFormats = replacements.slice(0);
3731    var parentFormats = replacements[getParentLineIndex(value, startingLineIndex)] || [];
3732    var endingLineIndex = getLineIndex(value, end);
3733    var lastChildIndex = getLastChildIndex(value, endingLineIndex); // Outdent all list items from the starting line index until the last child
3734    // index of the ending list. All children of the ending list need to be
3735    // outdented, otherwise they'll be orphaned.
3736  
3737    for (var index = startingLineIndex; index <= lastChildIndex; index++) {
3738      // Skip indices that are not line separators.
3739      if (text[index] !== LINE_SEPARATOR) {
3740        continue;
3741      } // In the case of level 0, the formats at the index are undefined.
3742  
3743  
3744      var currentFormats = newFormats[index] || []; // Omit the indentation level where the selection starts.
3745  
3746      newFormats[index] = parentFormats.concat(currentFormats.slice(parentFormats.length + 1));
3747  
3748      if (newFormats[index].length === 0) {
3749        delete newFormats[index];
3750      }
3751    }
3752  
3753    return outdent_list_items_objectSpread({}, value, {
3754      replacements: newFormats
3755    });
3756  }
3757  
3758  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/change-list-type.js
3759  
3760  
3761  function change_list_type_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; }
3762  
3763  function change_list_type_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { change_list_type_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 { change_list_type_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3764  
3765  /**
3766   * Internal dependencies
3767   */
3768  
3769  
3770  
3771  /**
3772   * Changes the list type of the selected indented list, if any. Looks at the
3773   * currently selected list item and takes the parent list, then changes the list
3774   * type of this list. When multiple lines are selected, the parent lists are
3775   * takes and changed.
3776   *
3777   * @param {Object} value     Value to change.
3778   * @param {Object} newFormat The new list format object. Choose between
3779   *                           `{ type: 'ol' }` and `{ type: 'ul' }`.
3780   *
3781   * @return {Object} The changed value.
3782   */
3783  
3784  function changeListType(value, newFormat) {
3785    var text = value.text,
3786        replacements = value.replacements,
3787        start = value.start,
3788        end = value.end;
3789    var startingLineIndex = getLineIndex(value, start);
3790    var startLineFormats = replacements[startingLineIndex] || [];
3791    var endLineFormats = replacements[getLineIndex(value, end)] || [];
3792    var startIndex = getParentLineIndex(value, startingLineIndex);
3793    var newReplacements = replacements.slice();
3794    var startCount = startLineFormats.length - 1;
3795    var endCount = endLineFormats.length - 1;
3796    var changed;
3797  
3798    for (var index = startIndex + 1 || 0; index < text.length; index++) {
3799      if (text[index] !== LINE_SEPARATOR) {
3800        continue;
3801      }
3802  
3803      if ((newReplacements[index] || []).length <= startCount) {
3804        break;
3805      }
3806  
3807      if (!newReplacements[index]) {
3808        continue;
3809      }
3810  
3811      changed = true;
3812      newReplacements[index] = newReplacements[index].map(function (format, i) {
3813        return i < startCount || i > endCount ? format : newFormat;
3814      });
3815    }
3816  
3817    if (!changed) {
3818      return value;
3819    }
3820  
3821    return change_list_type_objectSpread({}, value, {
3822      replacements: newReplacements
3823    });
3824  }
3825  
3826  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
3827  var esm_extends = __webpack_require__(8);
3828  
3829  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
3830  var slicedToArray = __webpack_require__(14);
3831  
3832  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
3833  var objectWithoutProperties = __webpack_require__(15);
3834  
3835  // EXTERNAL MODULE: external {"this":["wp","element"]}
3836  var external_this_wp_element_ = __webpack_require__(0);
3837  
3838  // EXTERNAL MODULE: ./node_modules/classnames/index.js
3839  var classnames = __webpack_require__(11);
3840  var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
3841  
3842  // EXTERNAL MODULE: external {"this":["wp","keycodes"]}
3843  var external_this_wp_keycodes_ = __webpack_require__(21);
3844  
3845  // EXTERNAL MODULE: external {"this":["wp","deprecated"]}
3846  var external_this_wp_deprecated_ = __webpack_require__(37);
3847  var external_this_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_deprecated_);
3848  
3849  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/component/format-edit.js
3850  
3851  
3852  /**
3853   * Internal dependencies
3854   */
3855  
3856  
3857  /**
3858   * Set of all interactive content tags.
3859   *
3860   * @see https://html.spec.whatwg.org/multipage/dom.html#interactive-content
3861   */
3862  
3863  var interactiveContentTags = new Set(['a', 'audio', 'button', 'details', 'embed', 'iframe', 'input', 'label', 'select', 'textarea', 'video']);
3864  function FormatEdit(_ref) {
3865    var formatTypes = _ref.formatTypes,
3866        onChange = _ref.onChange,
3867        onFocus = _ref.onFocus,
3868        value = _ref.value,
3869        allowedFormats = _ref.allowedFormats,
3870        withoutInteractiveFormatting = _ref.withoutInteractiveFormatting;
3871    return formatTypes.map(function (_ref2) {
3872      var name = _ref2.name,
3873          Edit = _ref2.edit,
3874          tagName = _ref2.tagName;
3875  
3876      if (!Edit) {
3877        return null;
3878      }
3879  
3880      if (allowedFormats && allowedFormats.indexOf(name) === -1) {
3881        return null;
3882      }
3883  
3884      if (withoutInteractiveFormatting && interactiveContentTags.has(tagName)) {
3885        return null;
3886      }
3887  
3888      var activeFormat = getActiveFormat(value, name);
3889      var isActive = activeFormat !== undefined;
3890      var activeObject = getActiveObject(value);
3891      var isObjectActive = activeObject !== undefined && activeObject.type === name;
3892      return Object(external_this_wp_element_["createElement"])(Edit, {
3893        key: name,
3894        isActive: isActive,
3895        activeAttributes: isActive ? activeFormat.attributes || {} : {},
3896        isObjectActive: isObjectActive,
3897        activeObjectAttributes: isObjectActive ? activeObject.attributes || {} : {},
3898        value: value,
3899        onChange: onChange,
3900        onFocus: onFocus
3901      });
3902    });
3903  }
3904  
3905  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/update-formats.js
3906  /**
3907   * Internal dependencies
3908   */
3909  
3910  /**
3911   * Efficiently updates all the formats from `start` (including) until `end`
3912   * (excluding) with the active formats. Mutates `value`.
3913   *
3914   * @param  {Object} $1         Named paramentes.
3915   * @param  {Object} $1.value   Value te update.
3916   * @param  {number} $1.start   Index to update from.
3917   * @param  {number} $1.end     Index to update until.
3918   * @param  {Array}  $1.formats Replacement formats.
3919   *
3920   * @return {Object} Mutated value.
3921   */
3922  
3923  function updateFormats(_ref) {
3924    var value = _ref.value,
3925        start = _ref.start,
3926        end = _ref.end,
3927        formats = _ref.formats;
3928    var formatsBefore = value.formats[start - 1] || [];
3929    var formatsAfter = value.formats[end] || []; // First, fix the references. If any format right before or after are
3930    // equal, the replacement format should use the same reference.
3931  
3932    value.activeFormats = formats.map(function (format, index) {
3933      if (formatsBefore[index]) {
3934        if (isFormatEqual(format, formatsBefore[index])) {
3935          return formatsBefore[index];
3936        }
3937      } else if (formatsAfter[index]) {
3938        if (isFormatEqual(format, formatsAfter[index])) {
3939          return formatsAfter[index];
3940        }
3941      }
3942  
3943      return format;
3944    });
3945  
3946    while (--end >= start) {
3947      if (value.activeFormats.length > 0) {
3948        value.formats[end] = value.activeFormats;
3949      } else {
3950        delete value.formats[end];
3951      }
3952    }
3953  
3954    return value;
3955  }
3956  
3957  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/component/with-format-types.js
3958  
3959  
3960  
3961  
3962  function with_format_types_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; }
3963  
3964  function with_format_types_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { with_format_types_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 { with_format_types_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3965  
3966  /**
3967   * External dependencies
3968   */
3969  
3970  /**
3971   * WordPress dependencies
3972   */
3973  
3974  
3975  
3976  
3977  function formatTypesSelector(select) {
3978    return select('core/rich-text').getFormatTypes();
3979  }
3980  /**
3981   * This higher-order component provides RichText with the `formatTypes` prop
3982   * and its derived props from experimental format type settings.
3983   *
3984   * @param {WPComponent} RichText The rich text component to add props for.
3985   *
3986   * @return {WPComponent} New enhanced component.
3987   */
3988  
3989  
3990  function withFormatTypes(RichText) {
3991    return function WithFormatTypes(props) {
3992      var clientId = props.clientId,
3993          identifier = props.identifier;
3994      var formatTypes = Object(external_this_wp_data_["useSelect"])(formatTypesSelector, []);
3995      var selectProps = Object(external_this_wp_data_["useSelect"])(function (select) {
3996        return formatTypes.reduce(function (acc, settings) {
3997          if (!settings.__experimentalGetPropsForEditableTreePreparation) {
3998            return acc;
3999          }
4000  
4001          var selectPrefix = "format_prepare_props_(".concat(settings.name, ")_");
4002          return with_format_types_objectSpread({}, acc, {}, Object(external_this_lodash_["mapKeys"])(settings.__experimentalGetPropsForEditableTreePreparation(select, {
4003            richTextIdentifier: identifier,
4004            blockClientId: clientId
4005          }), function (value, key) {
4006            return selectPrefix + key;
4007          }));
4008        }, {});
4009      }, [formatTypes, clientId, identifier]);
4010  
4011      var dispatchProps = Object(external_this_wp_data_["__unstableUseDispatchWithMap"])(function (dispatch) {
4012        return formatTypes.reduce(function (acc, settings) {
4013          if (!settings.__experimentalGetPropsForEditableTreeChangeHandler) {
4014            return acc;
4015          }
4016  
4017          var dispatchPrefix = "format_on_change_props_(".concat(settings.name, ")_");
4018          return with_format_types_objectSpread({}, acc, {}, Object(external_this_lodash_["mapKeys"])(settings.__experimentalGetPropsForEditableTreeChangeHandler(dispatch, {
4019            richTextIdentifier: identifier,
4020            blockClientId: clientId
4021          }), function (value, key) {
4022            return dispatchPrefix + key;
4023          }));
4024        }, {});
4025      }, [formatTypes, clientId, identifier]);
4026  
4027      var newProps = Object(external_this_wp_element_["useMemo"])(function () {
4028        return formatTypes.reduce(function (acc, settings) {
4029          if (!settings.__experimentalCreatePrepareEditableTree) {
4030            return acc;
4031          }
4032  
4033          var args = {
4034            richTextIdentifier: identifier,
4035            blockClientId: clientId
4036          };
4037  
4038          var combined = with_format_types_objectSpread({}, selectProps, {}, dispatchProps);
4039  
4040          var name = settings.name;
4041          var selectPrefix = "format_prepare_props_(".concat(name, ")_");
4042          var dispatchPrefix = "format_on_change_props_(".concat(name, ")_");
4043          var propsByPrefix = Object.keys(combined).reduce(function (accumulator, key) {
4044            if (key.startsWith(selectPrefix)) {
4045              accumulator[key.slice(selectPrefix.length)] = combined[key];
4046            }
4047  
4048            if (key.startsWith(dispatchPrefix)) {
4049              accumulator[key.slice(dispatchPrefix.length)] = combined[key];
4050            }
4051  
4052            return accumulator;
4053          }, {});
4054  
4055          if (settings.__experimentalCreateOnChangeEditableValue) {
4056            var _objectSpread2;
4057  
4058            return with_format_types_objectSpread({}, acc, (_objectSpread2 = {}, Object(defineProperty["a" /* default */])(_objectSpread2, "format_value_functions_(".concat(name, ")"), settings.__experimentalCreatePrepareEditableTree(propsByPrefix, args)), Object(defineProperty["a" /* default */])(_objectSpread2, "format_on_change_functions_(".concat(name, ")"), settings.__experimentalCreateOnChangeEditableValue(propsByPrefix, args)), _objectSpread2));
4059          }
4060  
4061          return with_format_types_objectSpread({}, acc, Object(defineProperty["a" /* default */])({}, "format_prepare_functions_(".concat(name, ")"), settings.__experimentalCreatePrepareEditableTree(propsByPrefix, args)));
4062        }, {});
4063      }, [formatTypes, clientId, identifier, selectProps, dispatchProps]);
4064      return Object(external_this_wp_element_["createElement"])(RichText, Object(esm_extends["a" /* default */])({}, props, selectProps, newProps, {
4065        formatTypes: formatTypes
4066      }));
4067    };
4068  }
4069  
4070  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/component/use-boundary-style.js
4071  /**
4072   * WordPress dependencies
4073   */
4074  
4075  /**
4076   * Calculates and renders the format boundary style when the active formats
4077   * change.
4078   */
4079  
4080  function useBoundaryStyle(_ref) {
4081    var activeFormats = _ref.activeFormats,
4082        ref = _ref.ref;
4083    Object(external_this_wp_element_["useEffect"])(function () {
4084      // There's no need to recalculate the boundary styles if no formats are
4085      // active, because no boundary styles will be visible.
4086      if (!activeFormats || !activeFormats.length) {
4087        return;
4088      }
4089  
4090      var boundarySelector = '*[data-rich-text-format-boundary]';
4091      var element = ref.current.querySelector(boundarySelector);
4092  
4093      if (!element) {
4094        return;
4095      }
4096  
4097      var ownerDocument = element.ownerDocument;
4098      var defaultView = ownerDocument.defaultView;
4099      var computedStyle = defaultView.getComputedStyle(element);
4100      var newColor = computedStyle.color.replace(')', ', 0.2)').replace('rgb', 'rgba');
4101      var selector = ".rich-text:focus ".concat(boundarySelector);
4102      var rule = "background-color: ".concat(newColor);
4103      var style = "".concat(selector, " {").concat(rule, "}");
4104      var globalStyleId = 'rich-text-boundary-style';
4105      var globalStyle = ownerDocument.getElementById(globalStyleId);
4106  
4107      if (!globalStyle) {
4108        globalStyle = ownerDocument.createElement('style');
4109        globalStyle.id = globalStyleId;
4110        ownerDocument.head.appendChild(globalStyle);
4111      }
4112  
4113      if (globalStyle.innerHTML !== style) {
4114        globalStyle.innerHTML = style;
4115      }
4116    }, [activeFormats]);
4117  }
4118  
4119  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/component/use-inline-warning.js
4120  /**
4121   * WordPress dependencies
4122   */
4123  
4124  function useInlineWarning(_ref) {
4125    var ref = _ref.ref;
4126    Object(external_this_wp_element_["useEffect"])(function () {
4127      if (false) { var computedStyle, defaultView, target; }
4128    }, []);
4129  }
4130  
4131  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/component/index.js
4132  
4133  
4134  
4135  
4136  
4137  
4138  function component_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; }
4139  
4140  function component_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { component_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 { component_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4141  
4142  /**
4143   * External dependencies
4144   */
4145  
4146  
4147  /**
4148   * WordPress dependencies
4149   */
4150  
4151  
4152  
4153  
4154  /**
4155   * Internal dependencies
4156   */
4157  
4158  
4159  
4160  
4161  
4162  
4163  
4164  
4165  
4166  
4167  
4168  
4169  
4170  
4171  
4172  
4173  
4174  
4175  /** @typedef {import('@wordpress/element').WPSyntheticEvent} WPSyntheticEvent */
4176  
4177  /**
4178   * All inserting input types that would insert HTML into the DOM.
4179   *
4180   * @see https://www.w3.org/TR/input-events-2/#interface-InputEvent-Attributes
4181   *
4182   * @type {Set}
4183   */
4184  
4185  var INSERTION_INPUT_TYPES_TO_IGNORE = new Set(['insertParagraph', 'insertOrderedList', 'insertUnorderedList', 'insertHorizontalRule', 'insertLink']);
4186  /**
4187   * In HTML, leading and trailing spaces are not visible, and multiple spaces
4188   * elsewhere are visually reduced to one space. This rule prevents spaces from
4189   * collapsing so all space is visible in the editor and can be removed. It also
4190   * prevents some browsers from inserting non-breaking spaces at the end of a
4191   * line to prevent the space from visually disappearing. Sometimes these non
4192   * breaking spaces can linger in the editor causing unwanted non breaking spaces
4193   * in between words. If also prevent Firefox from inserting a trailing `br` node
4194   * to visualise any trailing space, causing the element to be saved.
4195   *
4196   * > Authors are encouraged to set the 'white-space' property on editing hosts
4197   * > and on markup that was originally created through these editing mechanisms
4198   * > to the value 'pre-wrap'. Default HTML whitespace handling is not well
4199   * > suited to WYSIWYG editing, and line wrapping will not work correctly in
4200   * > some corner cases if 'white-space' is left at its default value.
4201   *
4202   * https://html.spec.whatwg.org/multipage/interaction.html#best-practices-for-in-page-editors
4203   *
4204   * @type {string}
4205   */
4206  
4207  var whiteSpace = 'pre-wrap';
4208  /**
4209   * Default style object for the editable element.
4210   *
4211   * @type {Object<string,string>}
4212   */
4213  
4214  var defaultStyle = {
4215    whiteSpace: whiteSpace
4216  };
4217  var EMPTY_ACTIVE_FORMATS = [];
4218  
4219  function createPrepareEditableTree(props, prefix) {
4220    var fns = Object.keys(props).reduce(function (accumulator, key) {
4221      if (key.startsWith(prefix)) {
4222        accumulator.push(props[key]);
4223      }
4224  
4225      return accumulator;
4226    }, []);
4227    return function (value) {
4228      return fns.reduce(function (accumulator, fn) {
4229        return fn(accumulator, value.text);
4230      }, value.formats);
4231    };
4232  }
4233  /**
4234   * If the selection is set on the placeholder element, collapse the selection to
4235   * the start (before the placeholder).
4236   *
4237   * @param {Window} defaultView
4238   */
4239  
4240  
4241  function fixPlaceholderSelection(defaultView) {
4242    var selection = defaultView.getSelection();
4243    var anchorNode = selection.anchorNode,
4244        anchorOffset = selection.anchorOffset;
4245  
4246    if (anchorNode.nodeType !== anchorNode.ELEMENT_NODE) {
4247      return;
4248    }
4249  
4250    var targetNode = anchorNode.childNodes[anchorOffset];
4251  
4252    if (!targetNode || targetNode.nodeType !== targetNode.ELEMENT_NODE || !targetNode.getAttribute('data-rich-text-placeholder')) {
4253      return;
4254    }
4255  
4256    selection.collapseToStart();
4257  }
4258  
4259  function component_RichText(_ref) {
4260    var _ref$tagName = _ref.tagName,
4261        TagName = _ref$tagName === void 0 ? 'div' : _ref$tagName,
4262        _ref$value = _ref.value,
4263        value = _ref$value === void 0 ? '' : _ref$value,
4264        selectionStart = _ref.selectionStart,
4265        selectionEnd = _ref.selectionEnd,
4266        children = _ref.children,
4267        allowedFormats = _ref.allowedFormats,
4268        withoutInteractiveFormatting = _ref.withoutInteractiveFormatting,
4269        formatTypes = _ref.formatTypes,
4270        style = _ref.style,
4271        className = _ref.className,
4272        placeholder = _ref.placeholder,
4273        disabled = _ref.disabled,
4274        preserveWhiteSpace = _ref.preserveWhiteSpace,
4275        onPaste = _ref.onPaste,
4276        _ref$format = _ref.format,
4277        format = _ref$format === void 0 ? 'string' : _ref$format,
4278        onDelete = _ref.onDelete,
4279        onEnter = _ref.onEnter,
4280        onSelectionChange = _ref.onSelectionChange,
4281        onChange = _ref.onChange,
4282        onFocus = _ref.unstableOnFocus,
4283        setFocusedElement = _ref.setFocusedElement,
4284        instanceId = _ref.instanceId,
4285        multilineTag = _ref.__unstableMultilineTag,
4286        multilineRootTag = _ref.__unstableMultilineRootTag,
4287        disableFormats = _ref.__unstableDisableFormats,
4288        didAutomaticChange = _ref.__unstableDidAutomaticChange,
4289        inputRule = _ref.__unstableInputRule,
4290        markAutomaticChange = _ref.__unstableMarkAutomaticChange,
4291        allowPrefixTransformations = _ref.__unstableAllowPrefixTransformations,
4292        undo = _ref.__unstableUndo,
4293        isCaretWithinFormattedText = _ref.__unstableIsCaretWithinFormattedText,
4294        onEnterFormattedText = _ref.__unstableOnEnterFormattedText,
4295        onExitFormattedText = _ref.__unstableOnExitFormattedText,
4296        onCreateUndoLevel = _ref.__unstableOnCreateUndoLevel,
4297        isSelected = _ref.__unstableIsSelected,
4298        ref = _ref.forwardedRef,
4299        remainingProps = Object(objectWithoutProperties["a" /* default */])(_ref, ["tagName", "value", "selectionStart", "selectionEnd", "children", "allowedFormats", "withoutInteractiveFormatting", "formatTypes", "style", "className", "placeholder", "disabled", "preserveWhiteSpace", "onPaste", "format", "onDelete", "onEnter", "onSelectionChange", "onChange", "unstableOnFocus", "setFocusedElement", "instanceId", "__unstableMultilineTag", "__unstableMultilineRootTag", "__unstableDisableFormats", "__unstableDidAutomaticChange", "__unstableInputRule", "__unstableMarkAutomaticChange", "__unstableAllowPrefixTransformations", "__unstableUndo", "__unstableIsCaretWithinFormattedText", "__unstableOnEnterFormattedText", "__unstableOnExitFormattedText", "__unstableOnCreateUndoLevel", "__unstableIsSelected", "forwardedRef"]);
4300  
4301    var _useState = Object(external_this_wp_element_["useState"])(),
4302        _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
4303        _useState2$ = _useState2[0],
4304        activeFormats = _useState2$ === void 0 ? [] : _useState2$,
4305        setActiveFormats = _useState2[1]; // For backward compatibility, fall back to tagName if it's a string.
4306    // tagName can now be a component for light blocks.
4307  
4308  
4309    if (!multilineRootTag && typeof TagName === 'string') {
4310      multilineRootTag = TagName;
4311    }
4312  
4313    function getDoc() {
4314      return ref.current.ownerDocument;
4315    }
4316  
4317    function getWin() {
4318      return getDoc().defaultView;
4319    }
4320    /**
4321     * Converts the outside data structure to our internal representation.
4322     *
4323     * @param {*} string The outside value, data type depends on props.
4324     *
4325     * @return {Object} An internal rich-text value.
4326     */
4327  
4328  
4329    function formatToValue(string) {
4330      if (disableFormats) {
4331        return {
4332          text: string,
4333          formats: Array(string.length),
4334          replacements: Array(string.length)
4335        };
4336      }
4337  
4338      if (format !== 'string') {
4339        return string;
4340      }
4341  
4342      var prepare = createPrepareEditableTree(remainingProps, 'format_value_functions');
4343      var result = create({
4344        html: string,
4345        multilineTag: multilineTag,
4346        multilineWrapperTags: multilineTag === 'li' ? ['ul', 'ol'] : undefined,
4347        preserveWhiteSpace: preserveWhiteSpace
4348      });
4349      result.formats = prepare(result);
4350      return result;
4351    }
4352    /**
4353     * Removes editor only formats from the value.
4354     *
4355     * Editor only formats are applied using `prepareEditableTree`, so we need to
4356     * remove them before converting the internal state
4357     *
4358     * @param {Object} val The internal rich-text value.
4359     *
4360     * @return {Object} A new rich-text value.
4361     */
4362  
4363  
4364    function removeEditorOnlyFormats(val) {
4365      formatTypes.forEach(function (formatType) {
4366        // Remove formats created by prepareEditableTree, because they are editor only.
4367        if (formatType.__experimentalCreatePrepareEditableTree) {
4368          val = removeFormat(val, formatType.name, 0, val.text.length);
4369        }
4370      });
4371      return val;
4372    }
4373    /**
4374     * Converts the internal value to the external data format.
4375     *
4376     * @param {Object} val The internal rich-text value.
4377     *
4378     * @return {*} The external data format, data type depends on props.
4379     */
4380  
4381  
4382    function valueToFormat(val) {
4383      if (disableFormats) {
4384        return val.text;
4385      }
4386  
4387      val = removeEditorOnlyFormats(val);
4388  
4389      if (format !== 'string') {
4390        return;
4391      }
4392  
4393      return toHTMLString({
4394        value: val,
4395        multilineTag: multilineTag,
4396        preserveWhiteSpace: preserveWhiteSpace
4397      });
4398    } // Internal values are updated synchronously, unlike props and state.
4399  
4400  
4401    var _value = Object(external_this_wp_element_["useRef"])(value);
4402  
4403    var record = Object(external_this_wp_element_["useRef"])(Object(external_this_wp_element_["useMemo"])(function () {
4404      var initialRecord = formatToValue(value);
4405      initialRecord.start = selectionStart;
4406      initialRecord.end = selectionEnd;
4407      return initialRecord;
4408    }, []));
4409  
4410    function createRecord() {
4411      var selection = getWin().getSelection();
4412      var range = selection.rangeCount > 0 ? selection.getRangeAt(0) : null;
4413      return create({
4414        element: ref.current,
4415        range: range,
4416        multilineTag: multilineTag,
4417        multilineWrapperTags: multilineTag === 'li' ? ['ul', 'ol'] : undefined,
4418        __unstableIsEditableTree: true,
4419        preserveWhiteSpace: preserveWhiteSpace
4420      });
4421    }
4422  
4423    function applyRecord(newRecord) {
4424      var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
4425          domOnly = _ref2.domOnly;
4426  
4427      apply({
4428        value: newRecord,
4429        current: ref.current,
4430        multilineTag: multilineTag,
4431        multilineWrapperTags: multilineTag === 'li' ? ['ul', 'ol'] : undefined,
4432        prepareEditableTree: createPrepareEditableTree(remainingProps, 'format_prepare_functions'),
4433        __unstableDomOnly: domOnly,
4434        placeholder: placeholder
4435      });
4436    }
4437    /**
4438     * Handles a paste event.
4439     *
4440     * Saves the pasted data as plain text in `pastedPlainText`.
4441     *
4442     * @param {ClipboardEvent} event The paste event.
4443     */
4444  
4445  
4446    function handlePaste(event) {
4447      if (!isSelected) {
4448        event.preventDefault();
4449        return;
4450      }
4451  
4452      var clipboardData = event.clipboardData;
4453      var items = clipboardData.items,
4454          files = clipboardData.files; // In Edge these properties can be null instead of undefined, so a more
4455      // rigorous test is required over using default values.
4456  
4457      items = Object(external_this_lodash_["isNil"])(items) ? [] : items;
4458      files = Object(external_this_lodash_["isNil"])(files) ? [] : files;
4459      var plainText = '';
4460      var html = ''; // IE11 only supports `Text` as an argument for `getData` and will
4461      // otherwise throw an invalid argument error, so we try the standard
4462      // arguments first, then fallback to `Text` if they fail.
4463  
4464      try {
4465        plainText = clipboardData.getData('text/plain');
4466        html = clipboardData.getData('text/html');
4467      } catch (error1) {
4468        try {
4469          html = clipboardData.getData('Text');
4470        } catch (error2) {
4471          // Some browsers like UC Browser paste plain text by default and
4472          // don't support clipboardData at all, so allow default
4473          // behaviour.
4474          return;
4475        }
4476      }
4477  
4478      event.preventDefault(); // Allows us to ask for this information when we get a report.
4479  
4480      window.console.log('Received HTML:\n\n', html);
4481      window.console.log('Received plain text:\n\n', plainText);
4482  
4483      if (disableFormats) {
4484        handleChange(insert(record.current, plainText));
4485        return;
4486      }
4487  
4488      var transformed = formatTypes.reduce(function (accumlator, _ref3) {
4489        var __unstablePasteRule = _ref3.__unstablePasteRule;
4490  
4491        // Only allow one transform.
4492        if (__unstablePasteRule && accumlator === record.current) {
4493          accumlator = __unstablePasteRule(record.current, {
4494            html: html,
4495            plainText: plainText
4496          });
4497        }
4498  
4499        return accumlator;
4500      }, record.current);
4501  
4502      if (transformed !== record.current) {
4503        handleChange(transformed);
4504        return;
4505      }
4506  
4507      if (onPaste) {
4508        files = Array.from(files);
4509        Array.from(items).forEach(function (item) {
4510          if (!item.getAsFile) {
4511            return;
4512          }
4513  
4514          var file = item.getAsFile();
4515  
4516          if (!file) {
4517            return;
4518          }
4519  
4520          var name = file.name,
4521              type = file.type,
4522              size = file.size;
4523  
4524          if (!Object(external_this_lodash_["find"])(files, {
4525            name: name,
4526            type: type,
4527            size: size
4528          })) {
4529            files.push(file);
4530          }
4531        });
4532        onPaste({
4533          value: removeEditorOnlyFormats(record.current),
4534          onChange: handleChange,
4535          html: html,
4536          plainText: plainText,
4537          files: files,
4538          activeFormats: activeFormats
4539        });
4540      }
4541    }
4542    /**
4543     * Handles delete on keydown:
4544     * - outdent list items,
4545     * - delete content if everything is selected,
4546     * - trigger the onDelete prop when selection is uncollapsed and at an edge.
4547     *
4548     * @param {WPSyntheticEvent} event A synthetic keyboard event.
4549     */
4550  
4551  
4552    function handleDelete(event) {
4553      var keyCode = event.keyCode;
4554  
4555      if (keyCode !== external_this_wp_keycodes_["DELETE"] && keyCode !== external_this_wp_keycodes_["BACKSPACE"] && keyCode !== external_this_wp_keycodes_["ESCAPE"]) {
4556        return;
4557      }
4558  
4559      if (didAutomaticChange) {
4560        event.preventDefault();
4561        undo();
4562        return;
4563      }
4564  
4565      if (keyCode === external_this_wp_keycodes_["ESCAPE"]) {
4566        return;
4567      }
4568  
4569      var currentValue = createRecord();
4570      var start = currentValue.start,
4571          end = currentValue.end,
4572          text = currentValue.text;
4573      var isReverse = keyCode === external_this_wp_keycodes_["BACKSPACE"]; // Always handle full content deletion ourselves.
4574  
4575      if (start === 0 && end !== 0 && end === text.length) {
4576        handleChange(remove_remove(currentValue));
4577        event.preventDefault();
4578        return;
4579      }
4580  
4581      if (multilineTag) {
4582        var newValue; // Check to see if we should remove the first item if empty.
4583  
4584        if (isReverse && currentValue.start === 0 && currentValue.end === 0 && isEmptyLine(currentValue)) {
4585          newValue = removeLineSeparator(currentValue, !isReverse);
4586        } else {
4587          newValue = removeLineSeparator(currentValue, isReverse);
4588        }
4589  
4590        if (newValue) {
4591          handleChange(newValue);
4592          event.preventDefault();
4593          return;
4594        }
4595      } // Only process delete if the key press occurs at an uncollapsed edge.
4596  
4597  
4598      if (!onDelete || !isCollapsed(currentValue) || activeFormats.length || isReverse && start !== 0 || !isReverse && end !== text.length) {
4599        return;
4600      }
4601  
4602      onDelete({
4603        isReverse: isReverse,
4604        value: currentValue
4605      });
4606      event.preventDefault();
4607    }
4608    /**
4609     * Triggers the `onEnter` prop on keydown.
4610     *
4611     * @param {WPSyntheticEvent} event A synthetic keyboard event.
4612     */
4613  
4614  
4615    function handleEnter(event) {
4616      if (event.keyCode !== external_this_wp_keycodes_["ENTER"]) {
4617        return;
4618      }
4619  
4620      event.preventDefault();
4621  
4622      if (!onEnter) {
4623        return;
4624      }
4625  
4626      onEnter({
4627        value: removeEditorOnlyFormats(createRecord()),
4628        onChange: handleChange,
4629        shiftKey: event.shiftKey
4630      });
4631    }
4632    /**
4633     * Indents list items on space keydown.
4634     *
4635     * @param {WPSyntheticEvent} event A synthetic keyboard event.
4636     */
4637  
4638  
4639    function handleSpace(event) {
4640      var keyCode = event.keyCode,
4641          shiftKey = event.shiftKey,
4642          altKey = event.altKey,
4643          metaKey = event.metaKey,
4644          ctrlKey = event.ctrlKey;
4645  
4646      if ( // Only override when no modifiers are pressed.
4647      shiftKey || altKey || metaKey || ctrlKey || keyCode !== external_this_wp_keycodes_["SPACE"] || multilineTag !== 'li') {
4648        return;
4649      }
4650  
4651      var currentValue = createRecord();
4652  
4653      if (!isCollapsed(currentValue)) {
4654        return;
4655      }
4656  
4657      var text = currentValue.text,
4658          start = currentValue.start;
4659      var characterBefore = text[start - 1]; // The caret must be at the start of a line.
4660  
4661      if (characterBefore && characterBefore !== LINE_SEPARATOR) {
4662        return;
4663      }
4664  
4665      handleChange(indentListItems(currentValue, {
4666        type: multilineRootTag
4667      }));
4668      event.preventDefault();
4669    }
4670    /**
4671     * Handles horizontal keyboard navigation when no modifiers are pressed. The
4672     * navigation is handled separately to move correctly around format
4673     * boundaries.
4674     *
4675     * @param {WPSyntheticEvent} event A synthetic keyboard event.
4676     */
4677  
4678  
4679    function handleHorizontalNavigation(event) {
4680      var keyCode = event.keyCode,
4681          shiftKey = event.shiftKey,
4682          altKey = event.altKey,
4683          metaKey = event.metaKey,
4684          ctrlKey = event.ctrlKey;
4685  
4686      if ( // Only override left and right keys without modifiers pressed.
4687      shiftKey || altKey || metaKey || ctrlKey || keyCode !== external_this_wp_keycodes_["LEFT"] && keyCode !== external_this_wp_keycodes_["RIGHT"]) {
4688        return;
4689      }
4690  
4691      var _record$current = record.current,
4692          text = _record$current.text,
4693          formats = _record$current.formats,
4694          start = _record$current.start,
4695          end = _record$current.end,
4696          _record$current$activ = _record$current.activeFormats,
4697          currentActiveFormats = _record$current$activ === void 0 ? [] : _record$current$activ;
4698      var collapsed = isCollapsed(record.current); // To do: ideally, we should look at visual position instead.
4699  
4700      var _getWin$getComputedSt = getWin().getComputedStyle(ref.current),
4701          direction = _getWin$getComputedSt.direction;
4702  
4703      var reverseKey = direction === 'rtl' ? external_this_wp_keycodes_["RIGHT"] : external_this_wp_keycodes_["LEFT"];
4704      var isReverse = event.keyCode === reverseKey; // If the selection is collapsed and at the very start, do nothing if
4705      // navigating backward.
4706      // If the selection is collapsed and at the very end, do nothing if
4707      // navigating forward.
4708  
4709      if (collapsed && currentActiveFormats.length === 0) {
4710        if (start === 0 && isReverse) {
4711          return;
4712        }
4713  
4714        if (end === text.length && !isReverse) {
4715          return;
4716        }
4717      } // If the selection is not collapsed, let the browser handle collapsing
4718      // the selection for now. Later we could expand this logic to set
4719      // boundary positions if needed.
4720  
4721  
4722      if (!collapsed) {
4723        return;
4724      } // In all other cases, prevent default behaviour.
4725  
4726  
4727      event.preventDefault();
4728      var formatsBefore = formats[start - 1] || EMPTY_ACTIVE_FORMATS;
4729      var formatsAfter = formats[start] || EMPTY_ACTIVE_FORMATS;
4730      var newActiveFormatsLength = currentActiveFormats.length;
4731      var source = formatsAfter;
4732  
4733      if (formatsBefore.length > formatsAfter.length) {
4734        source = formatsBefore;
4735      } // If the amount of formats before the caret and after the caret is
4736      // different, the caret is at a format boundary.
4737  
4738  
4739      if (formatsBefore.length < formatsAfter.length) {
4740        if (!isReverse && currentActiveFormats.length < formatsAfter.length) {
4741          newActiveFormatsLength++;
4742        }
4743  
4744        if (isReverse && currentActiveFormats.length > formatsBefore.length) {
4745          newActiveFormatsLength--;
4746        }
4747      } else if (formatsBefore.length > formatsAfter.length) {
4748        if (!isReverse && currentActiveFormats.length > formatsAfter.length) {
4749          newActiveFormatsLength--;
4750        }
4751  
4752        if (isReverse && currentActiveFormats.length < formatsBefore.length) {
4753          newActiveFormatsLength++;
4754        }
4755      }
4756  
4757      if (newActiveFormatsLength !== currentActiveFormats.length) {
4758        var _newActiveFormats = source.slice(0, newActiveFormatsLength);
4759  
4760        var _newValue = component_objectSpread({}, record.current, {
4761          activeFormats: _newActiveFormats
4762        });
4763  
4764        record.current = _newValue;
4765        applyRecord(_newValue);
4766        setActiveFormats(_newActiveFormats);
4767        return;
4768      }
4769  
4770      var newPos = start + (isReverse ? -1 : 1);
4771      var newActiveFormats = isReverse ? formatsBefore : formatsAfter;
4772  
4773      var newValue = component_objectSpread({}, record.current, {
4774        start: newPos,
4775        end: newPos,
4776        activeFormats: newActiveFormats
4777      });
4778  
4779      record.current = newValue;
4780      applyRecord(newValue);
4781      onSelectionChange(newPos, newPos);
4782      setActiveFormats(newActiveFormats);
4783    }
4784  
4785    function handleKeyDown(event) {
4786      if (event.defaultPrevented) {
4787        return;
4788      }
4789  
4790      handleDelete(event);
4791      handleEnter(event);
4792      handleSpace(event);
4793      handleHorizontalNavigation(event);
4794    }
4795  
4796    var lastHistoryValue = Object(external_this_wp_element_["useRef"])(value);
4797  
4798    function createUndoLevel() {
4799      // If the content is the same, no level needs to be created.
4800      if (lastHistoryValue.current === _value.current) {
4801        return;
4802      }
4803  
4804      onCreateUndoLevel();
4805      lastHistoryValue.current = _value.current;
4806    }
4807  
4808    var isComposing = Object(external_this_wp_element_["useRef"])(false);
4809    var timeout = Object(external_this_wp_element_["useRef"])();
4810    /**
4811     * Handle input on the next selection change event.
4812     *
4813     * @param {WPSyntheticEvent} event Synthetic input event.
4814     */
4815  
4816    function handleInput(event) {
4817      // Do not trigger a change if characters are being composed. Browsers
4818      // will usually emit a final `input` event when the characters are
4819      // composed.
4820      // As of December 2019, Safari doesn't support nativeEvent.isComposing.
4821      if (isComposing.current) {
4822        return;
4823      }
4824  
4825      var inputType;
4826  
4827      if (event) {
4828        inputType = event.inputType;
4829      }
4830  
4831      if (!inputType && event && event.nativeEvent) {
4832        inputType = event.nativeEvent.inputType;
4833      } // The browser formatted something or tried to insert HTML.
4834      // Overwrite it. It will be handled later by the format library if
4835      // needed.
4836  
4837  
4838      if (inputType && (inputType.indexOf('format') === 0 || INSERTION_INPUT_TYPES_TO_IGNORE.has(inputType))) {
4839        applyRecord(record.current);
4840        return;
4841      }
4842  
4843      var currentValue = createRecord();
4844      var _record$current2 = record.current,
4845          start = _record$current2.start,
4846          _record$current2$acti = _record$current2.activeFormats,
4847          oldActiveFormats = _record$current2$acti === void 0 ? [] : _record$current2$acti; // Update the formats between the last and new caret position.
4848  
4849      var change = updateFormats({
4850        value: currentValue,
4851        start: start,
4852        end: currentValue.start,
4853        formats: oldActiveFormats
4854      });
4855      handleChange(change, {
4856        withoutHistory: true
4857      }); // Create an undo level when input stops for over a second.
4858  
4859      getWin().clearTimeout(timeout.current);
4860      timeout.current = getWin().setTimeout(createUndoLevel, 1000); // Only run input rules when inserting text.
4861  
4862      if (inputType !== 'insertText') {
4863        return;
4864      }
4865  
4866      if (allowPrefixTransformations && inputRule) {
4867        inputRule(change, valueToFormat);
4868      }
4869  
4870      var transformed = formatTypes.reduce(function (accumlator, _ref4) {
4871        var __unstableInputRule = _ref4.__unstableInputRule;
4872  
4873        if (__unstableInputRule) {
4874          accumlator = __unstableInputRule(accumlator);
4875        }
4876  
4877        return accumlator;
4878      }, change);
4879  
4880      if (transformed !== change) {
4881        createUndoLevel();
4882        handleChange(component_objectSpread({}, transformed, {
4883          activeFormats: oldActiveFormats
4884        }));
4885        markAutomaticChange();
4886      }
4887    }
4888  
4889    function handleCompositionStart() {
4890      isComposing.current = true; // Do not update the selection when characters are being composed as
4891      // this rerenders the component and might distroy internal browser
4892      // editing state.
4893  
4894      getDoc().removeEventListener('selectionchange', handleSelectionChange);
4895    }
4896  
4897    function handleCompositionEnd() {
4898      isComposing.current = false; // Ensure the value is up-to-date for browsers that don't emit a final
4899      // input event after composition.
4900  
4901      handleInput({
4902        inputType: 'insertText'
4903      }); // Tracking selection changes can be resumed.
4904  
4905      getDoc().addEventListener('selectionchange', handleSelectionChange);
4906    }
4907  
4908    var didMount = Object(external_this_wp_element_["useRef"])(false);
4909    /**
4910     * Syncs the selection to local state. A callback for the `selectionchange`
4911     * native events, `keyup`, `mouseup` and `touchend` synthetic events, and
4912     * animation frames after the `focus` event.
4913     *
4914     * @param {Event|WPSyntheticEvent|DOMHighResTimeStamp} event
4915     */
4916  
4917    function handleSelectionChange(event) {
4918      if (!ref.current) {
4919        return;
4920      }
4921  
4922      if (document.activeElement !== ref.current) {
4923        return;
4924      }
4925  
4926      if (event.type !== 'selectionchange' && !isSelected) {
4927        return;
4928      }
4929  
4930      if (disabled) {
4931        return;
4932      } // In case of a keyboard event, ignore selection changes during
4933      // composition.
4934  
4935  
4936      if (isComposing.current) {
4937        return;
4938      }
4939  
4940      var _createRecord = createRecord(),
4941          start = _createRecord.start,
4942          end = _createRecord.end,
4943          text = _createRecord.text;
4944  
4945      var oldRecord = record.current; // Fallback mechanism for IE11, which doesn't support the input event.
4946      // Any input results in a selection change.
4947  
4948      if (text !== oldRecord.text) {
4949        handleInput();
4950        return;
4951      }
4952  
4953      if (start === oldRecord.start && end === oldRecord.end) {
4954        // Sometimes the browser may set the selection on the placeholder
4955        // element, in which case the caret is not visible. We need to set
4956        // the caret before the placeholder if that's the case.
4957        if (oldRecord.text.length === 0 && start === 0) {
4958          fixPlaceholderSelection(getWin());
4959        }
4960  
4961        return;
4962      }
4963  
4964      var newValue = component_objectSpread({}, oldRecord, {
4965        start: start,
4966        end: end,
4967        // Allow `getActiveFormats` to get new `activeFormats`.
4968        activeFormats: undefined
4969      });
4970  
4971      var newActiveFormats = getActiveFormats(newValue, EMPTY_ACTIVE_FORMATS); // Update the value with the new active formats.
4972  
4973      newValue.activeFormats = newActiveFormats;
4974  
4975      if (!isCaretWithinFormattedText && newActiveFormats.length) {
4976        onEnterFormattedText();
4977      } else if (isCaretWithinFormattedText && !newActiveFormats.length) {
4978        onExitFormattedText();
4979      } // It is important that the internal value is updated first,
4980      // otherwise the value will be wrong on render!
4981  
4982  
4983      record.current = newValue;
4984      applyRecord(newValue, {
4985        domOnly: true
4986      });
4987      onSelectionChange(start, end);
4988      setActiveFormats(newActiveFormats);
4989    }
4990    /**
4991     * Sync the value to global state. The node tree and selection will also be
4992     * updated if differences are found.
4993     *
4994     * @param {Object}  newRecord         The record to sync and apply.
4995     * @param {Object}  $2                Named options.
4996     * @param {boolean} $2.withoutHistory If true, no undo level will be
4997     *                                    created.
4998     */
4999  
5000  
5001    function handleChange(newRecord) {
5002      var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
5003          withoutHistory = _ref5.withoutHistory;
5004  
5005      if (disableFormats) {
5006        newRecord.formats = Array(newRecord.text.length);
5007        newRecord.replacements = Array(newRecord.text.length);
5008      }
5009  
5010      applyRecord(newRecord);
5011      var start = newRecord.start,
5012          end = newRecord.end,
5013          _newRecord$activeForm = newRecord.activeFormats,
5014          newActiveFormats = _newRecord$activeForm === void 0 ? [] : _newRecord$activeForm;
5015      var changeHandlers = Object(external_this_lodash_["pickBy"])(remainingProps, function (v, key) {
5016        return key.startsWith('format_on_change_functions_');
5017      });
5018      Object.values(changeHandlers).forEach(function (changeHandler) {
5019        changeHandler(newRecord.formats, newRecord.text);
5020      });
5021      _value.current = valueToFormat(newRecord);
5022      record.current = newRecord; // Selection must be updated first, so it is recorded in history when
5023      // the content change happens.
5024  
5025      onSelectionChange(start, end);
5026      onChange(_value.current);
5027      setActiveFormats(newActiveFormats);
5028  
5029      if (!withoutHistory) {
5030        createUndoLevel();
5031      }
5032    }
5033    /**
5034     * Select object when they are clicked. The browser will not set any
5035     * selection when clicking e.g. an image.
5036     *
5037     * @param {WPSyntheticEvent} event Synthetic mousedown or touchstart event.
5038     */
5039  
5040  
5041    function handlePointerDown(event) {
5042      var target = event.target; // If the child element has no text content, it must be an object.
5043  
5044      if (target === ref.current || target.textContent) {
5045        return;
5046      }
5047  
5048      var parentNode = target.parentNode;
5049      var index = Array.from(parentNode.childNodes).indexOf(target);
5050      var range = getDoc().createRange();
5051      var selection = getWin().getSelection();
5052      range.setStart(target.parentNode, index);
5053      range.setEnd(target.parentNode, index + 1);
5054      selection.removeAllRanges();
5055      selection.addRange(range);
5056    }
5057  
5058    var rafId = Object(external_this_wp_element_["useRef"])();
5059    /**
5060     * Handles a focus event on the contenteditable field, calling the
5061     * `unstableOnFocus` prop callback if one is defined. The callback does not
5062     * receive any arguments.
5063     *
5064     * This is marked as a private API and the `unstableOnFocus` prop is not
5065     * documented, as the current requirements where it is used are subject to
5066     * future refactoring following `isSelected` handling.
5067     *
5068     * In contrast with `setFocusedElement`, this is only triggered in response
5069     * to focus within the contenteditable field, whereas `setFocusedElement`
5070     * is triggered on focus within any `RichText` descendent element.
5071     *
5072     * @see setFocusedElement
5073     *
5074     * @private
5075     */
5076  
5077    function handleFocus() {
5078      if (onFocus) {
5079        onFocus();
5080      }
5081  
5082      if (!isSelected) {
5083        // We know for certain that on focus, the old selection is invalid.
5084        // It will be recalculated on the next mouseup, keyup, or touchend
5085        // event.
5086        var index = undefined;
5087        record.current = component_objectSpread({}, record.current, {
5088          start: index,
5089          end: index,
5090          activeFormats: EMPTY_ACTIVE_FORMATS
5091        });
5092        onSelectionChange(index, index);
5093        setActiveFormats(EMPTY_ACTIVE_FORMATS);
5094      } else {
5095        onSelectionChange(record.current.start, record.current.end);
5096        setActiveFormats(getActiveFormats(component_objectSpread({}, record.current, {
5097          activeFormats: undefined
5098        }), EMPTY_ACTIVE_FORMATS));
5099      } // Update selection as soon as possible, which is at the next animation
5100      // frame. The event listener for selection changes may be added too late
5101      // at this point, but this focus event is still too early to calculate
5102      // the selection.
5103  
5104  
5105      rafId.current = getWin().requestAnimationFrame(handleSelectionChange);
5106      getDoc().addEventListener('selectionchange', handleSelectionChange);
5107  
5108      if (setFocusedElement) {
5109        external_this_wp_deprecated_default()('wp.blockEditor.RichText setFocusedElement prop', {
5110          alternative: 'selection state from the block editor store.'
5111        });
5112        setFocusedElement(instanceId);
5113      }
5114    }
5115  
5116    function handleBlur() {
5117      getDoc().removeEventListener('selectionchange', handleSelectionChange);
5118    }
5119  
5120    function applyFromProps() {
5121      _value.current = value;
5122      record.current = formatToValue(value);
5123      record.current.start = selectionStart;
5124      record.current.end = selectionEnd;
5125      applyRecord(record.current);
5126    }
5127  
5128    Object(external_this_wp_element_["useEffect"])(function () {
5129      if (didMount.current) {
5130        applyFromProps();
5131      }
5132    }, [TagName, placeholder]);
5133    Object(external_this_wp_element_["useEffect"])(function () {
5134      if (didMount.current && value !== _value.current) {
5135        applyFromProps();
5136      }
5137    }, [value]);
5138    Object(external_this_wp_element_["useEffect"])(function () {
5139      if (!didMount.current) {
5140        return;
5141      }
5142  
5143      if (isSelected && (selectionStart !== record.current.start || selectionEnd !== record.current.end)) {
5144        applyFromProps();
5145      } else {
5146        record.current = component_objectSpread({}, record.current, {
5147          start: selectionStart,
5148          end: selectionEnd
5149        });
5150      }
5151    }, [selectionStart, selectionEnd, isSelected]);
5152    var prefix = 'format_prepare_props_';
5153  
5154    var predicate = function predicate(v, key) {
5155      return key.startsWith(prefix);
5156    };
5157  
5158    var prepareProps = Object(external_this_lodash_["pickBy"])(remainingProps, predicate);
5159    Object(external_this_wp_element_["useEffect"])(function () {
5160      if (didMount.current) {
5161        applyFromProps();
5162      }
5163    }, Object.values(prepareProps));
5164    Object(external_this_wp_element_["useLayoutEffect"])(function () {
5165      applyRecord(record.current, {
5166        domOnly: true
5167      });
5168      didMount.current = true;
5169      return function () {
5170        getDoc().removeEventListener('selectionchange', handleSelectionChange);
5171        getWin().cancelAnimationFrame(rafId.current);
5172        getWin().clearTimeout(timeout.current);
5173      };
5174    }, []);
5175  
5176    function focus() {
5177      ref.current.focus();
5178      applyRecord(record.current);
5179    }
5180  
5181    var ariaProps = Object(external_this_lodash_["pickBy"])(remainingProps, function (v, key) {
5182      return Object(external_this_lodash_["startsWith"])(key, 'aria-');
5183    });
5184  
5185    var editableProps = component_objectSpread({
5186      // Overridable props.
5187      role: 'textbox',
5188      'aria-multiline': true,
5189      'aria-label': placeholder
5190    }, ariaProps, {
5191      ref: ref,
5192      style: style ? component_objectSpread({}, style, {
5193        whiteSpace: whiteSpace
5194      }) : defaultStyle,
5195      className: classnames_default()('rich-text', className),
5196      onPaste: handlePaste,
5197      onInput: handleInput,
5198      onCompositionStart: handleCompositionStart,
5199      onCompositionEnd: handleCompositionEnd,
5200      onKeyDown: handleKeyDown,
5201      onFocus: handleFocus,
5202      onBlur: handleBlur,
5203      onMouseDown: handlePointerDown,
5204      onTouchStart: handlePointerDown,
5205      // Selection updates must be done at these events as they
5206      // happen before the `selectionchange` event. In some cases,
5207      // the `selectionchange` event may not even fire, for
5208      // example when the window receives focus again on click.
5209      onKeyUp: handleSelectionChange,
5210      onMouseUp: handleSelectionChange,
5211      onTouchEnd: handleSelectionChange,
5212      // Do not set the attribute if disabled.
5213      contentEditable: disabled ? undefined : true,
5214      suppressContentEditableWarning: !disabled
5215    });
5216  
5217    useBoundaryStyle({
5218      ref: ref,
5219      activeFormats: activeFormats
5220    });
5221    useInlineWarning({
5222      ref: ref
5223    });
5224    return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, isSelected && Object(external_this_wp_element_["createElement"])(FormatEdit, {
5225      allowedFormats: allowedFormats,
5226      withoutInteractiveFormatting: withoutInteractiveFormatting,
5227      value: record.current,
5228      onChange: handleChange,
5229      onFocus: focus,
5230      formatTypes: formatTypes
5231    }), children && children({
5232      isSelected: isSelected,
5233      value: record.current,
5234      onChange: handleChange,
5235      onFocus: focus,
5236      editableProps: editableProps,
5237      editableTagName: TagName
5238    }), !children && Object(external_this_wp_element_["createElement"])(TagName, editableProps));
5239  }
5240  
5241  var RichTextWrapper = withFormatTypes(component_RichText);
5242  /**
5243   * Renders a rich content input, providing users with the option to format the
5244   * content.
5245   */
5246  
5247  /* harmony default export */ var component = (Object(external_this_wp_element_["forwardRef"])(function (props, ref) {
5248    return Object(external_this_wp_element_["createElement"])(RichTextWrapper, Object(esm_extends["a" /* default */])({}, props, {
5249      forwardedRef: ref
5250    }));
5251  }));
5252  
5253  // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/index.js
5254  /**
5255   * Internal dependencies
5256   */
5257  
5258  
5259  
5260  
5261  
5262  
5263  
5264  
5265  
5266  
5267  
5268  
5269  
5270  
5271  
5272  
5273  
5274  
5275  
5276  
5277  
5278  
5279  
5280  
5281  
5282  
5283  
5284  
5285  
5286  
5287  
5288  
5289  
5290  
5291  
5292  
5293  
5294  /***/ }),
5295  
5296  /***/ 5:
5297  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5298  
5299  "use strict";
5300  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
5301  function _defineProperty(obj, key, value) {
5302    if (key in obj) {
5303      Object.defineProperty(obj, key, {
5304        value: value,
5305        enumerable: true,
5306        configurable: true,
5307        writable: true
5308      });
5309    } else {
5310      obj[key] = value;
5311    }
5312  
5313    return obj;
5314  }
5315  
5316  /***/ }),
5317  
5318  /***/ 8:
5319  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5320  
5321  "use strict";
5322  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
5323  function _extends() {
5324    _extends = Object.assign || function (target) {
5325      for (var i = 1; i < arguments.length; i++) {
5326        var source = arguments[i];
5327  
5328        for (var key in source) {
5329          if (Object.prototype.hasOwnProperty.call(source, key)) {
5330            target[key] = source[key];
5331          }
5332        }
5333      }
5334  
5335      return target;
5336    };
5337  
5338    return _extends.apply(this, arguments);
5339  }
5340  
5341  /***/ }),
5342  
5343  /***/ 89:
5344  /***/ (function(module, exports) {
5345  
5346  (function() { module.exports = this["wp"]["escapeHtml"]; }());
5347  
5348  /***/ })
5349  
5350  /******/ });


Generated: Sat Sep 26 01:00:03 2020 Cross-referenced by PHPXref 0.7.1