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


Generated: Sat Apr 4 01:00:03 2020 Cross-referenced by PHPXref 0.7.1