[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/dist/ -> block-editor.js (source)

   1  /******/ (function() { // webpackBootstrap
   2  /******/     var __webpack_modules__ = ({
   3  
   4  /***/ 6411:
   5  /***/ (function(module, exports) {
   6  
   7  var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
   8      autosize 4.0.4
   9      license: MIT
  10      http://www.jacklmoore.com/autosize
  11  */
  12  (function (global, factory) {
  13      if (true) {
  14          !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  15          __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  16          (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  17          __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  18      } else { var mod; }
  19  })(this, function (module, exports) {
  20      'use strict';
  21  
  22      var map = typeof Map === "function" ? new Map() : function () {
  23          var keys = [];
  24          var values = [];
  25  
  26          return {
  27              has: function has(key) {
  28                  return keys.indexOf(key) > -1;
  29              },
  30              get: function get(key) {
  31                  return values[keys.indexOf(key)];
  32              },
  33              set: function set(key, value) {
  34                  if (keys.indexOf(key) === -1) {
  35                      keys.push(key);
  36                      values.push(value);
  37                  }
  38              },
  39              delete: function _delete(key) {
  40                  var index = keys.indexOf(key);
  41                  if (index > -1) {
  42                      keys.splice(index, 1);
  43                      values.splice(index, 1);
  44                  }
  45              }
  46          };
  47      }();
  48  
  49      var createEvent = function createEvent(name) {
  50          return new Event(name, { bubbles: true });
  51      };
  52      try {
  53          new Event('test');
  54      } catch (e) {
  55          // IE does not support `new Event()`
  56          createEvent = function createEvent(name) {
  57              var evt = document.createEvent('Event');
  58              evt.initEvent(name, true, false);
  59              return evt;
  60          };
  61      }
  62  
  63  	function assign(ta) {
  64          if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;
  65  
  66          var heightOffset = null;
  67          var clientWidth = null;
  68          var cachedHeight = null;
  69  
  70  		function init() {
  71              var style = window.getComputedStyle(ta, null);
  72  
  73              if (style.resize === 'vertical') {
  74                  ta.style.resize = 'none';
  75              } else if (style.resize === 'both') {
  76                  ta.style.resize = 'horizontal';
  77              }
  78  
  79              if (style.boxSizing === 'content-box') {
  80                  heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
  81              } else {
  82                  heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
  83              }
  84              // Fix when a textarea is not on document body and heightOffset is Not a Number
  85              if (isNaN(heightOffset)) {
  86                  heightOffset = 0;
  87              }
  88  
  89              update();
  90          }
  91  
  92  		function changeOverflow(value) {
  93              {
  94                  // Chrome/Safari-specific fix:
  95                  // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
  96                  // made available by removing the scrollbar. The following forces the necessary text reflow.
  97                  var width = ta.style.width;
  98                  ta.style.width = '0px';
  99                  // Force reflow:
 100                  /* jshint ignore:start */
 101                  ta.offsetWidth;
 102                  /* jshint ignore:end */
 103                  ta.style.width = width;
 104              }
 105  
 106              ta.style.overflowY = value;
 107          }
 108  
 109  		function getParentOverflows(el) {
 110              var arr = [];
 111  
 112              while (el && el.parentNode && el.parentNode instanceof Element) {
 113                  if (el.parentNode.scrollTop) {
 114                      arr.push({
 115                          node: el.parentNode,
 116                          scrollTop: el.parentNode.scrollTop
 117                      });
 118                  }
 119                  el = el.parentNode;
 120              }
 121  
 122              return arr;
 123          }
 124  
 125  		function resize() {
 126              if (ta.scrollHeight === 0) {
 127                  // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
 128                  return;
 129              }
 130  
 131              var overflows = getParentOverflows(ta);
 132              var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240)
 133  
 134              ta.style.height = '';
 135              ta.style.height = ta.scrollHeight + heightOffset + 'px';
 136  
 137              // used to check if an update is actually necessary on window.resize
 138              clientWidth = ta.clientWidth;
 139  
 140              // prevents scroll-position jumping
 141              overflows.forEach(function (el) {
 142                  el.node.scrollTop = el.scrollTop;
 143              });
 144  
 145              if (docTop) {
 146                  document.documentElement.scrollTop = docTop;
 147              }
 148          }
 149  
 150  		function update() {
 151              resize();
 152  
 153              var styleHeight = Math.round(parseFloat(ta.style.height));
 154              var computed = window.getComputedStyle(ta, null);
 155  
 156              // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box
 157              var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;
 158  
 159              // The actual height not matching the style height (set via the resize method) indicates that 
 160              // the max-height has been exceeded, in which case the overflow should be allowed.
 161              if (actualHeight < styleHeight) {
 162                  if (computed.overflowY === 'hidden') {
 163                      changeOverflow('scroll');
 164                      resize();
 165                      actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
 166                  }
 167              } else {
 168                  // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
 169                  if (computed.overflowY !== 'hidden') {
 170                      changeOverflow('hidden');
 171                      resize();
 172                      actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
 173                  }
 174              }
 175  
 176              if (cachedHeight !== actualHeight) {
 177                  cachedHeight = actualHeight;
 178                  var evt = createEvent('autosize:resized');
 179                  try {
 180                      ta.dispatchEvent(evt);
 181                  } catch (err) {
 182                      // Firefox will throw an error on dispatchEvent for a detached element
 183                      // https://bugzilla.mozilla.org/show_bug.cgi?id=889376
 184                  }
 185              }
 186          }
 187  
 188          var pageResize = function pageResize() {
 189              if (ta.clientWidth !== clientWidth) {
 190                  update();
 191              }
 192          };
 193  
 194          var destroy = function (style) {
 195              window.removeEventListener('resize', pageResize, false);
 196              ta.removeEventListener('input', update, false);
 197              ta.removeEventListener('keyup', update, false);
 198              ta.removeEventListener('autosize:destroy', destroy, false);
 199              ta.removeEventListener('autosize:update', update, false);
 200  
 201              Object.keys(style).forEach(function (key) {
 202                  ta.style[key] = style[key];
 203              });
 204  
 205              map.delete(ta);
 206          }.bind(ta, {
 207              height: ta.style.height,
 208              resize: ta.style.resize,
 209              overflowY: ta.style.overflowY,
 210              overflowX: ta.style.overflowX,
 211              wordWrap: ta.style.wordWrap
 212          });
 213  
 214          ta.addEventListener('autosize:destroy', destroy, false);
 215  
 216          // IE9 does not fire onpropertychange or oninput for deletions,
 217          // so binding to onkeyup to catch most of those events.
 218          // There is no way that I know of to detect something like 'cut' in IE9.
 219          if ('onpropertychange' in ta && 'oninput' in ta) {
 220              ta.addEventListener('keyup', update, false);
 221          }
 222  
 223          window.addEventListener('resize', pageResize, false);
 224          ta.addEventListener('input', update, false);
 225          ta.addEventListener('autosize:update', update, false);
 226          ta.style.overflowX = 'hidden';
 227          ta.style.wordWrap = 'break-word';
 228  
 229          map.set(ta, {
 230              destroy: destroy,
 231              update: update
 232          });
 233  
 234          init();
 235      }
 236  
 237  	function destroy(ta) {
 238          var methods = map.get(ta);
 239          if (methods) {
 240              methods.destroy();
 241          }
 242      }
 243  
 244  	function update(ta) {
 245          var methods = map.get(ta);
 246          if (methods) {
 247              methods.update();
 248          }
 249      }
 250  
 251      var autosize = null;
 252  
 253      // Do nothing in Node.js environment and IE8 (or lower)
 254      if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
 255          autosize = function autosize(el) {
 256              return el;
 257          };
 258          autosize.destroy = function (el) {
 259              return el;
 260          };
 261          autosize.update = function (el) {
 262              return el;
 263          };
 264      } else {
 265          autosize = function autosize(el, options) {
 266              if (el) {
 267                  Array.prototype.forEach.call(el.length ? el : [el], function (x) {
 268                      return assign(x, options);
 269                  });
 270              }
 271              return el;
 272          };
 273          autosize.destroy = function (el) {
 274              if (el) {
 275                  Array.prototype.forEach.call(el.length ? el : [el], destroy);
 276              }
 277              return el;
 278          };
 279          autosize.update = function (el) {
 280              if (el) {
 281                  Array.prototype.forEach.call(el.length ? el : [el], update);
 282              }
 283              return el;
 284          };
 285      }
 286  
 287      exports.default = autosize;
 288      module.exports = exports['default'];
 289  });
 290  
 291  /***/ }),
 292  
 293  /***/ 4403:
 294  /***/ (function(module, exports) {
 295  
 296  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
 297    Copyright (c) 2018 Jed Watson.
 298    Licensed under the MIT License (MIT), see
 299    http://jedwatson.github.io/classnames
 300  */
 301  /* global define */
 302  
 303  (function () {
 304      'use strict';
 305  
 306      var hasOwn = {}.hasOwnProperty;
 307  
 308  	function classNames() {
 309          var classes = [];
 310  
 311          for (var i = 0; i < arguments.length; i++) {
 312              var arg = arguments[i];
 313              if (!arg) continue;
 314  
 315              var argType = typeof arg;
 316  
 317              if (argType === 'string' || argType === 'number') {
 318                  classes.push(arg);
 319              } else if (Array.isArray(arg)) {
 320                  if (arg.length) {
 321                      var inner = classNames.apply(null, arg);
 322                      if (inner) {
 323                          classes.push(inner);
 324                      }
 325                  }
 326              } else if (argType === 'object') {
 327                  if (arg.toString === Object.prototype.toString) {
 328                      for (var key in arg) {
 329                          if (hasOwn.call(arg, key) && arg[key]) {
 330                              classes.push(key);
 331                          }
 332                      }
 333                  } else {
 334                      classes.push(arg.toString());
 335                  }
 336              }
 337          }
 338  
 339          return classes.join(' ');
 340      }
 341  
 342      if ( true && module.exports) {
 343          classNames.default = classNames;
 344          module.exports = classNames;
 345      } else if (true) {
 346          // register as 'classnames', consistent with npm package name
 347          !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
 348              return classNames;
 349          }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
 350          __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
 351      } else {}
 352  }());
 353  
 354  
 355  /***/ }),
 356  
 357  /***/ 4827:
 358  /***/ (function(module) {
 359  
 360  // This code has been refactored for 140 bytes
 361  // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js
 362  var computedStyle = function (el, prop, getComputedStyle) {
 363    getComputedStyle = window.getComputedStyle;
 364  
 365    // In one fell swoop
 366    return (
 367      // If we have getComputedStyle
 368      getComputedStyle ?
 369        // Query it
 370        // TODO: From CSS-Query notes, we might need (node, null) for FF
 371        getComputedStyle(el) :
 372  
 373      // Otherwise, we are in IE and use currentStyle
 374        el.currentStyle
 375    )[
 376      // Switch to camelCase for CSSOM
 377      // DEV: Grabbed from jQuery
 378      // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194
 379      // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597
 380      prop.replace(/-(\w)/gi, function (word, letter) {
 381        return letter.toUpperCase();
 382      })
 383    ];
 384  };
 385  
 386  module.exports = computedStyle;
 387  
 388  
 389  /***/ }),
 390  
 391  /***/ 1198:
 392  /***/ (function(__unused_webpack_module, exports) {
 393  
 394  "use strict";
 395  /*istanbul ignore start*/
 396  
 397  
 398  Object.defineProperty(exports, "__esModule", ({
 399    value: true
 400  }));
 401  exports["default"] = Diff;
 402  
 403  /*istanbul ignore end*/
 404  function Diff() {}
 405  
 406  Diff.prototype = {
 407    /*istanbul ignore start*/
 408  
 409    /*istanbul ignore end*/
 410    diff: function diff(oldString, newString) {
 411      /*istanbul ignore start*/
 412      var
 413      /*istanbul ignore end*/
 414      options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
 415      var callback = options.callback;
 416  
 417      if (typeof options === 'function') {
 418        callback = options;
 419        options = {};
 420      }
 421  
 422      this.options = options;
 423      var self = this;
 424  
 425      function done(value) {
 426        if (callback) {
 427          setTimeout(function () {
 428            callback(undefined, value);
 429          }, 0);
 430          return true;
 431        } else {
 432          return value;
 433        }
 434      } // Allow subclasses to massage the input prior to running
 435  
 436  
 437      oldString = this.castInput(oldString);
 438      newString = this.castInput(newString);
 439      oldString = this.removeEmpty(this.tokenize(oldString));
 440      newString = this.removeEmpty(this.tokenize(newString));
 441      var newLen = newString.length,
 442          oldLen = oldString.length;
 443      var editLength = 1;
 444      var maxEditLength = newLen + oldLen;
 445      var bestPath = [{
 446        newPos: -1,
 447        components: []
 448      }]; // Seed editLength = 0, i.e. the content starts with the same values
 449  
 450      var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
 451  
 452      if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
 453        // Identity per the equality and tokenizer
 454        return done([{
 455          value: this.join(newString),
 456          count: newString.length
 457        }]);
 458      } // Main worker method. checks all permutations of a given edit length for acceptance.
 459  
 460  
 461      function execEditLength() {
 462        for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
 463          var basePath =
 464          /*istanbul ignore start*/
 465          void 0
 466          /*istanbul ignore end*/
 467          ;
 468  
 469          var addPath = bestPath[diagonalPath - 1],
 470              removePath = bestPath[diagonalPath + 1],
 471              _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
 472  
 473          if (addPath) {
 474            // No one else is going to attempt to use this value, clear it
 475            bestPath[diagonalPath - 1] = undefined;
 476          }
 477  
 478          var canAdd = addPath && addPath.newPos + 1 < newLen,
 479              canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
 480  
 481          if (!canAdd && !canRemove) {
 482            // If this path is a terminal then prune
 483            bestPath[diagonalPath] = undefined;
 484            continue;
 485          } // Select the diagonal that we want to branch from. We select the prior
 486          // path whose position in the new string is the farthest from the origin
 487          // and does not pass the bounds of the diff graph
 488  
 489  
 490          if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
 491            basePath = clonePath(removePath);
 492            self.pushComponent(basePath.components, undefined, true);
 493          } else {
 494            basePath = addPath; // No need to clone, we've pulled it from the list
 495  
 496            basePath.newPos++;
 497            self.pushComponent(basePath.components, true, undefined);
 498          }
 499  
 500          _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done
 501  
 502          if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
 503            return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
 504          } else {
 505            // Otherwise track this path as a potential candidate and continue.
 506            bestPath[diagonalPath] = basePath;
 507          }
 508        }
 509  
 510        editLength++;
 511      } // Performs the length of edit iteration. Is a bit fugly as this has to support the
 512      // sync and async mode which is never fun. Loops over execEditLength until a value
 513      // is produced.
 514  
 515  
 516      if (callback) {
 517        (function exec() {
 518          setTimeout(function () {
 519            // This should not happen, but we want to be safe.
 520  
 521            /* istanbul ignore next */
 522            if (editLength > maxEditLength) {
 523              return callback();
 524            }
 525  
 526            if (!execEditLength()) {
 527              exec();
 528            }
 529          }, 0);
 530        })();
 531      } else {
 532        while (editLength <= maxEditLength) {
 533          var ret = execEditLength();
 534  
 535          if (ret) {
 536            return ret;
 537          }
 538        }
 539      }
 540    },
 541  
 542    /*istanbul ignore start*/
 543  
 544    /*istanbul ignore end*/
 545    pushComponent: function pushComponent(components, added, removed) {
 546      var last = components[components.length - 1];
 547  
 548      if (last && last.added === added && last.removed === removed) {
 549        // We need to clone here as the component clone operation is just
 550        // as shallow array clone
 551        components[components.length - 1] = {
 552          count: last.count + 1,
 553          added: added,
 554          removed: removed
 555        };
 556      } else {
 557        components.push({
 558          count: 1,
 559          added: added,
 560          removed: removed
 561        });
 562      }
 563    },
 564  
 565    /*istanbul ignore start*/
 566  
 567    /*istanbul ignore end*/
 568    extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
 569      var newLen = newString.length,
 570          oldLen = oldString.length,
 571          newPos = basePath.newPos,
 572          oldPos = newPos - diagonalPath,
 573          commonCount = 0;
 574  
 575      while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
 576        newPos++;
 577        oldPos++;
 578        commonCount++;
 579      }
 580  
 581      if (commonCount) {
 582        basePath.components.push({
 583          count: commonCount
 584        });
 585      }
 586  
 587      basePath.newPos = newPos;
 588      return oldPos;
 589    },
 590  
 591    /*istanbul ignore start*/
 592  
 593    /*istanbul ignore end*/
 594    equals: function equals(left, right) {
 595      if (this.options.comparator) {
 596        return this.options.comparator(left, right);
 597      } else {
 598        return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
 599      }
 600    },
 601  
 602    /*istanbul ignore start*/
 603  
 604    /*istanbul ignore end*/
 605    removeEmpty: function removeEmpty(array) {
 606      var ret = [];
 607  
 608      for (var i = 0; i < array.length; i++) {
 609        if (array[i]) {
 610          ret.push(array[i]);
 611        }
 612      }
 613  
 614      return ret;
 615    },
 616  
 617    /*istanbul ignore start*/
 618  
 619    /*istanbul ignore end*/
 620    castInput: function castInput(value) {
 621      return value;
 622    },
 623  
 624    /*istanbul ignore start*/
 625  
 626    /*istanbul ignore end*/
 627    tokenize: function tokenize(value) {
 628      return value.split('');
 629    },
 630  
 631    /*istanbul ignore start*/
 632  
 633    /*istanbul ignore end*/
 634    join: function join(chars) {
 635      return chars.join('');
 636    }
 637  };
 638  
 639  function buildValues(diff, components, newString, oldString, useLongestToken) {
 640    var componentPos = 0,
 641        componentLen = components.length,
 642        newPos = 0,
 643        oldPos = 0;
 644  
 645    for (; componentPos < componentLen; componentPos++) {
 646      var component = components[componentPos];
 647  
 648      if (!component.removed) {
 649        if (!component.added && useLongestToken) {
 650          var value = newString.slice(newPos, newPos + component.count);
 651          value = value.map(function (value, i) {
 652            var oldValue = oldString[oldPos + i];
 653            return oldValue.length > value.length ? oldValue : value;
 654          });
 655          component.value = diff.join(value);
 656        } else {
 657          component.value = diff.join(newString.slice(newPos, newPos + component.count));
 658        }
 659  
 660        newPos += component.count; // Common case
 661  
 662        if (!component.added) {
 663          oldPos += component.count;
 664        }
 665      } else {
 666        component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
 667        oldPos += component.count; // Reverse add and remove so removes are output first to match common convention
 668        // The diffing algorithm is tied to add then remove output and this is the simplest
 669        // route to get the desired output with minimal overhead.
 670  
 671        if (componentPos && components[componentPos - 1].added) {
 672          var tmp = components[componentPos - 1];
 673          components[componentPos - 1] = components[componentPos];
 674          components[componentPos] = tmp;
 675        }
 676      }
 677    } // Special case handle for when one terminal is ignored (i.e. whitespace).
 678    // For this case we merge the terminal into the prior string and drop the change.
 679    // This is only available for string mode.
 680  
 681  
 682    var lastComponent = components[componentLen - 1];
 683  
 684    if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
 685      components[componentLen - 2].value += lastComponent.value;
 686      components.pop();
 687    }
 688  
 689    return components;
 690  }
 691  
 692  function clonePath(path) {
 693    return {
 694      newPos: path.newPos,
 695      components: path.components.slice(0)
 696    };
 697  }
 698  
 699  
 700  /***/ }),
 701  
 702  /***/ 1973:
 703  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
 704  
 705  "use strict";
 706  var __webpack_unused_export__;
 707  /*istanbul ignore start*/
 708  
 709  
 710  __webpack_unused_export__ = ({
 711    value: true
 712  });
 713  exports.Kx = diffChars;
 714  __webpack_unused_export__ = void 0;
 715  
 716  /*istanbul ignore end*/
 717  var
 718  /*istanbul ignore start*/
 719  _base = _interopRequireDefault(__webpack_require__(1198))
 720  /*istanbul ignore end*/
 721  ;
 722  
 723  /*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 724  
 725  /*istanbul ignore end*/
 726  var characterDiff = new
 727  /*istanbul ignore start*/
 728  _base
 729  /*istanbul ignore end*/
 730  .
 731  /*istanbul ignore start*/
 732  default
 733  /*istanbul ignore end*/
 734  ();
 735  
 736  /*istanbul ignore start*/
 737  __webpack_unused_export__ = characterDiff;
 738  
 739  /*istanbul ignore end*/
 740  function diffChars(oldStr, newStr, options) {
 741    return characterDiff.diff(oldStr, newStr, options);
 742  }
 743  
 744  
 745  /***/ }),
 746  
 747  /***/ 1345:
 748  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
 749  
 750  "use strict";
 751  
 752  
 753  var util = __webpack_require__(5022);
 754  
 755  function scrollIntoView(elem, container, config) {
 756    config = config || {};
 757    // document 归一化到 window
 758    if (container.nodeType === 9) {
 759      container = util.getWindow(container);
 760    }
 761  
 762    var allowHorizontalScroll = config.allowHorizontalScroll;
 763    var onlyScrollIfNeeded = config.onlyScrollIfNeeded;
 764    var alignWithTop = config.alignWithTop;
 765    var alignWithLeft = config.alignWithLeft;
 766    var offsetTop = config.offsetTop || 0;
 767    var offsetLeft = config.offsetLeft || 0;
 768    var offsetBottom = config.offsetBottom || 0;
 769    var offsetRight = config.offsetRight || 0;
 770  
 771    allowHorizontalScroll = allowHorizontalScroll === undefined ? true : allowHorizontalScroll;
 772  
 773    var isWin = util.isWindow(container);
 774    var elemOffset = util.offset(elem);
 775    var eh = util.outerHeight(elem);
 776    var ew = util.outerWidth(elem);
 777    var containerOffset = undefined;
 778    var ch = undefined;
 779    var cw = undefined;
 780    var containerScroll = undefined;
 781    var diffTop = undefined;
 782    var diffBottom = undefined;
 783    var win = undefined;
 784    var winScroll = undefined;
 785    var ww = undefined;
 786    var wh = undefined;
 787  
 788    if (isWin) {
 789      win = container;
 790      wh = util.height(win);
 791      ww = util.width(win);
 792      winScroll = {
 793        left: util.scrollLeft(win),
 794        top: util.scrollTop(win)
 795      };
 796      // elem 相对 container 可视视窗的距离
 797      diffTop = {
 798        left: elemOffset.left - winScroll.left - offsetLeft,
 799        top: elemOffset.top - winScroll.top - offsetTop
 800      };
 801      diffBottom = {
 802        left: elemOffset.left + ew - (winScroll.left + ww) + offsetRight,
 803        top: elemOffset.top + eh - (winScroll.top + wh) + offsetBottom
 804      };
 805      containerScroll = winScroll;
 806    } else {
 807      containerOffset = util.offset(container);
 808      ch = container.clientHeight;
 809      cw = container.clientWidth;
 810      containerScroll = {
 811        left: container.scrollLeft,
 812        top: container.scrollTop
 813      };
 814      // elem 相对 container 可视视窗的距离
 815      // 注意边框, offset 是边框到根节点
 816      diffTop = {
 817        left: elemOffset.left - (containerOffset.left + (parseFloat(util.css(container, 'borderLeftWidth')) || 0)) - offsetLeft,
 818        top: elemOffset.top - (containerOffset.top + (parseFloat(util.css(container, 'borderTopWidth')) || 0)) - offsetTop
 819      };
 820      diffBottom = {
 821        left: elemOffset.left + ew - (containerOffset.left + cw + (parseFloat(util.css(container, 'borderRightWidth')) || 0)) + offsetRight,
 822        top: elemOffset.top + eh - (containerOffset.top + ch + (parseFloat(util.css(container, 'borderBottomWidth')) || 0)) + offsetBottom
 823      };
 824    }
 825  
 826    if (diffTop.top < 0 || diffBottom.top > 0) {
 827      // 强制向上
 828      if (alignWithTop === true) {
 829        util.scrollTop(container, containerScroll.top + diffTop.top);
 830      } else if (alignWithTop === false) {
 831        util.scrollTop(container, containerScroll.top + diffBottom.top);
 832      } else {
 833        // 自动调整
 834        if (diffTop.top < 0) {
 835          util.scrollTop(container, containerScroll.top + diffTop.top);
 836        } else {
 837          util.scrollTop(container, containerScroll.top + diffBottom.top);
 838        }
 839      }
 840    } else {
 841      if (!onlyScrollIfNeeded) {
 842        alignWithTop = alignWithTop === undefined ? true : !!alignWithTop;
 843        if (alignWithTop) {
 844          util.scrollTop(container, containerScroll.top + diffTop.top);
 845        } else {
 846          util.scrollTop(container, containerScroll.top + diffBottom.top);
 847        }
 848      }
 849    }
 850  
 851    if (allowHorizontalScroll) {
 852      if (diffTop.left < 0 || diffBottom.left > 0) {
 853        // 强制向上
 854        if (alignWithLeft === true) {
 855          util.scrollLeft(container, containerScroll.left + diffTop.left);
 856        } else if (alignWithLeft === false) {
 857          util.scrollLeft(container, containerScroll.left + diffBottom.left);
 858        } else {
 859          // 自动调整
 860          if (diffTop.left < 0) {
 861            util.scrollLeft(container, containerScroll.left + diffTop.left);
 862          } else {
 863            util.scrollLeft(container, containerScroll.left + diffBottom.left);
 864          }
 865        }
 866      } else {
 867        if (!onlyScrollIfNeeded) {
 868          alignWithLeft = alignWithLeft === undefined ? true : !!alignWithLeft;
 869          if (alignWithLeft) {
 870            util.scrollLeft(container, containerScroll.left + diffTop.left);
 871          } else {
 872            util.scrollLeft(container, containerScroll.left + diffBottom.left);
 873          }
 874        }
 875      }
 876    }
 877  }
 878  
 879  module.exports = scrollIntoView;
 880  
 881  /***/ }),
 882  
 883  /***/ 5425:
 884  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
 885  
 886  "use strict";
 887  
 888  
 889  module.exports = __webpack_require__(1345);
 890  
 891  /***/ }),
 892  
 893  /***/ 5022:
 894  /***/ (function(module) {
 895  
 896  "use strict";
 897  
 898  
 899  var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
 900  
 901  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
 902  
 903  var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source;
 904  
 905  function getClientPosition(elem) {
 906    var box = undefined;
 907    var x = undefined;
 908    var y = undefined;
 909    var doc = elem.ownerDocument;
 910    var body = doc.body;
 911    var docElem = doc && doc.documentElement;
 912    // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式
 913    box = elem.getBoundingClientRect();
 914  
 915    // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop
 916    // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确
 917    // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin
 918  
 919    x = box.left;
 920    y = box.top;
 921  
 922    // In IE, most of the time, 2 extra pixels are added to the top and left
 923    // due to the implicit 2-pixel inset border.  In IE6/7 quirks mode and
 924    // IE6 standards mode, this border can be overridden by setting the
 925    // document element's border to zero -- thus, we cannot rely on the
 926    // offset always being 2 pixels.
 927  
 928    // In quirks mode, the offset can be determined by querying the body's
 929    // clientLeft/clientTop, but in standards mode, it is found by querying
 930    // the document element's clientLeft/clientTop.  Since we already called
 931    // getClientBoundingRect we have already forced a reflow, so it is not
 932    // too expensive just to query them all.
 933  
 934    // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的
 935    // 窗口边框标准是设 documentElement ,quirks 时设置 body
 936    // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去
 937    // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置
 938    // 标准 ie 下 docElem.clientTop 就是 border-top
 939    // ie7 html 即窗口边框改变不了。永远为 2
 940    // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0
 941  
 942    x -= docElem.clientLeft || body.clientLeft || 0;
 943    y -= docElem.clientTop || body.clientTop || 0;
 944  
 945    return {
 946      left: x,
 947      top: y
 948    };
 949  }
 950  
 951  function getScroll(w, top) {
 952    var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];
 953    var method = 'scroll' + (top ? 'Top' : 'Left');
 954    if (typeof ret !== 'number') {
 955      var d = w.document;
 956      // ie6,7,8 standard mode
 957      ret = d.documentElement[method];
 958      if (typeof ret !== 'number') {
 959        // quirks mode
 960        ret = d.body[method];
 961      }
 962    }
 963    return ret;
 964  }
 965  
 966  function getScrollLeft(w) {
 967    return getScroll(w);
 968  }
 969  
 970  function getScrollTop(w) {
 971    return getScroll(w, true);
 972  }
 973  
 974  function getOffset(el) {
 975    var pos = getClientPosition(el);
 976    var doc = el.ownerDocument;
 977    var w = doc.defaultView || doc.parentWindow;
 978    pos.left += getScrollLeft(w);
 979    pos.top += getScrollTop(w);
 980    return pos;
 981  }
 982  function _getComputedStyle(elem, name, computedStyle_) {
 983    var val = '';
 984    var d = elem.ownerDocument;
 985    var computedStyle = computedStyle_ || d.defaultView.getComputedStyle(elem, null);
 986  
 987    // https://github.com/kissyteam/kissy/issues/61
 988    if (computedStyle) {
 989      val = computedStyle.getPropertyValue(name) || computedStyle[name];
 990    }
 991  
 992    return val;
 993  }
 994  
 995  var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i');
 996  var RE_POS = /^(top|right|bottom|left)$/;
 997  var CURRENT_STYLE = 'currentStyle';
 998  var RUNTIME_STYLE = 'runtimeStyle';
 999  var LEFT = 'left';
1000  var PX = 'px';
1001  
1002  function _getComputedStyleIE(elem, name) {
1003    // currentStyle maybe null
1004    // http://msdn.microsoft.com/en-us/library/ms535231.aspx
1005    var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];
1006  
1007    // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值
1008    // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19
1009    // 在 ie 下不对,需要直接用 offset 方式
1010    // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了
1011  
1012    // From the awesome hack by Dean Edwards
1013    // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
1014    // If we're not dealing with a regular pixel number
1015    // but a number that has a weird ending, we need to convert it to pixels
1016    // exclude left right for relativity
1017    if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {
1018      // Remember the original values
1019      var style = elem.style;
1020      var left = style[LEFT];
1021      var rsLeft = elem[RUNTIME_STYLE][LEFT];
1022  
1023      // prevent flashing of content
1024      elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];
1025  
1026      // Put in the new values to get a computed value out
1027      style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;
1028      ret = style.pixelLeft + PX;
1029  
1030      // Revert the changed values
1031      style[LEFT] = left;
1032  
1033      elem[RUNTIME_STYLE][LEFT] = rsLeft;
1034    }
1035    return ret === '' ? 'auto' : ret;
1036  }
1037  
1038  var getComputedStyleX = undefined;
1039  if (typeof window !== 'undefined') {
1040    getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;
1041  }
1042  
1043  function each(arr, fn) {
1044    for (var i = 0; i < arr.length; i++) {
1045      fn(arr[i]);
1046    }
1047  }
1048  
1049  function isBorderBoxFn(elem) {
1050    return getComputedStyleX(elem, 'boxSizing') === 'border-box';
1051  }
1052  
1053  var BOX_MODELS = ['margin', 'border', 'padding'];
1054  var CONTENT_INDEX = -1;
1055  var PADDING_INDEX = 2;
1056  var BORDER_INDEX = 1;
1057  var MARGIN_INDEX = 0;
1058  
1059  function swap(elem, options, callback) {
1060    var old = {};
1061    var style = elem.style;
1062    var name = undefined;
1063  
1064    // Remember the old values, and insert the new ones
1065    for (name in options) {
1066      if (options.hasOwnProperty(name)) {
1067        old[name] = style[name];
1068        style[name] = options[name];
1069      }
1070    }
1071  
1072    callback.call(elem);
1073  
1074    // Revert the old values
1075    for (name in options) {
1076      if (options.hasOwnProperty(name)) {
1077        style[name] = old[name];
1078      }
1079    }
1080  }
1081  
1082  function getPBMWidth(elem, props, which) {
1083    var value = 0;
1084    var prop = undefined;
1085    var j = undefined;
1086    var i = undefined;
1087    for (j = 0; j < props.length; j++) {
1088      prop = props[j];
1089      if (prop) {
1090        for (i = 0; i < which.length; i++) {
1091          var cssProp = undefined;
1092          if (prop === 'border') {
1093            cssProp = prop + which[i] + 'Width';
1094          } else {
1095            cssProp = prop + which[i];
1096          }
1097          value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;
1098        }
1099      }
1100    }
1101    return value;
1102  }
1103  
1104  /**
1105   * A crude way of determining if an object is a window
1106   * @member util
1107   */
1108  function isWindow(obj) {
1109    // must use == for ie8
1110    /* eslint eqeqeq:0 */
1111    return obj != null && obj == obj.window;
1112  }
1113  
1114  var domUtils = {};
1115  
1116  each(['Width', 'Height'], function (name) {
1117    domUtils['doc' + name] = function (refWin) {
1118      var d = refWin.document;
1119      return Math.max(
1120      // firefox chrome documentElement.scrollHeight< body.scrollHeight
1121      // ie standard mode : documentElement.scrollHeight> body.scrollHeight
1122      d.documentElement['scroll' + name],
1123      // quirks : documentElement.scrollHeight 最大等于可视窗口多一点?
1124      d.body['scroll' + name], domUtils['viewport' + name](d));
1125    };
1126  
1127    domUtils['viewport' + name] = function (win) {
1128      // pc browser includes scrollbar in window.innerWidth
1129      var prop = 'client' + name;
1130      var doc = win.document;
1131      var body = doc.body;
1132      var documentElement = doc.documentElement;
1133      var documentElementProp = documentElement[prop];
1134      // 标准模式取 documentElement
1135      // backcompat 取 body
1136      return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;
1137    };
1138  });
1139  
1140  /*
1141   得到元素的大小信息
1142   @param elem
1143   @param name
1144   @param {String} [extra]  'padding' : (css width) + padding
1145   'border' : (css width) + padding + border
1146   'margin' : (css width) + padding + border + margin
1147   */
1148  function getWH(elem, name, extra) {
1149    if (isWindow(elem)) {
1150      return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);
1151    } else if (elem.nodeType === 9) {
1152      return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);
1153    }
1154    var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
1155    var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight;
1156    var computedStyle = getComputedStyleX(elem);
1157    var isBorderBox = isBorderBoxFn(elem, computedStyle);
1158    var cssBoxValue = 0;
1159    if (borderBoxValue == null || borderBoxValue <= 0) {
1160      borderBoxValue = undefined;
1161      // Fall back to computed then un computed css if necessary
1162      cssBoxValue = getComputedStyleX(elem, name);
1163      if (cssBoxValue == null || Number(cssBoxValue) < 0) {
1164        cssBoxValue = elem.style[name] || 0;
1165      }
1166      // Normalize '', auto, and prepare for extra
1167      cssBoxValue = parseFloat(cssBoxValue) || 0;
1168    }
1169    if (extra === undefined) {
1170      extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;
1171    }
1172    var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;
1173    var val = borderBoxValue || cssBoxValue;
1174    if (extra === CONTENT_INDEX) {
1175      if (borderBoxValueOrIsBorderBox) {
1176        return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);
1177      }
1178      return cssBoxValue;
1179    }
1180    if (borderBoxValueOrIsBorderBox) {
1181      var padding = extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle);
1182      return val + (extra === BORDER_INDEX ? 0 : padding);
1183    }
1184    return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);
1185  }
1186  
1187  var cssShow = {
1188    position: 'absolute',
1189    visibility: 'hidden',
1190    display: 'block'
1191  };
1192  
1193  // fix #119 : https://github.com/kissyteam/kissy/issues/119
1194  function getWHIgnoreDisplay(elem) {
1195    var val = undefined;
1196    var args = arguments;
1197    // in case elem is window
1198    // elem.offsetWidth === undefined
1199    if (elem.offsetWidth !== 0) {
1200      val = getWH.apply(undefined, args);
1201    } else {
1202      swap(elem, cssShow, function () {
1203        val = getWH.apply(undefined, args);
1204      });
1205    }
1206    return val;
1207  }
1208  
1209  function css(el, name, v) {
1210    var value = v;
1211    if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
1212      for (var i in name) {
1213        if (name.hasOwnProperty(i)) {
1214          css(el, i, name[i]);
1215        }
1216      }
1217      return undefined;
1218    }
1219    if (typeof value !== 'undefined') {
1220      if (typeof value === 'number') {
1221        value += 'px';
1222      }
1223      el.style[name] = value;
1224      return undefined;
1225    }
1226    return getComputedStyleX(el, name);
1227  }
1228  
1229  each(['width', 'height'], function (name) {
1230    var first = name.charAt(0).toUpperCase() + name.slice(1);
1231    domUtils['outer' + first] = function (el, includeMargin) {
1232      return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);
1233    };
1234    var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
1235  
1236    domUtils[name] = function (elem, val) {
1237      if (val !== undefined) {
1238        if (elem) {
1239          var computedStyle = getComputedStyleX(elem);
1240          var isBorderBox = isBorderBoxFn(elem);
1241          if (isBorderBox) {
1242            val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);
1243          }
1244          return css(elem, name, val);
1245        }
1246        return undefined;
1247      }
1248      return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);
1249    };
1250  });
1251  
1252  // 设置 elem 相对 elem.ownerDocument 的坐标
1253  function setOffset(elem, offset) {
1254    // set position first, in-case top/left are set even on static elem
1255    if (css(elem, 'position') === 'static') {
1256      elem.style.position = 'relative';
1257    }
1258  
1259    var old = getOffset(elem);
1260    var ret = {};
1261    var current = undefined;
1262    var key = undefined;
1263  
1264    for (key in offset) {
1265      if (offset.hasOwnProperty(key)) {
1266        current = parseFloat(css(elem, key)) || 0;
1267        ret[key] = current + offset[key] - old[key];
1268      }
1269    }
1270    css(elem, ret);
1271  }
1272  
1273  module.exports = _extends({
1274    getWindow: function getWindow(node) {
1275      var doc = node.ownerDocument || node;
1276      return doc.defaultView || doc.parentWindow;
1277    },
1278    offset: function offset(el, value) {
1279      if (typeof value !== 'undefined') {
1280        setOffset(el, value);
1281      } else {
1282        return getOffset(el);
1283      }
1284    },
1285  
1286    isWindow: isWindow,
1287    each: each,
1288    css: css,
1289    clone: function clone(obj) {
1290      var ret = {};
1291      for (var i in obj) {
1292        if (obj.hasOwnProperty(i)) {
1293          ret[i] = obj[i];
1294        }
1295      }
1296      var overflow = obj.overflow;
1297      if (overflow) {
1298        for (var i in obj) {
1299          if (obj.hasOwnProperty(i)) {
1300            ret.overflow[i] = obj.overflow[i];
1301          }
1302        }
1303      }
1304      return ret;
1305    },
1306    scrollLeft: function scrollLeft(w, v) {
1307      if (isWindow(w)) {
1308        if (v === undefined) {
1309          return getScrollLeft(w);
1310        }
1311        window.scrollTo(v, getScrollTop(w));
1312      } else {
1313        if (v === undefined) {
1314          return w.scrollLeft;
1315        }
1316        w.scrollLeft = v;
1317      }
1318    },
1319    scrollTop: function scrollTop(w, v) {
1320      if (isWindow(w)) {
1321        if (v === undefined) {
1322          return getScrollTop(w);
1323        }
1324        window.scrollTo(getScrollLeft(w), v);
1325      } else {
1326        if (v === undefined) {
1327          return w.scrollTop;
1328        }
1329        w.scrollTop = v;
1330      }
1331    },
1332  
1333    viewportWidth: 0,
1334    viewportHeight: 0
1335  }, domUtils);
1336  
1337  /***/ }),
1338  
1339  /***/ 8575:
1340  /***/ (function(module) {
1341  
1342  if (typeof Object.create === 'function') {
1343    // implementation from standard node.js 'util' module
1344    module.exports = function inherits(ctor, superCtor) {
1345      if (superCtor) {
1346        ctor.super_ = superCtor
1347        ctor.prototype = Object.create(superCtor.prototype, {
1348          constructor: {
1349            value: ctor,
1350            enumerable: false,
1351            writable: true,
1352            configurable: true
1353          }
1354        })
1355      }
1356    };
1357  } else {
1358    // old school shim for old browsers
1359    module.exports = function inherits(ctor, superCtor) {
1360      if (superCtor) {
1361        ctor.super_ = superCtor
1362        var TempCtor = function () {}
1363        TempCtor.prototype = superCtor.prototype
1364        ctor.prototype = new TempCtor()
1365        ctor.prototype.constructor = ctor
1366      }
1367    }
1368  }
1369  
1370  
1371  /***/ }),
1372  
1373  /***/ 9894:
1374  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
1375  
1376  // Load in dependencies
1377  var computedStyle = __webpack_require__(4827);
1378  
1379  /**
1380   * Calculate the `line-height` of a given node
1381   * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM.
1382   * @returns {Number} `line-height` of the element in pixels
1383   */
1384  function lineHeight(node) {
1385    // Grab the line-height via style
1386    var lnHeightStr = computedStyle(node, 'line-height');
1387    var lnHeight = parseFloat(lnHeightStr, 10);
1388  
1389    // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em')
1390    if (lnHeightStr === lnHeight + '') {
1391      // Save the old lineHeight style and update the em unit to the element
1392      var _lnHeightStyle = node.style.lineHeight;
1393      node.style.lineHeight = lnHeightStr + 'em';
1394  
1395      // Calculate the em based height
1396      lnHeightStr = computedStyle(node, 'line-height');
1397      lnHeight = parseFloat(lnHeightStr, 10);
1398  
1399      // Revert the lineHeight style
1400      if (_lnHeightStyle) {
1401        node.style.lineHeight = _lnHeightStyle;
1402      } else {
1403        delete node.style.lineHeight;
1404      }
1405    }
1406  
1407    // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt)
1408    // DEV: `em` units are converted to `pt` in IE6
1409    // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length
1410    if (lnHeightStr.indexOf('pt') !== -1) {
1411      lnHeight *= 4;
1412      lnHeight /= 3;
1413    // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm)
1414    } else if (lnHeightStr.indexOf('mm') !== -1) {
1415      lnHeight *= 96;
1416      lnHeight /= 25.4;
1417    // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm)
1418    } else if (lnHeightStr.indexOf('cm') !== -1) {
1419      lnHeight *= 96;
1420      lnHeight /= 2.54;
1421    // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in)
1422    } else if (lnHeightStr.indexOf('in') !== -1) {
1423      lnHeight *= 96;
1424    // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc)
1425    } else if (lnHeightStr.indexOf('pc') !== -1) {
1426      lnHeight *= 16;
1427    }
1428  
1429    // Continue our computation
1430    lnHeight = Math.round(lnHeight);
1431  
1432    // If the line-height is "normal", calculate by font-size
1433    if (lnHeightStr === 'normal') {
1434      // Create a temporary node
1435      var nodeName = node.nodeName;
1436      var _node = document.createElement(nodeName);
1437      _node.innerHTML = '&nbsp;';
1438  
1439      // If we have a text area, reset it to only 1 row
1440      // https://github.com/twolfson/line-height/issues/4
1441      if (nodeName.toUpperCase() === 'TEXTAREA') {
1442        _node.setAttribute('rows', '1');
1443      }
1444  
1445      // Set the font-size of the element
1446      var fontSizeStr = computedStyle(node, 'font-size');
1447      _node.style.fontSize = fontSizeStr;
1448  
1449      // Remove default padding/border which can affect offset height
1450      // https://github.com/twolfson/line-height/issues/4
1451      // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight
1452      _node.style.padding = '0px';
1453      _node.style.border = '0px';
1454  
1455      // Append it to the body
1456      var body = document.body;
1457      body.appendChild(_node);
1458  
1459      // Assume the line height of the element is the height
1460      var height = _node.offsetHeight;
1461      lnHeight = height;
1462  
1463      // Remove our child from the DOM
1464      body.removeChild(_node);
1465    }
1466  
1467    // Return the calculated height
1468    return lnHeight;
1469  }
1470  
1471  // Export lineHeight
1472  module.exports = lineHeight;
1473  
1474  
1475  /***/ }),
1476  
1477  /***/ 7970:
1478  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
1479  
1480  module.exports = __webpack_require__(195);
1481  
1482  
1483  /***/ }),
1484  
1485  /***/ 3110:
1486  /***/ (function(module) {
1487  
1488  "use strict";
1489  /**
1490   * Copyright (c) 2015, Facebook, Inc.
1491   * All rights reserved.
1492   *
1493   * This source code is licensed under the BSD-style license found in the
1494   * LICENSE file in the root directory of this source tree. An additional grant
1495   * of patent rights can be found in the PATENTS file in the same directory.
1496   *
1497   * @providesModule ExecutionEnvironment
1498   */
1499  
1500  /*jslint evil: true */
1501  
1502  
1503  
1504  var canUseDOM = !!(
1505    typeof window !== 'undefined' &&
1506    window.document &&
1507    window.document.createElement
1508  );
1509  
1510  /**
1511   * Simple, lightweight module assisting with the detection and context of
1512   * Worker. Helps avoid circular dependencies and allows code to reason about
1513   * whether or not they are in a Worker, even if they never include the main
1514   * `ReactWorker` dependency.
1515   */
1516  var ExecutionEnvironment = {
1517  
1518    canUseDOM: canUseDOM,
1519  
1520    canUseWorkers: typeof Worker !== 'undefined',
1521  
1522    canUseEventListeners:
1523      canUseDOM && !!(window.addEventListener || window.attachEvent),
1524  
1525    canUseViewport: canUseDOM && !!window.screen,
1526  
1527    isInWorker: !canUseDOM // For now, this is true - might change in the future.
1528  
1529  };
1530  
1531  module.exports = ExecutionEnvironment;
1532  
1533  
1534  /***/ }),
1535  
1536  /***/ 3812:
1537  /***/ (function(module) {
1538  
1539  /**
1540   * Copyright 2004-present Facebook. All Rights Reserved.
1541   *
1542   * @providesModule UserAgent_DEPRECATED
1543   */
1544  
1545  /**
1546   *  Provides entirely client-side User Agent and OS detection. You should prefer
1547   *  the non-deprecated UserAgent module when possible, which exposes our
1548   *  authoritative server-side PHP-based detection to the client.
1549   *
1550   *  Usage is straightforward:
1551   *
1552   *    if (UserAgent_DEPRECATED.ie()) {
1553   *      //  IE
1554   *    }
1555   *
1556   *  You can also do version checks:
1557   *
1558   *    if (UserAgent_DEPRECATED.ie() >= 7) {
1559   *      //  IE7 or better
1560   *    }
1561   *
1562   *  The browser functions will return NaN if the browser does not match, so
1563   *  you can also do version compares the other way:
1564   *
1565   *    if (UserAgent_DEPRECATED.ie() < 7) {
1566   *      //  IE6 or worse
1567   *    }
1568   *
1569   *  Note that the version is a float and may include a minor version number,
1570   *  so you should always use range operators to perform comparisons, not
1571   *  strict equality.
1572   *
1573   *  **Note:** You should **strongly** prefer capability detection to browser
1574   *  version detection where it's reasonable:
1575   *
1576   *    http://www.quirksmode.org/js/support.html
1577   *
1578   *  Further, we have a large number of mature wrapper functions and classes
1579   *  which abstract away many browser irregularities. Check the documentation,
1580   *  grep for things, or ask on javascript@lists.facebook.com before writing yet
1581   *  another copy of "event || window.event".
1582   *
1583   */
1584  
1585  var _populated = false;
1586  
1587  // Browsers
1588  var _ie, _firefox, _opera, _webkit, _chrome;
1589  
1590  // Actual IE browser for compatibility mode
1591  var _ie_real_version;
1592  
1593  // Platforms
1594  var _osx, _windows, _linux, _android;
1595  
1596  // Architectures
1597  var _win64;
1598  
1599  // Devices
1600  var _iphone, _ipad, _native;
1601  
1602  var _mobile;
1603  
1604  function _populate() {
1605    if (_populated) {
1606      return;
1607    }
1608  
1609    _populated = true;
1610  
1611    // To work around buggy JS libraries that can't handle multi-digit
1612    // version numbers, Opera 10's user agent string claims it's Opera
1613    // 9, then later includes a Version/X.Y field:
1614    //
1615    // Opera/9.80 (foo) Presto/2.2.15 Version/10.10
1616    var uas = navigator.userAgent;
1617    var agent = /(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(uas);
1618    var os    = /(Mac OS X)|(Windows)|(Linux)/.exec(uas);
1619  
1620    _iphone = /\b(iPhone|iP[ao]d)/.exec(uas);
1621    _ipad = /\b(iP[ao]d)/.exec(uas);
1622    _android = /Android/i.exec(uas);
1623    _native = /FBAN\/\w+;/i.exec(uas);
1624    _mobile = /Mobile/i.exec(uas);
1625  
1626    // Note that the IE team blog would have you believe you should be checking
1627    // for 'Win64; x64'.  But MSDN then reveals that you can actually be coming
1628    // from either x64 or ia64;  so ultimately, you should just check for Win64
1629    // as in indicator of whether you're in 64-bit IE.  32-bit IE on 64-bit
1630    // Windows will send 'WOW64' instead.
1631    _win64 = !!(/Win64/.exec(uas));
1632  
1633    if (agent) {
1634      _ie = agent[1] ? parseFloat(agent[1]) : (
1635            agent[5] ? parseFloat(agent[5]) : NaN);
1636      // IE compatibility mode
1637      if (_ie && document && document.documentMode) {
1638        _ie = document.documentMode;
1639      }
1640      // grab the "true" ie version from the trident token if available
1641      var trident = /(?:Trident\/(\d+.\d+))/.exec(uas);
1642      _ie_real_version = trident ? parseFloat(trident[1]) + 4 : _ie;
1643  
1644      _firefox = agent[2] ? parseFloat(agent[2]) : NaN;
1645      _opera   = agent[3] ? parseFloat(agent[3]) : NaN;
1646      _webkit  = agent[4] ? parseFloat(agent[4]) : NaN;
1647      if (_webkit) {
1648        // We do not add the regexp to the above test, because it will always
1649        // match 'safari' only since 'AppleWebKit' appears before 'Chrome' in
1650        // the userAgent string.
1651        agent = /(?:Chrome\/(\d+\.\d+))/.exec(uas);
1652        _chrome = agent && agent[1] ? parseFloat(agent[1]) : NaN;
1653      } else {
1654        _chrome = NaN;
1655      }
1656    } else {
1657      _ie = _firefox = _opera = _chrome = _webkit = NaN;
1658    }
1659  
1660    if (os) {
1661      if (os[1]) {
1662        // Detect OS X version.  If no version number matches, set _osx to true.
1663        // Version examples:  10, 10_6_1, 10.7
1664        // Parses version number as a float, taking only first two sets of
1665        // digits.  If only one set of digits is found, returns just the major
1666        // version number.
1667        var ver = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(uas);
1668  
1669        _osx = ver ? parseFloat(ver[1].replace('_', '.')) : true;
1670      } else {
1671        _osx = false;
1672      }
1673      _windows = !!os[2];
1674      _linux   = !!os[3];
1675    } else {
1676      _osx = _windows = _linux = false;
1677    }
1678  }
1679  
1680  var UserAgent_DEPRECATED = {
1681  
1682    /**
1683     *  Check if the UA is Internet Explorer.
1684     *
1685     *
1686     *  @return float|NaN Version number (if match) or NaN.
1687     */
1688    ie: function() {
1689      return _populate() || _ie;
1690    },
1691  
1692    /**
1693     * Check if we're in Internet Explorer compatibility mode.
1694     *
1695     * @return bool true if in compatibility mode, false if
1696     * not compatibility mode or not ie
1697     */
1698    ieCompatibilityMode: function() {
1699      return _populate() || (_ie_real_version > _ie);
1700    },
1701  
1702  
1703    /**
1704     * Whether the browser is 64-bit IE.  Really, this is kind of weak sauce;  we
1705     * only need this because Skype can't handle 64-bit IE yet.  We need to remove
1706     * this when we don't need it -- tracked by #601957.
1707     */
1708    ie64: function() {
1709      return UserAgent_DEPRECATED.ie() && _win64;
1710    },
1711  
1712    /**
1713     *  Check if the UA is Firefox.
1714     *
1715     *
1716     *  @return float|NaN Version number (if match) or NaN.
1717     */
1718    firefox: function() {
1719      return _populate() || _firefox;
1720    },
1721  
1722  
1723    /**
1724     *  Check if the UA is Opera.
1725     *
1726     *
1727     *  @return float|NaN Version number (if match) or NaN.
1728     */
1729    opera: function() {
1730      return _populate() || _opera;
1731    },
1732  
1733  
1734    /**
1735     *  Check if the UA is WebKit.
1736     *
1737     *
1738     *  @return float|NaN Version number (if match) or NaN.
1739     */
1740    webkit: function() {
1741      return _populate() || _webkit;
1742    },
1743  
1744    /**
1745     *  For Push
1746     *  WILL BE REMOVED VERY SOON. Use UserAgent_DEPRECATED.webkit
1747     */
1748    safari: function() {
1749      return UserAgent_DEPRECATED.webkit();
1750    },
1751  
1752    /**
1753     *  Check if the UA is a Chrome browser.
1754     *
1755     *
1756     *  @return float|NaN Version number (if match) or NaN.
1757     */
1758    chrome : function() {
1759      return _populate() || _chrome;
1760    },
1761  
1762  
1763    /**
1764     *  Check if the user is running Windows.
1765     *
1766     *  @return bool `true' if the user's OS is Windows.
1767     */
1768    windows: function() {
1769      return _populate() || _windows;
1770    },
1771  
1772  
1773    /**
1774     *  Check if the user is running Mac OS X.
1775     *
1776     *  @return float|bool   Returns a float if a version number is detected,
1777     *                       otherwise true/false.
1778     */
1779    osx: function() {
1780      return _populate() || _osx;
1781    },
1782  
1783    /**
1784     * Check if the user is running Linux.
1785     *
1786     * @return bool `true' if the user's OS is some flavor of Linux.
1787     */
1788    linux: function() {
1789      return _populate() || _linux;
1790    },
1791  
1792    /**
1793     * Check if the user is running on an iPhone or iPod platform.
1794     *
1795     * @return bool `true' if the user is running some flavor of the
1796     *    iPhone OS.
1797     */
1798    iphone: function() {
1799      return _populate() || _iphone;
1800    },
1801  
1802    mobile: function() {
1803      return _populate() || (_iphone || _ipad || _android || _mobile);
1804    },
1805  
1806    nativeApp: function() {
1807      // webviews inside of the native apps
1808      return _populate() || _native;
1809    },
1810  
1811    android: function() {
1812      return _populate() || _android;
1813    },
1814  
1815    ipad: function() {
1816      return _populate() || _ipad;
1817    }
1818  };
1819  
1820  module.exports = UserAgent_DEPRECATED;
1821  
1822  
1823  /***/ }),
1824  
1825  /***/ 7939:
1826  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
1827  
1828  "use strict";
1829  /**
1830   * Copyright 2013-2015, Facebook, Inc.
1831   * All rights reserved.
1832   *
1833   * This source code is licensed under the BSD-style license found in the
1834   * LICENSE file in the root directory of this source tree. An additional grant
1835   * of patent rights can be found in the PATENTS file in the same directory.
1836   *
1837   * @providesModule isEventSupported
1838   */
1839  
1840  
1841  
1842  var ExecutionEnvironment = __webpack_require__(3110);
1843  
1844  var useHasFeature;
1845  if (ExecutionEnvironment.canUseDOM) {
1846    useHasFeature =
1847      document.implementation &&
1848      document.implementation.hasFeature &&
1849      // always returns true in newer browsers as per the standard.
1850      // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
1851      document.implementation.hasFeature('', '') !== true;
1852  }
1853  
1854  /**
1855   * Checks if an event is supported in the current execution environment.
1856   *
1857   * NOTE: This will not work correctly for non-generic events such as `change`,
1858   * `reset`, `load`, `error`, and `select`.
1859   *
1860   * Borrows from Modernizr.
1861   *
1862   * @param {string} eventNameSuffix Event name, e.g. "click".
1863   * @param {?boolean} capture Check if the capture phase is supported.
1864   * @return {boolean} True if the event is supported.
1865   * @internal
1866   * @license Modernizr 3.0.0pre (Custom Build) | MIT
1867   */
1868  function isEventSupported(eventNameSuffix, capture) {
1869    if (!ExecutionEnvironment.canUseDOM ||
1870        capture && !('addEventListener' in document)) {
1871      return false;
1872    }
1873  
1874    var eventName = 'on' + eventNameSuffix;
1875    var isSupported = eventName in document;
1876  
1877    if (!isSupported) {
1878      var element = document.createElement('div');
1879      element.setAttribute(eventName, 'return;');
1880      isSupported = typeof element[eventName] === 'function';
1881    }
1882  
1883    if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
1884      // This is the only way to test support for the `wheel` event in IE9+.
1885      isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
1886    }
1887  
1888    return isSupported;
1889  }
1890  
1891  module.exports = isEventSupported;
1892  
1893  
1894  /***/ }),
1895  
1896  /***/ 195:
1897  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
1898  
1899  "use strict";
1900  /**
1901   * Copyright (c) 2015, Facebook, Inc.
1902   * All rights reserved.
1903   *
1904   * This source code is licensed under the BSD-style license found in the
1905   * LICENSE file in the root directory of this source tree. An additional grant
1906   * of patent rights can be found in the PATENTS file in the same directory.
1907   *
1908   * @providesModule normalizeWheel
1909   * @typechecks
1910   */
1911  
1912  
1913  
1914  var UserAgent_DEPRECATED = __webpack_require__(3812);
1915  
1916  var isEventSupported = __webpack_require__(7939);
1917  
1918  
1919  // Reasonable defaults
1920  var PIXEL_STEP  = 10;
1921  var LINE_HEIGHT = 40;
1922  var PAGE_HEIGHT = 800;
1923  
1924  /**
1925   * Mouse wheel (and 2-finger trackpad) support on the web sucks.  It is
1926   * complicated, thus this doc is long and (hopefully) detailed enough to answer
1927   * your questions.
1928   *
1929   * If you need to react to the mouse wheel in a predictable way, this code is
1930   * like your bestest friend. * hugs *
1931   *
1932   * As of today, there are 4 DOM event types you can listen to:
1933   *
1934   *   'wheel'                -- Chrome(31+), FF(17+), IE(9+)
1935   *   'mousewheel'           -- Chrome, IE(6+), Opera, Safari
1936   *   'MozMousePixelScroll'  -- FF(3.5 only!) (2010-2013) -- don't bother!
1937   *   'DOMMouseScroll'       -- FF(0.9.7+) since 2003
1938   *
1939   * So what to do?  The is the best:
1940   *
1941   *   normalizeWheel.getEventType();
1942   *
1943   * In your event callback, use this code to get sane interpretation of the
1944   * deltas.  This code will return an object with properties:
1945   *
1946   *   spinX   -- normalized spin speed (use for zoom) - x plane
1947   *   spinY   -- " - y plane
1948   *   pixelX  -- normalized distance (to pixels) - x plane
1949   *   pixelY  -- " - y plane
1950   *
1951   * Wheel values are provided by the browser assuming you are using the wheel to
1952   * scroll a web page by a number of lines or pixels (or pages).  Values can vary
1953   * significantly on different platforms and browsers, forgetting that you can
1954   * scroll at different speeds.  Some devices (like trackpads) emit more events
1955   * at smaller increments with fine granularity, and some emit massive jumps with
1956   * linear speed or acceleration.
1957   *
1958   * This code does its best to normalize the deltas for you:
1959   *
1960   *   - spin is trying to normalize how far the wheel was spun (or trackpad
1961   *     dragged).  This is super useful for zoom support where you want to
1962   *     throw away the chunky scroll steps on the PC and make those equal to
1963   *     the slow and smooth tiny steps on the Mac. Key data: This code tries to
1964   *     resolve a single slow step on a wheel to 1.
1965   *
1966   *   - pixel is normalizing the desired scroll delta in pixel units.  You'll
1967   *     get the crazy differences between browsers, but at least it'll be in
1968   *     pixels!
1969   *
1970   *   - positive value indicates scrolling DOWN/RIGHT, negative UP/LEFT.  This
1971   *     should translate to positive value zooming IN, negative zooming OUT.
1972   *     This matches the newer 'wheel' event.
1973   *
1974   * Why are there spinX, spinY (or pixels)?
1975   *
1976   *   - spinX is a 2-finger side drag on the trackpad, and a shift + wheel turn
1977   *     with a mouse.  It results in side-scrolling in the browser by default.
1978   *
1979   *   - spinY is what you expect -- it's the classic axis of a mouse wheel.
1980   *
1981   *   - I dropped spinZ/pixelZ.  It is supported by the DOM 3 'wheel' event and
1982   *     probably is by browsers in conjunction with fancy 3D controllers .. but
1983   *     you know.
1984   *
1985   * Implementation info:
1986   *
1987   * Examples of 'wheel' event if you scroll slowly (down) by one step with an
1988   * average mouse:
1989   *
1990   *   OS X + Chrome  (mouse)     -    4   pixel delta  (wheelDelta -120)
1991   *   OS X + Safari  (mouse)     -  N/A   pixel delta  (wheelDelta  -12)
1992   *   OS X + Firefox (mouse)     -    0.1 line  delta  (wheelDelta  N/A)
1993   *   Win8 + Chrome  (mouse)     -  100   pixel delta  (wheelDelta -120)
1994   *   Win8 + Firefox (mouse)     -    3   line  delta  (wheelDelta -120)
1995   *
1996   * On the trackpad:
1997   *
1998   *   OS X + Chrome  (trackpad)  -    2   pixel delta  (wheelDelta   -6)
1999   *   OS X + Firefox (trackpad)  -    1   pixel delta  (wheelDelta  N/A)
2000   *
2001   * On other/older browsers.. it's more complicated as there can be multiple and
2002   * also missing delta values.
2003   *
2004   * The 'wheel' event is more standard:
2005   *
2006   * http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents
2007   *
2008   * The basics is that it includes a unit, deltaMode (pixels, lines, pages), and
2009   * deltaX, deltaY and deltaZ.  Some browsers provide other values to maintain
2010   * backward compatibility with older events.  Those other values help us
2011   * better normalize spin speed.  Example of what the browsers provide:
2012   *
2013   *                          | event.wheelDelta | event.detail
2014   *        ------------------+------------------+--------------
2015   *          Safari v5/OS X  |       -120       |       0
2016   *          Safari v5/Win7  |       -120       |       0
2017   *         Chrome v17/OS X  |       -120       |       0
2018   *         Chrome v17/Win7  |       -120       |       0
2019   *                IE9/Win7  |       -120       |   undefined
2020   *         Firefox v4/OS X  |     undefined    |       1
2021   *         Firefox v4/Win7  |     undefined    |       3
2022   *
2023   */
2024  function normalizeWheel(/*object*/ event) /*object*/ {
2025    var sX = 0, sY = 0,       // spinX, spinY
2026        pX = 0, pY = 0;       // pixelX, pixelY
2027  
2028    // Legacy
2029    if ('detail'      in event) { sY = event.detail; }
2030    if ('wheelDelta'  in event) { sY = -event.wheelDelta / 120; }
2031    if ('wheelDeltaY' in event) { sY = -event.wheelDeltaY / 120; }
2032    if ('wheelDeltaX' in event) { sX = -event.wheelDeltaX / 120; }
2033  
2034    // side scrolling on FF with DOMMouseScroll
2035    if ( 'axis' in event && event.axis === event.HORIZONTAL_AXIS ) {
2036      sX = sY;
2037      sY = 0;
2038    }
2039  
2040    pX = sX * PIXEL_STEP;
2041    pY = sY * PIXEL_STEP;
2042  
2043    if ('deltaY' in event) { pY = event.deltaY; }
2044    if ('deltaX' in event) { pX = event.deltaX; }
2045  
2046    if ((pX || pY) && event.deltaMode) {
2047      if (event.deltaMode == 1) {          // delta in LINE units
2048        pX *= LINE_HEIGHT;
2049        pY *= LINE_HEIGHT;
2050      } else {                             // delta in PAGE units
2051        pX *= PAGE_HEIGHT;
2052        pY *= PAGE_HEIGHT;
2053      }
2054    }
2055  
2056    // Fall-back if spin cannot be determined
2057    if (pX && !sX) { sX = (pX < 1) ? -1 : 1; }
2058    if (pY && !sY) { sY = (pY < 1) ? -1 : 1; }
2059  
2060    return { spinX  : sX,
2061             spinY  : sY,
2062             pixelX : pX,
2063             pixelY : pY };
2064  }
2065  
2066  
2067  /**
2068   * The best combination if you prefer spinX + spinY normalization.  It favors
2069   * the older DOMMouseScroll for Firefox, as FF does not include wheelDelta with
2070   * 'wheel' event, making spin speed determination impossible.
2071   */
2072  normalizeWheel.getEventType = function() /*string*/ {
2073    return (UserAgent_DEPRECATED.firefox())
2074             ? 'DOMMouseScroll'
2075             : (isEventSupported('wheel'))
2076                 ? 'wheel'
2077                 : 'mousewheel';
2078  };
2079  
2080  module.exports = normalizeWheel;
2081  
2082  
2083  /***/ }),
2084  
2085  /***/ 5372:
2086  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
2087  
2088  "use strict";
2089  /**
2090   * Copyright (c) 2013-present, Facebook, Inc.
2091   *
2092   * This source code is licensed under the MIT license found in the
2093   * LICENSE file in the root directory of this source tree.
2094   */
2095  
2096  
2097  
2098  var ReactPropTypesSecret = __webpack_require__(9567);
2099  
2100  function emptyFunction() {}
2101  function emptyFunctionWithReset() {}
2102  emptyFunctionWithReset.resetWarningCache = emptyFunction;
2103  
2104  module.exports = function() {
2105    function shim(props, propName, componentName, location, propFullName, secret) {
2106      if (secret === ReactPropTypesSecret) {
2107        // It is still safe when called from React.
2108        return;
2109      }
2110      var err = new Error(
2111        'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
2112        'Use PropTypes.checkPropTypes() to call them. ' +
2113        'Read more at http://fb.me/use-check-prop-types'
2114      );
2115      err.name = 'Invariant Violation';
2116      throw err;
2117    };
2118    shim.isRequired = shim;
2119    function getShim() {
2120      return shim;
2121    };
2122    // Important!
2123    // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
2124    var ReactPropTypes = {
2125      array: shim,
2126      bigint: shim,
2127      bool: shim,
2128      func: shim,
2129      number: shim,
2130      object: shim,
2131      string: shim,
2132      symbol: shim,
2133  
2134      any: shim,
2135      arrayOf: getShim,
2136      element: shim,
2137      elementType: shim,
2138      instanceOf: getShim,
2139      node: shim,
2140      objectOf: getShim,
2141      oneOf: getShim,
2142      oneOfType: getShim,
2143      shape: getShim,
2144      exact: getShim,
2145  
2146      checkPropTypes: emptyFunctionWithReset,
2147      resetWarningCache: emptyFunction
2148    };
2149  
2150    ReactPropTypes.PropTypes = ReactPropTypes;
2151  
2152    return ReactPropTypes;
2153  };
2154  
2155  
2156  /***/ }),
2157  
2158  /***/ 2652:
2159  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
2160  
2161  /**
2162   * Copyright (c) 2013-present, Facebook, Inc.
2163   *
2164   * This source code is licensed under the MIT license found in the
2165   * LICENSE file in the root directory of this source tree.
2166   */
2167  
2168  if (false) { var throwOnDirectAccess, ReactIs; } else {
2169    // By explicitly using `prop-types` you are opting into new production behavior.
2170    // http://fb.me/prop-types-in-prod
2171    module.exports = __webpack_require__(5372)();
2172  }
2173  
2174  
2175  /***/ }),
2176  
2177  /***/ 9567:
2178  /***/ (function(module) {
2179  
2180  "use strict";
2181  /**
2182   * Copyright (c) 2013-present, Facebook, Inc.
2183   *
2184   * This source code is licensed under the MIT license found in the
2185   * LICENSE file in the root directory of this source tree.
2186   */
2187  
2188  
2189  
2190  var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
2191  
2192  module.exports = ReactPropTypesSecret;
2193  
2194  
2195  /***/ }),
2196  
2197  /***/ 5438:
2198  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
2199  
2200  "use strict";
2201  
2202  var __extends = (this && this.__extends) || (function () {
2203      var extendStatics = Object.setPrototypeOf ||
2204          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
2205          function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
2206      return function (d, b) {
2207          extendStatics(d, b);
2208          function __() { this.constructor = d; }
2209          d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
2210      };
2211  })();
2212  var __assign = (this && this.__assign) || Object.assign || function(t) {
2213      for (var s, i = 1, n = arguments.length; i < n; i++) {
2214          s = arguments[i];
2215          for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
2216              t[p] = s[p];
2217      }
2218      return t;
2219  };
2220  var __rest = (this && this.__rest) || function (s, e) {
2221      var t = {};
2222      for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
2223          t[p] = s[p];
2224      if (s != null && typeof Object.getOwnPropertySymbols === "function")
2225          for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
2226              t[p[i]] = s[p[i]];
2227      return t;
2228  };
2229  exports.__esModule = true;
2230  var React = __webpack_require__(9196);
2231  var PropTypes = __webpack_require__(2652);
2232  var autosize = __webpack_require__(6411);
2233  var _getLineHeight = __webpack_require__(9894);
2234  var getLineHeight = _getLineHeight;
2235  var RESIZED = "autosize:resized";
2236  /**
2237   * A light replacement for built-in textarea component
2238   * which automaticaly adjusts its height to match the content
2239   */
2240  var TextareaAutosizeClass = /** @class */ (function (_super) {
2241      __extends(TextareaAutosizeClass, _super);
2242      function TextareaAutosizeClass() {
2243          var _this = _super !== null && _super.apply(this, arguments) || this;
2244          _this.state = {
2245              lineHeight: null
2246          };
2247          _this.textarea = null;
2248          _this.onResize = function (e) {
2249              if (_this.props.onResize) {
2250                  _this.props.onResize(e);
2251              }
2252          };
2253          _this.updateLineHeight = function () {
2254              if (_this.textarea) {
2255                  _this.setState({
2256                      lineHeight: getLineHeight(_this.textarea)
2257                  });
2258              }
2259          };
2260          _this.onChange = function (e) {
2261              var onChange = _this.props.onChange;
2262              _this.currentValue = e.currentTarget.value;
2263              onChange && onChange(e);
2264          };
2265          return _this;
2266      }
2267      TextareaAutosizeClass.prototype.componentDidMount = function () {
2268          var _this = this;
2269          var _a = this.props, maxRows = _a.maxRows, async = _a.async;
2270          if (typeof maxRows === "number") {
2271              this.updateLineHeight();
2272          }
2273          if (typeof maxRows === "number" || async) {
2274              /*
2275                the defer is needed to:
2276                  - force "autosize" to activate the scrollbar when this.props.maxRows is passed
2277                  - support StyledComponents (see #71)
2278              */
2279              setTimeout(function () { return _this.textarea && autosize(_this.textarea); });
2280          }
2281          else {
2282              this.textarea && autosize(this.textarea);
2283          }
2284          if (this.textarea) {
2285              this.textarea.addEventListener(RESIZED, this.onResize);
2286          }
2287      };
2288      TextareaAutosizeClass.prototype.componentWillUnmount = function () {
2289          if (this.textarea) {
2290              this.textarea.removeEventListener(RESIZED, this.onResize);
2291              autosize.destroy(this.textarea);
2292          }
2293      };
2294      TextareaAutosizeClass.prototype.render = function () {
2295          var _this = this;
2296          var _a = this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, children = _b.children, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef", "children"]), lineHeight = _a.state.lineHeight;
2297          var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null;
2298          return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) {
2299                  _this.textarea = element;
2300                  if (typeof _this.props.innerRef === 'function') {
2301                      _this.props.innerRef(element);
2302                  }
2303                  else if (_this.props.innerRef) {
2304                      _this.props.innerRef.current = element;
2305                  }
2306              } }), children));
2307      };
2308      TextareaAutosizeClass.prototype.componentDidUpdate = function () {
2309          this.textarea && autosize.update(this.textarea);
2310      };
2311      TextareaAutosizeClass.defaultProps = {
2312          rows: 1,
2313          async: false
2314      };
2315      TextareaAutosizeClass.propTypes = {
2316          rows: PropTypes.number,
2317          maxRows: PropTypes.number,
2318          onResize: PropTypes.func,
2319          innerRef: PropTypes.any,
2320          async: PropTypes.bool
2321      };
2322      return TextareaAutosizeClass;
2323  }(React.Component));
2324  exports.TextareaAutosize = React.forwardRef(function (props, ref) {
2325      return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref }));
2326  });
2327  
2328  
2329  /***/ }),
2330  
2331  /***/ 773:
2332  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
2333  
2334  "use strict";
2335  var __webpack_unused_export__;
2336  
2337  __webpack_unused_export__ = true;
2338  var TextareaAutosize_1 = __webpack_require__(5438);
2339  exports.Z = TextareaAutosize_1.TextareaAutosize;
2340  
2341  
2342  /***/ }),
2343  
2344  /***/ 3124:
2345  /***/ (function(module) {
2346  
2347  var traverse = module.exports = function (obj) {
2348      return new Traverse(obj);
2349  };
2350  
2351  function Traverse (obj) {
2352      this.value = obj;
2353  }
2354  
2355  Traverse.prototype.get = function (ps) {
2356      var node = this.value;
2357      for (var i = 0; i < ps.length; i ++) {
2358          var key = ps[i];
2359          if (!node || !hasOwnProperty.call(node, key)) {
2360              node = undefined;
2361              break;
2362          }
2363          node = node[key];
2364      }
2365      return node;
2366  };
2367  
2368  Traverse.prototype.has = function (ps) {
2369      var node = this.value;
2370      for (var i = 0; i < ps.length; i ++) {
2371          var key = ps[i];
2372          if (!node || !hasOwnProperty.call(node, key)) {
2373              return false;
2374          }
2375          node = node[key];
2376      }
2377      return true;
2378  };
2379  
2380  Traverse.prototype.set = function (ps, value) {
2381      var node = this.value;
2382      for (var i = 0; i < ps.length - 1; i ++) {
2383          var key = ps[i];
2384          if (!hasOwnProperty.call(node, key)) node[key] = {};
2385          node = node[key];
2386      }
2387      node[ps[i]] = value;
2388      return value;
2389  };
2390  
2391  Traverse.prototype.map = function (cb) {
2392      return walk(this.value, cb, true);
2393  };
2394  
2395  Traverse.prototype.forEach = function (cb) {
2396      this.value = walk(this.value, cb, false);
2397      return this.value;
2398  };
2399  
2400  Traverse.prototype.reduce = function (cb, init) {
2401      var skip = arguments.length === 1;
2402      var acc = skip ? this.value : init;
2403      this.forEach(function (x) {
2404          if (!this.isRoot || !skip) {
2405              acc = cb.call(this, acc, x);
2406          }
2407      });
2408      return acc;
2409  };
2410  
2411  Traverse.prototype.paths = function () {
2412      var acc = [];
2413      this.forEach(function (x) {
2414          acc.push(this.path); 
2415      });
2416      return acc;
2417  };
2418  
2419  Traverse.prototype.nodes = function () {
2420      var acc = [];
2421      this.forEach(function (x) {
2422          acc.push(this.node);
2423      });
2424      return acc;
2425  };
2426  
2427  Traverse.prototype.clone = function () {
2428      var parents = [], nodes = [];
2429      
2430      return (function clone (src) {
2431          for (var i = 0; i < parents.length; i++) {
2432              if (parents[i] === src) {
2433                  return nodes[i];
2434              }
2435          }
2436          
2437          if (typeof src === 'object' && src !== null) {
2438              var dst = copy(src);
2439              
2440              parents.push(src);
2441              nodes.push(dst);
2442              
2443              forEach(objectKeys(src), function (key) {
2444                  dst[key] = clone(src[key]);
2445              });
2446              
2447              parents.pop();
2448              nodes.pop();
2449              return dst;
2450          }
2451          else {
2452              return src;
2453          }
2454      })(this.value);
2455  };
2456  
2457  function walk (root, cb, immutable) {
2458      var path = [];
2459      var parents = [];
2460      var alive = true;
2461      
2462      return (function walker (node_) {
2463          var node = immutable ? copy(node_) : node_;
2464          var modifiers = {};
2465          
2466          var keepGoing = true;
2467          
2468          var state = {
2469              node : node,
2470              node_ : node_,
2471              path : [].concat(path),
2472              parent : parents[parents.length - 1],
2473              parents : parents,
2474              key : path.slice(-1)[0],
2475              isRoot : path.length === 0,
2476              level : path.length,
2477              circular : null,
2478              update : function (x, stopHere) {
2479                  if (!state.isRoot) {
2480                      state.parent.node[state.key] = x;
2481                  }
2482                  state.node = x;
2483                  if (stopHere) keepGoing = false;
2484              },
2485              'delete' : function (stopHere) {
2486                  delete state.parent.node[state.key];
2487                  if (stopHere) keepGoing = false;
2488              },
2489              remove : function (stopHere) {
2490                  if (isArray(state.parent.node)) {
2491                      state.parent.node.splice(state.key, 1);
2492                  }
2493                  else {
2494                      delete state.parent.node[state.key];
2495                  }
2496                  if (stopHere) keepGoing = false;
2497              },
2498              keys : null,
2499              before : function (f) { modifiers.before = f },
2500              after : function (f) { modifiers.after = f },
2501              pre : function (f) { modifiers.pre = f },
2502              post : function (f) { modifiers.post = f },
2503              stop : function () { alive = false },
2504              block : function () { keepGoing = false }
2505          };
2506          
2507          if (!alive) return state;
2508          
2509          function updateState() {
2510              if (typeof state.node === 'object' && state.node !== null) {
2511                  if (!state.keys || state.node_ !== state.node) {
2512                      state.keys = objectKeys(state.node)
2513                  }
2514                  
2515                  state.isLeaf = state.keys.length == 0;
2516                  
2517                  for (var i = 0; i < parents.length; i++) {
2518                      if (parents[i].node_ === node_) {
2519                          state.circular = parents[i];
2520                          break;
2521                      }
2522                  }
2523              }
2524              else {
2525                  state.isLeaf = true;
2526                  state.keys = null;
2527              }
2528              
2529              state.notLeaf = !state.isLeaf;
2530              state.notRoot = !state.isRoot;
2531          }
2532          
2533          updateState();
2534          
2535          // use return values to update if defined
2536          var ret = cb.call(state, state.node);
2537          if (ret !== undefined && state.update) state.update(ret);
2538          
2539          if (modifiers.before) modifiers.before.call(state, state.node);
2540          
2541          if (!keepGoing) return state;
2542          
2543          if (typeof state.node == 'object'
2544          && state.node !== null && !state.circular) {
2545              parents.push(state);
2546              
2547              updateState();
2548              
2549              forEach(state.keys, function (key, i) {
2550                  path.push(key);
2551                  
2552                  if (modifiers.pre) modifiers.pre.call(state, state.node[key], key);
2553                  
2554                  var child = walker(state.node[key]);
2555                  if (immutable && hasOwnProperty.call(state.node, key)) {
2556                      state.node[key] = child.node;
2557                  }
2558                  
2559                  child.isLast = i == state.keys.length - 1;
2560                  child.isFirst = i == 0;
2561                  
2562                  if (modifiers.post) modifiers.post.call(state, child);
2563                  
2564                  path.pop();
2565              });
2566              parents.pop();
2567          }
2568          
2569          if (modifiers.after) modifiers.after.call(state, state.node);
2570          
2571          return state;
2572      })(root).node;
2573  }
2574  
2575  function copy (src) {
2576      if (typeof src === 'object' && src !== null) {
2577          var dst;
2578          
2579          if (isArray(src)) {
2580              dst = [];
2581          }
2582          else if (isDate(src)) {
2583              dst = new Date(src.getTime ? src.getTime() : src);
2584          }
2585          else if (isRegExp(src)) {
2586              dst = new RegExp(src);
2587          }
2588          else if (isError(src)) {
2589              dst = { message: src.message };
2590          }
2591          else if (isBoolean(src)) {
2592              dst = new Boolean(src);
2593          }
2594          else if (isNumber(src)) {
2595              dst = new Number(src);
2596          }
2597          else if (isString(src)) {
2598              dst = new String(src);
2599          }
2600          else if (Object.create && Object.getPrototypeOf) {
2601              dst = Object.create(Object.getPrototypeOf(src));
2602          }
2603          else if (src.constructor === Object) {
2604              dst = {};
2605          }
2606          else {
2607              var proto =
2608                  (src.constructor && src.constructor.prototype)
2609                  || src.__proto__
2610                  || {}
2611              ;
2612              var T = function () {};
2613              T.prototype = proto;
2614              dst = new T;
2615          }
2616          
2617          forEach(objectKeys(src), function (key) {
2618              dst[key] = src[key];
2619          });
2620          return dst;
2621      }
2622      else return src;
2623  }
2624  
2625  var objectKeys = Object.keys || function keys (obj) {
2626      var res = [];
2627      for (var key in obj) res.push(key)
2628      return res;
2629  };
2630  
2631  function toS (obj) { return Object.prototype.toString.call(obj) }
2632  function isDate (obj) { return toS(obj) === '[object Date]' }
2633  function isRegExp (obj) { return toS(obj) === '[object RegExp]' }
2634  function isError (obj) { return toS(obj) === '[object Error]' }
2635  function isBoolean (obj) { return toS(obj) === '[object Boolean]' }
2636  function isNumber (obj) { return toS(obj) === '[object Number]' }
2637  function isString (obj) { return toS(obj) === '[object String]' }
2638  
2639  var isArray = Array.isArray || function isArray (xs) {
2640      return Object.prototype.toString.call(xs) === '[object Array]';
2641  };
2642  
2643  var forEach = function (xs, fn) {
2644      if (xs.forEach) return xs.forEach(fn)
2645      else for (var i = 0; i < xs.length; i++) {
2646          fn(xs[i], i, xs);
2647      }
2648  };
2649  
2650  forEach(objectKeys(Traverse.prototype), function (key) {
2651      traverse[key] = function (obj) {
2652          var args = [].slice.call(arguments, 1);
2653          var t = new Traverse(obj);
2654          return t[key].apply(t, args);
2655      };
2656  });
2657  
2658  var hasOwnProperty = Object.hasOwnProperty || function (obj, key) {
2659      return key in obj;
2660  };
2661  
2662  
2663  /***/ }),
2664  
2665  /***/ 9196:
2666  /***/ (function(module) {
2667  
2668  "use strict";
2669  module.exports = window["React"];
2670  
2671  /***/ })
2672  
2673  /******/     });
2674  /************************************************************************/
2675  /******/     // The module cache
2676  /******/     var __webpack_module_cache__ = {};
2677  /******/     
2678  /******/     // The require function
2679  /******/ 	function __webpack_require__(moduleId) {
2680  /******/         // Check if module is in cache
2681  /******/         var cachedModule = __webpack_module_cache__[moduleId];
2682  /******/         if (cachedModule !== undefined) {
2683  /******/             return cachedModule.exports;
2684  /******/         }
2685  /******/         // Create a new module (and put it into the cache)
2686  /******/         var module = __webpack_module_cache__[moduleId] = {
2687  /******/             // no module.id needed
2688  /******/             // no module.loaded needed
2689  /******/             exports: {}
2690  /******/         };
2691  /******/     
2692  /******/         // Execute the module function
2693  /******/         __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
2694  /******/     
2695  /******/         // Return the exports of the module
2696  /******/         return module.exports;
2697  /******/     }
2698  /******/     
2699  /************************************************************************/
2700  /******/     /* webpack/runtime/compat get default export */
2701  /******/     !function() {
2702  /******/         // getDefaultExport function for compatibility with non-harmony modules
2703  /******/         __webpack_require__.n = function(module) {
2704  /******/             var getter = module && module.__esModule ?
2705  /******/                 function() { return module['default']; } :
2706  /******/                 function() { return module; };
2707  /******/             __webpack_require__.d(getter, { a: getter });
2708  /******/             return getter;
2709  /******/         };
2710  /******/     }();
2711  /******/     
2712  /******/     /* webpack/runtime/define property getters */
2713  /******/     !function() {
2714  /******/         // define getter functions for harmony exports
2715  /******/         __webpack_require__.d = function(exports, definition) {
2716  /******/             for(var key in definition) {
2717  /******/                 if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
2718  /******/                     Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
2719  /******/                 }
2720  /******/             }
2721  /******/         };
2722  /******/     }();
2723  /******/     
2724  /******/     /* webpack/runtime/hasOwnProperty shorthand */
2725  /******/     !function() {
2726  /******/         __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
2727  /******/     }();
2728  /******/     
2729  /******/     /* webpack/runtime/make namespace object */
2730  /******/     !function() {
2731  /******/         // define __esModule on exports
2732  /******/         __webpack_require__.r = function(exports) {
2733  /******/             if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
2734  /******/                 Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2735  /******/             }
2736  /******/             Object.defineProperty(exports, '__esModule', { value: true });
2737  /******/         };
2738  /******/     }();
2739  /******/     
2740  /************************************************************************/
2741  var __webpack_exports__ = {};
2742  // This entry need to be wrapped in an IIFE because it need to be in strict mode.
2743  !function() {
2744  "use strict";
2745  // ESM COMPAT FLAG
2746  __webpack_require__.r(__webpack_exports__);
2747  
2748  // EXPORTS
2749  __webpack_require__.d(__webpack_exports__, {
2750    "AlignmentControl": function() { return /* reexport */ AlignmentControl; },
2751    "AlignmentToolbar": function() { return /* reexport */ AlignmentToolbar; },
2752    "Autocomplete": function() { return /* reexport */ autocomplete; },
2753    "BlockAlignmentControl": function() { return /* reexport */ BlockAlignmentControl; },
2754    "BlockAlignmentToolbar": function() { return /* reexport */ BlockAlignmentToolbar; },
2755    "BlockBreadcrumb": function() { return /* reexport */ block_breadcrumb; },
2756    "BlockColorsStyleSelector": function() { return /* reexport */ color_style_selector; },
2757    "BlockContextProvider": function() { return /* reexport */ BlockContextProvider; },
2758    "BlockControls": function() { return /* reexport */ block_controls; },
2759    "BlockEdit": function() { return /* reexport */ BlockEdit; },
2760    "BlockEditorKeyboardShortcuts": function() { return /* reexport */ keyboard_shortcuts; },
2761    "BlockEditorProvider": function() { return /* reexport */ provider; },
2762    "BlockFormatControls": function() { return /* reexport */ BlockFormatControls; },
2763    "BlockIcon": function() { return /* reexport */ block_icon; },
2764    "BlockInspector": function() { return /* reexport */ block_inspector; },
2765    "BlockList": function() { return /* reexport */ BlockList; },
2766    "BlockMover": function() { return /* reexport */ block_mover; },
2767    "BlockNavigationDropdown": function() { return /* reexport */ dropdown; },
2768    "BlockPreview": function() { return /* reexport */ block_preview; },
2769    "BlockSelectionClearer": function() { return /* reexport */ BlockSelectionClearer; },
2770    "BlockSettingsMenu": function() { return /* reexport */ block_settings_menu; },
2771    "BlockSettingsMenuControls": function() { return /* reexport */ block_settings_menu_controls; },
2772    "BlockStyles": function() { return /* reexport */ block_styles; },
2773    "BlockTitle": function() { return /* reexport */ BlockTitle; },
2774    "BlockToolbar": function() { return /* reexport */ block_toolbar; },
2775    "BlockTools": function() { return /* reexport */ BlockTools; },
2776    "BlockVerticalAlignmentControl": function() { return /* reexport */ BlockVerticalAlignmentControl; },
2777    "BlockVerticalAlignmentToolbar": function() { return /* reexport */ BlockVerticalAlignmentToolbar; },
2778    "ButtonBlockAppender": function() { return /* reexport */ button_block_appender; },
2779    "ButtonBlockerAppender": function() { return /* reexport */ ButtonBlockerAppender; },
2780    "ColorPalette": function() { return /* reexport */ color_palette; },
2781    "ColorPaletteControl": function() { return /* reexport */ ColorPaletteControl; },
2782    "ContrastChecker": function() { return /* reexport */ contrast_checker; },
2783    "CopyHandler": function() { return /* reexport */ copy_handler; },
2784    "DefaultBlockAppender": function() { return /* reexport */ default_block_appender; },
2785    "FontSizePicker": function() { return /* reexport */ font_size_picker; },
2786    "InnerBlocks": function() { return /* reexport */ inner_blocks; },
2787    "Inserter": function() { return /* reexport */ inserter; },
2788    "InspectorAdvancedControls": function() { return /* reexport */ InspectorAdvancedControls; },
2789    "InspectorControls": function() { return /* reexport */ inspector_controls; },
2790    "JustifyContentControl": function() { return /* reexport */ JustifyContentControl; },
2791    "JustifyToolbar": function() { return /* reexport */ JustifyToolbar; },
2792    "LineHeightControl": function() { return /* reexport */ line_height_control; },
2793    "MediaPlaceholder": function() { return /* reexport */ media_placeholder; },
2794    "MediaReplaceFlow": function() { return /* reexport */ media_replace_flow; },
2795    "MediaUpload": function() { return /* reexport */ media_upload; },
2796    "MediaUploadCheck": function() { return /* reexport */ media_upload_check; },
2797    "MultiSelectScrollIntoView": function() { return /* reexport */ MultiSelectScrollIntoView; },
2798    "NavigableToolbar": function() { return /* reexport */ navigable_toolbar; },
2799    "ObserveTyping": function() { return /* reexport */ observe_typing; },
2800    "PanelColorSettings": function() { return /* reexport */ panel_color_settings; },
2801    "PlainText": function() { return /* reexport */ plain_text; },
2802    "RichText": function() { return /* reexport */ rich_text; },
2803    "RichTextShortcut": function() { return /* reexport */ RichTextShortcut; },
2804    "RichTextToolbarButton": function() { return /* reexport */ RichTextToolbarButton; },
2805    "SETTINGS_DEFAULTS": function() { return /* reexport */ SETTINGS_DEFAULTS; },
2806    "SkipToSelectedBlock": function() { return /* reexport */ skip_to_selected_block; },
2807    "ToolSelector": function() { return /* reexport */ tool_selector; },
2808    "Typewriter": function() { return /* reexport */ typewriter; },
2809    "URLInput": function() { return /* reexport */ url_input; },
2810    "URLInputButton": function() { return /* reexport */ url_input_button; },
2811    "URLPopover": function() { return /* reexport */ url_popover; },
2812    "Warning": function() { return /* reexport */ warning; },
2813    "WritingFlow": function() { return /* reexport */ writing_flow; },
2814    "__experimentalBlockAlignmentMatrixControl": function() { return /* reexport */ block_alignment_matrix_control; },
2815    "__experimentalBlockContentOverlay": function() { return /* reexport */ BlockContentOverlay; },
2816    "__experimentalBlockFullHeightAligmentControl": function() { return /* reexport */ block_full_height_alignment_control; },
2817    "__experimentalBlockPatternSetup": function() { return /* reexport */ block_pattern_setup; },
2818    "__experimentalBlockPatternsList": function() { return /* reexport */ block_patterns_list; },
2819    "__experimentalBlockVariationPicker": function() { return /* reexport */ block_variation_picker; },
2820    "__experimentalBlockVariationTransforms": function() { return /* reexport */ block_variation_transforms; },
2821    "__experimentalBorderRadiusControl": function() { return /* reexport */ BorderRadiusControl; },
2822    "__experimentalBorderStyleControl": function() { return /* reexport */ BorderStyleControl; },
2823    "__experimentalColorGradientControl": function() { return /* reexport */ control; },
2824    "__experimentalColorGradientSettingsDropdown": function() { return /* reexport */ ColorGradientSettingsDropdown; },
2825    "__experimentalDateFormatPicker": function() { return /* reexport */ DateFormatPicker; },
2826    "__experimentalDuotoneControl": function() { return /* reexport */ duotone_control; },
2827    "__experimentalFontAppearanceControl": function() { return /* reexport */ FontAppearanceControl; },
2828    "__experimentalFontFamilyControl": function() { return /* reexport */ FontFamilyControl; },
2829    "__experimentalGetBorderClassesAndStyles": function() { return /* reexport */ getBorderClassesAndStyles; },
2830    "__experimentalGetColorClassesAndStyles": function() { return /* reexport */ getColorClassesAndStyles; },
2831    "__experimentalGetGradientClass": function() { return /* reexport */ __experimentalGetGradientClass; },
2832    "__experimentalGetGradientObjectByGradientValue": function() { return /* reexport */ __experimentalGetGradientObjectByGradientValue; },
2833    "__experimentalGetMatchingVariation": function() { return /* reexport */ __experimentalGetMatchingVariation; },
2834    "__experimentalGetSpacingClassesAndStyles": function() { return /* reexport */ getSpacingClassesAndStyles; },
2835    "__experimentalImageEditingProvider": function() { return /* reexport */ ImageEditingProvider; },
2836    "__experimentalImageEditor": function() { return /* reexport */ ImageEditor; },
2837    "__experimentalImageSizeControl": function() { return /* reexport */ ImageSizeControl; },
2838    "__experimentalImageURLInputUI": function() { return /* reexport */ ImageURLInputUI; },
2839    "__experimentalLayoutStyle": function() { return /* reexport */ LayoutStyle; },
2840    "__experimentalLetterSpacingControl": function() { return /* reexport */ LetterSpacingControl; },
2841    "__experimentalLibrary": function() { return /* reexport */ library; },
2842    "__experimentalLinkControl": function() { return /* reexport */ link_control; },
2843    "__experimentalLinkControlSearchInput": function() { return /* reexport */ search_input; },
2844    "__experimentalLinkControlSearchItem": function() { return /* reexport */ search_item; },
2845    "__experimentalLinkControlSearchResults": function() { return /* reexport */ LinkControlSearchResults; },
2846    "__experimentalListView": function() { return /* reexport */ components_list_view; },
2847    "__experimentalPanelColorGradientSettings": function() { return /* reexport */ panel_color_gradient_settings; },
2848    "__experimentalPreviewOptions": function() { return /* reexport */ PreviewOptions; },
2849    "__experimentalResponsiveBlockControl": function() { return /* reexport */ responsive_block_control; },
2850    "__experimentalTextDecorationControl": function() { return /* reexport */ TextDecorationControl; },
2851    "__experimentalTextTransformControl": function() { return /* reexport */ TextTransformControl; },
2852    "__experimentalToolsPanelColorDropdown": function() { return /* reexport */ ToolsPanelColorDropdown; },
2853    "__experimentalUnitControl": function() { return /* reexport */ UnitControl; },
2854    "__experimentalUseBlockPreview": function() { return /* reexport */ useBlockPreview; },
2855    "__experimentalUseBorderProps": function() { return /* reexport */ useBorderProps; },
2856    "__experimentalUseColorProps": function() { return /* reexport */ useColorProps; },
2857    "__experimentalUseCustomSides": function() { return /* reexport */ useCustomSides; },
2858    "__experimentalUseGradient": function() { return /* reexport */ __experimentalUseGradient; },
2859    "__experimentalUseNoRecursiveRenders": function() { return /* reexport */ useNoRecursiveRenders; },
2860    "__experimentalUseResizeCanvas": function() { return /* reexport */ useResizeCanvas; },
2861    "__unstableBlockNameContext": function() { return /* reexport */ block_name_context; },
2862    "__unstableBlockSettingsMenuFirstItem": function() { return /* reexport */ block_settings_menu_first_item; },
2863    "__unstableBlockToolbarLastItem": function() { return /* reexport */ block_toolbar_last_item; },
2864    "__unstableEditorStyles": function() { return /* reexport */ EditorStyles; },
2865    "__unstableIframe": function() { return /* reexport */ iframe; },
2866    "__unstableInserterMenuExtension": function() { return /* reexport */ inserter_menu_extension; },
2867    "__unstablePresetDuotoneFilter": function() { return /* reexport */ PresetDuotoneFilter; },
2868    "__unstableRichTextInputEvent": function() { return /* reexport */ __unstableRichTextInputEvent; },
2869    "__unstableUseBlockSelectionClearer": function() { return /* reexport */ useBlockSelectionClearer; },
2870    "__unstableUseClipboardHandler": function() { return /* reexport */ useClipboardHandler; },
2871    "__unstableUseMouseMoveTypingReset": function() { return /* reexport */ useMouseMoveTypingReset; },
2872    "__unstableUseTypewriter": function() { return /* reexport */ useTypewriter; },
2873    "__unstableUseTypingObserver": function() { return /* reexport */ useTypingObserver; },
2874    "createCustomColorsHOC": function() { return /* reexport */ createCustomColorsHOC; },
2875    "getColorClassName": function() { return /* reexport */ getColorClassName; },
2876    "getColorObjectByAttributeValues": function() { return /* reexport */ getColorObjectByAttributeValues; },
2877    "getColorObjectByColorValue": function() { return /* reexport */ getColorObjectByColorValue; },
2878    "getFontSize": function() { return /* reexport */ getFontSize; },
2879    "getFontSizeClass": function() { return /* reexport */ getFontSizeClass; },
2880    "getFontSizeObjectByValue": function() { return /* reexport */ getFontSizeObjectByValue; },
2881    "getGradientSlugByValue": function() { return /* reexport */ getGradientSlugByValue; },
2882    "getGradientValueBySlug": function() { return /* reexport */ getGradientValueBySlug; },
2883    "getPxFromCssUnit": function() { return /* reexport */ parse_css_unit_to_px; },
2884    "store": function() { return /* reexport */ store; },
2885    "storeConfig": function() { return /* reexport */ storeConfig; },
2886    "transformStyles": function() { return /* reexport */ transform_styles; },
2887    "useBlockDisplayInformation": function() { return /* reexport */ useBlockDisplayInformation; },
2888    "useBlockEditContext": function() { return /* reexport */ useBlockEditContext; },
2889    "useBlockProps": function() { return /* reexport */ useBlockProps; },
2890    "useCachedTruthy": function() { return /* reexport */ useCachedTruthy; },
2891    "useInnerBlocksProps": function() { return /* reexport */ useInnerBlocksProps; },
2892    "useSetting": function() { return /* reexport */ useSetting; },
2893    "withColorContext": function() { return /* reexport */ with_color_context; },
2894    "withColors": function() { return /* reexport */ withColors; },
2895    "withFontSizes": function() { return /* reexport */ with_font_sizes; }
2896  });
2897  
2898  // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/selectors.js
2899  var selectors_namespaceObject = {};
2900  __webpack_require__.r(selectors_namespaceObject);
2901  __webpack_require__.d(selectors_namespaceObject, {
2902    "__experimentalGetActiveBlockIdByBlockNames": function() { return __experimentalGetActiveBlockIdByBlockNames; },
2903    "__experimentalGetAllowedBlocks": function() { return __experimentalGetAllowedBlocks; },
2904    "__experimentalGetAllowedPatterns": function() { return __experimentalGetAllowedPatterns; },
2905    "__experimentalGetBlockListSettingsForBlocks": function() { return __experimentalGetBlockListSettingsForBlocks; },
2906    "__experimentalGetDirectInsertBlock": function() { return __experimentalGetDirectInsertBlock; },
2907    "__experimentalGetGlobalBlocksByName": function() { return __experimentalGetGlobalBlocksByName; },
2908    "__experimentalGetLastBlockAttributeChanges": function() { return __experimentalGetLastBlockAttributeChanges; },
2909    "__experimentalGetParsedPattern": function() { return __experimentalGetParsedPattern; },
2910    "__experimentalGetPatternTransformItems": function() { return __experimentalGetPatternTransformItems; },
2911    "__experimentalGetPatternsByBlockTypes": function() { return __experimentalGetPatternsByBlockTypes; },
2912    "__experimentalGetReusableBlockTitle": function() { return __experimentalGetReusableBlockTitle; },
2913    "__unstableGetBlockWithoutInnerBlocks": function() { return __unstableGetBlockWithoutInnerBlocks; },
2914    "__unstableGetClientIdWithClientIdsTree": function() { return __unstableGetClientIdWithClientIdsTree; },
2915    "__unstableGetClientIdsTree": function() { return __unstableGetClientIdsTree; },
2916    "__unstableGetSelectedBlocksWithPartialSelection": function() { return __unstableGetSelectedBlocksWithPartialSelection; },
2917    "__unstableIsFullySelected": function() { return __unstableIsFullySelected; },
2918    "__unstableIsLastBlockChangeIgnored": function() { return __unstableIsLastBlockChangeIgnored; },
2919    "__unstableIsSelectionCollapsed": function() { return __unstableIsSelectionCollapsed; },
2920    "__unstableIsSelectionMergeable": function() { return __unstableIsSelectionMergeable; },
2921    "areInnerBlocksControlled": function() { return areInnerBlocksControlled; },
2922    "canInsertBlockType": function() { return canInsertBlockType; },
2923    "canInsertBlocks": function() { return canInsertBlocks; },
2924    "canLockBlockType": function() { return canLockBlockType; },
2925    "canMoveBlock": function() { return canMoveBlock; },
2926    "canMoveBlocks": function() { return canMoveBlocks; },
2927    "canRemoveBlock": function() { return canRemoveBlock; },
2928    "canRemoveBlocks": function() { return canRemoveBlocks; },
2929    "didAutomaticChange": function() { return didAutomaticChange; },
2930    "getAdjacentBlockClientId": function() { return getAdjacentBlockClientId; },
2931    "getBlock": function() { return getBlock; },
2932    "getBlockAttributes": function() { return getBlockAttributes; },
2933    "getBlockCount": function() { return getBlockCount; },
2934    "getBlockHierarchyRootClientId": function() { return getBlockHierarchyRootClientId; },
2935    "getBlockIndex": function() { return getBlockIndex; },
2936    "getBlockInsertionPoint": function() { return getBlockInsertionPoint; },
2937    "getBlockListSettings": function() { return getBlockListSettings; },
2938    "getBlockMode": function() { return getBlockMode; },
2939    "getBlockName": function() { return getBlockName; },
2940    "getBlockOrder": function() { return getBlockOrder; },
2941    "getBlockParents": function() { return getBlockParents; },
2942    "getBlockParentsByBlockName": function() { return getBlockParentsByBlockName; },
2943    "getBlockRootClientId": function() { return getBlockRootClientId; },
2944    "getBlockSelectionEnd": function() { return getBlockSelectionEnd; },
2945    "getBlockSelectionStart": function() { return getBlockSelectionStart; },
2946    "getBlockTransformItems": function() { return getBlockTransformItems; },
2947    "getBlocks": function() { return getBlocks; },
2948    "getBlocksByClientId": function() { return getBlocksByClientId; },
2949    "getClientIdsOfDescendants": function() { return getClientIdsOfDescendants; },
2950    "getClientIdsWithDescendants": function() { return getClientIdsWithDescendants; },
2951    "getDraggedBlockClientIds": function() { return getDraggedBlockClientIds; },
2952    "getFirstMultiSelectedBlockClientId": function() { return getFirstMultiSelectedBlockClientId; },
2953    "getGlobalBlockCount": function() { return getGlobalBlockCount; },
2954    "getInserterItems": function() { return getInserterItems; },
2955    "getLastMultiSelectedBlockClientId": function() { return getLastMultiSelectedBlockClientId; },
2956    "getLowestCommonAncestorWithSelectedBlock": function() { return getLowestCommonAncestorWithSelectedBlock; },
2957    "getMultiSelectedBlockClientIds": function() { return getMultiSelectedBlockClientIds; },
2958    "getMultiSelectedBlocks": function() { return getMultiSelectedBlocks; },
2959    "getMultiSelectedBlocksEndClientId": function() { return getMultiSelectedBlocksEndClientId; },
2960    "getMultiSelectedBlocksStartClientId": function() { return getMultiSelectedBlocksStartClientId; },
2961    "getNextBlockClientId": function() { return getNextBlockClientId; },
2962    "getPreviousBlockClientId": function() { return getPreviousBlockClientId; },
2963    "getSelectedBlock": function() { return getSelectedBlock; },
2964    "getSelectedBlockClientId": function() { return getSelectedBlockClientId; },
2965    "getSelectedBlockClientIds": function() { return getSelectedBlockClientIds; },
2966    "getSelectedBlockCount": function() { return getSelectedBlockCount; },
2967    "getSelectedBlocksInitialCaretPosition": function() { return getSelectedBlocksInitialCaretPosition; },
2968    "getSelectionEnd": function() { return getSelectionEnd; },
2969    "getSelectionStart": function() { return getSelectionStart; },
2970    "getSettings": function() { return getSettings; },
2971    "getTemplate": function() { return getTemplate; },
2972    "getTemplateLock": function() { return getTemplateLock; },
2973    "hasBlockMovingClientId": function() { return selectors_hasBlockMovingClientId; },
2974    "hasInserterItems": function() { return hasInserterItems; },
2975    "hasMultiSelection": function() { return hasMultiSelection; },
2976    "hasSelectedBlock": function() { return hasSelectedBlock; },
2977    "hasSelectedInnerBlock": function() { return hasSelectedInnerBlock; },
2978    "isAncestorBeingDragged": function() { return isAncestorBeingDragged; },
2979    "isAncestorMultiSelected": function() { return isAncestorMultiSelected; },
2980    "isBlockBeingDragged": function() { return isBlockBeingDragged; },
2981    "isBlockHighlighted": function() { return isBlockHighlighted; },
2982    "isBlockInsertionPointVisible": function() { return isBlockInsertionPointVisible; },
2983    "isBlockMultiSelected": function() { return isBlockMultiSelected; },
2984    "isBlockSelected": function() { return isBlockSelected; },
2985    "isBlockValid": function() { return isBlockValid; },
2986    "isBlockWithinSelection": function() { return isBlockWithinSelection; },
2987    "isCaretWithinFormattedText": function() { return selectors_isCaretWithinFormattedText; },
2988    "isDraggingBlocks": function() { return isDraggingBlocks; },
2989    "isFirstMultiSelectedBlock": function() { return isFirstMultiSelectedBlock; },
2990    "isLastBlockChangePersistent": function() { return isLastBlockChangePersistent; },
2991    "isMultiSelecting": function() { return selectors_isMultiSelecting; },
2992    "isNavigationMode": function() { return selectors_isNavigationMode; },
2993    "isSelectionEnabled": function() { return selectors_isSelectionEnabled; },
2994    "isTyping": function() { return selectors_isTyping; },
2995    "isValidTemplate": function() { return isValidTemplate; },
2996    "wasBlockJustInserted": function() { return wasBlockJustInserted; }
2997  });
2998  
2999  // NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/actions.js
3000  var actions_namespaceObject = {};
3001  __webpack_require__.r(actions_namespaceObject);
3002  __webpack_require__.d(actions_namespaceObject, {
3003    "__unstableDeleteSelection": function() { return __unstableDeleteSelection; },
3004    "__unstableExpandSelection": function() { return __unstableExpandSelection; },
3005    "__unstableMarkAutomaticChange": function() { return __unstableMarkAutomaticChange; },
3006    "__unstableMarkLastChangeAsPersistent": function() { return __unstableMarkLastChangeAsPersistent; },
3007    "__unstableMarkNextChangeAsNotPersistent": function() { return __unstableMarkNextChangeAsNotPersistent; },
3008    "__unstableSaveReusableBlock": function() { return __unstableSaveReusableBlock; },
3009    "__unstableSplitSelection": function() { return __unstableSplitSelection; },
3010    "clearSelectedBlock": function() { return clearSelectedBlock; },
3011    "duplicateBlocks": function() { return duplicateBlocks; },
3012    "enterFormattedText": function() { return enterFormattedText; },
3013    "exitFormattedText": function() { return exitFormattedText; },
3014    "flashBlock": function() { return flashBlock; },
3015    "hideInsertionPoint": function() { return hideInsertionPoint; },
3016    "insertAfterBlock": function() { return insertAfterBlock; },
3017    "insertBeforeBlock": function() { return insertBeforeBlock; },
3018    "insertBlock": function() { return insertBlock; },
3019    "insertBlocks": function() { return insertBlocks; },
3020    "insertDefaultBlock": function() { return insertDefaultBlock; },
3021    "mergeBlocks": function() { return mergeBlocks; },
3022    "moveBlockToPosition": function() { return moveBlockToPosition; },
3023    "moveBlocksDown": function() { return moveBlocksDown; },
3024    "moveBlocksToPosition": function() { return moveBlocksToPosition; },
3025    "moveBlocksUp": function() { return moveBlocksUp; },
3026    "multiSelect": function() { return multiSelect; },
3027    "receiveBlocks": function() { return receiveBlocks; },
3028    "removeBlock": function() { return removeBlock; },
3029    "removeBlocks": function() { return removeBlocks; },
3030    "replaceBlock": function() { return replaceBlock; },
3031    "replaceBlocks": function() { return replaceBlocks; },
3032    "replaceInnerBlocks": function() { return replaceInnerBlocks; },
3033    "resetBlocks": function() { return resetBlocks; },
3034    "resetSelection": function() { return resetSelection; },
3035    "selectBlock": function() { return selectBlock; },
3036    "selectNextBlock": function() { return selectNextBlock; },
3037    "selectPreviousBlock": function() { return selectPreviousBlock; },
3038    "selectionChange": function() { return selectionChange; },
3039    "setBlockMovingClientId": function() { return setBlockMovingClientId; },
3040    "setHasControlledInnerBlocks": function() { return setHasControlledInnerBlocks; },
3041    "setNavigationMode": function() { return setNavigationMode; },
3042    "setTemplateValidity": function() { return setTemplateValidity; },
3043    "showInsertionPoint": function() { return showInsertionPoint; },
3044    "startDraggingBlocks": function() { return startDraggingBlocks; },
3045    "startMultiSelect": function() { return startMultiSelect; },
3046    "startTyping": function() { return startTyping; },
3047    "stopDraggingBlocks": function() { return stopDraggingBlocks; },
3048    "stopMultiSelect": function() { return stopMultiSelect; },
3049    "stopTyping": function() { return stopTyping; },
3050    "synchronizeTemplate": function() { return synchronizeTemplate; },
3051    "toggleBlockHighlight": function() { return toggleBlockHighlight; },
3052    "toggleBlockMode": function() { return toggleBlockMode; },
3053    "toggleSelection": function() { return toggleSelection; },
3054    "updateBlock": function() { return updateBlock; },
3055    "updateBlockAttributes": function() { return updateBlockAttributes; },
3056    "updateBlockListSettings": function() { return updateBlockListSettings; },
3057    "updateSettings": function() { return updateSettings; },
3058    "validateBlocksToTemplate": function() { return validateBlocksToTemplate; }
3059  });
3060  
3061  ;// CONCATENATED MODULE: external ["wp","blocks"]
3062  var external_wp_blocks_namespaceObject = window["wp"]["blocks"];
3063  ;// CONCATENATED MODULE: external ["wp","hooks"]
3064  var external_wp_hooks_namespaceObject = window["wp"]["hooks"];
3065  ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/compat.js
3066  /**
3067   * WordPress dependencies
3068   */
3069  
3070  
3071  
3072  function migrateLightBlockWrapper(settings) {
3073    const {
3074      apiVersion = 1
3075    } = settings;
3076  
3077    if (apiVersion < 2 && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'lightBlockWrapper', false)) {
3078      settings.apiVersion = 2;
3079    }
3080  
3081    return settings;
3082  }
3083  
3084  (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/compat/migrateLightBlockWrapper', migrateLightBlockWrapper);
3085  
3086  ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
3087  function _extends() {
3088    _extends = Object.assign || function (target) {
3089      for (var i = 1; i < arguments.length; i++) {
3090        var source = arguments[i];
3091  
3092        for (var key in source) {
3093          if (Object.prototype.hasOwnProperty.call(source, key)) {
3094            target[key] = source[key];
3095          }
3096        }
3097      }
3098  
3099      return target;
3100    };
3101  
3102    return _extends.apply(this, arguments);
3103  }
3104  ;// CONCATENATED MODULE: external ["wp","element"]
3105  var external_wp_element_namespaceObject = window["wp"]["element"];
3106  // EXTERNAL MODULE: ./node_modules/classnames/index.js
3107  var classnames = __webpack_require__(4403);
3108  var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
3109  ;// CONCATENATED MODULE: external "lodash"
3110  var external_lodash_namespaceObject = window["lodash"];
3111  ;// CONCATENATED MODULE: external ["wp","compose"]
3112  var external_wp_compose_namespaceObject = window["wp"]["compose"];
3113  ;// CONCATENATED MODULE: external ["wp","components"]
3114  var external_wp_components_namespaceObject = window["wp"]["components"];
3115  ;// CONCATENATED MODULE: external ["wp","data"]
3116  var external_wp_data_namespaceObject = window["wp"]["data"];
3117  ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/groups.js
3118  /**
3119   * WordPress dependencies
3120   */
3121  
3122  const BlockControlsDefault = (0,external_wp_components_namespaceObject.createSlotFill)('BlockControls');
3123  const BlockControlsBlock = (0,external_wp_components_namespaceObject.createSlotFill)('BlockControlsBlock');
3124  const BlockControlsInline = (0,external_wp_components_namespaceObject.createSlotFill)('BlockFormatControls');
3125  const BlockControlsOther = (0,external_wp_components_namespaceObject.createSlotFill)('BlockControlsOther');
3126  const BlockControlsParent = (0,external_wp_components_namespaceObject.createSlotFill)('BlockControlsParent');
3127  const groups = {
3128    default: BlockControlsDefault,
3129    block: BlockControlsBlock,
3130    inline: BlockControlsInline,
3131    other: BlockControlsOther,
3132    parent: BlockControlsParent
3133  };
3134  /* harmony default export */ var block_controls_groups = (groups);
3135  
3136  ;// CONCATENATED MODULE: external ["wp","i18n"]
3137  var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
3138  ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/defaults.js
3139  /**
3140   * WordPress dependencies
3141   */
3142  
3143  const PREFERENCES_DEFAULTS = {
3144    insertUsage: {}
3145  };
3146  /**
3147   * The default editor settings
3148   *
3149   * @typedef {Object} SETTINGS_DEFAULT
3150   * @property {boolean}       alignWide                              Enable/Disable Wide/Full Alignments
3151   * @property {boolean}       supportsLayout                         Enable/disable layouts support in container blocks.
3152   * @property {boolean}       imageEditing                           Image Editing settings set to false to disable.
3153   * @property {Array}         imageSizes                             Available image sizes
3154   * @property {number}        maxWidth                               Max width to constraint resizing
3155   * @property {boolean|Array} allowedBlockTypes                      Allowed block types
3156   * @property {boolean}       hasFixedToolbar                        Whether or not the editor toolbar is fixed
3157   * @property {boolean}       focusMode                              Whether the focus mode is enabled or not
3158   * @property {Array}         styles                                 Editor Styles
3159   * @property {boolean}       keepCaretInsideBlock                   Whether caret should move between blocks in edit mode
3160   * @property {string}        bodyPlaceholder                        Empty post placeholder
3161   * @property {string}        titlePlaceholder                       Empty title placeholder
3162   * @property {boolean}       canLockBlocks                          Whether the user can manage Block Lock state
3163   * @property {boolean}       codeEditingEnabled                     Whether or not the user can switch to the code editor
3164   * @property {boolean}       generateAnchors                        Enable/Disable auto anchor generation for Heading blocks
3165   * @property {boolean}       __experimentalCanUserUseUnfilteredHTML Whether the user should be able to use unfiltered HTML or the HTML should be filtered e.g., to remove elements considered insecure like iframes.
3166   * @property {boolean}       __experimentalBlockDirectory           Whether the user has enabled the Block Directory
3167   * @property {Array}         __experimentalBlockPatterns            Array of objects representing the block patterns
3168   * @property {Array}         __experimentalBlockPatternCategories   Array of objects representing the block pattern categories
3169   * @property {boolean}       __unstableGalleryWithImageBlocks       Whether the user has enabled the refactored gallery block which uses InnerBlocks
3170   */
3171  
3172  const SETTINGS_DEFAULTS = {
3173    alignWide: false,
3174    supportsLayout: true,
3175    // colors setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.
3176    // The setting is only kept for backward compatibility purposes.
3177    colors: [{
3178      name: (0,external_wp_i18n_namespaceObject.__)('Black'),
3179      slug: 'black',
3180      color: '#000000'
3181    }, {
3182      name: (0,external_wp_i18n_namespaceObject.__)('Cyan bluish gray'),
3183      slug: 'cyan-bluish-gray',
3184      color: '#abb8c3'
3185    }, {
3186      name: (0,external_wp_i18n_namespaceObject.__)('White'),
3187      slug: 'white',
3188      color: '#ffffff'
3189    }, {
3190      name: (0,external_wp_i18n_namespaceObject.__)('Pale pink'),
3191      slug: 'pale-pink',
3192      color: '#f78da7'
3193    }, {
3194      name: (0,external_wp_i18n_namespaceObject.__)('Vivid red'),
3195      slug: 'vivid-red',
3196      color: '#cf2e2e'
3197    }, {
3198      name: (0,external_wp_i18n_namespaceObject.__)('Luminous vivid orange'),
3199      slug: 'luminous-vivid-orange',
3200      color: '#ff6900'
3201    }, {
3202      name: (0,external_wp_i18n_namespaceObject.__)('Luminous vivid amber'),
3203      slug: 'luminous-vivid-amber',
3204      color: '#fcb900'
3205    }, {
3206      name: (0,external_wp_i18n_namespaceObject.__)('Light green cyan'),
3207      slug: 'light-green-cyan',
3208      color: '#7bdcb5'
3209    }, {
3210      name: (0,external_wp_i18n_namespaceObject.__)('Vivid green cyan'),
3211      slug: 'vivid-green-cyan',
3212      color: '#00d084'
3213    }, {
3214      name: (0,external_wp_i18n_namespaceObject.__)('Pale cyan blue'),
3215      slug: 'pale-cyan-blue',
3216      color: '#8ed1fc'
3217    }, {
3218      name: (0,external_wp_i18n_namespaceObject.__)('Vivid cyan blue'),
3219      slug: 'vivid-cyan-blue',
3220      color: '#0693e3'
3221    }, {
3222      name: (0,external_wp_i18n_namespaceObject.__)('Vivid purple'),
3223      slug: 'vivid-purple',
3224      color: '#9b51e0'
3225    }],
3226    // fontSizes setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.
3227    // The setting is only kept for backward compatibility purposes.
3228    fontSizes: [{
3229      name: (0,external_wp_i18n_namespaceObject._x)('Small', 'font size name'),
3230      size: 13,
3231      slug: 'small'
3232    }, {
3233      name: (0,external_wp_i18n_namespaceObject._x)('Normal', 'font size name'),
3234      size: 16,
3235      slug: 'normal'
3236    }, {
3237      name: (0,external_wp_i18n_namespaceObject._x)('Medium', 'font size name'),
3238      size: 20,
3239      slug: 'medium'
3240    }, {
3241      name: (0,external_wp_i18n_namespaceObject._x)('Large', 'font size name'),
3242      size: 36,
3243      slug: 'large'
3244    }, {
3245      name: (0,external_wp_i18n_namespaceObject._x)('Huge', 'font size name'),
3246      size: 42,
3247      slug: 'huge'
3248    }],
3249    // Image default size slug.
3250    imageDefaultSize: 'large',
3251    imageSizes: [{
3252      slug: 'thumbnail',
3253      name: (0,external_wp_i18n_namespaceObject.__)('Thumbnail')
3254    }, {
3255      slug: 'medium',
3256      name: (0,external_wp_i18n_namespaceObject.__)('Medium')
3257    }, {
3258      slug: 'large',
3259      name: (0,external_wp_i18n_namespaceObject.__)('Large')
3260    }, {
3261      slug: 'full',
3262      name: (0,external_wp_i18n_namespaceObject.__)('Full Size')
3263    }],
3264    // Allow plugin to disable Image Editor if need be.
3265    imageEditing: true,
3266    // This is current max width of the block inner area
3267    // It's used to constraint image resizing and this value could be overridden later by themes
3268    maxWidth: 580,
3269    // Allowed block types for the editor, defaulting to true (all supported).
3270    allowedBlockTypes: true,
3271    // Maximum upload size in bytes allowed for the site.
3272    maxUploadFileSize: 0,
3273    // List of allowed mime types and file extensions.
3274    allowedMimeTypes: null,
3275    // Allows to disable block locking interface.
3276    canLockBlocks: true,
3277    __experimentalCanUserUseUnfilteredHTML: false,
3278    __experimentalBlockDirectory: false,
3279    __mobileEnablePageTemplates: false,
3280    __experimentalBlockPatterns: [],
3281    __experimentalBlockPatternCategories: [],
3282    __experimentalSpotlightEntityBlocks: [],
3283    __unstableGalleryWithImageBlocks: false,
3284    generateAnchors: false,
3285    // gradients setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.
3286    // The setting is only kept for backward compatibility purposes.
3287    gradients: [{
3288      name: (0,external_wp_i18n_namespaceObject.__)('Vivid cyan blue to vivid purple'),
3289      gradient: 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
3290      slug: 'vivid-cyan-blue-to-vivid-purple'
3291    }, {
3292      name: (0,external_wp_i18n_namespaceObject.__)('Light green cyan to vivid green cyan'),
3293      gradient: 'linear-gradient(135deg,rgb(122,220,180) 0%,rgb(0,208,130) 100%)',
3294      slug: 'light-green-cyan-to-vivid-green-cyan'
3295    }, {
3296      name: (0,external_wp_i18n_namespaceObject.__)('Luminous vivid amber to luminous vivid orange'),
3297      gradient: 'linear-gradient(135deg,rgba(252,185,0,1) 0%,rgba(255,105,0,1) 100%)',
3298      slug: 'luminous-vivid-amber-to-luminous-vivid-orange'
3299    }, {
3300      name: (0,external_wp_i18n_namespaceObject.__)('Luminous vivid orange to vivid red'),
3301      gradient: 'linear-gradient(135deg,rgba(255,105,0,1) 0%,rgb(207,46,46) 100%)',
3302      slug: 'luminous-vivid-orange-to-vivid-red'
3303    }, {
3304      name: (0,external_wp_i18n_namespaceObject.__)('Very light gray to cyan bluish gray'),
3305      gradient: 'linear-gradient(135deg,rgb(238,238,238) 0%,rgb(169,184,195) 100%)',
3306      slug: 'very-light-gray-to-cyan-bluish-gray'
3307    }, {
3308      name: (0,external_wp_i18n_namespaceObject.__)('Cool to warm spectrum'),
3309      gradient: 'linear-gradient(135deg,rgb(74,234,220) 0%,rgb(151,120,209) 20%,rgb(207,42,186) 40%,rgb(238,44,130) 60%,rgb(251,105,98) 80%,rgb(254,248,76) 100%)',
3310      slug: 'cool-to-warm-spectrum'
3311    }, {
3312      name: (0,external_wp_i18n_namespaceObject.__)('Blush light purple'),
3313      gradient: 'linear-gradient(135deg,rgb(255,206,236) 0%,rgb(152,150,240) 100%)',
3314      slug: 'blush-light-purple'
3315    }, {
3316      name: (0,external_wp_i18n_namespaceObject.__)('Blush bordeaux'),
3317      gradient: 'linear-gradient(135deg,rgb(254,205,165) 0%,rgb(254,45,45) 50%,rgb(107,0,62) 100%)',
3318      slug: 'blush-bordeaux'
3319    }, {
3320      name: (0,external_wp_i18n_namespaceObject.__)('Luminous dusk'),
3321      gradient: 'linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%)',
3322      slug: 'luminous-dusk'
3323    }, {
3324      name: (0,external_wp_i18n_namespaceObject.__)('Pale ocean'),
3325      gradient: 'linear-gradient(135deg,rgb(255,245,203) 0%,rgb(182,227,212) 50%,rgb(51,167,181) 100%)',
3326      slug: 'pale-ocean'
3327    }, {
3328      name: (0,external_wp_i18n_namespaceObject.__)('Electric grass'),
3329      gradient: 'linear-gradient(135deg,rgb(202,248,128) 0%,rgb(113,206,126) 100%)',
3330      slug: 'electric-grass'
3331    }, {
3332      name: (0,external_wp_i18n_namespaceObject.__)('Midnight'),
3333      gradient: 'linear-gradient(135deg,rgb(2,3,129) 0%,rgb(40,116,252) 100%)',
3334      slug: 'midnight'
3335    }],
3336    __unstableResolvedAssets: {
3337      styles: [],
3338      scripts: []
3339    }
3340  };
3341  
3342  ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/array.js
3343  /**
3344   * External dependencies
3345   */
3346  
3347  /**
3348   * Insert one or multiple elements into a given position of an array.
3349   *
3350   * @param {Array}  array    Source array.
3351   * @param {*}      elements Elements to insert.
3352   * @param {number} index    Insert Position.
3353   *
3354   * @return {Array} Result.
3355   */
3356  
3357  function insertAt(array, elements, index) {
3358    return [...array.slice(0, index), ...(0,external_lodash_namespaceObject.castArray)(elements), ...array.slice(index)];
3359  }
3360  /**
3361   * Moves an element in an array.
3362   *
3363   * @param {Array}  array Source array.
3364   * @param {number} from  Source index.
3365   * @param {number} to    Destination index.
3366   * @param {number} count Number of elements to move.
3367   *
3368   * @return {Array} Result.
3369   */
3370  
3371  function moveTo(array, from, to) {
3372    let count = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
3373    const withoutMovedElements = [...array];
3374    withoutMovedElements.splice(from, count);
3375    return insertAt(withoutMovedElements, array.slice(from, from + count), to);
3376  }
3377  
3378  ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/reducer.js
3379  /**
3380   * External dependencies
3381   */
3382  
3383  /**
3384   * WordPress dependencies
3385   */
3386  
3387  
3388  
3389  /**
3390   * Internal dependencies
3391   */
3392  
3393  
3394  
3395  /**
3396   * Given an array of blocks, returns an object where each key is a nesting
3397   * context, the value of which is an array of block client IDs existing within
3398   * that nesting context.
3399   *
3400   * @param {Array}   blocks       Blocks to map.
3401   * @param {?string} rootClientId Assumed root client ID.
3402   *
3403   * @return {Object} Block order map object.
3404   */
3405  
3406  function mapBlockOrder(blocks) {
3407    let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
3408    const result = {
3409      [rootClientId]: []
3410    };
3411    blocks.forEach(block => {
3412      const {
3413        clientId,
3414        innerBlocks
3415      } = block;
3416      result[rootClientId].push(clientId);
3417      Object.assign(result, mapBlockOrder(innerBlocks, clientId));
3418    });
3419    return result;
3420  }
3421  /**
3422   * Given an array of blocks, returns an object where each key contains
3423   * the clientId of the block and the value is the parent of the block.
3424   *
3425   * @param {Array}   blocks       Blocks to map.
3426   * @param {?string} rootClientId Assumed root client ID.
3427   *
3428   * @return {Object} Block order map object.
3429   */
3430  
3431  
3432  function mapBlockParents(blocks) {
3433    let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
3434    return blocks.reduce((result, block) => Object.assign(result, {
3435      [block.clientId]: rootClientId
3436    }, mapBlockParents(block.innerBlocks, block.clientId)), {});
3437  }
3438  /**
3439   * Helper method to iterate through all blocks, recursing into inner blocks,
3440   * applying a transformation function to each one.
3441   * Returns a flattened object with the transformed blocks.
3442   *
3443   * @param {Array}    blocks    Blocks to flatten.
3444   * @param {Function} transform Transforming function to be applied to each block.
3445   *
3446   * @return {Object} Flattened object.
3447   */
3448  
3449  
3450  function flattenBlocks(blocks) {
3451    let transform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : external_lodash_namespaceObject.identity;
3452    const result = {};
3453    const stack = [...blocks];
3454  
3455    while (stack.length) {
3456      const {
3457        innerBlocks,
3458        ...block
3459      } = stack.shift();
3460      stack.push(...innerBlocks);
3461      result[block.clientId] = transform(block);
3462    }
3463  
3464    return result;
3465  }
3466  /**
3467   * Given an array of blocks, returns an object containing all blocks, without
3468   * attributes, recursing into inner blocks. Keys correspond to the block client
3469   * ID, the value of which is the attributes object.
3470   *
3471   * @param {Array} blocks Blocks to flatten.
3472   *
3473   * @return {Object} Flattened block attributes object.
3474   */
3475  
3476  
3477  function getFlattenedBlocksWithoutAttributes(blocks) {
3478    return flattenBlocks(blocks, block => (0,external_lodash_namespaceObject.omit)(block, 'attributes'));
3479  }
3480  /**
3481   * Given an array of blocks, returns an object containing all block attributes,
3482   * recursing into inner blocks. Keys correspond to the block client ID, the
3483   * value of which is the attributes object.
3484   *
3485   * @param {Array} blocks Blocks to flatten.
3486   *
3487   * @return {Object} Flattened block attributes object.
3488   */
3489  
3490  
3491  function getFlattenedBlockAttributes(blocks) {
3492    return flattenBlocks(blocks, block => block.attributes);
3493  }
3494  /**
3495   * Returns an object against which it is safe to perform mutating operations,
3496   * given the original object and its current working copy.
3497   *
3498   * @param {Object} original Original object.
3499   * @param {Object} working  Working object.
3500   *
3501   * @return {Object} Mutation-safe object.
3502   */
3503  
3504  
3505  function getMutateSafeObject(original, working) {
3506    if (original === working) {
3507      return { ...original
3508      };
3509    }
3510  
3511    return working;
3512  }
3513  /**
3514   * Returns true if the two object arguments have the same keys, or false
3515   * otherwise.
3516   *
3517   * @param {Object} a First object.
3518   * @param {Object} b Second object.
3519   *
3520   * @return {boolean} Whether the two objects have the same keys.
3521   */
3522  
3523  
3524  function hasSameKeys(a, b) {
3525    return (0,external_lodash_namespaceObject.isEqual)((0,external_lodash_namespaceObject.keys)(a), (0,external_lodash_namespaceObject.keys)(b));
3526  }
3527  /**
3528   * Returns true if, given the currently dispatching action and the previously
3529   * dispatched action, the two actions are updating the same block attribute, or
3530   * false otherwise.
3531   *
3532   * @param {Object} action     Currently dispatching action.
3533   * @param {Object} lastAction Previously dispatched action.
3534   *
3535   * @return {boolean} Whether actions are updating the same block attribute.
3536   */
3537  
3538  function isUpdatingSameBlockAttribute(action, lastAction) {
3539    return action.type === 'UPDATE_BLOCK_ATTRIBUTES' && lastAction !== undefined && lastAction.type === 'UPDATE_BLOCK_ATTRIBUTES' && (0,external_lodash_namespaceObject.isEqual)(action.clientIds, lastAction.clientIds) && hasSameKeys(action.attributes, lastAction.attributes);
3540  }
3541  
3542  function buildBlockTree(state, blocks) {
3543    const result = {};
3544    const stack = [...blocks];
3545    const flattenedBlocks = [...blocks];
3546  
3547    while (stack.length) {
3548      const block = stack.shift();
3549      stack.push(...block.innerBlocks);
3550      flattenedBlocks.push(...block.innerBlocks);
3551    } // Create objects before mutating them, that way it's always defined.
3552  
3553  
3554    for (const block of flattenedBlocks) {
3555      result[block.clientId] = {};
3556    }
3557  
3558    for (const block of flattenedBlocks) {
3559      result[block.clientId] = Object.assign(result[block.clientId], { ...state.byClientId[block.clientId],
3560        attributes: state.attributes[block.clientId],
3561        innerBlocks: block.innerBlocks.map(subBlock => result[subBlock.clientId])
3562      });
3563    }
3564  
3565    return result;
3566  }
3567  
3568  function updateParentInnerBlocksInTree(state, tree, updatedClientIds) {
3569    let updateChildrenOfUpdatedClientIds = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
3570    const uncontrolledParents = new Set([]);
3571    const controlledParents = new Set();
3572  
3573    for (const clientId of updatedClientIds) {
3574      let current = updateChildrenOfUpdatedClientIds ? clientId : state.parents[clientId];
3575  
3576      do {
3577        if (state.controlledInnerBlocks[current]) {
3578          // Should stop on controlled blocks.
3579          // If we reach a controlled parent, break out of the loop.
3580          controlledParents.add(current);
3581          break;
3582        } else {
3583          // Else continue traversing up through parents.
3584          uncontrolledParents.add(current);
3585          current = state.parents[current];
3586        }
3587      } while (current !== undefined);
3588    } // To make sure the order of assignments doesn't matter,
3589    // we first create empty objects and mutates the inner blocks later.
3590  
3591  
3592    for (const clientId of uncontrolledParents) {
3593      tree[clientId] = { ...tree[clientId]
3594      };
3595    }
3596  
3597    for (const clientId of uncontrolledParents) {
3598      tree[clientId].innerBlocks = (state.order[clientId] || []).map(subClientId => tree[subClientId]);
3599    } // Controlled parent blocks, need a dedicated key for their inner blocks
3600    // to be used when doing getBlocks( controlledBlockClientId ).
3601  
3602  
3603    for (const clientId of controlledParents) {
3604      tree['controlled||' + clientId] = {
3605        innerBlocks: (state.order[clientId] || []).map(subClientId => tree[subClientId])
3606      };
3607    }
3608  
3609    return tree;
3610  }
3611  /**
3612   * Higher-order reducer intended to compute full block objects key for each block in the post.
3613   * This is a denormalization to optimize the performance of the getBlock selectors and avoid
3614   * recomputing the block objects and avoid heavy memoization.
3615   *
3616   * @param {Function} reducer Original reducer function.
3617   *
3618   * @return {Function} Enhanced reducer function.
3619   */
3620  
3621  
3622  const withBlockTree = reducer => function () {
3623    let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3624    let action = arguments.length > 1 ? arguments[1] : undefined;
3625    const newState = reducer(state, action);
3626  
3627    if (newState === state) {
3628      return state;
3629    }
3630  
3631    newState.tree = state.tree ? state.tree : {};
3632  
3633    switch (action.type) {
3634      case 'RECEIVE_BLOCKS':
3635      case 'INSERT_BLOCKS':
3636        {
3637          const subTree = buildBlockTree(newState, action.blocks);
3638          newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree,
3639            ...subTree
3640          }, action.rootClientId ? [action.rootClientId] : [''], true);
3641          break;
3642        }
3643  
3644      case 'UPDATE_BLOCK':
3645        newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree,
3646          [action.clientId]: { ...newState.tree[action.clientId],
3647            ...newState.byClientId[action.clientId],
3648            attributes: newState.attributes[action.clientId]
3649          }
3650        }, [action.clientId], false);
3651        break;
3652  
3653      case 'UPDATE_BLOCK_ATTRIBUTES':
3654        {
3655          const newSubTree = action.clientIds.reduce((result, clientId) => {
3656            result[clientId] = { ...newState.tree[clientId],
3657              attributes: newState.attributes[clientId]
3658            };
3659            return result;
3660          }, {});
3661          newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree,
3662            ...newSubTree
3663          }, action.clientIds, false);
3664          break;
3665        }
3666  
3667      case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
3668        {
3669          const subTree = buildBlockTree(newState, action.blocks);
3670          newState.tree = updateParentInnerBlocksInTree(newState, { ...(0,external_lodash_namespaceObject.omit)(newState.tree, action.replacedClientIds.concat( // Controlled inner blocks are only removed
3671            // if the block doesn't move to another position
3672            // otherwise their content will be lost.
3673            action.replacedClientIds.filter(clientId => !subTree[clientId]).map(clientId => 'controlled||' + clientId))),
3674            ...subTree
3675          }, action.blocks.map(b => b.clientId), false); // If there are no replaced blocks, it means we're removing blocks so we need to update their parent.
3676  
3677          const parentsOfRemovedBlocks = [];
3678  
3679          for (const clientId of action.clientIds) {
3680            if (state.parents[clientId] !== undefined && (state.parents[clientId] === '' || newState.byClientId[state.parents[clientId]])) {
3681              parentsOfRemovedBlocks.push(state.parents[clientId]);
3682            }
3683          }
3684  
3685          newState.tree = updateParentInnerBlocksInTree(newState, newState.tree, parentsOfRemovedBlocks, true);
3686          break;
3687        }
3688  
3689      case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
3690        const parentsOfRemovedBlocks = [];
3691  
3692        for (const clientId of action.clientIds) {
3693          if (state.parents[clientId] !== undefined && (state.parents[clientId] === '' || newState.byClientId[state.parents[clientId]])) {
3694            parentsOfRemovedBlocks.push(state.parents[clientId]);
3695          }
3696        }
3697  
3698        newState.tree = updateParentInnerBlocksInTree(newState, (0,external_lodash_namespaceObject.omit)(newState.tree, action.removedClientIds.concat(action.removedClientIds.map(clientId => 'controlled||' + clientId))), parentsOfRemovedBlocks, true);
3699        break;
3700  
3701      case 'MOVE_BLOCKS_TO_POSITION':
3702        {
3703          const updatedBlockUids = [];
3704  
3705          if (action.fromRootClientId) {
3706            updatedBlockUids.push(action.fromRootClientId);
3707          }
3708  
3709          if (action.toRootClientId) {
3710            updatedBlockUids.push(action.toRootClientId);
3711          }
3712  
3713          if (!action.fromRootClientId || !action.fromRootClientId) {
3714            updatedBlockUids.push('');
3715          }
3716  
3717          newState.tree = updateParentInnerBlocksInTree(newState, newState.tree, updatedBlockUids, true);
3718          break;
3719        }
3720  
3721      case 'MOVE_BLOCKS_UP':
3722      case 'MOVE_BLOCKS_DOWN':
3723        {
3724          const updatedBlockUids = [action.rootClientId ? action.rootClientId : ''];
3725          newState.tree = updateParentInnerBlocksInTree(newState, newState.tree, updatedBlockUids, true);
3726          break;
3727        }
3728  
3729      case 'SAVE_REUSABLE_BLOCK_SUCCESS':
3730        {
3731          const updatedBlockUids = (0,external_lodash_namespaceObject.keys)((0,external_lodash_namespaceObject.omitBy)(newState.attributes, (attributes, clientId) => {
3732            return newState.byClientId[clientId].name !== 'core/block' || attributes.ref !== action.updatedId;
3733          }));
3734          newState.tree = updateParentInnerBlocksInTree(newState, { ...newState.tree,
3735            ...updatedBlockUids.reduce((result, clientId) => {
3736              result[clientId] = { ...newState.byClientId[clientId],
3737                attributes: newState.attributes[clientId],
3738                innerBlocks: newState.tree[clientId].innerBlocks
3739              };
3740              return result;
3741            }, {})
3742          }, updatedBlockUids, false);
3743        }
3744    }
3745  
3746    return newState;
3747  };
3748  /**
3749   * Higher-order reducer intended to augment the blocks reducer, assigning an
3750   * `isPersistentChange` property value corresponding to whether a change in
3751   * state can be considered as persistent. All changes are considered persistent
3752   * except when updating the same block attribute as in the previous action.
3753   *
3754   * @param {Function} reducer Original reducer function.
3755   *
3756   * @return {Function} Enhanced reducer function.
3757   */
3758  
3759  
3760  function withPersistentBlockChange(reducer) {
3761    let lastAction;
3762    let markNextChangeAsNotPersistent = false;
3763    return (state, action) => {
3764      let nextState = reducer(state, action);
3765      const isExplicitPersistentChange = action.type === 'MARK_LAST_CHANGE_AS_PERSISTENT' || markNextChangeAsNotPersistent; // Defer to previous state value (or default) unless changing or
3766      // explicitly marking as persistent.
3767  
3768      if (state === nextState && !isExplicitPersistentChange) {
3769        var _state$isPersistentCh;
3770  
3771        markNextChangeAsNotPersistent = action.type === 'MARK_NEXT_CHANGE_AS_NOT_PERSISTENT';
3772        const nextIsPersistentChange = (_state$isPersistentCh = state === null || state === void 0 ? void 0 : state.isPersistentChange) !== null && _state$isPersistentCh !== void 0 ? _state$isPersistentCh : true;
3773  
3774        if (state.isPersistentChange === nextIsPersistentChange) {
3775          return state;
3776        }
3777  
3778        return { ...nextState,
3779          isPersistentChange: nextIsPersistentChange
3780        };
3781      }
3782  
3783      nextState = { ...nextState,
3784        isPersistentChange: isExplicitPersistentChange ? !markNextChangeAsNotPersistent : !isUpdatingSameBlockAttribute(action, lastAction)
3785      }; // In comparing against the previous action, consider only those which
3786      // would have qualified as one which would have been ignored or not
3787      // have resulted in a changed state.
3788  
3789      lastAction = action;
3790      markNextChangeAsNotPersistent = action.type === 'MARK_NEXT_CHANGE_AS_NOT_PERSISTENT';
3791      return nextState;
3792    };
3793  }
3794  /**
3795   * Higher-order reducer intended to augment the blocks reducer, assigning an
3796   * `isIgnoredChange` property value corresponding to whether a change in state
3797   * can be considered as ignored. A change is considered ignored when the result
3798   * of an action not incurred by direct user interaction.
3799   *
3800   * @param {Function} reducer Original reducer function.
3801   *
3802   * @return {Function} Enhanced reducer function.
3803   */
3804  
3805  
3806  function withIgnoredBlockChange(reducer) {
3807    /**
3808     * Set of action types for which a blocks state change should be ignored.
3809     *
3810     * @type {Set}
3811     */
3812    const IGNORED_ACTION_TYPES = new Set(['RECEIVE_BLOCKS']);
3813    return (state, action) => {
3814      const nextState = reducer(state, action);
3815  
3816      if (nextState !== state) {
3817        nextState.isIgnoredChange = IGNORED_ACTION_TYPES.has(action.type);
3818      }
3819  
3820      return nextState;
3821    };
3822  }
3823  /**
3824   * Higher-order reducer targeting the combined blocks reducer, augmenting
3825   * block client IDs in remove action to include cascade of inner blocks.
3826   *
3827   * @param {Function} reducer Original reducer function.
3828   *
3829   * @return {Function} Enhanced reducer function.
3830   */
3831  
3832  
3833  const withInnerBlocksRemoveCascade = reducer => (state, action) => {
3834    // Gets all children which need to be removed.
3835    const getAllChildren = clientIds => {
3836      let result = clientIds;
3837  
3838      for (let i = 0; i < result.length; i++) {
3839        if (!state.order[result[i]] || action.keepControlledInnerBlocks && action.keepControlledInnerBlocks[result[i]]) {
3840          continue;
3841        }
3842  
3843        if (result === clientIds) {
3844          result = [...result];
3845        }
3846  
3847        result.push(...state.order[result[i]]);
3848      }
3849  
3850      return result;
3851    };
3852  
3853    if (state) {
3854      switch (action.type) {
3855        case 'REMOVE_BLOCKS':
3856          action = { ...action,
3857            type: 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN',
3858            removedClientIds: getAllChildren(action.clientIds)
3859          };
3860          break;
3861  
3862        case 'REPLACE_BLOCKS':
3863          action = { ...action,
3864            type: 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN',
3865            replacedClientIds: getAllChildren(action.clientIds)
3866          };
3867          break;
3868      }
3869    }
3870  
3871    return reducer(state, action);
3872  };
3873  /**
3874   * Higher-order reducer which targets the combined blocks reducer and handles
3875   * the `RESET_BLOCKS` action. When dispatched, this action will replace all
3876   * blocks that exist in the post, leaving blocks that exist only in state (e.g.
3877   * reusable blocks and blocks controlled by inner blocks controllers) alone.
3878   *
3879   * @param {Function} reducer Original reducer function.
3880   *
3881   * @return {Function} Enhanced reducer function.
3882   */
3883  
3884  
3885  const withBlockReset = reducer => (state, action) => {
3886    if (action.type === 'RESET_BLOCKS') {
3887      const newState = { ...state,
3888        byClientId: getFlattenedBlocksWithoutAttributes(action.blocks),
3889        attributes: getFlattenedBlockAttributes(action.blocks),
3890        order: mapBlockOrder(action.blocks),
3891        parents: mapBlockParents(action.blocks),
3892        controlledInnerBlocks: {}
3893      };
3894      const subTree = buildBlockTree(newState, action.blocks);
3895      newState.tree = { ...subTree,
3896        // Root.
3897        '': {
3898          innerBlocks: action.blocks.map(subBlock => subTree[subBlock.clientId])
3899        }
3900      };
3901      return newState;
3902    }
3903  
3904    return reducer(state, action);
3905  };
3906  /**
3907   * Higher-order reducer which targets the combined blocks reducer and handles
3908   * the `REPLACE_INNER_BLOCKS` action. When dispatched, this action the state
3909   * should become equivalent to the execution of a `REMOVE_BLOCKS` action
3910   * containing all the child's of the root block followed by the execution of
3911   * `INSERT_BLOCKS` with the new blocks.
3912   *
3913   * @param {Function} reducer Original reducer function.
3914   *
3915   * @return {Function} Enhanced reducer function.
3916   */
3917  
3918  
3919  const withReplaceInnerBlocks = reducer => (state, action) => {
3920    if (action.type !== 'REPLACE_INNER_BLOCKS') {
3921      return reducer(state, action);
3922    } // Finds every nested inner block controller. We must check the action blocks
3923    // and not just the block parent state because some inner block controllers
3924    // should be deleted if specified, whereas others should not be deleted. If
3925    // a controlled should not be deleted, then we need to avoid deleting its
3926    // inner blocks from the block state because its inner blocks will not be
3927    // attached to the block in the action.
3928  
3929  
3930    const nestedControllers = {};
3931  
3932    if (Object.keys(state.controlledInnerBlocks).length) {
3933      const stack = [...action.blocks];
3934  
3935      while (stack.length) {
3936        const {
3937          innerBlocks,
3938          ...block
3939        } = stack.shift();
3940        stack.push(...innerBlocks);
3941  
3942        if (!!state.controlledInnerBlocks[block.clientId]) {
3943          nestedControllers[block.clientId] = true;
3944        }
3945      }
3946    } // The `keepControlledInnerBlocks` prop will keep the inner blocks of the
3947    // marked block in the block state so that they can be reattached to the
3948    // marked block when we re-insert everything a few lines below.
3949  
3950  
3951    let stateAfterBlocksRemoval = state;
3952  
3953    if (state.order[action.rootClientId]) {
3954      stateAfterBlocksRemoval = reducer(stateAfterBlocksRemoval, {
3955        type: 'REMOVE_BLOCKS',
3956        keepControlledInnerBlocks: nestedControllers,
3957        clientIds: state.order[action.rootClientId]
3958      });
3959    }
3960  
3961    let stateAfterInsert = stateAfterBlocksRemoval;
3962  
3963    if (action.blocks.length) {
3964      stateAfterInsert = reducer(stateAfterInsert, { ...action,
3965        type: 'INSERT_BLOCKS',
3966        index: 0
3967      }); // We need to re-attach the block order of the controlled inner blocks.
3968      // Otherwise, an inner block controller's blocks will be deleted entirely
3969      // from its entity..
3970  
3971      stateAfterInsert.order = { ...stateAfterInsert.order,
3972        ...(0,external_lodash_namespaceObject.reduce)(nestedControllers, (result, value, key) => {
3973          if (state.order[key]) {
3974            result[key] = state.order[key];
3975          }
3976  
3977          return result;
3978        }, {})
3979      };
3980    }
3981  
3982    return stateAfterInsert;
3983  };
3984  /**
3985   * Higher-order reducer which targets the combined blocks reducer and handles
3986   * the `SAVE_REUSABLE_BLOCK_SUCCESS` action. This action can't be handled by
3987   * regular reducers and needs a higher-order reducer since it needs access to
3988   * both `byClientId` and `attributes` simultaneously.
3989   *
3990   * @param {Function} reducer Original reducer function.
3991   *
3992   * @return {Function} Enhanced reducer function.
3993   */
3994  
3995  
3996  const withSaveReusableBlock = reducer => (state, action) => {
3997    if (state && action.type === 'SAVE_REUSABLE_BLOCK_SUCCESS') {
3998      const {
3999        id,
4000        updatedId
4001      } = action; // If a temporary reusable block is saved, we swap the temporary id with the final one.
4002  
4003      if (id === updatedId) {
4004        return state;
4005      }
4006  
4007      state = { ...state
4008      };
4009      state.attributes = (0,external_lodash_namespaceObject.mapValues)(state.attributes, (attributes, clientId) => {
4010        const {
4011          name
4012        } = state.byClientId[clientId];
4013  
4014        if (name === 'core/block' && attributes.ref === id) {
4015          return { ...attributes,
4016            ref: updatedId
4017          };
4018        }
4019  
4020        return attributes;
4021      });
4022    }
4023  
4024    return reducer(state, action);
4025  };
4026  /**
4027   * Higher-order reducer which removes blocks from state when switching parent block controlled state.
4028   *
4029   * @param {Function} reducer Original reducer function.
4030   *
4031   * @return {Function} Enhanced reducer function.
4032   */
4033  
4034  
4035  const withResetControlledBlocks = reducer => (state, action) => {
4036    if (action.type === 'SET_HAS_CONTROLLED_INNER_BLOCKS') {
4037      // when switching a block from controlled to uncontrolled or inverse,
4038      // we need to remove its content first.
4039      const tempState = reducer(state, {
4040        type: 'REPLACE_INNER_BLOCKS',
4041        rootClientId: action.clientId,
4042        blocks: []
4043      });
4044      return reducer(tempState, action);
4045    }
4046  
4047    return reducer(state, action);
4048  };
4049  /**
4050   * Reducer returning the blocks state.
4051   *
4052   * @param {Object} state  Current state.
4053   * @param {Object} action Dispatched action.
4054   *
4055   * @return {Object} Updated state.
4056   */
4057  
4058  
4059  const blocks = (0,external_lodash_namespaceObject.flow)(external_wp_data_namespaceObject.combineReducers, withSaveReusableBlock, // Needs to be before withBlockCache.
4060  withBlockTree, // Needs to be before withInnerBlocksRemoveCascade.
4061  withInnerBlocksRemoveCascade, withReplaceInnerBlocks, // Needs to be after withInnerBlocksRemoveCascade.
4062  withBlockReset, withPersistentBlockChange, withIgnoredBlockChange, withResetControlledBlocks)({
4063    byClientId() {
4064      let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4065      let action = arguments.length > 1 ? arguments[1] : undefined;
4066  
4067      switch (action.type) {
4068        case 'RECEIVE_BLOCKS':
4069        case 'INSERT_BLOCKS':
4070          return { ...state,
4071            ...getFlattenedBlocksWithoutAttributes(action.blocks)
4072          };
4073  
4074        case 'UPDATE_BLOCK':
4075          // Ignore updates if block isn't known.
4076          if (!state[action.clientId]) {
4077            return state;
4078          } // Do nothing if only attributes change.
4079  
4080  
4081          const changes = (0,external_lodash_namespaceObject.omit)(action.updates, 'attributes');
4082  
4083          if ((0,external_lodash_namespaceObject.isEmpty)(changes)) {
4084            return state;
4085          }
4086  
4087          return { ...state,
4088            [action.clientId]: { ...state[action.clientId],
4089              ...changes
4090            }
4091          };
4092  
4093        case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
4094          if (!action.blocks) {
4095            return state;
4096          }
4097  
4098          return { ...(0,external_lodash_namespaceObject.omit)(state, action.replacedClientIds),
4099            ...getFlattenedBlocksWithoutAttributes(action.blocks)
4100          };
4101  
4102        case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
4103          return (0,external_lodash_namespaceObject.omit)(state, action.removedClientIds);
4104      }
4105  
4106      return state;
4107    },
4108  
4109    attributes() {
4110      let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4111      let action = arguments.length > 1 ? arguments[1] : undefined;
4112  
4113      switch (action.type) {
4114        case 'RECEIVE_BLOCKS':
4115        case 'INSERT_BLOCKS':
4116          return { ...state,
4117            ...getFlattenedBlockAttributes(action.blocks)
4118          };
4119  
4120        case 'UPDATE_BLOCK':
4121          // Ignore updates if block isn't known or there are no attribute changes.
4122          if (!state[action.clientId] || !action.updates.attributes) {
4123            return state;
4124          }
4125  
4126          return { ...state,
4127            [action.clientId]: { ...state[action.clientId],
4128              ...action.updates.attributes
4129            }
4130          };
4131  
4132        case 'UPDATE_BLOCK_ATTRIBUTES':
4133          {
4134            // Avoid a state change if none of the block IDs are known.
4135            if (action.clientIds.every(id => !state[id])) {
4136              return state;
4137            }
4138  
4139            const next = action.clientIds.reduce((accumulator, id) => ({ ...accumulator,
4140              [id]: (0,external_lodash_namespaceObject.reduce)(action.uniqueByBlock ? action.attributes[id] : action.attributes, (result, value, key) => {
4141                // Consider as updates only changed values.
4142                if (value !== result[key]) {
4143                  result = getMutateSafeObject(state[id], result);
4144                  result[key] = value;
4145                }
4146  
4147                return result;
4148              }, state[id])
4149            }), {});
4150  
4151            if (action.clientIds.every(id => next[id] === state[id])) {
4152              return state;
4153            }
4154  
4155            return { ...state,
4156              ...next
4157            };
4158          }
4159  
4160        case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
4161          if (!action.blocks) {
4162            return state;
4163          }
4164  
4165          return { ...(0,external_lodash_namespaceObject.omit)(state, action.replacedClientIds),
4166            ...getFlattenedBlockAttributes(action.blocks)
4167          };
4168  
4169        case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
4170          return (0,external_lodash_namespaceObject.omit)(state, action.removedClientIds);
4171      }
4172  
4173      return state;
4174    },
4175  
4176    order() {
4177      let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4178      let action = arguments.length > 1 ? arguments[1] : undefined;
4179  
4180      switch (action.type) {
4181        case 'RECEIVE_BLOCKS':
4182          {
4183            const blockOrder = mapBlockOrder(action.blocks);
4184            return { ...state,
4185              ...(0,external_lodash_namespaceObject.omit)(blockOrder, ''),
4186              '': ((state === null || state === void 0 ? void 0 : state['']) || []).concat(blockOrder[''])
4187            };
4188          }
4189  
4190        case 'INSERT_BLOCKS':
4191          {
4192            const {
4193              rootClientId = ''
4194            } = action;
4195            const subState = state[rootClientId] || [];
4196            const mappedBlocks = mapBlockOrder(action.blocks, rootClientId);
4197            const {
4198              index = subState.length
4199            } = action;
4200            return { ...state,
4201              ...mappedBlocks,
4202              [rootClientId]: insertAt(subState, mappedBlocks[rootClientId], index)
4203            };
4204          }
4205  
4206        case 'MOVE_BLOCKS_TO_POSITION':
4207          {
4208            const {
4209              fromRootClientId = '',
4210              toRootClientId = '',
4211              clientIds
4212            } = action;
4213            const {
4214              index = state[toRootClientId].length
4215            } = action; // Moving inside the same parent block.
4216  
4217            if (fromRootClientId === toRootClientId) {
4218              const subState = state[toRootClientId];
4219              const fromIndex = subState.indexOf(clientIds[0]);
4220              return { ...state,
4221                [toRootClientId]: moveTo(state[toRootClientId], fromIndex, index, clientIds.length)
4222              };
4223            } // Moving from a parent block to another.
4224  
4225  
4226            return { ...state,
4227              [fromRootClientId]: (0,external_lodash_namespaceObject.without)(state[fromRootClientId], ...clientIds),
4228              [toRootClientId]: insertAt(state[toRootClientId], clientIds, index)
4229            };
4230          }
4231  
4232        case 'MOVE_BLOCKS_UP':
4233          {
4234            const {
4235              clientIds,
4236              rootClientId = ''
4237            } = action;
4238            const firstClientId = (0,external_lodash_namespaceObject.first)(clientIds);
4239            const subState = state[rootClientId];
4240  
4241            if (!subState.length || firstClientId === (0,external_lodash_namespaceObject.first)(subState)) {
4242              return state;
4243            }
4244  
4245            const firstIndex = subState.indexOf(firstClientId);
4246            return { ...state,
4247              [rootClientId]: moveTo(subState, firstIndex, firstIndex - 1, clientIds.length)
4248            };
4249          }
4250  
4251        case 'MOVE_BLOCKS_DOWN':
4252          {
4253            const {
4254              clientIds,
4255              rootClientId = ''
4256            } = action;
4257            const firstClientId = (0,external_lodash_namespaceObject.first)(clientIds);
4258            const lastClientId = (0,external_lodash_namespaceObject.last)(clientIds);
4259            const subState = state[rootClientId];
4260  
4261            if (!subState.length || lastClientId === (0,external_lodash_namespaceObject.last)(subState)) {
4262              return state;
4263            }
4264  
4265            const firstIndex = subState.indexOf(firstClientId);
4266            return { ...state,
4267              [rootClientId]: moveTo(subState, firstIndex, firstIndex + 1, clientIds.length)
4268            };
4269          }
4270  
4271        case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
4272          {
4273            const {
4274              clientIds
4275            } = action;
4276  
4277            if (!action.blocks) {
4278              return state;
4279            }
4280  
4281            const mappedBlocks = mapBlockOrder(action.blocks);
4282            return (0,external_lodash_namespaceObject.flow)([nextState => (0,external_lodash_namespaceObject.omit)(nextState, action.replacedClientIds), nextState => ({ ...nextState,
4283              ...(0,external_lodash_namespaceObject.omit)(mappedBlocks, '')
4284            }), nextState => (0,external_lodash_namespaceObject.mapValues)(nextState, subState => (0,external_lodash_namespaceObject.reduce)(subState, (result, clientId) => {
4285              if (clientId === clientIds[0]) {
4286                return [...result, ...mappedBlocks['']];
4287              }
4288  
4289              if (clientIds.indexOf(clientId) === -1) {
4290                result.push(clientId);
4291              }
4292  
4293              return result;
4294            }, []))])(state);
4295          }
4296  
4297        case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
4298          return (0,external_lodash_namespaceObject.flow)([// Remove inner block ordering for removed blocks.
4299          nextState => (0,external_lodash_namespaceObject.omit)(nextState, action.removedClientIds), // Remove deleted blocks from other blocks' orderings.
4300          nextState => (0,external_lodash_namespaceObject.mapValues)(nextState, subState => (0,external_lodash_namespaceObject.without)(subState, ...action.removedClientIds))])(state);
4301      }
4302  
4303      return state;
4304    },
4305  
4306    // While technically redundant data as the inverse of `order`, it serves as
4307    // an optimization for the selectors which derive the ancestry of a block.
4308    parents() {
4309      let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4310      let action = arguments.length > 1 ? arguments[1] : undefined;
4311  
4312      switch (action.type) {
4313        case 'RECEIVE_BLOCKS':
4314          return { ...state,
4315            ...mapBlockParents(action.blocks)
4316          };
4317  
4318        case 'INSERT_BLOCKS':
4319          return { ...state,
4320            ...mapBlockParents(action.blocks, action.rootClientId || '')
4321          };
4322  
4323        case 'MOVE_BLOCKS_TO_POSITION':
4324          {
4325            return { ...state,
4326              ...action.clientIds.reduce((accumulator, id) => {
4327                accumulator[id] = action.toRootClientId || '';
4328                return accumulator;
4329              }, {})
4330            };
4331          }
4332  
4333        case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
4334          return { ...(0,external_lodash_namespaceObject.omit)(state, action.replacedClientIds),
4335            ...mapBlockParents(action.blocks, state[action.clientIds[0]])
4336          };
4337  
4338        case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
4339          return (0,external_lodash_namespaceObject.omit)(state, action.removedClientIds);
4340      }
4341  
4342      return state;
4343    },
4344  
4345    controlledInnerBlocks() {
4346      let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4347      let {
4348        type,
4349        clientId,
4350        hasControlledInnerBlocks
4351      } = arguments.length > 1 ? arguments[1] : undefined;
4352  
4353      if (type === 'SET_HAS_CONTROLLED_INNER_BLOCKS') {
4354        return { ...state,
4355          [clientId]: hasControlledInnerBlocks
4356        };
4357      }
4358  
4359      return state;
4360    }
4361  
4362  });
4363  /**
4364   * Reducer returning typing state.
4365   *
4366   * @param {boolean} state  Current state.
4367   * @param {Object}  action Dispatched action.
4368   *
4369   * @return {boolean} Updated state.
4370   */
4371  
4372  function isTyping() {
4373    let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
4374    let action = arguments.length > 1 ? arguments[1] : undefined;
4375  
4376    switch (action.type) {
4377      case 'START_TYPING':
4378        return true;
4379  
4380      case 'STOP_TYPING':
4381        return false;
4382    }
4383  
4384    return state;
4385  }
4386  /**
4387   * Reducer returning dragged block client id.
4388   *
4389   * @param {string[]} state  Current state.
4390   * @param {Object}   action Dispatched action.
4391   *
4392   * @return {string[]} Updated state.
4393   */
4394  
4395  function draggedBlocks() {
4396    let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
4397    let action = arguments.length > 1 ? arguments[1] : undefined;
4398  
4399    switch (action.type) {
4400      case 'START_DRAGGING_BLOCKS':
4401        return action.clientIds;
4402  
4403      case 'STOP_DRAGGING_BLOCKS':
4404        return [];
4405    }
4406  
4407    return state;
4408  }
4409  /**
4410   * Reducer returning whether the caret is within formatted text.
4411   *
4412   * @param {boolean} state  Current state.
4413   * @param {Object}  action Dispatched action.
4414   *
4415   * @return {boolean} Updated state.
4416   */
4417  
4418  function isCaretWithinFormattedText() {
4419    let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
4420    let action = arguments.length > 1 ? arguments[1] : undefined;
4421  
4422    switch (action.type) {
4423      case 'ENTER_FORMATTED_TEXT':
4424        return true;
4425  
4426      case 'EXIT_FORMATTED_TEXT':
4427        return false;
4428    }
4429  
4430    return state;
4431  }
4432  /**
4433   * Internal helper reducer for selectionStart and selectionEnd. Can hold a block
4434   * selection, represented by an object with property clientId.
4435   *
4436   * @param {Object} state  Current state.
4437   * @param {Object} action Dispatched action.
4438   *
4439   * @return {Object} Updated state.
4440   */
4441  
4442  function selectionHelper() {
4443    let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4444    let action = arguments.length > 1 ? arguments[1] : undefined;
4445  
4446    switch (action.type) {
4447      case 'CLEAR_SELECTED_BLOCK':
4448        {
4449          if (state.clientId) {
4450            return {};
4451          }
4452  
4453          return state;
4454        }
4455  
4456      case 'SELECT_BLOCK':
4457        if (action.clientId === state.clientId) {
4458          return state;
4459        }
4460  
4461        return {
4462          clientId: action.clientId
4463        };
4464  
4465      case 'REPLACE_INNER_BLOCKS':
4466      case 'INSERT_BLOCKS':
4467        {
4468          if (!action.updateSelection || !action.blocks.length) {
4469            return state;
4470          }
4471  
4472          return {
4473            clientId: action.blocks[0].clientId
4474          };
4475        }
4476  
4477      case 'REMOVE_BLOCKS':
4478        if (!action.clientIds || !action.clientIds.length || action.clientIds.indexOf(state.clientId) === -1) {
4479          return state;
4480        }
4481  
4482        return {};
4483  
4484      case 'REPLACE_BLOCKS':
4485        {
4486          if (action.clientIds.indexOf(state.clientId) === -1) {
4487            return state;
4488          }
4489  
4490          const blockToSelect = action.blocks[action.indexToSelect] || action.blocks[action.blocks.length - 1];
4491  
4492          if (!blockToSelect) {
4493            return {};
4494          }
4495  
4496          if (blockToSelect.clientId === state.clientId) {
4497            return state;
4498          }
4499  
4500          return {
4501            clientId: blockToSelect.clientId
4502          };
4503        }
4504    }
4505  
4506    return state;
4507  }
4508  /**
4509   * Reducer returning the selection state.
4510   *
4511   * @param {boolean} state  Current state.
4512   * @param {Object}  action Dispatched action.
4513   *
4514   * @return {boolean} Updated state.
4515   */
4516  
4517  
4518  function selection() {
4519    var _state$selectionStart, _state$selectionEnd, _state$selectionStart2, _state$selectionEnd2;
4520  
4521    let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4522    let action = arguments.length > 1 ? arguments[1] : undefined;
4523  
4524    switch (action.type) {
4525      case 'SELECTION_CHANGE':
4526        if (action.clientId) {
4527          return {
4528            selectionStart: {
4529              clientId: action.clientId,
4530              attributeKey: action.attributeKey,
4531              offset: action.startOffset
4532            },
4533            selectionEnd: {
4534              clientId: action.clientId,
4535              attributeKey: action.attributeKey,
4536              offset: action.endOffset
4537            }
4538          };
4539        }
4540  
4541        return {
4542          selectionStart: action.start || state.selectionStart,
4543          selectionEnd: action.end || state.selectionEnd
4544        };
4545  
4546      case 'RESET_SELECTION':
4547        const {
4548          selectionStart,
4549          selectionEnd
4550        } = action;
4551        return {
4552          selectionStart,
4553          selectionEnd
4554        };
4555  
4556      case 'MULTI_SELECT':
4557        const {
4558          start,
4559          end
4560        } = action;
4561  
4562        if (start === ((_state$selectionStart = state.selectionStart) === null || _state$selectionStart === void 0 ? void 0 : _state$selectionStart.clientId) && end === ((_state$selectionEnd = state.selectionEnd) === null || _state$selectionEnd === void 0 ? void 0 : _state$selectionEnd.clientId)) {
4563          return state;
4564        }
4565  
4566        return {
4567          selectionStart: {
4568            clientId: start
4569          },
4570          selectionEnd: {
4571            clientId: end
4572          }
4573        };
4574  
4575      case 'RESET_BLOCKS':
4576        const startClientId = state === null || state === void 0 ? void 0 : (_state$selectionStart2 = state.selectionStart) === null || _state$selectionStart2 === void 0 ? void 0 : _state$selectionStart2.clientId;
4577        const endClientId = state === null || state === void 0 ? void 0 : (_state$selectionEnd2 = state.selectionEnd) === null || _state$selectionEnd2 === void 0 ? void 0 : _state$selectionEnd2.clientId; // Do nothing if there's no selected block.
4578  
4579        if (!startClientId && !endClientId) {
4580          return state;
4581        } // If the start of the selection won't exist after reset, remove selection.
4582  
4583  
4584        if (!action.blocks.some(block => block.clientId === startClientId)) {
4585          return {
4586            selectionStart: {},
4587            selectionEnd: {}
4588          };
4589        } // If the end of the selection won't exist after reset, collapse selection.
4590  
4591  
4592        if (!action.blocks.some(block => block.clientId === endClientId)) {
4593          return { ...state,
4594            selectionEnd: state.selectionStart
4595          };
4596        }
4597  
4598    }
4599  
4600    return {
4601      selectionStart: selectionHelper(state.selectionStart, action),
4602      selectionEnd: selectionHelper(state.selectionEnd, action)
4603    };
4604  }
4605  /**
4606   * Reducer returning whether the user is multi-selecting.
4607   *
4608   * @param {boolean} state  Current state.
4609   * @param {Object}  action Dispatched action.
4610   *
4611   * @return {boolean} Updated state.
4612   */
4613  
4614  function isMultiSelecting() {
4615    let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
4616    let action = arguments.length > 1 ? arguments[1] : undefined;
4617  
4618    switch (action.type) {
4619      case 'START_MULTI_SELECT':
4620        return true;
4621  
4622      case 'STOP_MULTI_SELECT':
4623        return false;
4624    }
4625  
4626    return state;
4627  }
4628  /**
4629   * Reducer returning whether selection is enabled.
4630   *
4631   * @param {boolean} state  Current state.
4632   * @param {Object}  action Dispatched action.
4633   *
4634   * @return {boolean} Updated state.
4635   */
4636  
4637  function isSelectionEnabled() {
4638    let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
4639    let action = arguments.length > 1 ? arguments[1] : undefined;
4640  
4641    switch (action.type) {
4642      case 'TOGGLE_SELECTION':
4643        return action.isSelectionEnabled;
4644    }
4645  
4646    return state;
4647  }
4648  /**
4649   * Reducer returning the initial block selection.
4650   *
4651   * Currently this in only used to restore the selection after block deletion and
4652   * pasting new content.This reducer should eventually be removed in favour of setting
4653   * selection directly.
4654   *
4655   * @param {boolean} state  Current state.
4656   * @param {Object}  action Dispatched action.
4657   *
4658   * @return {number|null} Initial position: 0, -1 or null.
4659   */
4660  
4661  function initialPosition() {
4662    let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
4663    let action = arguments.length > 1 ? arguments[1] : undefined;
4664  
4665    if (action.type === 'REPLACE_BLOCKS' && action.initialPosition !== undefined) {
4666      return action.initialPosition;
4667    } else if (['MULTI_SELECT', 'SELECT_BLOCK', 'RESET_SELECTION', 'INSERT_BLOCKS', 'REPLACE_INNER_BLOCKS'].includes(action.type)) {
4668      return action.initialPosition;
4669    }
4670  
4671    return state;
4672  }
4673  function blocksMode() {
4674    let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4675    let action = arguments.length > 1 ? arguments[1] : undefined;
4676  
4677    if (action.type === 'TOGGLE_BLOCK_MODE') {
4678      const {
4679        clientId
4680      } = action;
4681      return { ...state,
4682        [clientId]: state[clientId] && state[clientId] === 'html' ? 'visual' : 'html'
4683      };
4684    }
4685  
4686    return state;
4687  }
4688  /**
4689   * Reducer returning the block insertion point visibility, either null if there
4690   * is not an explicit insertion point assigned, or an object of its `index` and
4691   * `rootClientId`.
4692   *
4693   * @param {Object} state  Current state.
4694   * @param {Object} action Dispatched action.
4695   *
4696   * @return {Object} Updated state.
4697   */
4698  
4699  function insertionPoint() {
4700    let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
4701    let action = arguments.length > 1 ? arguments[1] : undefined;
4702  
4703    switch (action.type) {
4704      case 'SHOW_INSERTION_POINT':
4705        const {
4706          rootClientId,
4707          index,
4708          __unstableWithInserter
4709        } = action;
4710        return {
4711          rootClientId,
4712          index,
4713          __unstableWithInserter
4714        };
4715  
4716      case 'HIDE_INSERTION_POINT':
4717        return null;
4718    }
4719  
4720    return state;
4721  }
4722  /**
4723   * Reducer returning whether the post blocks match the defined template or not.
4724   *
4725   * @param {Object} state  Current state.
4726   * @param {Object} action Dispatched action.
4727   *
4728   * @return {boolean} Updated state.
4729   */
4730  
4731  function template() {
4732    let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
4733      isValid: true
4734    };
4735    let action = arguments.length > 1 ? arguments[1] : undefined;
4736  
4737    switch (action.type) {
4738      case 'SET_TEMPLATE_VALIDITY':
4739        return { ...state,
4740          isValid: action.isValid
4741        };
4742    }
4743  
4744    return state;
4745  }
4746  /**
4747   * Reducer returning the editor setting.
4748   *
4749   * @param {Object} state  Current state.
4750   * @param {Object} action Dispatched action.
4751   *
4752   * @return {Object} Updated state.
4753   */
4754  
4755  function settings() {
4756    let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : SETTINGS_DEFAULTS;
4757    let action = arguments.length > 1 ? arguments[1] : undefined;
4758  
4759    switch (action.type) {
4760      case 'UPDATE_SETTINGS':
4761        return { ...state,
4762          ...action.settings
4763        };
4764    }
4765  
4766    return state;
4767  }
4768  /**
4769   * Reducer returning the user preferences.
4770   *
4771   * @param {Object} state  Current state.
4772   * @param {Object} action Dispatched action.
4773   *
4774   * @return {string} Updated state.
4775   */
4776  
4777  function preferences() {
4778    let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : PREFERENCES_DEFAULTS;
4779    let action = arguments.length > 1 ? arguments[1] : undefined;
4780  
4781    switch (action.type) {
4782      case 'INSERT_BLOCKS':
4783      case 'REPLACE_BLOCKS':
4784        return action.blocks.reduce((prevState, block) => {
4785          const {
4786            attributes,
4787            name: blockName
4788          } = block;
4789          const match = (0,external_wp_data_namespaceObject.select)(external_wp_blocks_namespaceObject.store).getActiveBlockVariation(blockName, attributes); // If a block variation match is found change the name to be the same with the
4790          // one that is used for block variations in the Inserter (`getItemFromVariation`).
4791  
4792          let id = match !== null && match !== void 0 && match.name ? `$blockName}/$match.name}` : blockName;
4793          const insert = {
4794            name: id
4795          };
4796  
4797          if (blockName === 'core/block') {
4798            insert.ref = attributes.ref;
4799            id += '/' + attributes.ref;
4800          }
4801  
4802          return { ...prevState,
4803            insertUsage: { ...prevState.insertUsage,
4804              [id]: {
4805                time: action.time,
4806                count: prevState.insertUsage[id] ? prevState.insertUsage[id].count + 1 : 1,
4807                insert
4808              }
4809            }
4810          };
4811        }, state);
4812    }
4813  
4814    return state;
4815  }
4816  /**
4817   * Reducer returning an object where each key is a block client ID, its value
4818   * representing the settings for its nested blocks.
4819   *
4820   * @param {Object} state  Current state.
4821   * @param {Object} action Dispatched action.
4822   *
4823   * @return {Object} Updated state.
4824   */
4825  
4826  const blockListSettings = function () {
4827    let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4828    let action = arguments.length > 1 ? arguments[1] : undefined;
4829  
4830    switch (action.type) {
4831      // Even if the replaced blocks have the same client ID, our logic
4832      // should correct the state.
4833      case 'REPLACE_BLOCKS':
4834      case 'REMOVE_BLOCKS':
4835        {
4836          return (0,external_lodash_namespaceObject.omit)(state, action.clientIds);
4837        }
4838  
4839      case 'UPDATE_BLOCK_LIST_SETTINGS':
4840        {
4841          const {
4842            clientId
4843          } = action;
4844  
4845          if (!action.settings) {
4846            if (state.hasOwnProperty(clientId)) {
4847              return (0,external_lodash_namespaceObject.omit)(state, clientId);
4848            }
4849  
4850            return state;
4851          }
4852  
4853          if ((0,external_lodash_namespaceObject.isEqual)(state[clientId], action.settings)) {
4854            return state;
4855          }
4856  
4857          return { ...state,
4858            [clientId]: action.settings
4859          };
4860        }
4861    }
4862  
4863    return state;
4864  };
4865  /**
4866   * Reducer returning whether the navigation mode is enabled or not.
4867   *
4868   * @param {string} state  Current state.
4869   * @param {Object} action Dispatched action.
4870   *
4871   * @return {string} Updated state.
4872   */
4873  
4874  function isNavigationMode() {
4875    let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
4876    let action = arguments.length > 1 ? arguments[1] : undefined;
4877  
4878    // Let inserting block always trigger Edit mode.
4879    if (action.type === 'INSERT_BLOCKS') {
4880      return false;
4881    }
4882  
4883    if (action.type === 'SET_NAVIGATION_MODE') {
4884      return action.isNavigationMode;
4885    }
4886  
4887    return state;
4888  }
4889  /**
4890   * Reducer returning whether the block moving mode is enabled or not.
4891   *
4892   * @param {string|null} state  Current state.
4893   * @param {Object}      action Dispatched action.
4894   *
4895   * @return {string|null} Updated state.
4896   */
4897  
4898  function hasBlockMovingClientId() {
4899    let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
4900    let action = arguments.length > 1 ? arguments[1] : undefined;
4901  
4902    // Let inserting block always trigger Edit mode.
4903    if (action.type === 'SET_BLOCK_MOVING_MODE') {
4904      return action.hasBlockMovingClientId;
4905    }
4906  
4907    if (action.type === 'SET_NAVIGATION_MODE') {
4908      return null;
4909    }
4910  
4911    return state;
4912  }
4913  /**
4914   * Reducer return an updated state representing the most recent block attribute
4915   * update. The state is structured as an object where the keys represent the
4916   * client IDs of blocks, the values a subset of attributes from the most recent
4917   * block update. The state is always reset to null if the last action is
4918   * anything other than an attributes update.
4919   *
4920   * @param {Object<string,Object>} state  Current state.
4921   * @param {Object}                action Action object.
4922   *
4923   * @return {[string,Object]} Updated state.
4924   */
4925  
4926  function lastBlockAttributesChange(state, action) {
4927    switch (action.type) {
4928      case 'UPDATE_BLOCK':
4929        if (!action.updates.attributes) {
4930          break;
4931        }
4932  
4933        return {
4934          [action.clientId]: action.updates.attributes
4935        };
4936  
4937      case 'UPDATE_BLOCK_ATTRIBUTES':
4938        return action.clientIds.reduce((accumulator, id) => ({ ...accumulator,
4939          [id]: action.uniqueByBlock ? action.attributes[id] : action.attributes
4940        }), {});
4941    }
4942  
4943    return null;
4944  }
4945  /**
4946   * Reducer returning automatic change state.
4947   *
4948   * @param {boolean} state  Current state.
4949   * @param {Object}  action Dispatched action.
4950   *
4951   * @return {string} Updated state.
4952   */
4953  
4954  function automaticChangeStatus(state, action) {
4955    switch (action.type) {
4956      case 'MARK_AUTOMATIC_CHANGE':
4957        return 'pending';
4958  
4959      case 'MARK_AUTOMATIC_CHANGE_FINAL':
4960        if (state === 'pending') {
4961          return 'final';
4962        }
4963  
4964        return;
4965  
4966      case 'SELECTION_CHANGE':
4967        // As long as the state is not final, ignore any selection changes.
4968        if (state !== 'final') {
4969          return state;
4970        }
4971  
4972        return;
4973      // Undoing an automatic change should still be possible after mouse
4974      // move.
4975  
4976      case 'START_TYPING':
4977      case 'STOP_TYPING':
4978        return state;
4979    } // Reset the state by default (for any action not handled).
4980  
4981  }
4982  /**
4983   * Reducer returning current highlighted block.
4984   *
4985   * @param {boolean} state  Current highlighted block.
4986   * @param {Object}  action Dispatched action.
4987   *
4988   * @return {string} Updated state.
4989   */
4990  
4991  function highlightedBlock(state, action) {
4992    switch (action.type) {
4993      case 'TOGGLE_BLOCK_HIGHLIGHT':
4994        const {
4995          clientId,
4996          isHighlighted
4997        } = action;
4998  
4999        if (isHighlighted) {
5000          return clientId;
5001        } else if (state === clientId) {
5002          return null;
5003        }
5004  
5005        return state;
5006  
5007      case 'SELECT_BLOCK':
5008        if (action.clientId !== state) {
5009          return null;
5010        }
5011  
5012    }
5013  
5014    return state;
5015  }
5016  /**
5017   * Reducer returning the block insertion event list state.
5018   *
5019   * @param {Object} state  Current state.
5020   * @param {Object} action Dispatched action.
5021   *
5022   * @return {Object} Updated state.
5023   */
5024  
5025  function lastBlockInserted() {
5026    var _action$meta;
5027  
5028    let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5029    let action = arguments.length > 1 ? arguments[1] : undefined;
5030  
5031    switch (action.type) {
5032      case 'INSERT_BLOCKS':
5033        if (!action.blocks.length) {
5034          return state;
5035        }
5036  
5037        const clientId = action.blocks[0].clientId;
5038        const source = (_action$meta = action.meta) === null || _action$meta === void 0 ? void 0 : _action$meta.source;
5039        return {
5040          clientId,
5041          source
5042        };
5043  
5044      case 'RESET_BLOCKS':
5045        return {};
5046    }
5047  
5048    return state;
5049  }
5050  /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
5051    blocks,
5052    isTyping,
5053    draggedBlocks,
5054    isCaretWithinFormattedText,
5055    selection,
5056    isMultiSelecting,
5057    isSelectionEnabled,
5058    initialPosition,
5059    blocksMode,
5060    blockListSettings,
5061    insertionPoint,
5062    template,
5063    settings,
5064    preferences,
5065    lastBlockAttributesChange,
5066    isNavigationMode,
5067    hasBlockMovingClientId,
5068    automaticChangeStatus,
5069    highlightedBlock,
5070    lastBlockInserted
5071  }));
5072  
5073  ;// CONCATENATED MODULE: ./node_modules/rememo/es/rememo.js
5074  
5075  
5076  var LEAF_KEY, hasWeakMap;
5077  
5078  /**
5079   * Arbitrary value used as key for referencing cache object in WeakMap tree.
5080   *
5081   * @type {Object}
5082   */
5083  LEAF_KEY = {};
5084  
5085  /**
5086   * Whether environment supports WeakMap.
5087   *
5088   * @type {boolean}
5089   */
5090  hasWeakMap = typeof WeakMap !== 'undefined';
5091  
5092  /**
5093   * Returns the first argument as the sole entry in an array.
5094   *
5095   * @param {*} value Value to return.
5096   *
5097   * @return {Array} Value returned as entry in array.
5098   */
5099  function arrayOf( value ) {
5100      return [ value ];
5101  }
5102  
5103  /**
5104   * Returns true if the value passed is object-like, or false otherwise. A value
5105   * is object-like if it can support property assignment, e.g. object or array.
5106   *
5107   * @param {*} value Value to test.
5108   *
5109   * @return {boolean} Whether value is object-like.
5110   */
5111  function isObjectLike( value ) {
5112      return !! value && 'object' === typeof value;
5113  }
5114  
5115  /**
5116   * Creates and returns a new cache object.
5117   *
5118   * @return {Object} Cache object.
5119   */
5120  function createCache() {
5121      var cache = {
5122          clear: function() {
5123              cache.head = null;
5124          },
5125      };
5126  
5127      return cache;
5128  }
5129  
5130  /**
5131   * Returns true if entries within the two arrays are strictly equal by
5132   * reference from a starting index.
5133   *
5134   * @param {Array}  a         First array.
5135   * @param {Array}  b         Second array.
5136   * @param {number} fromIndex Index from which to start comparison.
5137   *
5138   * @return {boolean} Whether arrays are shallowly equal.
5139   */
5140  function isShallowEqual( a, b, fromIndex ) {
5141      var i;
5142  
5143      if ( a.length !== b.length ) {
5144          return false;
5145      }
5146  
5147      for ( i = fromIndex; i < a.length; i++ ) {
5148          if ( a[ i ] !== b[ i ] ) {
5149              return false;
5150          }
5151      }
5152  
5153      return true;
5154  }
5155  
5156  /**
5157   * Returns a memoized selector function. The getDependants function argument is
5158   * called before the memoized selector and is expected to return an immutable
5159   * reference or array of references on which the selector depends for computing
5160   * its own return value. The memoize cache is preserved only as long as those
5161   * dependant references remain the same. If getDependants returns a different
5162   * reference(s), the cache is cleared and the selector value regenerated.
5163   *
5164   * @param {Function} selector      Selector function.
5165   * @param {Function} getDependants Dependant getter returning an immutable
5166   *                                 reference or array of reference used in
5167   *                                 cache bust consideration.
5168   *
5169   * @return {Function} Memoized selector.
5170   */
5171  /* harmony default export */ function rememo(selector, getDependants ) {
5172      var rootCache, getCache;
5173  
5174      // Use object source as dependant if getter not provided
5175      if ( ! getDependants ) {
5176          getDependants = arrayOf;
5177      }
5178  
5179      /**
5180       * Returns the root cache. If WeakMap is supported, this is assigned to the
5181       * root WeakMap cache set, otherwise it is a shared instance of the default
5182       * cache object.
5183       *
5184       * @return {(WeakMap|Object)} Root cache object.
5185       */
5186  	function getRootCache() {
5187          return rootCache;
5188      }
5189  
5190      /**
5191       * Returns the cache for a given dependants array. When possible, a WeakMap
5192       * will be used to create a unique cache for each set of dependants. This
5193       * is feasible due to the nature of WeakMap in allowing garbage collection
5194       * to occur on entries where the key object is no longer referenced. Since
5195       * WeakMap requires the key to be an object, this is only possible when the
5196       * dependant is object-like. The root cache is created as a hierarchy where
5197       * each top-level key is the first entry in a dependants set, the value a
5198       * WeakMap where each key is the next dependant, and so on. This continues
5199       * so long as the dependants are object-like. If no dependants are object-
5200       * like, then the cache is shared across all invocations.
5201       *
5202       * @see isObjectLike
5203       *
5204       * @param {Array} dependants Selector dependants.
5205       *
5206       * @return {Object} Cache object.
5207       */
5208  	function getWeakMapCache( dependants ) {
5209          var caches = rootCache,
5210              isUniqueByDependants = true,
5211              i, dependant, map, cache;
5212  
5213          for ( i = 0; i < dependants.length; i++ ) {
5214              dependant = dependants[ i ];
5215  
5216              // Can only compose WeakMap from object-like key.
5217              if ( ! isObjectLike( dependant ) ) {
5218                  isUniqueByDependants = false;
5219                  break;
5220              }
5221  
5222              // Does current segment of cache already have a WeakMap?
5223              if ( caches.has( dependant ) ) {
5224                  // Traverse into nested WeakMap.
5225                  caches = caches.get( dependant );
5226              } else {
5227                  // Create, set, and traverse into a new one.
5228                  map = new WeakMap();
5229                  caches.set( dependant, map );
5230                  caches = map;
5231              }
5232          }
5233  
5234          // We use an arbitrary (but consistent) object as key for the last item
5235          // in the WeakMap to serve as our running cache.
5236          if ( ! caches.has( LEAF_KEY ) ) {
5237              cache = createCache();
5238              cache.isUniqueByDependants = isUniqueByDependants;
5239              caches.set( LEAF_KEY, cache );
5240          }
5241  
5242          return caches.get( LEAF_KEY );
5243      }
5244  
5245      // Assign cache handler by availability of WeakMap
5246      getCache = hasWeakMap ? getWeakMapCache : getRootCache;
5247  
5248      /**
5249       * Resets root memoization cache.
5250       */
5251  	function clear() {
5252          rootCache = hasWeakMap ? new WeakMap() : createCache();
5253      }
5254  
5255      // eslint-disable-next-line jsdoc/check-param-names
5256      /**
5257       * The augmented selector call, considering first whether dependants have
5258       * changed before passing it to underlying memoize function.
5259       *
5260       * @param {Object} source    Source object for derivation.
5261       * @param {...*}   extraArgs Additional arguments to pass to selector.
5262       *
5263       * @return {*} Selector result.
5264       */
5265  	function callSelector( /* source, ...extraArgs */ ) {
5266          var len = arguments.length,
5267              cache, node, i, args, dependants;
5268  
5269          // Create copy of arguments (avoid leaking deoptimization).
5270          args = new Array( len );
5271          for ( i = 0; i < len; i++ ) {
5272              args[ i ] = arguments[ i ];
5273          }
5274  
5275          dependants = getDependants.apply( null, args );
5276          cache = getCache( dependants );
5277  
5278          // If not guaranteed uniqueness by dependants (primitive type or lack
5279          // of WeakMap support), shallow compare against last dependants and, if
5280          // references have changed, destroy cache to recalculate result.
5281          if ( ! cache.isUniqueByDependants ) {
5282              if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) {
5283                  cache.clear();
5284              }
5285  
5286              cache.lastDependants = dependants;
5287          }
5288  
5289          node = cache.head;
5290          while ( node ) {
5291              // Check whether node arguments match arguments
5292              if ( ! isShallowEqual( node.args, args, 1 ) ) {
5293                  node = node.next;
5294                  continue;
5295              }
5296  
5297              // At this point we can assume we've found a match
5298  
5299              // Surface matched node to head if not already
5300              if ( node !== cache.head ) {
5301                  // Adjust siblings to point to each other.
5302                  node.prev.next = node.next;
5303                  if ( node.next ) {
5304                      node.next.prev = node.prev;
5305                  }
5306  
5307                  node.next = cache.head;
5308                  node.prev = null;
5309                  cache.head.prev = node;
5310                  cache.head = node;
5311              }
5312  
5313              // Return immediately
5314              return node.val;
5315          }
5316  
5317          // No cached value found. Continue to insertion phase:
5318  
5319          node = {
5320              // Generate the result from original function
5321              val: selector.apply( null, args ),
5322          };
5323  
5324          // Avoid including the source object in the cache.
5325          args[ 0 ] = null;
5326          node.args = args;
5327  
5328          // Don't need to check whether node is already head, since it would
5329          // have been returned above already if it was
5330  
5331          // Shift existing head down list
5332          if ( cache.head ) {
5333              cache.head.prev = node;
5334              node.next = cache.head;
5335          }
5336  
5337          cache.head = node;
5338  
5339          return node.val;
5340      }
5341  
5342      callSelector.getDependants = getDependants;
5343      callSelector.clear = clear;
5344      clear();
5345  
5346      return callSelector;
5347  }
5348  
5349  ;// CONCATENATED MODULE: external ["wp","primitives"]
5350  var external_wp_primitives_namespaceObject = window["wp"]["primitives"];
5351  ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol.js
5352  
5353  
5354  /**
5355   * WordPress dependencies
5356   */
5357  
5358  const symbol = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
5359    xmlns: "http://www.w3.org/2000/svg",
5360    viewBox: "0 0 24 24"
5361  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
5362    d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"
5363  }));
5364  /* harmony default export */ var library_symbol = (symbol);
5365  
5366  ;// CONCATENATED MODULE: external ["wp","richText"]
5367  var external_wp_richText_namespaceObject = window["wp"]["richText"];
5368  ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/utils.js
5369  /**
5370   * Helper function that maps attribute definition properties to the
5371   * ones used by RichText utils like `create, toHTMLString, etc..`.
5372   *
5373   * @param {Object} attributeDefinition A block's attribute definition object.
5374   * @return {Object} The mapped object.
5375   */
5376  function mapRichTextSettings(attributeDefinition) {
5377    const {
5378      multiline: multilineTag,
5379      __unstableMultilineWrapperTags: multilineWrapperTags,
5380      __unstablePreserveWhiteSpace: preserveWhiteSpace
5381    } = attributeDefinition;
5382    return {
5383      multilineTag,
5384      multilineWrapperTags,
5385      preserveWhiteSpace
5386    };
5387  }
5388  
5389  ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/selectors.js
5390  /**
5391   * External dependencies
5392   */
5393  
5394  
5395  /**
5396   * WordPress dependencies
5397   */
5398  
5399  
5400  
5401  
5402  
5403  
5404  
5405  /**
5406   * Internal dependencies
5407   */
5408  
5409  
5410  /**
5411   * A block selection object.
5412   *
5413   * @typedef {Object} WPBlockSelection
5414   *
5415   * @property {string} clientId     A block client ID.
5416   * @property {string} attributeKey A block attribute key.
5417   * @property {number} offset       An attribute value offset, based on the rich
5418   *                                 text value. See `wp.richText.create`.
5419   */
5420  // Module constants.
5421  
5422  const MILLISECONDS_PER_HOUR = 3600 * 1000;
5423  const MILLISECONDS_PER_DAY = 24 * 3600 * 1000;
5424  const MILLISECONDS_PER_WEEK = 7 * 24 * 3600 * 1000;
5425  /**
5426   * Shared reference to an empty array for cases where it is important to avoid
5427   * returning a new array reference on every invocation, as in a connected or
5428   * other pure component which performs `shouldComponentUpdate` check on props.
5429   * This should be used as a last resort, since the normalized data should be
5430   * maintained by the reducer result in state.
5431   *
5432   * @type {Array}
5433   */
5434  
5435  const EMPTY_ARRAY = [];
5436  /**
5437   * Returns a block's name given its client ID, or null if no block exists with
5438   * the client ID.
5439   *
5440   * @param {Object} state    Editor state.
5441   * @param {string} clientId Block client ID.
5442   *
5443   * @return {string} Block name.
5444   */
5445  
5446  function getBlockName(state, clientId) {
5447    const block = state.blocks.byClientId[clientId];
5448    const socialLinkName = 'core/social-link';
5449  
5450    if (external_wp_element_namespaceObject.Platform.OS !== 'web' && (block === null || block === void 0 ? void 0 : block.name) === socialLinkName) {
5451      const attributes = state.blocks.attributes[clientId];
5452      const {
5453        service
5454      } = attributes;
5455      return service ? `$socialLinkName}-$service}` : socialLinkName;
5456    }
5457  
5458    return block ? block.name : null;
5459  }
5460  /**
5461   * Returns whether a block is valid or not.
5462   *
5463   * @param {Object} state    Editor state.
5464   * @param {string} clientId Block client ID.
5465   *
5466   * @return {boolean} Is Valid.
5467   */
5468  
5469  function isBlockValid(state, clientId) {
5470    const block = state.blocks.byClientId[clientId];
5471    return !!block && block.isValid;
5472  }
5473  /**
5474   * Returns a block's attributes given its client ID, or null if no block exists with
5475   * the client ID.
5476   *
5477   * @param {Object} state    Editor state.
5478   * @param {string} clientId Block client ID.
5479   *
5480   * @return {Object?} Block attributes.
5481   */
5482  
5483  function getBlockAttributes(state, clientId) {
5484    const block = state.blocks.byClientId[clientId];
5485  
5486    if (!block) {
5487      return null;
5488    }
5489  
5490    return state.blocks.attributes[clientId];
5491  }
5492  /**
5493   * Returns a block given its client ID. This is a parsed copy of the block,
5494   * containing its `blockName`, `clientId`, and current `attributes` state. This
5495   * is not the block's registration settings, which must be retrieved from the
5496   * blocks module registration store.
5497   *
5498   * getBlock recurses through its inner blocks until all its children blocks have
5499   * been retrieved. Note that getBlock will not return the child inner blocks of
5500   * an inner block controller. This is because an inner block controller syncs
5501   * itself with its own entity, and should therefore not be included with the
5502   * blocks of a different entity. For example, say you call `getBlocks( TP )` to
5503   * get the blocks of a template part. If another template part is a child of TP,
5504   * then the nested template part's child blocks will not be returned. This way,
5505   * the template block itself is considered part of the parent, but the children
5506   * are not.
5507   *
5508   * @param {Object} state    Editor state.
5509   * @param {string} clientId Block client ID.
5510   *
5511   * @return {Object} Parsed block object.
5512   */
5513  
5514  function getBlock(state, clientId) {
5515    const block = state.blocks.byClientId[clientId];
5516  
5517    if (!block) {
5518      return null;
5519    }
5520  
5521    return state.blocks.tree[clientId];
5522  }
5523  const __unstableGetBlockWithoutInnerBlocks = rememo((state, clientId) => {
5524    const block = state.blocks.byClientId[clientId];
5525  
5526    if (!block) {
5527      return null;
5528    }
5529  
5530    return { ...block,
5531      attributes: getBlockAttributes(state, clientId)
5532    };
5533  }, (state, clientId) => [state.blocks.byClientId[clientId], state.blocks.attributes[clientId]]);
5534  /**
5535   * Returns all block objects for the current post being edited as an array in
5536   * the order they appear in the post. Note that this will exclude child blocks
5537   * of nested inner block controllers.
5538   *
5539   * @param {Object}  state        Editor state.
5540   * @param {?string} rootClientId Optional root client ID of block list.
5541   *
5542   * @return {Object[]} Post blocks.
5543   */
5544  
5545  function getBlocks(state, rootClientId) {
5546    var _state$blocks$tree$tr;
5547  
5548    const treeKey = !rootClientId || !areInnerBlocksControlled(state, rootClientId) ? rootClientId || '' : 'controlled||' + rootClientId;
5549    return ((_state$blocks$tree$tr = state.blocks.tree[treeKey]) === null || _state$blocks$tree$tr === void 0 ? void 0 : _state$blocks$tree$tr.innerBlocks) || EMPTY_ARRAY;
5550  }
5551  /**
5552   * Returns a stripped down block object containing only its client ID,
5553   * and its inner blocks' client IDs.
5554   *
5555   * @param {Object} state    Editor state.
5556   * @param {string} clientId Client ID of the block to get.
5557   *
5558   * @return {Object} Client IDs of the post blocks.
5559   */
5560  
5561  const __unstableGetClientIdWithClientIdsTree = rememo((state, clientId) => ({
5562    clientId,
5563    innerBlocks: __unstableGetClientIdsTree(state, clientId)
5564  }), state => [state.blocks.order]);
5565  /**
5566   * Returns the block tree represented in the block-editor store from the
5567   * given root, consisting of stripped down block objects containing only
5568   * their client IDs, and their inner blocks' client IDs.
5569   *
5570   * @param {Object}  state        Editor state.
5571   * @param {?string} rootClientId Optional root client ID of block list.
5572   *
5573   * @return {Object[]} Client IDs of the post blocks.
5574   */
5575  
5576  const __unstableGetClientIdsTree = rememo(function (state) {
5577    let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
5578    return (0,external_lodash_namespaceObject.map)(getBlockOrder(state, rootClientId), clientId => __unstableGetClientIdWithClientIdsTree(state, clientId));
5579  }, state => [state.blocks.order]);
5580  /**
5581   * Returns an array containing the clientIds of all descendants of the blocks
5582   * given. Returned ids are ordered first by the order of the ids given, then
5583   * by the order that they appear in the editor.
5584   *
5585   * @param {Object} state     Global application state.
5586   * @param {Array}  clientIds Array of blocks to inspect.
5587   *
5588   * @return {Array} ids of descendants.
5589   */
5590  
5591  const getClientIdsOfDescendants = rememo((state, clientIds) => {
5592    const collectedIds = [];
5593  
5594    for (const givenId of clientIds) {
5595      for (const descendantId of getBlockOrder(state, givenId)) {
5596        collectedIds.push(descendantId, ...getClientIdsOfDescendants(state, [descendantId]));
5597      }
5598    }
5599  
5600    return collectedIds;
5601  }, state => [state.blocks.order]);
5602  /**
5603   * Returns an array containing the clientIds of the top-level blocks and
5604   * their descendants of any depth (for nested blocks). Ids are returned
5605   * in the same order that they appear in the editor.
5606   *
5607   * @param {Object} state Global application state.
5608   *
5609   * @return {Array} ids of top-level and descendant blocks.
5610   */
5611  
5612  const getClientIdsWithDescendants = rememo(state => {
5613    const collectedIds = [];
5614  
5615    for (const topLevelId of getBlockOrder(state)) {
5616      collectedIds.push(topLevelId, ...getClientIdsOfDescendants(state, [topLevelId]));
5617    }
5618  
5619    return collectedIds;
5620  }, state => [state.blocks.order]);
5621  /**
5622   * Returns the total number of blocks, or the total number of blocks with a specific name in a post.
5623   * The number returned includes nested blocks.
5624   *
5625   * @param {Object}  state     Global application state.
5626   * @param {?string} blockName Optional block name, if specified only blocks of that type will be counted.
5627   *
5628   * @return {number} Number of blocks in the post, or number of blocks with name equal to blockName.
5629   */
5630  
5631  const getGlobalBlockCount = rememo((state, blockName) => {
5632    const clientIds = getClientIdsWithDescendants(state);
5633  
5634    if (!blockName) {
5635      return clientIds.length;
5636    }
5637  
5638    return (0,external_lodash_namespaceObject.reduce)(clientIds, (accumulator, clientId) => {
5639      const block = state.blocks.byClientId[clientId];
5640      return block.name === blockName ? accumulator + 1 : accumulator;
5641    }, 0);
5642  }, state => [state.blocks.order, state.blocks.byClientId]);
5643  /**
5644   * Returns all global blocks that match a blockName. Results include nested blocks.
5645   *
5646   * @param {Object}  state     Global application state.
5647   * @param {?string} blockName Optional block name, if not specified, returns an empty array.
5648   *
5649   * @return {Array} Array of clientIds of blocks with name equal to blockName.
5650   */
5651  
5652  const __experimentalGetGlobalBlocksByName = rememo((state, blockName) => {
5653    if (!blockName) {
5654      return EMPTY_ARRAY;
5655    }
5656  
5657    const clientIds = getClientIdsWithDescendants(state);
5658    const foundBlocks = clientIds.filter(clientId => {
5659      const block = state.blocks.byClientId[clientId];
5660      return block.name === blockName;
5661    });
5662    return foundBlocks.length > 0 ? foundBlocks : EMPTY_ARRAY;
5663  }, state => [state.blocks.order, state.blocks.byClientId]);
5664  /**
5665   * Given an array of block client IDs, returns the corresponding array of block
5666   * objects.
5667   *
5668   * @param {Object}   state     Editor state.
5669   * @param {string[]} clientIds Client IDs for which blocks are to be returned.
5670   *
5671   * @return {WPBlock[]} Block objects.
5672   */
5673  
5674  const getBlocksByClientId = rememo((state, clientIds) => (0,external_lodash_namespaceObject.map)((0,external_lodash_namespaceObject.castArray)(clientIds), clientId => getBlock(state, clientId)), (state, clientIds) => (0,external_lodash_namespaceObject.map)((0,external_lodash_namespaceObject.castArray)(clientIds), clientId => state.blocks.tree[clientId]));
5675  /**
5676   * Returns the number of blocks currently present in the post.
5677   *
5678   * @param {Object}  state        Editor state.
5679   * @param {?string} rootClientId Optional root client ID of block list.
5680   *
5681   * @return {number} Number of blocks in the post.
5682   */
5683  
5684  function getBlockCount(state, rootClientId) {
5685    return getBlockOrder(state, rootClientId).length;
5686  }
5687  /**
5688   * Returns the current selection start block client ID, attribute key and text
5689   * offset.
5690   *
5691   * @param {Object} state Block editor state.
5692   *
5693   * @return {WPBlockSelection} Selection start information.
5694   */
5695  
5696  function getSelectionStart(state) {
5697    return state.selection.selectionStart;
5698  }
5699  /**
5700   * Returns the current selection end block client ID, attribute key and text
5701   * offset.
5702   *
5703   * @param {Object} state Block editor state.
5704   *
5705   * @return {WPBlockSelection} Selection end information.
5706   */
5707  
5708  function getSelectionEnd(state) {
5709    return state.selection.selectionEnd;
5710  }
5711  /**
5712   * Returns the current block selection start. This value may be null, and it
5713   * may represent either a singular block selection or multi-selection start.
5714   * A selection is singular if its start and end match.
5715   *
5716   * @param {Object} state Global application state.
5717   *
5718   * @return {?string} Client ID of block selection start.
5719   */
5720  
5721  function getBlockSelectionStart(state) {
5722    return state.selection.selectionStart.clientId;
5723  }
5724  /**
5725   * Returns the current block selection end. This value may be null, and it
5726   * may represent either a singular block selection or multi-selection end.
5727   * A selection is singular if its start and end match.
5728   *
5729   * @param {Object} state Global application state.
5730   *
5731   * @return {?string} Client ID of block selection end.
5732   */
5733  
5734  function getBlockSelectionEnd(state) {
5735    return state.selection.selectionEnd.clientId;
5736  }
5737  /**
5738   * Returns the number of blocks currently selected in the post.
5739   *
5740   * @param {Object} state Global application state.
5741   *
5742   * @return {number} Number of blocks selected in the post.
5743   */
5744  
5745  function getSelectedBlockCount(state) {
5746    const multiSelectedBlockCount = getMultiSelectedBlockClientIds(state).length;
5747  
5748    if (multiSelectedBlockCount) {
5749      return multiSelectedBlockCount;
5750    }
5751  
5752    return state.selection.selectionStart.clientId ? 1 : 0;
5753  }
5754  /**
5755   * Returns true if there is a single selected block, or false otherwise.
5756   *
5757   * @param {Object} state Editor state.
5758   *
5759   * @return {boolean} Whether a single block is selected.
5760   */
5761  
5762  function hasSelectedBlock(state) {
5763    const {
5764      selectionStart,
5765      selectionEnd
5766    } = state.selection;
5767    return !!selectionStart.clientId && selectionStart.clientId === selectionEnd.clientId;
5768  }
5769  /**
5770   * Returns the currently selected block client ID, or null if there is no
5771   * selected block.
5772   *
5773   * @param {Object} state Editor state.
5774   *
5775   * @return {?string} Selected block client ID.
5776   */
5777  
5778  function getSelectedBlockClientId(state) {
5779    const {
5780      selectionStart,
5781      selectionEnd
5782    } = state.selection;
5783    const {
5784      clientId
5785    } = selectionStart;
5786  
5787    if (!clientId || clientId !== selectionEnd.clientId) {
5788      return null;
5789    }
5790  
5791    return clientId;
5792  }
5793  /**
5794   * Returns the currently selected block, or null if there is no selected block.
5795   *
5796   * @param {Object} state Global application state.
5797   *
5798   * @return {?Object} Selected block.
5799   */
5800  
5801  function getSelectedBlock(state) {
5802    const clientId = getSelectedBlockClientId(state);
5803    return clientId ? getBlock(state, clientId) : null;
5804  }
5805  /**
5806   * Given a block client ID, returns the root block from which the block is
5807   * nested, an empty string for top-level blocks, or null if the block does not
5808   * exist.
5809   *
5810   * @param {Object} state    Editor state.
5811   * @param {string} clientId Block from which to find root client ID.
5812   *
5813   * @return {?string} Root client ID, if exists
5814   */
5815  
5816  function getBlockRootClientId(state, clientId) {
5817    return state.blocks.parents[clientId] !== undefined ? state.blocks.parents[clientId] : null;
5818  }
5819  /**
5820   * Given a block client ID, returns the list of all its parents from top to bottom.
5821   *
5822   * @param {Object}  state     Editor state.
5823   * @param {string}  clientId  Block from which to find root client ID.
5824   * @param {boolean} ascending Order results from bottom to top (true) or top to bottom (false).
5825   *
5826   * @return {Array} ClientIDs of the parent blocks.
5827   */
5828  
5829  const getBlockParents = rememo(function (state, clientId) {
5830    let ascending = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
5831    const parents = [];
5832    let current = clientId;
5833  
5834    while (!!state.blocks.parents[current]) {
5835      current = state.blocks.parents[current];
5836      parents.push(current);
5837    }
5838  
5839    return ascending ? parents : parents.reverse();
5840  }, state => [state.blocks.parents]);
5841  /**
5842   * Given a block client ID and a block name, returns the list of all its parents
5843   * from top to bottom, filtered by the given name(s). For example, if passed
5844   * 'core/group' as the blockName, it will only return parents which are group
5845   * blocks. If passed `[ 'core/group', 'core/cover']`, as the blockName, it will
5846   * return parents which are group blocks and parents which are cover blocks.
5847   *
5848   * @param {Object}          state     Editor state.
5849   * @param {string}          clientId  Block from which to find root client ID.
5850   * @param {string|string[]} blockName Block name(s) to filter.
5851   * @param {boolean}         ascending Order results from bottom to top (true) or top to bottom (false).
5852   *
5853   * @return {Array} ClientIDs of the parent blocks.
5854   */
5855  
5856  const getBlockParentsByBlockName = rememo(function (state, clientId, blockName) {
5857    let ascending = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
5858    const parents = getBlockParents(state, clientId, ascending);
5859    return (0,external_lodash_namespaceObject.map)((0,external_lodash_namespaceObject.filter)((0,external_lodash_namespaceObject.map)(parents, id => ({
5860      id,
5861      name: getBlockName(state, id)
5862    })), _ref => {
5863      let {
5864        name
5865      } = _ref;
5866  
5867      if (Array.isArray(blockName)) {
5868        return blockName.includes(name);
5869      }
5870  
5871      return name === blockName;
5872    }), _ref2 => {
5873      let {
5874        id
5875      } = _ref2;
5876      return id;
5877    });
5878  }, state => [state.blocks.parents]);
5879  /**
5880   * Given a block client ID, returns the root of the hierarchy from which the block is nested, return the block itself for root level blocks.
5881   *
5882   * @param {Object} state    Editor state.
5883   * @param {string} clientId Block from which to find root client ID.
5884   *
5885   * @return {string} Root client ID
5886   */
5887  
5888  function getBlockHierarchyRootClientId(state, clientId) {
5889    let current = clientId;
5890    let parent;
5891  
5892    do {
5893      parent = current;
5894      current = state.blocks.parents[current];
5895    } while (current);
5896  
5897    return parent;
5898  }
5899  /**
5900   * Given a block client ID, returns the lowest common ancestor with selected client ID.
5901   *
5902   * @param {Object} state    Editor state.
5903   * @param {string} clientId Block from which to find common ancestor client ID.
5904   *
5905   * @return {string} Common ancestor client ID or undefined
5906   */
5907  
5908  function getLowestCommonAncestorWithSelectedBlock(state, clientId) {
5909    const selectedId = getSelectedBlockClientId(state);
5910    const clientParents = [...getBlockParents(state, clientId), clientId];
5911    const selectedParents = [...getBlockParents(state, selectedId), selectedId];
5912    let lowestCommonAncestor;
5913    const maxDepth = Math.min(clientParents.length, selectedParents.length);
5914  
5915    for (let index = 0; index < maxDepth; index++) {
5916      if (clientParents[index] === selectedParents[index]) {
5917        lowestCommonAncestor = clientParents[index];
5918      } else {
5919        break;
5920      }
5921    }
5922  
5923    return lowestCommonAncestor;
5924  }
5925  /**
5926   * Returns the client ID of the block adjacent one at the given reference
5927   * startClientId and modifier directionality. Defaults start startClientId to
5928   * the selected block, and direction as next block. Returns null if there is no
5929   * adjacent block.
5930   *
5931   * @param {Object}  state         Editor state.
5932   * @param {?string} startClientId Optional client ID of block from which to
5933   *                                search.
5934   * @param {?number} modifier      Directionality multiplier (1 next, -1
5935   *                                previous).
5936   *
5937   * @return {?string} Return the client ID of the block, or null if none exists.
5938   */
5939  
5940  function getAdjacentBlockClientId(state, startClientId) {
5941    let modifier = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
5942  
5943    // Default to selected block.
5944    if (startClientId === undefined) {
5945      startClientId = getSelectedBlockClientId(state);
5946    } // Try multi-selection starting at extent based on modifier.
5947  
5948  
5949    if (startClientId === undefined) {
5950      if (modifier < 0) {
5951        startClientId = getFirstMultiSelectedBlockClientId(state);
5952      } else {
5953        startClientId = getLastMultiSelectedBlockClientId(state);
5954      }
5955    } // Validate working start client ID.
5956  
5957  
5958    if (!startClientId) {
5959      return null;
5960    } // Retrieve start block root client ID, being careful to allow the falsey
5961    // empty string top-level root by explicitly testing against null.
5962  
5963  
5964    const rootClientId = getBlockRootClientId(state, startClientId);
5965  
5966    if (rootClientId === null) {
5967      return null;
5968    }
5969  
5970    const {
5971      order
5972    } = state.blocks;
5973    const orderSet = order[rootClientId];
5974    const index = orderSet.indexOf(startClientId);
5975    const nextIndex = index + 1 * modifier; // Block was first in set and we're attempting to get previous.
5976  
5977    if (nextIndex < 0) {
5978      return null;
5979    } // Block was last in set and we're attempting to get next.
5980  
5981  
5982    if (nextIndex === orderSet.length) {
5983      return null;
5984    } // Assume incremented index is within the set.
5985  
5986  
5987    return orderSet[nextIndex];
5988  }
5989  /**
5990   * Returns the previous block's client ID from the given reference start ID.
5991   * Defaults start to the selected block. Returns null if there is no previous
5992   * block.
5993   *
5994   * @param {Object}  state         Editor state.
5995   * @param {?string} startClientId Optional client ID of block from which to
5996   *                                search.
5997   *
5998   * @return {?string} Adjacent block's client ID, or null if none exists.
5999   */
6000  
6001  function getPreviousBlockClientId(state, startClientId) {
6002    return getAdjacentBlockClientId(state, startClientId, -1);
6003  }
6004  /**
6005   * Returns the next block's client ID from the given reference start ID.
6006   * Defaults start to the selected block. Returns null if there is no next
6007   * block.
6008   *
6009   * @param {Object}  state         Editor state.
6010   * @param {?string} startClientId Optional client ID of block from which to
6011   *                                search.
6012   *
6013   * @return {?string} Adjacent block's client ID, or null if none exists.
6014   */
6015  
6016  function getNextBlockClientId(state, startClientId) {
6017    return getAdjacentBlockClientId(state, startClientId, 1);
6018  }
6019  /* eslint-disable jsdoc/valid-types */
6020  
6021  /**
6022   * Returns the initial caret position for the selected block.
6023   * This position is to used to position the caret properly when the selected block changes.
6024   * If the current block is not a RichText, having initial position set to 0 means "focus block"
6025   *
6026   * @param {Object} state Global application state.
6027   *
6028   * @return {0|-1|null} Initial position.
6029   */
6030  
6031  function getSelectedBlocksInitialCaretPosition(state) {
6032    /* eslint-enable jsdoc/valid-types */
6033    return state.initialPosition;
6034  }
6035  /**
6036   * Returns the current selection set of block client IDs (multiselection or single selection).
6037   *
6038   * @param {Object} state Editor state.
6039   *
6040   * @return {Array} Multi-selected block client IDs.
6041   */
6042  
6043  const getSelectedBlockClientIds = rememo(state => {
6044    const {
6045      selectionStart,
6046      selectionEnd
6047    } = state.selection;
6048  
6049    if (selectionStart.clientId === undefined || selectionEnd.clientId === undefined) {
6050      return EMPTY_ARRAY;
6051    }
6052  
6053    if (selectionStart.clientId === selectionEnd.clientId) {
6054      return [selectionStart.clientId];
6055    } // Retrieve root client ID to aid in retrieving relevant nested block
6056    // order, being careful to allow the falsey empty string top-level root
6057    // by explicitly testing against null.
6058  
6059  
6060    const rootClientId = getBlockRootClientId(state, selectionStart.clientId);
6061  
6062    if (rootClientId === null) {
6063      return EMPTY_ARRAY;
6064    }
6065  
6066    const blockOrder = getBlockOrder(state, rootClientId);
6067    const startIndex = blockOrder.indexOf(selectionStart.clientId);
6068    const endIndex = blockOrder.indexOf(selectionEnd.clientId);
6069  
6070    if (startIndex > endIndex) {
6071      return blockOrder.slice(endIndex, startIndex + 1);
6072    }
6073  
6074    return blockOrder.slice(startIndex, endIndex + 1);
6075  }, state => [state.blocks.order, state.selection.selectionStart.clientId, state.selection.selectionEnd.clientId]);
6076  /**
6077   * Returns the current multi-selection set of block client IDs, or an empty
6078   * array if there is no multi-selection.
6079   *
6080   * @param {Object} state Editor state.
6081   *
6082   * @return {Array} Multi-selected block client IDs.
6083   */
6084  
6085  function getMultiSelectedBlockClientIds(state) {
6086    const {
6087      selectionStart,
6088      selectionEnd
6089    } = state.selection;
6090  
6091    if (selectionStart.clientId === selectionEnd.clientId) {
6092      return EMPTY_ARRAY;
6093    }
6094  
6095    return getSelectedBlockClientIds(state);
6096  }
6097  /**
6098   * Returns the current multi-selection set of blocks, or an empty array if
6099   * there is no multi-selection.
6100   *
6101   * @param {Object} state Editor state.
6102   *
6103   * @return {Array} Multi-selected block objects.
6104   */
6105  
6106  const getMultiSelectedBlocks = rememo(state => {
6107    const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(state);
6108  
6109    if (!multiSelectedBlockClientIds.length) {
6110      return EMPTY_ARRAY;
6111    }
6112  
6113    return multiSelectedBlockClientIds.map(clientId => getBlock(state, clientId));
6114  }, state => [...getSelectedBlockClientIds.getDependants(state), state.blocks.byClientId, state.blocks.order, state.blocks.attributes]);
6115  /**
6116   * Returns the client ID of the first block in the multi-selection set, or null
6117   * if there is no multi-selection.
6118   *
6119   * @param {Object} state Editor state.
6120   *
6121   * @return {?string} First block client ID in the multi-selection set.
6122   */
6123  
6124  function getFirstMultiSelectedBlockClientId(state) {
6125    return (0,external_lodash_namespaceObject.first)(getMultiSelectedBlockClientIds(state)) || null;
6126  }
6127  /**
6128   * Returns the client ID of the last block in the multi-selection set, or null
6129   * if there is no multi-selection.
6130   *
6131   * @param {Object} state Editor state.
6132   *
6133   * @return {?string} Last block client ID in the multi-selection set.
6134   */
6135  
6136  function getLastMultiSelectedBlockClientId(state) {
6137    return (0,external_lodash_namespaceObject.last)(getMultiSelectedBlockClientIds(state)) || null;
6138  }
6139  /**
6140   * Returns true if a multi-selection exists, and the block corresponding to the
6141   * specified client ID is the first block of the multi-selection set, or false
6142   * otherwise.
6143   *
6144   * @param {Object} state    Editor state.
6145   * @param {string} clientId Block client ID.
6146   *
6147   * @return {boolean} Whether block is first in multi-selection.
6148   */
6149  
6150  function isFirstMultiSelectedBlock(state, clientId) {
6151    return getFirstMultiSelectedBlockClientId(state) === clientId;
6152  }
6153  /**
6154   * Returns true if the client ID occurs within the block multi-selection, or
6155   * false otherwise.
6156   *
6157   * @param {Object} state    Editor state.
6158   * @param {string} clientId Block client ID.
6159   *
6160   * @return {boolean} Whether block is in multi-selection set.
6161   */
6162  
6163  function isBlockMultiSelected(state, clientId) {
6164    return getMultiSelectedBlockClientIds(state).indexOf(clientId) !== -1;
6165  }
6166  /**
6167   * Returns true if an ancestor of the block is multi-selected, or false
6168   * otherwise.
6169   *
6170   * @param {Object} state    Editor state.
6171   * @param {string} clientId Block client ID.
6172   *
6173   * @return {boolean} Whether an ancestor of the block is in multi-selection
6174   *                   set.
6175   */
6176  
6177  const isAncestorMultiSelected = rememo((state, clientId) => {
6178    let ancestorClientId = clientId;
6179    let isMultiSelected = false;
6180  
6181    while (ancestorClientId && !isMultiSelected) {
6182      ancestorClientId = getBlockRootClientId(state, ancestorClientId);
6183      isMultiSelected = isBlockMultiSelected(state, ancestorClientId);
6184    }
6185  
6186    return isMultiSelected;
6187  }, state => [state.blocks.order, state.selection.selectionStart.clientId, state.selection.selectionEnd.clientId]);
6188  /**
6189   * Returns the client ID of the block which begins the multi-selection set, or
6190   * null if there is no multi-selection.
6191   *
6192   * This is not necessarily the first client ID in the selection.
6193   *
6194   * @see getFirstMultiSelectedBlockClientId
6195   *
6196   * @param {Object} state Editor state.
6197   *
6198   * @return {?string} Client ID of block beginning multi-selection.
6199   */
6200  
6201  function getMultiSelectedBlocksStartClientId(state) {
6202    const {
6203      selectionStart,
6204      selectionEnd
6205    } = state.selection;
6206  
6207    if (selectionStart.clientId === selectionEnd.clientId) {
6208      return null;
6209    }
6210  
6211    return selectionStart.clientId || null;
6212  }
6213  /**
6214   * Returns the client ID of the block which ends the multi-selection set, or
6215   * null if there is no multi-selection.
6216   *
6217   * This is not necessarily the last client ID in the selection.
6218   *
6219   * @see getLastMultiSelectedBlockClientId
6220   *
6221   * @param {Object} state Editor state.
6222   *
6223   * @return {?string} Client ID of block ending multi-selection.
6224   */
6225  
6226  function getMultiSelectedBlocksEndClientId(state) {
6227    const {
6228      selectionStart,
6229      selectionEnd
6230    } = state.selection;
6231  
6232    if (selectionStart.clientId === selectionEnd.clientId) {
6233      return null;
6234    }
6235  
6236    return selectionEnd.clientId || null;
6237  }
6238  /**
6239   * Returns true if the selection is not partial.
6240   *
6241   * @param {Object} state Editor state.
6242   *
6243   * @return {boolean} Whether the selection is mergeable.
6244   */
6245  
6246  function __unstableIsFullySelected(state) {
6247    const selectionAnchor = getSelectionStart(state);
6248    const selectionFocus = getSelectionEnd(state);
6249    return !selectionAnchor.attributeKey && !selectionFocus.attributeKey && typeof selectionAnchor.offset === 'undefined' && typeof selectionFocus.offset === 'undefined';
6250  }
6251  /**
6252   * Returns true if the selection is collapsed.
6253   *
6254   * @param {Object} state Editor state.
6255   *
6256   * @return {boolean} Whether the selection is collapsed.
6257   */
6258  
6259  function __unstableIsSelectionCollapsed(state) {
6260    const selectionAnchor = getSelectionStart(state);
6261    const selectionFocus = getSelectionEnd(state);
6262    return !!selectionAnchor && !!selectionFocus && selectionAnchor.clientId === selectionFocus.clientId && selectionAnchor.attributeKey === selectionFocus.attributeKey && selectionAnchor.offset === selectionFocus.offset;
6263  }
6264  /**
6265   * Check whether the selection is mergeable.
6266   *
6267   * @param {Object}  state     Editor state.
6268   * @param {boolean} isForward Whether to merge forwards.
6269   *
6270   * @return {boolean} Whether the selection is mergeable.
6271   */
6272  
6273  function __unstableIsSelectionMergeable(state, isForward) {
6274    const selectionAnchor = getSelectionStart(state);
6275    const selectionFocus = getSelectionEnd(state); // It's not mergeable if the start and end are within the same block.
6276  
6277    if (selectionAnchor.clientId === selectionFocus.clientId) return false; // It's not mergeable if there's no rich text selection.
6278  
6279    if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') return false;
6280    const anchorRootClientId = getBlockRootClientId(state, selectionAnchor.clientId);
6281    const focusRootClientId = getBlockRootClientId(state, selectionFocus.clientId); // It's not mergeable if the selection doesn't start and end in the same
6282    // block list. Maybe in the future it should be allowed.
6283  
6284    if (anchorRootClientId !== focusRootClientId) {
6285      return false;
6286    }
6287  
6288    const blockOrder = getBlockOrder(state, anchorRootClientId);
6289    const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId);
6290    const focusIndex = blockOrder.indexOf(selectionFocus.clientId); // Reassign selection start and end based on order.
6291  
6292    let selectionStart, selectionEnd;
6293  
6294    if (anchorIndex > focusIndex) {
6295      selectionStart = selectionFocus;
6296      selectionEnd = selectionAnchor;
6297    } else {
6298      selectionStart = selectionAnchor;
6299      selectionEnd = selectionFocus;
6300    }
6301  
6302    const targetBlockClientId = isForward ? selectionEnd.clientId : selectionStart.clientId;
6303    const blockToMergeClientId = isForward ? selectionStart.clientId : selectionEnd.clientId;
6304    const targetBlock = getBlock(state, targetBlockClientId);
6305    const targetBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(targetBlock.name);
6306    if (!targetBlockType.merge) return false;
6307    const blockToMerge = getBlock(state, blockToMergeClientId); // It's mergeable if the blocks are of the same type.
6308  
6309    if (blockToMerge.name === targetBlock.name) return true; // If the blocks are of a different type, try to transform the block being
6310    // merged into the same type of block.
6311  
6312    const blocksToMerge = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blockToMerge, targetBlock.name);
6313    return blocksToMerge && blocksToMerge.length;
6314  }
6315  /**
6316   * Get partial selected blocks with their content updated
6317   * based on the selection.
6318   *
6319   * @param {Object} state Editor state.
6320   *
6321   * @return {Object[]} Updated partial selected blocks.
6322   */
6323  
6324  const __unstableGetSelectedBlocksWithPartialSelection = state => {
6325    const selectionAnchor = getSelectionStart(state);
6326    const selectionFocus = getSelectionEnd(state);
6327  
6328    if (selectionAnchor.clientId === selectionFocus.clientId) {
6329      return EMPTY_ARRAY;
6330    } // Can't split if the selection is not set.
6331  
6332  
6333    if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') {
6334      return EMPTY_ARRAY;
6335    }
6336  
6337    const anchorRootClientId = getBlockRootClientId(state, selectionAnchor.clientId);
6338    const focusRootClientId = getBlockRootClientId(state, selectionFocus.clientId); // It's not splittable if the selection doesn't start and end in the same
6339    // block list. Maybe in the future it should be allowed.
6340  
6341    if (anchorRootClientId !== focusRootClientId) {
6342      return EMPTY_ARRAY;
6343    }
6344  
6345    const blockOrder = getBlockOrder(state, anchorRootClientId);
6346    const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId);
6347    const focusIndex = blockOrder.indexOf(selectionFocus.clientId); // Reassign selection start and end based on order.
6348  
6349    const [selectionStart, selectionEnd] = anchorIndex > focusIndex ? [selectionFocus, selectionAnchor] : [selectionAnchor, selectionFocus];
6350    const blockA = getBlock(state, selectionStart.clientId);
6351    const blockAType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockA.name);
6352    const blockB = getBlock(state, selectionEnd.clientId);
6353    const blockBType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockB.name);
6354    const htmlA = blockA.attributes[selectionStart.attributeKey];
6355    const htmlB = blockB.attributes[selectionEnd.attributeKey];
6356    const attributeDefinitionA = blockAType.attributes[selectionStart.attributeKey];
6357    const attributeDefinitionB = blockBType.attributes[selectionEnd.attributeKey];
6358    let valueA = (0,external_wp_richText_namespaceObject.create)({
6359      html: htmlA,
6360      ...mapRichTextSettings(attributeDefinitionA)
6361    });
6362    let valueB = (0,external_wp_richText_namespaceObject.create)({
6363      html: htmlB,
6364      ...mapRichTextSettings(attributeDefinitionB)
6365    });
6366    valueA = (0,external_wp_richText_namespaceObject.remove)(valueA, 0, selectionStart.offset);
6367    valueB = (0,external_wp_richText_namespaceObject.remove)(valueB, selectionEnd.offset, valueB.text.length);
6368    return [{ ...blockA,
6369      attributes: { ...blockA.attributes,
6370        [selectionStart.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({
6371          value: valueA,
6372          ...mapRichTextSettings(attributeDefinitionA)
6373        })
6374      }
6375    }, { ...blockB,
6376      attributes: { ...blockB.attributes,
6377        [selectionEnd.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({
6378          value: valueB,
6379          ...mapRichTextSettings(attributeDefinitionB)
6380        })
6381      }
6382    }];
6383  };
6384  /**
6385   * Returns an array containing all block client IDs in the editor in the order
6386   * they appear. Optionally accepts a root client ID of the block list for which
6387   * the order should be returned, defaulting to the top-level block order.
6388   *
6389   * @param {Object}  state        Editor state.
6390   * @param {?string} rootClientId Optional root client ID of block list.
6391   *
6392   * @return {Array} Ordered client IDs of editor blocks.
6393   */
6394  
6395  function getBlockOrder(state, rootClientId) {
6396    return state.blocks.order[rootClientId || ''] || EMPTY_ARRAY;
6397  }
6398  /**
6399   * Returns the index at which the block corresponding to the specified client
6400   * ID occurs within the block order, or `-1` if the block does not exist.
6401   *
6402   * @param {Object} state    Editor state.
6403   * @param {string} clientId Block client ID.
6404   *
6405   * @return {number} Index at which block exists in order.
6406   */
6407  
6408  function getBlockIndex(state, clientId) {
6409    const rootClientId = getBlockRootClientId(state, clientId);
6410    return getBlockOrder(state, rootClientId).indexOf(clientId);
6411  }
6412  /**
6413   * Returns true if the block corresponding to the specified client ID is
6414   * currently selected and no multi-selection exists, or false otherwise.
6415   *
6416   * @param {Object} state    Editor state.
6417   * @param {string} clientId Block client ID.
6418   *
6419   * @return {boolean} Whether block is selected and multi-selection exists.
6420   */
6421  
6422  function isBlockSelected(state, clientId) {
6423    const {
6424      selectionStart,
6425      selectionEnd
6426    } = state.selection;
6427  
6428    if (selectionStart.clientId !== selectionEnd.clientId) {
6429      return false;
6430    }
6431  
6432    return selectionStart.clientId === clientId;
6433  }
6434  /**
6435   * Returns true if one of the block's inner blocks is selected.
6436   *
6437   * @param {Object}  state    Editor state.
6438   * @param {string}  clientId Block client ID.
6439   * @param {boolean} deep     Perform a deep check.
6440   *
6441   * @return {boolean} Whether the block as an inner block selected
6442   */
6443  
6444  function hasSelectedInnerBlock(state, clientId) {
6445    let deep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
6446    return (0,external_lodash_namespaceObject.some)(getBlockOrder(state, clientId), innerClientId => isBlockSelected(state, innerClientId) || isBlockMultiSelected(state, innerClientId) || deep && hasSelectedInnerBlock(state, innerClientId, deep));
6447  }
6448  /**
6449   * Returns true if the block corresponding to the specified client ID is
6450   * currently selected but isn't the last of the selected blocks. Here "last"
6451   * refers to the block sequence in the document, _not_ the sequence of
6452   * multi-selection, which is why `state.selectionEnd` isn't used.
6453   *
6454   * @param {Object} state    Editor state.
6455   * @param {string} clientId Block client ID.
6456   *
6457   * @return {boolean} Whether block is selected and not the last in the
6458   *                   selection.
6459   */
6460  
6461  function isBlockWithinSelection(state, clientId) {
6462    if (!clientId) {
6463      return false;
6464    }
6465  
6466    const clientIds = getMultiSelectedBlockClientIds(state);
6467    const index = clientIds.indexOf(clientId);
6468    return index > -1 && index < clientIds.length - 1;
6469  }
6470  /**
6471   * Returns true if a multi-selection has been made, or false otherwise.
6472   *
6473   * @param {Object} state Editor state.
6474   *
6475   * @return {boolean} Whether multi-selection has been made.
6476   */
6477  
6478  function hasMultiSelection(state) {
6479    const {
6480      selectionStart,
6481      selectionEnd
6482    } = state.selection;
6483    return selectionStart.clientId !== selectionEnd.clientId;
6484  }
6485  /**
6486   * Whether in the process of multi-selecting or not. This flag is only true
6487   * while the multi-selection is being selected (by mouse move), and is false
6488   * once the multi-selection has been settled.
6489   *
6490   * @see hasMultiSelection
6491   *
6492   * @param {Object} state Global application state.
6493   *
6494   * @return {boolean} True if multi-selecting, false if not.
6495   */
6496  
6497  function selectors_isMultiSelecting(state) {
6498    return state.isMultiSelecting;
6499  }
6500  /**
6501   * Selector that returns if multi-selection is enabled or not.
6502   *
6503   * @param {Object} state Global application state.
6504   *
6505   * @return {boolean} True if it should be possible to multi-select blocks, false if multi-selection is disabled.
6506   */
6507  
6508  function selectors_isSelectionEnabled(state) {
6509    return state.isSelectionEnabled;
6510  }
6511  /**
6512   * Returns the block's editing mode, defaulting to "visual" if not explicitly
6513   * assigned.
6514   *
6515   * @param {Object} state    Editor state.
6516   * @param {string} clientId Block client ID.
6517   *
6518   * @return {Object} Block editing mode.
6519   */
6520  
6521  function getBlockMode(state, clientId) {
6522    return state.blocksMode[clientId] || 'visual';
6523  }
6524  /**
6525   * Returns true if the user is typing, or false otherwise.
6526   *
6527   * @param {Object} state Global application state.
6528   *
6529   * @return {boolean} Whether user is typing.
6530   */
6531  
6532  function selectors_isTyping(state) {
6533    return state.isTyping;
6534  }
6535  /**
6536   * Returns true if the user is dragging blocks, or false otherwise.
6537   *
6538   * @param {Object} state Global application state.
6539   *
6540   * @return {boolean} Whether user is dragging blocks.
6541   */
6542  
6543  function isDraggingBlocks(state) {
6544    return !!state.draggedBlocks.length;
6545  }
6546  /**
6547   * Returns the client ids of any blocks being directly dragged.
6548   *
6549   * This does not include children of a parent being dragged.
6550   *
6551   * @param {Object} state Global application state.
6552   *
6553   * @return {string[]} Array of dragged block client ids.
6554   */
6555  
6556  function getDraggedBlockClientIds(state) {
6557    return state.draggedBlocks;
6558  }
6559  /**
6560   * Returns whether the block is being dragged.
6561   *
6562   * Only returns true if the block is being directly dragged,
6563   * not if the block is a child of a parent being dragged.
6564   * See `isAncestorBeingDragged` for child blocks.
6565   *
6566   * @param {Object} state    Global application state.
6567   * @param {string} clientId Client id for block to check.
6568   *
6569   * @return {boolean} Whether the block is being dragged.
6570   */
6571  
6572  function isBlockBeingDragged(state, clientId) {
6573    return state.draggedBlocks.includes(clientId);
6574  }
6575  /**
6576   * Returns whether a parent/ancestor of the block is being dragged.
6577   *
6578   * @param {Object} state    Global application state.
6579   * @param {string} clientId Client id for block to check.
6580   *
6581   * @return {boolean} Whether the block's ancestor is being dragged.
6582   */
6583  
6584  function isAncestorBeingDragged(state, clientId) {
6585    // Return early if no blocks are being dragged rather than
6586    // the more expensive check for parents.
6587    if (!isDraggingBlocks(state)) {
6588      return false;
6589    }
6590  
6591    const parents = getBlockParents(state, clientId);
6592    return (0,external_lodash_namespaceObject.some)(parents, parentClientId => isBlockBeingDragged(state, parentClientId));
6593  }
6594  /**
6595   * Returns true if the caret is within formatted text, or false otherwise.
6596   *
6597   * @param {Object} state Global application state.
6598   *
6599   * @return {boolean} Whether the caret is within formatted text.
6600   */
6601  
6602  function selectors_isCaretWithinFormattedText(state) {
6603    return state.isCaretWithinFormattedText;
6604  }
6605  /**
6606   * Returns the insertion point, the index at which the new inserted block would
6607   * be placed. Defaults to the last index.
6608   *
6609   * @param {Object} state Editor state.
6610   *
6611   * @return {Object} Insertion point object with `rootClientId`, `index`.
6612   */
6613  
6614  function getBlockInsertionPoint(state) {
6615    let rootClientId, index;
6616    const {
6617      insertionPoint,
6618      selection: {
6619        selectionEnd
6620      }
6621    } = state;
6622  
6623    if (insertionPoint !== null) {
6624      return insertionPoint;
6625    }
6626  
6627    const {
6628      clientId
6629    } = selectionEnd;
6630  
6631    if (clientId) {
6632      rootClientId = getBlockRootClientId(state, clientId) || undefined;
6633      index = getBlockIndex(state, selectionEnd.clientId, rootClientId) + 1;
6634    } else {
6635      index = getBlockOrder(state).length;
6636    }
6637  
6638    return {
6639      rootClientId,
6640      index
6641    };
6642  }
6643  /**
6644   * Returns true if we should show the block insertion point.
6645   *
6646   * @param {Object} state Global application state.
6647   *
6648   * @return {?boolean} Whether the insertion point is visible or not.
6649   */
6650  
6651  function isBlockInsertionPointVisible(state) {
6652    return state.insertionPoint !== null;
6653  }
6654  /**
6655   * Returns whether the blocks matches the template or not.
6656   *
6657   * @param {boolean} state
6658   * @return {?boolean} Whether the template is valid or not.
6659   */
6660  
6661  function isValidTemplate(state) {
6662    return state.template.isValid;
6663  }
6664  /**
6665   * Returns the defined block template
6666   *
6667   * @param {boolean} state
6668   *
6669   * @return {?Array} Block Template.
6670   */
6671  
6672  function getTemplate(state) {
6673    return state.settings.template;
6674  }
6675  /**
6676   * Returns the defined block template lock. Optionally accepts a root block
6677   * client ID as context, otherwise defaulting to the global context.
6678   *
6679   * @param {Object}  state        Editor state.
6680   * @param {?string} rootClientId Optional block root client ID.
6681   *
6682   * @return {?string} Block Template Lock
6683   */
6684  
6685  function getTemplateLock(state, rootClientId) {
6686    if (!rootClientId) {
6687      return state.settings.templateLock;
6688    }
6689  
6690    const blockListSettings = getBlockListSettings(state, rootClientId);
6691  
6692    if (!blockListSettings) {
6693      return null;
6694    }
6695  
6696    return blockListSettings.templateLock;
6697  }
6698  
6699  const checkAllowList = function (list, item) {
6700    let defaultResult = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
6701  
6702    if ((0,external_lodash_namespaceObject.isBoolean)(list)) {
6703      return list;
6704    }
6705  
6706    if ((0,external_lodash_namespaceObject.isArray)(list)) {
6707      // TODO: when there is a canonical way to detect that we are editing a post
6708      // the following check should be changed to something like:
6709      // if ( list.includes( 'core/post-content' ) && getEditorMode() === 'post-content' && item === null )
6710      if (list.includes('core/post-content') && item === null) {
6711        return true;
6712      }
6713  
6714      return list.includes(item);
6715    }
6716  
6717    return defaultResult;
6718  };
6719  /**
6720   * Determines if the given block type is allowed to be inserted into the block list.
6721   * This function is not exported and not memoized because using a memoized selector
6722   * inside another memoized selector is just a waste of time.
6723   *
6724   * @param {Object}        state        Editor state.
6725   * @param {string|Object} blockName    The block type object, e.g., the response
6726   *                                     from the block directory; or a string name of
6727   *                                     an installed block type, e.g.' core/paragraph'.
6728   * @param {?string}       rootClientId Optional root client ID of block list.
6729   *
6730   * @return {boolean} Whether the given block type is allowed to be inserted.
6731   */
6732  
6733  
6734  const canInsertBlockTypeUnmemoized = function (state, blockName) {
6735    let rootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
6736    let blockType;
6737  
6738    if (blockName && 'object' === typeof blockName) {
6739      blockType = blockName;
6740      blockName = blockType.name;
6741    } else {
6742      blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName);
6743    }
6744  
6745    if (!blockType) {
6746      return false;
6747    }
6748  
6749    const {
6750      allowedBlockTypes
6751    } = getSettings(state);
6752    const isBlockAllowedInEditor = checkAllowList(allowedBlockTypes, blockName, true);
6753  
6754    if (!isBlockAllowedInEditor) {
6755      return false;
6756    }
6757  
6758    const isLocked = !!getTemplateLock(state, rootClientId);
6759  
6760    if (isLocked) {
6761      return false;
6762    }
6763  
6764    const parentBlockListSettings = getBlockListSettings(state, rootClientId); // The parent block doesn't have settings indicating it doesn't support
6765    // inner blocks, return false.
6766  
6767    if (rootClientId && parentBlockListSettings === undefined) {
6768      return false;
6769    }
6770  
6771    const parentAllowedBlocks = parentBlockListSettings === null || parentBlockListSettings === void 0 ? void 0 : parentBlockListSettings.allowedBlocks;
6772    const hasParentAllowedBlock = checkAllowList(parentAllowedBlocks, blockName);
6773    const blockAllowedParentBlocks = blockType.parent;
6774    const parentName = getBlockName(state, rootClientId);
6775    const hasBlockAllowedParent = checkAllowList(blockAllowedParentBlocks, parentName);
6776    let hasBlockAllowedAncestor = true;
6777    const blockAllowedAncestorBlocks = blockType.ancestor;
6778  
6779    if (blockAllowedAncestorBlocks) {
6780      const ancestors = [rootClientId, ...getBlockParents(state, rootClientId)];
6781      hasBlockAllowedAncestor = (0,external_lodash_namespaceObject.some)(ancestors, ancestorClientId => checkAllowList(blockAllowedAncestorBlocks, getBlockName(state, ancestorClientId)));
6782    }
6783  
6784    const canInsert = hasBlockAllowedAncestor && (hasParentAllowedBlock === null && hasBlockAllowedParent === null || hasParentAllowedBlock === true || hasBlockAllowedParent === true);
6785  
6786    if (!canInsert) {
6787      return canInsert;
6788    }
6789    /**
6790     * This filter is an ad-hoc solution to prevent adding template parts inside post content.
6791     * Conceptually, having a filter inside a selector is bad pattern so this code will be
6792     * replaced by a declarative API that doesn't the following drawbacks:
6793     *
6794     * Filters are not reactive: Upon switching between "template mode" and non "template mode",
6795     * the filter and selector won't necessarily be executed again. For now, it doesn't matter much
6796     * because you can't switch between the two modes while the inserter stays open.
6797     *
6798     * Filters are global: Once they're defined, they will affect all editor instances and all registries.
6799     * An ideal API would only affect specific editor instances.
6800     */
6801  
6802  
6803    return (0,external_wp_hooks_namespaceObject.applyFilters)('blockEditor.__unstableCanInsertBlockType', canInsert, blockType, rootClientId, {
6804      // Pass bound selectors of the current registry. If we're in a nested
6805      // context, the data will differ from the one selected from the root
6806      // registry.
6807      getBlock: getBlock.bind(null, state),
6808      getBlockParentsByBlockName: getBlockParentsByBlockName.bind(null, state)
6809    });
6810  };
6811  /**
6812   * Determines if the given block type is allowed to be inserted into the block list.
6813   *
6814   * @param {Object}  state        Editor state.
6815   * @param {string}  blockName    The name of the block type, e.g.' core/paragraph'.
6816   * @param {?string} rootClientId Optional root client ID of block list.
6817   *
6818   * @return {boolean} Whether the given block type is allowed to be inserted.
6819   */
6820  
6821  
6822  const canInsertBlockType = rememo(canInsertBlockTypeUnmemoized, (state, blockName, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId[rootClientId], state.settings.allowedBlockTypes, state.settings.templateLock]);
6823  /**
6824   * Determines if the given blocks are allowed to be inserted into the block
6825   * list.
6826   *
6827   * @param {Object}  state        Editor state.
6828   * @param {string}  clientIds    The block client IDs to be inserted.
6829   * @param {?string} rootClientId Optional root client ID of block list.
6830   *
6831   * @return {boolean} Whether the given blocks are allowed to be inserted.
6832   */
6833  
6834  function canInsertBlocks(state, clientIds) {
6835    let rootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
6836    return clientIds.every(id => canInsertBlockType(state, getBlockName(state, id), rootClientId));
6837  }
6838  /**
6839   * Determines if the given block is allowed to be deleted.
6840   *
6841   * @param {Object}  state        Editor state.
6842   * @param {string}  clientId     The block client Id.
6843   * @param {?string} rootClientId Optional root client ID of block list.
6844   *
6845   * @return {boolean} Whether the given block is allowed to be removed.
6846   */
6847  
6848  function canRemoveBlock(state, clientId) {
6849    let rootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
6850    const attributes = getBlockAttributes(state, clientId); // attributes can be null if the block is already deleted.
6851  
6852    if (attributes === null) {
6853      return true;
6854    }
6855  
6856    const {
6857      lock
6858    } = attributes;
6859    const parentIsLocked = !!getTemplateLock(state, rootClientId); // If we don't have a lock on the blockType level, we defer to the parent templateLock.
6860  
6861    if (lock === undefined || (lock === null || lock === void 0 ? void 0 : lock.remove) === undefined) {
6862      return !parentIsLocked;
6863    } // When remove is true, it means we cannot remove it.
6864  
6865  
6866    return !(lock !== null && lock !== void 0 && lock.remove);
6867  }
6868  /**
6869   * Determines if the given blocks are allowed to be removed.
6870   *
6871   * @param {Object}  state        Editor state.
6872   * @param {string}  clientIds    The block client IDs to be removed.
6873   * @param {?string} rootClientId Optional root client ID of block list.
6874   *
6875   * @return {boolean} Whether the given blocks are allowed to be removed.
6876   */
6877  
6878  function canRemoveBlocks(state, clientIds) {
6879    let rootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
6880    return clientIds.every(clientId => canRemoveBlock(state, clientId, rootClientId));
6881  }
6882  /**
6883   * Determines if the given block is allowed to be moved.
6884   *
6885   * @param {Object}  state        Editor state.
6886   * @param {string}  clientId     The block client Id.
6887   * @param {?string} rootClientId Optional root client ID of block list.
6888   *
6889   * @return {boolean} Whether the given block is allowed to be moved.
6890   */
6891  
6892  function canMoveBlock(state, clientId) {
6893    let rootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
6894    const attributes = getBlockAttributes(state, clientId);
6895  
6896    if (attributes === null) {
6897      return;
6898    }
6899  
6900    const {
6901      lock
6902    } = attributes;
6903    const parentIsLocked = getTemplateLock(state, rootClientId) === 'all'; // If we don't have a lock on the blockType level, we defer to the parent templateLock.
6904  
6905    if (lock === undefined || (lock === null || lock === void 0 ? void 0 : lock.move) === undefined) {
6906      return !parentIsLocked;
6907    } // When move is true, it means we cannot move it.
6908  
6909  
6910    return !(lock !== null && lock !== void 0 && lock.move);
6911  }
6912  /**
6913   * Determines if the given blocks are allowed to be moved.
6914   *
6915   * @param {Object}  state        Editor state.
6916   * @param {string}  clientIds    The block client IDs to be moved.
6917   * @param {?string} rootClientId Optional root client ID of block list.
6918   *
6919   * @return {boolean} Whether the given blocks are allowed to be moved.
6920   */
6921  
6922  function canMoveBlocks(state, clientIds) {
6923    let rootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
6924    return clientIds.every(clientId => canMoveBlock(state, clientId, rootClientId));
6925  }
6926  /**
6927   * Determines if the given block type can be locked/unlocked by a user.
6928   *
6929   * @param {Object}          state      Editor state.
6930   * @param {(string|Object)} nameOrType Block name or type object.
6931   *
6932   * @return {boolean} Whether a given block type can be locked/unlocked.
6933   */
6934  
6935  function canLockBlockType(state, nameOrType) {
6936    var _state$settings;
6937  
6938    if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, 'lock', true)) {
6939      return false;
6940    } // Use block editor settings as the default value.
6941  
6942  
6943    return !!((_state$settings = state.settings) !== null && _state$settings !== void 0 && _state$settings.canLockBlocks);
6944  }
6945  /**
6946   * Returns information about how recently and frequently a block has been inserted.
6947   *
6948   * @param {Object} state Global application state.
6949   * @param {string} id    A string which identifies the insert, e.g. 'core/block/12'
6950   *
6951   * @return {?{ time: number, count: number }} An object containing `time` which is when the last
6952   *                                            insert occurred as a UNIX epoch, and `count` which is
6953   *                                            the number of inserts that have occurred.
6954   */
6955  
6956  function getInsertUsage(state, id) {
6957    var _state$preferences$in, _state$preferences$in2;
6958  
6959    return (_state$preferences$in = (_state$preferences$in2 = state.preferences.insertUsage) === null || _state$preferences$in2 === void 0 ? void 0 : _state$preferences$in2[id]) !== null && _state$preferences$in !== void 0 ? _state$preferences$in : null;
6960  }
6961  /**
6962   * Returns whether we can show a block type in the inserter
6963   *
6964   * @param {Object}  state        Global State
6965   * @param {Object}  blockType    BlockType
6966   * @param {?string} rootClientId Optional root client ID of block list.
6967   *
6968   * @return {boolean} Whether the given block type is allowed to be shown in the inserter.
6969   */
6970  
6971  
6972  const canIncludeBlockTypeInInserter = (state, blockType, rootClientId) => {
6973    if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'inserter', true)) {
6974      return false;
6975    }
6976  
6977    return canInsertBlockTypeUnmemoized(state, blockType.name, rootClientId);
6978  };
6979  /**
6980   * Return a function to be used to tranform a block variation to an inserter item
6981   *
6982   * @param {Object} state Global State
6983   * @param {Object} item  Denormalized inserter item
6984   * @return {Function} Function to transform a block variation to inserter item
6985   */
6986  
6987  
6988  const getItemFromVariation = (state, item) => variation => {
6989    const variationId = `$item.id}/$variation.name}`;
6990    const {
6991      time,
6992      count = 0
6993    } = getInsertUsage(state, variationId) || {};
6994    return { ...item,
6995      id: variationId,
6996      icon: variation.icon || item.icon,
6997      title: variation.title || item.title,
6998      description: variation.description || item.description,
6999      category: variation.category || item.category,
7000      // If `example` is explicitly undefined for the variation, the preview will not be shown.
7001      example: variation.hasOwnProperty('example') ? variation.example : item.example,
7002      initialAttributes: { ...item.initialAttributes,
7003        ...variation.attributes
7004      },
7005      innerBlocks: variation.innerBlocks,
7006      keywords: variation.keywords || item.keywords,
7007      frecency: calculateFrecency(time, count)
7008    };
7009  };
7010  /**
7011   * Returns the calculated frecency.
7012   *
7013   * 'frecency' is a heuristic (https://en.wikipedia.org/wiki/Frecency)
7014   * that combines block usage frequenty and recency.
7015   *
7016   * @param {number} time  When the last insert occurred as a UNIX epoch
7017   * @param {number} count The number of inserts that have occurred.
7018   *
7019   * @return {number} The calculated frecency.
7020   */
7021  
7022  
7023  const calculateFrecency = (time, count) => {
7024    if (!time) {
7025      return count;
7026    } // The selector is cached, which means Date.now() is the last time that the
7027    // relevant state changed. This suits our needs.
7028  
7029  
7030    const duration = Date.now() - time;
7031  
7032    switch (true) {
7033      case duration < MILLISECONDS_PER_HOUR:
7034        return count * 4;
7035  
7036      case duration < MILLISECONDS_PER_DAY:
7037        return count * 2;
7038  
7039      case duration < MILLISECONDS_PER_WEEK:
7040        return count / 2;
7041  
7042      default:
7043        return count / 4;
7044    }
7045  };
7046  /**
7047   * Returns a function that accepts a block type and builds an item to be shown
7048   * in a specific context. It's used for building items for Inserter and available
7049   * block Transfroms list.
7050   *
7051   * @param {Object} state              Editor state.
7052   * @param {Object} options            Options object for handling the building of a block type.
7053   * @param {string} options.buildScope The scope for which the item is going to be used.
7054   * @return {Function} Function returns an item to be shown in a specific context (Inserter|Transforms list).
7055   */
7056  
7057  
7058  const buildBlockTypeItem = (state, _ref3) => {
7059    let {
7060      buildScope = 'inserter'
7061    } = _ref3;
7062    return blockType => {
7063      const id = blockType.name;
7064      let isDisabled = false;
7065  
7066      if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType.name, 'multiple', true)) {
7067        isDisabled = (0,external_lodash_namespaceObject.some)(getBlocksByClientId(state, getClientIdsWithDescendants(state)), {
7068          name: blockType.name
7069        });
7070      }
7071  
7072      const {
7073        time,
7074        count = 0
7075      } = getInsertUsage(state, id) || {};
7076      const blockItemBase = {
7077        id,
7078        name: blockType.name,
7079        title: blockType.title,
7080        icon: blockType.icon,
7081        isDisabled,
7082        frecency: calculateFrecency(time, count)
7083      };
7084      if (buildScope === 'transform') return blockItemBase;
7085      const inserterVariations = (0,external_wp_blocks_namespaceObject.getBlockVariations)(blockType.name, 'inserter');
7086      return { ...blockItemBase,
7087        initialAttributes: {},
7088        description: blockType.description,
7089        category: blockType.category,
7090        keywords: blockType.keywords,
7091        variations: inserterVariations,
7092        example: blockType.example,
7093        utility: 1 // Deprecated.
7094  
7095      };
7096    };
7097  };
7098  /**
7099   * Determines the items that appear in the inserter. Includes both static
7100   * items (e.g. a regular block type) and dynamic items (e.g. a reusable block).
7101   *
7102   * Each item object contains what's necessary to display a button in the
7103   * inserter and handle its selection.
7104   *
7105   * The 'frecency' property is a heuristic (https://en.wikipedia.org/wiki/Frecency)
7106   * that combines block usage frequenty and recency.
7107   *
7108   * Items are returned ordered descendingly by their 'utility' and 'frecency'.
7109   *
7110   * @param    {Object}   state             Editor state.
7111   * @param    {?string}  rootClientId      Optional root client ID of block list.
7112   *
7113   * @return {WPEditorInserterItem[]} Items that appear in inserter.
7114   *
7115   * @typedef {Object} WPEditorInserterItem
7116   * @property {string}   id                Unique identifier for the item.
7117   * @property {string}   name              The type of block to create.
7118   * @property {Object}   initialAttributes Attributes to pass to the newly created block.
7119   * @property {string}   title             Title of the item, as it appears in the inserter.
7120   * @property {string}   icon              Dashicon for the item, as it appears in the inserter.
7121   * @property {string}   category          Block category that the item is associated with.
7122   * @property {string[]} keywords          Keywords that can be searched to find this item.
7123   * @property {boolean}  isDisabled        Whether or not the user should be prevented from inserting
7124   *                                        this item.
7125   * @property {number}   frecency          Heuristic that combines frequency and recency.
7126   */
7127  
7128  
7129  const getInserterItems = rememo(function (state) {
7130    let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
7131    const buildBlockTypeInserterItem = buildBlockTypeItem(state, {
7132      buildScope: 'inserter'
7133    });
7134    /*
7135     * Matches block comment delimiters amid serialized content.
7136     *
7137     * @see `tokenizer` in `@wordpress/block-serialization-default-parser`
7138     * package
7139     *
7140     * blockParserTokenizer differs from the original tokenizer in the
7141     * following ways:
7142     *
7143     * - removed global flag (/g)
7144     * - prepended ^\s*
7145     *
7146     */
7147  
7148    const blockParserTokenizer = /^\s*<!--\s+(\/)?wp:([a-z][a-z0-9_-]*\/)?([a-z][a-z0-9_-]*)\s+({(?:(?=([^}]+|}+(?=})|(?!}\s+\/?-->)[^])*)\5|[^]*?)}\s+)?(\/)?-->/;
7149  
7150    const buildReusableBlockInserterItem = reusableBlock => {
7151      let icon = library_symbol;
7152      /*
7153       * Instead of always displaying a generic "symbol" icon for every
7154       * reusable block, try to use an icon that represents the first
7155       * outermost block contained in the reusable block. This requires
7156       * scanning the serialized form of the reusable block to find its
7157       * first block delimiter, then looking up the corresponding block
7158       * type, if available.
7159       */
7160  
7161      if (external_wp_element_namespaceObject.Platform.OS === 'web') {
7162        const content = typeof reusableBlock.content.raw === 'string' ? reusableBlock.content.raw : reusableBlock.content;
7163        const rawBlockMatch = content.match(blockParserTokenizer);
7164  
7165        if (rawBlockMatch) {
7166          const [,, namespace = 'core/', blockName] = rawBlockMatch;
7167          const referencedBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(namespace + blockName);
7168  
7169          if (referencedBlockType) {
7170            icon = referencedBlockType.icon;
7171          }
7172        }
7173      }
7174  
7175      const id = `core/block/$reusableBlock.id}`;
7176      const {
7177        time,
7178        count = 0
7179      } = getInsertUsage(state, id) || {};
7180      const frecency = calculateFrecency(time, count);
7181      return {
7182        id,
7183        name: 'core/block',
7184        initialAttributes: {
7185          ref: reusableBlock.id
7186        },
7187        title: reusableBlock.title.raw,
7188        icon,
7189        category: 'reusable',
7190        keywords: [],
7191        isDisabled: false,
7192        utility: 1,
7193        // Deprecated.
7194        frecency
7195      };
7196    };
7197  
7198    const blockTypeInserterItems = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeInserterItem);
7199    const reusableBlockInserterItems = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) ? getReusableBlocks(state).map(buildReusableBlockInserterItem) : [];
7200    const items = blockTypeInserterItems.reduce((accumulator, item) => {
7201      const {
7202        variations = []
7203      } = item; // Exclude any block type item that is to be replaced by a default variation.
7204  
7205      if (!variations.some(_ref4 => {
7206        let {
7207          isDefault
7208        } = _ref4;
7209        return isDefault;
7210      })) {
7211        accumulator.push(item);
7212      }
7213  
7214      if (variations.length) {
7215        const variationMapper = getItemFromVariation(state, item);
7216        accumulator.push(...variations.map(variationMapper));
7217      }
7218  
7219      return accumulator;
7220    }, []); // Ensure core blocks are prioritized in the returned results,
7221    // because third party blocks can be registered earlier than
7222    // the core blocks (usually by using the `init` action),
7223    // thus affecting the display order.
7224    // We don't sort reusable blocks as they are handled differently.
7225  
7226    const groupByType = (blocks, block) => {
7227      const {
7228        core,
7229        noncore
7230      } = blocks;
7231      const type = block.name.startsWith('core/') ? core : noncore;
7232      type.push(block);
7233      return blocks;
7234    };
7235  
7236    const {
7237      core: coreItems,
7238      noncore: nonCoreItems
7239    } = items.reduce(groupByType, {
7240      core: [],
7241      noncore: []
7242    });
7243    const sortedBlockTypes = [...coreItems, ...nonCoreItems];
7244    return [...sortedBlockTypes, ...reusableBlockInserterItems];
7245  }, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.blocks.order, state.preferences.insertUsage, state.settings.allowedBlockTypes, state.settings.templateLock, getReusableBlocks(state), (0,external_wp_blocks_namespaceObject.getBlockTypes)()]);
7246  /**
7247   * Determines the items that appear in the available block transforms list.
7248   *
7249   * Each item object contains what's necessary to display a menu item in the
7250   * transform list and handle its selection.
7251   *
7252   * The 'frecency' property is a heuristic (https://en.wikipedia.org/wiki/Frecency)
7253   * that combines block usage frequenty and recency.
7254   *
7255   * Items are returned ordered descendingly by their 'frecency'.
7256   *
7257   * @param    {Object}  state        Editor state.
7258   * @param    {?string} rootClientId Optional root client ID of block list.
7259   *
7260   * @return {WPEditorTransformItem[]} Items that appear in inserter.
7261   *
7262   * @typedef {Object} WPEditorTransformItem
7263   * @property {string}  id           Unique identifier for the item.
7264   * @property {string}  name         The type of block to create.
7265   * @property {string}  title        Title of the item, as it appears in the inserter.
7266   * @property {string}  icon         Dashicon for the item, as it appears in the inserter.
7267   * @property {boolean} isDisabled   Whether or not the user should be prevented from inserting
7268   *                                  this item.
7269   * @property {number}  frecency     Heuristic that combines frequency and recency.
7270   */
7271  
7272  const getBlockTransformItems = rememo(function (state, blocks) {
7273    var _itemsByName$sourceBl;
7274  
7275    let rootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
7276    const [sourceBlock] = blocks;
7277    const buildBlockTypeTransformItem = buildBlockTypeItem(state, {
7278      buildScope: 'transform'
7279    });
7280    const blockTypeTransformItems = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeTransformItem);
7281    const itemsByName = (0,external_lodash_namespaceObject.mapKeys)(blockTypeTransformItems, _ref5 => {
7282      let {
7283        name
7284      } = _ref5;
7285      return name;
7286    }); // Consider unwraping the highest priority.
7287  
7288    itemsByName['*'] = {
7289      frecency: +Infinity,
7290      id: '*',
7291      isDisabled: false,
7292      name: '*',
7293      title: (0,external_wp_i18n_namespaceObject.__)('Unwrap'),
7294      icon: (_itemsByName$sourceBl = itemsByName[sourceBlock.name]) === null || _itemsByName$sourceBl === void 0 ? void 0 : _itemsByName$sourceBl.icon
7295    };
7296    const possibleTransforms = (0,external_wp_blocks_namespaceObject.getPossibleBlockTransformations)(blocks).reduce((accumulator, block) => {
7297      if (block === '*') {
7298        accumulator.push(itemsByName['*']);
7299      } else if (itemsByName[block === null || block === void 0 ? void 0 : block.name]) {
7300        accumulator.push(itemsByName[block.name]);
7301      }
7302  
7303      return accumulator;
7304    }, []);
7305    return (0,external_lodash_namespaceObject.orderBy)(possibleTransforms, block => itemsByName[block.name].frecency, 'desc');
7306  }, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.preferences.insertUsage, state.settings.allowedBlockTypes, state.settings.templateLock, (0,external_wp_blocks_namespaceObject.getBlockTypes)()]);
7307  /**
7308   * Determines whether there are items to show in the inserter.
7309   *
7310   * @param {Object}  state        Editor state.
7311   * @param {?string} rootClientId Optional root client ID of block list.
7312   *
7313   * @return {boolean} Items that appear in inserter.
7314   */
7315  
7316  const hasInserterItems = rememo(function (state) {
7317    let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
7318    const hasBlockType = (0,external_lodash_namespaceObject.some)((0,external_wp_blocks_namespaceObject.getBlockTypes)(), blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId));
7319  
7320    if (hasBlockType) {
7321      return true;
7322    }
7323  
7324    const hasReusableBlock = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) && getReusableBlocks(state).length > 0;
7325    return hasReusableBlock;
7326  }, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.settings.allowedBlockTypes, state.settings.templateLock, getReusableBlocks(state), (0,external_wp_blocks_namespaceObject.getBlockTypes)()]);
7327  /**
7328   * Returns the list of allowed inserter blocks for inner blocks children
7329   *
7330   * @param {Object}  state        Editor state.
7331   * @param {?string} rootClientId Optional root client ID of block list.
7332   *
7333   * @return {Array?} The list of allowed block types.
7334   */
7335  
7336  const __experimentalGetAllowedBlocks = rememo(function (state) {
7337    let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
7338  
7339    if (!rootClientId) {
7340      return;
7341    }
7342  
7343    return (0,external_lodash_namespaceObject.filter)((0,external_wp_blocks_namespaceObject.getBlockTypes)(), blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId));
7344  }, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.settings.allowedBlockTypes, state.settings.templateLock, (0,external_wp_blocks_namespaceObject.getBlockTypes)()]);
7345  /**
7346   * Returns the block to be directly inserted by the block appender.
7347   *
7348   * @param    {Object}         state            Editor state.
7349   * @param    {?string}        rootClientId     Optional root client ID of block list.
7350   *
7351   * @return {?WPDirectInsertBlock}              The block type to be directly inserted.
7352   *
7353   * @typedef {Object} WPDirectInsertBlock
7354   * @property {string}         name             The type of block.
7355   * @property {?Object}        attributes       Attributes to pass to the newly created block.
7356   * @property {?Array<string>} attributesToCopy Attributes to be copied from adjecent blocks when inserted.
7357   */
7358  
7359  const __experimentalGetDirectInsertBlock = rememo(function (state) {
7360    var _state$blockListSetti, _state$blockListSetti2;
7361  
7362    let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
7363  
7364    if (!rootClientId) {
7365      return;
7366    }
7367  
7368    const defaultBlock = (_state$blockListSetti = state.blockListSettings[rootClientId]) === null || _state$blockListSetti === void 0 ? void 0 : _state$blockListSetti.__experimentalDefaultBlock;
7369    const directInsert = (_state$blockListSetti2 = state.blockListSettings[rootClientId]) === null || _state$blockListSetti2 === void 0 ? void 0 : _state$blockListSetti2.__experimentalDirectInsert;
7370  
7371    if (!defaultBlock || !directInsert) {
7372      return;
7373    }
7374  
7375    if (typeof directInsert === 'function') {
7376      return directInsert(getBlock(state, rootClientId)) ? defaultBlock : null;
7377    }
7378  
7379    return defaultBlock;
7380  }, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.tree[rootClientId]]);
7381  
7382  const checkAllowListRecursive = (blocks, allowedBlockTypes) => {
7383    if ((0,external_lodash_namespaceObject.isBoolean)(allowedBlockTypes)) {
7384      return allowedBlockTypes;
7385    }
7386  
7387    const blocksQueue = [...blocks];
7388  
7389    while (blocksQueue.length > 0) {
7390      var _block$innerBlocks;
7391  
7392      const block = blocksQueue.shift();
7393      const isAllowed = checkAllowList(allowedBlockTypes, block.name || block.blockName, true);
7394  
7395      if (!isAllowed) {
7396        return false;
7397      }
7398  
7399      (_block$innerBlocks = block.innerBlocks) === null || _block$innerBlocks === void 0 ? void 0 : _block$innerBlocks.forEach(innerBlock => {
7400        blocksQueue.push(innerBlock);
7401      });
7402    }
7403  
7404    return true;
7405  };
7406  
7407  const __experimentalGetParsedPattern = rememo((state, patternName) => {
7408    const patterns = state.settings.__experimentalBlockPatterns;
7409    const pattern = patterns.find(_ref6 => {
7410      let {
7411        name
7412      } = _ref6;
7413      return name === patternName;
7414    });
7415  
7416    if (!pattern) {
7417      return null;
7418    }
7419  
7420    return { ...pattern,
7421      blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, {
7422        __unstableSkipMigrationLogs: true
7423      })
7424    };
7425  }, state => [state.settings.__experimentalBlockPatterns]);
7426  const getAllAllowedPatterns = rememo(state => {
7427    const patterns = state.settings.__experimentalBlockPatterns;
7428    const {
7429      allowedBlockTypes
7430    } = getSettings(state);
7431    const parsedPatterns = patterns.filter(_ref7 => {
7432      let {
7433        inserter = true
7434      } = _ref7;
7435      return !!inserter;
7436    }).map(_ref8 => {
7437      let {
7438        name
7439      } = _ref8;
7440      return __experimentalGetParsedPattern(state, name);
7441    });
7442    const allowedPatterns = parsedPatterns.filter(_ref9 => {
7443      let {
7444        blocks
7445      } = _ref9;
7446      return checkAllowListRecursive(blocks, allowedBlockTypes);
7447    });
7448    return allowedPatterns;
7449  }, state => [state.settings.__experimentalBlockPatterns, state.settings.allowedBlockTypes]);
7450  /**
7451   * Returns the list of allowed patterns for inner blocks children.
7452   *
7453   * @param {Object}  state        Editor state.
7454   * @param {?string} rootClientId Optional target root client ID.
7455   *
7456   * @return {Array?} The list of allowed patterns.
7457   */
7458  
7459  const __experimentalGetAllowedPatterns = rememo(function (state) {
7460    let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
7461    const availableParsedPatterns = getAllAllowedPatterns(state);
7462    const patternsAllowed = (0,external_lodash_namespaceObject.filter)(availableParsedPatterns, _ref10 => {
7463      let {
7464        blocks
7465      } = _ref10;
7466      return blocks.every(_ref11 => {
7467        let {
7468          name
7469        } = _ref11;
7470        return canInsertBlockType(state, name, rootClientId);
7471      });
7472    });
7473    return patternsAllowed;
7474  }, (state, rootClientId) => [state.settings.__experimentalBlockPatterns, state.settings.allowedBlockTypes, state.settings.templateLock, state.blockListSettings[rootClientId], state.blocks.byClientId[rootClientId]]);
7475  /**
7476   * Returns the list of patterns based on their declared `blockTypes`
7477   * and a block's name.
7478   * Patterns can use `blockTypes` to integrate in work flows like
7479   * suggesting appropriate patterns in a Placeholder state(during insertion)
7480   * or blocks transformations.
7481   *
7482   * @param {Object}          state        Editor state.
7483   * @param {string|string[]} blockNames   Block's name or array of block names to find matching pattens.
7484   * @param {?string}         rootClientId Optional target root client ID.
7485   *
7486   * @return {Array} The list of matched block patterns based on declared `blockTypes` and block name.
7487   */
7488  
7489  const __experimentalGetPatternsByBlockTypes = rememo(function (state, blockNames) {
7490    let rootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
7491    if (!blockNames) return EMPTY_ARRAY;
7492  
7493    const patterns = __experimentalGetAllowedPatterns(state, rootClientId);
7494  
7495    const normalizedBlockNames = Array.isArray(blockNames) ? blockNames : [blockNames];
7496    return patterns.filter(pattern => {
7497      var _pattern$blockTypes, _pattern$blockTypes$s;
7498  
7499      return pattern === null || pattern === void 0 ? void 0 : (_pattern$blockTypes = pattern.blockTypes) === null || _pattern$blockTypes === void 0 ? void 0 : (_pattern$blockTypes$s = _pattern$blockTypes.some) === null || _pattern$blockTypes$s === void 0 ? void 0 : _pattern$blockTypes$s.call(_pattern$blockTypes, blockName => normalizedBlockNames.includes(blockName));
7500    });
7501  }, (state, rootClientId) => [...__experimentalGetAllowedPatterns.getDependants(state, rootClientId)]);
7502  /**
7503   * Determines the items that appear in the available pattern transforms list.
7504   *
7505   * For now we only handle blocks without InnerBlocks and take into account
7506   * the `__experimentalRole` property of blocks' attributes for the transformation.
7507   *
7508   * We return the first set of possible eligible block patterns,
7509   * by checking the `blockTypes` property. We still have to recurse through
7510   * block pattern's blocks and try to find matches from the selected blocks.
7511   * Now this happens in the consumer to avoid heavy operations in the selector.
7512   *
7513   * @param {Object}   state        Editor state.
7514   * @param {Object[]} blocks       The selected blocks.
7515   * @param {?string}  rootClientId Optional root client ID of block list.
7516   *
7517   * @return {WPBlockPattern[]} Items that are eligible for a pattern transformation.
7518   */
7519  
7520  const __experimentalGetPatternTransformItems = rememo(function (state, blocks) {
7521    let rootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
7522    if (!blocks) return EMPTY_ARRAY;
7523    /**
7524     * For now we only handle blocks without InnerBlocks and take into account
7525     * the `__experimentalRole` property of blocks' attributes for the transformation.
7526     * Note that the blocks have been retrieved through `getBlock`, which doesn't
7527     * return the inner blocks of an inner block controller, so we still need
7528     * to check for this case too.
7529     */
7530  
7531    if (blocks.some(_ref12 => {
7532      let {
7533        clientId,
7534        innerBlocks
7535      } = _ref12;
7536      return innerBlocks.length || areInnerBlocksControlled(state, clientId);
7537    })) {
7538      return EMPTY_ARRAY;
7539    } // Create a Set of the selected block names that is used in patterns filtering.
7540  
7541  
7542    const selectedBlockNames = Array.from(new Set(blocks.map(_ref13 => {
7543      let {
7544        name
7545      } = _ref13;
7546      return name;
7547    })));
7548    /**
7549     * Here we will return first set of possible eligible block patterns,
7550     * by checking the `blockTypes` property. We still have to recurse through
7551     * block pattern's blocks and try to find matches from the selected blocks.
7552     * Now this happens in the consumer to avoid heavy operations in the selector.
7553     */
7554  
7555    return __experimentalGetPatternsByBlockTypes(state, selectedBlockNames, rootClientId);
7556  }, (state, rootClientId) => [...__experimentalGetPatternsByBlockTypes.getDependants(state, rootClientId)]);
7557  /**
7558   * Returns the Block List settings of a block, if any exist.
7559   *
7560   * @param {Object}  state    Editor state.
7561   * @param {?string} clientId Block client ID.
7562   *
7563   * @return {?Object} Block settings of the block if set.
7564   */
7565  
7566  function getBlockListSettings(state, clientId) {
7567    return state.blockListSettings[clientId];
7568  }
7569  /**
7570   * Returns the editor settings.
7571   *
7572   * @param {Object} state Editor state.
7573   *
7574   * @return {Object} The editor settings object.
7575   */
7576  
7577  function getSettings(state) {
7578    return state.settings;
7579  }
7580  /**
7581   * Returns true if the most recent block change is be considered persistent, or
7582   * false otherwise. A persistent change is one committed by BlockEditorProvider
7583   * via its `onChange` callback, in addition to `onInput`.
7584   *
7585   * @param {Object} state Block editor state.
7586   *
7587   * @return {boolean} Whether the most recent block change was persistent.
7588   */
7589  
7590  function isLastBlockChangePersistent(state) {
7591    return state.blocks.isPersistentChange;
7592  }
7593  /**
7594   * Returns the block list settings for an array of blocks, if any exist.
7595   *
7596   * @param {Object} state     Editor state.
7597   * @param {Array}  clientIds Block client IDs.
7598   *
7599   * @return {Object} An object where the keys are client ids and the values are
7600   *                  a block list setting object.
7601   */
7602  
7603  const __experimentalGetBlockListSettingsForBlocks = rememo(function (state) {
7604    let clientIds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
7605    return clientIds.reduce((blockListSettingsForBlocks, clientId) => {
7606      if (!state.blockListSettings[clientId]) {
7607        return blockListSettingsForBlocks;
7608      }
7609  
7610      return { ...blockListSettingsForBlocks,
7611        [clientId]: state.blockListSettings[clientId]
7612      };
7613    }, {});
7614  }, state => [state.blockListSettings]);
7615  /**
7616   * Returns the title of a given reusable block
7617   *
7618   * @param {Object}        state Global application state.
7619   * @param {number|string} ref   The shared block's ID.
7620   *
7621   * @return {string} The reusable block saved title.
7622   */
7623  
7624  const __experimentalGetReusableBlockTitle = rememo((state, ref) => {
7625    var _reusableBlock$title;
7626  
7627    const reusableBlock = (0,external_lodash_namespaceObject.find)(getReusableBlocks(state), block => block.id === ref);
7628  
7629    if (!reusableBlock) {
7630      return null;
7631    }
7632  
7633    return (_reusableBlock$title = reusableBlock.title) === null || _reusableBlock$title === void 0 ? void 0 : _reusableBlock$title.raw;
7634  }, state => [getReusableBlocks(state)]);
7635  /**
7636   * Returns true if the most recent block change is be considered ignored, or
7637   * false otherwise. An ignored change is one not to be committed by
7638   * BlockEditorProvider, neither via `onChange` nor `onInput`.
7639   *
7640   * @param {Object} state Block editor state.
7641   *
7642   * @return {boolean} Whether the most recent block change was ignored.
7643   */
7644  
7645  function __unstableIsLastBlockChangeIgnored(state) {
7646    // TODO: Removal Plan: Changes incurred by RECEIVE_BLOCKS should not be
7647    // ignored if in-fact they result in a change in blocks state. The current
7648    // need to ignore changes not a result of user interaction should be
7649    // accounted for in the refactoring of reusable blocks as occurring within
7650    // their own separate block editor / state (#7119).
7651    return state.blocks.isIgnoredChange;
7652  }
7653  /**
7654   * Returns the block attributes changed as a result of the last dispatched
7655   * action.
7656   *
7657   * @param {Object} state Block editor state.
7658   *
7659   * @return {Object<string,Object>} Subsets of block attributes changed, keyed
7660   *                                 by block client ID.
7661   */
7662  
7663  function __experimentalGetLastBlockAttributeChanges(state) {
7664    return state.lastBlockAttributesChange;
7665  }
7666  /**
7667   * Returns the available reusable blocks
7668   *
7669   * @param {Object} state Global application state.
7670   *
7671   * @return {Array} Reusable blocks
7672   */
7673  
7674  function getReusableBlocks(state) {
7675    var _state$settings$__exp, _state$settings2;
7676  
7677    return (_state$settings$__exp = state === null || state === void 0 ? void 0 : (_state$settings2 = state.settings) === null || _state$settings2 === void 0 ? void 0 : _state$settings2.__experimentalReusableBlocks) !== null && _state$settings$__exp !== void 0 ? _state$settings$__exp : EMPTY_ARRAY;
7678  }
7679  /**
7680   * Returns whether the navigation mode is enabled.
7681   *
7682   * @param {Object} state Editor state.
7683   *
7684   * @return {boolean} Is navigation mode enabled.
7685   */
7686  
7687  
7688  function selectors_isNavigationMode(state) {
7689    return state.isNavigationMode;
7690  }
7691  /**
7692   * Returns whether block moving mode is enabled.
7693   *
7694   * @param {Object} state Editor state.
7695   *
7696   * @return {string} Client Id of moving block.
7697   */
7698  
7699  function selectors_hasBlockMovingClientId(state) {
7700    return state.hasBlockMovingClientId;
7701  }
7702  /**
7703   * Returns true if the last change was an automatic change, false otherwise.
7704   *
7705   * @param {Object} state Global application state.
7706   *
7707   * @return {boolean} Whether the last change was automatic.
7708   */
7709  
7710  function didAutomaticChange(state) {
7711    return !!state.automaticChangeStatus;
7712  }
7713  /**
7714   * Returns true if the current highlighted block matches the block clientId.
7715   *
7716   * @param {Object} state    Global application state.
7717   * @param {string} clientId The block to check.
7718   *
7719   * @return {boolean} Whether the block is currently highlighted.
7720   */
7721  
7722  function isBlockHighlighted(state, clientId) {
7723    return state.highlightedBlock === clientId;
7724  }
7725  /**
7726   * Checks if a given block has controlled inner blocks.
7727   *
7728   * @param {Object} state    Global application state.
7729   * @param {string} clientId The block to check.
7730   *
7731   * @return {boolean} True if the block has controlled inner blocks.
7732   */
7733  
7734  function areInnerBlocksControlled(state, clientId) {
7735    return !!state.blocks.controlledInnerBlocks[clientId];
7736  }
7737  /**
7738   * Returns the clientId for the first 'active' block of a given array of block names.
7739   * A block is 'active' if it (or a child) is the selected block.
7740   * Returns the first match moving up the DOM from the selected block.
7741   *
7742   * @param {Object}   state            Global application state.
7743   * @param {string[]} validBlocksNames The names of block types to check for.
7744   *
7745   * @return {string} The matching block's clientId.
7746   */
7747  
7748  const __experimentalGetActiveBlockIdByBlockNames = rememo((state, validBlockNames) => {
7749    if (!validBlockNames.length) {
7750      return null;
7751    } // Check if selected block is a valid entity area.
7752  
7753  
7754    const selectedBlockClientId = getSelectedBlockClientId(state);
7755  
7756    if (validBlockNames.includes(getBlockName(state, selectedBlockClientId))) {
7757      return selectedBlockClientId;
7758    } // Check if first selected block is a child of a valid entity area.
7759  
7760  
7761    const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(state);
7762    const entityAreaParents = getBlockParentsByBlockName(state, selectedBlockClientId || multiSelectedBlockClientIds[0], validBlockNames);
7763  
7764    if (entityAreaParents) {
7765      // Last parent closest/most interior.
7766      return (0,external_lodash_namespaceObject.last)(entityAreaParents);
7767    }
7768  
7769    return null;
7770  }, (state, validBlockNames) => [state.selection.selectionStart.clientId, state.selection.selectionEnd.clientId, validBlockNames]);
7771  /**
7772   * Tells if the block with the passed clientId was just inserted.
7773   *
7774   * @param {Object}  state    Global application state.
7775   * @param {Object}  clientId Client Id of the block.
7776   * @param {?string} source   Optional insertion source of the block.
7777   * @return {boolean} True if the block matches the last block inserted from the specified source.
7778   */
7779  
7780  function wasBlockJustInserted(state, clientId, source) {
7781    const {
7782      lastBlockInserted
7783    } = state;
7784    return lastBlockInserted.clientId === clientId && lastBlockInserted.source === source;
7785  }
7786  
7787  ;// CONCATENATED MODULE: external ["wp","a11y"]
7788  var external_wp_a11y_namespaceObject = window["wp"]["a11y"];
7789  ;// CONCATENATED MODULE: external ["wp","deprecated"]
7790  var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
7791  var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
7792  ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/actions.js
7793  /**
7794   * External dependencies
7795   */
7796  
7797  /**
7798   * WordPress dependencies
7799   */
7800  
7801  
7802  
7803  
7804  
7805  
7806  /**
7807   * Internal dependencies
7808   */
7809  
7810  
7811  /**
7812   * Action which will insert a default block insert action if there
7813   * are no other blocks at the root of the editor. This action should be used
7814   * in actions which may result in no blocks remaining in the editor (removal,
7815   * replacement, etc).
7816   */
7817  
7818  const ensureDefaultBlock = () => _ref => {
7819    let {
7820      select,
7821      dispatch
7822    } = _ref;
7823    // To avoid a focus loss when removing the last block, assure there is
7824    // always a default block if the last of the blocks have been removed.
7825    const count = select.getBlockCount();
7826  
7827    if (count > 0) {
7828      return;
7829    } // If there's an custom appender, don't insert default block.
7830    // We have to remember to manually move the focus elsewhere to
7831    // prevent it from being lost though.
7832  
7833  
7834    const {
7835      __unstableHasCustomAppender
7836    } = select.getSettings();
7837  
7838    if (__unstableHasCustomAppender) {
7839      return;
7840    }
7841  
7842    dispatch.insertDefaultBlock();
7843  };
7844  /**
7845   * Action that resets blocks state to the specified array of blocks, taking precedence
7846   * over any other content reflected as an edit in state.
7847   *
7848   * @param {Array} blocks Array of blocks.
7849   */
7850  
7851  
7852  const resetBlocks = blocks => _ref2 => {
7853    let {
7854      dispatch
7855    } = _ref2;
7856    dispatch({
7857      type: 'RESET_BLOCKS',
7858      blocks
7859    });
7860    dispatch(validateBlocksToTemplate(blocks));
7861  };
7862  /**
7863   * Block validity is a function of blocks state (at the point of a
7864   * reset) and the template setting. As a compromise to its placement
7865   * across distinct parts of state, it is implemented here as a side-
7866   * effect of the block reset action.
7867   *
7868   * @param {Array} blocks Array of blocks.
7869   */
7870  
7871  const validateBlocksToTemplate = blocks => _ref3 => {
7872    let {
7873      select,
7874      dispatch
7875    } = _ref3;
7876    const template = select.getTemplate();
7877    const templateLock = select.getTemplateLock(); // Unlocked templates are considered always valid because they act
7878    // as default values only.
7879  
7880    const isBlocksValidToTemplate = !template || templateLock !== 'all' || (0,external_wp_blocks_namespaceObject.doBlocksMatchTemplate)(blocks, template); // Update if validity has changed.
7881  
7882    const isValidTemplate = select.isValidTemplate();
7883  
7884    if (isBlocksValidToTemplate !== isValidTemplate) {
7885      dispatch.setTemplateValidity(isBlocksValidToTemplate);
7886      return isBlocksValidToTemplate;
7887    }
7888  };
7889  /**
7890   * A block selection object.
7891   *
7892   * @typedef {Object} WPBlockSelection
7893   *
7894   * @property {string} clientId     A block client ID.
7895   * @property {string} attributeKey A block attribute key.
7896   * @property {number} offset       An attribute value offset, based on the rich
7897   *                                 text value. See `wp.richText.create`.
7898   */
7899  
7900  /**
7901   * A selection object.
7902   *
7903   * @typedef {Object} WPSelection
7904   *
7905   * @property {WPBlockSelection} start The selection start.
7906   * @property {WPBlockSelection} end   The selection end.
7907   */
7908  
7909  /* eslint-disable jsdoc/valid-types */
7910  
7911  /**
7912   * Returns an action object used in signalling that selection state should be
7913   * reset to the specified selection.
7914   *
7915   * @param {WPBlockSelection} selectionStart  The selection start.
7916   * @param {WPBlockSelection} selectionEnd    The selection end.
7917   * @param {0|-1|null}        initialPosition Initial block position.
7918   *
7919   * @return {Object} Action object.
7920   */
7921  
7922  function resetSelection(selectionStart, selectionEnd, initialPosition) {
7923    /* eslint-enable jsdoc/valid-types */
7924    return {
7925      type: 'RESET_SELECTION',
7926      selectionStart,
7927      selectionEnd,
7928      initialPosition
7929    };
7930  }
7931  /**
7932   * Returns an action object used in signalling that blocks have been received.
7933   * Unlike resetBlocks, these should be appended to the existing known set, not
7934   * replacing.
7935   *
7936   * @deprecated
7937   *
7938   * @param {Object[]} blocks Array of block objects.
7939   *
7940   * @return {Object} Action object.
7941   */
7942  
7943  function receiveBlocks(blocks) {
7944    external_wp_deprecated_default()('wp.data.dispatch( "core/block-editor" ).receiveBlocks', {
7945      since: '5.9',
7946      alternative: 'resetBlocks or insertBlocks'
7947    });
7948    return {
7949      type: 'RECEIVE_BLOCKS',
7950      blocks
7951    };
7952  }
7953  /**
7954   * Action that updates attributes of multiple blocks with the specified client IDs.
7955   *
7956   * @param {string|string[]} clientIds     Block client IDs.
7957   * @param {Object}          attributes    Block attributes to be merged. Should be keyed by clientIds if
7958   *                                        uniqueByBlock is true.
7959   * @param {boolean}         uniqueByBlock true if each block in clientIds array has a unique set of attributes
7960   * @return {Object} Action object.
7961   */
7962  
7963  function updateBlockAttributes(clientIds, attributes) {
7964    let uniqueByBlock = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7965    return {
7966      type: 'UPDATE_BLOCK_ATTRIBUTES',
7967      clientIds: (0,external_lodash_namespaceObject.castArray)(clientIds),
7968      attributes,
7969      uniqueByBlock
7970    };
7971  }
7972  /**
7973   * Action that updates the block with the specified client ID.
7974   *
7975   * @param {string} clientId Block client ID.
7976   * @param {Object} updates  Block attributes to be merged.
7977   *
7978   * @return {Object} Action object.
7979   */
7980  
7981  function updateBlock(clientId, updates) {
7982    return {
7983      type: 'UPDATE_BLOCK',
7984      clientId,
7985      updates
7986    };
7987  }
7988  /* eslint-disable jsdoc/valid-types */
7989  
7990  /**
7991   * Returns an action object used in signalling that the block with the
7992   * specified client ID has been selected, optionally accepting a position
7993   * value reflecting its selection directionality. An initialPosition of -1
7994   * reflects a reverse selection.
7995   *
7996   * @param {string}    clientId        Block client ID.
7997   * @param {0|-1|null} initialPosition Optional initial position. Pass as -1 to
7998   *                                    reflect reverse selection.
7999   *
8000   * @return {Object} Action object.
8001   */
8002  
8003  function selectBlock(clientId) {
8004    let initialPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
8005  
8006    /* eslint-enable jsdoc/valid-types */
8007    return {
8008      type: 'SELECT_BLOCK',
8009      initialPosition,
8010      clientId
8011    };
8012  }
8013  /**
8014   * Yields action objects used in signalling that the block preceding the given
8015   * clientId should be selected.
8016   *
8017   * @param {string} clientId Block client ID.
8018   */
8019  
8020  const selectPreviousBlock = clientId => _ref4 => {
8021    let {
8022      select,
8023      dispatch
8024    } = _ref4;
8025    const previousBlockClientId = select.getPreviousBlockClientId(clientId);
8026  
8027    if (previousBlockClientId) {
8028      dispatch.selectBlock(previousBlockClientId, -1);
8029    }
8030  };
8031  /**
8032   * Yields action objects used in signalling that the block following the given
8033   * clientId should be selected.
8034   *
8035   * @param {string} clientId Block client ID.
8036   */
8037  
8038  const selectNextBlock = clientId => _ref5 => {
8039    let {
8040      select,
8041      dispatch
8042    } = _ref5;
8043    const nextBlockClientId = select.getNextBlockClientId(clientId);
8044  
8045    if (nextBlockClientId) {
8046      dispatch.selectBlock(nextBlockClientId);
8047    }
8048  };
8049  /**
8050   * Action that starts block multi-selection.
8051   *
8052   * @return {Object} Action object.
8053   */
8054  
8055  function startMultiSelect() {
8056    return {
8057      type: 'START_MULTI_SELECT'
8058    };
8059  }
8060  /**
8061   * Action that stops block multi-selection.
8062   *
8063   * @return {Object} Action object.
8064   */
8065  
8066  function stopMultiSelect() {
8067    return {
8068      type: 'STOP_MULTI_SELECT'
8069    };
8070  }
8071  /**
8072   * Action that changes block multi-selection.
8073   *
8074   * @param {string}      start                         First block of the multi selection.
8075   * @param {string}      end                           Last block of the multiselection.
8076   * @param {number|null} __experimentalInitialPosition Optional initial position. Pass as null to skip focus within editor canvas.
8077   */
8078  
8079  const multiSelect = function (start, end) {
8080    let __experimentalInitialPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
8081  
8082    return _ref6 => {
8083      let {
8084        select,
8085        dispatch
8086      } = _ref6;
8087      const startBlockRootClientId = select.getBlockRootClientId(start);
8088      const endBlockRootClientId = select.getBlockRootClientId(end); // Only allow block multi-selections at the same level.
8089  
8090      if (startBlockRootClientId !== endBlockRootClientId) {
8091        return;
8092      }
8093  
8094      dispatch({
8095        type: 'MULTI_SELECT',
8096        start,
8097        end,
8098        initialPosition: __experimentalInitialPosition
8099      });
8100      const blockCount = select.getSelectedBlockCount();
8101      (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)(
8102      /* translators: %s: number of selected blocks */
8103      (0,external_wp_i18n_namespaceObject._n)('%s block selected.', '%s blocks selected.', blockCount), blockCount), 'assertive');
8104    };
8105  };
8106  /**
8107   * Action that clears the block selection.
8108   *
8109   * @return {Object} Action object.
8110   */
8111  
8112  function clearSelectedBlock() {
8113    return {
8114      type: 'CLEAR_SELECTED_BLOCK'
8115    };
8116  }
8117  /**
8118   * Action that enables or disables block selection.
8119   *
8120   * @param {boolean} [isSelectionEnabled=true] Whether block selection should
8121   *                                            be enabled.
8122   *
8123   * @return {Object} Action object.
8124   */
8125  
8126  function toggleSelection() {
8127    let isSelectionEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
8128    return {
8129      type: 'TOGGLE_SELECTION',
8130      isSelectionEnabled
8131    };
8132  }
8133  
8134  function getBlocksWithDefaultStylesApplied(blocks, blockEditorSettings) {
8135    var _blockEditorSettings$, _blockEditorSettings$2;
8136  
8137    const preferredStyleVariations = (_blockEditorSettings$ = blockEditorSettings === null || blockEditorSettings === void 0 ? void 0 : (_blockEditorSettings$2 = blockEditorSettings.__experimentalPreferredStyleVariations) === null || _blockEditorSettings$2 === void 0 ? void 0 : _blockEditorSettings$2.value) !== null && _blockEditorSettings$ !== void 0 ? _blockEditorSettings$ : {};
8138    return blocks.map(block => {
8139      var _block$attributes;
8140  
8141      const blockName = block.name;
8142  
8143      if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'defaultStylePicker', true)) {
8144        return block;
8145      }
8146  
8147      if (!preferredStyleVariations[blockName]) {
8148        return block;
8149      }
8150  
8151      const className = (_block$attributes = block.attributes) === null || _block$attributes === void 0 ? void 0 : _block$attributes.className;
8152  
8153      if (className !== null && className !== void 0 && className.includes('is-style-')) {
8154        return block;
8155      }
8156  
8157      const {
8158        attributes = {}
8159      } = block;
8160      const blockStyle = preferredStyleVariations[blockName];
8161      return { ...block,
8162        attributes: { ...attributes,
8163          className: `$className || ''} is-style-$blockStyle}`.trim()
8164        }
8165      };
8166    });
8167  }
8168  /* eslint-disable jsdoc/valid-types */
8169  
8170  /**
8171   * Action that replaces given blocks with one or more replacement blocks.
8172   *
8173   * @param {(string|string[])} clientIds       Block client ID(s) to replace.
8174   * @param {(Object|Object[])} blocks          Replacement block(s).
8175   * @param {number}            indexToSelect   Index of replacement block to select.
8176   * @param {0|-1|null}         initialPosition Index of caret after in the selected block after the operation.
8177   * @param {?Object}           meta            Optional Meta values to be passed to the action object.
8178   *
8179   * @return {Object} Action object.
8180   */
8181  
8182  
8183  const replaceBlocks = function (clientIds, blocks, indexToSelect) {
8184    let initialPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
8185    let meta = arguments.length > 4 ? arguments[4] : undefined;
8186    return _ref7 => {
8187      let {
8188        select,
8189        dispatch
8190      } = _ref7;
8191  
8192      /* eslint-enable jsdoc/valid-types */
8193      clientIds = (0,external_lodash_namespaceObject.castArray)(clientIds);
8194      blocks = getBlocksWithDefaultStylesApplied((0,external_lodash_namespaceObject.castArray)(blocks), select.getSettings());
8195      const rootClientId = select.getBlockRootClientId((0,external_lodash_namespaceObject.first)(clientIds)); // Replace is valid if the new blocks can be inserted in the root block.
8196  
8197      for (let index = 0; index < blocks.length; index++) {
8198        const block = blocks[index];
8199        const canInsertBlock = select.canInsertBlockType(block.name, rootClientId);
8200  
8201        if (!canInsertBlock) {
8202          return;
8203        }
8204      }
8205  
8206      dispatch({
8207        type: 'REPLACE_BLOCKS',
8208        clientIds,
8209        blocks,
8210        time: Date.now(),
8211        indexToSelect,
8212        initialPosition,
8213        meta
8214      });
8215      dispatch(ensureDefaultBlock());
8216    };
8217  };
8218  /**
8219   * Action that replaces a single block with one or more replacement blocks.
8220   *
8221   * @param {(string|string[])} clientId Block client ID to replace.
8222   * @param {(Object|Object[])} block    Replacement block(s).
8223   *
8224   * @return {Object} Action object.
8225   */
8226  
8227  function replaceBlock(clientId, block) {
8228    return replaceBlocks(clientId, block);
8229  }
8230  /**
8231   * Higher-order action creator which, given the action type to dispatch creates
8232   * an action creator for managing block movement.
8233   *
8234   * @param {string} type Action type to dispatch.
8235   *
8236   * @return {Function} Action creator.
8237   */
8238  
8239  const createOnMove = type => (clientIds, rootClientId) => _ref8 => {
8240    let {
8241      select,
8242      dispatch
8243    } = _ref8;
8244    // If one of the blocks is locked or the parent is locked, we cannot move any block.
8245    const canMoveBlocks = select.canMoveBlocks(clientIds, rootClientId);
8246  
8247    if (!canMoveBlocks) {
8248      return;
8249    }
8250  
8251    dispatch({
8252      type,
8253      clientIds: (0,external_lodash_namespaceObject.castArray)(clientIds),
8254      rootClientId
8255    });
8256  };
8257  
8258  const moveBlocksDown = createOnMove('MOVE_BLOCKS_DOWN');
8259  const moveBlocksUp = createOnMove('MOVE_BLOCKS_UP');
8260  /**
8261   * Action that moves given blocks to a new position.
8262   *
8263   * @param {?string} clientIds        The client IDs of the blocks.
8264   * @param {?string} fromRootClientId Root client ID source.
8265   * @param {?string} toRootClientId   Root client ID destination.
8266   * @param {number}  index            The index to move the blocks to.
8267   */
8268  
8269  const moveBlocksToPosition = function (clientIds) {
8270    let fromRootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
8271    let toRootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
8272    let index = arguments.length > 3 ? arguments[3] : undefined;
8273    return _ref9 => {
8274      let {
8275        select,
8276        dispatch
8277      } = _ref9;
8278      const canMoveBlocks = select.canMoveBlocks(clientIds, fromRootClientId); // If one of the blocks is locked or the parent is locked, we cannot move any block.
8279  
8280      if (!canMoveBlocks) {
8281        return;
8282      } // If moving inside the same root block the move is always possible.
8283  
8284  
8285      if (fromRootClientId !== toRootClientId) {
8286        const canRemoveBlocks = select.canRemoveBlocks(clientIds, fromRootClientId); // If we're moving to another block, it means we're deleting blocks from
8287        // the original block, so we need to check if removing is possible.
8288  
8289        if (!canRemoveBlocks) {
8290          return;
8291        }
8292  
8293        const canInsertBlocks = select.canInsertBlocks(clientIds, toRootClientId); // If moving to other parent block, the move is possible if we can insert a block of the same type inside the new parent block.
8294  
8295        if (!canInsertBlocks) {
8296          return;
8297        }
8298      }
8299  
8300      dispatch({
8301        type: 'MOVE_BLOCKS_TO_POSITION',
8302        fromRootClientId,
8303        toRootClientId,
8304        clientIds,
8305        index
8306      });
8307    };
8308  };
8309  /**
8310   * Action that moves given block to a new position.
8311   *
8312   * @param {?string} clientId         The client ID of the block.
8313   * @param {?string} fromRootClientId Root client ID source.
8314   * @param {?string} toRootClientId   Root client ID destination.
8315   * @param {number}  index            The index to move the block to.
8316   */
8317  
8318  function moveBlockToPosition(clientId) {
8319    let fromRootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
8320    let toRootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
8321    let index = arguments.length > 3 ? arguments[3] : undefined;
8322    return moveBlocksToPosition([clientId], fromRootClientId, toRootClientId, index);
8323  }
8324  /**
8325   * Action that inserts a single block, optionally at a specific index respective a root block list.
8326   *
8327   * @param {Object}   block           Block object to insert.
8328   * @param {?number}  index           Index at which block should be inserted.
8329   * @param {?string}  rootClientId    Optional root client ID of block list on which to insert.
8330   * @param {?boolean} updateSelection If true block selection will be updated. If false, block selection will not change. Defaults to true.
8331   * @param {?Object}  meta            Optional Meta values to be passed to the action object.
8332   *
8333   * @return {Object} Action object.
8334   */
8335  
8336  function insertBlock(block, index, rootClientId, updateSelection, meta) {
8337    return insertBlocks([block], index, rootClientId, updateSelection, 0, meta);
8338  }
8339  /* eslint-disable jsdoc/valid-types */
8340  
8341  /**
8342   * Action that inserts an array of blocks, optionally at a specific index respective a root block list.
8343   *
8344   * @param {Object[]}  blocks          Block objects to insert.
8345   * @param {?number}   index           Index at which block should be inserted.
8346   * @param {?string}   rootClientId    Optional root client ID of block list on which to insert.
8347   * @param {?boolean}  updateSelection If true block selection will be updated.  If false, block selection will not change. Defaults to true.
8348   * @param {0|-1|null} initialPosition Initial focus position. Setting it to null prevent focusing the inserted block.
8349   * @param {?Object}   meta            Optional Meta values to be passed to the action object.
8350   * @return {Object} Action object.
8351   */
8352  
8353  const insertBlocks = function (blocks, index, rootClientId) {
8354    let updateSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
8355    let initialPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
8356    let meta = arguments.length > 5 ? arguments[5] : undefined;
8357    return _ref10 => {
8358      let {
8359        select,
8360        dispatch
8361      } = _ref10;
8362  
8363      /* eslint-enable jsdoc/valid-types */
8364      if ((0,external_lodash_namespaceObject.isObject)(initialPosition)) {
8365        meta = initialPosition;
8366        initialPosition = 0;
8367        external_wp_deprecated_default()("meta argument in wp.data.dispatch('core/block-editor')", {
8368          since: '5.8',
8369          hint: 'The meta argument is now the 6th argument of the function'
8370        });
8371      }
8372  
8373      blocks = getBlocksWithDefaultStylesApplied((0,external_lodash_namespaceObject.castArray)(blocks), select.getSettings());
8374      const allowedBlocks = [];
8375  
8376      for (const block of blocks) {
8377        const isValid = select.canInsertBlockType(block.name, rootClientId);
8378  
8379        if (isValid) {
8380          allowedBlocks.push(block);
8381        }
8382      }
8383  
8384      if (allowedBlocks.length) {
8385        dispatch({
8386          type: 'INSERT_BLOCKS',
8387          blocks: allowedBlocks,
8388          index,
8389          rootClientId,
8390          time: Date.now(),
8391          updateSelection,
8392          initialPosition: updateSelection ? initialPosition : null,
8393          meta
8394        });
8395      }
8396    };
8397  };
8398  /**
8399   * Action that shows the insertion point.
8400   *
8401   * @param {?string} rootClientId      Optional root client ID of block list on
8402   *                                    which to insert.
8403   * @param {?number} index             Index at which block should be inserted.
8404   * @param {Object}  __unstableOptions Whether or not to show an inserter button.
8405   *
8406   * @return {Object} Action object.
8407   */
8408  
8409  function showInsertionPoint(rootClientId, index) {
8410    let __unstableOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
8411  
8412    const {
8413      __unstableWithInserter
8414    } = __unstableOptions;
8415    return {
8416      type: 'SHOW_INSERTION_POINT',
8417      rootClientId,
8418      index,
8419      __unstableWithInserter
8420    };
8421  }
8422  /**
8423   * Action that hides the insertion point.
8424   *
8425   * @return {Object} Action object.
8426   */
8427  
8428  function hideInsertionPoint() {
8429    return {
8430      type: 'HIDE_INSERTION_POINT'
8431    };
8432  }
8433  /**
8434   * Action that resets the template validity.
8435   *
8436   * @param {boolean} isValid template validity flag.
8437   *
8438   * @return {Object} Action object.
8439   */
8440  
8441  function setTemplateValidity(isValid) {
8442    return {
8443      type: 'SET_TEMPLATE_VALIDITY',
8444      isValid
8445    };
8446  }
8447  /**
8448   * Action that synchronizes the template with the list of blocks.
8449   *
8450   * @return {Object} Action object.
8451   */
8452  
8453  const synchronizeTemplate = () => _ref11 => {
8454    let {
8455      select,
8456      dispatch
8457    } = _ref11;
8458    dispatch({
8459      type: 'SYNCHRONIZE_TEMPLATE'
8460    });
8461    const blocks = select.getBlocks();
8462    const template = select.getTemplate();
8463    const updatedBlockList = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(blocks, template);
8464    dispatch.resetBlocks(updatedBlockList);
8465  };
8466  /**
8467   * Delete the current selection.
8468   *
8469   * @param {boolean} isForward
8470   */
8471  
8472  const __unstableDeleteSelection = isForward => _ref12 => {
8473    let {
8474      registry,
8475      select,
8476      dispatch
8477    } = _ref12;
8478    const selectionAnchor = select.getSelectionStart();
8479    const selectionFocus = select.getSelectionEnd();
8480    if (selectionAnchor.clientId === selectionFocus.clientId) return; // It's not mergeable if there's no rich text selection.
8481  
8482    if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') return false;
8483    const anchorRootClientId = select.getBlockRootClientId(selectionAnchor.clientId);
8484    const focusRootClientId = select.getBlockRootClientId(selectionFocus.clientId); // It's not mergeable if the selection doesn't start and end in the same
8485    // block list. Maybe in the future it should be allowed.
8486  
8487    if (anchorRootClientId !== focusRootClientId) {
8488      return;
8489    }
8490  
8491    const blockOrder = select.getBlockOrder(anchorRootClientId);
8492    const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId);
8493    const focusIndex = blockOrder.indexOf(selectionFocus.clientId); // Reassign selection start and end based on order.
8494  
8495    let selectionStart, selectionEnd;
8496  
8497    if (anchorIndex > focusIndex) {
8498      selectionStart = selectionFocus;
8499      selectionEnd = selectionAnchor;
8500    } else {
8501      selectionStart = selectionAnchor;
8502      selectionEnd = selectionFocus;
8503    }
8504  
8505    const targetSelection = isForward ? selectionEnd : selectionStart;
8506    const targetBlock = select.getBlock(targetSelection.clientId);
8507    const targetBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(targetBlock.name);
8508  
8509    if (!targetBlockType.merge) {
8510      return;
8511    }
8512  
8513    const selectionA = selectionStart;
8514    const selectionB = selectionEnd;
8515    const blockA = select.getBlock(selectionA.clientId);
8516    const blockAType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockA.name);
8517    const blockB = select.getBlock(selectionB.clientId);
8518    const blockBType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockB.name);
8519    const htmlA = blockA.attributes[selectionA.attributeKey];
8520    const htmlB = blockB.attributes[selectionB.attributeKey];
8521    const attributeDefinitionA = blockAType.attributes[selectionA.attributeKey];
8522    const attributeDefinitionB = blockBType.attributes[selectionB.attributeKey];
8523    let valueA = (0,external_wp_richText_namespaceObject.create)({
8524      html: htmlA,
8525      ...mapRichTextSettings(attributeDefinitionA)
8526    });
8527    let valueB = (0,external_wp_richText_namespaceObject.create)({
8528      html: htmlB,
8529      ...mapRichTextSettings(attributeDefinitionB)
8530    }); // A robust way to retain selection position through various transforms
8531    // is to insert a special character at the position and then recover it.
8532  
8533    const START_OF_SELECTED_AREA = '\u0086';
8534    valueA = (0,external_wp_richText_namespaceObject.remove)(valueA, selectionA.offset, valueA.text.length);
8535    valueB = (0,external_wp_richText_namespaceObject.insert)(valueB, START_OF_SELECTED_AREA, 0, selectionB.offset); // Clone the blocks so we don't manipulate the original.
8536  
8537    const cloneA = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockA, {
8538      [selectionA.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({
8539        value: valueA,
8540        ...mapRichTextSettings(attributeDefinitionA)
8541      })
8542    });
8543    const cloneB = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockB, {
8544      [selectionB.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({
8545        value: valueB,
8546        ...mapRichTextSettings(attributeDefinitionB)
8547      })
8548    });
8549    const followingBlock = isForward ? cloneA : cloneB; // We can only merge blocks with similar types
8550    // thus, we transform the block to merge first
8551  
8552    const blocksWithTheSameType = blockA.name === blockB.name ? [followingBlock] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(followingBlock, targetBlockType.name); // If the block types can not match, do nothing
8553  
8554    if (!blocksWithTheSameType || !blocksWithTheSameType.length) {
8555      return;
8556    }
8557  
8558    let updatedAttributes;
8559  
8560    if (isForward) {
8561      const blockToMerge = blocksWithTheSameType.pop();
8562      updatedAttributes = targetBlockType.merge(blockToMerge.attributes, cloneB.attributes);
8563    } else {
8564      const blockToMerge = blocksWithTheSameType.shift();
8565      updatedAttributes = targetBlockType.merge(cloneA.attributes, blockToMerge.attributes);
8566    }
8567  
8568    const newAttributeKey = (0,external_lodash_namespaceObject.findKey)(updatedAttributes, v => typeof v === 'string' && v.indexOf(START_OF_SELECTED_AREA) !== -1);
8569    const convertedHtml = updatedAttributes[newAttributeKey];
8570    const convertedValue = (0,external_wp_richText_namespaceObject.create)({
8571      html: convertedHtml,
8572      ...mapRichTextSettings(targetBlockType.attributes[newAttributeKey])
8573    });
8574    const newOffset = convertedValue.text.indexOf(START_OF_SELECTED_AREA);
8575    const newValue = (0,external_wp_richText_namespaceObject.remove)(convertedValue, newOffset, newOffset + 1);
8576    const newHtml = (0,external_wp_richText_namespaceObject.toHTMLString)({
8577      value: newValue,
8578      ...mapRichTextSettings(targetBlockType.attributes[newAttributeKey])
8579    });
8580    updatedAttributes[newAttributeKey] = newHtml;
8581    const selectedBlockClientIds = select.getSelectedBlockClientIds();
8582    const replacement = [...(isForward ? blocksWithTheSameType : []), { // Preserve the original client ID.
8583      ...targetBlock,
8584      attributes: { ...targetBlock.attributes,
8585        ...updatedAttributes
8586      }
8587    }, ...(isForward ? [] : blocksWithTheSameType)];
8588    registry.batch(() => {
8589      dispatch.selectionChange(targetBlock.clientId, newAttributeKey, newOffset, newOffset);
8590      dispatch.replaceBlocks(selectedBlockClientIds, replacement, 0, // If we don't pass the `indexToSelect` it will default to the last block.
8591      select.getSelectedBlocksInitialCaretPosition());
8592    });
8593  };
8594  /**
8595   * Split the current selection.
8596   */
8597  
8598  const __unstableSplitSelection = () => _ref13 => {
8599    let {
8600      select,
8601      dispatch
8602    } = _ref13;
8603    const selectionAnchor = select.getSelectionStart();
8604    const selectionFocus = select.getSelectionEnd();
8605    if (selectionAnchor.clientId === selectionFocus.clientId) return; // Can't split if the selection is not set.
8606  
8607    if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') return;
8608    const anchorRootClientId = select.getBlockRootClientId(selectionAnchor.clientId);
8609    const focusRootClientId = select.getBlockRootClientId(selectionFocus.clientId); // It's not splittable if the selection doesn't start and end in the same
8610    // block list. Maybe in the future it should be allowed.
8611  
8612    if (anchorRootClientId !== focusRootClientId) {
8613      return;
8614    }
8615  
8616    const blockOrder = select.getBlockOrder(anchorRootClientId);
8617    const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId);
8618    const focusIndex = blockOrder.indexOf(selectionFocus.clientId); // Reassign selection start and end based on order.
8619  
8620    let selectionStart, selectionEnd;
8621  
8622    if (anchorIndex > focusIndex) {
8623      selectionStart = selectionFocus;
8624      selectionEnd = selectionAnchor;
8625    } else {
8626      selectionStart = selectionAnchor;
8627      selectionEnd = selectionFocus;
8628    }
8629  
8630    const selectionA = selectionStart;
8631    const selectionB = selectionEnd;
8632    const blockA = select.getBlock(selectionA.clientId);
8633    const blockAType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockA.name);
8634    const blockB = select.getBlock(selectionB.clientId);
8635    const blockBType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockB.name);
8636    const htmlA = blockA.attributes[selectionA.attributeKey];
8637    const htmlB = blockB.attributes[selectionB.attributeKey];
8638    const attributeDefinitionA = blockAType.attributes[selectionA.attributeKey];
8639    const attributeDefinitionB = blockBType.attributes[selectionB.attributeKey];
8640    let valueA = (0,external_wp_richText_namespaceObject.create)({
8641      html: htmlA,
8642      ...mapRichTextSettings(attributeDefinitionA)
8643    });
8644    let valueB = (0,external_wp_richText_namespaceObject.create)({
8645      html: htmlB,
8646      ...mapRichTextSettings(attributeDefinitionB)
8647    });
8648    valueA = (0,external_wp_richText_namespaceObject.remove)(valueA, selectionA.offset, valueA.text.length);
8649    valueB = (0,external_wp_richText_namespaceObject.remove)(valueB, 0, selectionB.offset);
8650    dispatch.replaceBlocks(select.getSelectedBlockClientIds(), [{ // Preserve the original client ID.
8651      ...blockA,
8652      attributes: { ...blockA.attributes,
8653        [selectionA.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({
8654          value: valueA,
8655          ...mapRichTextSettings(attributeDefinitionA)
8656        })
8657      }
8658    }, (0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)()), { // Preserve the original client ID.
8659      ...blockB,
8660      attributes: { ...blockB.attributes,
8661        [selectionB.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({
8662          value: valueB,
8663          ...mapRichTextSettings(attributeDefinitionB)
8664        })
8665      }
8666    }], 1, // If we don't pass the `indexToSelect` it will default to the last block.
8667    select.getSelectedBlocksInitialCaretPosition());
8668  };
8669  /**
8670   * Expand the selection to cover the entire blocks, removing partial selection.
8671   */
8672  
8673  const __unstableExpandSelection = () => _ref14 => {
8674    let {
8675      select,
8676      dispatch
8677    } = _ref14;
8678    const selectionAnchor = select.getSelectionStart();
8679    const selectionFocus = select.getSelectionEnd();
8680    dispatch.selectionChange({
8681      start: {
8682        clientId: selectionAnchor.clientId
8683      },
8684      end: {
8685        clientId: selectionFocus.clientId
8686      }
8687    });
8688  };
8689  /**
8690   * Action that merges two blocks.
8691   *
8692   * @param {string} firstBlockClientId  Client ID of the first block to merge.
8693   * @param {string} secondBlockClientId Client ID of the second block to merge.
8694   */
8695  
8696  const mergeBlocks = (firstBlockClientId, secondBlockClientId) => _ref15 => {
8697    let {
8698      select,
8699      dispatch
8700    } = _ref15;
8701    const blocks = [firstBlockClientId, secondBlockClientId];
8702    dispatch({
8703      type: 'MERGE_BLOCKS',
8704      blocks
8705    });
8706    const [clientIdA, clientIdB] = blocks;
8707    const blockA = select.getBlock(clientIdA);
8708    const blockAType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockA.name); // Only focus the previous block if it's not mergeable.
8709  
8710    if (blockAType && !blockAType.merge) {
8711      dispatch.selectBlock(blockA.clientId);
8712      return;
8713    }
8714  
8715    const blockB = select.getBlock(clientIdB);
8716    const blockBType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockB.name);
8717    const {
8718      clientId,
8719      attributeKey,
8720      offset
8721    } = select.getSelectionStart();
8722    const selectedBlockType = clientId === clientIdA ? blockAType : blockBType;
8723    const attributeDefinition = selectedBlockType.attributes[attributeKey];
8724    const canRestoreTextSelection = (clientId === clientIdA || clientId === clientIdB) && attributeKey !== undefined && offset !== undefined && // We cannot restore text selection if the RichText identifier
8725    // is not a defined block attribute key. This can be the case if the
8726    // fallback intance ID is used to store selection (and no RichText
8727    // identifier is set), or when the identifier is wrong.
8728    !!attributeDefinition;
8729  
8730    if (!attributeDefinition) {
8731      if (typeof attributeKey === 'number') {
8732        window.console.error(`RichText needs an identifier prop that is the block attribute key of the attribute it controls. Its type is expected to be a string, but was $typeof attributeKey}`);
8733      } else {
8734        window.console.error('The RichText identifier prop does not match any attributes defined by the block.');
8735      }
8736    } // A robust way to retain selection position through various transforms
8737    // is to insert a special character at the position and then recover it.
8738  
8739  
8740    const START_OF_SELECTED_AREA = '\u0086'; // Clone the blocks so we don't insert the character in a "live" block.
8741  
8742    const cloneA = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockA);
8743    const cloneB = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockB);
8744  
8745    if (canRestoreTextSelection) {
8746      const selectedBlock = clientId === clientIdA ? cloneA : cloneB;
8747      const html = selectedBlock.attributes[attributeKey];
8748      const value = (0,external_wp_richText_namespaceObject.insert)((0,external_wp_richText_namespaceObject.create)({
8749        html,
8750        ...mapRichTextSettings(attributeDefinition)
8751      }), START_OF_SELECTED_AREA, offset, offset);
8752      selectedBlock.attributes[attributeKey] = (0,external_wp_richText_namespaceObject.toHTMLString)({
8753        value,
8754        ...mapRichTextSettings(attributeDefinition)
8755      });
8756    } // We can only merge blocks with similar types
8757    // thus, we transform the block to merge first.
8758  
8759  
8760    const blocksWithTheSameType = blockA.name === blockB.name ? [cloneB] : (0,external_wp_blocks_namespaceObject.switchToBlockType)(cloneB, blockA.name); // If the block types can not match, do nothing.
8761  
8762    if (!blocksWithTheSameType || !blocksWithTheSameType.length) {
8763      return;
8764    } // Calling the merge to update the attributes and remove the block to be merged.
8765  
8766  
8767    const updatedAttributes = blockAType.merge(cloneA.attributes, blocksWithTheSameType[0].attributes);
8768  
8769    if (canRestoreTextSelection) {
8770      const newAttributeKey = (0,external_lodash_namespaceObject.findKey)(updatedAttributes, v => typeof v === 'string' && v.indexOf(START_OF_SELECTED_AREA) !== -1);
8771      const convertedHtml = updatedAttributes[newAttributeKey];
8772      const convertedValue = (0,external_wp_richText_namespaceObject.create)({
8773        html: convertedHtml,
8774        ...mapRichTextSettings(blockAType.attributes[newAttributeKey])
8775      });
8776      const newOffset = convertedValue.text.indexOf(START_OF_SELECTED_AREA);
8777      const newValue = (0,external_wp_richText_namespaceObject.remove)(convertedValue, newOffset, newOffset + 1);
8778      const newHtml = (0,external_wp_richText_namespaceObject.toHTMLString)({
8779        value: newValue,
8780        ...mapRichTextSettings(blockAType.attributes[newAttributeKey])
8781      });
8782      updatedAttributes[newAttributeKey] = newHtml;
8783      dispatch.selectionChange(blockA.clientId, newAttributeKey, newOffset, newOffset);
8784    }
8785  
8786    dispatch.replaceBlocks([blockA.clientId, blockB.clientId], [{ ...blockA,
8787      attributes: { ...blockA.attributes,
8788        ...updatedAttributes
8789      }
8790    }, ...blocksWithTheSameType.slice(1)], 0 // If we don't pass the `indexToSelect` it will default to the last block.
8791    );
8792  };
8793  /**
8794   * Yields action objects used in signalling that the blocks corresponding to
8795   * the set of specified client IDs are to be removed.
8796   *
8797   * @param {string|string[]} clientIds      Client IDs of blocks to remove.
8798   * @param {boolean}         selectPrevious True if the previous block should be
8799   *                                         selected when a block is removed.
8800   */
8801  
8802  const removeBlocks = function (clientIds) {
8803    let selectPrevious = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
8804    return _ref16 => {
8805      let {
8806        select,
8807        dispatch
8808      } = _ref16;
8809  
8810      if (!clientIds || !clientIds.length) {
8811        return;
8812      }
8813  
8814      clientIds = (0,external_lodash_namespaceObject.castArray)(clientIds);
8815      const rootClientId = select.getBlockRootClientId(clientIds[0]);
8816      const canRemoveBlocks = select.canRemoveBlocks(clientIds, rootClientId);
8817  
8818      if (!canRemoveBlocks) {
8819        return;
8820      }
8821  
8822      if (selectPrevious) {
8823        dispatch.selectPreviousBlock(clientIds[0]);
8824      }
8825  
8826      dispatch({
8827        type: 'REMOVE_BLOCKS',
8828        clientIds
8829      }); // To avoid a focus loss when removing the last block, assure there is
8830      // always a default block if the last of the blocks have been removed.
8831  
8832      dispatch(ensureDefaultBlock());
8833    };
8834  };
8835  /**
8836   * Returns an action object used in signalling that the block with the
8837   * specified client ID is to be removed.
8838   *
8839   * @param {string}  clientId       Client ID of block to remove.
8840   * @param {boolean} selectPrevious True if the previous block should be
8841   *                                 selected when a block is removed.
8842   *
8843   * @return {Object} Action object.
8844   */
8845  
8846  function removeBlock(clientId, selectPrevious) {
8847    return removeBlocks([clientId], selectPrevious);
8848  }
8849  /* eslint-disable jsdoc/valid-types */
8850  
8851  /**
8852   * Returns an action object used in signalling that the inner blocks with the
8853   * specified client ID should be replaced.
8854   *
8855   * @param {string}    rootClientId    Client ID of the block whose InnerBlocks will re replaced.
8856   * @param {Object[]}  blocks          Block objects to insert as new InnerBlocks
8857   * @param {?boolean}  updateSelection If true block selection will be updated. If false, block selection will not change. Defaults to false.
8858   * @param {0|-1|null} initialPosition Initial block position.
8859   * @return {Object} Action object.
8860   */
8861  
8862  function replaceInnerBlocks(rootClientId, blocks) {
8863    let updateSelection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
8864    let initialPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
8865  
8866    /* eslint-enable jsdoc/valid-types */
8867    return {
8868      type: 'REPLACE_INNER_BLOCKS',
8869      rootClientId,
8870      blocks,
8871      updateSelection,
8872      initialPosition: updateSelection ? initialPosition : null,
8873      time: Date.now()
8874    };
8875  }
8876  /**
8877   * Returns an action object used to toggle the block editing mode between
8878   * visual and HTML modes.
8879   *
8880   * @param {string} clientId Block client ID.
8881   *
8882   * @return {Object} Action object.
8883   */
8884  
8885  function toggleBlockMode(clientId) {
8886    return {
8887      type: 'TOGGLE_BLOCK_MODE',
8888      clientId
8889    };
8890  }
8891  /**
8892   * Returns an action object used in signalling that the user has begun to type.
8893   *
8894   * @return {Object} Action object.
8895   */
8896  
8897  function startTyping() {
8898    return {
8899      type: 'START_TYPING'
8900    };
8901  }
8902  /**
8903   * Returns an action object used in signalling that the user has stopped typing.
8904   *
8905   * @return {Object} Action object.
8906   */
8907  
8908  function stopTyping() {
8909    return {
8910      type: 'STOP_TYPING'
8911    };
8912  }
8913  /**
8914   * Returns an action object used in signalling that the user has begun to drag blocks.
8915   *
8916   * @param {string[]} clientIds An array of client ids being dragged
8917   *
8918   * @return {Object} Action object.
8919   */
8920  
8921  function startDraggingBlocks() {
8922    let clientIds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
8923    return {
8924      type: 'START_DRAGGING_BLOCKS',
8925      clientIds
8926    };
8927  }
8928  /**
8929   * Returns an action object used in signalling that the user has stopped dragging blocks.
8930   *
8931   * @return {Object} Action object.
8932   */
8933  
8934  function stopDraggingBlocks() {
8935    return {
8936      type: 'STOP_DRAGGING_BLOCKS'
8937    };
8938  }
8939  /**
8940   * Returns an action object used in signalling that the caret has entered formatted text.
8941   *
8942   * @return {Object} Action object.
8943   */
8944  
8945  function enterFormattedText() {
8946    return {
8947      type: 'ENTER_FORMATTED_TEXT'
8948    };
8949  }
8950  /**
8951   * Returns an action object used in signalling that the user caret has exited formatted text.
8952   *
8953   * @return {Object} Action object.
8954   */
8955  
8956  function exitFormattedText() {
8957    return {
8958      type: 'EXIT_FORMATTED_TEXT'