diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-includes/js/dist/editor.js --- a/wp/wp-includes/js/dist/editor.js Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-includes/js/dist/editor.js Tue Dec 15 13:49:49 2020 +0100 @@ -82,7 +82,7 @@ /******/ /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 358); +/******/ return __webpack_require__(__webpack_require__.s = 438); /******/ }) /************************************************************************/ /******/ ({ @@ -102,68 +102,477 @@ /***/ }), /***/ 10: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; }); -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -} +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["blocks"]; }()); /***/ }), -/***/ 109: +/***/ 100: /***/ (function(module, exports) { -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } -} - +(function() { module.exports = this["wp"]["notices"]; }()); + +/***/ }), + +/***/ 103: +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["autop"]; }()); /***/ }), /***/ 11: +/***/ (function(module, exports, __webpack_require__) { + +var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! + Copyright (c) 2017 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/ +/* global define */ + +(function () { + 'use strict'; + + var hasOwn = {}.hasOwnProperty; + + function classNames () { + var classes = []; + + for (var i = 0; i < arguments.length; i++) { + var arg = arguments[i]; + if (!arg) continue; + + var argType = typeof arg; + + if (argType === 'string' || argType === 'number') { + classes.push(arg); + } else if (Array.isArray(arg) && arg.length) { + var inner = classNames.apply(null, arg); + if (inner) { + classes.push(inner); + } + } else if (argType === 'object') { + for (var key in arg) { + if (hasOwn.call(arg, key) && arg[key]) { + classes.push(key); + } + } + } + } + + return classes.join(' '); + } + + if ( true && module.exports) { + classNames.default = classNames; + module.exports = classNames; + } else if (true) { + // register as 'classnames', consistent with npm package name + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { + return classNames; + }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else {} +}()); + + +/***/ }), + +/***/ 110: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function flattenIntoMap( map, effects ) { + var i; + if ( Array.isArray( effects ) ) { + for ( i = 0; i < effects.length; i++ ) { + flattenIntoMap( map, effects[ i ] ); + } + } else { + for ( i in effects ) { + map[ i ] = ( map[ i ] || [] ).concat( effects[ i ] ); + } + } +} + +function refx( effects ) { + var map = {}, + middleware; + + flattenIntoMap( map, effects ); + + middleware = function( store ) { + return function( next ) { + return function( action ) { + var handlers = map[ action.type ], + result = next( action ), + i, handlerAction; + + if ( handlers ) { + for ( i = 0; i < handlers.length; i++ ) { + handlerAction = handlers[ i ]( action, store ); + if ( handlerAction ) { + store.dispatch( handlerAction ); + } + } + } + + return result; + }; + }; + }; + + middleware.effects = map; + + return middleware; +} + +module.exports = refx; + + +/***/ }), + +/***/ 12: +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _assertThisInitialized; }); +function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; +} + +/***/ }), + +/***/ 13: +/***/ (function(module, exports) { + +(function() { module.exports = this["React"]; }()); + +/***/ }), + +/***/ 134: +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(421); + + +/***/ }), + +/***/ 137: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _possibleConstructorReturn; }); -/* harmony import */ var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32); -/* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); - - -function _possibleConstructorReturn(self, call) { - if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(call) === "object" || typeof call === "function")) { - return call; - } - - return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(self); +/* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5); +/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__); + + + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +/** + * WordPress dependencies + */ + // Disable reason: JSDoc linter doesn't seem to parse the union (`&`) correctly. + +/* eslint-disable jsdoc/valid-types */ + +/** @typedef {{icon: JSX.Element, size?: number} & import('react').ComponentPropsWithoutRef<'SVG'>} IconProps */ + +/* eslint-enable jsdoc/valid-types */ + +/** + * Return an SVG icon. + * + * @param {IconProps} props icon is the SVG component to render + * size is a number specifiying the icon size in pixels + * Other props will be passed to wrapped SVG component + * + * @return {JSX.Element} Icon component + */ + +function Icon(_ref) { + var icon = _ref.icon, + _ref$size = _ref.size, + size = _ref$size === void 0 ? 24 : _ref$size, + props = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(_ref, ["icon", "size"]); + + return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__["cloneElement"])(icon, _objectSpread({ + width: size, + height: size + }, props)); +} + +/* harmony default export */ __webpack_exports__["a"] = (Icon); + + +/***/ }), + +/***/ 138: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + + +var ReactPropTypesSecret = __webpack_require__(139); + +function emptyFunction() {} +function emptyFunctionWithReset() {} +emptyFunctionWithReset.resetWarningCache = emptyFunction; + +module.exports = function() { + function shim(props, propName, componentName, location, propFullName, secret) { + if (secret === ReactPropTypesSecret) { + // It is still safe when called from React. + return; + } + var err = new Error( + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use PropTypes.checkPropTypes() to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + err.name = 'Invariant Violation'; + throw err; + }; + shim.isRequired = shim; + function getShim() { + return shim; + }; + // Important! + // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. + var ReactPropTypes = { + array: shim, + bool: shim, + func: shim, + number: shim, + object: shim, + string: shim, + symbol: shim, + + any: shim, + arrayOf: getShim, + element: shim, + elementType: shim, + instanceOf: getShim, + node: shim, + objectOf: getShim, + oneOf: getShim, + oneOfType: getShim, + shape: getShim, + exact: getShim, + + checkPropTypes: emptyFunctionWithReset, + resetWarningCache: emptyFunction + }; + + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; +}; + + +/***/ }), + +/***/ 139: +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + + +var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + +module.exports = ReactPropTypesSecret; + + +/***/ }), + +/***/ 14: +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; + +// EXPORTS +__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _slicedToArray; }); + +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +var arrayWithHoles = __webpack_require__(38); + +// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +function _iterableToArrayLimit(arr, i) { + if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; +} +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +var unsupportedIterableToArray = __webpack_require__(29); + +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +var nonIterableRest = __webpack_require__(39); + +// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + + + + +function _slicedToArray(arr, i) { + return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])(); } /***/ }), -/***/ 111: +/***/ 147: +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["wordcount"]; }()); + +/***/ }), + +/***/ 15: +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutProperties; }); +/* harmony import */ var _objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(41); + +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = Object(_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(source, excluded); + var key, i; + + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + + for (i = 0; i < sourceSymbolKeys.length; i++) { + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + + return target; +} + +/***/ }), + +/***/ 152: +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["mediaUtils"]; }()); + +/***/ }), + +/***/ 154: +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); + + +/** + * WordPress dependencies + */ + +var close = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { + d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z" +})); +/* harmony default export */ __webpack_exports__["a"] = (close); + + +/***/ }), + +/***/ 155: +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); + + +/** + * WordPress dependencies + */ + +var check = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { + d: "M9 18.6L3.5 13l1-1L9 16.4l9.5-9.9 1 1z" +})); +/* harmony default export */ __webpack_exports__["a"] = (check); + + +/***/ }), + +/***/ 16: +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; }); +function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); +} + +/***/ }), + +/***/ 173: /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -196,10 +605,10 @@ return t; }; exports.__esModule = true; -var React = __webpack_require__(27); -var PropTypes = __webpack_require__(31); -var autosize = __webpack_require__(112); -var _getLineHeight = __webpack_require__(113); +var React = __webpack_require__(13); +var PropTypes = __webpack_require__(28); +var autosize = __webpack_require__(174); +var _getLineHeight = __webpack_require__(175); var getLineHeight = _getLineHeight; var UPDATE = 'autosize:update'; var DESTROY = 'autosize:destroy'; @@ -292,7 +701,7 @@ /***/ }), -/***/ 112: +/***/ 174: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! @@ -581,11 +990,11 @@ /***/ }), -/***/ 113: +/***/ 175: /***/ (function(module, exports, __webpack_require__) { // Load in dependencies -var computedStyle = __webpack_require__(114); +var computedStyle = __webpack_require__(176); /** * Calculate the `line-height` of a given node @@ -685,7 +1094,7 @@ /***/ }), -/***/ 114: +/***/ 176: /***/ (function(module, exports) { // This code has been refactored for 140 bytes @@ -719,802 +1128,151 @@ /***/ }), -/***/ 117: -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.4.1 by @mathias */ -;(function(root) { - - /** Detect free variables */ - var freeExports = true && exports && - !exports.nodeType && exports; - var freeModule = true && module && - !module.nodeType && module; - var freeGlobal = typeof global == 'object' && global; - if ( - freeGlobal.global === freeGlobal || - freeGlobal.window === freeGlobal || - freeGlobal.self === freeGlobal - ) { - root = freeGlobal; - } - - /** - * The `punycode` object. - * @name punycode - * @type Object - */ - var punycode, - - /** Highest positive signed 32-bit float value */ - maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 - - /** Bootstring parameters */ - base = 36, - tMin = 1, - tMax = 26, - skew = 38, - damp = 700, - initialBias = 72, - initialN = 128, // 0x80 - delimiter = '-', // '\x2D' - - /** Regular expressions */ - regexPunycode = /^xn--/, - regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars - regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators - - /** Error messages */ - errors = { - 'overflow': 'Overflow: input needs wider integers to process', - 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', - 'invalid-input': 'Invalid input' - }, - - /** Convenience shortcuts */ - baseMinusTMin = base - tMin, - floor = Math.floor, - stringFromCharCode = String.fromCharCode, - - /** Temporary variable */ - key; - - /*--------------------------------------------------------------------------*/ - - /** - * A generic error utility function. - * @private - * @param {String} type The error type. - * @returns {Error} Throws a `RangeError` with the applicable error message. - */ - function error(type) { - throw new RangeError(errors[type]); - } - - /** - * A generic `Array#map` utility function. - * @private - * @param {Array} array The array to iterate over. - * @param {Function} callback The function that gets called for every array - * item. - * @returns {Array} A new array of values returned by the callback function. - */ - function map(array, fn) { - var length = array.length; - var result = []; - while (length--) { - result[length] = fn(array[length]); - } - return result; - } - - /** - * A simple `Array#map`-like wrapper to work with domain name strings or email - * addresses. - * @private - * @param {String} domain The domain name or email address. - * @param {Function} callback The function that gets called for every - * character. - * @returns {Array} A new string of characters returned by the callback - * function. - */ - function mapDomain(string, fn) { - var parts = string.split('@'); - var result = ''; - if (parts.length > 1) { - // In email addresses, only the domain name should be punycoded. Leave - // the local part (i.e. everything up to `@`) intact. - result = parts[0] + '@'; - string = parts[1]; - } - // Avoid `split(regex)` for IE8 compatibility. See #17. - string = string.replace(regexSeparators, '\x2E'); - var labels = string.split('.'); - var encoded = map(labels, fn).join('.'); - return result + encoded; - } - - /** - * Creates an array containing the numeric code points of each Unicode - * character in the string. While JavaScript uses UCS-2 internally, - * this function will convert a pair of surrogate halves (each of which - * UCS-2 exposes as separate characters) into a single code point, - * matching UTF-16. - * @see `punycode.ucs2.encode` - * @see - * @memberOf punycode.ucs2 - * @name decode - * @param {String} string The Unicode input string (UCS-2). - * @returns {Array} The new array of code points. - */ - function ucs2decode(string) { - var output = [], - counter = 0, - length = string.length, - value, - extra; - while (counter < length) { - value = string.charCodeAt(counter++); - if (value >= 0xD800 && value <= 0xDBFF && counter < length) { - // high surrogate, and there is a next character - extra = string.charCodeAt(counter++); - if ((extra & 0xFC00) == 0xDC00) { // low surrogate - output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); - } else { - // unmatched surrogate; only append this code unit, in case the next - // code unit is the high surrogate of a surrogate pair - output.push(value); - counter--; - } - } else { - output.push(value); - } - } - return output; - } - - /** - * Creates a string based on an array of numeric code points. - * @see `punycode.ucs2.decode` - * @memberOf punycode.ucs2 - * @name encode - * @param {Array} codePoints The array of numeric code points. - * @returns {String} The new Unicode string (UCS-2). - */ - function ucs2encode(array) { - return map(array, function(value) { - var output = ''; - if (value > 0xFFFF) { - value -= 0x10000; - output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); - value = 0xDC00 | value & 0x3FF; - } - output += stringFromCharCode(value); - return output; - }).join(''); - } - - /** - * Converts a basic code point into a digit/integer. - * @see `digitToBasic()` - * @private - * @param {Number} codePoint The basic numeric code point value. - * @returns {Number} The numeric value of a basic code point (for use in - * representing integers) in the range `0` to `base - 1`, or `base` if - * the code point does not represent a value. - */ - function basicToDigit(codePoint) { - if (codePoint - 48 < 10) { - return codePoint - 22; - } - if (codePoint - 65 < 26) { - return codePoint - 65; - } - if (codePoint - 97 < 26) { - return codePoint - 97; - } - return base; - } - - /** - * Converts a digit/integer into a basic code point. - * @see `basicToDigit()` - * @private - * @param {Number} digit The numeric value of a basic code point. - * @returns {Number} The basic code point whose value (when used for - * representing integers) is `digit`, which needs to be in the range - * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is - * used; else, the lowercase form is used. The behavior is undefined - * if `flag` is non-zero and `digit` has no uppercase form. - */ - function digitToBasic(digit, flag) { - // 0..25 map to ASCII a..z or A..Z - // 26..35 map to ASCII 0..9 - return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); - } - - /** - * Bias adaptation function as per section 3.4 of RFC 3492. - * https://tools.ietf.org/html/rfc3492#section-3.4 - * @private - */ - function adapt(delta, numPoints, firstTime) { - var k = 0; - delta = firstTime ? floor(delta / damp) : delta >> 1; - delta += floor(delta / numPoints); - for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { - delta = floor(delta / baseMinusTMin); - } - return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); - } - - /** - * Converts a Punycode string of ASCII-only symbols to a string of Unicode - * symbols. - * @memberOf punycode - * @param {String} input The Punycode string of ASCII-only symbols. - * @returns {String} The resulting string of Unicode symbols. - */ - function decode(input) { - // Don't use UCS-2 - var output = [], - inputLength = input.length, - out, - i = 0, - n = initialN, - bias = initialBias, - basic, - j, - index, - oldi, - w, - k, - digit, - t, - /** Cached calculation results */ - baseMinusT; - - // Handle the basic code points: let `basic` be the number of input code - // points before the last delimiter, or `0` if there is none, then copy - // the first basic code points to the output. - - basic = input.lastIndexOf(delimiter); - if (basic < 0) { - basic = 0; - } - - for (j = 0; j < basic; ++j) { - // if it's not a basic code point - if (input.charCodeAt(j) >= 0x80) { - error('not-basic'); - } - output.push(input.charCodeAt(j)); - } - - // Main decoding loop: start just after the last delimiter if any basic code - // points were copied; start at the beginning otherwise. - - for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { - - // `index` is the index of the next character to be consumed. - // Decode a generalized variable-length integer into `delta`, - // which gets added to `i`. The overflow checking is easier - // if we increase `i` as we go, then subtract off its starting - // value at the end to obtain `delta`. - for (oldi = i, w = 1, k = base; /* no condition */; k += base) { - - if (index >= inputLength) { - error('invalid-input'); - } - - digit = basicToDigit(input.charCodeAt(index++)); - - if (digit >= base || digit > floor((maxInt - i) / w)) { - error('overflow'); - } - - i += digit * w; - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - - if (digit < t) { - break; - } - - baseMinusT = base - t; - if (w > floor(maxInt / baseMinusT)) { - error('overflow'); - } - - w *= baseMinusT; - - } - - out = output.length + 1; - bias = adapt(i - oldi, out, oldi == 0); - - // `i` was supposed to wrap around from `out` to `0`, - // incrementing `n` each time, so we'll fix that now: - if (floor(i / out) > maxInt - n) { - error('overflow'); - } - - n += floor(i / out); - i %= out; - - // Insert `n` at position `i` of the output - output.splice(i++, 0, n); - - } - - return ucs2encode(output); - } - - /** - * Converts a string of Unicode symbols (e.g. a domain name label) to a - * Punycode string of ASCII-only symbols. - * @memberOf punycode - * @param {String} input The string of Unicode symbols. - * @returns {String} The resulting Punycode string of ASCII-only symbols. - */ - function encode(input) { - var n, - delta, - handledCPCount, - basicLength, - bias, - j, - m, - q, - k, - t, - currentValue, - output = [], - /** `inputLength` will hold the number of code points in `input`. */ - inputLength, - /** Cached calculation results */ - handledCPCountPlusOne, - baseMinusT, - qMinusT; - - // Convert the input in UCS-2 to Unicode - input = ucs2decode(input); - - // Cache the length - inputLength = input.length; - - // Initialize the state - n = initialN; - delta = 0; - bias = initialBias; - - // Handle the basic code points - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue < 0x80) { - output.push(stringFromCharCode(currentValue)); - } - } - - handledCPCount = basicLength = output.length; - - // `handledCPCount` is the number of code points that have been handled; - // `basicLength` is the number of basic code points. - - // Finish the basic string - if it is not empty - with a delimiter - if (basicLength) { - output.push(delimiter); - } - - // Main encoding loop: - while (handledCPCount < inputLength) { - - // All non-basic code points < n have been handled already. Find the next - // larger one: - for (m = maxInt, j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue >= n && currentValue < m) { - m = currentValue; - } - } - - // Increase `delta` enough to advance the decoder's state to , - // but guard against overflow - handledCPCountPlusOne = handledCPCount + 1; - if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { - error('overflow'); - } - - delta += (m - n) * handledCPCountPlusOne; - n = m; - - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - - if (currentValue < n && ++delta > maxInt) { - error('overflow'); - } - - if (currentValue == n) { - // Represent delta as a generalized variable-length integer - for (q = delta, k = base; /* no condition */; k += base) { - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - if (q < t) { - break; - } - qMinusT = q - t; - baseMinusT = base - t; - output.push( - stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) - ); - q = floor(qMinusT / baseMinusT); - } - - output.push(stringFromCharCode(digitToBasic(q, 0))); - bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); - delta = 0; - ++handledCPCount; - } - } - - ++delta; - ++n; - - } - return output.join(''); - } - - /** - * Converts a Punycode string representing a domain name or an email address - * to Unicode. Only the Punycoded parts of the input will be converted, i.e. - * it doesn't matter if you call it on a string that has already been - * converted to Unicode. - * @memberOf punycode - * @param {String} input The Punycoded domain name or email address to - * convert to Unicode. - * @returns {String} The Unicode representation of the given Punycode - * string. - */ - function toUnicode(input) { - return mapDomain(input, function(string) { - return regexPunycode.test(string) - ? decode(string.slice(4).toLowerCase()) - : string; - }); - } - - /** - * Converts a Unicode string representing a domain name or an email address to - * Punycode. Only the non-ASCII parts of the domain name will be converted, - * i.e. it doesn't matter if you call it with a domain that's already in - * ASCII. - * @memberOf punycode - * @param {String} input The domain name or email address to convert, as a - * Unicode string. - * @returns {String} The Punycode representation of the given domain name or - * email address. - */ - function toASCII(input) { - return mapDomain(input, function(string) { - return regexNonASCII.test(string) - ? 'xn--' + encode(string) - : string; - }); - } - - /*--------------------------------------------------------------------------*/ - - /** Define the public API */ - punycode = { - /** - * A string representing the current Punycode.js version number. - * @memberOf punycode - * @type String - */ - 'version': '1.4.1', - /** - * An object of methods to convert from JavaScript's internal character - * representation (UCS-2) to Unicode code points, and back. - * @see - * @memberOf punycode - * @type Object - */ - 'ucs2': { - 'decode': ucs2decode, - 'encode': ucs2encode - }, - 'decode': decode, - 'encode': encode, - 'toASCII': toASCII, - 'toUnicode': toUnicode - }; - - /** Expose `punycode` */ - // Some AMD build optimizers, like r.js, check for specific condition patterns - // like the following: - if ( - true - ) { - !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { - return punycode; - }).call(exports, __webpack_require__, exports, module), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else {} - -}(this)); - -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(118)(module), __webpack_require__(59))) - -/***/ }), - -/***/ 118: -/***/ (function(module, exports) { - -module.exports = function(module) { - if (!module.webpackPolyfill) { - module.deprecate = function() {}; - module.paths = []; - // module.parent = undefined by default - if (!module.children) module.children = []; - Object.defineProperty(module, "loaded", { - enumerable: true, - get: function() { - return module.l; - } - }); - Object.defineProperty(module, "id", { - enumerable: true, - get: function() { - return module.i; - } - }); - module.webpackPolyfill = 1; - } - return module; -}; +/***/ 177: +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); + + +/** + * WordPress dependencies + */ + +var closeSmall = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { + d: "M13 11.9l3.3-3.4-1.1-1-3.2 3.3-3.2-3.3-1.1 1 3.3 3.4-3.5 3.6 1 1L12 13l3.5 3.5 1-1z" +})); +/* harmony default export */ __webpack_exports__["a"] = (closeSmall); /***/ }), -/***/ 119: -/***/ (function(module, exports, __webpack_require__) { +/***/ 18: +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; - -module.exports = { - isString: function(arg) { - return typeof(arg) === 'string'; - }, - isObject: function(arg) { - return typeof(arg) === 'object' && arg !== null; - }, - isNull: function(arg) { - return arg === null; - }, - isNullOrUndefined: function(arg) { - return arg == null; - } -}; - +// EXPORTS +__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; }); + +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +var arrayLikeToArray = __webpack_require__(26); + +// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js + +function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr); +} +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js +var iterableToArray = __webpack_require__(35); + +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +var unsupportedIterableToArray = __webpack_require__(29); + +// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + + + + +function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread(); +} /***/ }), -/***/ 12: +/***/ 19: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; }); -function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - return _getPrototypeOf(o); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; }); +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } +} + +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; } /***/ }), -/***/ 120: -/***/ (function(module, exports, __webpack_require__) { +/***/ 2: +/***/ (function(module, exports) { + +(function() { module.exports = this["lodash"]; }()); + +/***/ }), + +/***/ 20: +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; - - -exports.decode = exports.parse = __webpack_require__(121); -exports.encode = exports.stringify = __webpack_require__(122); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; }); +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +/***/ }), + +/***/ 202: +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); + + +/** + * WordPress dependencies + */ + +var blockDefault = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { + d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" +})); +/* harmony default export */ __webpack_exports__["a"] = (blockDefault); /***/ }), -/***/ 121: -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - - - -// If obj.hasOwnProperty has been overridden, then calling -// obj.hasOwnProperty(prop) will break. -// See: https://github.com/joyent/node/issues/1707 -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} - -module.exports = function(qs, sep, eq, options) { - sep = sep || '&'; - eq = eq || '='; - var obj = {}; - - if (typeof qs !== 'string' || qs.length === 0) { - return obj; - } - - var regexp = /\+/g; - qs = qs.split(sep); - - var maxKeys = 1000; - if (options && typeof options.maxKeys === 'number') { - maxKeys = options.maxKeys; - } - - var len = qs.length; - // maxKeys <= 0 means that we should not limit keys count - if (maxKeys > 0 && len > maxKeys) { - len = maxKeys; - } - - for (var i = 0; i < len; ++i) { - var x = qs[i].replace(regexp, '%20'), - idx = x.indexOf(eq), - kstr, vstr, k, v; - - if (idx >= 0) { - kstr = x.substr(0, idx); - vstr = x.substr(idx + 1); - } else { - kstr = x; - vstr = ''; - } - - k = decodeURIComponent(kstr); - v = decodeURIComponent(vstr); - - if (!hasOwnProperty(obj, k)) { - obj[k] = v; - } else if (isArray(obj[k])) { - obj[k].push(v); - } else { - obj[k] = [obj[k], v]; - } - } - - return obj; -}; - -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; - +/***/ 21: +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["keycodes"]; }()); /***/ }), -/***/ 122: -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - - - -var stringifyPrimitive = function(v) { - switch (typeof v) { - case 'string': - return v; - - case 'boolean': - return v ? 'true' : 'false'; - - case 'number': - return isFinite(v) ? v : ''; - - default: - return ''; - } -}; - -module.exports = function(obj, sep, eq, name) { - sep = sep || '&'; - eq = eq || '='; - if (obj === null) { - obj = undefined; - } - - if (typeof obj === 'object') { - return map(objectKeys(obj), function(k) { - var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; - if (isArray(obj[k])) { - return map(obj[k], function(v) { - return ks + encodeURIComponent(stringifyPrimitive(v)); - }).join(sep); - } else { - return ks + encodeURIComponent(stringifyPrimitive(obj[k])); - } - }).join(sep); - - } - - if (!name) return ''; - return encodeURIComponent(stringifyPrimitive(name)) + eq + - encodeURIComponent(stringifyPrimitive(obj)); -}; - -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; - -function map (xs, f) { - if (xs.map) return xs.map(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - res.push(f(xs[i], i)); - } - return res; -} - -var objectKeys = Object.keys || function (obj) { - var res = []; - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); - } - return res; -}; - - -/***/ }), - -/***/ 13: +/***/ 22: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +// EXPORTS +__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _inherits; }); + // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { @@ -1525,7 +1283,6 @@ return _setPrototypeOf(o, p); } // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _inherits; }); function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { @@ -1544,185 +1301,246 @@ /***/ }), -/***/ 133: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["notices"]; }()); - -/***/ }), - -/***/ 14: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["blocks"]; }()); - -/***/ }), - -/***/ 15: +/***/ 23: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; }); -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - - return obj; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _possibleConstructorReturn; }); +/* harmony import */ var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(40); +/* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12); + + +function _possibleConstructorReturn(self, call) { + if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(call) === "object" || typeof call === "function")) { + return call; + } + + return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(self); } /***/ }), -/***/ 16: -/***/ (function(module, exports, __webpack_require__) { - -var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! - Copyright (c) 2017 Jed Watson. - Licensed under the MIT License (MIT), see - http://jedwatson.github.io/classnames -*/ -/* global define */ - -(function () { - 'use strict'; - - var hasOwn = {}.hasOwnProperty; - - function classNames () { - var classes = []; - - for (var i = 0; i < arguments.length; i++) { - var arg = arguments[i]; - if (!arg) continue; - - var argType = typeof arg; - - if (argType === 'string' || argType === 'number') { - classes.push(arg); - } else if (Array.isArray(arg) && arg.length) { - var inner = classNames.apply(null, arg); - if (inner) { - classes.push(inner); - } - } else if (argType === 'object') { - for (var key in arg) { - if (hasOwn.call(arg, key) && arg[key]) { - classes.push(key); - } - } - } - } - - return classes.join(' '); - } - - if ( true && module.exports) { - classNames.default = classNames; - module.exports = classNames; - } else if (true) { - // register as 'classnames', consistent with npm package name - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { - return classNames; - }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else {} -}()); - +/***/ 24: +/***/ (function(module, exports) { + +(function() { module.exports = this["regeneratorRuntime"]; }()); /***/ }), -/***/ 17: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; - -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js -function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { - arr2[i] = arr[i]; - } - - return arr2; - } -} -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js -var iterableToArray = __webpack_require__(34); - -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js -function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance"); -} -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toConsumableArray; }); - - - -function _toConsumableArray(arr) { - return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || _nonIterableSpread(); -} - -/***/ }), - -/***/ 18: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["keycodes"]; }()); - -/***/ }), - -/***/ 19: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; }); -function _extends() { - _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; - }; - - return _extends.apply(this, arguments); -} - -/***/ }), - -/***/ 2: -/***/ (function(module, exports) { - -(function() { module.exports = this["lodash"]; }()); - -/***/ }), - -/***/ 20: +/***/ 25: /***/ (function(module, exports) { (function() { module.exports = this["wp"]["richText"]; }()); /***/ }), -/***/ 21: +/***/ 26: +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; }); +function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) { + arr2[i] = arr[i]; + } + + return arr2; +} + +/***/ }), + +/***/ 28: +/***/ (function(module, exports, __webpack_require__) { + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +if (false) { var throwOnDirectAccess, ReactIs; } else { + // By explicitly using `prop-types` you are opting into new production behavior. + // http://fb.me/prop-types-in-prod + module.exports = __webpack_require__(138)(); +} + + +/***/ }), + +/***/ 29: +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; }); +/* harmony import */ var _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26); + +function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); +} + +/***/ }), + +/***/ 298: +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); + + +/** + * WordPress dependencies + */ + +var layout = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "-2 -2 24 24" +}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { + d: "M2 2h5v11H2V2zm6 0h5v5H8V2zm6 0h4v16h-4V2zM8 8h5v5H8V8zm-6 6h11v4H2v-4z" +})); +/* harmony default export */ __webpack_exports__["a"] = (layout); + + +/***/ }), + +/***/ 3: +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["components"]; }()); + +/***/ }), + +/***/ 302: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; - -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); + + +/** + * WordPress dependencies + */ + +var grid = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "-2 -2 24 24" +}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { + d: "M9 9V3H3v6h6zm8 0V3h-6v6h6zm-8 8v-6H3v6h6zm8 0v-6h-6v6h6z" +})); +/* harmony default export */ __webpack_exports__["a"] = (grid); + + +/***/ }), + +/***/ 31: +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["url"]; }()); + +/***/ }), + +/***/ 32: +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["hooks"]; }()); + +/***/ }), + +/***/ 35: +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; }); +function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); +} + +/***/ }), + +/***/ 36: +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["dataControls"]; }()); + +/***/ }), + +/***/ 37: +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["deprecated"]; }()); + +/***/ }), + +/***/ 38: +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; }); +function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; +} + +/***/ }), + +/***/ 39: +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; }); +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} + +/***/ }), + +/***/ 4: +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["data"]; }()); + +/***/ }), + +/***/ 40: +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; }); +function _typeof(obj) { + "@babel/helpers - typeof"; + + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function _typeof(obj) { + return typeof obj; + }; + } else { + _typeof = function _typeof(obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); +} + +/***/ }), + +/***/ 41: +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutPropertiesLoose; }); function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; @@ -1737,444 +1555,10 @@ return target; } -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutProperties; }); - -function _objectWithoutProperties(source, excluded) { - if (source == null) return {}; - var target = _objectWithoutPropertiesLoose(source, excluded); - var key, i; - - if (Object.getOwnPropertySymbols) { - var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - - for (i = 0; i < sourceSymbolKeys.length; i++) { - key = sourceSymbolKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; - target[key] = source[key]; - } - } - - return target; -} /***/ }), -/***/ 227: -/***/ (function(module, exports) { - -var traverse = module.exports = function (obj) { - return new Traverse(obj); -}; - -function Traverse (obj) { - this.value = obj; -} - -Traverse.prototype.get = function (ps) { - var node = this.value; - for (var i = 0; i < ps.length; i ++) { - var key = ps[i]; - if (!node || !hasOwnProperty.call(node, key)) { - node = undefined; - break; - } - node = node[key]; - } - return node; -}; - -Traverse.prototype.has = function (ps) { - var node = this.value; - for (var i = 0; i < ps.length; i ++) { - var key = ps[i]; - if (!node || !hasOwnProperty.call(node, key)) { - return false; - } - node = node[key]; - } - return true; -}; - -Traverse.prototype.set = function (ps, value) { - var node = this.value; - for (var i = 0; i < ps.length - 1; i ++) { - var key = ps[i]; - if (!hasOwnProperty.call(node, key)) node[key] = {}; - node = node[key]; - } - node[ps[i]] = value; - return value; -}; - -Traverse.prototype.map = function (cb) { - return walk(this.value, cb, true); -}; - -Traverse.prototype.forEach = function (cb) { - this.value = walk(this.value, cb, false); - return this.value; -}; - -Traverse.prototype.reduce = function (cb, init) { - var skip = arguments.length === 1; - var acc = skip ? this.value : init; - this.forEach(function (x) { - if (!this.isRoot || !skip) { - acc = cb.call(this, acc, x); - } - }); - return acc; -}; - -Traverse.prototype.paths = function () { - var acc = []; - this.forEach(function (x) { - acc.push(this.path); - }); - return acc; -}; - -Traverse.prototype.nodes = function () { - var acc = []; - this.forEach(function (x) { - acc.push(this.node); - }); - return acc; -}; - -Traverse.prototype.clone = function () { - var parents = [], nodes = []; - - return (function clone (src) { - for (var i = 0; i < parents.length; i++) { - if (parents[i] === src) { - return nodes[i]; - } - } - - if (typeof src === 'object' && src !== null) { - var dst = copy(src); - - parents.push(src); - nodes.push(dst); - - forEach(objectKeys(src), function (key) { - dst[key] = clone(src[key]); - }); - - parents.pop(); - nodes.pop(); - return dst; - } - else { - return src; - } - })(this.value); -}; - -function walk (root, cb, immutable) { - var path = []; - var parents = []; - var alive = true; - - return (function walker (node_) { - var node = immutable ? copy(node_) : node_; - var modifiers = {}; - - var keepGoing = true; - - var state = { - node : node, - node_ : node_, - path : [].concat(path), - parent : parents[parents.length - 1], - parents : parents, - key : path.slice(-1)[0], - isRoot : path.length === 0, - level : path.length, - circular : null, - update : function (x, stopHere) { - if (!state.isRoot) { - state.parent.node[state.key] = x; - } - state.node = x; - if (stopHere) keepGoing = false; - }, - 'delete' : function (stopHere) { - delete state.parent.node[state.key]; - if (stopHere) keepGoing = false; - }, - remove : function (stopHere) { - if (isArray(state.parent.node)) { - state.parent.node.splice(state.key, 1); - } - else { - delete state.parent.node[state.key]; - } - if (stopHere) keepGoing = false; - }, - keys : null, - before : function (f) { modifiers.before = f }, - after : function (f) { modifiers.after = f }, - pre : function (f) { modifiers.pre = f }, - post : function (f) { modifiers.post = f }, - stop : function () { alive = false }, - block : function () { keepGoing = false } - }; - - if (!alive) return state; - - function updateState() { - if (typeof state.node === 'object' && state.node !== null) { - if (!state.keys || state.node_ !== state.node) { - state.keys = objectKeys(state.node) - } - - state.isLeaf = state.keys.length == 0; - - for (var i = 0; i < parents.length; i++) { - if (parents[i].node_ === node_) { - state.circular = parents[i]; - break; - } - } - } - else { - state.isLeaf = true; - state.keys = null; - } - - state.notLeaf = !state.isLeaf; - state.notRoot = !state.isRoot; - } - - updateState(); - - // use return values to update if defined - var ret = cb.call(state, state.node); - if (ret !== undefined && state.update) state.update(ret); - - if (modifiers.before) modifiers.before.call(state, state.node); - - if (!keepGoing) return state; - - if (typeof state.node == 'object' - && state.node !== null && !state.circular) { - parents.push(state); - - updateState(); - - forEach(state.keys, function (key, i) { - path.push(key); - - if (modifiers.pre) modifiers.pre.call(state, state.node[key], key); - - var child = walker(state.node[key]); - if (immutable && hasOwnProperty.call(state.node, key)) { - state.node[key] = child.node; - } - - child.isLast = i == state.keys.length - 1; - child.isFirst = i == 0; - - if (modifiers.post) modifiers.post.call(state, child); - - path.pop(); - }); - parents.pop(); - } - - if (modifiers.after) modifiers.after.call(state, state.node); - - return state; - })(root).node; -} - -function copy (src) { - if (typeof src === 'object' && src !== null) { - var dst; - - if (isArray(src)) { - dst = []; - } - else if (isDate(src)) { - dst = new Date(src.getTime ? src.getTime() : src); - } - else if (isRegExp(src)) { - dst = new RegExp(src); - } - else if (isError(src)) { - dst = { message: src.message }; - } - else if (isBoolean(src)) { - dst = new Boolean(src); - } - else if (isNumber(src)) { - dst = new Number(src); - } - else if (isString(src)) { - dst = new String(src); - } - else if (Object.create && Object.getPrototypeOf) { - dst = Object.create(Object.getPrototypeOf(src)); - } - else if (src.constructor === Object) { - dst = {}; - } - else { - var proto = - (src.constructor && src.constructor.prototype) - || src.__proto__ - || {} - ; - var T = function () {}; - T.prototype = proto; - dst = new T; - } - - forEach(objectKeys(src), function (key) { - dst[key] = src[key]; - }); - return dst; - } - else return src; -} - -var objectKeys = Object.keys || function keys (obj) { - var res = []; - for (var key in obj) res.push(key) - return res; -}; - -function toS (obj) { return Object.prototype.toString.call(obj) } -function isDate (obj) { return toS(obj) === '[object Date]' } -function isRegExp (obj) { return toS(obj) === '[object RegExp]' } -function isError (obj) { return toS(obj) === '[object Error]' } -function isBoolean (obj) { return toS(obj) === '[object Boolean]' } -function isNumber (obj) { return toS(obj) === '[object Number]' } -function isString (obj) { return toS(obj) === '[object String]' } - -var isArray = Array.isArray || function isArray (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; - -var forEach = function (xs, fn) { - if (xs.forEach) return xs.forEach(fn) - else for (var i = 0; i < xs.length; i++) { - fn(xs[i], i, xs); - } -}; - -forEach(objectKeys(Traverse.prototype), function (key) { - traverse[key] = function (obj) { - var args = [].slice.call(arguments, 1); - var t = new Traverse(obj); - return t[key].apply(t, args); - }; -}); - -var hasOwnProperty = Object.hasOwnProperty || function (obj, key) { - return key in obj; -}; - - -/***/ }), - -/***/ 23: -/***/ (function(module, exports, __webpack_require__) { - -module.exports = __webpack_require__(54); - - -/***/ }), - -/***/ 25: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["url"]; }()); - -/***/ }), - -/***/ 26: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["hooks"]; }()); - -/***/ }), - -/***/ 27: -/***/ (function(module, exports) { - -(function() { module.exports = this["React"]; }()); - -/***/ }), - -/***/ 28: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js -var arrayWithHoles = __webpack_require__(37); - -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js -function _iterableToArrayLimit(arr, i) { - var _arr = []; - var _n = true; - var _d = false; - var _e = undefined; - - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) _i["return"](); - } finally { - if (_d) throw _e; - } - } - - return _arr; -} -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js -var nonIterableRest = __webpack_require__(38); - -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _slicedToArray; }); - - - -function _slicedToArray(arr, i) { - return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(nonIterableRest["a" /* default */])(); -} - -/***/ }), - -/***/ 3: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _assertThisInitialized; }); -function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - - return self; -} - -/***/ }), - -/***/ 30: +/***/ 42: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -2456,67 +1840,7 @@ /***/ }), -/***/ 31: -/***/ (function(module, exports, __webpack_require__) { - -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -if (false) { var throwOnDirectAccess, isValidElement, REACT_ELEMENT_TYPE; } else { - // By explicitly using `prop-types` you are opting into new production behavior. - // http://fb.me/prop-types-in-prod - module.exports = __webpack_require__(89)(); -} - - -/***/ }), - -/***/ 32: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; }); -function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); } - -function _typeof(obj) { - if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") { - _typeof = function _typeof(obj) { - return _typeof2(obj); - }; - } else { - _typeof = function _typeof(obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj); - }; - } - - return _typeof(obj); -} - -/***/ }), - -/***/ 33: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["apiFetch"]; }()); - -/***/ }), - -/***/ 34: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; }); -function _iterableToArray(iter) { - if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); -} - -/***/ }), - -/***/ 341: +/***/ 421: /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -2682,62 +2006,181 @@ /***/ }), -/***/ 35: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["blob"]; }()); - -/***/ }), - -/***/ 358: +/***/ 438: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +// ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); + +// EXPORTS +__webpack_require__.d(__webpack_exports__, "userAutocompleter", function() { return /* reexport */ autocompleters_user; }); +__webpack_require__.d(__webpack_exports__, "AutosaveMonitor", function() { return /* reexport */ autosave_monitor; }); +__webpack_require__.d(__webpack_exports__, "DocumentOutline", function() { return /* reexport */ document_outline; }); +__webpack_require__.d(__webpack_exports__, "DocumentOutlineCheck", function() { return /* reexport */ check; }); +__webpack_require__.d(__webpack_exports__, "VisualEditorGlobalKeyboardShortcuts", function() { return /* reexport */ visual_editor_shortcuts; }); +__webpack_require__.d(__webpack_exports__, "EditorGlobalKeyboardShortcuts", function() { return /* reexport */ EditorGlobalKeyboardShortcuts; }); +__webpack_require__.d(__webpack_exports__, "TextEditorGlobalKeyboardShortcuts", function() { return /* reexport */ TextEditorGlobalKeyboardShortcuts; }); +__webpack_require__.d(__webpack_exports__, "EditorKeyboardShortcutsRegister", function() { return /* reexport */ register_shortcuts; }); +__webpack_require__.d(__webpack_exports__, "EditorHistoryRedo", function() { return /* reexport */ editor_history_redo; }); +__webpack_require__.d(__webpack_exports__, "EditorHistoryUndo", function() { return /* reexport */ editor_history_undo; }); +__webpack_require__.d(__webpack_exports__, "EditorNotices", function() { return /* reexport */ editor_notices; }); +__webpack_require__.d(__webpack_exports__, "EntitiesSavedStates", function() { return /* reexport */ EntitiesSavedStates; }); +__webpack_require__.d(__webpack_exports__, "ErrorBoundary", function() { return /* reexport */ error_boundary; }); +__webpack_require__.d(__webpack_exports__, "LocalAutosaveMonitor", function() { return /* reexport */ local_autosave_monitor; }); +__webpack_require__.d(__webpack_exports__, "PageAttributesCheck", function() { return /* reexport */ page_attributes_check; }); +__webpack_require__.d(__webpack_exports__, "PageAttributesOrder", function() { return /* reexport */ page_attributes_order; }); +__webpack_require__.d(__webpack_exports__, "PageAttributesParent", function() { return /* reexport */ page_attributes_parent; }); +__webpack_require__.d(__webpack_exports__, "PageTemplate", function() { return /* reexport */ page_attributes_template; }); +__webpack_require__.d(__webpack_exports__, "PostAuthor", function() { return /* reexport */ post_author; }); +__webpack_require__.d(__webpack_exports__, "PostAuthorCheck", function() { return /* reexport */ post_author_check; }); +__webpack_require__.d(__webpack_exports__, "PostComments", function() { return /* reexport */ post_comments; }); +__webpack_require__.d(__webpack_exports__, "PostExcerpt", function() { return /* reexport */ post_excerpt; }); +__webpack_require__.d(__webpack_exports__, "PostExcerptCheck", function() { return /* reexport */ post_excerpt_check; }); +__webpack_require__.d(__webpack_exports__, "PostFeaturedImage", function() { return /* reexport */ post_featured_image; }); +__webpack_require__.d(__webpack_exports__, "PostFeaturedImageCheck", function() { return /* reexport */ post_featured_image_check; }); +__webpack_require__.d(__webpack_exports__, "PostFormat", function() { return /* reexport */ post_format; }); +__webpack_require__.d(__webpack_exports__, "PostFormatCheck", function() { return /* reexport */ post_format_check; }); +__webpack_require__.d(__webpack_exports__, "PostLastRevision", function() { return /* reexport */ post_last_revision; }); +__webpack_require__.d(__webpack_exports__, "PostLastRevisionCheck", function() { return /* reexport */ post_last_revision_check; }); +__webpack_require__.d(__webpack_exports__, "PostLockedModal", function() { return /* reexport */ post_locked_modal; }); +__webpack_require__.d(__webpack_exports__, "PostPendingStatus", function() { return /* reexport */ post_pending_status; }); +__webpack_require__.d(__webpack_exports__, "PostPendingStatusCheck", function() { return /* reexport */ post_pending_status_check; }); +__webpack_require__.d(__webpack_exports__, "PostPingbacks", function() { return /* reexport */ post_pingbacks; }); +__webpack_require__.d(__webpack_exports__, "PostPreviewButton", function() { return /* reexport */ post_preview_button; }); +__webpack_require__.d(__webpack_exports__, "PostPublishButton", function() { return /* reexport */ post_publish_button; }); +__webpack_require__.d(__webpack_exports__, "PostPublishButtonLabel", function() { return /* reexport */ post_publish_button_label; }); +__webpack_require__.d(__webpack_exports__, "PostPublishPanel", function() { return /* reexport */ post_publish_panel; }); +__webpack_require__.d(__webpack_exports__, "PostSavedState", function() { return /* reexport */ post_saved_state; }); +__webpack_require__.d(__webpack_exports__, "PostSchedule", function() { return /* reexport */ post_schedule; }); +__webpack_require__.d(__webpack_exports__, "PostScheduleCheck", function() { return /* reexport */ post_schedule_check; }); +__webpack_require__.d(__webpack_exports__, "PostScheduleLabel", function() { return /* reexport */ post_schedule_label; }); +__webpack_require__.d(__webpack_exports__, "PostSlug", function() { return /* reexport */ post_slug; }); +__webpack_require__.d(__webpack_exports__, "PostSlugCheck", function() { return /* reexport */ PostSlugCheck; }); +__webpack_require__.d(__webpack_exports__, "PostSticky", function() { return /* reexport */ post_sticky; }); +__webpack_require__.d(__webpack_exports__, "PostStickyCheck", function() { return /* reexport */ post_sticky_check; }); +__webpack_require__.d(__webpack_exports__, "PostSwitchToDraftButton", function() { return /* reexport */ post_switch_to_draft_button; }); +__webpack_require__.d(__webpack_exports__, "PostTaxonomies", function() { return /* reexport */ post_taxonomies; }); +__webpack_require__.d(__webpack_exports__, "PostTaxonomiesCheck", function() { return /* reexport */ post_taxonomies_check; }); +__webpack_require__.d(__webpack_exports__, "PostTextEditor", function() { return /* reexport */ post_text_editor; }); +__webpack_require__.d(__webpack_exports__, "PostTitle", function() { return /* reexport */ post_title; }); +__webpack_require__.d(__webpack_exports__, "PostTrash", function() { return /* reexport */ post_trash; }); +__webpack_require__.d(__webpack_exports__, "PostTrashCheck", function() { return /* reexport */ post_trash_check; }); +__webpack_require__.d(__webpack_exports__, "PostTypeSupportCheck", function() { return /* reexport */ post_type_support_check; }); +__webpack_require__.d(__webpack_exports__, "PostVisibility", function() { return /* reexport */ post_visibility; }); +__webpack_require__.d(__webpack_exports__, "PostVisibilityLabel", function() { return /* reexport */ post_visibility_label; }); +__webpack_require__.d(__webpack_exports__, "PostVisibilityCheck", function() { return /* reexport */ post_visibility_check; }); +__webpack_require__.d(__webpack_exports__, "TableOfContents", function() { return /* reexport */ table_of_contents; }); +__webpack_require__.d(__webpack_exports__, "UnsavedChangesWarning", function() { return /* reexport */ unsaved_changes_warning; }); +__webpack_require__.d(__webpack_exports__, "WordCount", function() { return /* reexport */ word_count; }); +__webpack_require__.d(__webpack_exports__, "EditorProvider", function() { return /* reexport */ provider; }); +__webpack_require__.d(__webpack_exports__, "ServerSideRender", function() { return /* reexport */ external_this_wp_serverSideRender_default.a; }); +__webpack_require__.d(__webpack_exports__, "RichText", function() { return /* reexport */ RichText; }); +__webpack_require__.d(__webpack_exports__, "Autocomplete", function() { return /* reexport */ Autocomplete; }); +__webpack_require__.d(__webpack_exports__, "AlignmentToolbar", function() { return /* reexport */ AlignmentToolbar; }); +__webpack_require__.d(__webpack_exports__, "BlockAlignmentToolbar", function() { return /* reexport */ BlockAlignmentToolbar; }); +__webpack_require__.d(__webpack_exports__, "BlockControls", function() { return /* reexport */ BlockControls; }); +__webpack_require__.d(__webpack_exports__, "BlockEdit", function() { return /* reexport */ deprecated_BlockEdit; }); +__webpack_require__.d(__webpack_exports__, "BlockEditorKeyboardShortcuts", function() { return /* reexport */ BlockEditorKeyboardShortcuts; }); +__webpack_require__.d(__webpack_exports__, "BlockFormatControls", function() { return /* reexport */ BlockFormatControls; }); +__webpack_require__.d(__webpack_exports__, "BlockIcon", function() { return /* reexport */ BlockIcon; }); +__webpack_require__.d(__webpack_exports__, "BlockInspector", function() { return /* reexport */ BlockInspector; }); +__webpack_require__.d(__webpack_exports__, "BlockList", function() { return /* reexport */ BlockList; }); +__webpack_require__.d(__webpack_exports__, "BlockMover", function() { return /* reexport */ BlockMover; }); +__webpack_require__.d(__webpack_exports__, "BlockNavigationDropdown", function() { return /* reexport */ BlockNavigationDropdown; }); +__webpack_require__.d(__webpack_exports__, "BlockSelectionClearer", function() { return /* reexport */ BlockSelectionClearer; }); +__webpack_require__.d(__webpack_exports__, "BlockSettingsMenu", function() { return /* reexport */ BlockSettingsMenu; }); +__webpack_require__.d(__webpack_exports__, "BlockTitle", function() { return /* reexport */ BlockTitle; }); +__webpack_require__.d(__webpack_exports__, "BlockToolbar", function() { return /* reexport */ BlockToolbar; }); +__webpack_require__.d(__webpack_exports__, "ColorPalette", function() { return /* reexport */ ColorPalette; }); +__webpack_require__.d(__webpack_exports__, "ContrastChecker", function() { return /* reexport */ ContrastChecker; }); +__webpack_require__.d(__webpack_exports__, "CopyHandler", function() { return /* reexport */ CopyHandler; }); +__webpack_require__.d(__webpack_exports__, "DefaultBlockAppender", function() { return /* reexport */ DefaultBlockAppender; }); +__webpack_require__.d(__webpack_exports__, "FontSizePicker", function() { return /* reexport */ FontSizePicker; }); +__webpack_require__.d(__webpack_exports__, "Inserter", function() { return /* reexport */ Inserter; }); +__webpack_require__.d(__webpack_exports__, "InnerBlocks", function() { return /* reexport */ InnerBlocks; }); +__webpack_require__.d(__webpack_exports__, "InspectorAdvancedControls", function() { return /* reexport */ InspectorAdvancedControls; }); +__webpack_require__.d(__webpack_exports__, "InspectorControls", function() { return /* reexport */ InspectorControls; }); +__webpack_require__.d(__webpack_exports__, "PanelColorSettings", function() { return /* reexport */ PanelColorSettings; }); +__webpack_require__.d(__webpack_exports__, "PlainText", function() { return /* reexport */ PlainText; }); +__webpack_require__.d(__webpack_exports__, "RichTextShortcut", function() { return /* reexport */ RichTextShortcut; }); +__webpack_require__.d(__webpack_exports__, "RichTextToolbarButton", function() { return /* reexport */ RichTextToolbarButton; }); +__webpack_require__.d(__webpack_exports__, "__unstableRichTextInputEvent", function() { return /* reexport */ __unstableRichTextInputEvent; }); +__webpack_require__.d(__webpack_exports__, "MediaPlaceholder", function() { return /* reexport */ MediaPlaceholder; }); +__webpack_require__.d(__webpack_exports__, "MediaUpload", function() { return /* reexport */ MediaUpload; }); +__webpack_require__.d(__webpack_exports__, "MediaUploadCheck", function() { return /* reexport */ MediaUploadCheck; }); +__webpack_require__.d(__webpack_exports__, "MultiSelectScrollIntoView", function() { return /* reexport */ MultiSelectScrollIntoView; }); +__webpack_require__.d(__webpack_exports__, "NavigableToolbar", function() { return /* reexport */ NavigableToolbar; }); +__webpack_require__.d(__webpack_exports__, "ObserveTyping", function() { return /* reexport */ ObserveTyping; }); +__webpack_require__.d(__webpack_exports__, "PreserveScrollInReorder", function() { return /* reexport */ PreserveScrollInReorder; }); +__webpack_require__.d(__webpack_exports__, "SkipToSelectedBlock", function() { return /* reexport */ SkipToSelectedBlock; }); +__webpack_require__.d(__webpack_exports__, "URLInput", function() { return /* reexport */ URLInput; }); +__webpack_require__.d(__webpack_exports__, "URLInputButton", function() { return /* reexport */ URLInputButton; }); +__webpack_require__.d(__webpack_exports__, "URLPopover", function() { return /* reexport */ URLPopover; }); +__webpack_require__.d(__webpack_exports__, "Warning", function() { return /* reexport */ Warning; }); +__webpack_require__.d(__webpack_exports__, "WritingFlow", function() { return /* reexport */ WritingFlow; }); +__webpack_require__.d(__webpack_exports__, "createCustomColorsHOC", function() { return /* reexport */ createCustomColorsHOC; }); +__webpack_require__.d(__webpack_exports__, "getColorClassName", function() { return /* reexport */ getColorClassName; }); +__webpack_require__.d(__webpack_exports__, "getColorObjectByAttributeValues", function() { return /* reexport */ getColorObjectByAttributeValues; }); +__webpack_require__.d(__webpack_exports__, "getColorObjectByColorValue", function() { return /* reexport */ getColorObjectByColorValue; }); +__webpack_require__.d(__webpack_exports__, "getFontSize", function() { return /* reexport */ getFontSize; }); +__webpack_require__.d(__webpack_exports__, "getFontSizeClass", function() { return /* reexport */ getFontSizeClass; }); +__webpack_require__.d(__webpack_exports__, "withColorContext", function() { return /* reexport */ withColorContext; }); +__webpack_require__.d(__webpack_exports__, "withColors", function() { return /* reexport */ withColors; }); +__webpack_require__.d(__webpack_exports__, "withFontSizes", function() { return /* reexport */ withFontSizes; }); +__webpack_require__.d(__webpack_exports__, "mediaUpload", function() { return /* reexport */ mediaUpload; }); +__webpack_require__.d(__webpack_exports__, "cleanForSlug", function() { return /* reexport */ cleanForSlug; }); +__webpack_require__.d(__webpack_exports__, "storeConfig", function() { return /* reexport */ storeConfig; }); +__webpack_require__.d(__webpack_exports__, "transformStyles", function() { return /* reexport */ external_this_wp_blockEditor_["transformStyles"]; }); + +// NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, "setupEditor", function() { return setupEditor; }); +__webpack_require__.d(actions_namespaceObject, "__experimentalTearDownEditor", function() { return __experimentalTearDownEditor; }); __webpack_require__.d(actions_namespaceObject, "resetPost", function() { return resetPost; }); __webpack_require__.d(actions_namespaceObject, "resetAutosave", function() { return resetAutosave; }); __webpack_require__.d(actions_namespaceObject, "__experimentalRequestPostUpdateStart", function() { return __experimentalRequestPostUpdateStart; }); -__webpack_require__.d(actions_namespaceObject, "__experimentalRequestPostUpdateSuccess", function() { return __experimentalRequestPostUpdateSuccess; }); -__webpack_require__.d(actions_namespaceObject, "__experimentalRequestPostUpdateFailure", function() { return __experimentalRequestPostUpdateFailure; }); +__webpack_require__.d(actions_namespaceObject, "__experimentalRequestPostUpdateFinish", function() { return __experimentalRequestPostUpdateFinish; }); __webpack_require__.d(actions_namespaceObject, "updatePost", function() { return updatePost; }); __webpack_require__.d(actions_namespaceObject, "setupEditorState", function() { return setupEditorState; }); __webpack_require__.d(actions_namespaceObject, "editPost", function() { return actions_editPost; }); __webpack_require__.d(actions_namespaceObject, "__experimentalOptimisticUpdatePost", function() { return __experimentalOptimisticUpdatePost; }); -__webpack_require__.d(actions_namespaceObject, "savePost", function() { return savePost; }); +__webpack_require__.d(actions_namespaceObject, "savePost", function() { return actions_savePost; }); __webpack_require__.d(actions_namespaceObject, "refreshPost", function() { return refreshPost; }); __webpack_require__.d(actions_namespaceObject, "trashPost", function() { return trashPost; }); __webpack_require__.d(actions_namespaceObject, "autosave", function() { return actions_autosave; }); +__webpack_require__.d(actions_namespaceObject, "__experimentalLocalAutosave", function() { return actions_experimentalLocalAutosave; }); __webpack_require__.d(actions_namespaceObject, "redo", function() { return actions_redo; }); __webpack_require__.d(actions_namespaceObject, "undo", function() { return actions_undo; }); __webpack_require__.d(actions_namespaceObject, "createUndoLevel", function() { return createUndoLevel; }); __webpack_require__.d(actions_namespaceObject, "updatePostLock", function() { return updatePostLock; }); -__webpack_require__.d(actions_namespaceObject, "__experimentalFetchReusableBlocks", function() { return __experimentalFetchReusableBlocks; }); +__webpack_require__.d(actions_namespaceObject, "__experimentalFetchReusableBlocks", function() { return actions_experimentalFetchReusableBlocks; }); __webpack_require__.d(actions_namespaceObject, "__experimentalReceiveReusableBlocks", function() { return __experimentalReceiveReusableBlocks; }); __webpack_require__.d(actions_namespaceObject, "__experimentalSaveReusableBlock", function() { return __experimentalSaveReusableBlock; }); __webpack_require__.d(actions_namespaceObject, "__experimentalDeleteReusableBlock", function() { return __experimentalDeleteReusableBlock; }); -__webpack_require__.d(actions_namespaceObject, "__experimentalUpdateReusableBlockTitle", function() { return __experimentalUpdateReusableBlockTitle; }); +__webpack_require__.d(actions_namespaceObject, "__experimentalUpdateReusableBlock", function() { return __experimentalUpdateReusableBlock; }); __webpack_require__.d(actions_namespaceObject, "__experimentalConvertBlockToStatic", function() { return __experimentalConvertBlockToStatic; }); __webpack_require__.d(actions_namespaceObject, "__experimentalConvertBlockToReusable", function() { return __experimentalConvertBlockToReusable; }); __webpack_require__.d(actions_namespaceObject, "enablePublishSidebar", function() { return enablePublishSidebar; }); __webpack_require__.d(actions_namespaceObject, "disablePublishSidebar", function() { return disablePublishSidebar; }); __webpack_require__.d(actions_namespaceObject, "lockPostSaving", function() { return lockPostSaving; }); __webpack_require__.d(actions_namespaceObject, "unlockPostSaving", function() { return unlockPostSaving; }); +__webpack_require__.d(actions_namespaceObject, "lockPostAutosaving", function() { return lockPostAutosaving; }); +__webpack_require__.d(actions_namespaceObject, "unlockPostAutosaving", function() { return unlockPostAutosaving; }); __webpack_require__.d(actions_namespaceObject, "resetEditorBlocks", function() { return actions_resetEditorBlocks; }); __webpack_require__.d(actions_namespaceObject, "updateEditorSettings", function() { return updateEditorSettings; }); __webpack_require__.d(actions_namespaceObject, "resetBlocks", function() { return resetBlocks; }); __webpack_require__.d(actions_namespaceObject, "receiveBlocks", function() { return receiveBlocks; }); __webpack_require__.d(actions_namespaceObject, "updateBlock", function() { return updateBlock; }); __webpack_require__.d(actions_namespaceObject, "updateBlockAttributes", function() { return updateBlockAttributes; }); -__webpack_require__.d(actions_namespaceObject, "selectBlock", function() { return selectBlock; }); +__webpack_require__.d(actions_namespaceObject, "selectBlock", function() { return actions_selectBlock; }); __webpack_require__.d(actions_namespaceObject, "startMultiSelect", function() { return startMultiSelect; }); __webpack_require__.d(actions_namespaceObject, "stopMultiSelect", function() { return stopMultiSelect; }); __webpack_require__.d(actions_namespaceObject, "multiSelect", function() { return multiSelect; }); __webpack_require__.d(actions_namespaceObject, "clearSelectedBlock", function() { return clearSelectedBlock; }); __webpack_require__.d(actions_namespaceObject, "toggleSelection", function() { return toggleSelection; }); -__webpack_require__.d(actions_namespaceObject, "replaceBlocks", function() { return replaceBlocks; }); +__webpack_require__.d(actions_namespaceObject, "replaceBlocks", function() { return actions_replaceBlocks; }); __webpack_require__.d(actions_namespaceObject, "replaceBlock", function() { return replaceBlock; }); __webpack_require__.d(actions_namespaceObject, "moveBlocksDown", function() { return moveBlocksDown; }); __webpack_require__.d(actions_namespaceObject, "moveBlocksUp", function() { return moveBlocksUp; }); @@ -2758,20 +2201,23 @@ __webpack_require__.d(actions_namespaceObject, "exitFormattedText", function() { return exitFormattedText; }); __webpack_require__.d(actions_namespaceObject, "insertDefaultBlock", function() { return insertDefaultBlock; }); __webpack_require__.d(actions_namespaceObject, "updateBlockListSettings", function() { return updateBlockListSettings; }); + +// NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, "hasEditorUndo", function() { return hasEditorUndo; }); __webpack_require__.d(selectors_namespaceObject, "hasEditorRedo", function() { return hasEditorRedo; }); -__webpack_require__.d(selectors_namespaceObject, "isEditedPostNew", function() { return selectors_isEditedPostNew; }); +__webpack_require__.d(selectors_namespaceObject, "isEditedPostNew", function() { return isEditedPostNew; }); __webpack_require__.d(selectors_namespaceObject, "hasChangedContent", function() { return hasChangedContent; }); __webpack_require__.d(selectors_namespaceObject, "isEditedPostDirty", function() { return selectors_isEditedPostDirty; }); +__webpack_require__.d(selectors_namespaceObject, "hasNonPostEntityChanges", function() { return selectors_hasNonPostEntityChanges; }); __webpack_require__.d(selectors_namespaceObject, "isCleanNewPost", function() { return selectors_isCleanNewPost; }); __webpack_require__.d(selectors_namespaceObject, "getCurrentPost", function() { return selectors_getCurrentPost; }); __webpack_require__.d(selectors_namespaceObject, "getCurrentPostType", function() { return selectors_getCurrentPostType; }); __webpack_require__.d(selectors_namespaceObject, "getCurrentPostId", function() { return selectors_getCurrentPostId; }); __webpack_require__.d(selectors_namespaceObject, "getCurrentPostRevisionsCount", function() { return getCurrentPostRevisionsCount; }); __webpack_require__.d(selectors_namespaceObject, "getCurrentPostLastRevisionId", function() { return getCurrentPostLastRevisionId; }); -__webpack_require__.d(selectors_namespaceObject, "getPostEdits", function() { return getPostEdits; }); +__webpack_require__.d(selectors_namespaceObject, "getPostEdits", function() { return selectors_getPostEdits; }); __webpack_require__.d(selectors_namespaceObject, "getReferenceByDistinctEdits", function() { return getReferenceByDistinctEdits; }); __webpack_require__.d(selectors_namespaceObject, "getCurrentPostAttribute", function() { return selectors_getCurrentPostAttribute; }); __webpack_require__.d(selectors_namespaceObject, "getEditedPostAttribute", function() { return selectors_getEditedPostAttribute; }); @@ -2800,40 +2246,43 @@ __webpack_require__.d(selectors_namespaceObject, "__experimentalGetReusableBlock", function() { return __experimentalGetReusableBlock; }); __webpack_require__.d(selectors_namespaceObject, "__experimentalIsSavingReusableBlock", function() { return __experimentalIsSavingReusableBlock; }); __webpack_require__.d(selectors_namespaceObject, "__experimentalIsFetchingReusableBlock", function() { return __experimentalIsFetchingReusableBlock; }); -__webpack_require__.d(selectors_namespaceObject, "__experimentalGetReusableBlocks", function() { return __experimentalGetReusableBlocks; }); +__webpack_require__.d(selectors_namespaceObject, "__experimentalGetReusableBlocks", function() { return selectors_experimentalGetReusableBlocks; }); __webpack_require__.d(selectors_namespaceObject, "getStateBeforeOptimisticTransaction", function() { return getStateBeforeOptimisticTransaction; }); __webpack_require__.d(selectors_namespaceObject, "isPublishingPost", function() { return selectors_isPublishingPost; }); -__webpack_require__.d(selectors_namespaceObject, "isPermalinkEditable", function() { return selectors_isPermalinkEditable; }); +__webpack_require__.d(selectors_namespaceObject, "isPermalinkEditable", function() { return isPermalinkEditable; }); __webpack_require__.d(selectors_namespaceObject, "getPermalink", function() { return getPermalink; }); -__webpack_require__.d(selectors_namespaceObject, "getPermalinkParts", function() { return selectors_getPermalinkParts; }); +__webpack_require__.d(selectors_namespaceObject, "getEditedPostSlug", function() { return getEditedPostSlug; }); +__webpack_require__.d(selectors_namespaceObject, "getPermalinkParts", function() { return getPermalinkParts; }); __webpack_require__.d(selectors_namespaceObject, "inSomeHistory", function() { return inSomeHistory; }); __webpack_require__.d(selectors_namespaceObject, "isPostLocked", function() { return isPostLocked; }); __webpack_require__.d(selectors_namespaceObject, "isPostSavingLocked", function() { return selectors_isPostSavingLocked; }); +__webpack_require__.d(selectors_namespaceObject, "isPostAutosavingLocked", function() { return isPostAutosavingLocked; }); __webpack_require__.d(selectors_namespaceObject, "isPostLockTakeover", function() { return isPostLockTakeover; }); __webpack_require__.d(selectors_namespaceObject, "getPostLockUser", function() { return getPostLockUser; }); __webpack_require__.d(selectors_namespaceObject, "getActivePostLock", function() { return getActivePostLock; }); -__webpack_require__.d(selectors_namespaceObject, "canUserUseUnfilteredHTML", function() { return canUserUseUnfilteredHTML; }); +__webpack_require__.d(selectors_namespaceObject, "canUserUseUnfilteredHTML", function() { return selectors_canUserUseUnfilteredHTML; }); __webpack_require__.d(selectors_namespaceObject, "isPublishSidebarEnabled", function() { return selectors_isPublishSidebarEnabled; }); -__webpack_require__.d(selectors_namespaceObject, "getEditorBlocks", function() { return getEditorBlocks; }); +__webpack_require__.d(selectors_namespaceObject, "getEditorBlocks", function() { return selectors_getEditorBlocks; }); +__webpack_require__.d(selectors_namespaceObject, "getEditorSelectionStart", function() { return selectors_getEditorSelectionStart; }); +__webpack_require__.d(selectors_namespaceObject, "getEditorSelectionEnd", function() { return selectors_getEditorSelectionEnd; }); __webpack_require__.d(selectors_namespaceObject, "__unstableIsEditorReady", function() { return __unstableIsEditorReady; }); __webpack_require__.d(selectors_namespaceObject, "getEditorSettings", function() { return selectors_getEditorSettings; }); -__webpack_require__.d(selectors_namespaceObject, "getBlockDependantsCacheBust", function() { return getBlockDependantsCacheBust; }); -__webpack_require__.d(selectors_namespaceObject, "getBlockName", function() { return selectors_getBlockName; }); +__webpack_require__.d(selectors_namespaceObject, "getBlockName", function() { return getBlockName; }); __webpack_require__.d(selectors_namespaceObject, "isBlockValid", function() { return isBlockValid; }); __webpack_require__.d(selectors_namespaceObject, "getBlockAttributes", function() { return getBlockAttributes; }); -__webpack_require__.d(selectors_namespaceObject, "getBlock", function() { return getBlock; }); +__webpack_require__.d(selectors_namespaceObject, "getBlock", function() { return selectors_getBlock; }); __webpack_require__.d(selectors_namespaceObject, "getBlocks", function() { return selectors_getBlocks; }); __webpack_require__.d(selectors_namespaceObject, "__unstableGetBlockWithoutInnerBlocks", function() { return __unstableGetBlockWithoutInnerBlocks; }); __webpack_require__.d(selectors_namespaceObject, "getClientIdsOfDescendants", function() { return getClientIdsOfDescendants; }); __webpack_require__.d(selectors_namespaceObject, "getClientIdsWithDescendants", function() { return getClientIdsWithDescendants; }); __webpack_require__.d(selectors_namespaceObject, "getGlobalBlockCount", function() { return getGlobalBlockCount; }); -__webpack_require__.d(selectors_namespaceObject, "getBlocksByClientId", function() { return getBlocksByClientId; }); +__webpack_require__.d(selectors_namespaceObject, "getBlocksByClientId", function() { return selectors_getBlocksByClientId; }); __webpack_require__.d(selectors_namespaceObject, "getBlockCount", function() { return getBlockCount; }); __webpack_require__.d(selectors_namespaceObject, "getBlockSelectionStart", function() { return getBlockSelectionStart; }); __webpack_require__.d(selectors_namespaceObject, "getBlockSelectionEnd", function() { return getBlockSelectionEnd; }); __webpack_require__.d(selectors_namespaceObject, "getSelectedBlockCount", function() { return getSelectedBlockCount; }); __webpack_require__.d(selectors_namespaceObject, "hasSelectedBlock", function() { return hasSelectedBlock; }); -__webpack_require__.d(selectors_namespaceObject, "getSelectedBlockClientId", function() { return selectors_getSelectedBlockClientId; }); +__webpack_require__.d(selectors_namespaceObject, "getSelectedBlockClientId", function() { return getSelectedBlockClientId; }); __webpack_require__.d(selectors_namespaceObject, "getSelectedBlock", function() { return getSelectedBlock; }); __webpack_require__.d(selectors_namespaceObject, "getBlockRootClientId", function() { return getBlockRootClientId; }); __webpack_require__.d(selectors_namespaceObject, "getBlockHierarchyRootClientId", function() { return getBlockHierarchyRootClientId; }); @@ -2859,86 +2308,80 @@ __webpack_require__.d(selectors_namespaceObject, "isMultiSelecting", function() { return isMultiSelecting; }); __webpack_require__.d(selectors_namespaceObject, "isSelectionEnabled", function() { return isSelectionEnabled; }); __webpack_require__.d(selectors_namespaceObject, "getBlockMode", function() { return getBlockMode; }); -__webpack_require__.d(selectors_namespaceObject, "isTyping", function() { return selectors_isTyping; }); -__webpack_require__.d(selectors_namespaceObject, "isCaretWithinFormattedText", function() { return selectors_isCaretWithinFormattedText; }); +__webpack_require__.d(selectors_namespaceObject, "isTyping", function() { return isTyping; }); +__webpack_require__.d(selectors_namespaceObject, "isCaretWithinFormattedText", function() { return isCaretWithinFormattedText; }); __webpack_require__.d(selectors_namespaceObject, "getBlockInsertionPoint", function() { return getBlockInsertionPoint; }); __webpack_require__.d(selectors_namespaceObject, "isBlockInsertionPointVisible", function() { return isBlockInsertionPointVisible; }); __webpack_require__.d(selectors_namespaceObject, "isValidTemplate", function() { return isValidTemplate; }); __webpack_require__.d(selectors_namespaceObject, "getTemplate", function() { return getTemplate; }); __webpack_require__.d(selectors_namespaceObject, "getTemplateLock", function() { return getTemplateLock; }); -__webpack_require__.d(selectors_namespaceObject, "canInsertBlockType", function() { return canInsertBlockType; }); -__webpack_require__.d(selectors_namespaceObject, "getInserterItems", function() { return selectors_getInserterItems; }); +__webpack_require__.d(selectors_namespaceObject, "canInsertBlockType", function() { return selectors_canInsertBlockType; }); +__webpack_require__.d(selectors_namespaceObject, "getInserterItems", function() { return getInserterItems; }); __webpack_require__.d(selectors_namespaceObject, "hasInserterItems", function() { return hasInserterItems; }); __webpack_require__.d(selectors_namespaceObject, "getBlockListSettings", function() { return getBlockListSettings; }); // EXTERNAL MODULE: external {"this":["wp","blockEditor"]} -var external_this_wp_blockEditor_ = __webpack_require__(8); +var external_this_wp_blockEditor_ = __webpack_require__(7); // EXTERNAL MODULE: external {"this":["wp","blocks"]} -var external_this_wp_blocks_ = __webpack_require__(14); +var external_this_wp_blocks_ = __webpack_require__(10); // EXTERNAL MODULE: external {"this":["wp","coreData"]} -var external_this_wp_coreData_ = __webpack_require__(72); +var external_this_wp_coreData_ = __webpack_require__(98); + +// EXTERNAL MODULE: external {"this":["wp","keyboardShortcuts"]} +var external_this_wp_keyboardShortcuts_ = __webpack_require__(52); // EXTERNAL MODULE: external {"this":["wp","notices"]} -var external_this_wp_notices_ = __webpack_require__(133); - -// EXTERNAL MODULE: external {"this":["wp","nux"]} -var external_this_wp_nux_ = __webpack_require__(60); +var external_this_wp_notices_ = __webpack_require__(100); // EXTERNAL MODULE: external {"this":["wp","richText"]} -var external_this_wp_richText_ = __webpack_require__(20); +var external_this_wp_richText_ = __webpack_require__(25); // EXTERNAL MODULE: external {"this":["wp","viewport"]} -var external_this_wp_viewport_ = __webpack_require__(40); +var external_this_wp_viewport_ = __webpack_require__(81); + +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js +var defineProperty = __webpack_require__(5); // EXTERNAL MODULE: external {"this":["wp","data"]} -var external_this_wp_data_ = __webpack_require__(5); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules -var slicedToArray = __webpack_require__(28); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js -var defineProperty = __webpack_require__(15); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js -var objectSpread = __webpack_require__(7); +var external_this_wp_data_ = __webpack_require__(4); + +// EXTERNAL MODULE: external {"this":["wp","dataControls"]} +var external_this_wp_dataControls_ = __webpack_require__(36); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js -var esm_typeof = __webpack_require__(32); +var esm_typeof = __webpack_require__(40); // EXTERNAL MODULE: ./node_modules/redux-optimist/index.js -var redux_optimist = __webpack_require__(62); +var redux_optimist = __webpack_require__(134); var redux_optimist_default = /*#__PURE__*/__webpack_require__.n(redux_optimist); -// EXTERNAL MODULE: external "lodash" -var external_lodash_ = __webpack_require__(2); - -// EXTERNAL MODULE: external {"this":["wp","url"]} -var external_this_wp_url_ = __webpack_require__(25); +// EXTERNAL MODULE: external {"this":"lodash"} +var external_this_lodash_ = __webpack_require__(2); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/defaults.js +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + /** * WordPress dependencies */ var PREFERENCES_DEFAULTS = { + insertUsage: {}, + // Should be kept for backward compatibility, see: https://github.com/WordPress/gutenberg/issues/14580. isPublishSidebarEnabled: true }; /** - * Default initial edits state. - * - * @type {Object} - */ - -var INITIAL_EDITS_DEFAULTS = {}; -/** * The default post editor settings * * allowedBlockTypes boolean|Array Allowed block types * richEditingEnabled boolean Whether rich editing is enabled or not + * codeEditingEnabled boolean Whether code editing is enabled or not * enableCustomFields boolean Whether the WordPress custom fields are enabled or not * autosaveInterval number Autosave Interval * availableTemplates array? The available post templates @@ -2947,256 +2390,28 @@ * maxUploadFileSize number Maximum upload file size */ -var EDITOR_SETTINGS_DEFAULTS = Object(objectSpread["a" /* default */])({}, external_this_wp_blockEditor_["SETTINGS_DEFAULTS"], { +var EDITOR_SETTINGS_DEFAULTS = _objectSpread({}, external_this_wp_blockEditor_["SETTINGS_DEFAULTS"], { richEditingEnabled: true, + codeEditingEnabled: true, enableCustomFields: false }); -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/constants.js -/** - * Set of post properties for which edits should assume a merging behavior, - * assuming an object value. - * - * @type {Set} - */ -var EDIT_MERGE_PROPERTIES = new Set(['meta']); -/** - * Constant for the store module (or reducer) key. - * @type {string} - */ - -var STORE_KEY = 'core/editor'; -var POST_UPDATE_TRANSACTION_ID = 'post-update'; -var SAVE_POST_NOTICE_ID = 'SAVE_POST_NOTICE_ID'; -var TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID'; -var PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/; -var ONE_MINUTE_IN_MS = 60 * 1000; - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/with-change-detection/index.js - - -/** - * External dependencies - */ - -/** - * Higher-order reducer creator for tracking changes to state over time. The - * returned reducer will include a `isDirty` property on the object reflecting - * whether the original reference of the reducer has changed. - * - * @param {?Object} options Optional options. - * @param {?Array} options.ignoreTypes Action types upon which to skip check. - * @param {?Array} options.resetTypes Action types upon which to reset dirty. - * - * @return {Function} Higher-order reducer. - */ - -var with_change_detection_withChangeDetection = function withChangeDetection() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - return function (reducer) { - return function (state, action) { - var nextState = reducer(state, action); // Reset at: - // - Initial state - // - Reset types - - var isReset = state === undefined || Object(external_lodash_["includes"])(options.resetTypes, action.type); - var isChanging = state !== nextState; // If not intending to update dirty flag, return early and avoid clone. - - if (!isChanging && !isReset) { - return state; - } // Avoid mutating state, unless it's already changing by original - // reducer and not initial. - - - if (!isChanging || state === undefined) { - nextState = Object(objectSpread["a" /* default */])({}, nextState); - } - - var isIgnored = Object(external_lodash_["includes"])(options.ignoreTypes, action.type); - - if (isIgnored) { - // Preserve the original value if ignored. - nextState.isDirty = state.isDirty; - } else { - nextState.isDirty = !isReset && isChanging; - } - - return nextState; - }; - }; -}; - -/* harmony default export */ var with_change_detection = (with_change_detection_withChangeDetection); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules -var toConsumableArray = __webpack_require__(17); - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/with-history/index.js - - +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/reducer.js + + + +function reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { reducer_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } /** * External dependencies */ -/** - * Default options for withHistory reducer enhancer. Refer to withHistory - * documentation for options explanation. - * - * @see withHistory - * - * @type {Object} - */ - -var DEFAULT_OPTIONS = { - resetTypes: [], - ignoreTypes: [], - shouldOverwriteState: function shouldOverwriteState() { - return false; - } -}; -/** - * Higher-order reducer creator which transforms the result of the original - * reducer into an object tracking its own history (past, present, future). - * - * @param {?Object} options Optional options. - * @param {?Array} options.resetTypes Action types upon which to - * clear past. - * @param {?Array} options.ignoreTypes Action types upon which to - * avoid history tracking. - * @param {?Function} options.shouldOverwriteState Function receiving last and - * current actions, returning - * boolean indicating whether - * present should be merged, - * rather than add undo level. - * - * @return {Function} Higher-order reducer. - */ - -var with_history_withHistory = function withHistory() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - return function (reducer) { - options = Object(objectSpread["a" /* default */])({}, DEFAULT_OPTIONS, options); // `ignoreTypes` is simply a convenience for `shouldOverwriteState` - - options.shouldOverwriteState = Object(external_lodash_["overSome"])([options.shouldOverwriteState, function (action) { - return Object(external_lodash_["includes"])(options.ignoreTypes, action.type); - }]); - var initialState = { - past: [], - present: reducer(undefined, {}), - future: [], - lastAction: null, - shouldCreateUndoLevel: false - }; - var _options = options, - _options$resetTypes = _options.resetTypes, - resetTypes = _options$resetTypes === void 0 ? [] : _options$resetTypes, - _options$shouldOverwr = _options.shouldOverwriteState, - shouldOverwriteState = _options$shouldOverwr === void 0 ? function () { - return false; - } : _options$shouldOverwr; - return function () { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; - var action = arguments.length > 1 ? arguments[1] : undefined; - var past = state.past, - present = state.present, - future = state.future, - lastAction = state.lastAction, - shouldCreateUndoLevel = state.shouldCreateUndoLevel; - var previousAction = lastAction; - - switch (action.type) { - case 'UNDO': - // Can't undo if no past. - if (!past.length) { - return state; - } - - return { - past: Object(external_lodash_["dropRight"])(past), - present: Object(external_lodash_["last"])(past), - future: [present].concat(Object(toConsumableArray["a" /* default */])(future)), - lastAction: null, - shouldCreateUndoLevel: false - }; - - case 'REDO': - // Can't redo if no future. - if (!future.length) { - return state; - } - - return { - past: [].concat(Object(toConsumableArray["a" /* default */])(past), [present]), - present: Object(external_lodash_["first"])(future), - future: Object(external_lodash_["drop"])(future), - lastAction: null, - shouldCreateUndoLevel: false - }; - - case 'CREATE_UNDO_LEVEL': - return Object(objectSpread["a" /* default */])({}, state, { - lastAction: null, - shouldCreateUndoLevel: true - }); - } - - var nextPresent = reducer(present, action); - - if (Object(external_lodash_["includes"])(resetTypes, action.type)) { - return { - past: [], - present: nextPresent, - future: [], - lastAction: null, - shouldCreateUndoLevel: false - }; - } - - if (present === nextPresent) { - return state; - } - - var nextPast = past; // The `lastAction` property is used to compare actions in the - // `shouldOverwriteState` option. If an action should be ignored, do not - // submit that action as the last action, otherwise the ability to - // compare subsequent actions will break. - - var lastActionToSubmit = previousAction; - - if (shouldCreateUndoLevel || !past.length || !shouldOverwriteState(action, previousAction)) { - nextPast = [].concat(Object(toConsumableArray["a" /* default */])(past), [present]); - lastActionToSubmit = action; - } - - return { - past: nextPast, - present: nextPresent, - future: [], - shouldCreateUndoLevel: false, - lastAction: lastActionToSubmit - }; - }; - }; -}; - -/* harmony default export */ var with_history = (with_history_withHistory); - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/reducer.js - - - - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - + +/** + * WordPress dependencies + */ /** @@ -3204,9 +2419,6 @@ */ - - - /** * Returns a post attribute value, flattening nested rendered content using its * raw value in place of its original object form. @@ -3224,23 +2436,6 @@ return value; } /** - * Returns an object against which it is safe to perform mutating operations, - * given the original object and its current working copy. - * - * @param {Object} original Original object. - * @param {Object} working Working object. - * - * @return {Object} Mutation-safe object. - */ - -function getMutateSafeObject(original, working) { - if (original === working) { - return Object(objectSpread["a" /* default */])({}, original); - } - - return working; -} -/** * Returns true if the two object arguments have the same keys, or false * otherwise. * @@ -3250,9 +2445,8 @@ * @return {boolean} Whether the two objects have the same keys. */ - function hasSameKeys(a, b) { - return Object(external_lodash_["isEqual"])(Object(external_lodash_["keys"])(a), Object(external_lodash_["keys"])(b)); + return Object(external_this_lodash_["isEqual"])(Object(external_this_lodash_["keys"])(a), Object(external_this_lodash_["keys"])(b)); } /** * Returns true if, given the currently dispatching action and the previously @@ -3279,7 +2473,7 @@ * @return {boolean} Whether to overwrite present state. */ -function reducer_shouldOverwriteState(action, previousAction) { +function shouldOverwriteState(action, previousAction) { if (action.type === 'RESET_EDITOR_BLOCKS') { return !action.shouldCreateUndoLevel; } @@ -3290,389 +2484,28 @@ return isUpdatingSamePostProperty(action, previousAction); } -/** - * Undoable reducer returning the editor post state, including blocks parsed - * from current HTML markup. - * - * Handles the following state keys: - * - edits: an object describing changes to be made to the current post, in - * the format accepted by the WP REST API - * - blocks: post content blocks - * - * @param {Object} state Current state. - * @param {Object} action Dispatched action. - * - * @returns {Object} Updated state. - */ - -var editor = Object(external_lodash_["flow"])([external_this_wp_data_["combineReducers"], with_history({ - resetTypes: ['SETUP_EDITOR_STATE'], - ignoreTypes: ['RESET_POST', 'UPDATE_POST'], - shouldOverwriteState: reducer_shouldOverwriteState -})])({ - // Track whether changes exist, resetting at each post save. Relies on - // editor initialization firing post reset as an effect. - blocks: with_change_detection({ - resetTypes: ['SETUP_EDITOR_STATE', 'REQUEST_POST_UPDATE_START'] - })(function () { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { - value: [] - }; - var action = arguments.length > 1 ? arguments[1] : undefined; - - switch (action.type) { - case 'RESET_EDITOR_BLOCKS': - if (action.blocks === state.value) { - return state; - } - - return { - value: action.blocks - }; - } - - return state; - }), - edits: function edits() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var action = arguments.length > 1 ? arguments[1] : undefined; - - switch (action.type) { - case 'EDIT_POST': - return Object(external_lodash_["reduce"])(action.edits, function (result, value, key) { - // Only assign into result if not already same value - if (value !== state[key]) { - result = getMutateSafeObject(state, result); - - if (EDIT_MERGE_PROPERTIES.has(key)) { - // Merge properties should assign to current value. - result[key] = Object(objectSpread["a" /* default */])({}, result[key], value); - } else { - // Otherwise override. - result[key] = value; - } - } - - return result; - }, state); - - case 'UPDATE_POST': - case 'RESET_POST': - var getCanonicalValue = action.type === 'UPDATE_POST' ? function (key) { - return action.edits[key]; - } : function (key) { - return getPostRawValue(action.post[key]); - }; - return Object(external_lodash_["reduce"])(state, function (result, value, key) { - if (!Object(external_lodash_["isEqual"])(value, getCanonicalValue(key))) { - return result; - } - - result = getMutateSafeObject(state, result); - delete result[key]; - return result; - }, state); - - case 'RESET_EDITOR_BLOCKS': - if ('content' in state) { - return Object(external_lodash_["omit"])(state, 'content'); - } - - return state; - } - - return state; - } -}); -/** - * Reducer returning the initial edits state. With matching shape to that of - * `editor.edits`, the initial edits are those applied programmatically, are - * not considered in prompting the user for unsaved changes, and are included - * in (and reset by) the next save payload. - * - * @param {Object} state Current state. - * @param {Object} action Action object. - * - * @return {Object} Next state. - */ - -function initialEdits() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INITIAL_EDITS_DEFAULTS; - var action = arguments.length > 1 ? arguments[1] : undefined; - - switch (action.type) { - case 'SETUP_EDITOR': - if (!action.edits) { - break; - } - - return action.edits; - - case 'SETUP_EDITOR_STATE': - if ('content' in state) { - return Object(external_lodash_["omit"])(state, 'content'); - } - - return state; - - case 'UPDATE_POST': - return Object(external_lodash_["reduce"])(action.edits, function (result, value, key) { - if (!result.hasOwnProperty(key)) { - return result; - } - - result = getMutateSafeObject(state, result); - delete result[key]; - return result; - }, state); - - case 'RESET_POST': - return INITIAL_EDITS_DEFAULTS; - } - - return state; -} -/** - * Reducer returning the last-known state of the current post, in the format - * returned by the WP REST API. - * - * @param {Object} state Current state. - * @param {Object} action Dispatched action. - * - * @return {Object} Updated state. - */ - -function currentPost() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; +function reducer_postId() { + var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; var action = arguments.length > 1 ? arguments[1] : undefined; switch (action.type) { case 'SETUP_EDITOR_STATE': case 'RESET_POST': case 'UPDATE_POST': - var post; - - if (action.post) { - post = action.post; - } else if (action.edits) { - post = Object(objectSpread["a" /* default */])({}, state, action.edits); - } else { - return state; - } - - return Object(external_lodash_["mapValues"])(post, getPostRawValue); - } - - return state; -} -/** - * Reducer returning typing state. - * - * @param {boolean} state Current state. - * @param {Object} action Dispatched action. - * - * @return {boolean} Updated state. - */ - -function isTyping() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - var action = arguments.length > 1 ? arguments[1] : undefined; - - switch (action.type) { - case 'START_TYPING': - return true; - - case 'STOP_TYPING': - return false; - } - - return state; -} -/** - * Reducer returning whether the caret is within formatted text. - * - * @param {boolean} state Current state. - * @param {Object} action Dispatched action. - * - * @return {boolean} Updated state. - */ - -function isCaretWithinFormattedText() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - var action = arguments.length > 1 ? arguments[1] : undefined; - - switch (action.type) { - case 'ENTER_FORMATTED_TEXT': - return true; - - case 'EXIT_FORMATTED_TEXT': - return false; + return action.post.id; } return state; } -/** - * Reducer returning the block selection's state. - * - * @param {Object} state Current state. - * @param {Object} action Dispatched action. - * - * @return {Object} Updated state. - */ - -function blockSelection() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { - start: null, - end: null, - isMultiSelecting: false, - isEnabled: true, - initialPosition: null - }; - var action = arguments.length > 1 ? arguments[1] : undefined; - - switch (action.type) { - case 'CLEAR_SELECTED_BLOCK': - if (state.start === null && state.end === null && !state.isMultiSelecting) { - return state; - } - - return Object(objectSpread["a" /* default */])({}, state, { - start: null, - end: null, - isMultiSelecting: false, - initialPosition: null - }); - - case 'START_MULTI_SELECT': - if (state.isMultiSelecting) { - return state; - } - - return Object(objectSpread["a" /* default */])({}, state, { - isMultiSelecting: true, - initialPosition: null - }); - - case 'STOP_MULTI_SELECT': - if (!state.isMultiSelecting) { - return state; - } - - return Object(objectSpread["a" /* default */])({}, state, { - isMultiSelecting: false, - initialPosition: null - }); - - case 'MULTI_SELECT': - return Object(objectSpread["a" /* default */])({}, state, { - start: action.start, - end: action.end, - initialPosition: null - }); - - case 'SELECT_BLOCK': - if (action.clientId === state.start && action.clientId === state.end) { - return state; - } - - return Object(objectSpread["a" /* default */])({}, state, { - start: action.clientId, - end: action.clientId, - initialPosition: action.initialPosition - }); - - case 'INSERT_BLOCKS': - { - if (action.updateSelection) { - return Object(objectSpread["a" /* default */])({}, state, { - start: action.blocks[0].clientId, - end: action.blocks[0].clientId, - initialPosition: null, - isMultiSelecting: false - }); - } - - return state; - } - - case 'REMOVE_BLOCKS': - if (!action.clientIds || !action.clientIds.length || action.clientIds.indexOf(state.start) === -1) { - return state; - } - - return Object(objectSpread["a" /* default */])({}, state, { - start: null, - end: null, - initialPosition: null, - isMultiSelecting: false - }); - - case 'REPLACE_BLOCKS': - if (action.clientIds.indexOf(state.start) === -1) { - return state; - } // If there are replacement blocks, assign last block as the next - // selected block, otherwise set to null. - - - var lastBlock = Object(external_lodash_["last"])(action.blocks); - var nextSelectedBlockClientId = lastBlock ? lastBlock.clientId : null; - - if (nextSelectedBlockClientId === state.start && nextSelectedBlockClientId === state.end) { - return state; - } - - return Object(objectSpread["a" /* default */])({}, state, { - start: nextSelectedBlockClientId, - end: nextSelectedBlockClientId, - initialPosition: null, - isMultiSelecting: false - }); - - case 'TOGGLE_SELECTION': - return Object(objectSpread["a" /* default */])({}, state, { - isEnabled: action.isSelectionEnabled - }); - } - - return state; -} -function blocksMode() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var action = arguments.length > 1 ? arguments[1] : undefined; - - if (action.type === 'TOGGLE_BLOCK_MODE') { - var clientId = action.clientId; - return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, clientId, state[clientId] && state[clientId] === 'html' ? 'visual' : 'html')); - } - - return state; -} -/** - * Reducer returning the block insertion point visibility, either null if there - * is not an explicit insertion point assigned, or an object of its `index` and - * `rootClientId`. - * - * @param {Object} state Current state. - * @param {Object} action Dispatched action. - * - * @return {Object} Updated state. - */ - -function insertionPoint() { +function reducer_postType() { var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; var action = arguments.length > 1 ? arguments[1] : undefined; switch (action.type) { - case 'SHOW_INSERTION_POINT': - var rootClientId = action.rootClientId, - index = action.index; - return { - rootClientId: rootClientId, - index: index - }; - - case 'HIDE_INSERTION_POINT': - return null; + case 'SETUP_EDITOR_STATE': + case 'RESET_POST': + case 'UPDATE_POST': + return action.post.type; } return state; @@ -3694,7 +2527,7 @@ switch (action.type) { case 'SET_TEMPLATE_VALIDITY': - return Object(objectSpread["a" /* default */])({}, state, { + return reducer_objectSpread({}, state, { isValid: action.isValid }); } @@ -3716,12 +2549,12 @@ switch (action.type) { case 'ENABLE_PUBLISH_SIDEBAR': - return Object(objectSpread["a" /* default */])({}, state, { + return reducer_objectSpread({}, state, { isPublishSidebarEnabled: true }); case 'DISABLE_PUBLISH_SIDEBAR': - return Object(objectSpread["a" /* default */])({}, state, { + return reducer_objectSpread({}, state, { isPublishSidebarEnabled: false }); } @@ -3744,26 +2577,9 @@ switch (action.type) { case 'REQUEST_POST_UPDATE_START': - return { - requesting: true, - successful: false, - error: null, - options: action.options || {} - }; - - case 'REQUEST_POST_UPDATE_SUCCESS': + case 'REQUEST_POST_UPDATE_FINISH': return { - requesting: false, - successful: true, - error: null, - options: action.options || {} - }; - - case 'REQUEST_POST_UPDATE_FAILURE': - return { - requesting: false, - successful: false, - error: action.error, + pending: action.type === 'REQUEST_POST_UPDATE_START', options: action.options || {} }; } @@ -3808,8 +2624,8 @@ * * When post saving is locked, the post cannot be published or updated. * - * @param {PostSavingLockState} state Current state. - * @param {Object} action Dispatched action. + * @param {PostLockState} state Current state. + * @param {Object} action Dispatched action. * * @return {PostLockState} Updated state. */ @@ -3820,10 +2636,35 @@ switch (action.type) { case 'LOCK_POST_SAVING': - return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, action.lockName, true)); + return reducer_objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.lockName, true)); case 'UNLOCK_POST_SAVING': - return Object(external_lodash_["omit"])(state, action.lockName); + return Object(external_this_lodash_["omit"])(state, action.lockName); + } + + return state; +} +/** + * Post autosaving lock. + * + * When post autosaving is locked, the post will not autosave. + * + * @param {PostLockState} state Current state. + * @param {Object} action Dispatched action. + * + * @return {PostLockState} Updated state. + */ + +function postAutosavingLock() { + var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var action = arguments.length > 1 ? arguments[1] : undefined; + + switch (action.type) { + case 'LOCK_POST_AUTOSAVING': + return reducer_objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.lockName, true)); + + case 'UNLOCK_POST_AUTOSAVING': + return Object(external_this_lodash_["omit"])(state, action.lockName); } return state; @@ -3836,37 +2677,14 @@ switch (action.type) { case 'RECEIVE_REUSABLE_BLOCKS': { - return Object(external_lodash_["reduce"])(action.results, function (nextState, result) { - var _result$reusableBlock = result.reusableBlock, - id = _result$reusableBlock.id, - title = _result$reusableBlock.title; - var clientId = result.parsedBlock.clientId; - var value = { - clientId: clientId, - title: title - }; - - if (!Object(external_lodash_["isEqual"])(nextState[id], value)) { - nextState = getMutateSafeObject(state, nextState); - nextState[id] = value; - } - - return nextState; - }, state); + return reducer_objectSpread({}, state, {}, Object(external_this_lodash_["keyBy"])(action.results, 'id')); } - case 'UPDATE_REUSABLE_BLOCK_TITLE': + case 'UPDATE_REUSABLE_BLOCK': { var id = action.id, - title = action.title; - - if (!state[id] || state[id].title === title) { - return state; - } - - return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, id, Object(objectSpread["a" /* default */])({}, state[id], { - title: title - }))); + changes = action.changes; + return reducer_objectSpread({}, state, Object(defineProperty["a" /* default */])({}, id, reducer_objectSpread({}, state[id], {}, changes))); } case 'SAVE_REUSABLE_BLOCK_SUCCESS': @@ -3879,13 +2697,15 @@ } var value = state[_id]; - return Object(objectSpread["a" /* default */])({}, Object(external_lodash_["omit"])(state, _id), Object(defineProperty["a" /* default */])({}, updatedId, value)); + return reducer_objectSpread({}, Object(external_this_lodash_["omit"])(state, _id), Object(defineProperty["a" /* default */])({}, updatedId, reducer_objectSpread({}, value, { + id: updatedId + }))); } case 'REMOVE_REUSABLE_BLOCK': { var _id2 = action.id; - return Object(external_lodash_["omit"])(state, _id2); + return Object(external_this_lodash_["omit"])(state, _id2); } } @@ -3904,14 +2724,14 @@ return state; } - return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, id, true)); + return reducer_objectSpread({}, state, Object(defineProperty["a" /* default */])({}, id, true)); } case 'FETCH_REUSABLE_BLOCKS_SUCCESS': case 'FETCH_REUSABLE_BLOCKS_FAILURE': { var _id3 = action.id; - return Object(external_lodash_["omit"])(state, _id3); + return Object(external_this_lodash_["omit"])(state, _id3); } } @@ -3923,13 +2743,13 @@ switch (action.type) { case 'SAVE_REUSABLE_BLOCK': - return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, action.id, true)); + return reducer_objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.id, true)); case 'SAVE_REUSABLE_BLOCK_SUCCESS': case 'SAVE_REUSABLE_BLOCK_FAILURE': { var id = action.id; - return Object(external_lodash_["omit"])(state, id); + return Object(external_this_lodash_["omit"])(state, id); } } @@ -3937,121 +2757,6 @@ } }); /** - * Reducer returning an object where each key is a block client ID, its value - * representing the settings for its nested blocks. - * - * @param {Object} state Current state. - * @param {Object} action Dispatched action. - * - * @return {Object} Updated state. - */ - -var reducer_blockListSettings = function blockListSettings() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var action = arguments.length > 1 ? arguments[1] : undefined; - - switch (action.type) { - // Even if the replaced blocks have the same client ID, our logic - // should correct the state. - case 'REPLACE_BLOCKS': - case 'REMOVE_BLOCKS': - { - return Object(external_lodash_["omit"])(state, action.clientIds); - } - - case 'UPDATE_BLOCK_LIST_SETTINGS': - { - var clientId = action.clientId; - - if (!action.settings) { - if (state.hasOwnProperty(clientId)) { - return Object(external_lodash_["omit"])(state, clientId); - } - - return state; - } - - if (Object(external_lodash_["isEqual"])(state[clientId], action.settings)) { - return state; - } - - return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, clientId, action.settings)); - } - } - - return state; -}; -/** - * Reducer returning the most recent autosave. - * - * @param {Object} state The autosave object. - * @param {Object} action Dispatched action. - * - * @return {Object} Updated state. - */ - -function autosave() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - var action = arguments.length > 1 ? arguments[1] : undefined; - - switch (action.type) { - case 'RESET_AUTOSAVE': - var post = action.post; - - var _map = ['title', 'excerpt', 'content'].map(function (field) { - return getPostRawValue(post[field]); - }), - _map2 = Object(slicedToArray["a" /* default */])(_map, 3), - title = _map2[0], - excerpt = _map2[1], - content = _map2[2]; - - return { - title: title, - excerpt: excerpt, - content: content - }; - } - - return state; -} -/** - * Reducer returning the post preview link. - * - * @param {string?} state The preview link - * @param {Object} action Dispatched action. - * - * @return {string?} Updated state. - */ - -function reducer_previewLink() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - var action = arguments.length > 1 ? arguments[1] : undefined; - - switch (action.type) { - case 'REQUEST_POST_UPDATE_SUCCESS': - if (action.post.preview_link) { - return action.post.preview_link; - } else if (action.post.link) { - return Object(external_this_wp_url_["addQueryArgs"])(action.post.link, { - preview: true - }); - } - - return state; - - case 'REQUEST_POST_UPDATE_START': - // Invalidate known preview link when autosave starts. - if (state && action.options.isPreview) { - return null; - } - - break; - } - - return state; -} -/** * Reducer returning whether the editor is ready to be rendered. * The editor is considered ready to be rendered once * the post object is loaded properly and the initial blocks parsed. @@ -4069,6 +2774,9 @@ switch (action.type) { case 'SETUP_EDITOR_STATE': return true; + + case 'TEAR_DOWN_EDITOR': + return false; } return state; @@ -4088,192 +2796,72 @@ switch (action.type) { case 'UPDATE_EDITOR_SETTINGS': - return Object(objectSpread["a" /* default */])({}, state, action.settings); + return reducer_objectSpread({}, state, {}, action.settings); } return state; } -/* harmony default export */ var store_reducer = (redux_optimist_default()(Object(external_this_wp_data_["combineReducers"])({ - editor: editor, - initialEdits: initialEdits, - currentPost: currentPost, +/* harmony default export */ var reducer = (redux_optimist_default()(Object(external_this_wp_data_["combineReducers"])({ + postId: reducer_postId, + postType: reducer_postType, preferences: preferences, saving: saving, postLock: postLock, reusableBlocks: reducer_reusableBlocks, template: reducer_template, - autosave: autosave, - previewLink: reducer_previewLink, postSavingLock: postSavingLock, isReady: reducer_isReady, - editorSettings: reducer_editorSettings + editorSettings: reducer_editorSettings, + postAutosavingLock: postAutosavingLock }))); // EXTERNAL MODULE: ./node_modules/refx/refx.js -var refx = __webpack_require__(70); +var refx = __webpack_require__(110); var refx_default = /*#__PURE__*/__webpack_require__.n(refx); -// EXTERNAL MODULE: ./node_modules/redux-multi/lib/index.js -var lib = __webpack_require__(97); -var lib_default = /*#__PURE__*/__webpack_require__.n(lib); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js -var regenerator = __webpack_require__(23); -var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator); +// EXTERNAL MODULE: external {"this":"regeneratorRuntime"} +var external_this_regeneratorRuntime_ = __webpack_require__(24); +var external_this_regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(external_this_regeneratorRuntime_); + +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js +var asyncToGenerator = __webpack_require__(50); // EXTERNAL MODULE: external {"this":["wp","apiFetch"]} -var external_this_wp_apiFetch_ = __webpack_require__(33); +var external_this_wp_apiFetch_ = __webpack_require__(45); var external_this_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_apiFetch_); -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/controls.js - - -/** - * WordPress dependencies - */ - - -/** - * Dispatches a control action for triggering an api fetch call. - * - * @param {Object} request Arguments for the fetch request. - * - * @return {Object} control descriptor. - */ - -function apiFetch(request) { - return { - type: 'API_FETCH', - request: request - }; -} -/** - * Dispatches a control action for triggering a registry select. - * - * @param {string} storeKey - * @param {string} selectorName - * @param {Array} args Arguments for the select. - * - * @return {Object} control descriptor. - */ - -function controls_select(storeKey, selectorName) { - for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { - args[_key - 2] = arguments[_key]; - } - - return { - type: 'SELECT', - storeKey: storeKey, - selectorName: selectorName, - args: args - }; -} -/** - * Dispatches a control action for triggering a registry select that has a - * resolver. - * - * @param {string} storeKey - * @param {string} selectorName - * @param {Array} args Arguments for the select. - * - * @return {Object} control descriptor. - */ - -function resolveSelect(storeKey, selectorName) { - for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { - args[_key2 - 2] = arguments[_key2]; - } - - return { - type: 'RESOLVE_SELECT', - storeKey: storeKey, - selectorName: selectorName, - args: args - }; -} -/** - * Dispatches a control action for triggering a registry dispatch. - * - * @param {string} storeKey - * @param {string} actionName - * @param {Array} args Arguments for the dispatch action. - * - * @return {Object} control descriptor. - */ - -function controls_dispatch(storeKey, actionName) { - for (var _len3 = arguments.length, args = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) { - args[_key3 - 2] = arguments[_key3]; - } - - return { - type: 'DISPATCH', - storeKey: storeKey, - actionName: actionName, - args: args - }; -} -/* harmony default export */ var controls = ({ - API_FETCH: function API_FETCH(_ref) { - var request = _ref.request; - return external_this_wp_apiFetch_default()(request); - }, - SELECT: Object(external_this_wp_data_["createRegistryControl"])(function (registry) { - return function (_ref2) { - var _registry$select; - - var storeKey = _ref2.storeKey, - selectorName = _ref2.selectorName, - args = _ref2.args; - return (_registry$select = registry.select(storeKey))[selectorName].apply(_registry$select, Object(toConsumableArray["a" /* default */])(args)); - }; - }), - DISPATCH: Object(external_this_wp_data_["createRegistryControl"])(function (registry) { - return function (_ref3) { - var _registry$dispatch; - - var storeKey = _ref3.storeKey, - actionName = _ref3.actionName, - args = _ref3.args; - return (_registry$dispatch = registry.dispatch(storeKey))[actionName].apply(_registry$dispatch, Object(toConsumableArray["a" /* default */])(args)); - }; - }), - RESOLVE_SELECT: Object(external_this_wp_data_["createRegistryControl"])(function (registry) { - return function (_ref4) { - var storeKey = _ref4.storeKey, - selectorName = _ref4.selectorName, - args = _ref4.args; - return new Promise(function (resolve) { - var hasFinished = function hasFinished() { - return registry.select('core/data').hasFinishedResolution(storeKey, selectorName, args); - }; - - var getResult = function getResult() { - return registry.select(storeKey)[selectorName].apply(null, args); - }; // trigger the selector (to trigger the resolver) - - - var result = getResult(); - - if (hasFinished()) { - return resolve(result); - } - - var unsubscribe = registry.subscribe(function () { - if (hasFinished()) { - unsubscribe(); - resolve(getResult()); - } - }); - }); - }; - }) -}); - // EXTERNAL MODULE: external {"this":["wp","i18n"]} var external_this_wp_i18n_ = __webpack_require__(1); +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules +var toConsumableArray = __webpack_require__(18); + +// EXTERNAL MODULE: external {"this":["wp","deprecated"]} +var external_this_wp_deprecated_ = __webpack_require__(37); +var external_this_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_deprecated_); + +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/constants.js +/** + * Set of post properties for which edits should assume a merging behavior, + * assuming an object value. + * + * @type {Set} + */ +var EDIT_MERGE_PROPERTIES = new Set(['meta']); +/** + * Constant for the store module (or reducer) key. + * + * @type {string} + */ + +var STORE_KEY = 'core/editor'; +var POST_UPDATE_TRANSACTION_ID = 'post-update'; +var SAVE_POST_NOTICE_ID = 'SAVE_POST_NOTICE_ID'; +var TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID'; +var PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/; +var ONE_MINUTE_IN_MS = 60 * 1000; +var AUTOSAVE_PROPERTIES = ['title', 'excerpt', 'content']; + // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/notice-builder.js /** * WordPress dependencies @@ -4303,15 +2891,15 @@ post = data.post, postType = data.postType; // Autosaves are neither shown a notice nor redirected. - if (Object(external_lodash_["get"])(data.options, ['isAutosave'])) { + if (Object(external_this_lodash_["get"])(data.options, ['isAutosave'])) { return []; } var publishStatus = ['publish', 'private', 'future']; - var isPublished = Object(external_lodash_["includes"])(publishStatus, previousPost.status); - var willPublish = Object(external_lodash_["includes"])(publishStatus, post.status); + var isPublished = Object(external_this_lodash_["includes"])(publishStatus, previousPost.status); + var willPublish = Object(external_this_lodash_["includes"])(publishStatus, post.status); var noticeMessage; - var shouldShowLink = Object(external_lodash_["get"])(postType, ['viewable'], false); + var shouldShowLink = Object(external_this_lodash_["get"])(postType, ['viewable'], false); if (!isPublished && !willPublish) { // If saving a non-published post, don't show notice. @@ -4345,6 +2933,7 @@ return [noticeMessage, { id: SAVE_POST_NOTICE_ID, + type: 'snackbar', actions: actions }]; } @@ -4376,11 +2965,17 @@ // Unless we publish an "updating failed" message var messages = { - publish: Object(external_this_wp_i18n_["__"])('Publishing failed'), - private: Object(external_this_wp_i18n_["__"])('Publishing failed'), - future: Object(external_this_wp_i18n_["__"])('Scheduling failed') - }; - var noticeMessage = !isPublished && publishStatus.indexOf(edits.status) !== -1 ? messages[edits.status] : Object(external_this_wp_i18n_["__"])('Updating failed'); + publish: Object(external_this_wp_i18n_["__"])('Publishing failed.'), + private: Object(external_this_wp_i18n_["__"])('Publishing failed.'), + future: Object(external_this_wp_i18n_["__"])('Scheduling failed.') + }; + var noticeMessage = !isPublished && publishStatus.indexOf(edits.status) !== -1 ? messages[edits.status] : Object(external_this_wp_i18n_["__"])('Updating failed.'); // Check if message string contains HTML. Notice text is currently only + // supported as plaintext, and stripping the tags may muddle the meaning. + + if (error.message && !/<\/?[^>]*>/.test(error.message)) { + noticeMessage = [noticeMessage, error.message].join(' '); + } + return [noticeMessage, { id: SAVE_POST_NOTICE_ID }]; @@ -4399,28 +2994,84 @@ }]; } +// EXTERNAL MODULE: ./node_modules/memize/index.js +var memize = __webpack_require__(60); +var memize_default = /*#__PURE__*/__webpack_require__.n(memize); + +// EXTERNAL MODULE: external {"this":["wp","autop"]} +var external_this_wp_autop_ = __webpack_require__(103); + +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/serialize-blocks.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + +/** + * Serializes blocks following backwards compatibility conventions. + * + * @param {Array} blocksForSerialization The blocks to serialize. + * + * @return {string} The blocks serialization. + */ + +var serializeBlocks = memize_default()(function (blocksForSerialization) { + // A single unmodified default block is assumed to + // be equivalent to an empty post. + if (blocksForSerialization.length === 1 && Object(external_this_wp_blocks_["isUnmodifiedDefaultBlock"])(blocksForSerialization[0])) { + blocksForSerialization = []; + } + + var content = Object(external_this_wp_blocks_["serialize"])(blocksForSerialization); // For compatibility, treat a post consisting of a + // single freeform block as legacy content and apply + // pre-block-editor removep'd content formatting. + + if (blocksForSerialization.length === 1 && blocksForSerialization[0].name === Object(external_this_wp_blocks_["getFreeformContentHandlerName"])()) { + content = Object(external_this_wp_autop_["removep"])(content); + } + + return content; +}, { + maxSize: 1 +}); +/* harmony default export */ var serialize_blocks = (serializeBlocks); + // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/actions.js -var _marked = -/*#__PURE__*/ -regenerator_default.a.mark(savePost), - _marked2 = -/*#__PURE__*/ -regenerator_default.a.mark(refreshPost), - _marked3 = -/*#__PURE__*/ -regenerator_default.a.mark(trashPost), - _marked4 = -/*#__PURE__*/ -regenerator_default.a.mark(actions_autosave); +function actions_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function actions_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { actions_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { actions_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +var _marked = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(setupEditor), + _marked2 = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(resetAutosave), + _marked3 = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(actions_editPost), + _marked4 = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(actions_savePost), + _marked5 = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(refreshPost), + _marked6 = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(trashPost), + _marked7 = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(actions_autosave), + _marked8 = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(actions_experimentalLocalAutosave), + _marked9 = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(actions_redo), + _marked10 = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(actions_undo), + _marked11 = /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(actions_resetEditorBlocks); /** * External dependencies */ +/** + * WordPress dependencies + */ + + + /** * Internal dependencies @@ -4430,22 +3081,87 @@ /** - * Returns an action object used in signalling that editor has initialized with + * Returns an action generator used in signalling that editor has initialized with * the specified post object and editor settings. * * @param {Object} post Post object. * @param {Object} edits Initial edited attributes object. * @param {Array?} template Block Template. - * - * @return {Object} Action object. */ function setupEditor(post, edits, template) { - return { - type: 'SETUP_EDITOR', - post: post, - edits: edits, - template: template + var content, blocks, isNewPost; + return external_this_regeneratorRuntime_default.a.wrap(function setupEditor$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + // In order to ensure maximum of a single parse during setup, edits are + // included as part of editor setup action. Assume edited content as + // canonical if provided, falling back to post. + if (Object(external_this_lodash_["has"])(edits, ['content'])) { + content = edits.content; + } else { + content = post.content.raw; + } + + blocks = Object(external_this_wp_blocks_["parse"])(content); // Apply a template for new posts only, if exists. + + isNewPost = post.status === 'auto-draft'; + + if (isNewPost && template) { + blocks = Object(external_this_wp_blocks_["synchronizeBlocksWithTemplate"])(blocks, template); + } + + _context.next = 6; + return resetPost(post); + + case 6: + _context.next = 8; + return { + type: 'SETUP_EDITOR', + post: post, + edits: edits, + template: template + }; + + case 8: + _context.next = 10; + return actions_resetEditorBlocks(blocks, { + __unstableShouldCreateUndoLevel: false + }); + + case 10: + _context.next = 12; + return setupEditorState(post); + + case 12: + if (!(edits && Object.keys(edits).some(function (key) { + return edits[key] !== (Object(external_this_lodash_["has"])(post, [key, 'raw']) ? post[key].raw : post[key]); + }))) { + _context.next = 15; + break; + } + + _context.next = 15; + return actions_editPost(edits); + + case 15: + case "end": + return _context.stop(); + } + } + }, _marked); +} +/** + * Returns an action object signalling that the editor is being destroyed and + * that any necessary state or side-effect cleanup should occur. + * + * @return {Object} Action object. + */ + +function __experimentalTearDownEditor() { + return { + type: 'TEAR_DOWN_EDITOR' }; } /** @@ -4467,19 +3183,46 @@ * Returns an action object used in signalling that the latest autosave of the * post has been received, by initialization or autosave. * - * @param {Object} post Autosave post object. + * @deprecated since 5.6. Callers should use the `receiveAutosaves( postId, autosave )` + * selector from the '@wordpress/core-data' package. + * + * @param {Object} newAutosave Autosave post object. * * @return {Object} Action object. */ -function resetAutosave(post) { - return { - type: 'RESET_AUTOSAVE', - post: post - }; -} -/** - * Optimistic action for dispatching that a post update request has started. +function resetAutosave(newAutosave) { + var postId; + return external_this_regeneratorRuntime_default.a.wrap(function resetAutosave$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + external_this_wp_deprecated_default()('resetAutosave action (`core/editor` store)', { + alternative: 'receiveAutosaves action (`core` store)', + plugin: 'Gutenberg' + }); + _context2.next = 3; + return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPostId'); + + case 3: + postId = _context2.sent; + _context2.next = 6; + return Object(external_this_wp_dataControls_["dispatch"])('core', 'receiveAutosaves', postId, newAutosave); + + case 6: + return _context2.abrupt("return", { + type: '__INERT__' + }); + + case 7: + case "end": + return _context2.stop(); + } + } + }, _marked2); +} +/** + * Action for dispatching that a post update request has started. * * @param {Object} options * @@ -4490,77 +3233,21 @@ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; return { type: 'REQUEST_POST_UPDATE_START', - optimist: { - type: redux_optimist["BEGIN"], - id: POST_UPDATE_TRANSACTION_ID - }, options: options }; } /** - * Optimistic action for indicating that the request post update has completed - * successfully. - * - * @param {Object} data The data for the action. - * @param {Object} data.previousPost The previous post prior to update. - * @param {Object} data.post The new post after update - * @param {boolean} data.isRevision Whether the post is a revision or not. - * @param {Object} data.options Options passed through from the original - * action dispatch. - * @param {Object} data.postType The post type object. - * - * @return {Object} Action object. - */ - -function __experimentalRequestPostUpdateSuccess(_ref) { - var previousPost = _ref.previousPost, - post = _ref.post, - isRevision = _ref.isRevision, - options = _ref.options, - postType = _ref.postType; - return { - type: 'REQUEST_POST_UPDATE_SUCCESS', - previousPost: previousPost, - post: post, - optimist: { - // Note: REVERT is not a failure case here. Rather, it - // is simply reversing the assumption that the updates - // were applied to the post proper, such that the post - // treated as having unsaved changes. - type: isRevision ? redux_optimist["REVERT"] : redux_optimist["COMMIT"], - id: POST_UPDATE_TRANSACTION_ID - }, - options: options, - postType: postType - }; -} -/** - * Optimistic action for indicating that the request post update has completed - * with a failure. - * - * @param {Object} data The data for the action - * @param {Object} data.post The post that failed updating. - * @param {Object} data.edits The fields that were being updated. - * @param {*} data.error The error from the failed call. - * @param {Object} data.options Options passed through from the original - * action dispatch. + * Action for dispatching that a post update request has finished. + * + * @param {Object} options + * * @return {Object} An action object */ -function __experimentalRequestPostUpdateFailure(_ref2) { - var post = _ref2.post, - edits = _ref2.edits, - error = _ref2.error, - options = _ref2.options; - return { - type: 'REQUEST_POST_UPDATE_FAILURE', - optimist: { - type: redux_optimist["REVERT"], - id: POST_UPDATE_TRANSACTION_ID - }, - post: post, - edits: edits, - error: error, +function __experimentalRequestPostUpdateFinish() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + return { + type: 'REQUEST_POST_UPDATE_FINISH', options: options }; } @@ -4598,16 +3285,35 @@ * Returns an action object used in signalling that attributes of the post have * been edited. * - * @param {Object} edits Post attributes to edit. - * - * @return {Object} Action object. - */ - -function actions_editPost(edits) { - return { - type: 'EDIT_POST', - edits: edits - }; + * @param {Object} edits Post attributes to edit. + * @param {Object} options Options for the edit. + * + * @yield {Object} Action object or control. + */ + +function actions_editPost(edits, options) { + var _yield$select, id, type; + + return external_this_regeneratorRuntime_default.a.wrap(function editPost$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + _context3.next = 2; + return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPost'); + + case 2: + _yield$select = _context3.sent; + id = _yield$select.id; + type = _yield$select.type; + _context3.next = 7; + return Object(external_this_wp_dataControls_["dispatch"])('core', 'editEntityRecord', 'postType', type, id, edits, options); + + case 7: + case "end": + return _context3.stop(); + } + } + }, _marked3); } /** * Returns action object produced by the updatePost creator augmented by @@ -4619,7 +3325,7 @@ */ function __experimentalOptimisticUpdatePost(edits) { - return Object(objectSpread["a" /* default */])({}, updatePost(edits), { + return actions_objectSpread({}, updatePost(edits), { optimist: { id: POST_UPDATE_TRANSACTION_ID } @@ -4631,219 +3337,157 @@ * @param {Object} options */ -function savePost() { +function actions_savePost() { var options, - isEditedPostSaveable, edits, - isAutosave, - isEditedPostNew, - post, - editedPostContent, - toSend, - currentPostType, - postType, - path, - method, - autoSavePost, - newPost, - resetAction, - notifySuccessArgs, - notifyFailArgs, - _args = arguments; - return regenerator_default.a.wrap(function savePost$(_context) { + previousRecord, + error, + args, + updatedRecord, + _args4, + _args5 = arguments; + + return external_this_regeneratorRuntime_default.a.wrap(function savePost$(_context4) { while (1) { - switch (_context.prev = _context.next) { + switch (_context4.prev = _context4.next) { case 0: - options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}; - _context.next = 3; - return controls_select(STORE_KEY, 'isEditedPostSaveable'); + options = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {}; + _context4.next = 3; + return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'isEditedPostSaveable'); case 3: - isEditedPostSaveable = _context.sent; - - if (isEditedPostSaveable) { - _context.next = 6; + if (_context4.sent) { + _context4.next = 5; break; } - return _context.abrupt("return"); - - case 6: - _context.next = 8; - return controls_select(STORE_KEY, 'getPostEdits'); - - case 8: - edits = _context.sent; - isAutosave = !!options.isAutosave; - - if (isAutosave) { - edits = Object(external_lodash_["pick"])(edits, ['title', 'content', 'excerpt']); + return _context4.abrupt("return"); + + case 5: + _context4.next = 7; + return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getEditedPostContent'); + + case 7: + _context4.t0 = _context4.sent; + edits = { + content: _context4.t0 + }; + + if (options.isAutosave) { + _context4.next = 12; + break; } - _context.next = 13; - return controls_select(STORE_KEY, 'isEditedPostNew'); - - case 13: - isEditedPostNew = _context.sent; - - // New posts (with auto-draft status) must be explicitly assigned draft - // status if there is not already a status assigned in edits (publish). - // Otherwise, they are wrongly left as auto-draft. Status is not always - // respected for autosaves, so it cannot simply be included in the pick - // above. This behavior relies on an assumption that an auto-draft post - // would never be saved by anyone other than the owner of the post, per - // logic within autosaves REST controller to save status field only for - // draft/auto-draft by current user. - // - // See: https://core.trac.wordpress.org/ticket/43316#comment:88 - // See: https://core.trac.wordpress.org/ticket/43316#comment:89 - if (isEditedPostNew) { - edits = Object(objectSpread["a" /* default */])({ - status: 'draft' - }, edits); - } - - _context.next = 17; - return controls_select(STORE_KEY, 'getCurrentPost'); - - case 17: - post = _context.sent; - _context.next = 20; - return controls_select(STORE_KEY, 'getEditedPostContent'); - - case 20: - editedPostContent = _context.sent; - toSend = Object(objectSpread["a" /* default */])({}, edits, { - content: editedPostContent, - id: post.id + _context4.next = 12; + return Object(external_this_wp_dataControls_["dispatch"])(STORE_KEY, 'editPost', edits, { + undoIgnore: true }); - _context.next = 24; - return controls_select(STORE_KEY, 'getCurrentPostType'); - - case 24: - currentPostType = _context.sent; - _context.next = 27; - return resolveSelect('core', 'getPostType', currentPostType); + + case 12: + _context4.next = 14; + return __experimentalRequestPostUpdateStart(options); + + case 14: + _context4.next = 16; + return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPost'); + + case 16: + previousRecord = _context4.sent; + _context4.t1 = actions_objectSpread; + _context4.t2 = { + id: previousRecord.id + }; + _context4.next = 21; + return Object(external_this_wp_dataControls_["select"])('core', 'getEntityRecordNonTransientEdits', 'postType', previousRecord.type, previousRecord.id); + + case 21: + _context4.t3 = _context4.sent; + _context4.t4 = {}; + _context4.t5 = edits; + edits = (0, _context4.t1)(_context4.t2, _context4.t3, _context4.t4, _context4.t5); + _context4.next = 27; + return Object(external_this_wp_dataControls_["dispatch"])('core', 'saveEntityRecord', 'postType', previousRecord.type, edits, options); case 27: - postType = _context.sent; - _context.next = 30; - return controls_dispatch(STORE_KEY, '__experimentalRequestPostUpdateStart', options); - - case 30: - _context.next = 32; - return controls_dispatch(STORE_KEY, '__experimentalOptimisticUpdatePost', toSend); - - case 32: - path = "/wp/v2/".concat(postType.rest_base, "/").concat(post.id); - method = 'PUT'; - - if (!isAutosave) { - _context.next = 43; + _context4.next = 29; + return __experimentalRequestPostUpdateFinish(options); + + case 29: + _context4.next = 31; + return Object(external_this_wp_dataControls_["select"])('core', 'getLastEntitySaveError', 'postType', previousRecord.type, previousRecord.id); + + case 31: + error = _context4.sent; + + if (!error) { + _context4.next = 39; break; } - _context.next = 37; - return controls_select(STORE_KEY, 'getAutosave'); + args = getNotificationArgumentsForSaveFail({ + post: previousRecord, + edits: edits, + error: error + }); + + if (!args.length) { + _context4.next = 37; + break; + } + + _context4.next = 37; + return external_this_wp_dataControls_["dispatch"].apply(void 0, ['core/notices', 'createErrorNotice'].concat(Object(toConsumableArray["a" /* default */])(args))); case 37: - autoSavePost = _context.sent; - // Ensure autosaves contain all expected fields, using autosave or - // post values as fallback if not otherwise included in edits. - toSend = Object(objectSpread["a" /* default */])({}, Object(external_lodash_["pick"])(post, ['title', 'content', 'excerpt']), autoSavePost, toSend); - path += '/autosaves'; - method = 'POST'; - _context.next = 47; + _context4.next = 57; break; - case 43: - _context.next = 45; - return controls_dispatch('core/notices', 'removeNotice', SAVE_POST_NOTICE_ID); - - case 45: - _context.next = 47; - return controls_dispatch('core/notices', 'removeNotice', 'autosave-exists'); + case 39: + _context4.next = 41; + return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPost'); + + case 41: + updatedRecord = _context4.sent; + _context4.t6 = getNotificationArgumentsForSaveSuccess; + _context4.t7 = previousRecord; + _context4.t8 = updatedRecord; + _context4.next = 47; + return Object(external_this_wp_dataControls_["select"])('core', 'getPostType', updatedRecord.type); case 47: - _context.prev = 47; - _context.next = 50; - return apiFetch({ - path: path, - method: method, - data: toSend - }); - - case 50: - newPost = _context.sent; - resetAction = isAutosave ? 'resetAutosave' : 'resetPost'; - _context.next = 54; - return controls_dispatch(STORE_KEY, resetAction, newPost); + _context4.t9 = _context4.sent; + _context4.t10 = options; + _context4.t11 = { + previousPost: _context4.t7, + post: _context4.t8, + postType: _context4.t9, + options: _context4.t10 + }; + _args4 = (0, _context4.t6)(_context4.t11); + + if (!_args4.length) { + _context4.next = 54; + break; + } + + _context4.next = 54; + return external_this_wp_dataControls_["dispatch"].apply(void 0, ['core/notices', 'createSuccessNotice'].concat(Object(toConsumableArray["a" /* default */])(_args4))); case 54: - _context.next = 56; - return controls_dispatch(STORE_KEY, '__experimentalRequestPostUpdateSuccess', { - previousPost: post, - post: newPost, - options: options, - postType: postType, - // An autosave may be processed by the server as a regular save - // when its update is requested by the author and the post was - // draft or auto-draft. - isRevision: newPost.id !== post.id - }); - - case 56: - notifySuccessArgs = getNotificationArgumentsForSaveSuccess({ - previousPost: post, - post: newPost, - postType: postType, - options: options - }); - - if (!(notifySuccessArgs.length > 0)) { - _context.next = 60; + if (options.isAutosave) { + _context4.next = 57; break; } - _context.next = 60; - return controls_dispatch.apply(void 0, ['core/notices', 'createSuccessNotice'].concat(Object(toConsumableArray["a" /* default */])(notifySuccessArgs))); - - case 60: - _context.next = 70; - break; - - case 62: - _context.prev = 62; - _context.t0 = _context["catch"](47); - _context.next = 66; - return controls_dispatch(STORE_KEY, '__experimentalRequestPostUpdateFailure', { - post: post, - edits: edits, - error: _context.t0, - options: options - }); - - case 66: - notifyFailArgs = getNotificationArgumentsForSaveFail({ - post: post, - edits: edits, - error: _context.t0 - }); - - if (!(notifyFailArgs.length > 0)) { - _context.next = 70; - break; - } - - _context.next = 70; - return controls_dispatch.apply(void 0, ['core/notices', 'createErrorNotice'].concat(Object(toConsumableArray["a" /* default */])(notifyFailArgs))); - - case 70: + _context4.next = 57; + return Object(external_this_wp_dataControls_["dispatch"])('core/block-editor', '__unstableMarkLastChangeAsPersistent'); + + case 57: case "end": - return _context.stop(); - } - } - }, _marked, this, [[47, 62]]); + return _context4.stop(); + } + } + }, _marked4); } /** * Action generator for handling refreshing the current post. @@ -4851,43 +3495,43 @@ function refreshPost() { var post, postTypeSlug, postType, newPost; - return regenerator_default.a.wrap(function refreshPost$(_context2) { + return external_this_regeneratorRuntime_default.a.wrap(function refreshPost$(_context5) { while (1) { - switch (_context2.prev = _context2.next) { + switch (_context5.prev = _context5.next) { case 0: - _context2.next = 2; - return controls_select(STORE_KEY, 'getCurrentPost'); + _context5.next = 2; + return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPost'); case 2: - post = _context2.sent; - _context2.next = 5; - return controls_select(STORE_KEY, 'getCurrentPostType'); + post = _context5.sent; + _context5.next = 5; + return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPostType'); case 5: - postTypeSlug = _context2.sent; - _context2.next = 8; - return resolveSelect('core', 'getPostType', postTypeSlug); + postTypeSlug = _context5.sent; + _context5.next = 8; + return Object(external_this_wp_dataControls_["select"])('core', 'getPostType', postTypeSlug); case 8: - postType = _context2.sent; - _context2.next = 11; - return apiFetch({ + postType = _context5.sent; + _context5.next = 11; + return Object(external_this_wp_dataControls_["apiFetch"])({ // Timestamp arg allows caller to bypass browser caching, which is // expected for this specific function. path: "/wp/v2/".concat(postType.rest_base, "/").concat(post.id) + "?context=edit&_timestamp=".concat(Date.now()) }); case 11: - newPost = _context2.sent; - _context2.next = 14; - return controls_dispatch(STORE_KEY, 'resetPost', newPost); + newPost = _context5.sent; + _context5.next = 14; + return Object(external_this_wp_dataControls_["dispatch"])(STORE_KEY, 'resetPost', newPost); case 14: case "end": - return _context2.stop(); - } - } - }, _marked2, this); + return _context5.stop(); + } + } + }, _marked5); } /** * Action generator for trashing the current post in the editor. @@ -4895,60 +3539,58 @@ function trashPost() { var postTypeSlug, postType, post; - return regenerator_default.a.wrap(function trashPost$(_context3) { + return external_this_regeneratorRuntime_default.a.wrap(function trashPost$(_context6) { while (1) { - switch (_context3.prev = _context3.next) { + switch (_context6.prev = _context6.next) { case 0: - _context3.next = 2; - return controls_select(STORE_KEY, 'getCurrentPostType'); + _context6.next = 2; + return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPostType'); case 2: - postTypeSlug = _context3.sent; - _context3.next = 5; - return resolveSelect('core', 'getPostType', postTypeSlug); + postTypeSlug = _context6.sent; + _context6.next = 5; + return Object(external_this_wp_dataControls_["select"])('core', 'getPostType', postTypeSlug); case 5: - postType = _context3.sent; - _context3.next = 8; - return controls_dispatch('core/notices', 'removeNotice', TRASH_POST_NOTICE_ID); + postType = _context6.sent; + _context6.next = 8; + return Object(external_this_wp_dataControls_["dispatch"])('core/notices', 'removeNotice', TRASH_POST_NOTICE_ID); case 8: - _context3.prev = 8; - _context3.next = 11; - return controls_select(STORE_KEY, 'getCurrentPost'); + _context6.prev = 8; + _context6.next = 11; + return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPost'); case 11: - post = _context3.sent; - _context3.next = 14; - return apiFetch({ + post = _context6.sent; + _context6.next = 14; + return Object(external_this_wp_dataControls_["apiFetch"])({ path: "/wp/v2/".concat(postType.rest_base, "/").concat(post.id), method: 'DELETE' }); case 14: - _context3.next = 16; - return controls_dispatch(STORE_KEY, 'resetPost', Object(objectSpread["a" /* default */])({}, post, { - status: 'trash' - })); + _context6.next = 16; + return Object(external_this_wp_dataControls_["dispatch"])(STORE_KEY, 'savePost'); case 16: - _context3.next = 22; + _context6.next = 22; break; case 18: - _context3.prev = 18; - _context3.t0 = _context3["catch"](8); - _context3.next = 22; - return controls_dispatch.apply(void 0, ['core/notices', 'createErrorNotice'].concat(Object(toConsumableArray["a" /* default */])(getNotificationArgumentsForTrashFail({ - error: _context3.t0 + _context6.prev = 18; + _context6.t0 = _context6["catch"](8); + _context6.next = 22; + return external_this_wp_dataControls_["dispatch"].apply(void 0, ['core/notices', 'createErrorNotice'].concat(Object(toConsumableArray["a" /* default */])(getNotificationArgumentsForTrashFail({ + error: _context6.t0 })))); case 22: case "end": - return _context3.stop(); - } - } - }, _marked3, this, [[8, 18]]); + return _context6.stop(); + } + } + }, _marked6, null, [[8, 18]]); } /** * Action generator used in signalling that the post should autosave. @@ -4957,44 +3599,106 @@ */ function actions_autosave(options) { - return regenerator_default.a.wrap(function autosave$(_context4) { + return external_this_regeneratorRuntime_default.a.wrap(function autosave$(_context7) { while (1) { - switch (_context4.prev = _context4.next) { + switch (_context7.prev = _context7.next) { case 0: - _context4.next = 2; - return controls_dispatch(STORE_KEY, 'savePost', Object(objectSpread["a" /* default */])({ + _context7.next = 2; + return Object(external_this_wp_dataControls_["dispatch"])(STORE_KEY, 'savePost', actions_objectSpread({ isAutosave: true }, options)); case 2: case "end": - return _context4.stop(); - } - } - }, _marked4, this); + return _context7.stop(); + } + } + }, _marked7); +} +function actions_experimentalLocalAutosave() { + var post, title, content, excerpt; + return external_this_regeneratorRuntime_default.a.wrap(function __experimentalLocalAutosave$(_context8) { + while (1) { + switch (_context8.prev = _context8.next) { + case 0: + _context8.next = 2; + return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPost'); + + case 2: + post = _context8.sent; + _context8.next = 5; + return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getEditedPostAttribute', 'title'); + + case 5: + title = _context8.sent; + _context8.next = 8; + return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getEditedPostAttribute', 'content'); + + case 8: + content = _context8.sent; + _context8.next = 11; + return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getEditedPostAttribute', 'excerpt'); + + case 11: + excerpt = _context8.sent; + _context8.next = 14; + return { + type: 'LOCAL_AUTOSAVE_SET', + postId: post.id, + title: title, + content: content, + excerpt: excerpt + }; + + case 14: + case "end": + return _context8.stop(); + } + } + }, _marked8); } /** * Returns an action object used in signalling that undo history should * restore last popped state. * - * @return {Object} Action object. + * @yield {Object} Action object. */ function actions_redo() { - return { - type: 'REDO' - }; + return external_this_regeneratorRuntime_default.a.wrap(function redo$(_context9) { + while (1) { + switch (_context9.prev = _context9.next) { + case 0: + _context9.next = 2; + return Object(external_this_wp_dataControls_["dispatch"])('core', 'redo'); + + case 2: + case "end": + return _context9.stop(); + } + } + }, _marked9); } /** * Returns an action object used in signalling that undo history should pop. * - * @return {Object} Action object. + * @yield {Object} Action object. */ function actions_undo() { - return { - type: 'UNDO' - }; + return external_this_regeneratorRuntime_default.a.wrap(function undo$(_context10) { + while (1) { + switch (_context10.prev = _context10.next) { + case 0: + _context10.next = 2; + return Object(external_this_wp_dataControls_["dispatch"])('core', 'undo'); + + case 2: + case "end": + return _context10.stop(); + } + } + }, _marked10); } /** * Returns an action object used in signalling that undo history record should @@ -5032,7 +3736,7 @@ * @return {Object} Action object. */ -function __experimentalFetchReusableBlocks(id) { +function actions_experimentalFetchReusableBlocks(id) { return { type: 'FETCH_REUSABLE_BLOCKS', id: id @@ -5085,20 +3789,20 @@ }; } /** - * Returns an action object used in signalling that a reusable block's title is + * Returns an action object used in signalling that a reusable block is * to be updated. * - * @param {number} id The ID of the reusable block to update. - * @param {string} title The new title. + * @param {number} id The ID of the reusable block to update. + * @param {Object} changes The changes to apply. * * @return {Object} Action object. */ -function __experimentalUpdateReusableBlockTitle(id, title) { - return { - type: 'UPDATE_REUSABLE_BLOCK_TITLE', +function __experimentalUpdateReusableBlock(id, changes) { + return { + type: 'UPDATE_REUSABLE_BLOCK', id: id, - title: title + changes: changes }; } /** @@ -5128,7 +3832,7 @@ function __experimentalConvertBlockToReusable(clientIds) { return { type: 'CONVERT_BLOCK_TO_REUSABLE', - clientIds: Object(external_lodash_["castArray"])(clientIds) + clientIds: Object(external_this_lodash_["castArray"])(clientIds) }; } /** @@ -5160,6 +3864,42 @@ * * @param {string} lockName The lock name. * + * @example + * ``` + * const { subscribe } = wp.data; + * + * const initialPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' ); + * + * // Only allow publishing posts that are set to a future date. + * if ( 'publish' !== initialPostStatus ) { + * + * // Track locking. + * let locked = false; + * + * // Watch for the publish event. + * let unssubscribe = subscribe( () => { + * const currentPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' ); + * if ( 'publish' !== currentPostStatus ) { + * + * // Compare the post date to the current date, lock the post if the date isn't in the future. + * const postDate = new Date( wp.data.select( 'core/editor' ).getEditedPostAttribute( 'date' ) ); + * const currentDate = new Date(); + * if ( postDate.getTime() <= currentDate.getTime() ) { + * if ( ! locked ) { + * locked = true; + * wp.data.dispatch( 'core/editor' ).lockPostSaving( 'futurelock' ); + * } + * } else { + * if ( locked ) { + * locked = false; + * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'futurelock' ); + * } + * } + * } + * } ); + * } + * ``` + * * @return {Object} Action object */ @@ -5174,6 +3914,12 @@ * * @param {string} lockName The lock name. * + * @example + * ``` + * // Unlock post saving with the lock key `mylock`: + * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' ); + * ``` + * * @return {Object} Action object */ @@ -5184,21 +3930,128 @@ }; } /** + * Returns an action object used to signal that post autosaving is locked. + * + * @param {string} lockName The lock name. + * + * @example + * ``` + * // Lock post autosaving with the lock key `mylock`: + * wp.data.dispatch( 'core/editor' ).lockPostAutosaving( 'mylock' ); + * ``` + * + * @return {Object} Action object + */ + +function lockPostAutosaving(lockName) { + return { + type: 'LOCK_POST_AUTOSAVING', + lockName: lockName + }; +} +/** + * Returns an action object used to signal that post autosaving is unlocked. + * + * @param {string} lockName The lock name. + * + * @example + * ``` + * // Unlock post saving with the lock key `mylock`: + * wp.data.dispatch( 'core/editor' ).unlockPostAutosaving( 'mylock' ); + * ``` + * + * @return {Object} Action object + */ + +function unlockPostAutosaving(lockName) { + return { + type: 'UNLOCK_POST_AUTOSAVING', + lockName: lockName + }; +} +/** * Returns an action object used to signal that the blocks have been updated. * * @param {Array} blocks Block Array. * @param {?Object} options Optional options. * - * @return {Object} Action object + * @yield {Object} Action object */ function actions_resetEditorBlocks(blocks) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - return { - type: 'RESET_EDITOR_BLOCKS', - blocks: blocks, - shouldCreateUndoLevel: options.__unstableShouldCreateUndoLevel !== false - }; + var options, + __unstableShouldCreateUndoLevel, + selectionStart, + selectionEnd, + edits, + _yield$select2, + id, + type, + noChange, + _args12 = arguments; + + return external_this_regeneratorRuntime_default.a.wrap(function resetEditorBlocks$(_context11) { + while (1) { + switch (_context11.prev = _context11.next) { + case 0: + options = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {}; + __unstableShouldCreateUndoLevel = options.__unstableShouldCreateUndoLevel, selectionStart = options.selectionStart, selectionEnd = options.selectionEnd; + edits = { + blocks: blocks, + selectionStart: selectionStart, + selectionEnd: selectionEnd + }; + + if (!(__unstableShouldCreateUndoLevel !== false)) { + _context11.next = 19; + break; + } + + _context11.next = 6; + return Object(external_this_wp_dataControls_["select"])(STORE_KEY, 'getCurrentPost'); + + case 6: + _yield$select2 = _context11.sent; + id = _yield$select2.id; + type = _yield$select2.type; + _context11.next = 11; + return Object(external_this_wp_dataControls_["__unstableSyncSelect"])('core', 'getEditedEntityRecord', 'postType', type, id); + + case 11: + _context11.t0 = _context11.sent.blocks; + _context11.t1 = edits.blocks; + noChange = _context11.t0 === _context11.t1; + + if (!noChange) { + _context11.next = 18; + break; + } + + _context11.next = 17; + return Object(external_this_wp_dataControls_["dispatch"])('core', '__unstableCreateUndoLevel', 'postType', type, id); + + case 17: + return _context11.abrupt("return", _context11.sent); + + case 18: + // We create a new function here on every persistent edit + // to make sure the edit makes the post dirty and creates + // a new undo level. + edits.content = function (_ref) { + var _ref$blocks = _ref.blocks, + blocksForSerialization = _ref$blocks === void 0 ? [] : _ref$blocks; + return serialize_blocks(blocksForSerialization); + }; + + case 19: + return _context11.delegateYield(actions_editPost(edits), "t2", 20); + + case 20: + case "end": + return _context11.stop(); + } + } + }, _marked11); } /* * Returns an action object used in signalling that the post editor settings have been updated. @@ -5219,83 +4072,261 @@ */ var actions_getBlockEditorAction = function getBlockEditorAction(name) { - return ( - /*#__PURE__*/ - regenerator_default.a.mark(function _callee() { - var _len, - args, - _key, - _args5 = arguments; - - return regenerator_default.a.wrap(function _callee$(_context5) { - while (1) { - switch (_context5.prev = _context5.next) { - case 0: - for (_len = _args5.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = _args5[_key]; - } - - _context5.next = 3; - return controls_dispatch.apply(void 0, ['core/block-editor', name].concat(args)); - - case 3: - case "end": - return _context5.stop(); - } + return /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(function _callee() { + var _len, + args, + _key, + _args13 = arguments; + + return external_this_regeneratorRuntime_default.a.wrap(function _callee$(_context12) { + while (1) { + switch (_context12.prev = _context12.next) { + case 0: + external_this_wp_deprecated_default()("`wp.data.dispatch( 'core/editor' )." + name + '`', { + alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`' + }); + + for (_len = _args13.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = _args13[_key]; + } + + _context12.next = 4; + return external_this_wp_dataControls_["dispatch"].apply(void 0, ['core/block-editor', name].concat(args)); + + case 4: + case "end": + return _context12.stop(); } - }, _callee, this); - }) - ); + } + }, _callee); + }); }; +/** + * @see resetBlocks in core/block-editor store. + */ + var resetBlocks = actions_getBlockEditorAction('resetBlocks'); +/** + * @see receiveBlocks in core/block-editor store. + */ + var receiveBlocks = actions_getBlockEditorAction('receiveBlocks'); +/** + * @see updateBlock in core/block-editor store. + */ + var updateBlock = actions_getBlockEditorAction('updateBlock'); +/** + * @see updateBlockAttributes in core/block-editor store. + */ + var updateBlockAttributes = actions_getBlockEditorAction('updateBlockAttributes'); -var selectBlock = actions_getBlockEditorAction('selectBlock'); +/** + * @see selectBlock in core/block-editor store. + */ + +var actions_selectBlock = actions_getBlockEditorAction('selectBlock'); +/** + * @see startMultiSelect in core/block-editor store. + */ + var startMultiSelect = actions_getBlockEditorAction('startMultiSelect'); +/** + * @see stopMultiSelect in core/block-editor store. + */ + var stopMultiSelect = actions_getBlockEditorAction('stopMultiSelect'); +/** + * @see multiSelect in core/block-editor store. + */ + var multiSelect = actions_getBlockEditorAction('multiSelect'); +/** + * @see clearSelectedBlock in core/block-editor store. + */ + var clearSelectedBlock = actions_getBlockEditorAction('clearSelectedBlock'); +/** + * @see toggleSelection in core/block-editor store. + */ + var toggleSelection = actions_getBlockEditorAction('toggleSelection'); -var replaceBlocks = actions_getBlockEditorAction('replaceBlocks'); +/** + * @see replaceBlocks in core/block-editor store. + */ + +var actions_replaceBlocks = actions_getBlockEditorAction('replaceBlocks'); +/** + * @see replaceBlock in core/block-editor store. + */ + var replaceBlock = actions_getBlockEditorAction('replaceBlock'); +/** + * @see moveBlocksDown in core/block-editor store. + */ + var moveBlocksDown = actions_getBlockEditorAction('moveBlocksDown'); +/** + * @see moveBlocksUp in core/block-editor store. + */ + var moveBlocksUp = actions_getBlockEditorAction('moveBlocksUp'); +/** + * @see moveBlockToPosition in core/block-editor store. + */ + var moveBlockToPosition = actions_getBlockEditorAction('moveBlockToPosition'); +/** + * @see insertBlock in core/block-editor store. + */ + var insertBlock = actions_getBlockEditorAction('insertBlock'); +/** + * @see insertBlocks in core/block-editor store. + */ + var insertBlocks = actions_getBlockEditorAction('insertBlocks'); +/** + * @see showInsertionPoint in core/block-editor store. + */ + var showInsertionPoint = actions_getBlockEditorAction('showInsertionPoint'); +/** + * @see hideInsertionPoint in core/block-editor store. + */ + var hideInsertionPoint = actions_getBlockEditorAction('hideInsertionPoint'); +/** + * @see setTemplateValidity in core/block-editor store. + */ + var setTemplateValidity = actions_getBlockEditorAction('setTemplateValidity'); +/** + * @see synchronizeTemplate in core/block-editor store. + */ + var synchronizeTemplate = actions_getBlockEditorAction('synchronizeTemplate'); +/** + * @see mergeBlocks in core/block-editor store. + */ + var mergeBlocks = actions_getBlockEditorAction('mergeBlocks'); +/** + * @see removeBlocks in core/block-editor store. + */ + var removeBlocks = actions_getBlockEditorAction('removeBlocks'); +/** + * @see removeBlock in core/block-editor store. + */ + var removeBlock = actions_getBlockEditorAction('removeBlock'); +/** + * @see toggleBlockMode in core/block-editor store. + */ + var toggleBlockMode = actions_getBlockEditorAction('toggleBlockMode'); +/** + * @see startTyping in core/block-editor store. + */ + var startTyping = actions_getBlockEditorAction('startTyping'); +/** + * @see stopTyping in core/block-editor store. + */ + var stopTyping = actions_getBlockEditorAction('stopTyping'); +/** + * @see enterFormattedText in core/block-editor store. + */ + var enterFormattedText = actions_getBlockEditorAction('enterFormattedText'); +/** + * @see exitFormattedText in core/block-editor store. + */ + var exitFormattedText = actions_getBlockEditorAction('exitFormattedText'); +/** + * @see insertDefaultBlock in core/block-editor store. + */ + var insertDefaultBlock = actions_getBlockEditorAction('insertDefaultBlock'); +/** + * @see updateBlockListSettings in core/block-editor store. + */ + var updateBlockListSettings = actions_getBlockEditorAction('updateBlockListSettings'); -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js -var asyncToGenerator = __webpack_require__(44); +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules +var slicedToArray = __webpack_require__(14); // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js -var rememo = __webpack_require__(30); +var rememo = __webpack_require__(42); // EXTERNAL MODULE: external {"this":["wp","date"]} -var external_this_wp_date_ = __webpack_require__(50); - -// EXTERNAL MODULE: external {"this":["wp","autop"]} -var external_this_wp_autop_ = __webpack_require__(66); +var external_this_wp_date_ = __webpack_require__(79); + +// EXTERNAL MODULE: external {"this":["wp","url"]} +var external_this_wp_url_ = __webpack_require__(31); + +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/url.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +/** + * Returns the URL of a WPAdmin Page. + * + * TODO: This should be moved to a module less specific to the editor. + * + * @param {string} page Page to navigate to. + * @param {Object} query Query Args. + * + * @return {string} WPAdmin URL. + */ + +function getWPAdminURL(page, query) { + return Object(external_this_wp_url_["addQueryArgs"])(page, query); +} +/** + * Performs some basic cleanup of a string for use as a post slug + * + * This replicates some of what sanitize_title() does in WordPress core, but + * is only designed to approximate what the slug will be. + * + * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin + * letters. Removes combining diacritical marks. Converts whitespace, periods, + * and forward slashes to hyphens. Removes any remaining non-word characters + * except hyphens. Converts remaining string to lowercase. It does not account + * for octets, HTML entities, or other encoded characters. + * + * @param {string} string Title or slug to be processed + * + * @return {string} Processed string + */ + +function cleanForSlug(string) { + if (!string) { + return ''; + } + + return Object(external_this_lodash_["trim"])(Object(external_this_lodash_["deburr"])(string).replace(/[\s\./]+/g, '-').replace(/[^\w-]+/g, '').toLowerCase(), '-'); +} // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/selectors.js +function selectors_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function selectors_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { selectors_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { selectors_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + /** * External dependencies */ @@ -5316,6 +4347,9 @@ + + + /** * Shared reference to an empty object for cases where it is important to avoid * returning a new object reference on every invocation, as in a connected or @@ -5326,6 +4360,15 @@ var EMPTY_OBJECT = {}; /** + * Shared reference to an empty array for cases where it is important to avoid + * returning a new array reference on every invocation, as in a connected or + * other pure component which performs `shouldComponentUpdate` check on props. + * This should be used as a last resort, since the normalized data should be + * maintained by the reducer result in state. + */ + +var EMPTY_ARRAY = []; +/** * Returns true if any past editor history snapshots exist, or false otherwise. * * @param {Object} state Global application state. @@ -5333,9 +4376,11 @@ * @return {boolean} Whether undo history exists. */ -function hasEditorUndo(state) { - return state.editor.past.length > 0; -} +var hasEditorUndo = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { + return function () { + return select('core').hasUndo(); + }; +}); /** * Returns true if any future editor history snapshots exist, or false * otherwise. @@ -5345,9 +4390,11 @@ * @return {boolean} Whether redo history exists. */ -function hasEditorRedo(state) { - return state.editor.future.length > 0; -} +var hasEditorRedo = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { + return function () { + return select('core').hasRedo(); + }; +}); /** * Returns true if the currently edited post is yet to be saved, or false if * the post has been saved. @@ -5357,7 +4404,7 @@ * @return {boolean} Whether the post is new. */ -function selectors_isEditedPostNew(state) { +function isEditedPostNew(state) { return selectors_getCurrentPost(state).status === 'auto-draft'; } /** @@ -5369,12 +4416,13 @@ */ function hasChangedContent(state) { - return state.editor.present.blocks.isDirty || // `edits` is intended to contain only values which are different from + var edits = selectors_getPostEdits(state); + return 'blocks' in edits || // `edits` is intended to contain only values which are different from // the saved post, so the mere presence of a property is an indicator // that the value is different than what is known to be saved. While // content in Visual mode is represented by the blocks state, in Text // mode it is tracked by `edits.content`. - 'content' in state.editor.present.edits; + 'content' in edits; } /** * Returns true if there are unsaved values for the current edit session, or @@ -5385,25 +4433,49 @@ * @return {boolean} Whether unsaved values exist. */ -function selectors_isEditedPostDirty(state) { - if (hasChangedContent(state)) { - return true; - } // Edits should contain only fields which differ from the saved post (reset - // at initial load and save complete). Thus, a non-empty edits state can be - // inferred to contain unsaved values. - - - if (Object.keys(state.editor.present.edits).length > 0) { - return true; - } // Edits and change detection are reset at the start of a save, but a post - // is still considered dirty until the point at which the save completes. - // Because the save is performed optimistically, the prior states are held - // until committed. These can be referenced to determine whether there's a - // chance that state may be reverted into one considered dirty. - - - return inSomeHistory(state, selectors_isEditedPostDirty); -} +var selectors_isEditedPostDirty = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { + return function (state) { + // Edits should contain only fields which differ from the saved post (reset + // at initial load and save complete). Thus, a non-empty edits state can be + // inferred to contain unsaved values. + var postType = selectors_getCurrentPostType(state); + var postId = selectors_getCurrentPostId(state); + + if (select('core').hasEditsForEntityRecord('postType', postType, postId)) { + return true; + } + + return false; + }; +}); +/** + * Returns true if there are unsaved edits for entities other than + * the editor's post, and false otherwise. + * + * @param {Object} state Global application state. + * + * @return {boolean} Whether there are edits or not. + */ + +var selectors_hasNonPostEntityChanges = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { + return function (state) { + var enableFullSiteEditing = selectors_getEditorSettings(state).__experimentalEnableFullSiteEditing; + + if (!enableFullSiteEditing) { + return false; + } + + var dirtyEntityRecords = select('core').__experimentalGetDirtyEntityRecords(); + + var _getCurrentPost = selectors_getCurrentPost(state), + type = _getCurrentPost.type, + id = _getCurrentPost.id; + + return Object(external_this_lodash_["some"])(dirtyEntityRecords, function (entityRecord) { + return entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id; + }); + }; +}); /** * Returns true if there are no unsaved values for the current edit session and * if the currently edited post is new (has never been saved before). @@ -5414,7 +4486,7 @@ */ function selectors_isCleanNewPost(state) { - return !selectors_isEditedPostDirty(state) && selectors_isEditedPostNew(state); + return !selectors_isEditedPostDirty(state) && isEditedPostNew(state); } /** * Returns the post currently being edited in its last known saved state, not @@ -5426,9 +4498,22 @@ * @return {Object} Post object. */ -function selectors_getCurrentPost(state) { - return state.currentPost; -} +var selectors_getCurrentPost = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { + return function (state) { + var postId = selectors_getCurrentPostId(state); + var postType = selectors_getCurrentPostType(state); + var post = select('core').getRawEntityRecord('postType', postType, postId); + + if (post) { + return post; + } // This exists for compatibility with the previous selector behavior + // which would guarantee an object return based on the editor reducer's + // default empty object state. + + + return EMPTY_OBJECT; + }; +}); /** * Returns the post type of the post currently being edited. * @@ -5438,7 +4523,7 @@ */ function selectors_getCurrentPostType(state) { - return state.currentPost.type; + return state.postType; } /** * Returns the ID of the post currently being edited, or null if the post has @@ -5450,7 +4535,7 @@ */ function selectors_getCurrentPostId(state) { - return selectors_getCurrentPost(state).id || null; + return state.postId; } /** * Returns the number of revisions of the post currently being edited. @@ -5461,7 +4546,7 @@ */ function getCurrentPostRevisionsCount(state) { - return Object(external_lodash_["get"])(selectors_getCurrentPost(state), ['_links', 'version-history', 0, 'count'], 0); + return Object(external_this_lodash_["get"])(selectors_getCurrentPost(state), ['_links', 'version-history', 0, 'count'], 0); } /** * Returns the last revision ID of the post currently being edited, @@ -5473,7 +4558,7 @@ */ function getCurrentPostLastRevisionId(state) { - return Object(external_lodash_["get"])(selectors_getCurrentPost(state), ['_links', 'predecessor-version', 0, 'id'], null); + return Object(external_this_lodash_["get"])(selectors_getCurrentPost(state), ['_links', 'predecessor-version', 0, 'id'], null); } /** * Returns any post values which have been changed in the editor but not yet @@ -5484,16 +4569,20 @@ * @return {Object} Object of key value pairs comprising unsaved edits. */ -var getPostEdits = Object(rememo["a" /* default */])(function (state) { - return Object(objectSpread["a" /* default */])({}, state.initialEdits, state.editor.present.edits); -}, function (state) { - return [state.editor.present.edits, state.initialEdits]; +var selectors_getPostEdits = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { + return function (state) { + var postType = selectors_getCurrentPostType(state); + var postId = selectors_getCurrentPostId(state); + return select('core').getEntityRecordEdits('postType', postType, postId) || EMPTY_OBJECT; + }; }); /** * Returns a new reference when edited values have changed. This is useful in * inferring where an edit has been made between states by comparison of the * return values using strict equality. * + * @deprecated since Gutenberg 6.5.0. + * * @example * * ``` @@ -5508,10 +4597,15 @@ * @return {*} A value whose reference will change only when an edit occurs. */ -var getReferenceByDistinctEdits = Object(rememo["a" /* default */])(function () { - return []; -}, function (state) { - return [state.editor]; +var getReferenceByDistinctEdits = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { + return function () + /* state */ + { + external_this_wp_deprecated_default()("`wp.data.select( 'core/editor' ).getReferenceByDistinctEdits`", { + alternative: "`wp.data.select( 'core' ).getReferenceByDistinctEdits`" + }); + return select('core').getReferenceByDistinctEdits(); + }; }); /** * Returns an attribute value of the saved post. @@ -5523,10 +4617,21 @@ */ function selectors_getCurrentPostAttribute(state, attributeName) { - var post = selectors_getCurrentPost(state); - - if (post.hasOwnProperty(attributeName)) { - return post[attributeName]; + switch (attributeName) { + case 'type': + return selectors_getCurrentPostType(state); + + case 'id': + return selectors_getCurrentPostId(state); + + default: + var post = selectors_getCurrentPost(state); + + if (!post.hasOwnProperty(attributeName)) { + break; + } + + return getPostRawValue(post[attributeName]); } } /** @@ -5540,17 +4645,15 @@ * @return {*} Post attribute value. */ -var getNestedEditedPostProperty = Object(rememo["a" /* default */])(function (state, attributeName) { - var edits = getPostEdits(state); +var getNestedEditedPostProperty = function getNestedEditedPostProperty(state, attributeName) { + var edits = selectors_getPostEdits(state); if (!edits.hasOwnProperty(attributeName)) { return selectors_getCurrentPostAttribute(state, attributeName); } - return Object(objectSpread["a" /* default */])({}, selectors_getCurrentPostAttribute(state, attributeName), edits[attributeName]); -}, function (state, attributeName) { - return [Object(external_lodash_["get"])(state.editor.present.edits, [attributeName], EMPTY_OBJECT), Object(external_lodash_["get"])(state.currentPost, [attributeName], EMPTY_OBJECT)]; -}); + return selectors_objectSpread({}, selectors_getCurrentPostAttribute(state, attributeName), {}, edits[attributeName]); +}; /** * Returns a single attribute of the post being edited, preferring the unsaved * edit if one exists, but falling back to the attribute for the last known @@ -5562,6 +4665,7 @@ * @return {*} Post attribute value. */ + function selectors_getEditedPostAttribute(state, attributeName) { // Special cases switch (attributeName) { @@ -5570,7 +4674,7 @@ } // Fall back to saved post value if not edited. - var edits = getPostEdits(state); + var edits = selectors_getPostEdits(state); if (!edits.hasOwnProperty(attributeName)) { return selectors_getCurrentPostAttribute(state, attributeName); @@ -5588,23 +4692,32 @@ * Returns an attribute value of the current autosave revision for a post, or * null if there is no autosave for the post. * + * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector + * from the '@wordpress/core-data' package and access properties on the returned + * autosave object using getPostRawValue. + * * @param {Object} state Global application state. * @param {string} attributeName Autosave attribute name. * * @return {*} Autosave attribute value. */ -function getAutosaveAttribute(state, attributeName) { - if (!hasAutosave(state)) { - return null; - } - - var autosave = getAutosave(state); - - if (autosave.hasOwnProperty(attributeName)) { - return autosave[attributeName]; - } -} +var getAutosaveAttribute = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { + return function (state, attributeName) { + if (!Object(external_this_lodash_["includes"])(AUTOSAVE_PROPERTIES, attributeName) && attributeName !== 'preview_link') { + return; + } + + var postType = selectors_getCurrentPostType(state); + var postId = selectors_getCurrentPostId(state); + var currentUserId = Object(external_this_lodash_["get"])(select('core').getCurrentUser(), ['id']); + var autosave = select('core').getAutosave(postType, postId, currentUserId); + + if (autosave) { + return getPostRawValue(autosave[attributeName]); + } + }; +}); /** * Returns the current visibility of the post being edited, preferring the * unsaved value if different than the saved post. The return value is one of @@ -5644,13 +4757,14 @@ /** * Return true if the current post has already been published. * - * @param {Object} state Global application state. + * @param {Object} state Global application state. + * @param {Object?} currentPost Explicit current post for bypassing registry selector. * * @return {boolean} Whether the post has been published. */ -function selectors_isCurrentPostPublished(state) { - var post = selectors_getCurrentPost(state); +function selectors_isCurrentPostPublished(state, currentPost) { + var post = currentPost || selectors_getCurrentPost(state); return ['publish', 'private'].indexOf(post.status) !== -1 || post.status === 'future' && !Object(external_this_wp_date_["isInTheFuture"])(new Date(Number(Object(external_this_wp_date_["getDate"])(post.date)) - ONE_MINUTE_IN_MS)); } /** @@ -5722,9 +4836,9 @@ // condition of the mere existence of blocks. Note that the value of edited // content takes precedent over block content, and must fall through to the // default logic. - var blocks = state.editor.present.blocks.value; - - if (blocks.length && !('content' in getPostEdits(state))) { + var blocks = selectors_getEditorBlocks(state); + + if (blocks.length) { // Pierce the abstraction of the serializer in knowing that blocks are // joined with with newlines such that even if every individual block // produces an empty save result, the serialized content is non-empty. @@ -5755,60 +4869,107 @@ /** * Returns true if the post can be autosaved, or false otherwise. * - * @param {Object} state Global application state. + * @param {Object} state Global application state. + * @param {Object} autosave A raw autosave object from the REST API. * * @return {boolean} Whether the post can be autosaved. */ -function selectors_isEditedPostAutosaveable(state) { - // A post must contain a title, an excerpt, or non-empty content to be valid for autosaving. - if (!selectors_isEditedPostSaveable(state)) { - return false; - } // If we don't already have an autosave, the post is autosaveable. - - - if (!hasAutosave(state)) { - return true; - } // To avoid an expensive content serialization, use the content dirtiness - // flag in place of content field comparison against the known autosave. - // This is not strictly accurate, and relies on a tolerance toward autosave - // request failures for unnecessary saves. - - - if (hasChangedContent(state)) { - return true; - } // If the title, excerpt or content has changed, the post is autosaveable. - - - var autosave = getAutosave(state); - return ['title', 'excerpt'].some(function (field) { - return autosave[field] !== selectors_getEditedPostAttribute(state, field); - }); -} +var selectors_isEditedPostAutosaveable = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { + return function (state) { + // A post must contain a title, an excerpt, or non-empty content to be valid for autosaving. + if (!selectors_isEditedPostSaveable(state)) { + return false; + } // A post is not autosavable when there is a post autosave lock. + + + if (isPostAutosavingLocked(state)) { + return false; + } + + var postType = selectors_getCurrentPostType(state); + var postId = selectors_getCurrentPostId(state); + var hasFetchedAutosave = select('core').hasFetchedAutosaves(postType, postId); + var currentUserId = Object(external_this_lodash_["get"])(select('core').getCurrentUser(), ['id']); // Disable reason - this line causes the side-effect of fetching the autosave + // via a resolver, moving below the return would result in the autosave never + // being fetched. + // eslint-disable-next-line @wordpress/no-unused-vars-before-return + + var autosave = select('core').getAutosave(postType, postId, currentUserId); // If any existing autosaves have not yet been fetched, this function is + // unable to determine if the post is autosaveable, so return false. + + if (!hasFetchedAutosave) { + return false; + } // If we don't already have an autosave, the post is autosaveable. + + + if (!autosave) { + return true; + } // To avoid an expensive content serialization, use the content dirtiness + // flag in place of content field comparison against the known autosave. + // This is not strictly accurate, and relies on a tolerance toward autosave + // request failures for unnecessary saves. + + + if (hasChangedContent(state)) { + return true; + } // If the title or excerpt has changed, the post is autosaveable. + + + return ['title', 'excerpt'].some(function (field) { + return getPostRawValue(autosave[field]) !== selectors_getEditedPostAttribute(state, field); + }); + }; +}); /** * Returns the current autosave, or null if one is not set (i.e. if the post * has yet to be autosaved, or has been saved or published since the last * autosave). * + * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` + * selector from the '@wordpress/core-data' package. + * * @param {Object} state Editor state. * * @return {?Object} Current autosave, if exists. */ -function getAutosave(state) { - return state.autosave; -} +var getAutosave = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { + return function (state) { + external_this_wp_deprecated_default()("`wp.data.select( 'core/editor' ).getAutosave()`", { + alternative: "`wp.data.select( 'core' ).getAutosave( postType, postId, userId )`", + plugin: 'Gutenberg' + }); + var postType = selectors_getCurrentPostType(state); + var postId = selectors_getCurrentPostId(state); + var currentUserId = Object(external_this_lodash_["get"])(select('core').getCurrentUser(), ['id']); + var autosave = select('core').getAutosave(postType, postId, currentUserId); + return Object(external_this_lodash_["mapValues"])(Object(external_this_lodash_["pick"])(autosave, AUTOSAVE_PROPERTIES), getPostRawValue); + }; +}); /** * Returns the true if there is an existing autosave, otherwise false. * + * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector + * from the '@wordpress/core-data' package and check for a truthy value. + * * @param {Object} state Global application state. * * @return {boolean} Whether there is an existing autosave. */ -function hasAutosave(state) { - return !!getAutosave(state); -} +var hasAutosave = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { + return function (state) { + external_this_wp_deprecated_default()("`wp.data.select( 'core/editor' ).hasAutosave()`", { + alternative: "`!! wp.data.select( 'core' ).getAutosave( postType, postId, userId )`", + plugin: 'Gutenberg' + }); + var postType = selectors_getCurrentPostType(state); + var postId = selectors_getCurrentPostId(state); + var currentUserId = Object(external_this_lodash_["get"])(select('core').getCurrentUser(), ['id']); + return !!select('core').getAutosave(postType, postId, currentUserId); + }; +}); /** * Return true if the post being edited is being scheduled. Preferring the * unsaved status values. @@ -5833,7 +4994,7 @@ * infer that a post is set to publish "Immediately" we check whether the date * and modified date are the same. * - * @param {Object} state Editor state. + * @param {Object} state Editor state. * * @return {boolean} Whether the edited post has a floating date value. */ @@ -5844,7 +5005,7 @@ var status = selectors_getEditedPostAttribute(state, 'status'); if (status === 'draft' || status === 'auto-draft' || status === 'pending') { - return date === modified; + return date === modified || date === null; } return false; @@ -5857,9 +5018,13 @@ * @return {boolean} Whether post is being saved. */ -function selectors_isSavingPost(state) { - return state.saving.requesting; -} +var selectors_isSavingPost = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { + return function (state) { + var postType = selectors_getCurrentPostType(state); + var postId = selectors_getCurrentPostId(state); + return select('core').isSavingEntityRecord('postType', postType, postId); + }; +}); /** * Returns true if a previous post save was attempted successfully, or false * otherwise. @@ -5869,9 +5034,13 @@ * @return {boolean} Whether the post was saved successfully. */ -function didPostSaveRequestSucceed(state) { - return state.saving.successful; -} +var didPostSaveRequestSucceed = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { + return function (state) { + var postType = selectors_getCurrentPostType(state); + var postId = selectors_getCurrentPostId(state); + return !select('core').getLastEntitySaveError('postType', postType, postId); + }; +}); /** * Returns true if a previous post save was attempted but failed, or false * otherwise. @@ -5881,9 +5050,13 @@ * @return {boolean} Whether the post save failed. */ -function didPostSaveRequestFail(state) { - return !!state.saving.error; -} +var didPostSaveRequestFail = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { + return function (state) { + var postType = selectors_getCurrentPostType(state); + var postId = selectors_getCurrentPostId(state); + return !!select('core').getLastEntitySaveError('postType', postType, postId); + }; +}); /** * Returns true if the post is autosaving, or false otherwise. * @@ -5893,7 +5066,11 @@ */ function selectors_isAutosavingPost(state) { - return selectors_isSavingPost(state) && !!state.saving.options.isAutosave; + if (!selectors_isSavingPost(state)) { + return false; + } + + return !!Object(external_this_lodash_["get"])(state.saving, ['options', 'isAutosave']); } /** * Returns true if the post is being previewed, or false otherwise. @@ -5904,7 +5081,11 @@ */ function isPreviewingPost(state) { - return selectors_isSavingPost(state) && !!state.saving.options.isPreview; + if (!selectors_isSavingPost(state)) { + return false; + } + + return !!state.saving.options.isPreview; } /** * Returns the post preview link @@ -5915,8 +5096,23 @@ */ function selectors_getEditedPostPreviewLink(state) { + if (state.saving.pending || selectors_isSavingPost(state)) { + return; + } + + var previewLink = getAutosaveAttribute(state, 'preview_link'); + + if (!previewLink) { + previewLink = selectors_getEditedPostAttribute(state, 'link'); + + if (previewLink) { + previewLink = Object(external_this_wp_url_["addQueryArgs"])(previewLink, { + preview: true + }); + } + } + var featuredImageId = selectors_getEditedPostAttribute(state, 'featured_media'); - var previewLink = state.previewLink; if (previewLink && featuredImageId) { return Object(external_this_wp_url_["addQueryArgs"])(previewLink, { @@ -5937,7 +5133,7 @@ */ function selectors_getSuggestedPostFormat(state) { - var blocks = state.editor.present.blocks.value; + var blocks = selectors_getEditorBlocks(state); var name; // If there is only one block in the content of the post grab its name // so we can derive a suitable post format from it. @@ -5982,12 +5178,19 @@ * Returns a set of blocks which are to be used in consideration of the post's * generated save content. * + * @deprecated since Gutenberg 6.2.0. + * * @param {Object} state Editor state. * * @return {WPBlock[]} Filtered set of blocks for save. */ function getBlocksForSerialization(state) { + external_this_wp_deprecated_default()('`core/editor` getBlocksForSerialization selector', { + plugin: 'Gutenberg', + alternative: 'getEditorBlocks', + hint: 'Blocks serialization pre-processing occurs at save time' + }); var blocks = state.editor.present.blocks.value; // WARNING: Any changes to the logic of this function should be verified // against the implementation of isEditedPostEmpty, which bypasses this // function for performance' sake, in an assumption of this current logic @@ -6004,35 +5207,31 @@ return blocks; } /** - * Returns the content of the post being edited, preferring raw string edit - * before falling back to serialization of block state. + * Returns the content of the post being edited. * * @param {Object} state Global application state. * * @return {string} Post content. */ -var getEditedPostContent = Object(rememo["a" /* default */])(function (state) { - var edits = getPostEdits(state); - - if ('content' in edits) { - return edits.content; - } - - var blocks = getBlocksForSerialization(state); - var content = Object(external_this_wp_blocks_["serialize"])(blocks); // For compatibility purposes, treat a post consisting of a single - // freeform block as legacy content and downgrade to a pre-block-editor - // removep'd content format. - - var isSingleFreeformBlock = blocks.length === 1 && blocks[0].name === Object(external_this_wp_blocks_["getFreeformContentHandlerName"])(); - - if (isSingleFreeformBlock) { - return Object(external_this_wp_autop_["removep"])(content); - } - - return content; -}, function (state) { - return [state.editor.present.blocks.value, state.editor.present.edits.content, state.initialEdits.content]; +var getEditedPostContent = Object(external_this_wp_data_["createRegistrySelector"])(function (select) { + return function (state) { + var postId = selectors_getCurrentPostId(state); + var postType = selectors_getCurrentPostType(state); + var record = select('core').getEditedEntityRecord('postType', postType, postId); + + if (record) { + if (typeof record.content === 'function') { + return record.content(record); + } else if (record.blocks) { + return serialize_blocks(record.blocks); + } else if (record.content) { + return record.content; + } + } + + return ''; + }; }); /** * Returns the reusable block with the given ID. @@ -6051,7 +5250,7 @@ } var isTemporary = isNaN(parseInt(ref)); - return Object(objectSpread["a" /* default */])({}, block, { + return selectors_objectSpread({}, block, { id: isTemporary ? ref : +ref, isTemporary: isTemporary }); @@ -6091,8 +5290,8 @@ * @return {Array} An array of all reusable blocks. */ -var __experimentalGetReusableBlocks = Object(rememo["a" /* default */])(function (state) { - return Object(external_lodash_["map"])(state.reusableBlocks.data, function (value, ref) { +var selectors_experimentalGetReusableBlocks = Object(rememo["a" /* default */])(function (state) { + return Object(external_this_lodash_["map"])(state.reusableBlocks.data, function (value, ref) { return __experimentalGetReusableBlock(state, ref); }); }, function (state) { @@ -6109,8 +5308,8 @@ */ function getStateBeforeOptimisticTransaction(state, transactionId) { - var transaction = Object(external_lodash_["find"])(state.optimist, function (entry) { - return entry.beforeState && Object(external_lodash_["get"])(entry.action, ['optimist', 'id']) === transactionId; + var transaction = Object(external_this_lodash_["find"])(state.optimist, function (entry) { + return entry.beforeState && Object(external_this_lodash_["get"])(entry.action, ['optimist', 'id']) === transactionId; }); return transaction ? transaction.beforeState : null; } @@ -6138,7 +5337,7 @@ var stateBeforeRequest = getStateBeforeOptimisticTransaction(state, POST_UPDATE_TRANSACTION_ID); // Consider as publishing when current post prior to request was not // considered published - return !!stateBeforeRequest && !selectors_isCurrentPostPublished(stateBeforeRequest); + return !!stateBeforeRequest && !selectors_isCurrentPostPublished(null, stateBeforeRequest.currentPost); } /** * Returns whether the permalink is editable or not. @@ -6148,7 +5347,7 @@ * @return {boolean} Whether or not the permalink is editable. */ -function selectors_isPermalinkEditable(state) { +function isPermalinkEditable(state) { var permalinkTemplate = selectors_getEditedPostAttribute(state, 'permalink_template'); return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate); } @@ -6161,7 +5360,7 @@ */ function getPermalink(state) { - var permalinkParts = selectors_getPermalinkParts(state); + var permalinkParts = getPermalinkParts(state); if (!permalinkParts) { return null; @@ -6171,13 +5370,26 @@ postName = permalinkParts.postName, suffix = permalinkParts.suffix; - if (selectors_isPermalinkEditable(state)) { + if (isPermalinkEditable(state)) { return prefix + postName + suffix; } return prefix; } /** + * Returns the slug for the post being edited, preferring a manually edited + * value if one exists, then a sanitized version of the current post title, and + * finally the post ID. + * + * @param {Object} state Editor state. + * + * @return {string} The current slug to be displayed in the editor + */ + +function getEditedPostSlug(state) { + return selectors_getEditedPostAttribute(state, 'slug') || cleanForSlug(selectors_getEditedPostAttribute(state, 'title')) || selectors_getCurrentPostId(state); +} +/** * Returns the permalink for a post, split into it's three parts: the prefix, * the postName, and the suffix. * @@ -6187,7 +5399,7 @@ * the permalink, or null if the post is not viewable. */ -function selectors_getPermalinkParts(state) { +function getPermalinkParts(state) { var permalinkTemplate = selectors_getEditedPostAttribute(state, 'permalink_template'); if (!permalinkTemplate) { @@ -6252,6 +5464,17 @@ return Object.keys(state.postSavingLock).length > 0; } /** + * Returns whether post autosaving is locked. + * + * @param {Object} state Global application state. + * + * @return {boolean} Is locked. + */ + +function isPostAutosavingLocked(state) { + return Object.keys(state.postAutosavingLock).length > 0; +} +/** * Returns whether the edition of the post has been taken over. * * @param {Object} state Global application state. @@ -6292,8 +5515,8 @@ * @return {boolean} Whether the user can or can't post unfiltered HTML. */ -function canUserUseUnfilteredHTML(state) { - return Object(external_lodash_["has"])(selectors_getCurrentPost(state), ['_links', 'wp:action-unfiltered-html']); +function selectors_canUserUseUnfilteredHTML(state) { + return Object(external_this_lodash_["has"])(selectors_getCurrentPost(state), ['_links', 'wp:action-unfiltered-html']); } /** * Returns whether the pre-publish panel should be shown @@ -6318,8 +5541,39 @@ * @return {Array} Block list. */ -function getEditorBlocks(state) { - return state.editor.present.blocks.value; +function selectors_getEditorBlocks(state) { + return selectors_getEditedPostAttribute(state, 'blocks') || EMPTY_ARRAY; +} +/** + * A block selection object. + * + * @typedef {Object} WPBlockSelection + * + * @property {string} clientId A block client ID. + * @property {string} attributeKey A block attribute key. + * @property {number} offset An attribute value offset, based on the rich + * text value. See `wp.richText.create`. + */ + +/** + * Returns the current selection start. + * + * @param {Object} state + * @return {WPBlockSelection} The selection start. + */ + +function selectors_getEditorSelectionStart(state) { + return selectors_getEditedPostAttribute(state, 'selectionStart'); +} +/** + * Returns the current selection end. + * + * @param {Object} state + * @return {WPBlockSelection} The selection end. + */ + +function selectors_getEditorSelectionEnd(state) { + return selectors_getEditedPostAttribute(state, 'selectionEnd'); } /** * Is the editor ready @@ -6351,6 +5605,10 @@ return function (state) { var _select; + external_this_wp_deprecated_default()("`wp.data.select( 'core/editor' )." + name + '`', { + alternative: "`wp.data.select( 'core/block-editor' )." + name + '`' + }); + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } @@ -6359,59 +5617,266 @@ }; }); } - -var getBlockDependantsCacheBust = getBlockEditorSelector('getBlockDependantsCacheBust'); -var selectors_getBlockName = getBlockEditorSelector('getBlockName'); +/** + * @see getBlockName in core/block-editor store. + */ + + +var getBlockName = getBlockEditorSelector('getBlockName'); +/** + * @see isBlockValid in core/block-editor store. + */ + var isBlockValid = getBlockEditorSelector('isBlockValid'); +/** + * @see getBlockAttributes in core/block-editor store. + */ + var getBlockAttributes = getBlockEditorSelector('getBlockAttributes'); -var getBlock = getBlockEditorSelector('getBlock'); +/** + * @see getBlock in core/block-editor store. + */ + +var selectors_getBlock = getBlockEditorSelector('getBlock'); +/** + * @see getBlocks in core/block-editor store. + */ + var selectors_getBlocks = getBlockEditorSelector('getBlocks'); +/** + * @see __unstableGetBlockWithoutInnerBlocks in core/block-editor store. + */ + var __unstableGetBlockWithoutInnerBlocks = getBlockEditorSelector('__unstableGetBlockWithoutInnerBlocks'); +/** + * @see getClientIdsOfDescendants in core/block-editor store. + */ + var getClientIdsOfDescendants = getBlockEditorSelector('getClientIdsOfDescendants'); +/** + * @see getClientIdsWithDescendants in core/block-editor store. + */ + var getClientIdsWithDescendants = getBlockEditorSelector('getClientIdsWithDescendants'); +/** + * @see getGlobalBlockCount in core/block-editor store. + */ + var getGlobalBlockCount = getBlockEditorSelector('getGlobalBlockCount'); -var getBlocksByClientId = getBlockEditorSelector('getBlocksByClientId'); +/** + * @see getBlocksByClientId in core/block-editor store. + */ + +var selectors_getBlocksByClientId = getBlockEditorSelector('getBlocksByClientId'); +/** + * @see getBlockCount in core/block-editor store. + */ + var getBlockCount = getBlockEditorSelector('getBlockCount'); +/** + * @see getBlockSelectionStart in core/block-editor store. + */ + var getBlockSelectionStart = getBlockEditorSelector('getBlockSelectionStart'); +/** + * @see getBlockSelectionEnd in core/block-editor store. + */ + var getBlockSelectionEnd = getBlockEditorSelector('getBlockSelectionEnd'); +/** + * @see getSelectedBlockCount in core/block-editor store. + */ + var getSelectedBlockCount = getBlockEditorSelector('getSelectedBlockCount'); +/** + * @see hasSelectedBlock in core/block-editor store. + */ + var hasSelectedBlock = getBlockEditorSelector('hasSelectedBlock'); -var selectors_getSelectedBlockClientId = getBlockEditorSelector('getSelectedBlockClientId'); +/** + * @see getSelectedBlockClientId in core/block-editor store. + */ + +var getSelectedBlockClientId = getBlockEditorSelector('getSelectedBlockClientId'); +/** + * @see getSelectedBlock in core/block-editor store. + */ + var getSelectedBlock = getBlockEditorSelector('getSelectedBlock'); +/** + * @see getBlockRootClientId in core/block-editor store. + */ + var getBlockRootClientId = getBlockEditorSelector('getBlockRootClientId'); +/** + * @see getBlockHierarchyRootClientId in core/block-editor store. + */ + var getBlockHierarchyRootClientId = getBlockEditorSelector('getBlockHierarchyRootClientId'); +/** + * @see getAdjacentBlockClientId in core/block-editor store. + */ + var getAdjacentBlockClientId = getBlockEditorSelector('getAdjacentBlockClientId'); +/** + * @see getPreviousBlockClientId in core/block-editor store. + */ + var getPreviousBlockClientId = getBlockEditorSelector('getPreviousBlockClientId'); +/** + * @see getNextBlockClientId in core/block-editor store. + */ + var getNextBlockClientId = getBlockEditorSelector('getNextBlockClientId'); +/** + * @see getSelectedBlocksInitialCaretPosition in core/block-editor store. + */ + var getSelectedBlocksInitialCaretPosition = getBlockEditorSelector('getSelectedBlocksInitialCaretPosition'); +/** + * @see getMultiSelectedBlockClientIds in core/block-editor store. + */ + var getMultiSelectedBlockClientIds = getBlockEditorSelector('getMultiSelectedBlockClientIds'); +/** + * @see getMultiSelectedBlocks in core/block-editor store. + */ + var getMultiSelectedBlocks = getBlockEditorSelector('getMultiSelectedBlocks'); +/** + * @see getFirstMultiSelectedBlockClientId in core/block-editor store. + */ + var getFirstMultiSelectedBlockClientId = getBlockEditorSelector('getFirstMultiSelectedBlockClientId'); +/** + * @see getLastMultiSelectedBlockClientId in core/block-editor store. + */ + var getLastMultiSelectedBlockClientId = getBlockEditorSelector('getLastMultiSelectedBlockClientId'); +/** + * @see isFirstMultiSelectedBlock in core/block-editor store. + */ + var isFirstMultiSelectedBlock = getBlockEditorSelector('isFirstMultiSelectedBlock'); +/** + * @see isBlockMultiSelected in core/block-editor store. + */ + var isBlockMultiSelected = getBlockEditorSelector('isBlockMultiSelected'); +/** + * @see isAncestorMultiSelected in core/block-editor store. + */ + var isAncestorMultiSelected = getBlockEditorSelector('isAncestorMultiSelected'); +/** + * @see getMultiSelectedBlocksStartClientId in core/block-editor store. + */ + var getMultiSelectedBlocksStartClientId = getBlockEditorSelector('getMultiSelectedBlocksStartClientId'); +/** + * @see getMultiSelectedBlocksEndClientId in core/block-editor store. + */ + var getMultiSelectedBlocksEndClientId = getBlockEditorSelector('getMultiSelectedBlocksEndClientId'); +/** + * @see getBlockOrder in core/block-editor store. + */ + var getBlockOrder = getBlockEditorSelector('getBlockOrder'); +/** + * @see getBlockIndex in core/block-editor store. + */ + var getBlockIndex = getBlockEditorSelector('getBlockIndex'); +/** + * @see isBlockSelected in core/block-editor store. + */ + var isBlockSelected = getBlockEditorSelector('isBlockSelected'); +/** + * @see hasSelectedInnerBlock in core/block-editor store. + */ + var hasSelectedInnerBlock = getBlockEditorSelector('hasSelectedInnerBlock'); +/** + * @see isBlockWithinSelection in core/block-editor store. + */ + var isBlockWithinSelection = getBlockEditorSelector('isBlockWithinSelection'); +/** + * @see hasMultiSelection in core/block-editor store. + */ + var hasMultiSelection = getBlockEditorSelector('hasMultiSelection'); +/** + * @see isMultiSelecting in core/block-editor store. + */ + var isMultiSelecting = getBlockEditorSelector('isMultiSelecting'); +/** + * @see isSelectionEnabled in core/block-editor store. + */ + var isSelectionEnabled = getBlockEditorSelector('isSelectionEnabled'); +/** + * @see getBlockMode in core/block-editor store. + */ + var getBlockMode = getBlockEditorSelector('getBlockMode'); -var selectors_isTyping = getBlockEditorSelector('isTyping'); -var selectors_isCaretWithinFormattedText = getBlockEditorSelector('isCaretWithinFormattedText'); +/** + * @see isTyping in core/block-editor store. + */ + +var isTyping = getBlockEditorSelector('isTyping'); +/** + * @see isCaretWithinFormattedText in core/block-editor store. + */ + +var isCaretWithinFormattedText = getBlockEditorSelector('isCaretWithinFormattedText'); +/** + * @see getBlockInsertionPoint in core/block-editor store. + */ + var getBlockInsertionPoint = getBlockEditorSelector('getBlockInsertionPoint'); +/** + * @see isBlockInsertionPointVisible in core/block-editor store. + */ + var isBlockInsertionPointVisible = getBlockEditorSelector('isBlockInsertionPointVisible'); +/** + * @see isValidTemplate in core/block-editor store. + */ + var isValidTemplate = getBlockEditorSelector('isValidTemplate'); +/** + * @see getTemplate in core/block-editor store. + */ + var getTemplate = getBlockEditorSelector('getTemplate'); +/** + * @see getTemplateLock in core/block-editor store. + */ + var getTemplateLock = getBlockEditorSelector('getTemplateLock'); -var canInsertBlockType = getBlockEditorSelector('canInsertBlockType'); -var selectors_getInserterItems = getBlockEditorSelector('getInserterItems'); +/** + * @see canInsertBlockType in core/block-editor store. + */ + +var selectors_canInsertBlockType = getBlockEditorSelector('canInsertBlockType'); +/** + * @see getInserterItems in core/block-editor store. + */ + +var getInserterItems = getBlockEditorSelector('getInserterItems'); +/** + * @see hasInserterItems in core/block-editor store. + */ + var hasInserterItems = getBlockEditorSelector('hasInserterItems'); +/** + * @see getBlockListSettings in core/block-editor store. + */ + var getBlockListSettings = getBlockEditorSelector('getBlockListSettings'); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/effects/reusable-blocks.js @@ -6419,6 +5884,10 @@ +function reusable_blocks_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function reusable_blocks_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { reusable_blocks_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { reusable_blocks_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + /** * External dependencies */ @@ -6441,27 +5910,22 @@ - /** * Module Constants */ var REUSABLE_BLOCK_NOTICE_ID = 'REUSABLE_BLOCK_NOTICE_ID'; /** - * Fetch Reusable Blocks Effect Handler. + * Fetch Reusable blocks Effect Handler. * * @param {Object} action action object. * @param {Object} store Redux Store. */ -var fetchReusableBlocks = -/*#__PURE__*/ -function () { - var _ref = Object(asyncToGenerator["a" /* default */])( - /*#__PURE__*/ - regenerator_default.a.mark(function _callee(action, store) { +var fetchReusableBlocks = /*#__PURE__*/function () { + var _ref = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(function _callee(action, store) { var id, dispatch, postType, posts, results; - return regenerator_default.a.wrap(function _callee$(_context) { + return external_this_regeneratorRuntime_default.a.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: @@ -6513,19 +5977,15 @@ posts = _context.sent; case 18: - results = Object(external_lodash_["compact"])(Object(external_lodash_["map"])(posts, function (post) { + results = Object(external_this_lodash_["compact"])(Object(external_this_lodash_["map"])(posts, function (post) { if (post.status !== 'publish' || post.content.protected) { return null; } - var parsedBlocks = Object(external_this_wp_blocks_["parse"])(post.content.raw); - return { - reusableBlock: { - id: post.id, - title: getPostRawValue(post.title) - }, - parsedBlock: parsedBlocks.length === 1 ? parsedBlocks[0] : Object(external_this_wp_blocks_["createBlock"])('core/template', {}, parsedBlocks) - }; + return reusable_blocks_objectSpread({}, post, { + content: post.content.raw, + title: post.title.raw + }); })); if (results.length) { @@ -6553,7 +6013,7 @@ return _context.stop(); } } - }, _callee, this, [[7, 23]]); + }, _callee, null, [[7, 23]]); })); return function fetchReusableBlocks(_x, _x2) { @@ -6561,21 +6021,17 @@ }; }(); /** - * Save Reusable Blocks Effect Handler. + * Save Reusable blocks Effect Handler. * * @param {Object} action action object. * @param {Object} store Redux Store. */ -var saveReusableBlocks = -/*#__PURE__*/ -function () { - var _ref2 = Object(asyncToGenerator["a" /* default */])( - /*#__PURE__*/ - regenerator_default.a.mark(function _callee2(action, store) { - var postType, id, dispatch, state, _getReusableBlock, clientId, title, isTemporary, reusableBlock, content, data, path, method, updatedReusableBlock, message; - - return regenerator_default.a.wrap(function _callee2$(_context2) { +var saveReusableBlocks = /*#__PURE__*/function () { + var _ref2 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(function _callee2(action, store) { + var postType, id, dispatch, state, _getReusableBlock, title, content, isTemporary, data, path, method, updatedReusableBlock, message; + + return external_this_regeneratorRuntime_default.a.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: @@ -6598,9 +6054,7 @@ id = action.id; dispatch = store.dispatch; state = store.getState(); - _getReusableBlock = __experimentalGetReusableBlock(state, id), clientId = _getReusableBlock.clientId, title = _getReusableBlock.title, isTemporary = _getReusableBlock.isTemporary; - reusableBlock = Object(external_this_wp_data_["select"])('core/block-editor').getBlock(clientId); - content = Object(external_this_wp_blocks_["serialize"])(reusableBlock.name === 'core/template' ? reusableBlock.innerBlocks : reusableBlock); + _getReusableBlock = __experimentalGetReusableBlock(state, id), title = _getReusableBlock.title, content = _getReusableBlock.content, isTemporary = _getReusableBlock.isTemporary; data = isTemporary ? { title: title, content: content, @@ -6613,15 +6067,15 @@ }; path = isTemporary ? "/wp/v2/".concat(postType.rest_base) : "/wp/v2/".concat(postType.rest_base, "/").concat(id); method = isTemporary ? 'POST' : 'PUT'; - _context2.prev = 14; - _context2.next = 17; + _context2.prev = 12; + _context2.next = 15; return external_this_wp_apiFetch_default()({ path: path, data: data, method: method }); - case 17: + case 15: updatedReusableBlock = _context2.sent; dispatch({ type: 'SAVE_REUSABLE_BLOCK_SUCCESS', @@ -6630,17 +6084,18 @@ }); message = isTemporary ? Object(external_this_wp_i18n_["__"])('Block created.') : Object(external_this_wp_i18n_["__"])('Block updated.'); Object(external_this_wp_data_["dispatch"])('core/notices').createSuccessNotice(message, { - id: REUSABLE_BLOCK_NOTICE_ID + id: REUSABLE_BLOCK_NOTICE_ID, + type: 'snackbar' }); Object(external_this_wp_data_["dispatch"])('core/block-editor').__unstableSaveReusableBlock(id, updatedReusableBlock.id); - _context2.next = 28; + _context2.next = 26; break; - case 24: - _context2.prev = 24; - _context2.t0 = _context2["catch"](14); + case 22: + _context2.prev = 22; + _context2.t0 = _context2["catch"](12); dispatch({ type: 'SAVE_REUSABLE_BLOCK_FAILURE', id: id @@ -6649,12 +6104,12 @@ id: REUSABLE_BLOCK_NOTICE_ID }); - case 28: + case 26: case "end": return _context2.stop(); } } - }, _callee2, this, [[14, 24]]); + }, _callee2, null, [[12, 22]]); })); return function saveReusableBlocks(_x3, _x4) { @@ -6662,20 +6117,16 @@ }; }(); /** - * Delete Reusable Blocks Effect Handler. + * Delete Reusable blocks Effect Handler. * * @param {Object} action action object. * @param {Object} store Redux Store. */ -var deleteReusableBlocks = -/*#__PURE__*/ -function () { - var _ref3 = Object(asyncToGenerator["a" /* default */])( - /*#__PURE__*/ - regenerator_default.a.mark(function _callee3(action, store) { +var deleteReusableBlocks = /*#__PURE__*/function () { + var _ref3 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(function _callee3(action, store) { var postType, id, getState, dispatch, reusableBlock, allBlocks, associatedBlocks, associatedBlockClientIds, transactionId, message; - return regenerator_default.a.wrap(function _callee3$(_context3) { + return external_this_regeneratorRuntime_default.a.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: @@ -6716,7 +6167,7 @@ associatedBlockClientIds = associatedBlocks.map(function (block) { return block.clientId; }); - transactionId = Object(external_lodash_["uniqueId"])(); + transactionId = Object(external_this_lodash_["uniqueId"])(); dispatch({ type: 'REMOVE_REUSABLE_BLOCK', id: id, @@ -6726,7 +6177,10 @@ } }); // Remove the parsed block. - Object(external_this_wp_data_["dispatch"])('core/block-editor').removeBlocks([].concat(Object(toConsumableArray["a" /* default */])(associatedBlockClientIds), [reusableBlock.clientId])); + if (associatedBlockClientIds.length) { + Object(external_this_wp_data_["dispatch"])('core/block-editor').removeBlocks(associatedBlockClientIds); + } + _context3.prev = 16; _context3.next = 19; return external_this_wp_apiFetch_default()({ @@ -6745,7 +6199,8 @@ }); message = Object(external_this_wp_i18n_["__"])('Block deleted.'); Object(external_this_wp_data_["dispatch"])('core/notices').createSuccessNotice(message, { - id: REUSABLE_BLOCK_NOTICE_ID + id: REUSABLE_BLOCK_NOTICE_ID, + type: 'snackbar' }); _context3.next = 28; break; @@ -6770,7 +6225,7 @@ return _context3.stop(); } } - }, _callee3, this, [[16, 24]]); + }, _callee3, null, [[16, 24]]); })); return function deleteReusableBlocks(_x5, _x6) { @@ -6778,15 +6233,6 @@ }; }(); /** - * Receive Reusable Blocks Effect Handler. - * - * @param {Object} action action object. - */ - -var reusable_blocks_receiveReusableBlocks = function receiveReusableBlocks(action) { - Object(external_this_wp_data_["dispatch"])('core/block-editor').receiveBlocks(Object(external_lodash_["map"])(action.results, 'parsedBlock')); -}; -/** * Convert a reusable block to a static block effect handler * * @param {Object} action action object. @@ -6797,17 +6243,7 @@ var state = store.getState(); var oldBlock = Object(external_this_wp_data_["select"])('core/block-editor').getBlock(action.clientId); var reusableBlock = __experimentalGetReusableBlock(state, oldBlock.attributes.ref); - var referencedBlock = Object(external_this_wp_data_["select"])('core/block-editor').getBlock(reusableBlock.clientId); - var newBlocks; - - if (referencedBlock.name === 'core/template') { - newBlocks = referencedBlock.innerBlocks.map(function (innerBlock) { - return Object(external_this_wp_blocks_["cloneBlock"])(innerBlock); - }); - } else { - newBlocks = [Object(external_this_wp_blocks_["cloneBlock"])(referencedBlock)]; - } - + var newBlocks = Object(external_this_wp_blocks_["parse"])(reusableBlock.content); Object(external_this_wp_data_["dispatch"])('core/block-editor').replaceBlocks(oldBlock.clientId, newBlocks); }; /** @@ -6819,76 +6255,24 @@ var reusable_blocks_convertBlockToReusable = function convertBlockToReusable(action, store) { var dispatch = store.dispatch; - var parsedBlock; - - if (action.clientIds.length === 1) { - parsedBlock = Object(external_this_wp_data_["select"])('core/block-editor').getBlock(action.clientIds[0]); - } else { - parsedBlock = Object(external_this_wp_blocks_["createBlock"])('core/template', {}, Object(external_this_wp_data_["select"])('core/block-editor').getBlocksByClientId(action.clientIds)); // This shouldn't be necessary but at the moment - // we expect the content of the shared blocks to live in the blocks state. - - Object(external_this_wp_data_["dispatch"])('core/block-editor').receiveBlocks([parsedBlock]); - } - var reusableBlock = { - id: Object(external_lodash_["uniqueId"])('reusable'), - clientId: parsedBlock.clientId, - title: Object(external_this_wp_i18n_["__"])('Untitled Reusable Block') - }; - dispatch(__experimentalReceiveReusableBlocks([{ - reusableBlock: reusableBlock, - parsedBlock: parsedBlock - }])); + id: Object(external_this_lodash_["uniqueId"])('reusable'), + title: Object(external_this_wp_i18n_["__"])('Untitled Reusable Block'), + content: Object(external_this_wp_blocks_["serialize"])(Object(external_this_wp_data_["select"])('core/block-editor').getBlocksByClientId(action.clientIds)) + }; + dispatch(__experimentalReceiveReusableBlocks([reusableBlock])); dispatch(__experimentalSaveReusableBlock(reusableBlock.id)); Object(external_this_wp_data_["dispatch"])('core/block-editor').replaceBlocks(action.clientIds, Object(external_this_wp_blocks_["createBlock"])('core/block', { ref: reusableBlock.id - })); // Re-add the original block to the store, since replaceBlock() will have removed it - - Object(external_this_wp_data_["dispatch"])('core/block-editor').receiveBlocks([parsedBlock]); + })); }; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/effects.js /** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - -/** * Internal dependencies */ - - /* harmony default export */ var effects = ({ - SETUP_EDITOR: function SETUP_EDITOR(action) { - var post = action.post, - edits = action.edits, - template = action.template; // In order to ensure maximum of a single parse during setup, edits are - // included as part of editor setup action. Assume edited content as - // canonical if provided, falling back to post. - - var content; - - if (Object(external_lodash_["has"])(edits, ['content'])) { - content = edits.content; - } else { - content = post.content.raw; - } - - var blocks = Object(external_this_wp_blocks_["parse"])(content); // Apply a template for new posts only, if exists. - - var isNewPost = post.status === 'auto-draft'; - - if (isNewPost && template) { - blocks = Object(external_this_wp_blocks_["synchronizeBlocksWithTemplate"])(blocks, template); - } - - return [actions_resetEditorBlocks(blocks), setupEditorState(post)]; - }, FETCH_REUSABLE_BLOCKS: function FETCH_REUSABLE_BLOCKS(action, store) { fetchReusableBlocks(action, store); }, @@ -6898,20 +6282,15 @@ DELETE_REUSABLE_BLOCK: function DELETE_REUSABLE_BLOCK(action, store) { deleteReusableBlocks(action, store); }, - RECEIVE_REUSABLE_BLOCKS: reusable_blocks_receiveReusableBlocks, CONVERT_BLOCK_TO_STATIC: reusable_blocks_convertBlockToStatic, CONVERT_BLOCK_TO_REUSABLE: reusable_blocks_convertBlockToReusable }); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/middlewares.js - - /** * External dependencies */ - - /** * Internal dependencies */ @@ -6926,33 +6305,119 @@ */ function applyMiddlewares(store) { - var middlewares = [refx_default()(effects), lib_default.a]; - var enhancedDispatch = function enhancedDispatch() { throw new Error('Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.'); }; - var chain = []; var middlewareAPI = { getState: store.getState, dispatch: function dispatch() { return enhancedDispatch.apply(void 0, arguments); } }; - chain = middlewares.map(function (middleware) { - return middleware(middlewareAPI); - }); - enhancedDispatch = external_lodash_["flowRight"].apply(void 0, Object(toConsumableArray["a" /* default */])(chain))(store.dispatch); + enhancedDispatch = refx_default()(effects)(middlewareAPI)(store.dispatch); store.dispatch = enhancedDispatch; return store; } -/* harmony default export */ var store_middlewares = (applyMiddlewares); +/* harmony default export */ var middlewares = (applyMiddlewares); + +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/controls.js +/** + * WordPress dependencies + */ + +/** + * Returns a control descriptor signalling to subscribe to the registry and + * resolve the control promise only when the next state change occurs. + * + * @return {Object} Control descriptor. + */ + +function awaitNextStateChange() { + return { + type: 'AWAIT_NEXT_STATE_CHANGE' + }; +} +/** + * Returns a control descriptor signalling to resolve with the current data + * registry. + * + * @return {Object} Control descriptor. + */ + +function getRegistry() { + return { + type: 'GET_REGISTRY' + }; +} +/** + * Function returning a sessionStorage key to set or retrieve a given post's + * automatic session backup. + * + * Keys are crucially prefixed with 'wp-autosave-' so that wp-login.php's + * `loggedout` handler can clear sessionStorage of any user-private content. + * + * @see https://github.com/WordPress/wordpress-develop/blob/6dad32d2aed47e6c0cf2aee8410645f6d7aba6bd/src/wp-login.php#L103 + * + * @param {string} postId Post ID. + * @return {string} sessionStorage key + */ + +function postKey(postId) { + return "wp-autosave-block-editor-post-".concat(postId); +} + +function localAutosaveGet(postId) { + return window.sessionStorage.getItem(postKey(postId)); +} +function localAutosaveSet(postId, title, content, excerpt) { + window.sessionStorage.setItem(postKey(postId), JSON.stringify({ + post_title: title, + content: content, + excerpt: excerpt + })); +} +function localAutosaveClear(postId) { + window.sessionStorage.removeItem(postKey(postId)); +} +var controls = { + AWAIT_NEXT_STATE_CHANGE: Object(external_this_wp_data_["createRegistryControl"])(function (registry) { + return function () { + return new Promise(function (resolve) { + var unsubscribe = registry.subscribe(function () { + unsubscribe(); + resolve(); + }); + }); + }; + }), + GET_REGISTRY: Object(external_this_wp_data_["createRegistryControl"])(function (registry) { + return function () { + return registry; + }; + }), + LOCAL_AUTOSAVE_SET: function LOCAL_AUTOSAVE_SET(_ref) { + var postId = _ref.postId, + title = _ref.title, + content = _ref.content, + excerpt = _ref.excerpt; + localAutosaveSet(postId, title, content, excerpt); + } +}; +/* harmony default export */ var store_controls = (controls); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/index.js -/** - * WordPress dependencies - */ + + +function store_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function store_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { store_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { store_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +/** + * WordPress dependencies + */ + /** * Internal dependencies @@ -6964,139 +6429,178 @@ -var store_store = Object(external_this_wp_data_["registerStore"])(STORE_KEY, { - reducer: store_reducer, +/** + * Post editor data store configuration. + * + * @see https://github.com/WordPress/gutenberg/blob/master/packages/data/README.md#registerStore + * + * @type {Object} + */ + +var storeConfig = { + reducer: reducer, selectors: selectors_namespaceObject, actions: actions_namespaceObject, - controls: controls, + controls: store_objectSpread({}, external_this_wp_dataControls_["controls"], {}, store_controls) +}; +var store_store = Object(external_this_wp_data_["registerStore"])(STORE_KEY, store_objectSpread({}, storeConfig, { persist: ['preferences'] -}); -store_middlewares(store_store); +})); +middlewares(store_store); /* harmony default export */ var build_module_store = (store_store); -// EXTERNAL MODULE: external {"this":["wp","hooks"]} -var external_this_wp_hooks_ = __webpack_require__(26); +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js +var esm_extends = __webpack_require__(8); + +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +var objectWithoutProperties = __webpack_require__(15); // EXTERNAL MODULE: external {"this":["wp","element"]} var external_this_wp_element_ = __webpack_require__(0); -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/block.js - - - -/** - * WordPress dependencies - */ - - - -/** - * Returns the client ID of the parent where a newly inserted block would be - * placed. - * - * @return {string} Client ID of the parent where a newly inserted block would - * be placed. - */ - -function defaultGetBlockInsertionParentClientId() { - return Object(external_this_wp_data_["select"])('core/block-editor').getBlockInsertionPoint().rootClientId; -} -/** - * Returns the inserter items for the specified parent block. - * - * @param {string} rootClientId Client ID of the block for which to retrieve - * inserter items. - * - * @return {Array} The inserter items for the specified - * parent. - */ - - -function defaultGetInserterItems(rootClientId) { - return Object(external_this_wp_data_["select"])('core/block-editor').getInserterItems(rootClientId); -} -/** - * Returns the name of the currently selected block. - * - * @return {string?} The name of the currently selected block or `null` if no - * block is selected. - */ - - -function defaultGetSelectedBlockName() { - var _select = Object(external_this_wp_data_["select"])('core/block-editor'), - getSelectedBlockClientId = _select.getSelectedBlockClientId, - getBlockName = _select.getBlockName; - - var selectedBlockClientId = getSelectedBlockClientId(); - return selectedBlockClientId ? getBlockName(selectedBlockClientId) : null; -} -/** - * Creates a blocks repeater for replacing the current block with a selected block type. - * - * @return {Completer} A blocks completer. - */ - - -function createBlockCompleter() { - var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - _ref$getBlockInsertio = _ref.getBlockInsertionParentClientId, - getBlockInsertionParentClientId = _ref$getBlockInsertio === void 0 ? defaultGetBlockInsertionParentClientId : _ref$getBlockInsertio, - _ref$getInserterItems = _ref.getInserterItems, - getInserterItems = _ref$getInserterItems === void 0 ? defaultGetInserterItems : _ref$getInserterItems, - _ref$getSelectedBlock = _ref.getSelectedBlockName, - getSelectedBlockName = _ref$getSelectedBlock === void 0 ? defaultGetSelectedBlockName : _ref$getSelectedBlock; - - return { - name: 'blocks', - className: 'editor-autocompleters__block', - triggerPrefix: '/', - options: function options() { - var selectedBlockName = getSelectedBlockName(); - return getInserterItems(getBlockInsertionParentClientId()).filter( // Avoid offering to replace the current block with a block of the same type. - function (inserterItem) { - return selectedBlockName !== inserterItem.name; - }); - }, - getOptionKeywords: function getOptionKeywords(inserterItem) { - var title = inserterItem.title, - _inserterItem$keyword = inserterItem.keywords, - keywords = _inserterItem$keyword === void 0 ? [] : _inserterItem$keyword, - category = inserterItem.category; - return [category].concat(Object(toConsumableArray["a" /* default */])(keywords), [title]); - }, - getOptionLabel: function getOptionLabel(inserterItem) { - var icon = inserterItem.icon, - title = inserterItem.title; - return [Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockIcon"], { - key: "icon", - icon: icon, - showColors: true - }), title]; - }, - allowContext: function allowContext(before, after) { - return !(/\S/.test(before) || /\S/.test(after)); - }, - getOptionCompletion: function getOptionCompletion(inserterItem) { - var name = inserterItem.name, - initialAttributes = inserterItem.initialAttributes; - return { - action: 'replace', - value: Object(external_this_wp_blocks_["createBlock"])(name, initialAttributes) - }; - }, - isOptionDisabled: function isOptionDisabled(inserterItem) { - return inserterItem.isDisabled; - } - }; -} -/** - * Creates a blocks repeater for replacing the current block with a selected block type. - * - * @return {Completer} A blocks completer. - */ - -/* harmony default export */ var autocompleters_block = (createBlockCompleter()); +// EXTERNAL MODULE: external {"this":["wp","compose"]} +var external_this_wp_compose_ = __webpack_require__(9); + +// EXTERNAL MODULE: external {"this":["wp","hooks"]} +var external_this_wp_hooks_ = __webpack_require__(32); + +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/custom-sources-backwards-compatibility.js + + + + + + +function custom_sources_backwards_compatibility_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function custom_sources_backwards_compatibility_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { custom_sources_backwards_compatibility_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { custom_sources_backwards_compatibility_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + +/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */ + +/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */ + +/** + * Object whose keys are the names of block attributes, where each value + * represents the meta key to which the block attribute is intended to save. + * + * @see https://developer.wordpress.org/reference/functions/register_meta/ + * + * @typedef {Object} WPMetaAttributeMapping + */ + +/** + * Given a mapping of attribute names (meta source attributes) to their + * associated meta key, returns a higher order component that overrides its + * `attributes` and `setAttributes` props to sync any changes with the edited + * post's meta keys. + * + * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping. + * + * @return {WPHigherOrderComponent} Higher-order component. + */ + +var custom_sources_backwards_compatibility_createWithMetaAttributeSource = function createWithMetaAttributeSource(metaAttributes) { + return Object(external_this_wp_compose_["createHigherOrderComponent"])(function (BlockEdit) { + return function (_ref) { + var attributes = _ref.attributes, + _setAttributes = _ref.setAttributes, + props = Object(objectWithoutProperties["a" /* default */])(_ref, ["attributes", "setAttributes"]); + + var postType = Object(external_this_wp_data_["useSelect"])(function (select) { + return select('core/editor').getCurrentPostType(); + }, []); + + var _useEntityProp = Object(external_this_wp_coreData_["useEntityProp"])('postType', postType, 'meta'), + _useEntityProp2 = Object(slicedToArray["a" /* default */])(_useEntityProp, 2), + meta = _useEntityProp2[0], + setMeta = _useEntityProp2[1]; + + var mergedAttributes = Object(external_this_wp_element_["useMemo"])(function () { + return custom_sources_backwards_compatibility_objectSpread({}, attributes, {}, Object(external_this_lodash_["mapValues"])(metaAttributes, function (metaKey) { + return meta[metaKey]; + })); + }, [attributes, meta]); + return Object(external_this_wp_element_["createElement"])(BlockEdit, Object(esm_extends["a" /* default */])({ + attributes: mergedAttributes, + setAttributes: function setAttributes(nextAttributes) { + var nextMeta = Object(external_this_lodash_["mapKeys"])( // Filter to intersection of keys between the updated + // attributes and those with an associated meta key. + Object(external_this_lodash_["pickBy"])(nextAttributes, function (value, key) { + return metaAttributes[key]; + }), // Rename the keys to the expected meta key name. + function (value, attributeKey) { + return metaAttributes[attributeKey]; + }); + + if (!Object(external_this_lodash_["isEmpty"])(nextMeta)) { + setMeta(nextMeta); + } + + _setAttributes(nextAttributes); + } + }, props)); + }; + }, 'withMetaAttributeSource'); +}; +/** + * Filters a registered block's settings to enhance a block's `edit` component + * to upgrade meta-sourced attributes to use the post's meta entity property. + * + * @param {WPBlockSettings} settings Registered block settings. + * + * @return {WPBlockSettings} Filtered block settings. + */ + + +function shimAttributeSource(settings) { + /** @type {WPMetaAttributeMapping} */ + var metaAttributes = Object(external_this_lodash_["mapValues"])(Object(external_this_lodash_["pickBy"])(settings.attributes, { + source: 'meta' + }), 'meta'); + + if (!Object(external_this_lodash_["isEmpty"])(metaAttributes)) { + settings.edit = custom_sources_backwards_compatibility_createWithMetaAttributeSource(metaAttributes)(settings.edit); + } + + return settings; +} + +Object(external_this_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/editor/custom-sources-backwards-compatibility/shim-attribute-source', shimAttributeSource); // The above filter will only capture blocks registered after the filter was +// added. There may already be blocks registered by this point, and those must +// be updated to apply the shim. +// +// The following implementation achieves this, albeit with a couple caveats: +// - Only blocks registered on the global store will be modified. +// - The block settings are directly mutated, since there is currently no +// mechanism to update an existing block registration. This is the reason for +// `getBlockType` separate from `getBlockTypes`, since the latter returns a +// _copy_ of the block registration (i.e. the mutation would not affect the +// actual registered block settings). +// +// `getBlockTypes` or `getBlockType` implementation could change in the future +// in regards to creating settings clones, but the corresponding end-to-end +// tests for meta blocks should cover against any potential regressions. +// +// In the future, we could support updating block settings, at which point this +// implementation could use that mechanism instead. + +Object(external_this_wp_data_["select"])('core/blocks').getBlockTypes().map(function (_ref2) { + var name = _ref2.name; + return Object(external_this_wp_data_["select"])('core/blocks').getBlockType(name); +}).forEach(shimAttributeSource); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/user.js @@ -7105,11 +6609,13 @@ * WordPress dependencies */ -/** -* A user mentions completer. -* -* @type {Completer} -*/ +/** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */ + +/** + * A user mentions completer. + * + * @type {WPCompleter} + */ /* harmony default export */ var autocompleters_user = ({ name: 'users', @@ -7131,12 +6637,15 @@ return [user.slug, user.name]; }, getOptionLabel: function getOptionLabel(user) { - return [Object(external_this_wp_element_["createElement"])("img", { + var avatar = user.avatar_urls && user.avatar_urls[24] ? Object(external_this_wp_element_["createElement"])("img", { key: "avatar", className: "editor-autocompleters__user-avatar", alt: "", src: user.avatar_urls[24] - }), Object(external_this_wp_element_["createElement"])("span", { + }) : Object(external_this_wp_element_["createElement"])("span", { + className: "editor-autocompleters__no-avatar" + }); + return [avatar, Object(external_this_wp_element_["createElement"])("span", { key: "name", className: "editor-autocompleters__user-name" }, user.name), Object(external_this_wp_element_["createElement"])("span", { @@ -7149,63 +6658,55 @@ } }); +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/default-autocompleters.js +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + + +function setDefaultCompleters() { + var completers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + // Provide copies so filters may directly modify them. + completers.push(Object(external_this_lodash_["clone"])(autocompleters_user)); + return completers; +} + +Object(external_this_wp_hooks_["addFilter"])('editor.Autocomplete.completers', 'editor/autocompleters/set-default-completers', setDefaultCompleters); + +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/index.js +/** + * Internal dependencies + */ + + + // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/index.js - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js -var esm_extends = __webpack_require__(19); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js + 1 modules -var objectWithoutProperties = __webpack_require__(21); - -// EXTERNAL MODULE: external {"this":["wp","components"]} -var external_this_wp_components_ = __webpack_require__(4); - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/server-side-render/index.js - - - - - -/** - * WordPress dependencies - */ - - -/* harmony default export */ var server_side_render = (function (_ref) { - var _ref$urlQueryArgs = _ref.urlQueryArgs, - urlQueryArgs = _ref$urlQueryArgs === void 0 ? {} : _ref$urlQueryArgs, - props = Object(objectWithoutProperties["a" /* default */])(_ref, ["urlQueryArgs"]); - - var _select = Object(external_this_wp_data_["select"])('core/editor'), - getCurrentPostId = _select.getCurrentPostId; - - urlQueryArgs = Object(objectSpread["a" /* default */])({ - post_id: getCurrentPostId() - }, urlQueryArgs); - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ServerSideRender"], Object(esm_extends["a" /* default */])({ - urlQueryArgs: urlQueryArgs - }, props)); -}); - // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js -var classCallCheck = __webpack_require__(10); +var classCallCheck = __webpack_require__(20); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js -var createClass = __webpack_require__(9); +var createClass = __webpack_require__(19); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js -var possibleConstructorReturn = __webpack_require__(11); +var possibleConstructorReturn = __webpack_require__(23); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js -var getPrototypeOf = __webpack_require__(12); +var getPrototypeOf = __webpack_require__(16); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules -var inherits = __webpack_require__(13); - -// EXTERNAL MODULE: external {"this":["wp","compose"]} -var external_this_wp_compose_ = __webpack_require__(6); +var inherits = __webpack_require__(22); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autosave-monitor/index.js @@ -7214,21 +6715,25 @@ -/** - * WordPress dependencies - */ - - - -var autosave_monitor_AutosaveMonitor = -/*#__PURE__*/ -function (_Component) { +function _createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +/** + * WordPress dependencies + */ + + + +var autosave_monitor_AutosaveMonitor = /*#__PURE__*/function (_Component) { Object(inherits["a" /* default */])(AutosaveMonitor, _Component); + var _super = _createSuper(AutosaveMonitor); + function AutosaveMonitor() { Object(classCallCheck["a" /* default */])(this, AutosaveMonitor); - return Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(AutosaveMonitor).apply(this, arguments)); + return _super.apply(this, arguments); } Object(createClass["a" /* default */])(AutosaveMonitor, [{ @@ -7267,13 +6772,26 @@ value: function toggleTimer(isPendingSave) { var _this = this; - clearTimeout(this.pendingSave); - var autosaveInterval = this.props.autosaveInterval; - - if (isPendingSave) { + var _this$props2 = this.props, + interval = _this$props2.interval, + _this$props2$shouldTh = _this$props2.shouldThrottle, + shouldThrottle = _this$props2$shouldTh === void 0 ? false : _this$props2$shouldTh; // By default, AutosaveMonitor will wait for a pause in editing before + // autosaving. In other words, its action is "debounced". + // + // The `shouldThrottle` props allows overriding this behaviour, thus + // making the autosave action "throttled". + + if (!shouldThrottle && this.pendingSave) { + clearTimeout(this.pendingSave); + delete this.pendingSave; + } + + if (isPendingSave && !(shouldThrottle && this.pendingSave)) { this.pendingSave = setTimeout(function () { - return _this.props.autosave(); - }, autosaveInterval * 1000); + _this.props.autosave(); + + delete _this.pendingSave; + }, interval * 1000); } } }, { @@ -7285,31 +6803,37 @@ return AutosaveMonitor; }(external_this_wp_element_["Component"]); -/* harmony default export */ var autosave_monitor = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { - var _select = select('core/editor'), - isEditedPostDirty = _select.isEditedPostDirty, - isEditedPostAutosaveable = _select.isEditedPostAutosaveable, - getReferenceByDistinctEdits = _select.getReferenceByDistinctEdits, - isAutosavingPost = _select.isAutosavingPost; - - var _select$getEditorSett = select('core/editor').getEditorSettings(), - autosaveInterval = _select$getEditorSett.autosaveInterval; - +/* harmony default export */ var autosave_monitor = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, ownProps) { + var _select = select('core'), + getReferenceByDistinctEdits = _select.getReferenceByDistinctEdits; + + var _select2 = select('core/editor'), + isEditedPostDirty = _select2.isEditedPostDirty, + isEditedPostAutosaveable = _select2.isEditedPostAutosaveable, + isAutosavingPost = _select2.isAutosavingPost, + getEditorSettings = _select2.getEditorSettings; + + var _ownProps$interval = ownProps.interval, + interval = _ownProps$interval === void 0 ? getEditorSettings().autosaveInterval : _ownProps$interval; return { isDirty: isEditedPostDirty(), isAutosaveable: isEditedPostAutosaveable(), editsReference: getReferenceByDistinctEdits(), isAutosaving: isAutosavingPost(), - autosaveInterval: autosaveInterval - }; -}), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { - return { - autosave: dispatch('core/editor').autosave + interval: interval + }; +}), Object(external_this_wp_data_["withDispatch"])(function (dispatch, ownProps) { + return { + autosave: function autosave() { + var _ownProps$autosave = ownProps.autosave, + autosave = _ownProps$autosave === void 0 ? dispatch('core/editor').autosave : _ownProps$autosave; + autosave(); + } }; })])(autosave_monitor_AutosaveMonitor)); // EXTERNAL MODULE: ./node_modules/classnames/index.js -var classnames = __webpack_require__(16); +var classnames = __webpack_require__(11); var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/item.js @@ -7368,6 +6892,10 @@ +function document_outline_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function document_outline_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { document_outline_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { document_outline_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + /** * External dependencies */ @@ -7421,11 +6949,11 @@ var document_outline_computeOutlineHeadings = function computeOutlineHeadings() { var blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; - return Object(external_lodash_["flatMap"])(blocks, function () { + return Object(external_this_lodash_["flatMap"])(blocks, function () { var block = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; if (block.name === 'core/heading') { - return Object(objectSpread["a" /* default */])({}, block, { + return document_outline_objectSpread({}, block, { path: path, level: block.attributes.level, isEmpty: isEmptyHeading(block) @@ -7457,7 +6985,7 @@ var titleNode = document.querySelector('.editor-post-title__input'); var hasTitle = isTitleSupported && title && titleNode; - var countByLevel = Object(external_lodash_["countBy"])(headings, 'level'); + var countByLevel = Object(external_this_lodash_["countBy"])(headings, 'level'); var hasMultipleH1 = countByLevel[1] > 1; return Object(external_this_wp_element_["createElement"])("div", { className: "document-outline" @@ -7500,7 +7028,7 @@ return { title: getEditedPostAttribute('title'), blocks: getBlocks(), - isTitleSupported: Object(external_lodash_["get"])(postType, ['supports', 'title'], false) + isTitleSupported: Object(external_this_lodash_["get"])(postType, ['supports', 'title'], false) }; }))(document_outline_DocumentOutline)); @@ -7518,7 +7046,7 @@ function DocumentOutlineCheck(_ref) { var blocks = _ref.blocks, children = _ref.children; - var headings = Object(external_lodash_["filter"])(blocks, function (block) { + var headings = Object(external_this_lodash_["filter"])(blocks, function (block) { return block.name === 'core/heading'; }); @@ -7535,20 +7063,7 @@ }; })(DocumentOutlineCheck)); -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js -var assertThisInitialized = __webpack_require__(3); - -// EXTERNAL MODULE: external {"this":["wp","keycodes"]} -var external_this_wp_keycodes_ = __webpack_require__(18); - -// EXTERNAL MODULE: external {"this":["wp","deprecated"]} -var external_this_wp_deprecated_ = __webpack_require__(49); -var external_this_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_deprecated_); - // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/save-shortcut.js - - - /** * WordPress dependencies */ @@ -7557,62 +7072,64 @@ function SaveShortcut(_ref) { - var onSave = _ref.onSave; - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["KeyboardShortcuts"], { - bindGlobal: true, - shortcuts: Object(defineProperty["a" /* default */])({}, external_this_wp_keycodes_["rawShortcut"].primary('s'), function (event) { - event.preventDefault(); - onSave(); - }) + var resetBlocksOnSave = _ref.resetBlocksOnSave; + + var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/editor'), + resetEditorBlocks = _useDispatch.resetEditorBlocks, + savePost = _useDispatch.savePost; + + var _useSelect = Object(external_this_wp_data_["useSelect"])(function (select) { + var _select = select('core/editor'), + _isEditedPostDirty = _select.isEditedPostDirty, + _getPostEdits = _select.getPostEdits; + + return { + isEditedPostDirty: _isEditedPostDirty, + getPostEdits: _getPostEdits + }; + }, []), + isEditedPostDirty = _useSelect.isEditedPostDirty, + getPostEdits = _useSelect.getPostEdits; + + Object(external_this_wp_keyboardShortcuts_["useShortcut"])('core/editor/save', function (event) { + event.preventDefault(); // TODO: This should be handled in the `savePost` effect in + // considering `isSaveable`. See note on `isEditedPostSaveable` + // selector about dirtiness and meta-boxes. + // + // See: `isEditedPostSaveable` + + if (!isEditedPostDirty()) { + return; + } // The text editor requires that editor blocks are updated for a + // save to work correctly. Usually this happens when the textarea + // for the code editors blurs, but the shortcut can be used without + // blurring the textarea. + + + if (resetBlocksOnSave) { + var postEdits = getPostEdits(); + + if (postEdits.content && typeof postEdits.content === 'string') { + var blocks = Object(external_this_wp_blocks_["parse"])(postEdits.content); + resetEditorBlocks(blocks); + } + } + + savePost(); + }, { + bindGlobal: true }); -} -/* harmony default export */ var save_shortcut = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { - var _select = select('core/editor'), - isEditedPostDirty = _select.isEditedPostDirty; - - return { - isDirty: isEditedPostDirty() - }; -}), Object(external_this_wp_data_["withDispatch"])(function (dispatch, ownProps, _ref3) { - var select = _ref3.select; - - var _dispatch = dispatch('core/editor'), - savePost = _dispatch.savePost; - - return { - onSave: function onSave() { - // TODO: This should be handled in the `savePost` effect in - // considering `isSaveable`. See note on `isEditedPostSaveable` - // selector about dirtiness and meta-boxes. - // - // See: `isEditedPostSaveable` - var _select2 = select('core/editor'), - isEditedPostDirty = _select2.isEditedPostDirty; - - if (!isEditedPostDirty()) { - return; - } - - savePost(); - } - }; -})])(SaveShortcut)); + return null; +} + +/* harmony default export */ var save_shortcut = (SaveShortcut); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js - - - - - - - -/** - * WordPress dependencies - */ - - +/** + * WordPress dependencies + */ @@ -7623,67 +7140,33 @@ -var visual_editor_shortcuts_VisualEditorGlobalKeyboardShortcuts = -/*#__PURE__*/ -function (_Component) { - Object(inherits["a" /* default */])(VisualEditorGlobalKeyboardShortcuts, _Component); - - function VisualEditorGlobalKeyboardShortcuts() { - var _this; - - Object(classCallCheck["a" /* default */])(this, VisualEditorGlobalKeyboardShortcuts); - - _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(VisualEditorGlobalKeyboardShortcuts).apply(this, arguments)); - _this.undoOrRedo = _this.undoOrRedo.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - return _this; - } - - Object(createClass["a" /* default */])(VisualEditorGlobalKeyboardShortcuts, [{ - key: "undoOrRedo", - value: function undoOrRedo(event) { - var _this$props = this.props, - onRedo = _this$props.onRedo, - onUndo = _this$props.onUndo; - - if (event.shiftKey) { - onRedo(); - } else { - onUndo(); - } - - event.preventDefault(); - } - }, { - key: "render", - value: function render() { - var _ref; - - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockEditorKeyboardShortcuts"], null), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["KeyboardShortcuts"], { - shortcuts: (_ref = {}, Object(defineProperty["a" /* default */])(_ref, external_this_wp_keycodes_["rawShortcut"].primary('z'), this.undoOrRedo), Object(defineProperty["a" /* default */])(_ref, external_this_wp_keycodes_["rawShortcut"].primaryShift('z'), this.undoOrRedo), _ref) - }), Object(external_this_wp_element_["createElement"])(save_shortcut, null)); - } - }]); - - return VisualEditorGlobalKeyboardShortcuts; -}(external_this_wp_element_["Component"]); - -var EnhancedVisualEditorGlobalKeyboardShortcuts = Object(external_this_wp_data_["withDispatch"])(function (dispatch) { - var _dispatch = dispatch('core/editor'), - redo = _dispatch.redo, - undo = _dispatch.undo; - - return { - onRedo: redo, - onUndo: undo - }; -})(visual_editor_shortcuts_VisualEditorGlobalKeyboardShortcuts); -/* harmony default export */ var visual_editor_shortcuts = (EnhancedVisualEditorGlobalKeyboardShortcuts); +function VisualEditorGlobalKeyboardShortcuts() { + var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/editor'), + redo = _useDispatch.redo, + undo = _useDispatch.undo; + + Object(external_this_wp_keyboardShortcuts_["useShortcut"])('core/editor/undo', function (event) { + undo(); + event.preventDefault(); + }, { + bindGlobal: true + }); + Object(external_this_wp_keyboardShortcuts_["useShortcut"])('core/editor/redo', function (event) { + redo(); + event.preventDefault(); + }, { + bindGlobal: true + }); + return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockEditorKeyboardShortcuts"], null), Object(external_this_wp_element_["createElement"])(save_shortcut, null)); +} + +/* harmony default export */ var visual_editor_shortcuts = (VisualEditorGlobalKeyboardShortcuts); function EditorGlobalKeyboardShortcuts() { external_this_wp_deprecated_default()('EditorGlobalKeyboardShortcuts', { alternative: 'VisualEditorGlobalKeyboardShortcuts', plugin: 'Gutenberg' }); - return Object(external_this_wp_element_["createElement"])(EnhancedVisualEditorGlobalKeyboardShortcuts, null); + return Object(external_this_wp_element_["createElement"])(VisualEditorGlobalKeyboardShortcuts, null); } // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/text-editor-shortcuts.js @@ -7694,26 +7177,110 @@ */ function TextEditorGlobalKeyboardShortcuts() { - return Object(external_this_wp_element_["createElement"])(save_shortcut, null); -} + return Object(external_this_wp_element_["createElement"])(save_shortcut, { + resetBlocksOnSave: true + }); +} + +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/register-shortcuts.js + + +/** + * WordPress dependencies + */ + + + + + +function EditorKeyboardShortcutsRegister() { + // Registering the shortcuts + var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/keyboard-shortcuts'), + registerShortcut = _useDispatch.registerShortcut; + + Object(external_this_wp_element_["useEffect"])(function () { + registerShortcut({ + name: 'core/editor/save', + category: 'global', + description: Object(external_this_wp_i18n_["__"])('Save your changes.'), + keyCombination: { + modifier: 'primary', + character: 's' + } + }); + registerShortcut({ + name: 'core/editor/undo', + category: 'global', + description: Object(external_this_wp_i18n_["__"])('Undo your last changes.'), + keyCombination: { + modifier: 'primary', + character: 'z' + } + }); + registerShortcut({ + name: 'core/editor/redo', + category: 'global', + description: Object(external_this_wp_i18n_["__"])('Redo your last undo.'), + keyCombination: { + modifier: 'primaryShift', + character: 'z' + } + }); + }, [registerShortcut]); + return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockEditorKeyboardShortcuts"].Register, null); +} + +/* harmony default export */ var register_shortcuts = (EditorKeyboardShortcutsRegister); + +// EXTERNAL MODULE: external {"this":["wp","components"]} +var external_this_wp_components_ = __webpack_require__(3); + +// EXTERNAL MODULE: external {"this":["wp","keycodes"]} +var external_this_wp_keycodes_ = __webpack_require__(21); + +// EXTERNAL MODULE: external {"this":["wp","primitives"]} +var external_this_wp_primitives_ = __webpack_require__(6); + +// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js + + +/** + * WordPress dependencies + */ + +var redo_redo = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { + d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z" +})); +/* harmony default export */ var library_redo = (redo_redo); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/redo.js -/** - * WordPress dependencies - */ - - - - - - -function EditorHistoryRedo(_ref) { - var hasRedo = _ref.hasRedo, - redo = _ref.redo; - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { - icon: "redo", + +/** + * WordPress dependencies + */ + + + + + + + +function EditorHistoryRedo(props, ref) { + var hasRedo = Object(external_this_wp_data_["useSelect"])(function (select) { + return select('core/editor').hasEditorRedo(); + }, []); + + var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/editor'), + redo = _useDispatch.redo; + + return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, { + ref: ref, + icon: library_redo, label: Object(external_this_wp_i18n_["__"])('Redo'), shortcut: external_this_wp_keycodes_["displayShortcut"].primaryShift('z') // If there are no redo levels we don't want to actually disable this // button, because it will remove focus for keyboard users. @@ -7722,36 +7289,51 @@ "aria-disabled": !hasRedo, onClick: hasRedo ? redo : undefined, className: "editor-history__redo" - }); -} - -/* harmony default export */ var editor_history_redo = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { - return { - hasRedo: select('core/editor').hasEditorRedo() - }; -}), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { - return { - redo: dispatch('core/editor').redo - }; -})])(EditorHistoryRedo)); + })); +} + +/* harmony default export */ var editor_history_redo = (Object(external_this_wp_element_["forwardRef"])(EditorHistoryRedo)); + +// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js + + +/** + * WordPress dependencies + */ + +var undo_undo = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { + d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z" +})); +/* harmony default export */ var library_undo = (undo_undo); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/undo.js -/** - * WordPress dependencies - */ - - - - - - -function EditorHistoryUndo(_ref) { - var hasUndo = _ref.hasUndo, - undo = _ref.undo; - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { - icon: "undo", + +/** + * WordPress dependencies + */ + + + + + + + +function EditorHistoryUndo(props, ref) { + var hasUndo = Object(external_this_wp_data_["useSelect"])(function (select) { + return select('core/editor').hasEditorUndo(); + }, []); + + var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/editor'), + undo = _useDispatch.undo; + + return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, { + ref: ref, + icon: library_undo, label: Object(external_this_wp_i18n_["__"])('Undo'), shortcut: external_this_wp_keycodes_["displayShortcut"].primary('z') // If there are no undo levels we don't want to actually disable this // button, because it will remove focus for keyboard users. @@ -7760,18 +7342,10 @@ "aria-disabled": !hasUndo, onClick: hasUndo ? undo : undefined, className: "editor-history__undo" - }); -} - -/* harmony default export */ var editor_history_undo = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { - return { - hasUndo: select('core/editor').hasEditorUndo() - }; -}), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { - return { - undo: dispatch('core/editor').undo - }; -})])(EditorHistoryUndo)); + })); +} + +/* harmony default export */ var editor_history_undo = (Object(external_this_wp_element_["forwardRef"])(EditorHistoryUndo)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/template-validation-notice/index.js @@ -7794,8 +7368,8 @@ } var confirmSynchronization = function confirmSynchronization() { - // eslint-disable-next-line no-alert - if (window.confirm(Object(external_this_wp_i18n_["__"])('Resetting the template may result in loss of content, do you want to continue?'))) { + if ( // eslint-disable-next-line no-alert + window.confirm(Object(external_this_wp_i18n_["__"])('Resetting the template may result in loss of content, do you want to continue?'))) { props.synchronizeTemplate(); } }; @@ -7803,14 +7377,16 @@ return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Notice"], { className: "editor-template-validation-notice", isDismissible: false, - status: "warning" - }, Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_i18n_["__"])('The content of your post doesn’t match the template assigned to your post type.')), Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { - isDefault: true, - onClick: props.resetTemplateValidity - }, Object(external_this_wp_i18n_["__"])('Keep it as is')), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { - onClick: confirmSynchronization, - isPrimary: true - }, Object(external_this_wp_i18n_["__"])('Reset the template')))); + status: "warning", + actions: [{ + label: Object(external_this_wp_i18n_["__"])('Keep it as is'), + onClick: props.resetTemplateValidity + }, { + label: Object(external_this_wp_i18n_["__"])('Reset the template'), + onClick: confirmSynchronization, + isPrimary: true + }] + }, Object(external_this_wp_i18n_["__"])('The content of your post doesn’t match the template assigned to your post type.')); } /* harmony default export */ var template_validation_notice = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { @@ -7833,8 +7409,6 @@ // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-notices/index.js - - /** * External dependencies */ @@ -7852,19 +7426,31 @@ function EditorNotices(_ref) { - var dismissible = _ref.dismissible, - notices = _ref.notices, - props = Object(objectWithoutProperties["a" /* default */])(_ref, ["dismissible", "notices"]); - - if (dismissible !== undefined) { - notices = Object(external_lodash_["filter"])(notices, { - isDismissible: dismissible - }); - } - - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["NoticeList"], Object(esm_extends["a" /* default */])({ - notices: notices - }, props), dismissible !== false && Object(external_this_wp_element_["createElement"])(template_validation_notice, null)); + var notices = _ref.notices, + onRemove = _ref.onRemove; + var dismissibleNotices = Object(external_this_lodash_["filter"])(notices, { + isDismissible: true, + type: 'default' + }); + var nonDismissibleNotices = Object(external_this_lodash_["filter"])(notices, { + isDismissible: false, + type: 'default' + }); + var snackbarNotices = Object(external_this_lodash_["filter"])(notices, { + type: 'snackbar' + }); + return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["NoticeList"], { + notices: nonDismissibleNotices, + className: "components-editor-notices__pinned" + }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["NoticeList"], { + notices: dismissibleNotices, + className: "components-editor-notices__dismissible", + onRemove: onRemove + }, Object(external_this_wp_element_["createElement"])(template_validation_notice, null)), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SnackbarList"], { + notices: snackbarNotices, + className: "components-editor-notices__snackbar", + onRemove: onRemove + })); } /* harmony default export */ var editor_notices = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { return { @@ -7876,6 +7462,331 @@ }; })])(EditorNotices)); +// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js +var library_close = __webpack_require__(154); + +// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js +var layout = __webpack_require__(298); + +// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js + + +/** + * WordPress dependencies + */ + +var page_page = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { + d: "M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z" +})); +/* harmony default export */ var library_page = (page_page); + +// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/grid.js +var grid = __webpack_require__(302); + +// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js +var block_default = __webpack_require__(202); + +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-record-item.js + + +/** + * WordPress dependencies + */ + + + + +function EntityRecordItem(_ref) { + var record = _ref.record, + checked = _ref.checked, + onChange = _ref.onChange, + closePanel = _ref.closePanel; + var name = record.name, + kind = record.kind, + title = record.title, + key = record.key; + var parentBlockId = Object(external_this_wp_data_["useSelect"])(function (select) { + var _blocks$; + + // Get entity's blocks. + var _select$getEditedEnti = select('core').getEditedEntityRecord(kind, name, key), + _select$getEditedEnti2 = _select$getEditedEnti.blocks, + blocks = _select$getEditedEnti2 === void 0 ? [] : _select$getEditedEnti2; // Get parents of the entity's first block. + + + var parents = select('core/block-editor').getBlockParents((_blocks$ = blocks[0]) === null || _blocks$ === void 0 ? void 0 : _blocks$.clientId); // Return closest parent block's clientId. + + return parents[parents.length - 1]; + }, []); + var isSelected = Object(external_this_wp_data_["useSelect"])(function (select) { + var selectedBlockId = select('core/block-editor').getSelectedBlockClientId(); + return selectedBlockId === parentBlockId; + }, [parentBlockId]); + var isSelectedText = isSelected ? Object(external_this_wp_i18n_["__"])('Selected') : Object(external_this_wp_i18n_["__"])('Select'); + + var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/block-editor'), + selectBlock = _useDispatch.selectBlock; + + var selectParentBlock = Object(external_this_wp_element_["useCallback"])(function () { + return selectBlock(parentBlockId); + }, [parentBlockId]); + var selectAndDismiss = Object(external_this_wp_element_["useCallback"])(function () { + selectBlock(parentBlockId); + closePanel(); + }, [parentBlockId]); + return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelRow"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], { + label: Object(external_this_wp_element_["createElement"])("strong", null, title || Object(external_this_wp_i18n_["__"])('Untitled')), + checked: checked, + onChange: onChange + }), parentBlockId ? Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + onClick: selectParentBlock, + className: "entities-saved-states__find-entity", + disabled: isSelected + }, isSelectedText), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + onClick: selectAndDismiss, + className: "entities-saved-states__find-entity-small", + disabled: isSelected + }, isSelectedText)) : null); +} + +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-type-list.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + +var ENTITY_NAME_ICONS = { + site: layout["a" /* default */], + page: library_page, + post: grid["a" /* default */], + wp_template: grid["a" /* default */] +}; +function EntityTypeList(_ref) { + var list = _ref.list, + unselectedEntities = _ref.unselectedEntities, + setUnselectedEntities = _ref.setUnselectedEntities, + closePanel = _ref.closePanel; + var firstRecord = list[0]; + var entity = Object(external_this_wp_data_["useSelect"])(function (select) { + return select('core').getEntity(firstRecord.kind, firstRecord.name); + }, [firstRecord.kind, firstRecord.name]); // Set icon based on type of entity. + + var name = firstRecord.name; + var icon = ENTITY_NAME_ICONS[name] || block_default["a" /* default */]; + return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { + title: entity.label, + initialOpen: true, + icon: icon + }, list.map(function (record) { + return Object(external_this_wp_element_["createElement"])(EntityRecordItem, { + key: record.key || 'site', + record: record, + checked: !Object(external_this_lodash_["some"])(unselectedEntities, function (elt) { + return elt.kind === record.kind && elt.name === record.name && elt.key === record.key; + }), + onChange: function onChange(value) { + return setUnselectedEntities(record, value); + }, + closePanel: closePanel + }); + })); +} + +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/index.js + + + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + +var ENTITY_NAMES = { + wp_template_part: function wp_template_part(number) { + return Object(external_this_wp_i18n_["_n"])('template part', 'template parts', number); + }, + wp_template: function wp_template(number) { + return Object(external_this_wp_i18n_["_n"])('template', 'templates', number); + }, + post: function post(number) { + return Object(external_this_wp_i18n_["_n"])('post', 'posts', number); + }, + page: function page(number) { + return Object(external_this_wp_i18n_["_n"])('page', 'pages', number); + }, + site: function site(number) { + return Object(external_this_wp_i18n_["_n"])('site', 'sites', number); + } +}; +var PLACEHOLDER_PHRASES = { + // 0 is a back up, but should never be observed. + 0: Object(external_this_wp_i18n_["__"])('There are no changes.'), + + /* translators: placeholders represent pre-translated singular/plural entity names (page, post, template, site, etc.) */ + 1: Object(external_this_wp_i18n_["__"])('Changes have been made to your %s.'), + + /* translators: placeholders represent pre-translated singular/plural entity names (page, post, template, site, etc.) */ + 2: Object(external_this_wp_i18n_["__"])('Changes have been made to your %1$s and %2$s.'), + + /* translators: placeholders represent pre-translated singular/plural entity names (page, post, template, site, etc.) */ + 3: Object(external_this_wp_i18n_["__"])('Changes have been made to your %1$s, %2$s, and %3$s.'), + + /* translators: placeholders represent pre-translated singular/plural entity names (page, post, template, site, etc.) */ + 4: Object(external_this_wp_i18n_["__"])('Changes have been made to your %1$s, %2$s, %3$s, and %4$s.'), + + /* translators: placeholders represent pre-translated singular/plural entity names (page, post, template, site, etc.) */ + 5: Object(external_this_wp_i18n_["__"])('Changes have been made to your %1$s, %2$s, %3$s, %4$s, and %5$s.') +}; +function EntitiesSavedStates(_ref) { + var isOpen = _ref.isOpen, + close = _ref.close; + + var _useSelect = Object(external_this_wp_data_["useSelect"])(function (select) { + return { + dirtyEntityRecords: select('core').__experimentalGetDirtyEntityRecords() + }; + }, []), + dirtyEntityRecords = _useSelect.dirtyEntityRecords; + + var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core'), + saveEditedEntityRecord = _useDispatch.saveEditedEntityRecord; // To group entities by type. + + + var partitionedSavables = Object.values(Object(external_this_lodash_["groupBy"])(dirtyEntityRecords, 'name')); // Get labels for text-prompt phrase. + + var entityNamesForPrompt = []; + partitionedSavables.forEach(function (list) { + if (ENTITY_NAMES[list[0].name]) { + entityNamesForPrompt.push(ENTITY_NAMES[list[0].name](list.length)); + } + }); // Get text-prompt phrase based on number of entity types changed. + + var placeholderPhrase = PLACEHOLDER_PHRASES[entityNamesForPrompt.length] || // Fallback for edge case that should not be observed (more than 5 entity types edited). + Object(external_this_wp_i18n_["__"])('Changes have been made to multiple entity types.'); // eslint-disable-next-line @wordpress/valid-sprintf + + + var promptPhrase = external_this_wp_i18n_["sprintf"].apply(void 0, [placeholderPhrase].concat(entityNamesForPrompt)); // Unchecked entities to be ignored by save function. + + var _useState = Object(external_this_wp_element_["useState"])([]), + _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), + unselectedEntities = _useState2[0], + _setUnselectedEntities = _useState2[1]; + + var setUnselectedEntities = function setUnselectedEntities(_ref2, checked) { + var kind = _ref2.kind, + name = _ref2.name, + key = _ref2.key; + + if (checked) { + _setUnselectedEntities(unselectedEntities.filter(function (elt) { + return elt.kind !== kind || elt.name !== name || elt.key !== key; + })); + } else { + _setUnselectedEntities([].concat(Object(toConsumableArray["a" /* default */])(unselectedEntities), [{ + kind: kind, + name: name, + key: key + }])); + } + }; + + var saveCheckedEntities = function saveCheckedEntities() { + var entitiesToSave = dirtyEntityRecords.filter(function (_ref3) { + var kind = _ref3.kind, + name = _ref3.name, + key = _ref3.key; + return !Object(external_this_lodash_["some"])(unselectedEntities, function (elt) { + return elt.kind === kind && elt.name === name && elt.key === key; + }); + }); + close(entitiesToSave); + entitiesToSave.forEach(function (_ref4) { + var kind = _ref4.kind, + name = _ref4.name, + key = _ref4.key; + saveEditedEntityRecord(kind, name, key); + }); + }; + + var _useState3 = Object(external_this_wp_element_["useState"])(false), + _useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2), + isReviewing = _useState4[0], + setIsReviewing = _useState4[1]; + + var toggleIsReviewing = function toggleIsReviewing() { + return setIsReviewing(function (value) { + return !value; + }); + }; // Explicitly define this with no argument passed. Using `close` on + // its own will use the event object in place of the expected saved entities. + + + var dismissPanel = Object(external_this_wp_element_["useCallback"])(function () { + return close(); + }, [close]); + return isOpen ? Object(external_this_wp_element_["createElement"])("div", { + className: "entities-saved-states__panel" + }, Object(external_this_wp_element_["createElement"])("div", { + className: "entities-saved-states__panel-header" + }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + isPrimary: true, + disabled: dirtyEntityRecords.length - unselectedEntities.length === 0, + onClick: saveCheckedEntities, + className: "editor-entities-saved-states__save-button" + }, Object(external_this_wp_i18n_["__"])('Save')), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + onClick: dismissPanel, + icon: library_close["a" /* default */], + label: Object(external_this_wp_i18n_["__"])('Close panel') + })), Object(external_this_wp_element_["createElement"])("div", { + className: "entities-saved-states__text-prompt" + }, Object(external_this_wp_element_["createElement"])("strong", null, Object(external_this_wp_i18n_["__"])('Are you ready to save?')), Object(external_this_wp_element_["createElement"])("p", null, promptPhrase), Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + onClick: toggleIsReviewing, + isLink: true, + className: "entities-saved-states__review-changes-button" + }, isReviewing ? Object(external_this_wp_i18n_["__"])('Hide changes.') : Object(external_this_wp_i18n_["__"])('Review changes.')))), isReviewing && partitionedSavables.map(function (list) { + return Object(external_this_wp_element_["createElement"])(EntityTypeList, { + key: list[0].name, + list: list, + closePanel: dismissPanel, + unselectedEntities: unselectedEntities, + setUnselectedEntities: setUnselectedEntities + }); + })) : null; +} + +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +var assertThisInitialized = __webpack_require__(12); + // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/error-boundary/index.js @@ -7885,28 +7796,32 @@ -/** - * WordPress dependencies - */ - - - - - - -var error_boundary_ErrorBoundary = -/*#__PURE__*/ -function (_Component) { +function error_boundary_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (error_boundary_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } + +function error_boundary_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +/** + * WordPress dependencies + */ + + + + + + +var error_boundary_ErrorBoundary = /*#__PURE__*/function (_Component) { Object(inherits["a" /* default */])(ErrorBoundary, _Component); + var _super = error_boundary_createSuper(ErrorBoundary); + function ErrorBoundary() { var _this; Object(classCallCheck["a" /* default */])(this, ErrorBoundary); - _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(ErrorBoundary).apply(this, arguments)); - _this.reboot = _this.reboot.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.getContent = _this.getContent.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); + _this = _super.apply(this, arguments); + _this.reboot = _this.reboot.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.getContent = _this.getContent.bind(Object(assertThisInitialized["a" /* default */])(_this)); _this.state = { error: null }; @@ -7952,15 +7867,15 @@ actions: [Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { key: "recovery", onClick: this.reboot, - isLarge: true + isSecondary: true }, Object(external_this_wp_i18n_["__"])('Attempt Recovery')), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ClipboardButton"], { key: "copy-post", text: this.getContent, - isLarge: true + isSecondary: true }, Object(external_this_wp_i18n_["__"])('Copy Post Text')), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ClipboardButton"], { key: "copy-error", text: error.stack, - isLarge: true + isSecondary: true }, Object(external_this_wp_i18n_["__"])('Copy Error'))] }, Object(external_this_wp_i18n_["__"])('The editor has encountered an unexpected error.')); } @@ -7971,6 +7886,184 @@ /* harmony default export */ var error_boundary = (error_boundary_ErrorBoundary); +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/local-autosave-monitor/index.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + +var requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame; +/** + * Function which returns true if the current environment supports browser + * sessionStorage, or false otherwise. The result of this function is cached and + * reused in subsequent invocations. + */ + +var hasSessionStorageSupport = Object(external_this_lodash_["once"])(function () { + try { + // Private Browsing in Safari 10 and earlier will throw an error when + // attempting to set into sessionStorage. The test here is intentional in + // causing a thrown error as condition bailing from local autosave. + window.sessionStorage.setItem('__wpEditorTestSessionStorage', ''); + window.sessionStorage.removeItem('__wpEditorTestSessionStorage'); + return true; + } catch (error) { + return false; + } +}); +/** + * Custom hook which manages the creation of a notice prompting the user to + * restore a local autosave, if one exists. + */ + +function useAutosaveNotice() { + var _useSelect = Object(external_this_wp_data_["useSelect"])(function (select) { + return { + postId: select('core/editor').getCurrentPostId(), + getEditedPostAttribute: select('core/editor').getEditedPostAttribute, + hasRemoteAutosave: !!select('core/editor').getEditorSettings().autosave + }; + }, []), + postId = _useSelect.postId, + getEditedPostAttribute = _useSelect.getEditedPostAttribute, + hasRemoteAutosave = _useSelect.hasRemoteAutosave; + + var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/notices'), + createWarningNotice = _useDispatch.createWarningNotice, + removeNotice = _useDispatch.removeNotice; + + var _useDispatch2 = Object(external_this_wp_data_["useDispatch"])('core/editor'), + editPost = _useDispatch2.editPost, + resetEditorBlocks = _useDispatch2.resetEditorBlocks; + + Object(external_this_wp_element_["useEffect"])(function () { + var localAutosave = localAutosaveGet(postId); + + if (!localAutosave) { + return; + } + + try { + localAutosave = JSON.parse(localAutosave); + } catch (error) { + // Not usable if it can't be parsed. + return; + } + + var _localAutosave = localAutosave, + title = _localAutosave.post_title, + content = _localAutosave.content, + excerpt = _localAutosave.excerpt; + var edits = { + title: title, + content: content, + excerpt: excerpt + }; + { + // Only display a notice if there is a difference between what has been + // saved and that which is stored in sessionStorage. + var hasDifference = Object.keys(edits).some(function (key) { + return edits[key] !== getEditedPostAttribute(key); + }); + + if (!hasDifference) { + // If there is no difference, it can be safely ejected from storage. + localAutosaveClear(postId); + return; + } + } + + if (hasRemoteAutosave) { + return; + } + + var noticeId = Object(external_this_lodash_["uniqueId"])('wpEditorAutosaveRestore'); + createWarningNotice(Object(external_this_wp_i18n_["__"])('The backup of this post in your browser is different from the version below.'), { + id: noticeId, + actions: [{ + label: Object(external_this_wp_i18n_["__"])('Restore the backup'), + onClick: function onClick() { + editPost(Object(external_this_lodash_["omit"])(edits, ['content'])); + resetEditorBlocks(Object(external_this_wp_blocks_["parse"])(edits.content)); + removeNotice(noticeId); + } + }] + }); + }, [postId]); +} +/** + * Custom hook which ejects a local autosave after a successful save occurs. + */ + + +function useAutosavePurge() { + var _useSelect2 = Object(external_this_wp_data_["useSelect"])(function (select) { + return { + postId: select('core/editor').getCurrentPostId(), + isDirty: select('core/editor').isEditedPostDirty(), + isAutosaving: select('core/editor').isAutosavingPost(), + didError: select('core/editor').didPostSaveRequestFail() + }; + }, []), + postId = _useSelect2.postId, + isDirty = _useSelect2.isDirty, + isAutosaving = _useSelect2.isAutosaving, + didError = _useSelect2.didError; + + var lastIsDirty = Object(external_this_wp_element_["useRef"])(isDirty); + var lastIsAutosaving = Object(external_this_wp_element_["useRef"])(isAutosaving); + Object(external_this_wp_element_["useEffect"])(function () { + if (!didError && (lastIsAutosaving.current && !isAutosaving || lastIsDirty.current && !isDirty)) { + localAutosaveClear(postId); + } + + lastIsDirty.current = isDirty; + lastIsAutosaving.current = isAutosaving; + }, [isDirty, isAutosaving, didError]); +} + +function LocalAutosaveMonitor() { + var _useDispatch3 = Object(external_this_wp_data_["useDispatch"])('core/editor'), + __experimentalLocalAutosave = _useDispatch3.__experimentalLocalAutosave; + + var autosave = Object(external_this_wp_element_["useCallback"])(function () { + requestIdleCallback(__experimentalLocalAutosave); + }, []); + useAutosaveNotice(); + useAutosavePurge(); + + var _useSelect3 = Object(external_this_wp_data_["useSelect"])(function (select) { + return { + localAutosaveInterval: select('core/editor').getEditorSettings().__experimentalLocalAutosaveInterval + }; + }, []), + localAutosaveInterval = _useSelect3.localAutosaveInterval; + + return Object(external_this_wp_element_["createElement"])(autosave_monitor, { + interval: localAutosaveInterval, + autosave: autosave, + shouldThrottle: true + }); +} + +/* harmony default export */ var local_autosave_monitor = (Object(external_this_wp_compose_["ifCondition"])(hasSessionStorageSupport)(LocalAutosaveMonitor)); + // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/check.js /** * External dependencies @@ -7985,9 +8078,9 @@ var availableTemplates = _ref.availableTemplates, postType = _ref.postType, children = _ref.children; - var supportsPageAttributes = Object(external_lodash_["get"])(postType, ['supports', 'page-attributes'], false); // Only render fields if post type supports page attributes or available templates exist. - - if (!supportsPageAttributes && Object(external_lodash_["isEmpty"])(availableTemplates)) { + var supportsPageAttributes = Object(external_this_lodash_["get"])(postType, ['supports', 'page-attributes'], false); // Only render fields if post type supports page attributes or available templates exist. + + if (!supportsPageAttributes && Object(external_this_lodash_["isEmpty"])(availableTemplates)) { return null; } @@ -8024,13 +8117,14 @@ * A component which renders its own children only if the current editor post * type supports one of the given `supportKeys` prop. * - * @param {?Object} props.postType Current post type. - * @param {WPElement} props.children Children to be rendered if post - * type supports. - * @param {(string|string[])} props.supportKeys String or string array of keys - * to test. - * - * @return {WPElement} Rendered element. + * @param {Object} props Props. + * @param {string} [props.postType] Current post type. + * @param {WPElement} props.children Children to be rendered if post + * type supports. + * @param {(string|string[])} props.supportKeys String or string array of keys + * to test. + * + * @return {WPComponent} The component to be rendered. */ function PostTypeSupportCheck(_ref) { @@ -8040,7 +8134,7 @@ var isSupported = true; if (postType) { - isSupported = Object(external_lodash_["some"])(Object(external_lodash_["castArray"])(supportKeys), function (key) { + isSupported = Object(external_this_lodash_["some"])(Object(external_this_lodash_["castArray"])(supportKeys), function (key) { return !!postType.supports[key]; }); } @@ -8098,7 +8192,7 @@ }); var newOrder = Number(value); - if (Number.isInteger(newOrder) && Object(external_lodash_["invoke"])(value, ['trim']) !== '') { + if (Number.isInteger(newOrder) && Object(external_this_lodash_["invoke"])(value, ['trim']) !== '') { onUpdateOrder(Number(value)); } }; @@ -8142,6 +8236,10 @@ // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/terms.js +function terms_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function terms_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { terms_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { terms_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + /** * External dependencies */ @@ -8156,12 +8254,12 @@ function buildTermsTree(flatTerms) { var flatTermsWithParentAndChildren = flatTerms.map(function (term) { - return Object(objectSpread["a" /* default */])({ + return terms_objectSpread({ children: [], parent: null }, term); }); - var termsByParent = Object(external_lodash_["groupBy"])(flatTermsWithParentAndChildren, 'parent'); + var termsByParent = Object(external_this_lodash_["groupBy"])(flatTermsWithParentAndChildren, 'parent'); if (termsByParent.null && termsByParent.null.length) { return flatTermsWithParentAndChildren; @@ -8170,7 +8268,7 @@ var fillWithChildren = function fillWithChildren(terms) { return terms.map(function (term) { var children = termsByParent[term.id]; - return Object(objectSpread["a" /* default */])({}, term, { + return terms_objectSpread({}, term, { children: children && children.length ? fillWithChildren(children) : [] }); }); @@ -8204,8 +8302,8 @@ postType = _ref.postType, items = _ref.items, onUpdateParent = _ref.onUpdateParent; - var isHierarchical = Object(external_lodash_["get"])(postType, ['hierarchical'], false); - var parentPageLabel = Object(external_lodash_["get"])(postType, ['labels', 'parent_item_colon']); + var isHierarchical = Object(external_this_lodash_["get"])(postType, ['hierarchical'], false); + var parentPageLabel = Object(external_this_lodash_["get"])(postType, ['labels', 'parent_item_colon']); var pageItems = items || []; if (!isHierarchical || !parentPageLabel || !pageItems.length) { @@ -8216,7 +8314,7 @@ return { id: item.id, parent: item.parent, - name: item.title.raw ? item.title.raw : "#".concat(item.id, " (").concat(Object(external_this_wp_i18n_["__"])('no title'), ")") + name: item.title && item.title.raw ? item.title.raw : "#".concat(item.id, " (").concat(Object(external_this_wp_i18n_["__"])('no title'), ")") }; })); return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TreeSelect"], { @@ -8240,7 +8338,7 @@ var postTypeSlug = getEditedPostAttribute('type'); var postType = getPostType(postTypeSlug); var postId = getCurrentPostId(); - var isHierarchical = Object(external_lodash_["get"])(postType, ['hierarchical'], false); + var isHierarchical = Object(external_this_lodash_["get"])(postType, ['hierarchical'], false); var query = { per_page: -1, exclude: postId, @@ -8288,7 +8386,7 @@ selectedTemplate = _ref.selectedTemplate, onUpdate = _ref.onUpdate; - if (Object(external_lodash_["isEmpty"])(availableTemplates)) { + if (Object(external_this_lodash_["isEmpty"])(availableTemplates)) { return null; } @@ -8297,7 +8395,7 @@ value: selectedTemplate, onChange: onUpdate, className: "editor-page-attributes__template", - options: Object(external_lodash_["map"])(availableTemplates, function (templateName, templateSlug) { + options: Object(external_this_lodash_["map"])(availableTemplates, function (templateName, templateSlug) { return { value: templateSlug, label: templateName @@ -8327,6 +8425,9 @@ }; }))(PageTemplate)); +// EXTERNAL MODULE: external {"this":["wp","htmlEntities"]} +var external_this_wp_htmlEntities_ = __webpack_require__(75); + // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/check.js @@ -8361,7 +8462,7 @@ /* harmony default export */ var post_author_check = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { var post = select('core/editor').getCurrentPost(); return { - hasAssignAuthorAction: Object(external_lodash_["get"])(post, ['_links', 'wp:action-assign-author'], false), + hasAssignAuthorAction: Object(external_this_lodash_["get"])(post, ['_links', 'wp:action-assign-author'], false), postType: select('core/editor').getCurrentPostType(), authors: select('core').getAuthors() }; @@ -8376,9 +8477,14 @@ -/** - * WordPress dependencies - */ +function post_author_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (post_author_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } + +function post_author_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +/** + * WordPress dependencies + */ + @@ -8388,18 +8494,18 @@ */ -var post_author_PostAuthor = -/*#__PURE__*/ -function (_Component) { +var post_author_PostAuthor = /*#__PURE__*/function (_Component) { Object(inherits["a" /* default */])(PostAuthor, _Component); + var _super = post_author_createSuper(PostAuthor); + function PostAuthor() { var _this; Object(classCallCheck["a" /* default */])(this, PostAuthor); - _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostAuthor).apply(this, arguments)); - _this.setAuthorId = _this.setAuthorId.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); + _this = _super.apply(this, arguments); + _this.setAuthorId = _this.setAuthorId.bind(Object(assertThisInitialized["a" /* default */])(_this)); return _this; } @@ -8432,7 +8538,7 @@ return Object(external_this_wp_element_["createElement"])("option", { key: author.id, value: author.id - }, author.name); + }, Object(external_this_wp_htmlEntities_["decodeEntities"])(author.name)); }))); /* eslint-enable jsx-a11y/no-onchange */ } @@ -8479,7 +8585,7 @@ }; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], { - label: Object(external_this_wp_i18n_["__"])('Allow Comments'), + label: Object(external_this_wp_i18n_["__"])('Allow comments'), checked: commentStatus === 'open', onChange: onToggleComments }); @@ -8519,7 +8625,7 @@ }, value: excerpt }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ExternalLink"], { - href: Object(external_this_wp_i18n_["__"])('https://codex.wordpress.org/Excerpt') + href: Object(external_this_wp_i18n_["__"])('https://wordpress.org/support/article/excerpt/') }, Object(external_this_wp_i18n_["__"])('Learn more about manual excerpts'))); } @@ -8569,14 +8675,14 @@ children = _ref.children, postType = _ref.postType, supportKeys = _ref.supportKeys; - var isSupported = Object(external_lodash_["some"])(Object(external_lodash_["castArray"])(supportKeys), function (key) { - var supported = Object(external_lodash_["get"])(themeSupports, [key], false); // 'post-thumbnails' can be boolean or an array of post types. + var isSupported = Object(external_this_lodash_["some"])(Object(external_this_lodash_["castArray"])(supportKeys), function (key) { + var supported = Object(external_this_lodash_["get"])(themeSupports, [key], false); // 'post-thumbnails' can be boolean or an array of post types. // In the latter case, we need to verify `postType` exists // within `supported`. If `postType` isn't passed, then the check // should fail. - if ('post-thumbnails' === key && Object(external_lodash_["isArray"])(supported)) { - return Object(external_lodash_["includes"])(supported, postType); + if ('post-thumbnails' === key && Object(external_this_lodash_["isArray"])(supported)) { + return Object(external_this_lodash_["includes"])(supported, postType); } return supported; @@ -8624,6 +8730,7 @@ // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/index.js + /** * External dependencies */ @@ -8645,7 +8752,7 @@ var ALLOWED_MEDIA_TYPES = ['image']; // Used when labels from post type were not yet loaded or when they are not present. -var DEFAULT_FEATURE_IMAGE_LABEL = Object(external_this_wp_i18n_["__"])('Featured Image'); +var DEFAULT_FEATURE_IMAGE_LABEL = Object(external_this_wp_i18n_["__"])('Featured image'); var DEFAULT_SET_FEATURE_IMAGE_LABEL = Object(external_this_wp_i18n_["__"])('Set featured image'); @@ -8655,63 +8762,83 @@ var currentPostId = _ref.currentPostId, featuredImageId = _ref.featuredImageId, onUpdateImage = _ref.onUpdateImage, + onDropImage = _ref.onDropImage, onRemoveImage = _ref.onRemoveImage, media = _ref.media, - postType = _ref.postType; - var postLabel = Object(external_lodash_["get"])(postType, ['labels'], {}); + postType = _ref.postType, + noticeUI = _ref.noticeUI; + var postLabel = Object(external_this_lodash_["get"])(postType, ['labels'], {}); var instructions = Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_i18n_["__"])('To edit the featured image, you need permission to upload media.')); var mediaWidth, mediaHeight, mediaSourceUrl; if (media) { var mediaSize = Object(external_this_wp_hooks_["applyFilters"])('editor.PostFeaturedImage.imageSize', 'post-thumbnail', media.id, currentPostId); - if (Object(external_lodash_["has"])(media, ['media_details', 'sizes', mediaSize])) { + if (Object(external_this_lodash_["has"])(media, ['media_details', 'sizes', mediaSize])) { + // use mediaSize when available mediaWidth = media.media_details.sizes[mediaSize].width; mediaHeight = media.media_details.sizes[mediaSize].height; mediaSourceUrl = media.media_details.sizes[mediaSize].source_url; } else { - mediaWidth = media.media_details.width; - mediaHeight = media.media_details.height; - mediaSourceUrl = media.source_url; - } - } - - return Object(external_this_wp_element_["createElement"])(post_featured_image_check, null, Object(external_this_wp_element_["createElement"])("div", { + // get fallbackMediaSize if mediaSize is not available + var fallbackMediaSize = Object(external_this_wp_hooks_["applyFilters"])('editor.PostFeaturedImage.imageSize', 'thumbnail', media.id, currentPostId); + + if (Object(external_this_lodash_["has"])(media, ['media_details', 'sizes', fallbackMediaSize])) { + // use fallbackMediaSize when mediaSize is not available + mediaWidth = media.media_details.sizes[fallbackMediaSize].width; + mediaHeight = media.media_details.sizes[fallbackMediaSize].height; + mediaSourceUrl = media.media_details.sizes[fallbackMediaSize].source_url; + } else { + // use full image size when mediaFallbackSize and mediaSize are not available + mediaWidth = media.media_details.width; + mediaHeight = media.media_details.height; + mediaSourceUrl = media.source_url; + } + } + } + + return Object(external_this_wp_element_["createElement"])(post_featured_image_check, null, noticeUI, Object(external_this_wp_element_["createElement"])("div", { className: "editor-post-featured-image" }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUploadCheck"], { fallback: instructions }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUpload"], { title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, onSelect: onUpdateImage, + unstableFeaturedImageFlow: true, allowedTypes: ALLOWED_MEDIA_TYPES, modalClass: !featuredImageId ? 'editor-post-featured-image__media-modal' : 'editor-post-featured-image__media-modal', render: function render(_ref2) { var open = _ref2.open; - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + return Object(external_this_wp_element_["createElement"])("div", { + className: "editor-post-featured-image__container" + }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview', onClick: open, "aria-label": !featuredImageId ? null : Object(external_this_wp_i18n_["__"])('Edit or update the image') }, !!featuredImageId && media && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ResponsiveWrapper"], { naturalWidth: mediaWidth, - naturalHeight: mediaHeight + naturalHeight: mediaHeight, + isInline: true }, Object(external_this_wp_element_["createElement"])("img", { src: mediaSourceUrl, alt: "" - })), !!featuredImageId && !media && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Spinner"], null), !featuredImageId && (postLabel.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)); + })), !!featuredImageId && !media && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Spinner"], null), !featuredImageId && (postLabel.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["DropZone"], { + onFilesDrop: onDropImage + })); }, value: featuredImageId })), !!featuredImageId && media && !media.isLoading && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUploadCheck"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUpload"], { title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, onSelect: onUpdateImage, + unstableFeaturedImageFlow: true, allowedTypes: ALLOWED_MEDIA_TYPES, modalClass: "editor-post-featured-image__media-modal", render: function render(_ref3) { var open = _ref3.open; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { onClick: open, - isDefault: true, - isLarge: true - }, Object(external_this_wp_i18n_["__"])('Replace image')); + isSecondary: true + }, Object(external_this_wp_i18n_["__"])('Replace Image')); } })), !!featuredImageId && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUploadCheck"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { onClick: onRemoveImage, @@ -8737,7 +8864,10 @@ featuredImageId: featuredImageId }; }); -var post_featured_image_applyWithDispatch = Object(external_this_wp_data_["withDispatch"])(function (dispatch) { +var post_featured_image_applyWithDispatch = Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref4, _ref5) { + var noticeOperations = _ref4.noticeOperations; + var select = _ref5.select; + var _dispatch = dispatch('core/editor'), editPost = _dispatch.editPost; @@ -8747,6 +8877,24 @@ featured_media: image.id }); }, + onDropImage: function onDropImage(filesList) { + select('core/block-editor').getSettings().mediaUpload({ + allowedTypes: ['image'], + filesList: filesList, + onFileChange: function onFileChange(_ref6) { + var _ref7 = Object(slicedToArray["a" /* default */])(_ref6, 1), + image = _ref7[0]; + + editPost({ + featured_media: image.id + }); + }, + onError: function onError(message) { + noticeOperations.removeAllNotices(); + noticeOperations.createErrorNotice(message); + } + }); + }, onRemoveImage: function onRemoveImage() { editPost({ featured_media: 0 @@ -8754,7 +8902,7 @@ } }; }); -/* harmony default export */ var post_featured_image = (Object(external_this_wp_compose_["compose"])(post_featured_image_applyWithSelect, post_featured_image_applyWithDispatch, Object(external_this_wp_components_["withFilters"])('editor.PostFeaturedImage'))(PostFeaturedImage)); +/* harmony default export */ var post_featured_image = (Object(external_this_wp_compose_["compose"])(external_this_wp_components_["withNotices"], post_featured_image_applyWithSelect, post_featured_image_applyWithDispatch, Object(external_this_wp_components_["withFilters"])('editor.PostFeaturedImage'))(PostFeaturedImage)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/check.js @@ -8848,14 +8996,12 @@ instanceId = _ref.instanceId; var postFormatSelectorId = 'post-format-selector-' + instanceId; var formats = POST_FORMATS.filter(function (format) { - return Object(external_lodash_["includes"])(supportedFormats, format.id); + return Object(external_this_lodash_["includes"])(supportedFormats, format.id); }); - var suggestion = Object(external_lodash_["find"])(formats, function (format) { + var suggestion = Object(external_this_lodash_["find"])(formats, function (format) { return format.id === suggestedFormat; }); // Disable reason: We need to change the value immiediately to show/hide the suggestion if needed - /* eslint-disable jsx-a11y/no-onchange */ - return Object(external_this_wp_element_["createElement"])(post_format_check, null, Object(external_this_wp_element_["createElement"])("div", { className: "editor-post-format" }, Object(external_this_wp_element_["createElement"])("div", { @@ -8882,7 +9028,6 @@ return onUpdatePostFormat(suggestion.id); } }, suggestion.caption)))); - /* eslint-enable jsx-a11y/no-onchange */ } /* harmony default export */ var post_format = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { @@ -8894,7 +9039,7 @@ var themeSupports = select('core').getThemeSupports(); // Ensure current format is always in the set. // The current format may not be a format supported by the theme. - var supportedFormats = Object(external_lodash_["union"])([postFormat], Object(external_lodash_["get"])(themeSupports, ['formats'], [])); + var supportedFormats = Object(external_this_lodash_["union"])([postFormat], Object(external_this_lodash_["get"])(themeSupports, ['formats'], [])); return { postFormat: postFormat, supportedFormats: supportedFormats, @@ -8910,6 +9055,21 @@ }; }), external_this_wp_compose_["withInstanceId"]])(PostFormat)); +// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/backup.js + + +/** + * WordPress dependencies + */ + +var backup = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "-2 -2 24 24" +}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { + d: "M13.65 2.88c3.93 2.01 5.48 6.84 3.47 10.77s-6.83 5.48-10.77 3.47c-1.87-.96-3.2-2.56-3.86-4.4l1.64-1.03c.45 1.57 1.52 2.95 3.08 3.76 3.01 1.54 6.69.35 8.23-2.66 1.55-3.01.36-6.69-2.65-8.24C9.78 3.01 6.1 4.2 4.56 7.21l1.88.97-4.95 3.08-.39-5.82 1.78.91C4.9 2.4 9.75.89 13.65 2.88zm-4.36 7.83C9.11 10.53 9 10.28 9 10c0-.07.03-.12.04-.19h-.01L10 5l.97 4.81L14 13l-4.5-2.12.02-.02c-.08-.04-.16-.09-.23-.15z" +})); +/* harmony default export */ var library_backup = (backup); + // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/check.js @@ -8946,51 +9106,6 @@ }; })(PostLastRevisionCheck)); -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/url.js -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - -/** - * Returns the URL of a WPAdmin Page. - * - * TODO: This should be moved to a module less specific to the editor. - * - * @param {string} page Page to navigate to. - * @param {Object} query Query Args. - * - * @return {string} WPAdmin URL. - */ - -function getWPAdminURL(page, query) { - return Object(external_this_wp_url_["addQueryArgs"])(page, query); -} -/** - * Performs some basic cleanup of a string for use as a post slug - * - * This replicates some of what santize_title() does in WordPress core, but - * is only designed to approximate what the slug will be. - * - * Converts whitespace, periods, forward slashes and underscores to hyphens. - * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin - * letters. Removes combining diacritical marks. Converts remaining string - * to lowercase. It does not touch octets, HTML entities, or other encoded - * characters. - * - * @param {string} string Title or slug to be processed - * - * @return {string} Processed string - */ - -function cleanForSlug(string) { - return Object(external_lodash_["toLower"])(Object(external_lodash_["deburr"])(Object(external_lodash_["trim"])(string.replace(/[\s\./_]+/g, '-'), '-'))); -} - // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/index.js @@ -9000,6 +9115,7 @@ + /** * Internal dependencies */ @@ -9010,14 +9126,16 @@ function LastRevision(_ref) { var lastRevisionId = _ref.lastRevisionId, revisionsCount = _ref.revisionsCount; - return Object(external_this_wp_element_["createElement"])(post_last_revision_check, null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { + return Object(external_this_wp_element_["createElement"])(post_last_revision_check, null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { href: getWPAdminURL('revision.php', { revision: lastRevisionId, gutenberg: true }), className: "editor-post-last-revision__title", - icon: "backup" - }, Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_n"])('%d Revision', '%d Revisions', revisionsCount), revisionsCount))); + icon: library_backup + }, Object(external_this_wp_i18n_["sprintf"])( + /* translators: %d: number of revisions */ + Object(external_this_wp_i18n_["_n"])('%d Revision', '%d Revisions', revisionsCount), revisionsCount))); } /* harmony default export */ var post_last_revision = (Object(external_this_wp_data_["withSelect"])(function (select) { @@ -9040,14 +9158,18 @@ +function post_preview_button_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (post_preview_button_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } + +function post_preview_button_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + /** * External dependencies */ -/** - * WordPress dependencies - */ - + +/** + * WordPress dependencies + */ @@ -9075,7 +9197,7 @@ /** * Filters the interstitial message shown when generating previews. * - * @param {String} markup The preview interstitial markup. + * @param {string} markup The preview interstitial markup. */ markup = Object(external_this_wp_hooks_["applyFilters"])('editor.PostPreview.interstitialMarkup', markup); @@ -9084,18 +9206,19 @@ targetDocument.close(); } -var post_preview_button_PostPreviewButton = -/*#__PURE__*/ -function (_Component) { +var post_preview_button_PostPreviewButton = /*#__PURE__*/function (_Component) { Object(inherits["a" /* default */])(PostPreviewButton, _Component); + var _super = post_preview_button_createSuper(PostPreviewButton); + function PostPreviewButton() { var _this; Object(classCallCheck["a" /* default */])(this, PostPreviewButton); - _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostPreviewButton).apply(this, arguments)); - _this.openPreviewWindow = _this.openPreviewWindow.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); + _this = _super.apply(this, arguments); + _this.buttonRef = Object(external_this_wp_element_["createRef"])(); + _this.openPreviewWindow = _this.openPreviewWindow.bind(Object(assertThisInitialized["a" /* default */])(_this)); return _this; } @@ -9124,6 +9247,10 @@ if (previewWindow && !previewWindow.closed) { previewWindow.location = url; + + if (this.buttonRef.current) { + this.buttonRef.current.focus(); + } } } }, { @@ -9184,20 +9311,22 @@ // just link to the post's URL. var href = previewLink || currentPostLink; + var classNames = classnames_default()({ + 'editor-post-preview': !this.props.className + }, this.props.className); return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { - isLarge: true, - className: "editor-post-preview", + isTertiary: !this.props.className, + className: classNames, href: href, target: this.getWindowTarget(), disabled: !isSaveable, - onClick: this.openPreviewWindow - }, Object(external_this_wp_i18n_["_x"])('Preview', 'imperative verb'), Object(external_this_wp_element_["createElement"])("span", { - className: "screen-reader-text" + onClick: this.openPreviewWindow, + ref: this.buttonRef + }, this.props.textContent ? this.props.textContent : Object(external_this_wp_i18n_["_x"])('Preview', 'imperative verb'), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["VisuallyHidden"], { + as: "span" }, /* translators: accessibility text */ - Object(external_this_wp_i18n_["__"])('(opens in a new tab)')), Object(external_this_wp_element_["createElement"])(external_this_wp_nux_["DotTip"], { - tipId: "core/editor.preview" - }, Object(external_this_wp_i18n_["__"])('Click “Preview” to load a preview of this page, so you can make sure you’re happy with your blocks.'))); + Object(external_this_wp_i18n_["__"])('(opens in a new tab)'))); } }]); @@ -9226,7 +9355,7 @@ previewLink: forcePreviewLink !== undefined ? forcePreviewLink : previewLink, isSaveable: isEditedPostSaveable(), isAutosaveable: forceIsAutosaveable || isEditedPostAutosaveable(), - isViewable: Object(external_lodash_["get"])(postType, ['viewable'], false), + isViewable: Object(external_this_lodash_["get"])(postType, ['viewable'], false), isDraft: ['draft', 'auto-draft'].indexOf(getEditedPostAttribute('status')) !== -1 }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { @@ -9248,6 +9377,10 @@ +function post_locked_modal_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (post_locked_modal_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } + +function post_locked_modal_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + /** * External dependencies */ @@ -9270,20 +9403,20 @@ -var post_locked_modal_PostLockedModal = -/*#__PURE__*/ -function (_Component) { +var post_locked_modal_PostLockedModal = /*#__PURE__*/function (_Component) { Object(inherits["a" /* default */])(PostLockedModal, _Component); + var _super = post_locked_modal_createSuper(PostLockedModal); + function PostLockedModal() { var _this; Object(classCallCheck["a" /* default */])(this, PostLockedModal); - _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostLockedModal).apply(this, arguments)); - _this.sendPostLock = _this.sendPostLock.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.receivePostLock = _this.receivePostLock.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.releasePostLock = _this.releasePostLock.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); + _this = _super.apply(this, arguments); + _this.sendPostLock = _this.sendPostLock.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.receivePostLock = _this.receivePostLock.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.releasePostLock = _this.releasePostLock.bind(Object(assertThisInitialized["a" /* default */])(_this)); return _this; } @@ -9399,9 +9532,14 @@ data.append('_wpnonce', postLockUtils.unlockNonce); data.append('post_ID', postId); data.append('active_post_lock', activePostLock); - var xhr = new window.XMLHttpRequest(); - xhr.open('POST', postLockUtils.ajaxUrl, false); - xhr.send(data); + + if (window.navigator.sendBeacon) { + window.navigator.sendBeacon(postLockUtils.ajaxUrl, data); + } else { + var xhr = new window.XMLHttpRequest(); + xhr.open('POST', postLockUtils.ajaxUrl, false); + xhr.send(data); + } } }, { key: "render", @@ -9428,7 +9566,7 @@ _wpnonce: postLockUtils.nonce }); var allPostsUrl = getWPAdminURL('edit.php', { - post_type: Object(external_lodash_["get"])(postType, ['slug']) + post_type: Object(external_this_lodash_["get"])(postType, ['slug']) }); var allPostsLabel = Object(external_this_wp_i18n_["__"])('Exit the Editor'); @@ -9438,7 +9576,7 @@ focusOnMount: true, shouldCloseOnClickOutside: false, shouldCloseOnEsc: false, - isDismissable: false, + isDismissible: false, className: "editor-post-locked-modal" }, !!userAvatar && Object(external_this_wp_element_["createElement"])("img", { src: userAvatar, @@ -9450,19 +9588,16 @@ className: "editor-post-locked-modal__buttons" }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { isPrimary: true, - isLarge: true, href: allPostsUrl }, allPostsLabel))), !isTakeover && Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])("div", null, userDisplayName ? Object(external_this_wp_i18n_["sprintf"])( /* translators: %s: user's display name */ Object(external_this_wp_i18n_["__"])('%s is currently working on this post, which means you cannot make changes, unless you take over.'), userDisplayName) : Object(external_this_wp_i18n_["__"])('Another user is currently working on this post, which means you cannot make changes, unless you take over.')), Object(external_this_wp_element_["createElement"])("div", { className: "editor-post-locked-modal__buttons" }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { - isDefault: true, - isLarge: true, + isSecondary: true, href: allPostsUrl }, allPostsLabel), Object(external_this_wp_element_["createElement"])(post_preview_button, null), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { isPrimary: true, - isLarge: true, href: unlockUrl }, Object(external_this_wp_i18n_["__"])('Take Over'))))); } @@ -9535,7 +9670,7 @@ getCurrentPost = _select.getCurrentPost; return { - hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), + hasPublishAction: Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), isPublished: isCurrentPostPublished(), postType: getCurrentPostType() }; @@ -9566,7 +9701,7 @@ }; return Object(external_this_wp_element_["createElement"])(post_pending_status_check, null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], { - label: Object(external_this_wp_i18n_["__"])('Pending Review'), + label: Object(external_this_wp_i18n_["__"])('Pending review'), checked: status === 'pending', onChange: togglePendingStatus })); @@ -9609,7 +9744,7 @@ }; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], { - label: Object(external_this_wp_i18n_["__"])('Allow Pingbacks & Trackbacks'), + label: Object(external_this_wp_i18n_["__"])('Allow pingbacks & trackbacks'), checked: pingStatus === 'open', onChange: onTogglePingback }); @@ -9643,7 +9778,8 @@ isSaving = _ref.isSaving, isPublishing = _ref.isPublishing, hasPublishAction = _ref.hasPublishAction, - isAutosaving = _ref.isAutosaving; + isAutosaving = _ref.isAutosaving, + hasNonPostEntityChanges = _ref.hasNonPostEntityChanges; if (isPublishing) { return Object(external_this_wp_i18n_["__"])('Publishing…'); @@ -9654,11 +9790,11 @@ } if (!hasPublishAction) { - return Object(external_this_wp_i18n_["__"])('Submit for Review'); + return hasNonPostEntityChanges ? Object(external_this_wp_i18n_["__"])('Submit for Review…') : Object(external_this_wp_i18n_["__"])('Submit for Review'); } else if (isPublished) { - return Object(external_this_wp_i18n_["__"])('Update'); + return hasNonPostEntityChanges ? Object(external_this_wp_i18n_["__"])('Update…') : Object(external_this_wp_i18n_["__"])('Update'); } else if (isBeingScheduled) { - return Object(external_this_wp_i18n_["__"])('Schedule'); + return hasNonPostEntityChanges ? Object(external_this_wp_i18n_["__"])('Schedule…') : Object(external_this_wp_i18n_["__"])('Schedule'); } return Object(external_this_wp_i18n_["__"])('Publish'); @@ -9680,7 +9816,7 @@ isBeingScheduled: isEditedPostBeingScheduled(), isSaving: forceIsSaving || isSavingPost(), isPublishing: isPublishingPost(), - hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), + hasPublishAction: Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), postType: getCurrentPostType(), isAutosaving: isAutosavingPost() }; @@ -9695,14 +9831,19 @@ + +function post_publish_button_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (post_publish_button_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } + +function post_publish_button_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + /** * External dependencies */ -/** - * WordPress dependencies - */ - + +/** + * WordPress dependencies + */ @@ -9714,18 +9855,23 @@ */ -var post_publish_button_PostPublishButton = -/*#__PURE__*/ -function (_Component) { +var post_publish_button_PostPublishButton = /*#__PURE__*/function (_Component) { Object(inherits["a" /* default */])(PostPublishButton, _Component); + var _super = post_publish_button_createSuper(PostPublishButton); + function PostPublishButton(props) { var _this; Object(classCallCheck["a" /* default */])(this, PostPublishButton); - _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostPublishButton).call(this, props)); + _this = _super.call(this, props); _this.buttonNode = Object(external_this_wp_element_["createRef"])(); + _this.createOnClick = _this.createOnClick.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.closeEntitiesSavedStates = _this.closeEntitiesSavedStates.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.state = { + entitiesSavedStatesCallback: false + }; return _this; } @@ -9737,36 +9883,91 @@ } } }, { + key: "createOnClick", + value: function createOnClick(callback) { + var _this2 = this; + + return function () { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var hasNonPostEntityChanges = _this2.props.hasNonPostEntityChanges; + + if (hasNonPostEntityChanges) { + // The modal for multiple entity saving will open, + // hold the callback for saving/publishing the post + // so that we can call it if the post entity is checked. + _this2.setState({ + entitiesSavedStatesCallback: function entitiesSavedStatesCallback() { + return callback.apply(void 0, args); + } + }); // Open the save panel by setting its callback. + // To set a function on the useState hook, we must set it + // with another function (() => myFunction). Passing the + // function on its own will cause an error when called. + + + _this2.props.setEntitiesSavedStatesCallback(function () { + return _this2.closeEntitiesSavedStates; + }); + + return external_this_lodash_["noop"]; + } + + return callback.apply(void 0, args); + }; + } + }, { + key: "closeEntitiesSavedStates", + value: function closeEntitiesSavedStates(savedEntities) { + var _this$props = this.props, + postType = _this$props.postType, + postId = _this$props.postId; + var entitiesSavedStatesCallback = this.state.entitiesSavedStatesCallback; + this.setState({ + entitiesSavedStatesCallback: false + }, function () { + if (savedEntities && Object(external_this_lodash_["some"])(savedEntities, function (elt) { + return elt.kind === 'postType' && elt.name === postType && elt.key === postId; + })) { + // The post entity was checked, call the held callback from `createOnClick`. + entitiesSavedStatesCallback(); + } + }); + } + }, { key: "render", value: function render() { - var _this$props = this.props, - forceIsDirty = _this$props.forceIsDirty, - forceIsSaving = _this$props.forceIsSaving, - hasPublishAction = _this$props.hasPublishAction, - isBeingScheduled = _this$props.isBeingScheduled, - isOpen = _this$props.isOpen, - isPostSavingLocked = _this$props.isPostSavingLocked, - isPublishable = _this$props.isPublishable, - isPublished = _this$props.isPublished, - isSaveable = _this$props.isSaveable, - isSaving = _this$props.isSaving, - isToggle = _this$props.isToggle, - onSave = _this$props.onSave, - onStatusChange = _this$props.onStatusChange, - _this$props$onSubmit = _this$props.onSubmit, - onSubmit = _this$props$onSubmit === void 0 ? external_lodash_["noop"] : _this$props$onSubmit, - onToggle = _this$props.onToggle, - visibility = _this$props.visibility; + var _this$props2 = this.props, + forceIsDirty = _this$props2.forceIsDirty, + forceIsSaving = _this$props2.forceIsSaving, + hasPublishAction = _this$props2.hasPublishAction, + isBeingScheduled = _this$props2.isBeingScheduled, + isOpen = _this$props2.isOpen, + isPostSavingLocked = _this$props2.isPostSavingLocked, + isPublishable = _this$props2.isPublishable, + isPublished = _this$props2.isPublished, + isSaveable = _this$props2.isSaveable, + isSaving = _this$props2.isSaving, + isToggle = _this$props2.isToggle, + onSave = _this$props2.onSave, + onStatusChange = _this$props2.onStatusChange, + _this$props2$onSubmit = _this$props2.onSubmit, + onSubmit = _this$props2$onSubmit === void 0 ? external_this_lodash_["noop"] : _this$props2$onSubmit, + onToggle = _this$props2.onToggle, + visibility = _this$props2.visibility, + hasNonPostEntityChanges = _this$props2.hasNonPostEntityChanges; var isButtonDisabled = isSaving || forceIsSaving || !isSaveable || isPostSavingLocked || !isPublishable && !forceIsDirty; var isToggleDisabled = isPublished || isSaving || forceIsSaving || !isSaveable || !isPublishable && !forceIsDirty; var publishStatus; if (!hasPublishAction) { publishStatus = 'pending'; + } else if (visibility === 'private') { + publishStatus = 'private'; } else if (isBeingScheduled) { publishStatus = 'future'; - } else if (visibility === 'private') { - publishStatus = 'private'; } else { publishStatus = 'publish'; } @@ -9790,32 +9991,34 @@ }; var buttonProps = { - 'aria-disabled': isButtonDisabled, + 'aria-disabled': isButtonDisabled && !hasNonPostEntityChanges, className: 'editor-post-publish-button', isBusy: isSaving && isPublished, - isLarge: true, isPrimary: true, - onClick: onClickButton + onClick: this.createOnClick(onClickButton) }; var toggleProps = { - 'aria-disabled': isToggleDisabled, + 'aria-disabled': isToggleDisabled && !hasNonPostEntityChanges, 'aria-expanded': isOpen, className: 'editor-post-publish-panel__toggle', isBusy: isSaving && isPublished, isPrimary: true, - onClick: onClickToggle + onClick: this.createOnClick(onClickToggle) }; - var toggleChildren = isBeingScheduled ? Object(external_this_wp_i18n_["__"])('Schedule…') : Object(external_this_wp_i18n_["__"])('Publish…'); + var toggleChildren = isBeingScheduled ? Object(external_this_wp_i18n_["__"])('Schedule…') : Object(external_this_wp_i18n_["__"])('Publish'); var buttonChildren = Object(external_this_wp_element_["createElement"])(post_publish_button_label, { - forceIsSaving: forceIsSaving + forceIsSaving: forceIsSaving, + hasNonPostEntityChanges: hasNonPostEntityChanges }); var componentProps = isToggle ? toggleProps : buttonProps; var componentChildren = isToggle ? toggleChildren : buttonChildren; - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], Object(esm_extends["a" /* default */])({ + return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], Object(esm_extends["a" /* default */])({ ref: this.buttonNode - }, componentProps), componentChildren, Object(external_this_wp_element_["createElement"])(external_this_wp_nux_["DotTip"], { - tipId: "core/editor.publish" - }, Object(external_this_wp_i18n_["__"])('Finished writing? That’s great, let’s get this published right now. Just click “Publish” and you’re good to go.'))); + }, componentProps, { + className: classnames_default()(componentProps.className, 'editor-post-publish-button__button', { + 'has-changes-dot': hasNonPostEntityChanges + }) + }), componentChildren)); } }]); @@ -9831,7 +10034,9 @@ isEditedPostPublishable = _select.isEditedPostPublishable, isPostSavingLocked = _select.isPostSavingLocked, getCurrentPost = _select.getCurrentPost, - getCurrentPostType = _select.getCurrentPostType; + getCurrentPostType = _select.getCurrentPostType, + getCurrentPostId = _select.getCurrentPostId, + hasNonPostEntityChanges = _select.hasNonPostEntityChanges; return { isSaving: isSavingPost(), @@ -9841,8 +10046,10 @@ isPostSavingLocked: isPostSavingLocked(), isPublishable: isEditedPostPublishable(), isPublished: isCurrentPostPublished(), - hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), - postType: getCurrentPostType() + hasPublishAction: Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), + postType: getCurrentPostType(), + postId: getCurrentPostId(), + hasNonPostEntityChanges: hasNonPostEntityChanges() }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { var _dispatch = dispatch('core/editor'), @@ -9853,12 +10060,17 @@ onStatusChange: function onStatusChange(status) { return editPost({ status: status + }, { + undoIgnore: true }); }, onSave: savePost }; })])(post_publish_button_PostPublishButton)); +// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js +var close_small = __webpack_require__(177); + // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/utils.js /** * WordPress dependencies @@ -9887,9 +10099,14 @@ -/** - * WordPress dependencies - */ +function post_visibility_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (post_visibility_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } + +function post_visibility_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +/** + * WordPress dependencies + */ + @@ -9899,21 +10116,21 @@ */ -var post_visibility_PostVisibility = -/*#__PURE__*/ -function (_Component) { +var post_visibility_PostVisibility = /*#__PURE__*/function (_Component) { Object(inherits["a" /* default */])(PostVisibility, _Component); + var _super = post_visibility_createSuper(PostVisibility); + function PostVisibility(props) { var _this; Object(classCallCheck["a" /* default */])(this, PostVisibility); - _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostVisibility).apply(this, arguments)); - _this.setPublic = _this.setPublic.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.setPrivate = _this.setPrivate.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.setPasswordProtected = _this.setPasswordProtected.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.updatePassword = _this.updatePassword.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); + _this = _super.apply(this, arguments); + _this.setPublic = _this.setPublic.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.setPrivate = _this.setPrivate.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.setPasswordProtected = _this.setPasswordProtected.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.updatePassword = _this.updatePassword.bind(Object(assertThisInitialized["a" /* default */])(_this)); _this.state = { hasPassword: !!props.password }; @@ -9935,8 +10152,8 @@ }, { key: "setPrivate", value: function setPrivate() { - if (!window.confirm(Object(external_this_wp_i18n_["__"])('Would you like to privately publish this post now?'))) { - // eslint-disable-line no-alert + if ( // eslint-disable-next-line no-alert + !window.confirm(Object(external_this_wp_i18n_["__"])('Would you like to privately publish this post now?'))) { return; } @@ -10022,9 +10239,9 @@ })), this.state.hasPassword && Object(external_this_wp_element_["createElement"])("div", { className: "editor-post-visibility__dialog-password", key: "password-selector" - }, Object(external_this_wp_element_["createElement"])("label", { - htmlFor: "editor-post-visibility__dialog-password-input-".concat(instanceId), - className: "screen-reader-text" + }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["VisuallyHidden"], { + as: "label", + htmlFor: "editor-post-visibility__dialog-password-input-".concat(instanceId) }, Object(external_this_wp_i18n_["__"])('Create password')), Object(external_this_wp_element_["createElement"])("input", { className: "editor-post-visibility__dialog-password-input", id: "editor-post-visibility__dialog-password-input-".concat(instanceId), @@ -10056,7 +10273,7 @@ return { onSave: savePost, onUpdateVisibility: function onUpdateVisibility(status) { - var password = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + var password = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; editPost({ status: status, password: password @@ -10085,7 +10302,7 @@ var visibility = _ref.visibility; var getVisibilityLabel = function getVisibilityLabel() { - return Object(external_lodash_["find"])(visibilityOptions, { + return Object(external_this_lodash_["find"])(visibilityOptions, { value: visibility }).label; }; @@ -10113,6 +10330,11 @@ var date = _ref.date, onUpdateDate = _ref.onUpdateDate; + var onChange = function onChange(newDate) { + onUpdateDate(newDate); + document.activeElement.blur(); + }; + var settings = Object(external_this_wp_date_["__experimentalGetSettings"])(); // To know if the current timezone is a 12 hour time with look for "a" in the time format // We also make sure this a is not escaped by a "/" @@ -10124,7 +10346,7 @@ return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["DateTimePicker"], { key: "date-time-picker", currentDate: date, - onChange: onUpdateDate, + onChange: onChange, is12Hour: is12HourTime }); } @@ -10155,7 +10377,7 @@ var settings = Object(external_this_wp_date_["__experimentalGetSettings"])(); - return date && !isFloating ? Object(external_this_wp_date_["dateI18n"])(settings.formats.datetimeAbbreviated, date) : Object(external_this_wp_i18n_["__"])('Immediately'); + return date && !isFloating ? Object(external_this_wp_date_["dateI18n"])("".concat(settings.formats.date, " ").concat(settings.formats.time), date) : Object(external_this_wp_i18n_["__"])('Immediately'); } /* harmony default export */ var post_schedule_label = (Object(external_this_wp_data_["withSelect"])(function (select) { return { @@ -10174,6 +10396,13 @@ +function flat_term_selector_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (flat_term_selector_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } + +function flat_term_selector_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function flat_term_selector_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function flat_term_selector_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { flat_term_selector_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { flat_term_selector_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } /** * External dependencies @@ -10207,7 +10436,7 @@ }; /** * Returns a term object with name unescaped. - * The unescape of the name propery is done using lodash unescape function. + * The unescape of the name property is done using lodash unescape function. * * @param {Object} term The term object to unescape. * @@ -10216,8 +10445,8 @@ var flat_term_selector_unescapeTerm = function unescapeTerm(term) { - return Object(objectSpread["a" /* default */])({}, term, { - name: Object(external_lodash_["unescape"])(term.name) + return flat_term_selector_objectSpread({}, term, { + name: Object(external_this_lodash_["unescape"])(term.name) }); }; /** @@ -10226,30 +10455,30 @@ * * @param {Object[]} terms Array of term objects to unescape. * - * @return {Object[]} Array of therm objects unscaped. + * @return {Object[]} Array of term objects unescaped. */ var flat_term_selector_unescapeTerms = function unescapeTerms(terms) { - return Object(external_lodash_["map"])(terms, flat_term_selector_unescapeTerm); + return Object(external_this_lodash_["map"])(terms, flat_term_selector_unescapeTerm); }; -var flat_term_selector_FlatTermSelector = -/*#__PURE__*/ -function (_Component) { +var flat_term_selector_FlatTermSelector = /*#__PURE__*/function (_Component) { Object(inherits["a" /* default */])(FlatTermSelector, _Component); + var _super = flat_term_selector_createSuper(FlatTermSelector); + function FlatTermSelector() { var _this; Object(classCallCheck["a" /* default */])(this, FlatTermSelector); - _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(FlatTermSelector).apply(this, arguments)); - _this.onChange = _this.onChange.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.searchTerms = Object(external_lodash_["throttle"])(_this.searchTerms.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))), 500); - _this.findOrCreateTerm = _this.findOrCreateTerm.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); + _this = _super.apply(this, arguments); + _this.onChange = _this.onChange.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.searchTerms = Object(external_this_lodash_["throttle"])(_this.searchTerms.bind(Object(assertThisInitialized["a" /* default */])(_this)), 500); + _this.findOrCreateTerm = _this.findOrCreateTerm.bind(Object(assertThisInitialized["a" /* default */])(_this)); _this.state = { - loading: !Object(external_lodash_["isEmpty"])(_this.props.terms), + loading: !Object(external_this_lodash_["isEmpty"])(_this.props.terms), availableTerms: [], selectedTerms: [] }; @@ -10261,7 +10490,7 @@ value: function componentDidMount() { var _this2 = this; - if (!Object(external_lodash_["isEmpty"])(this.props.terms)) { + if (!Object(external_this_lodash_["isEmpty"])(this.props.terms)) { this.initRequest = this.fetchTerms({ include: this.props.terms.join(','), per_page: -1 @@ -10284,8 +10513,8 @@ }, { key: "componentWillUnmount", value: function componentWillUnmount() { - Object(external_lodash_["invoke"])(this.initRequest, ['abort']); - Object(external_lodash_["invoke"])(this.searchRequest, ['abort']); + Object(external_this_lodash_["invoke"])(this.initRequest, ['abort']); + Object(external_this_lodash_["invoke"])(this.searchRequest, ['abort']); } }, { key: "componentDidUpdate", @@ -10302,7 +10531,7 @@ var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var taxonomy = this.props.taxonomy; - var query = Object(objectSpread["a" /* default */])({}, DEFAULT_QUERY, params); + var query = flat_term_selector_objectSpread({}, DEFAULT_QUERY, {}, params); var request = external_this_wp_apiFetch_default()({ path: Object(external_this_wp_url_["addQueryArgs"])("/wp/v2/".concat(taxonomy.rest_base), query) @@ -10311,7 +10540,7 @@ _this3.setState(function (state) { return { availableTerms: state.availableTerms.concat(terms.filter(function (term) { - return !Object(external_lodash_["find"])(state.availableTerms, function (availableTerm) { + return !Object(external_this_lodash_["find"])(state.availableTerms, function (availableTerm) { return availableTerm.id === term.id; }); })) @@ -10328,16 +10557,16 @@ var _this4 = this; var terms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - var selectedTerms = terms.reduce(function (result, termId) { - var termObject = Object(external_lodash_["find"])(_this4.state.availableTerms, function (term) { + var selectedTerms = terms.reduce(function (accumulator, termId) { + var termObject = Object(external_this_lodash_["find"])(_this4.state.availableTerms, function (term) { return term.id === termId; }); if (termObject) { - result.push(termObject.name); + accumulator.push(termObject.name); } - return result; + return accumulator; }, []); this.setState({ selectedTerms: selectedTerms @@ -10349,7 +10578,7 @@ var _this5 = this; var taxonomy = this.props.taxonomy; - var termNameEscaped = Object(external_lodash_["escape"])(termName); // Tries to create a term or fetch it if it already exists. + var termNameEscaped = Object(external_this_lodash_["escape"])(termName); // Tries to create a term or fetch it if it already exists. return external_this_wp_apiFetch_default()({ path: "/wp/v2/".concat(taxonomy.rest_base), @@ -10363,12 +10592,12 @@ if (errorCode === 'term_exists') { // If the terms exist, fetch it instead of creating a new one. _this5.addRequest = external_this_wp_apiFetch_default()({ - path: Object(external_this_wp_url_["addQueryArgs"])("/wp/v2/".concat(taxonomy.rest_base), Object(objectSpread["a" /* default */])({}, DEFAULT_QUERY, { + path: Object(external_this_wp_url_["addQueryArgs"])("/wp/v2/".concat(taxonomy.rest_base), flat_term_selector_objectSpread({}, DEFAULT_QUERY, { search: termNameEscaped })) }).then(flat_term_selector_unescapeTerms); return _this5.addRequest.then(function (searchResult) { - return Object(external_lodash_["find"])(searchResult, function (result) { + return Object(external_this_lodash_["find"])(searchResult, function (result) { return isSameTermName(result.name, termName); }); }); @@ -10382,21 +10611,21 @@ value: function onChange(termNames) { var _this6 = this; - var uniqueTerms = Object(external_lodash_["uniqBy"])(termNames, function (term) { + var uniqueTerms = Object(external_this_lodash_["uniqBy"])(termNames, function (term) { return term.toLowerCase(); }); this.setState({ selectedTerms: uniqueTerms }); var newTermNames = uniqueTerms.filter(function (termName) { - return !Object(external_lodash_["find"])(_this6.state.availableTerms, function (term) { + return !Object(external_this_lodash_["find"])(_this6.state.availableTerms, function (term) { return isSameTermName(term.name, termName); }); }); var termNamesToIds = function termNamesToIds(names, availableTerms) { return names.map(function (termName) { - return Object(external_lodash_["find"])(availableTerms, function (term) { + return Object(external_this_lodash_["find"])(availableTerms, function (term) { return isSameTermName(term.name, termName); }).id; }); @@ -10420,7 +10649,7 @@ key: "searchTerms", value: function searchTerms() { var search = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; - Object(external_lodash_["invoke"])(this.searchRequest, ['abort']); + Object(external_this_lodash_["invoke"])(this.searchRequest, ['abort']); this.searchRequest = this.fetchTerms({ search: search }); @@ -10444,11 +10673,17 @@ var termNames = availableTerms.map(function (term) { return term.name; }); - var newTermLabel = Object(external_lodash_["get"])(taxonomy, ['labels', 'add_new_item'], slug === 'post_tag' ? Object(external_this_wp_i18n_["__"])('Add New Tag') : Object(external_this_wp_i18n_["__"])('Add New Term')); - var singularName = Object(external_lodash_["get"])(taxonomy, ['labels', 'singular_name'], slug === 'post_tag' ? Object(external_this_wp_i18n_["__"])('Tag') : Object(external_this_wp_i18n_["__"])('Term')); - var termAddedLabel = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_x"])('%s added', 'term'), singularName); - var termRemovedLabel = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_x"])('%s removed', 'term'), singularName); - var removeTermLabel = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_x"])('Remove %s', 'term'), singularName); + var newTermLabel = Object(external_this_lodash_["get"])(taxonomy, ['labels', 'add_new_item'], slug === 'post_tag' ? Object(external_this_wp_i18n_["__"])('Add new tag') : Object(external_this_wp_i18n_["__"])('Add new Term')); + var singularName = Object(external_this_lodash_["get"])(taxonomy, ['labels', 'singular_name'], slug === 'post_tag' ? Object(external_this_wp_i18n_["__"])('Tag') : Object(external_this_wp_i18n_["__"])('Term')); + var termAddedLabel = Object(external_this_wp_i18n_["sprintf"])( + /* translators: %s: term name. */ + Object(external_this_wp_i18n_["_x"])('%s added', 'term'), singularName); + var termRemovedLabel = Object(external_this_wp_i18n_["sprintf"])( + /* translators: %s: term name. */ + Object(external_this_wp_i18n_["_x"])('%s removed', 'term'), singularName); + var removeTermLabel = Object(external_this_wp_i18n_["sprintf"])( + /* translators: %s: term name. */ + Object(external_this_wp_i18n_["_x"])('Remove %s', 'term'), singularName); return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["FormTokenField"], { value: selectedTerms, suggestions: termNames, @@ -10480,8 +10715,8 @@ var taxonomy = getTaxonomy(slug); return { - hasCreateAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-create-' + taxonomy.rest_base], false) : false, - hasAssignAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-assign-' + taxonomy.rest_base], false) : false, + hasCreateAction: taxonomy ? Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-create-' + taxonomy.rest_base], false) : false, + hasAssignAction: taxonomy ? Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-assign-' + taxonomy.rest_base], false) : false, terms: taxonomy ? select('core/editor').getEditedPostAttribute(taxonomy.rest_base) : [], taxonomy: taxonomy }; @@ -10501,6 +10736,10 @@ +function maybe_tags_panel_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (maybe_tags_panel_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } + +function maybe_tags_panel_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + /** * External dependencies */ @@ -10533,17 +10772,17 @@ })); }; -var maybe_tags_panel_MaybeTagsPanel = -/*#__PURE__*/ -function (_Component) { +var maybe_tags_panel_MaybeTagsPanel = /*#__PURE__*/function (_Component) { Object(inherits["a" /* default */])(MaybeTagsPanel, _Component); + var _super = maybe_tags_panel_createSuper(MaybeTagsPanel); + function MaybeTagsPanel(props) { var _this; Object(classCallCheck["a" /* default */])(this, MaybeTagsPanel); - _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(MaybeTagsPanel).call(this, props)); + _this = _super.call(this, props); _this.state = { hadTagsWhenOpeningThePanel: props.hasTags }; @@ -10581,7 +10820,7 @@ var tags = tagsTaxonomy && select('core/editor').getEditedPostAttribute(tagsTaxonomy.rest_base); return { areTagsFetched: tagsTaxonomy !== undefined, - isPostTypeSupported: tagsTaxonomy && Object(external_lodash_["some"])(tagsTaxonomy.types, function (type) { + isPostTypeSupported: tagsTaxonomy && Object(external_this_lodash_["some"])(tagsTaxonomy.types, function (type) { return type === postType; }), hasTags: tags && tags.length @@ -10638,15 +10877,17 @@ }, Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_i18n_["__"])('Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.')), Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_element_["createElement"])(maybe_post_format_panel_PostFormatSuggestion, { onUpdatePostFormat: onUpdatePostFormat, suggestedPostFormat: suggestion.id, - suggestionText: Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["__"])('Apply the "%1$s" format.'), suggestion.caption) + suggestionText: Object(external_this_wp_i18n_["sprintf"])( + /* translators: %s: post format */ + Object(external_this_wp_i18n_["__"])('Apply the "%1$s" format.'), suggestion.caption) }))); }; var maybe_post_format_panel_getSuggestion = function getSuggestion(supportedFormats, suggestedPostFormat) { var formats = POST_FORMATS.filter(function (format) { - return Object(external_lodash_["includes"])(supportedFormats, format.id); + return Object(external_this_lodash_["includes"])(supportedFormats, format.id); }); - return Object(external_lodash_["find"])(formats, function (format) { + return Object(external_this_lodash_["find"])(formats, function (format) { return format.id === suggestedPostFormat; }); }; @@ -10656,7 +10897,7 @@ getEditedPostAttribute = _select.getEditedPostAttribute, getSuggestedPostFormat = _select.getSuggestedPostFormat; - var supportedFormats = Object(external_lodash_["get"])(select('core').getThemeSupports(), ['formats'], []); + var supportedFormats = Object(external_this_lodash_["get"])(select('core').getThemeSupports(), ['formats'], []); return { currentPostFormat: getEditedPostAttribute('format'), suggestion: maybe_post_format_panel_getSuggestion(supportedFormats, getSuggestedPostFormat()) @@ -10689,7 +10930,6 @@ - /** * Internal dependencies */ @@ -10732,7 +10972,7 @@ className: "editor-post-publish-panel__link", key: "label" }, Object(external_this_wp_element_["createElement"])(post_schedule_label, null))] - }, Object(external_this_wp_element_["createElement"])(post_schedule, null)), Object(external_this_wp_element_["createElement"])(maybe_post_format_panel, null), Object(external_this_wp_element_["createElement"])(maybe_tags_panel, null), children)); + }, Object(external_this_wp_element_["createElement"])(post_schedule, null))), Object(external_this_wp_element_["createElement"])(maybe_post_format_panel, null), Object(external_this_wp_element_["createElement"])(maybe_tags_panel, null), children); } /* harmony default export */ var prepublish = (Object(external_this_wp_data_["withSelect"])(function (select) { @@ -10741,7 +10981,7 @@ isEditedPostBeingScheduled = _select.isEditedPostBeingScheduled; return { - hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), + hasPublishAction: Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), isBeingScheduled: isEditedPostBeingScheduled() }; })(PostPublishPanelPrepublish)); @@ -10755,6 +10995,10 @@ +function postpublish_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (postpublish_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } + +function postpublish_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + /** * External dependencies */ @@ -10768,28 +11012,47 @@ + /** * Internal dependencies */ - -var postpublish_PostPublishPanelPostpublish = -/*#__PURE__*/ -function (_Component) { +var POSTNAME = '%postname%'; +/** + * Returns URL for a future post. + * + * @param {Object} post Post object. + * + * @return {string} PostPublish URL. + */ + +var getFuturePostUrl = function getFuturePostUrl(post) { + var slug = post.slug; + + if (post.permalink_template.includes(POSTNAME)) { + return post.permalink_template.replace(POSTNAME, slug); + } + + return post.permalink_template; +}; + +var postpublish_PostPublishPanelPostpublish = /*#__PURE__*/function (_Component) { Object(inherits["a" /* default */])(PostPublishPanelPostpublish, _Component); + var _super = postpublish_createSuper(PostPublishPanelPostpublish); + function PostPublishPanelPostpublish() { var _this; Object(classCallCheck["a" /* default */])(this, PostPublishPanelPostpublish); - _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostPublishPanelPostpublish).apply(this, arguments)); + _this = _super.apply(this, arguments); _this.state = { showCopyConfirmation: false }; - _this.onCopy = _this.onCopy.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.onSelectInput = _this.onSelectInput.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); + _this.onCopy = _this.onCopy.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.onSelectInput = _this.onSelectInput.bind(Object(assertThisInitialized["a" /* default */])(_this)); _this.postLink = Object(external_this_wp_element_["createRef"])(); return _this; } @@ -10834,17 +11097,18 @@ isScheduled = _this$props.isScheduled, post = _this$props.post, postType = _this$props.postType; - var postLabel = Object(external_lodash_["get"])(postType, ['labels', 'singular_name']); - var viewPostLabel = Object(external_lodash_["get"])(postType, ['labels', 'view_item']); - var postPublishNonLinkHeader = isScheduled ? Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_i18n_["__"])('is now scheduled. It will go live on'), " ", Object(external_this_wp_element_["createElement"])(post_schedule_label, null), ".") : Object(external_this_wp_i18n_["__"])('is now live.'); + var postLabel = Object(external_this_lodash_["get"])(postType, ['labels', 'singular_name']); + var viewPostLabel = Object(external_this_lodash_["get"])(postType, ['labels', 'view_item']); + var link = post.status === 'future' ? getFuturePostUrl(post) : post.link; + var postPublishNonLinkHeader = isScheduled ? Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_i18n_["__"])('is now scheduled. It will go live on'), ' ', Object(external_this_wp_element_["createElement"])(post_schedule_label, null), ".") : Object(external_this_wp_i18n_["__"])('is now live.'); return Object(external_this_wp_element_["createElement"])("div", { className: "post-publish-panel__postpublish" }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { className: "post-publish-panel__postpublish-header" }, Object(external_this_wp_element_["createElement"])("a", { ref: this.postLink, - href: post.link - }, post.title || Object(external_this_wp_i18n_["__"])('(no title)')), " ", postPublishNonLinkHeader), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], null, Object(external_this_wp_element_["createElement"])("p", { + href: link + }, Object(external_this_wp_htmlEntities_["decodeEntities"])(post.title) || Object(external_this_wp_i18n_["__"])('(no title)')), ' ', postPublishNonLinkHeader), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], null, Object(external_this_wp_element_["createElement"])("p", { className: "post-publish-panel__postpublish-subheader" }, Object(external_this_wp_element_["createElement"])("strong", null, Object(external_this_wp_i18n_["__"])('What’s next?'))), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TextControl"], { className: "post-publish-panel__postpublish-post-address", @@ -10852,16 +11116,16 @@ label: Object(external_this_wp_i18n_["sprintf"])( /* translators: %s: post type singular name */ Object(external_this_wp_i18n_["__"])('%s address'), postLabel), - value: Object(external_this_wp_url_["safeDecodeURIComponent"])(post.link), + value: Object(external_this_wp_url_["safeDecodeURIComponent"])(link), onFocus: this.onSelectInput }), Object(external_this_wp_element_["createElement"])("div", { className: "post-publish-panel__postpublish-buttons" }, !isScheduled && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { - isDefault: true, - href: post.link + isSecondary: true, + href: link }, viewPostLabel), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ClipboardButton"], { - isDefault: true, - text: post.link, + isSecondary: true, + text: link, onCopy: this.onCopy }, this.state.showCopyConfirmation ? Object(external_this_wp_i18n_["__"])('Copied!') : Object(external_this_wp_i18n_["__"])('Copy Link')))), children); } @@ -10897,6 +11161,10 @@ +function post_publish_panel_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (post_publish_panel_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } + +function post_publish_panel_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + /** * External dependencies */ @@ -10910,6 +11178,7 @@ + /** * Internal dependencies */ @@ -10917,18 +11186,18 @@ -var post_publish_panel_PostPublishPanel = -/*#__PURE__*/ -function (_Component) { +var post_publish_panel_PostPublishPanel = /*#__PURE__*/function (_Component) { Object(inherits["a" /* default */])(PostPublishPanel, _Component); + var _super = post_publish_panel_createSuper(PostPublishPanel); + function PostPublishPanel() { var _this; Object(classCallCheck["a" /* default */])(this, PostPublishPanel); - _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostPublishPanel).apply(this, arguments)); - _this.onSubmit = _this.onSubmit.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); + _this = _super.apply(this, arguments); + _this.onSubmit = _this.onSubmit.bind(Object(assertThisInitialized["a" /* default */])(_this)); return _this; } @@ -10970,7 +11239,7 @@ PrePublishExtension = _this$props2.PrePublishExtension, additionalProps = Object(objectWithoutProperties["a" /* default */])(_this$props2, ["forceIsDirty", "forceIsSaving", "isBeingScheduled", "isPublished", "isPublishSidebarEnabled", "isScheduled", "isSaving", "onClose", "onTogglePublishSidebar", "PostPublishExtension", "PrePublishExtension"]); - var propsForPanel = Object(external_lodash_["omit"])(additionalProps, ['hasPublishAction', 'isDirty', 'isPostTypeViewable']); + var propsForPanel = Object(external_this_lodash_["omit"])(additionalProps, ['hasPublishAction', 'isDirty', 'isPostTypeViewable']); var isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled; var isPrePublish = !isPublishedOrScheduled && !isSaving; var isPostPublish = isPublishedOrScheduled && !isSaving; @@ -10978,23 +11247,24 @@ className: "editor-post-publish-panel" }, propsForPanel), Object(external_this_wp_element_["createElement"])("div", { className: "editor-post-publish-panel__header" - }, isPostPublish ? Object(external_this_wp_element_["createElement"])("div", { - className: "editor-post-publish-panel__header-published" - }, isScheduled ? Object(external_this_wp_i18n_["__"])('Scheduled') : Object(external_this_wp_i18n_["__"])('Published')) : Object(external_this_wp_element_["createElement"])("div", { + }, isPostPublish ? Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + onClick: onClose, + icon: close_small["a" /* default */], + label: Object(external_this_wp_i18n_["__"])('Close panel') + }) : Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("div", { className: "editor-post-publish-panel__header-publish-button" }, Object(external_this_wp_element_["createElement"])(post_publish_button, { focusOnMount: true, onSubmit: this.onSubmit, forceIsDirty: forceIsDirty, forceIsSaving: forceIsSaving - }), Object(external_this_wp_element_["createElement"])("span", { - className: "editor-post-publish-panel__spacer" - })), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { - "aria-expanded": true, + })), Object(external_this_wp_element_["createElement"])("div", { + className: "editor-post-publish-panel__header-cancel-button" + }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { onClick: onClose, - icon: "no-alt", - label: Object(external_this_wp_i18n_["__"])('Close panel') - })), Object(external_this_wp_element_["createElement"])("div", { + label: Object(external_this_wp_i18n_["__"])('Close panel'), + isSecondary: true + }, Object(external_this_wp_i18n_["__"])('Cancel'))))), Object(external_this_wp_element_["createElement"])("div", { className: "editor-post-publish-panel__content" }, isPrePublish && Object(external_this_wp_element_["createElement"])(prepublish, null, PrePublishExtension && Object(external_this_wp_element_["createElement"])(PrePublishExtension, null)), isPostPublish && Object(external_this_wp_element_["createElement"])(postpublish, { focusOnMount: true @@ -11028,8 +11298,8 @@ var postType = getPostType(getEditedPostAttribute('type')); return { - hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), - isPostTypeViewable: Object(external_lodash_["get"])(postType, ['viewable'], false), + hasPublishAction: Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), + isPostTypeViewable: Object(external_this_lodash_["get"])(postType, ['viewable'], false), isBeingScheduled: isEditedPostBeingScheduled(), isDirty: isEditedPostDirty(), isPublished: isCurrentPostPublished(), @@ -11055,6 +11325,42 @@ }; }), external_this_wp_components_["withFocusReturn"], external_this_wp_components_["withConstrainedTabbing"]])(post_publish_panel_PostPublishPanel)); +// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js +var build_module_icon = __webpack_require__(137); + +// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud.js + + +/** + * WordPress dependencies + */ + +var cloud = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "-2 -2 24 24" +}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { + d: "M14.9 9c1.8.2 3.1 1.7 3.1 3.5 0 1.9-1.6 3.5-3.5 3.5h-10C2.6 16 1 14.4 1 12.5 1 10.7 2.3 9.3 4.1 9 4 8.9 4 8.7 4 8.5 4 7.1 5.1 6 6.5 6c.3 0 .7.1.9.2C8.1 4.9 9.4 4 11 4c2.2 0 4 1.8 4 4 0 .4-.1.7-.1 1z" +})); +/* harmony default export */ var library_cloud = (cloud); + +// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js +var library_check = __webpack_require__(155); + +// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud-upload.js + + +/** + * WordPress dependencies + */ + +var cloudUpload = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "-2 -2 24 24" +}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { + d: "M14.8 9c.1-.3.2-.6.2-1 0-2.2-1.8-4-4-4-1.5 0-2.9.9-3.5 2.2-.3-.1-.7-.2-1-.2C5.1 6 4 7.1 4 8.5c0 .2 0 .4.1.5-1.8.3-3.1 1.7-3.1 3.5C1 14.4 2.6 16 4.5 16H8v-3H5l4.5-4.5L14 13h-3v3h3.5c1.9 0 3.5-1.6 3.5-3.5 0-1.8-1.4-3.3-3.2-3.5z" +})); +/* harmony default export */ var cloud_upload = (cloudUpload); + // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-switch-to-draft-button/index.js @@ -11071,6 +11377,7 @@ isPublished = _ref.isPublished, isScheduled = _ref.isScheduled, onClick = _ref.onClick; + var isMobileViewport = Object(external_this_wp_compose_["useViewportMatch"])('small', '<'); if (!isPublished && !isScheduled) { return null; @@ -11096,7 +11403,7 @@ onClick: onSwitch, disabled: isSaving, isTertiary: true - }, Object(external_this_wp_i18n_["__"])('Switch to Draft')); + }, isMobileViewport ? Object(external_this_wp_i18n_["__"])('Draft') : Object(external_this_wp_i18n_["__"])('Switch to draft')); } /* harmony default export */ var post_switch_to_draft_button = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { @@ -11133,14 +11440,18 @@ +function post_saved_state_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (post_saved_state_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } + +function post_saved_state_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + /** * External dependencies */ - -/** - * WordPress dependencies - */ +/** + * WordPress dependencies + */ + @@ -11160,17 +11471,17 @@ * @param {Object} Props Component Props. */ -var post_saved_state_PostSavedState = -/*#__PURE__*/ -function (_Component) { +var post_saved_state_PostSavedState = /*#__PURE__*/function (_Component) { Object(inherits["a" /* default */])(PostSavedState, _Component); + var _super = post_saved_state_createSuper(PostSavedState); + function PostSavedState() { var _this; Object(classCallCheck["a" /* default */])(this, PostSavedState); - _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostSavedState).apply(this, arguments)); + _this = _super.apply(this, arguments); _this.state = { forceSavedMessage: false }; @@ -11197,7 +11508,7 @@ key: "render", value: function render() { var _this$props = this.props, - post = _this$props.post, + hasPublishAction = _this$props.hasPublishAction, isNew = _this$props.isNew, isScheduled = _this$props.isScheduled, isPublished = _this$props.isPublished, @@ -11217,11 +11528,16 @@ var classes = classnames_default()('editor-post-saved-state', 'is-saving', { 'is-autosaving': isAutosaving }); - return Object(external_this_wp_element_["createElement"])("span", { - className: classes - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Dashicon"], { - icon: "cloud" - }), isAutosaving ? Object(external_this_wp_i18n_["__"])('Autosaving') : Object(external_this_wp_i18n_["__"])('Saving')); + return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Animate"], { + type: "loading" + }, function (_ref) { + var animateClassName = _ref.className; + return Object(external_this_wp_element_["createElement"])("span", { + className: classnames_default()(classes, animateClassName) + }, Object(external_this_wp_element_["createElement"])(build_module_icon["a" /* default */], { + icon: library_cloud + }), isAutosaving ? Object(external_this_wp_i18n_["__"])('Autosaving') : Object(external_this_wp_i18n_["__"])('Saving')); + }); } if (isPublished || isScheduled) { @@ -11235,34 +11551,36 @@ if (forceSavedMessage || !isNew && !isDirty) { return Object(external_this_wp_element_["createElement"])("span", { className: "editor-post-saved-state is-saved" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Dashicon"], { - icon: "saved" + }, Object(external_this_wp_element_["createElement"])(build_module_icon["a" /* default */], { + icon: library_check["a" /* default */] }), Object(external_this_wp_i18n_["__"])('Saved')); } // Once the post has been submitted for review this button // is not needed for the contributor role. - var hasPublishAction = Object(external_lodash_["get"])(post, ['_links', 'wp:action-publish'], false); - if (!hasPublishAction && isPending) { return null; } - var label = isPending ? Object(external_this_wp_i18n_["__"])('Save as Pending') : Object(external_this_wp_i18n_["__"])('Save Draft'); + var label = isPending ? Object(external_this_wp_i18n_["__"])('Save as pending') : Object(external_this_wp_i18n_["__"])('Save draft'); if (!isLargeViewport) { - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { + return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { className: "editor-post-save-draft", label: label, - onClick: onSave, + onClick: function onClick() { + return onSave(); + }, shortcut: external_this_wp_keycodes_["displayShortcut"].primary('s'), - icon: "cloud-upload" + icon: cloud_upload }); } return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { className: "editor-post-save-draft", - onClick: onSave, + onClick: function onClick() { + return onSave(); + }, shortcut: external_this_wp_keycodes_["displayShortcut"].primary('s'), isTertiary: true }, label); @@ -11271,9 +11589,11 @@ return PostSavedState; }(external_this_wp_element_["Component"]); -/* harmony default export */ var post_saved_state = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref) { - var forceIsDirty = _ref.forceIsDirty, - forceIsSaving = _ref.forceIsSaving; +/* harmony default export */ var post_saved_state = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref2) { + var _getCurrentPost$_link, _getCurrentPost, _getCurrentPost$_link2; + + var forceIsDirty = _ref2.forceIsDirty, + forceIsSaving = _ref2.forceIsSaving; var _select = select('core/editor'), isEditedPostNew = _select.isEditedPostNew, @@ -11287,7 +11607,7 @@ getEditedPostAttribute = _select.getEditedPostAttribute; return { - post: getCurrentPost(), + hasPublishAction: (_getCurrentPost$_link = (_getCurrentPost = getCurrentPost()) === null || _getCurrentPost === void 0 ? void 0 : (_getCurrentPost$_link2 = _getCurrentPost['_links']) === null || _getCurrentPost$_link2 === void 0 ? void 0 : _getCurrentPost$_link2['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false, isNew: isEditedPostNew(), isPublished: isCurrentPostPublished(), isScheduled: isCurrentPostScheduled(), @@ -11302,7 +11622,7 @@ onSave: dispatch('core/editor').savePost }; }), external_this_wp_compose_["withSafeTimeout"], Object(external_this_wp_viewport_["withViewportMatch"])({ - isLargeViewport: 'medium' + isLargeViewport: 'small' })])(post_saved_state_PostSavedState)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/check.js @@ -11332,11 +11652,142 @@ getCurrentPostType = _select.getCurrentPostType; return { - hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), + hasPublishAction: Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), postType: getCurrentPostType() }; })])(PostScheduleCheck)); +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/check.js + + +/** + * Internal dependencies + */ + +function PostSlugCheck(_ref) { + var children = _ref.children; + return Object(external_this_wp_element_["createElement"])(post_type_support_check, { + supportKeys: "slug" + }, children); +} + +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/index.js + + + + + + + + +function post_slug_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (post_slug_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } + +function post_slug_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + +var post_slug_PostSlug = /*#__PURE__*/function (_Component) { + Object(inherits["a" /* default */])(PostSlug, _Component); + + var _super = post_slug_createSuper(PostSlug); + + function PostSlug(_ref) { + var _this; + + var postSlug = _ref.postSlug, + postTitle = _ref.postTitle, + postID = _ref.postID; + + Object(classCallCheck["a" /* default */])(this, PostSlug); + + _this = _super.apply(this, arguments); + _this.state = { + editedSlug: Object(external_this_wp_url_["safeDecodeURIComponent"])(postSlug) || cleanForSlug(postTitle) || postID + }; + _this.setSlug = _this.setSlug.bind(Object(assertThisInitialized["a" /* default */])(_this)); + return _this; + } + + Object(createClass["a" /* default */])(PostSlug, [{ + key: "setSlug", + value: function setSlug(event) { + var _this$props = this.props, + postSlug = _this$props.postSlug, + onUpdateSlug = _this$props.onUpdateSlug; + var value = event.target.value; + var editedSlug = cleanForSlug(value); + + if (editedSlug === postSlug) { + return; + } + + onUpdateSlug(editedSlug); + } + }, { + key: "render", + value: function render() { + var _this2 = this; + + var instanceId = this.props.instanceId; + var editedSlug = this.state.editedSlug; + var inputId = 'editor-post-slug-' + instanceId; + return Object(external_this_wp_element_["createElement"])(PostSlugCheck, null, Object(external_this_wp_element_["createElement"])("label", { + htmlFor: inputId + }, Object(external_this_wp_i18n_["__"])('Slug')), Object(external_this_wp_element_["createElement"])("input", { + type: "text", + id: inputId, + value: editedSlug, + onChange: function onChange(event) { + return _this2.setState({ + editedSlug: event.target.value + }); + }, + onBlur: this.setSlug, + className: "editor-post-slug__input" + })); + } + }]); + + return PostSlug; +}(external_this_wp_element_["Component"]); +/* harmony default export */ var post_slug = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { + var _select = select('core/editor'), + getCurrentPost = _select.getCurrentPost, + getEditedPostAttribute = _select.getEditedPostAttribute; + + var _getCurrentPost = getCurrentPost(), + id = _getCurrentPost.id; + + return { + postSlug: getEditedPostAttribute('slug'), + postTitle: getEditedPostAttribute('title'), + postID: id + }; +}), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { + var _dispatch = dispatch('core/editor'), + editPost = _dispatch.editPost; + + return { + onUpdateSlug: function onUpdateSlug(slug) { + editPost({ + slug: slug + }); + } + }; +}), external_this_wp_compose_["withInstanceId"]])(post_slug_PostSlug)); + // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/check.js /** * External dependencies @@ -11362,7 +11813,7 @@ /* harmony default export */ var post_sticky_check = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { var post = select('core/editor').getCurrentPost(); return { - hasStickyAction: Object(external_lodash_["get"])(post, ['_links', 'wp:action-sticky'], false), + hasStickyAction: Object(external_this_lodash_["get"])(post, ['_links', 'wp:action-sticky'], false), postType: select('core/editor').getCurrentPostType() }; })])(PostStickyCheck)); @@ -11419,6 +11870,13 @@ +function hierarchical_term_selector_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function hierarchical_term_selector_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { hierarchical_term_selector_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { hierarchical_term_selector_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function hierarchical_term_selector_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (hierarchical_term_selector_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } + +function hierarchical_term_selector_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } /** * External dependencies @@ -11452,25 +11910,25 @@ }; var MIN_TERMS_COUNT_FOR_FILTER = 8; -var hierarchical_term_selector_HierarchicalTermSelector = -/*#__PURE__*/ -function (_Component) { +var hierarchical_term_selector_HierarchicalTermSelector = /*#__PURE__*/function (_Component) { Object(inherits["a" /* default */])(HierarchicalTermSelector, _Component); + var _super = hierarchical_term_selector_createSuper(HierarchicalTermSelector); + function HierarchicalTermSelector() { var _this; Object(classCallCheck["a" /* default */])(this, HierarchicalTermSelector); - _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(HierarchicalTermSelector).apply(this, arguments)); - _this.findTerm = _this.findTerm.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.onChange = _this.onChange.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.onChangeFormName = _this.onChangeFormName.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.onChangeFormParent = _this.onChangeFormParent.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.onAddTerm = _this.onAddTerm.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.onToggleForm = _this.onToggleForm.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.setFilterValue = _this.setFilterValue.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.sortBySelected = _this.sortBySelected.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); + _this = _super.apply(this, arguments); + _this.findTerm = _this.findTerm.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.onChange = _this.onChange.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.onChangeFormName = _this.onChangeFormName.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.onChangeFormParent = _this.onChangeFormParent.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.onAddTerm = _this.onAddTerm.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.onToggleForm = _this.onToggleForm.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.setFilterValue = _this.setFilterValue.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.sortBySelected = _this.sortBySelected.bind(Object(assertThisInitialized["a" /* default */])(_this)); _this.state = { loading: true, availableTermsTree: [], @@ -11487,15 +11945,14 @@ Object(createClass["a" /* default */])(HierarchicalTermSelector, [{ key: "onChange", - value: function onChange(event) { + value: function onChange(termId) { var _this$props = this.props, onUpdateTerms = _this$props.onUpdateTerms, _this$props$terms = _this$props.terms, terms = _this$props$terms === void 0 ? [] : _this$props$terms, taxonomy = _this$props.taxonomy; - var termId = parseInt(event.target.value, 10); var hasTerm = terms.indexOf(termId) !== -1; - var newTerms = hasTerm ? Object(external_lodash_["without"])(terms, termId) : [].concat(Object(toConsumableArray["a" /* default */])(terms), [termId]); + var newTerms = hasTerm ? Object(external_this_lodash_["without"])(terms, termId) : [].concat(Object(toConsumableArray["a" /* default */])(terms), [termId]); onUpdateTerms(newTerms, taxonomy.rest_base); } }, { @@ -11525,7 +11982,7 @@ }, { key: "findTerm", value: function findTerm(terms, parent, name) { - return Object(external_lodash_["find"])(terms, function (term) { + return Object(external_this_lodash_["find"])(terms, function (term) { return (!term.parent && !parent || parseInt(term.parent) === parseInt(parent)) && term.name.toLowerCase() === name.toLowerCase(); }); } @@ -11555,7 +12012,7 @@ if (existingTerm) { // if the term we are adding exists but is not selected select it - if (!Object(external_lodash_["some"])(terms, function (term) { + if (!Object(external_this_lodash_["some"])(terms, function (term) { return term === existingTerm.id; })) { onUpdateTerms([].concat(Object(toConsumableArray["a" /* default */])(terms), [existingTerm.id]), taxonomy.rest_base); @@ -11586,7 +12043,7 @@ if (errorCode === 'term_exists') { // search the new category created since last fetch _this2.addRequest = external_this_wp_apiFetch_default()({ - path: Object(external_this_wp_url_["addQueryArgs"])("/wp/v2/".concat(taxonomy.rest_base), Object(objectSpread["a" /* default */])({}, hierarchical_term_selector_DEFAULT_QUERY, { + path: Object(external_this_wp_url_["addQueryArgs"])("/wp/v2/".concat(taxonomy.rest_base), hierarchical_term_selector_objectSpread({}, hierarchical_term_selector_DEFAULT_QUERY, { parent: formParent || 0, search: formName })) @@ -11599,11 +12056,13 @@ return Promise.reject(error); }); findOrCreatePromise.then(function (term) { - var hasTerm = !!Object(external_lodash_["find"])(_this2.state.availableTerms, function (availableTerm) { + var hasTerm = !!Object(external_this_lodash_["find"])(_this2.state.availableTerms, function (availableTerm) { return availableTerm.id === term.id; }); var newAvailableTerms = hasTerm ? _this2.state.availableTerms : [term].concat(Object(toConsumableArray["a" /* default */])(_this2.state.availableTerms)); - var termAddedMessage = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_x"])('%s added', 'term'), Object(external_lodash_["get"])(_this2.props.taxonomy, ['labels', 'singular_name'], slug === 'category' ? Object(external_this_wp_i18n_["__"])('Category') : Object(external_this_wp_i18n_["__"])('Term'))); + var termAddedMessage = Object(external_this_wp_i18n_["sprintf"])( + /* translators: %s: taxonomy name */ + Object(external_this_wp_i18n_["_x"])('%s added', 'term'), Object(external_this_lodash_["get"])(_this2.props.taxonomy, ['labels', 'singular_name'], slug === 'category' ? Object(external_this_wp_i18n_["__"])('Category') : Object(external_this_wp_i18n_["__"])('Term'))); _this2.props.speak(termAddedMessage, 'assertive'); @@ -11638,8 +12097,8 @@ }, { key: "componentWillUnmount", value: function componentWillUnmount() { - Object(external_lodash_["invoke"])(this.fetchRequest, ['abort']); - Object(external_lodash_["invoke"])(this.addRequest, ['abort']); + Object(external_this_lodash_["invoke"])(this.fetchRequest, ['abort']); + Object(external_this_lodash_["invoke"])(this.addRequest, ['abort']); } }, { key: "componentDidUpdate", @@ -11761,7 +12220,9 @@ filteredTermsTree: filteredTermsTree }); var resultCount = getResultCount(filteredTermsTree); - var resultsFoundMessage = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_n"])('%d result found.', '%d results found.', resultCount), resultCount); + var resultsFoundMessage = Object(external_this_wp_i18n_["sprintf"])( + /* translators: %d: number of results */ + Object(external_this_wp_i18n_["_n"])('%d result found.', '%d results found.', resultCount), resultCount); this.props.debouncedSpeak(resultsFoundMessage, 'assertive'); } }, { @@ -11774,7 +12235,7 @@ // don't want to modify the original term. - var term = Object(objectSpread["a" /* default */])({}, originalTerm); // Map and filter the children, recursive so we deal with grandchildren + var term = hierarchical_term_selector_objectSpread({}, originalTerm); // Map and filter the children, recursive so we deal with grandchildren // and any deeper levels. @@ -11786,7 +12247,7 @@ // (i.e. some child matched at some point in the tree) then return it. - if (-1 !== term.name.toLowerCase().indexOf(filterValue) || term.children.length > 0) { + if (-1 !== term.name.toLowerCase().indexOf(filterValue.toLowerCase()) || term.children.length > 0) { return term; } // Otherwise, return false. After mapping, the list of terms will need // to have false values filtered out. @@ -11805,20 +12266,18 @@ var _this$props$terms2 = this.props.terms, terms = _this$props$terms2 === void 0 ? [] : _this$props$terms2; return renderedTerms.map(function (term) { - var id = "editor-post-taxonomies-hierarchical-term-".concat(term.id); return Object(external_this_wp_element_["createElement"])("div", { key: term.id, className: "editor-post-taxonomies__hierarchical-terms-choice" - }, Object(external_this_wp_element_["createElement"])("input", { - id: id, - className: "editor-post-taxonomies__hierarchical-terms-input", - type: "checkbox", + }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], { checked: terms.indexOf(term.id) !== -1, - value: term.id, - onChange: _this4.onChange - }), Object(external_this_wp_element_["createElement"])("label", { - htmlFor: id - }, Object(external_lodash_["unescape"])(term.name)), !!term.children.length && Object(external_this_wp_element_["createElement"])("div", { + onChange: function onChange() { + var termId = parseInt(term.id, 10); + + _this4.onChange(termId); + }, + label: Object(external_this_lodash_["unescape"])(term.name) + }), !!term.children.length && Object(external_this_wp_element_["createElement"])("div", { className: "editor-post-taxonomies__hierarchical-terms-subchoices" }, _this4.renderTerms(term.children))); }); @@ -11848,7 +12307,7 @@ filterValue = _this$state2.filterValue; var labelWithFallback = function labelWithFallback(labelProperty, fallbackIsCategory, fallbackIsNotCategory) { - return Object(external_lodash_["get"])(taxonomy, ['labels', labelProperty], slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory); + return Object(external_this_lodash_["get"])(taxonomy, ['labels', labelProperty], slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory); }; var newTermButtonLabel = labelWithFallback('add_new_item', Object(external_this_wp_i18n_["__"])('Add new category'), Object(external_this_wp_i18n_["__"])('Add new term')); @@ -11858,8 +12317,8 @@ var newTermSubmitLabel = newTermButtonLabel; var inputId = "editor-post-taxonomies__hierarchical-terms-input-".concat(instanceId); var filterInputId = "editor-post-taxonomies__hierarchical-terms-filter-".concat(instanceId); - var filterLabel = Object(external_lodash_["get"])(this.props.taxonomy, ['labels', 'search_items'], Object(external_this_wp_i18n_["__"])('Search Terms')); - var groupLabel = Object(external_lodash_["get"])(this.props.taxonomy, ['name'], Object(external_this_wp_i18n_["__"])('Terms')); + var filterLabel = Object(external_this_lodash_["get"])(this.props.taxonomy, ['labels', 'search_items'], Object(external_this_wp_i18n_["__"])('Search Terms')); + var groupLabel = Object(external_this_lodash_["get"])(this.props.taxonomy, ['name'], Object(external_this_wp_i18n_["__"])('Terms')); var showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER; return [showFilter && Object(external_this_wp_element_["createElement"])("label", { key: "filter-label", @@ -11903,11 +12362,10 @@ selectedId: formParent, tree: availableTermsTree }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { - isDefault: true, + isSecondary: true, type: "submit", className: "editor-post-taxonomies__hierarchical-terms-submit" }, newTermSubmitLabel))]; - /* eslint-enable jsx-a11y/no-onchange */ } }]); @@ -11925,8 +12383,8 @@ var taxonomy = getTaxonomy(slug); return { - hasCreateAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-create-' + taxonomy.rest_base], false) : false, - hasAssignAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-assign-' + taxonomy.rest_base], false) : false, + hasCreateAction: taxonomy ? Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-create-' + taxonomy.rest_base], false) : false, + hasAssignAction: taxonomy ? Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-assign-' + taxonomy.rest_base], false) : false, terms: taxonomy ? select('core/editor').getEditedPostAttribute(taxonomy.rest_base) : [], taxonomy: taxonomy }; @@ -11962,11 +12420,11 @@ var postType = _ref.postType, taxonomies = _ref.taxonomies, _ref$taxonomyWrapper = _ref.taxonomyWrapper, - taxonomyWrapper = _ref$taxonomyWrapper === void 0 ? external_lodash_["identity"] : _ref$taxonomyWrapper; - var availableTaxonomies = Object(external_lodash_["filter"])(taxonomies, function (taxonomy) { - return Object(external_lodash_["includes"])(taxonomy.types, postType); + taxonomyWrapper = _ref$taxonomyWrapper === void 0 ? external_this_lodash_["identity"] : _ref$taxonomyWrapper; + var availableTaxonomies = Object(external_this_lodash_["filter"])(taxonomies, function (taxonomy) { + return Object(external_this_lodash_["includes"])(taxonomy.types, postType); }); - var visibleTaxonomies = Object(external_lodash_["filter"])(availableTaxonomies, function (taxonomy) { + var visibleTaxonomies = Object(external_this_lodash_["filter"])(availableTaxonomies, function (taxonomy) { return taxonomy.visibility.show_ui; }); return visibleTaxonomies.map(function (taxonomy) { @@ -12002,8 +12460,8 @@ var postType = _ref.postType, taxonomies = _ref.taxonomies, children = _ref.children; - var hasTaxonomies = Object(external_lodash_["some"])(taxonomies, function (taxonomy) { - return Object(external_lodash_["includes"])(taxonomy.types, postType); + var hasTaxonomies = Object(external_this_lodash_["some"])(taxonomies, function (taxonomy) { + return Object(external_this_lodash_["includes"])(taxonomy.types, postType); }); if (!hasTaxonomies) { @@ -12022,8 +12480,8 @@ })])(PostTaxonomiesCheck)); // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js -var react_autosize_textarea_lib = __webpack_require__(61); -var react_autosize_textarea_lib_default = /*#__PURE__*/__webpack_require__.n(react_autosize_textarea_lib); +var lib = __webpack_require__(97); +var lib_default = /*#__PURE__*/__webpack_require__.n(lib); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-text-editor/index.js @@ -12034,6 +12492,10 @@ +function post_text_editor_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (post_text_editor_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } + +function post_text_editor_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + /** * External dependencies */ @@ -12047,19 +12509,20 @@ -var post_text_editor_PostTextEditor = -/*#__PURE__*/ -function (_Component) { + +var post_text_editor_PostTextEditor = /*#__PURE__*/function (_Component) { Object(inherits["a" /* default */])(PostTextEditor, _Component); + var _super = post_text_editor_createSuper(PostTextEditor); + function PostTextEditor() { var _this; Object(classCallCheck["a" /* default */])(this, PostTextEditor); - _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostTextEditor).apply(this, arguments)); - _this.edit = _this.edit.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.stopEditing = _this.stopEditing.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); + _this = _super.apply(this, arguments); + _this.edit = _this.edit.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.stopEditing = _this.stopEditing.bind(Object(assertThisInitialized["a" /* default */])(_this)); _this.state = {}; return _this; } @@ -12107,10 +12570,10 @@ value: function render() { var value = this.state.value; var instanceId = this.props.instanceId; - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("label", { - htmlFor: "post-content-".concat(instanceId), - className: "screen-reader-text" - }, Object(external_this_wp_i18n_["__"])('Type text or HTML')), Object(external_this_wp_element_["createElement"])(react_autosize_textarea_lib_default.a, { + return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["VisuallyHidden"], { + as: "label", + htmlFor: "post-content-".concat(instanceId) + }, Object(external_this_wp_i18n_["__"])('Type text or HTML')), Object(external_this_wp_element_["createElement"])(lib_default.a, { autoComplete: "off", dir: "auto", value: value, @@ -12162,139 +12625,19 @@ }; }), external_this_wp_compose_["withInstanceId"]])(post_text_editor_PostTextEditor)); -// EXTERNAL MODULE: external {"this":["wp","htmlEntities"]} -var external_this_wp_htmlEntities_ = __webpack_require__(57); - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-permalink/editor.js - - - - - - - - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - - -var editor_PostPermalinkEditor = -/*#__PURE__*/ -function (_Component) { - Object(inherits["a" /* default */])(PostPermalinkEditor, _Component); - - function PostPermalinkEditor(_ref) { - var _this; - - var permalinkParts = _ref.permalinkParts, - slug = _ref.slug; - - Object(classCallCheck["a" /* default */])(this, PostPermalinkEditor); - - _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostPermalinkEditor).apply(this, arguments)); - _this.state = { - editedPostName: slug || permalinkParts.postName - }; - _this.onSavePermalink = _this.onSavePermalink.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - return _this; - } - - Object(createClass["a" /* default */])(PostPermalinkEditor, [{ - key: "onSavePermalink", - value: function onSavePermalink(event) { - var postName = cleanForSlug(this.state.editedPostName); - event.preventDefault(); - this.props.onSave(); - - if (postName === this.props.postName) { - return; - } - - this.props.editPost({ - slug: postName - }); - this.setState({ - editedPostName: postName - }); - } - }, { - key: "render", - value: function render() { - var _this2 = this; - - var _this$props$permalink = this.props.permalinkParts, - prefix = _this$props$permalink.prefix, - suffix = _this$props$permalink.suffix; - var editedPostName = this.state.editedPostName; - /* eslint-disable jsx-a11y/no-autofocus */ - // Autofocus is allowed here, as this mini-UI is only loaded when the user clicks to open it. - - return Object(external_this_wp_element_["createElement"])("form", { - className: "editor-post-permalink-editor", - onSubmit: this.onSavePermalink - }, Object(external_this_wp_element_["createElement"])("span", { - className: "editor-post-permalink__editor-container" - }, Object(external_this_wp_element_["createElement"])("span", { - className: "editor-post-permalink-editor__prefix" - }, prefix), Object(external_this_wp_element_["createElement"])("input", { - className: "editor-post-permalink-editor__edit", - "aria-label": Object(external_this_wp_i18n_["__"])('Edit post permalink'), - value: editedPostName, - onChange: function onChange(event) { - return _this2.setState({ - editedPostName: event.target.value - }); - }, - type: "text", - autoFocus: true - }), Object(external_this_wp_element_["createElement"])("span", { - className: "editor-post-permalink-editor__suffix" - }, suffix), "\u200E"), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { - className: "editor-post-permalink-editor__save", - isLarge: true, - onClick: this.onSavePermalink - }, Object(external_this_wp_i18n_["__"])('Save'))); - /* eslint-enable jsx-a11y/no-autofocus */ - } - }]); - - return PostPermalinkEditor; -}(external_this_wp_element_["Component"]); - -/* harmony default export */ var post_permalink_editor = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { - var _select = select('core/editor'), - getPermalinkParts = _select.getPermalinkParts; - - return { - permalinkParts: getPermalinkParts() - }; -}), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { - var _dispatch = dispatch('core/editor'), - editPost = _dispatch.editPost; - - return { - editPost: editPost - }; -})])(editor_PostPermalinkEditor)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-permalink/index.js - - - - - - - +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-title/index.js + + + + + + + + + +function post_title_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (post_title_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } + +function post_title_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } /** * External dependencies @@ -12311,205 +12654,6 @@ -/** - * Internal dependencies - */ - - - - -var post_permalink_PostPermalink = -/*#__PURE__*/ -function (_Component) { - Object(inherits["a" /* default */])(PostPermalink, _Component); - - function PostPermalink() { - var _this; - - Object(classCallCheck["a" /* default */])(this, PostPermalink); - - _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostPermalink).apply(this, arguments)); - _this.addVisibilityCheck = _this.addVisibilityCheck.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.onVisibilityChange = _this.onVisibilityChange.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.state = { - isCopied: false, - isEditingPermalink: false - }; - return _this; - } - - Object(createClass["a" /* default */])(PostPermalink, [{ - key: "addVisibilityCheck", - value: function addVisibilityCheck() { - window.addEventListener('visibilitychange', this.onVisibilityChange); - } - }, { - key: "onVisibilityChange", - value: function onVisibilityChange() { - var _this$props = this.props, - isEditable = _this$props.isEditable, - refreshPost = _this$props.refreshPost; // If the user just returned after having clicked the "Change Permalinks" button, - // fetch a new copy of the post from the server, just in case they enabled permalinks. - - if (!isEditable && 'visible' === document.visibilityState) { - refreshPost(); - } - } - }, { - key: "componentDidUpdate", - value: function componentDidUpdate(prevProps, prevState) { - // If we've just stopped editing the permalink, focus on the new permalink. - if (prevState.isEditingPermalink && !this.state.isEditingPermalink) { - this.linkElement.focus(); - } - } - }, { - key: "componentWillUnmount", - value: function componentWillUnmount() { - window.removeEventListener('visibilitychange', this.addVisibilityCheck); - } - }, { - key: "render", - value: function render() { - var _this2 = this; - - var _this$props2 = this.props, - isEditable = _this$props2.isEditable, - isNew = _this$props2.isNew, - isPublished = _this$props2.isPublished, - isViewable = _this$props2.isViewable, - permalinkParts = _this$props2.permalinkParts, - postLink = _this$props2.postLink, - postSlug = _this$props2.postSlug, - postID = _this$props2.postID, - postTitle = _this$props2.postTitle; - - if (isNew || !isViewable || !permalinkParts || !postLink) { - return null; - } - - var _this$state = this.state, - isCopied = _this$state.isCopied, - isEditingPermalink = _this$state.isEditingPermalink; - var ariaLabel = isCopied ? Object(external_this_wp_i18n_["__"])('Permalink copied') : Object(external_this_wp_i18n_["__"])('Copy the permalink'); - var prefix = permalinkParts.prefix, - suffix = permalinkParts.suffix; - var slug = Object(external_this_wp_url_["safeDecodeURIComponent"])(postSlug) || cleanForSlug(postTitle) || postID; - var samplePermalink = isEditable ? prefix + slug + suffix : prefix; - return Object(external_this_wp_element_["createElement"])("div", { - className: "editor-post-permalink" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ClipboardButton"], { - className: classnames_default()('editor-post-permalink__copy', { - 'is-copied': isCopied - }), - text: samplePermalink, - label: ariaLabel, - onCopy: function onCopy() { - return _this2.setState({ - isCopied: true - }); - }, - "aria-disabled": isCopied, - icon: "admin-links" - }), Object(external_this_wp_element_["createElement"])("span", { - className: "editor-post-permalink__label" - }, Object(external_this_wp_i18n_["__"])('Permalink:')), !isEditingPermalink && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ExternalLink"], { - className: "editor-post-permalink__link", - href: !isPublished ? postLink : samplePermalink, - target: "_blank", - ref: function ref(linkElement) { - return _this2.linkElement = linkElement; - } - }, Object(external_this_wp_url_["safeDecodeURI"])(samplePermalink), "\u200E"), isEditingPermalink && Object(external_this_wp_element_["createElement"])(post_permalink_editor, { - slug: slug, - onSave: function onSave() { - return _this2.setState({ - isEditingPermalink: false - }); - } - }), isEditable && !isEditingPermalink && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { - className: "editor-post-permalink__edit", - isLarge: true, - onClick: function onClick() { - return _this2.setState({ - isEditingPermalink: true - }); - } - }, Object(external_this_wp_i18n_["__"])('Edit')), !isEditable && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { - className: "editor-post-permalink__change", - isLarge: true, - href: getWPAdminURL('options-permalink.php'), - onClick: this.addVisibilityCheck, - target: "_blank" - }, Object(external_this_wp_i18n_["__"])('Change Permalinks'))); - } - }]); - - return PostPermalink; -}(external_this_wp_element_["Component"]); - -/* harmony default export */ var post_permalink = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { - var _select = select('core/editor'), - isEditedPostNew = _select.isEditedPostNew, - isPermalinkEditable = _select.isPermalinkEditable, - getCurrentPost = _select.getCurrentPost, - getPermalinkParts = _select.getPermalinkParts, - getEditedPostAttribute = _select.getEditedPostAttribute, - isCurrentPostPublished = _select.isCurrentPostPublished; - - var _select2 = select('core'), - getPostType = _select2.getPostType; - - var _getCurrentPost = getCurrentPost(), - id = _getCurrentPost.id, - link = _getCurrentPost.link; - - var postTypeName = getEditedPostAttribute('type'); - var postType = getPostType(postTypeName); - return { - isNew: isEditedPostNew(), - postLink: link, - permalinkParts: getPermalinkParts(), - postSlug: getEditedPostAttribute('slug'), - isEditable: isPermalinkEditable(), - isPublished: isCurrentPostPublished(), - postTitle: getEditedPostAttribute('title'), - postID: id, - isViewable: Object(external_lodash_["get"])(postType, ['viewable'], false) - }; -}), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { - var _dispatch = dispatch('core/editor'), - refreshPost = _dispatch.refreshPost; - - return { - refreshPost: refreshPost - }; -})])(post_permalink_PostPermalink)); - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-title/index.js - - - - - - - - -/** - * External dependencies - */ - - - -/** - * WordPress dependencies - */ - - - - - - /** @@ -12517,29 +12661,28 @@ */ - /** * Constants */ var REGEXP_NEWLINES = /[\r\n]+/g; -var post_title_PostTitle = -/*#__PURE__*/ -function (_Component) { +var post_title_PostTitle = /*#__PURE__*/function (_Component) { Object(inherits["a" /* default */])(PostTitle, _Component); + var _super = post_title_createSuper(PostTitle); + function PostTitle() { var _this; Object(classCallCheck["a" /* default */])(this, PostTitle); - _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PostTitle).apply(this, arguments)); - _this.onChange = _this.onChange.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.onSelect = _this.onSelect.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.onUnselect = _this.onUnselect.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.onKeyDown = _this.onKeyDown.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); - _this.redirectHistory = _this.redirectHistory.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); + _this = _super.apply(this, arguments); + _this.onChange = _this.onChange.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.onSelect = _this.onSelect.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.onUnselect = _this.onUnselect.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.onKeyDown = _this.onKeyDown.bind(Object(assertThisInitialized["a" /* default */])(_this)); + _this.onPaste = _this.onPaste.bind(Object(assertThisInitialized["a" /* default */])(_this)); _this.state = { isSelected: false }; @@ -12547,11 +12690,6 @@ } Object(createClass["a" /* default */])(PostTitle, [{ - key: "handleFocusOutside", - value: function handleFocusOutside() { - this.onUnselect(); - } - }, { key: "onSelect", value: function onSelect() { this.setState({ @@ -12580,42 +12718,69 @@ this.props.onEnterPress(); } } - /** - * Emulates behavior of an undo or redo on its corresponding key press - * combination. This is a workaround to React's treatment of undo in a - * controlled textarea where characters are updated one at a time. - * Instead, leverage the store's undo handling of title changes. - * - * @see https://github.com/facebook/react/issues/8514 - * - * @param {KeyboardEvent} event Key event. - */ - - }, { - key: "redirectHistory", - value: function redirectHistory(event) { - if (event.shiftKey) { - this.props.onRedo(); - } else { - this.props.onUndo(); - } - - event.preventDefault(); + }, { + key: "onPaste", + value: function onPaste(event) { + var _this$props = this.props, + title = _this$props.title, + onInsertBlockAfter = _this$props.onInsertBlockAfter, + onUpdate = _this$props.onUpdate; + var clipboardData = event.clipboardData; + var plainText = ''; + var html = ''; // IE11 only supports `Text` as an argument for `getData` and will + // otherwise throw an invalid argument error, so we try the standard + // arguments first, then fallback to `Text` if they fail. + + try { + plainText = clipboardData.getData('text/plain'); + html = clipboardData.getData('text/html'); + } catch (error1) { + try { + html = clipboardData.getData('Text'); + } catch (error2) { + // Some browsers like UC Browser paste plain text by default and + // don't support clipboardData at all, so allow default + // behaviour. + return; + } + } // Allows us to ask for this information when we get a report. + + + window.console.log('Received HTML:\n\n', html); + window.console.log('Received plain text:\n\n', plainText); + var content = Object(external_this_wp_blocks_["pasteHandler"])({ + HTML: html, + plainText: plainText + }); + + if (typeof content !== 'string' && content.length) { + event.preventDefault(); + + var _content = Object(slicedToArray["a" /* default */])(content, 1), + firstBlock = _content[0]; + + if (!title && (firstBlock.name === 'core/heading' || firstBlock.name === 'core/paragraph')) { + onUpdate(firstBlock.attributes.content); + onInsertBlockAfter(content.slice(1)); + } else { + onInsertBlockAfter(content); + } + } } }, { key: "render", value: function render() { - var _this$props = this.props, - hasFixedToolbar = _this$props.hasFixedToolbar, - isCleanNewPost = _this$props.isCleanNewPost, - isFocusMode = _this$props.isFocusMode, - isPostTypeViewable = _this$props.isPostTypeViewable, - instanceId = _this$props.instanceId, - placeholder = _this$props.placeholder, - title = _this$props.title; + var _this$props2 = this.props, + hasFixedToolbar = _this$props2.hasFixedToolbar, + isCleanNewPost = _this$props2.isCleanNewPost, + isFocusMode = _this$props2.isFocusMode, + instanceId = _this$props2.instanceId, + placeholder = _this$props2.placeholder, + title = _this$props2.title; var isSelected = this.state.isSelected; // The wp-block className is important for editor styles. - - var className = classnames_default()('wp-block editor-post-title__block', { + // This same block is used in both the visual and the code editor. + + var className = classnames_default()('wp-block editor-post-title editor-post-title__block', { 'is-selected': isSelected, 'is-focus-mode': isFocusMode, 'has-fixed-toolbar': hasFixedToolbar @@ -12624,26 +12789,21 @@ return Object(external_this_wp_element_["createElement"])(post_type_support_check, { supportKeys: "title" }, Object(external_this_wp_element_["createElement"])("div", { - className: "editor-post-title" - }, Object(external_this_wp_element_["createElement"])("div", { className: className - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["KeyboardShortcuts"], { - shortcuts: { - 'mod+z': this.redirectHistory, - 'mod+shift+z': this.redirectHistory - } - }, Object(external_this_wp_element_["createElement"])("label", { - htmlFor: "post-title-".concat(instanceId), - className: "screen-reader-text" - }, decodedPlaceholder || Object(external_this_wp_i18n_["__"])('Add title')), Object(external_this_wp_element_["createElement"])(react_autosize_textarea_lib_default.a, { + }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["VisuallyHidden"], { + as: "label", + htmlFor: "post-title-".concat(instanceId) + }, decodedPlaceholder || Object(external_this_wp_i18n_["__"])('Add title')), Object(external_this_wp_element_["createElement"])(lib_default.a, { id: "post-title-".concat(instanceId), className: "editor-post-title__input", value: title, onChange: this.onChange, placeholder: decodedPlaceholder || Object(external_this_wp_i18n_["__"])('Add title'), onFocus: this.onSelect, + onBlur: this.onUnselect, onKeyDown: this.onKeyDown, - onKeyPress: this.onUnselect + onKeyPress: this.onUnselect, + onPaste: this.onPaste /* Only autofocus the title when the post is entirely empty. This should only happen for a new post, which means we @@ -12653,10 +12813,10 @@ /* eslint-disable jsx-a11y/no-autofocus */ , - autoFocus: isCleanNewPost + autoFocus: (document.body === document.activeElement || !document.activeElement) && isCleanNewPost /* eslint-enable jsx-a11y/no-autofocus */ - })), isSelected && isPostTypeViewable && Object(external_this_wp_element_["createElement"])(post_permalink, null)))); + }))); } }]); @@ -12671,11 +12831,6 @@ var _select2 = select('core/block-editor'), getSettings = _select2.getSettings; - var _select3 = select('core'), - getPostType = _select3.getPostType; - - var postType = getPostType(getEditedPostAttribute('type')); - var _getSettings = getSettings(), titlePlaceholder = _getSettings.titlePlaceholder, focusMode = _getSettings.focusMode, @@ -12684,7 +12839,6 @@ return { isCleanNewPost: isCleanNewPost(), title: getEditedPostAttribute('title'), - isPostTypeViewable: Object(external_lodash_["get"])(postType, ['viewable'], false), placeholder: titlePlaceholder, isFocusMode: focusMode, hasFixedToolbar: hasFixedToolbar @@ -12693,28 +12847,28 @@ var post_title_applyWithDispatch = Object(external_this_wp_data_["withDispatch"])(function (dispatch) { var _dispatch = dispatch('core/block-editor'), insertDefaultBlock = _dispatch.insertDefaultBlock, - clearSelectedBlock = _dispatch.clearSelectedBlock; + clearSelectedBlock = _dispatch.clearSelectedBlock, + insertBlocks = _dispatch.insertBlocks; var _dispatch2 = dispatch('core/editor'), - editPost = _dispatch2.editPost, - undo = _dispatch2.undo, - redo = _dispatch2.redo; + editPost = _dispatch2.editPost; return { onEnterPress: function onEnterPress() { insertDefaultBlock(undefined, undefined, 0); }, + onInsertBlockAfter: function onInsertBlockAfter(blocks) { + insertBlocks(blocks, 0); + }, onUpdate: function onUpdate(title) { editPost({ title: title }); }, - onUndo: undo, - onRedo: redo, clearSelectedBlock: clearSelectedBlock }; }); -/* harmony default export */ var post_title = (Object(external_this_wp_compose_["compose"])(post_title_applyWithSelect, post_title_applyWithDispatch, external_this_wp_compose_["withInstanceId"], external_this_wp_components_["withFocusOutside"])(post_title_PostTitle)); +/* harmony default export */ var post_title = (Object(external_this_wp_compose_["compose"])(post_title_applyWithSelect, post_title_applyWithDispatch, external_this_wp_compose_["withInstanceId"])(post_title_PostTitle)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/index.js @@ -12743,10 +12897,10 @@ }; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { - className: "editor-post-trash button-link-delete", - onClick: onClick, - isDefault: true, - isLarge: true + className: "editor-post-trash", + isDestructive: true, + isTertiary: true, + onClick: onClick }, Object(external_this_wp_i18n_["__"])('Move to trash')); } @@ -12776,9 +12930,10 @@ function PostTrashCheck(_ref) { var isNew = _ref.isNew, postId = _ref.postId, + canUserDelete = _ref.canUserDelete, children = _ref.children; - if (isNew || !postId) { + if (isNew || !postId || !canUserDelete) { return null; } @@ -12788,11 +12943,20 @@ /* harmony default export */ var post_trash_check = (Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), isEditedPostNew = _select.isEditedPostNew, - getCurrentPostId = _select.getCurrentPostId; - + getCurrentPostId = _select.getCurrentPostId, + getCurrentPostType = _select.getCurrentPostType; + + var _select2 = select('core'), + getPostType = _select2.getPostType, + canUser = _select2.canUser; + + var postId = getCurrentPostId(); + var postType = getPostType(getCurrentPostType()); + var resource = (postType === null || postType === void 0 ? void 0 : postType['rest_base']) || ''; return { isNew: isEditedPostNew(), - postId: getCurrentPostId() + postId: postId, + canUserDelete: postId && resource ? canUser('delete', resource, postId) : false }; })(PostTrashCheck)); @@ -12821,13 +12985,28 @@ getCurrentPostType = _select.getCurrentPostType; return { - hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), + hasPublishAction: Object(external_this_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), postType: getCurrentPostType() }; })])(PostVisibilityCheck)); +// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/info.js + + +/** + * WordPress dependencies + */ + +var info_info = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { + d: "M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z" +})); +/* harmony default export */ var library_info = (info_info); + // EXTERNAL MODULE: external {"this":["wp","wordcount"]} -var external_this_wp_wordcount_ = __webpack_require__(98); +var external_this_wp_wordcount_ = __webpack_require__(147); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/word-count/index.js @@ -12868,7 +13047,6 @@ */ - /** * Internal dependencies */ @@ -12877,55 +13055,75 @@ function TableOfContentsPanel(_ref) { - var headingCount = _ref.headingCount, - paragraphCount = _ref.paragraphCount, - numberOfBlocks = _ref.numberOfBlocks, - hasOutlineItemsDisabled = _ref.hasOutlineItemsDisabled, + var hasOutlineItemsDisabled = _ref.hasOutlineItemsDisabled, onRequestClose = _ref.onRequestClose; - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("div", { - className: "table-of-contents__counts", - role: "note", - "aria-label": Object(external_this_wp_i18n_["__"])('Document Statistics'), - tabIndex: "0" - }, Object(external_this_wp_element_["createElement"])("div", { - className: "table-of-contents__count" - }, Object(external_this_wp_i18n_["__"])('Words'), Object(external_this_wp_element_["createElement"])(word_count, null)), Object(external_this_wp_element_["createElement"])("div", { - className: "table-of-contents__count" - }, Object(external_this_wp_i18n_["__"])('Headings'), Object(external_this_wp_element_["createElement"])("span", { - className: "table-of-contents__number" - }, headingCount)), Object(external_this_wp_element_["createElement"])("div", { - className: "table-of-contents__count" - }, Object(external_this_wp_i18n_["__"])('Paragraphs'), Object(external_this_wp_element_["createElement"])("span", { - className: "table-of-contents__number" - }, paragraphCount)), Object(external_this_wp_element_["createElement"])("div", { - className: "table-of-contents__count" - }, Object(external_this_wp_i18n_["__"])('Blocks'), Object(external_this_wp_element_["createElement"])("span", { - className: "table-of-contents__number" - }, numberOfBlocks))), headingCount > 0 && Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("hr", null), Object(external_this_wp_element_["createElement"])("span", { - className: "table-of-contents__title" - }, Object(external_this_wp_i18n_["__"])('Document Outline')), Object(external_this_wp_element_["createElement"])(document_outline, { - onSelect: onRequestClose, - hasOutlineItemsDisabled: hasOutlineItemsDisabled - }))); -} - -/* harmony default export */ var panel = (Object(external_this_wp_data_["withSelect"])(function (select) { - var _select = select('core/block-editor'), - getGlobalBlockCount = _select.getGlobalBlockCount; - - return { - headingCount: getGlobalBlockCount('core/heading'), - paragraphCount: getGlobalBlockCount('core/paragraph'), - numberOfBlocks: getGlobalBlockCount() - }; -})(TableOfContentsPanel)); + + var _useSelect = Object(external_this_wp_data_["useSelect"])(function (select) { + var _select = select('core/block-editor'), + getGlobalBlockCount = _select.getGlobalBlockCount; + + return { + headingCount: getGlobalBlockCount('core/heading'), + paragraphCount: getGlobalBlockCount('core/paragraph'), + numberOfBlocks: getGlobalBlockCount() + }; + }, []), + headingCount = _useSelect.headingCount, + paragraphCount = _useSelect.paragraphCount, + numberOfBlocks = _useSelect.numberOfBlocks; + + return ( + /* + * Disable reason: The `list` ARIA role is redundant but + * Safari+VoiceOver won't announce the list otherwise. + */ + + /* eslint-disable jsx-a11y/no-redundant-roles */ + Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("div", { + className: "table-of-contents__wrapper", + role: "note", + "aria-label": Object(external_this_wp_i18n_["__"])('Document Statistics'), + tabIndex: "0" + }, Object(external_this_wp_element_["createElement"])("ul", { + role: "list", + className: "table-of-contents__counts" + }, Object(external_this_wp_element_["createElement"])("li", { + className: "table-of-contents__count" + }, Object(external_this_wp_i18n_["__"])('Words'), Object(external_this_wp_element_["createElement"])(word_count, null)), Object(external_this_wp_element_["createElement"])("li", { + className: "table-of-contents__count" + }, Object(external_this_wp_i18n_["__"])('Headings'), Object(external_this_wp_element_["createElement"])("span", { + className: "table-of-contents__number" + }, headingCount)), Object(external_this_wp_element_["createElement"])("li", { + className: "table-of-contents__count" + }, Object(external_this_wp_i18n_["__"])('Paragraphs'), Object(external_this_wp_element_["createElement"])("span", { + className: "table-of-contents__number" + }, paragraphCount)), Object(external_this_wp_element_["createElement"])("li", { + className: "table-of-contents__count" + }, Object(external_this_wp_i18n_["__"])('Blocks'), Object(external_this_wp_element_["createElement"])("span", { + className: "table-of-contents__number" + }, numberOfBlocks)))), headingCount > 0 && Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("hr", null), Object(external_this_wp_element_["createElement"])("h2", { + className: "table-of-contents__title" + }, Object(external_this_wp_i18n_["__"])('Document Outline')), Object(external_this_wp_element_["createElement"])(document_outline, { + onSelect: onRequestClose, + hasOutlineItemsDisabled: hasOutlineItemsDisabled + }))) + /* eslint-enable jsx-a11y/no-redundant-roles */ + + ); +} + +/* harmony default export */ var panel = (TableOfContentsPanel); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/index.js -/** - * WordPress dependencies - */ + + +/** + * WordPress dependencies + */ + + @@ -12935,9 +13133,13 @@ -function TableOfContents(_ref) { - var hasBlocks = _ref.hasBlocks, - hasOutlineItemsDisabled = _ref.hasOutlineItemsDisabled; +function TableOfContents(_ref, ref) { + var hasOutlineItemsDisabled = _ref.hasOutlineItemsDisabled, + props = Object(objectWithoutProperties["a" /* default */])(_ref, ["hasOutlineItemsDisabled"]); + + var hasBlocks = Object(external_this_wp_data_["useSelect"])(function (select) { + return !!select('core/block-editor').getBlockCount(); + }, []); return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Dropdown"], { position: "bottom", className: "table-of-contents", @@ -12945,14 +13147,15 @@ renderToggle: function renderToggle(_ref2) { var isOpen = _ref2.isOpen, onToggle = _ref2.onToggle; - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { + return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, { + ref: ref, onClick: hasBlocks ? onToggle : undefined, - icon: "info-outline", + icon: library_info, "aria-expanded": isOpen, label: Object(external_this_wp_i18n_["__"])('Content structure'), - labelPosition: "bottom", + tooltipPosition: "bottom", "aria-disabled": !hasBlocks - }); + })); }, renderContent: function renderContent(_ref3) { var onClose = _ref3.onClose; @@ -12964,11 +13167,7 @@ }); } -/* harmony default export */ var table_of_contents = (Object(external_this_wp_data_["withSelect"])(function (select) { - return { - hasBlocks: !!select('core/block-editor').getBlockCount() - }; -})(TableOfContents)); +/* harmony default export */ var table_of_contents = (Object(external_this_wp_element_["forwardRef"])(TableOfContents)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/unsaved-changes-warning/index.js @@ -12978,25 +13177,29 @@ -/** - * WordPress dependencies - */ - - - - -var unsaved_changes_warning_UnsavedChangesWarning = -/*#__PURE__*/ -function (_Component) { +function unsaved_changes_warning_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (unsaved_changes_warning_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } + +function unsaved_changes_warning_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +/** + * WordPress dependencies + */ + + + + +var unsaved_changes_warning_UnsavedChangesWarning = /*#__PURE__*/function (_Component) { Object(inherits["a" /* default */])(UnsavedChangesWarning, _Component); + var _super = unsaved_changes_warning_createSuper(UnsavedChangesWarning); + function UnsavedChangesWarning() { var _this; Object(classCallCheck["a" /* default */])(this, UnsavedChangesWarning); - _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(UnsavedChangesWarning).apply(this, arguments)); - _this.warnIfUnsavedChanges = _this.warnIfUnsavedChanges.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); + _this = _super.apply(this, arguments); + _this.warnIfUnsavedChanges = _this.warnIfUnsavedChanges.bind(Object(assertThisInitialized["a" /* default */])(_this)); return _this; } @@ -13021,9 +13224,9 @@ }, { key: "warnIfUnsavedChanges", value: function warnIfUnsavedChanges(event) { - var isDirty = this.props.isDirty; - - if (isDirty) { + var isEditedPostDirty = this.props.isEditedPostDirty; + + if (isEditedPostDirty()) { event.returnValue = Object(external_this_wp_i18n_["__"])('You have unsaved changes. If you proceed, they will be lost.'); return event.returnValue; } @@ -13040,1411 +13243,24 @@ /* harmony default export */ var unsaved_changes_warning = (Object(external_this_wp_data_["withSelect"])(function (select) { return { - isDirty: select('core/editor').isEditedPostDirty() + // We need to call the selector directly in the listener to avoid race + // conditions with `BrowserURL` where `componentDidUpdate` gets the + // new value of `isEditedPostDirty` before this component does, + // causing this component to incorrectly think a trashed post is still dirty. + isEditedPostDirty: select('core/editor').isEditedPostDirty }; })(unsaved_changes_warning_UnsavedChangesWarning)); -// EXTERNAL MODULE: ./node_modules/memize/index.js -var memize = __webpack_require__(41); -var memize_default = /*#__PURE__*/__webpack_require__.n(memize); - -// EXTERNAL MODULE: ./node_modules/traverse/index.js -var traverse = __webpack_require__(227); -var traverse_default = /*#__PURE__*/__webpack_require__.n(traverse); - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/editor-styles/ast/parse.js - - -/* eslint-disable @wordpress/no-unused-vars-before-return */ -// Adapted from https://github.com/reworkcss/css -// because we needed to remove source map support. -// http://www.w3.org/TR/CSS21/grammar.htm -// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027 -var commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g; -/* harmony default export */ var parse = (function (css, options) { - options = options || {}; - /** - * Positional. - */ - - var lineno = 1; - var column = 1; - /** - * Update lineno and column based on `str`. - */ - - function updatePosition(str) { - var lines = str.match(/\n/g); - - if (lines) { - lineno += lines.length; - } - - var i = str.lastIndexOf('\n'); // eslint-disable-next-line no-bitwise - - column = ~i ? str.length - i : column + str.length; - } - /** - * Mark position and patch `node.position`. - */ - - - function position() { - var start = { - line: lineno, - column: column - }; - return function (node) { - node.position = new Position(start); - whitespace(); - return node; - }; - } - /** - * Store position information for a node - */ - - - function Position(start) { - this.start = start; - this.end = { - line: lineno, - column: column - }; - this.source = options.source; - } - /** - * Non-enumerable source string - */ - - - Position.prototype.content = css; - /** - * Error `msg`. - */ - - var errorsList = []; - - function error(msg) { - var err = new Error(options.source + ':' + lineno + ':' + column + ': ' + msg); - err.reason = msg; - err.filename = options.source; - err.line = lineno; - err.column = column; - err.source = css; - - if (options.silent) { - errorsList.push(err); - } else { - throw err; - } - } - /** - * Parse stylesheet. - */ - - - function stylesheet() { - var rulesList = rules(); - return { - type: 'stylesheet', - stylesheet: { - source: options.source, - rules: rulesList, - parsingErrors: errorsList - } - }; - } - /** - * Opening brace. - */ - - - function open() { - return match(/^{\s*/); - } - /** - * Closing brace. - */ - - - function close() { - return match(/^}/); - } - /** - * Parse ruleset. - */ - - - function rules() { - var node; - var accumulator = []; - whitespace(); - comments(accumulator); - - while (css.length && css.charAt(0) !== '}' && (node = atrule() || rule())) { - if (node !== false) { - accumulator.push(node); - comments(accumulator); - } - } - - return accumulator; - } - /** - * Match `re` and return captures. - */ - - - function match(re) { - var m = re.exec(css); - - if (!m) { - return; - } - - var str = m[0]; - updatePosition(str); - css = css.slice(str.length); - return m; - } - /** - * Parse whitespace. - */ - - - function whitespace() { - match(/^\s*/); - } - /** - * Parse comments; - */ - - - function comments(accumulator) { - var c; - accumulator = accumulator || []; // eslint-disable-next-line no-cond-assign - - while (c = comment()) { - if (c !== false) { - accumulator.push(c); - } - } - - return accumulator; - } - /** - * Parse comment. - */ - - - function comment() { - var pos = position(); - - if ('/' !== css.charAt(0) || '*' !== css.charAt(1)) { - return; - } - - var i = 2; - - while ('' !== css.charAt(i) && ('*' !== css.charAt(i) || '/' !== css.charAt(i + 1))) { - ++i; - } - - i += 2; - - if ('' === css.charAt(i - 1)) { - return error('End of comment missing'); - } - - var str = css.slice(2, i - 2); - column += 2; - updatePosition(str); - css = css.slice(i); - column += 2; - return pos({ - type: 'comment', - comment: str - }); - } - /** - * Parse selector. - */ - - - function selector() { - var m = match(/^([^{]+)/); - - if (!m) { - return; - } - /* @fix Remove all comments from selectors - * http://ostermiller.org/findcomment.html */ - - - return trim(m[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, '').replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, function (matched) { - return matched.replace(/,/g, "\u200C"); - }).split(/\s*(?![^(]*\)),\s*/).map(function (s) { - return s.replace(/\u200C/g, ','); - }); - } - /** - * Parse declaration. - */ - - - function declaration() { - var pos = position(); // prop - - var prop = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/); - - if (!prop) { - return; - } - - prop = trim(prop[0]); // : - - if (!match(/^:\s*/)) { - return error("property missing ':'"); - } // val - - - var val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/); - var ret = pos({ - type: 'declaration', - property: prop.replace(commentre, ''), - value: val ? trim(val[0]).replace(commentre, '') : '' - }); // ; - - match(/^[;\s]*/); - return ret; - } - /** - * Parse declarations. - */ - - - function declarations() { - var decls = []; - - if (!open()) { - return error("missing '{'"); - } - - comments(decls); // declarations - - var decl; // eslint-disable-next-line no-cond-assign - - while (decl = declaration()) { - if (decl !== false) { - decls.push(decl); - comments(decls); - } - } - - if (!close()) { - return error("missing '}'"); - } - - return decls; - } - /** - * Parse keyframe. - */ - - - function keyframe() { - var m; - var vals = []; - var pos = position(); // eslint-disable-next-line no-cond-assign - - while (m = match(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/)) { - vals.push(m[1]); - match(/^,\s*/); - } - - if (!vals.length) { - return; - } - - return pos({ - type: 'keyframe', - values: vals, - declarations: declarations() - }); - } - /** - * Parse keyframes. - */ - - - function atkeyframes() { - var pos = position(); - var m = match(/^@([-\w]+)?keyframes\s*/); - - if (!m) { - return; - } - - var vendor = m[1]; // identifier - - m = match(/^([-\w]+)\s*/); - - if (!m) { - return error('@keyframes missing name'); - } - - var name = m[1]; - - if (!open()) { - return error("@keyframes missing '{'"); - } - - var frame; - var frames = comments(); // eslint-disable-next-line no-cond-assign - - while (frame = keyframe()) { - frames.push(frame); - frames = frames.concat(comments()); - } - - if (!close()) { - return error("@keyframes missing '}'"); - } - - return pos({ - type: 'keyframes', - name: name, - vendor: vendor, - keyframes: frames - }); - } - /** - * Parse supports. - */ - - - function atsupports() { - var pos = position(); - var m = match(/^@supports *([^{]+)/); - - if (!m) { - return; - } - - var supports = trim(m[1]); - - if (!open()) { - return error("@supports missing '{'"); - } - - var style = comments().concat(rules()); - - if (!close()) { - return error("@supports missing '}'"); - } - - return pos({ - type: 'supports', - supports: supports, - rules: style - }); - } - /** - * Parse host. - */ - - - function athost() { - var pos = position(); - var m = match(/^@host\s*/); - - if (!m) { - return; - } - - if (!open()) { - return error("@host missing '{'"); - } - - var style = comments().concat(rules()); - - if (!close()) { - return error("@host missing '}'"); - } - - return pos({ - type: 'host', - rules: style - }); - } - /** - * Parse media. - */ - - - function atmedia() { - var pos = position(); - var m = match(/^@media *([^{]+)/); - - if (!m) { - return; - } - - var media = trim(m[1]); - - if (!open()) { - return error("@media missing '{'"); - } - - var style = comments().concat(rules()); - - if (!close()) { - return error("@media missing '}'"); - } - - return pos({ - type: 'media', - media: media, - rules: style - }); - } - /** - * Parse custom-media. - */ - - - function atcustommedia() { - var pos = position(); - var m = match(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/); - - if (!m) { - return; - } - - return pos({ - type: 'custom-media', - name: trim(m[1]), - media: trim(m[2]) - }); - } - /** - * Parse paged media. - */ - - - function atpage() { - var pos = position(); - var m = match(/^@page */); - - if (!m) { - return; - } - - var sel = selector() || []; - - if (!open()) { - return error("@page missing '{'"); - } - - var decls = comments(); // declarations - - var decl; // eslint-disable-next-line no-cond-assign - - while (decl = declaration()) { - decls.push(decl); - decls = decls.concat(comments()); - } - - if (!close()) { - return error("@page missing '}'"); - } - - return pos({ - type: 'page', - selectors: sel, - declarations: decls - }); - } - /** - * Parse document. - */ - - - function atdocument() { - var pos = position(); - var m = match(/^@([-\w]+)?document *([^{]+)/); - - if (!m) { - return; - } - - var vendor = trim(m[1]); - var doc = trim(m[2]); - - if (!open()) { - return error("@document missing '{'"); - } - - var style = comments().concat(rules()); - - if (!close()) { - return error("@document missing '}'"); - } - - return pos({ - type: 'document', - document: doc, - vendor: vendor, - rules: style - }); - } - /** - * Parse font-face. - */ - - - function atfontface() { - var pos = position(); - var m = match(/^@font-face\s*/); - - if (!m) { - return; - } - - if (!open()) { - return error("@font-face missing '{'"); - } - - var decls = comments(); // declarations - - var decl; // eslint-disable-next-line no-cond-assign - - while (decl = declaration()) { - decls.push(decl); - decls = decls.concat(comments()); - } - - if (!close()) { - return error("@font-face missing '}'"); - } - - return pos({ - type: 'font-face', - declarations: decls - }); - } - /** - * Parse import - */ - - - var atimport = _compileAtrule('import'); - /** - * Parse charset - */ - - - var atcharset = _compileAtrule('charset'); - /** - * Parse namespace - */ - - - var atnamespace = _compileAtrule('namespace'); - /** - * Parse non-block at-rules - */ - - - function _compileAtrule(name) { - var re = new RegExp('^@' + name + '\\s*([^;]+);'); - return function () { - var pos = position(); - var m = match(re); - - if (!m) { - return; - } - - var ret = { - type: name - }; - ret[name] = m[1].trim(); - return pos(ret); - }; - } - /** - * Parse at rule. - */ - - - function atrule() { - if (css[0] !== '@') { - return; - } - - return atkeyframes() || atmedia() || atcustommedia() || atsupports() || atimport() || atcharset() || atnamespace() || atdocument() || atpage() || athost() || atfontface(); - } - /** - * Parse rule. - */ - - - function rule() { - var pos = position(); - var sel = selector(); - - if (!sel) { - return error('selector missing'); - } - - comments(); - return pos({ - type: 'rule', - selectors: sel, - declarations: declarations() - }); - } - - return addParent(stylesheet()); -}); -/** - * Trim `str`. - */ - -function trim(str) { - return str ? str.replace(/^\s+|\s+$/g, '') : ''; -} -/** - * Adds non-enumerable parent node reference to each node. - */ - - -function addParent(obj, parent) { - var isNode = obj && typeof obj.type === 'string'; - var childParent = isNode ? obj : parent; - - for (var k in obj) { - var value = obj[k]; - - if (Array.isArray(value)) { - value.forEach(function (v) { - addParent(v, childParent); - }); - } else if (value && Object(esm_typeof["a" /* default */])(value) === 'object') { - addParent(value, childParent); - } - } - - if (isNode) { - Object.defineProperty(obj, 'parent', { - configurable: true, - writable: true, - enumerable: false, - value: parent || null - }); - } - - return obj; -} - -// EXTERNAL MODULE: ./node_modules/inherits/inherits_browser.js -var inherits_browser = __webpack_require__(109); -var inherits_browser_default = /*#__PURE__*/__webpack_require__.n(inherits_browser); - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/editor-styles/ast/stringify/compiler.js -// Adapted from https://github.com/reworkcss/css -// because we needed to remove source map support. - -/** - * Expose `Compiler`. - */ -/* harmony default export */ var stringify_compiler = (Compiler); -/** - * Initialize a compiler. - * - * @param {Type} name - * @return {Type} - * @api public - */ - -function Compiler(opts) { - this.options = opts || {}; -} -/** - * Emit `str` - */ - - -Compiler.prototype.emit = function (str) { - return str; -}; -/** - * Visit `node`. - */ - - -Compiler.prototype.visit = function (node) { - return this[node.type](node); -}; -/** - * Map visit over array of `nodes`, optionally using a `delim` - */ - - -Compiler.prototype.mapVisit = function (nodes, delim) { - var buf = ''; - delim = delim || ''; - - for (var i = 0, length = nodes.length; i < length; i++) { - buf += this.visit(nodes[i]); - - if (delim && i < length - 1) { - buf += this.emit(delim); - } - } - - return buf; -}; - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/editor-styles/ast/stringify/compress.js -// Adapted from https://github.com/reworkcss/css -// because we needed to remove source map support. - -/** - * External dependencies - */ - -/** - * Internal dependencies - */ - - -/** - * Expose compiler. - */ - -/* harmony default export */ var compress = (compress_Compiler); -/** - * Initialize a new `Compiler`. - */ - -function compress_Compiler(options) { - stringify_compiler.call(this, options); -} -/** - * Inherit from `Base.prototype`. - */ - - -inherits_browser_default()(compress_Compiler, stringify_compiler); -/** - * Compile `node`. - */ - -compress_Compiler.prototype.compile = function (node) { - return node.stylesheet.rules.map(this.visit, this).join(''); -}; -/** - * Visit comment node. - */ - - -compress_Compiler.prototype.comment = function (node) { - return this.emit('', node.position); -}; -/** - * Visit import node. - */ - - -compress_Compiler.prototype.import = function (node) { - return this.emit('@import ' + node.import + ';', node.position); -}; -/** - * Visit media node. - */ - - -compress_Compiler.prototype.media = function (node) { - return this.emit('@media ' + node.media, node.position) + this.emit('{') + this.mapVisit(node.rules) + this.emit('}'); -}; -/** - * Visit document node. - */ - - -compress_Compiler.prototype.document = function (node) { - var doc = '@' + (node.vendor || '') + 'document ' + node.document; - return this.emit(doc, node.position) + this.emit('{') + this.mapVisit(node.rules) + this.emit('}'); -}; -/** - * Visit charset node. - */ - - -compress_Compiler.prototype.charset = function (node) { - return this.emit('@charset ' + node.charset + ';', node.position); -}; -/** - * Visit namespace node. - */ - - -compress_Compiler.prototype.namespace = function (node) { - return this.emit('@namespace ' + node.namespace + ';', node.position); -}; -/** - * Visit supports node. - */ - - -compress_Compiler.prototype.supports = function (node) { - return this.emit('@supports ' + node.supports, node.position) + this.emit('{') + this.mapVisit(node.rules) + this.emit('}'); -}; -/** - * Visit keyframes node. - */ - - -compress_Compiler.prototype.keyframes = function (node) { - return this.emit('@' + (node.vendor || '') + 'keyframes ' + node.name, node.position) + this.emit('{') + this.mapVisit(node.keyframes) + this.emit('}'); -}; -/** - * Visit keyframe node. - */ - - -compress_Compiler.prototype.keyframe = function (node) { - var decls = node.declarations; - return this.emit(node.values.join(','), node.position) + this.emit('{') + this.mapVisit(decls) + this.emit('}'); -}; -/** - * Visit page node. - */ - - -compress_Compiler.prototype.page = function (node) { - var sel = node.selectors.length ? node.selectors.join(', ') : ''; - return this.emit('@page ' + sel, node.position) + this.emit('{') + this.mapVisit(node.declarations) + this.emit('}'); -}; -/** - * Visit font-face node. - */ - - -compress_Compiler.prototype['font-face'] = function (node) { - return this.emit('@font-face', node.position) + this.emit('{') + this.mapVisit(node.declarations) + this.emit('}'); -}; -/** - * Visit host node. - */ - - -compress_Compiler.prototype.host = function (node) { - return this.emit('@host', node.position) + this.emit('{') + this.mapVisit(node.rules) + this.emit('}'); -}; -/** - * Visit custom-media node. - */ - - -compress_Compiler.prototype['custom-media'] = function (node) { - return this.emit('@custom-media ' + node.name + ' ' + node.media + ';', node.position); -}; -/** - * Visit rule node. - */ - - -compress_Compiler.prototype.rule = function (node) { - var decls = node.declarations; - - if (!decls.length) { - return ''; - } - - return this.emit(node.selectors.join(','), node.position) + this.emit('{') + this.mapVisit(decls) + this.emit('}'); -}; -/** - * Visit declaration node. - */ - - -compress_Compiler.prototype.declaration = function (node) { - return this.emit(node.property + ':' + node.value, node.position) + this.emit(';'); -}; - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/editor-styles/ast/stringify/identity.js -/* eslint-disable @wordpress/no-unused-vars-before-return */ -// Adapted from https://github.com/reworkcss/css -// because we needed to remove source map support. - -/** - * External dependencies - */ - -/** - * Internal dependencies - */ - - -/** - * Expose compiler. - */ - -/* harmony default export */ var identity = (identity_Compiler); -/** - * Initialize a new `Compiler`. - */ - -function identity_Compiler(options) { - options = options || {}; - stringify_compiler.call(this, options); - this.indentation = options.indent; -} -/** - * Inherit from `Base.prototype`. - */ - - -inherits_browser_default()(identity_Compiler, stringify_compiler); -/** - * Compile `node`. - */ - -identity_Compiler.prototype.compile = function (node) { - return this.stylesheet(node); -}; -/** - * Visit stylesheet node. - */ - - -identity_Compiler.prototype.stylesheet = function (node) { - return this.mapVisit(node.stylesheet.rules, '\n\n'); -}; -/** - * Visit comment node. - */ - - -identity_Compiler.prototype.comment = function (node) { - return this.emit(this.indent() + '/*' + node.comment + '*/', node.position); -}; -/** - * Visit import node. - */ - - -identity_Compiler.prototype.import = function (node) { - return this.emit('@import ' + node.import + ';', node.position); -}; -/** - * Visit media node. - */ - - -identity_Compiler.prototype.media = function (node) { - return this.emit('@media ' + node.media, node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(node.rules, '\n\n') + this.emit(this.indent(-1) + '\n}'); -}; -/** - * Visit document node. - */ - - -identity_Compiler.prototype.document = function (node) { - var doc = '@' + (node.vendor || '') + 'document ' + node.document; - return this.emit(doc, node.position) + this.emit(' ' + ' {\n' + this.indent(1)) + this.mapVisit(node.rules, '\n\n') + this.emit(this.indent(-1) + '\n}'); -}; -/** - * Visit charset node. - */ - - -identity_Compiler.prototype.charset = function (node) { - return this.emit('@charset ' + node.charset + ';', node.position); -}; -/** - * Visit namespace node. - */ - - -identity_Compiler.prototype.namespace = function (node) { - return this.emit('@namespace ' + node.namespace + ';', node.position); -}; -/** - * Visit supports node. - */ - - -identity_Compiler.prototype.supports = function (node) { - return this.emit('@supports ' + node.supports, node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(node.rules, '\n\n') + this.emit(this.indent(-1) + '\n}'); -}; -/** - * Visit keyframes node. - */ - - -identity_Compiler.prototype.keyframes = function (node) { - return this.emit('@' + (node.vendor || '') + 'keyframes ' + node.name, node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(node.keyframes, '\n') + this.emit(this.indent(-1) + '}'); -}; -/** - * Visit keyframe node. - */ - - -identity_Compiler.prototype.keyframe = function (node) { - var decls = node.declarations; - return this.emit(this.indent()) + this.emit(node.values.join(', '), node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(decls, '\n') + this.emit(this.indent(-1) + '\n' + this.indent() + '}\n'); -}; -/** - * Visit page node. - */ - - -identity_Compiler.prototype.page = function (node) { - var sel = node.selectors.length ? node.selectors.join(', ') + ' ' : ''; - return this.emit('@page ' + sel, node.position) + this.emit('{\n') + this.emit(this.indent(1)) + this.mapVisit(node.declarations, '\n') + this.emit(this.indent(-1)) + this.emit('\n}'); -}; -/** - * Visit font-face node. - */ - - -identity_Compiler.prototype['font-face'] = function (node) { - return this.emit('@font-face ', node.position) + this.emit('{\n') + this.emit(this.indent(1)) + this.mapVisit(node.declarations, '\n') + this.emit(this.indent(-1)) + this.emit('\n}'); -}; -/** - * Visit host node. - */ - - -identity_Compiler.prototype.host = function (node) { - return this.emit('@host', node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(node.rules, '\n\n') + this.emit(this.indent(-1) + '\n}'); -}; -/** - * Visit custom-media node. - */ - - -identity_Compiler.prototype['custom-media'] = function (node) { - return this.emit('@custom-media ' + node.name + ' ' + node.media + ';', node.position); -}; -/** - * Visit rule node. - */ - - -identity_Compiler.prototype.rule = function (node) { - var indent = this.indent(); - var decls = node.declarations; - - if (!decls.length) { - return ''; - } - - return this.emit(node.selectors.map(function (s) { - return indent + s; - }).join(',\n'), node.position) + this.emit(' {\n') + this.emit(this.indent(1)) + this.mapVisit(decls, '\n') + this.emit(this.indent(-1)) + this.emit('\n' + this.indent() + '}'); -}; -/** - * Visit declaration node. - */ - - -identity_Compiler.prototype.declaration = function (node) { - return this.emit(this.indent()) + this.emit(node.property + ': ' + node.value, node.position) + this.emit(';'); -}; -/** - * Increase, decrease or return current indentation. - */ - - -identity_Compiler.prototype.indent = function (level) { - this.level = this.level || 1; - - if (null !== level) { - this.level += level; - return ''; - } - - return Array(this.level).join(this.indentation || ' '); -}; - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/editor-styles/ast/stringify/index.js -// Adapted from https://github.com/reworkcss/css -// because we needed to remove source map support. - -/** - * Internal dependencies - */ - - -/** - * Stringfy the given AST `node`. - * - * Options: - * - * - `compress` space-optimized output - * - `sourcemap` return an object with `.code` and `.map` - * - * @param {Object} node - * @param {Object} [options] - * @return {String} - * @api public - */ - -/* harmony default export */ var stringify = (function (node, options) { - options = options || {}; - var compiler = options.compress ? new compress(options) : new identity(options); - var code = compiler.compile(node); - return code; -}); - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/editor-styles/ast/index.js -// Adapted from https://github.com/reworkcss/css -// because we needed to remove source map support. - - - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/editor-styles/traverse.js -/** - * External dependencies - */ - -/** - * Internal dependencies - */ - - - -function traverseCSS(css, callback) { - try { - var parsed = parse(css); - var updated = traverse_default.a.map(parsed, function (node) { - if (!node) { - return node; - } - - var updatedNode = callback(node); - return this.update(updatedNode); - }); - return stringify(updated); - } catch (err) { - // eslint-disable-next-line no-console - console.warn('Error while traversing the CSS: ' + err); - return null; - } -} - -/* harmony default export */ var editor_styles_traverse = (traverseCSS); - -// EXTERNAL MODULE: ./node_modules/url/url.js -var url = __webpack_require__(84); - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/editor-styles/transforms/url-rewrite.js - - -/** - * External dependencies - */ - -/** - * Return `true` if the given path is http/https. - * - * @param {string} filePath path - * - * @return {boolean} is remote path. - */ - -function isRemotePath(filePath) { - return /^(?:https?:)?\/\//.test(filePath); -} -/** - * Return `true` if the given filePath is an absolute url. - * - * @param {string} filePath path - * - * @return {boolean} is absolute path. - */ - - -function isAbsolutePath(filePath) { - return /^\/(?!\/)/.test(filePath); -} -/** - * Whether or not the url should be inluded. - * - * @param {Object} meta url meta info - * - * @return {boolean} is valid. - */ - - -function isValidURL(meta) { - // ignore hashes or data uris - if (meta.value.indexOf('data:') === 0 || meta.value.indexOf('#') === 0) { - return false; - } - - if (isAbsolutePath(meta.value)) { - return false; - } // do not handle the http/https urls if `includeRemote` is false - - - if (isRemotePath(meta.value)) { - return false; - } - - return true; -} -/** - * Get the absolute path of the url, relative to the basePath - * - * @param {string} str the url - * @param {string} baseURL base URL - * @param {string} absolutePath the absolute path - * - * @return {string} the full path to the file - */ - - -function getResourcePath(str, baseURL) { - var pathname = Object(url["parse"])(str).pathname; - var filePath = Object(url["resolve"])(baseURL, pathname); - return filePath; -} -/** - * Process the single `url()` pattern - * - * @param {string} baseURL the base URL for relative URLs - * @return {Promise} the Promise - */ - - -function processURL(baseURL) { - return function (meta) { - var URL = getResourcePath(meta.value, baseURL); - return Object(objectSpread["a" /* default */])({}, meta, { - newUrl: 'url(' + meta.before + meta.quote + URL + meta.quote + meta.after + ')' - }); - }; -} -/** - * Get all `url()`s, and return the meta info - * - * @param {string} value decl.value - * - * @return {Array} the urls - */ - - -function getURLs(value) { - var reg = /url\((\s*)(['"]?)(.+?)\2(\s*)\)/g; - var match; - var URLs = []; - - while ((match = reg.exec(value)) !== null) { - var meta = { - source: match[0], - before: match[1], - quote: match[2], - value: match[3], - after: match[4] - }; - - if (isValidURL(meta)) { - URLs.push(meta); - } - } - - return URLs; -} -/** - * Replace the raw value's `url()` segment to the new value - * - * @param {string} raw the raw value - * @param {Array} URLs the URLs to replace - * - * @return {string} the new value - */ - - -function replaceURLs(raw, URLs) { - URLs.forEach(function (item) { - raw = raw.replace(item.source, item.newUrl); - }); - return raw; -} - -var url_rewrite_rewrite = function rewrite(rootURL) { - return function (node) { - if (node.type === 'declaration') { - var updatedURLs = getURLs(node.value).map(processURL(rootURL)); - return Object(objectSpread["a" /* default */])({}, node, { - value: replaceURLs(node.value, updatedURLs) - }); - } - - return node; - }; -}; - -/* harmony default export */ var url_rewrite = (url_rewrite_rewrite); - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/editor-styles/transforms/wrap.js - - -/** - * External dependencies - */ - -/** - * @const string IS_ROOT_TAG Regex to check if the selector is a root tag selector. - */ - -var IS_ROOT_TAG = /^(body|html|:root).*$/; - -var wrap_wrap = function wrap(namespace) { - var ignore = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; - return function (node) { - var updateSelector = function updateSelector(selector) { - if (Object(external_lodash_["includes"])(ignore, selector.trim())) { - return selector; - } // Anything other than a root tag is always prefixed. - - - { - if (!selector.match(IS_ROOT_TAG)) { - return namespace + ' ' + selector; - } - } // HTML and Body elements cannot be contained within our container so lets extract their styles. - - return selector.replace(/^(body|html|:root)/, namespace); - }; - - if (node.type === 'rule') { - return Object(objectSpread["a" /* default */])({}, node, { - selectors: node.selectors.map(updateSelector) - }); - } - - return node; - }; -}; - -/* harmony default export */ var transforms_wrap = (wrap_wrap); - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/editor-styles/index.js -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/with-registry-provider.js + + + + +/** + * WordPress dependencies + */ + + /** @@ -14453,50 +13269,52 @@ - -/** - * Convert css rules. - * - * @param {Array} styles CSS rules. - * @param {string} wrapperClassName Wrapper Class Name. - * @return {Array} converted rules. - */ - -var editor_styles_transformStyles = function transformStyles(styles) { - var wrapperClassName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; - return Object(external_lodash_["map"])(styles, function (_ref) { - var css = _ref.css, - baseURL = _ref.baseURL; - var transforms = []; - - if (wrapperClassName) { - transforms.push(transforms_wrap(wrapperClassName)); - } - - if (baseURL) { - transforms.push(url_rewrite(baseURL)); - } - - if (transforms.length) { - return editor_styles_traverse(css, Object(external_this_wp_compose_["compose"])(transforms)); - } - - return css; +var withRegistryProvider = Object(external_this_wp_compose_["createHigherOrderComponent"])(function (WrappedComponent) { + return Object(external_this_wp_data_["withRegistry"])(function (props) { + var _props$useSubRegistry = props.useSubRegistry, + useSubRegistry = _props$useSubRegistry === void 0 ? true : _props$useSubRegistry, + registry = props.registry, + additionalProps = Object(objectWithoutProperties["a" /* default */])(props, ["useSubRegistry", "registry"]); + + if (!useSubRegistry) { + return Object(external_this_wp_element_["createElement"])(WrappedComponent, additionalProps); + } + + var _useState = Object(external_this_wp_element_["useState"])(null), + _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), + subRegistry = _useState2[0], + setSubRegistry = _useState2[1]; + + Object(external_this_wp_element_["useEffect"])(function () { + var newRegistry = Object(external_this_wp_data_["createRegistry"])({ + 'core/block-editor': external_this_wp_blockEditor_["storeConfig"] + }, registry); + var store = newRegistry.registerStore('core/editor', storeConfig); // This should be removed after the refactoring of the effects to controls. + + middlewares(store); + setSubRegistry(newRegistry); + }, [registry]); + + if (!subRegistry) { + return null; + } + + return Object(external_this_wp_element_["createElement"])(external_this_wp_data_["RegistryProvider"], { + value: subRegistry + }, Object(external_this_wp_element_["createElement"])(WrappedComponent, additionalProps)); }); -}; - -/* harmony default export */ var editor_styles = (editor_styles_transformStyles); - -// EXTERNAL MODULE: external {"this":["wp","blob"]} -var external_this_wp_blob_ = __webpack_require__(35); - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/media-upload/media-upload.js - - - - - - +}, 'withRegistryProvider'); +/* harmony default export */ var with_registry_provider = (withRegistryProvider); + +// EXTERNAL MODULE: external {"this":["wp","mediaUtils"]} +var external_this_wp_mediaUtils_ = __webpack_require__(152); + +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/media-upload/index.js + + +function media_upload_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function media_upload_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { media_upload_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { media_upload_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } /** * External dependencies @@ -14508,322 +13326,6 @@ - -/** - * Browsers may use unexpected mime types, and they differ from browser to browser. - * This function computes a flexible array of mime types from the mime type structured provided by the server. - * Converts { jpg|jpeg|jpe: "image/jpeg" } into [ "image/jpeg", "image/jpg", "image/jpeg", "image/jpe" ] - * The computation of this array instead of directly using the object, - * solves the problem in chrome where mp3 files have audio/mp3 as mime type instead of audio/mpeg. - * https://bugs.chromium.org/p/chromium/issues/detail?id=227004 - * - * @param {?Object} wpMimeTypesObject Mime type object received from the server. - * Extensions are keys separated by '|' and values are mime types associated with an extension. - * - * @return {?Array} An array of mime types or the parameter passed if it was "falsy". - */ - -function getMimeTypesArray(wpMimeTypesObject) { - if (!wpMimeTypesObject) { - return wpMimeTypesObject; - } - - return Object(external_lodash_["flatMap"])(wpMimeTypesObject, function (mime, extensionsString) { - var _mime$split = mime.split('/'), - _mime$split2 = Object(slicedToArray["a" /* default */])(_mime$split, 1), - type = _mime$split2[0]; - - var extensions = extensionsString.split('|'); - return [mime].concat(Object(toConsumableArray["a" /* default */])(Object(external_lodash_["map"])(extensions, function (extension) { - return "".concat(type, "/").concat(extension); - }))); - }); -} -/** - * Media Upload is used by audio, image, gallery, video, and file blocks to - * handle uploading a media file when a file upload button is activated. - * - * TODO: future enhancement to add an upload indicator. - * - * @param {Object} $0 Parameters object passed to the function. - * @param {?Array} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed. - * @param {?Object} $0.additionalData Additional data to include in the request. - * @param {Array} $0.filesList List of files. - * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site. - * @param {Function} $0.onError Function called when an error happens. - * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available. - * @param {?Object} $0.wpAllowedMimeTypes List of allowed mime types and file extensions. - */ - -function mediaUpload(_x) { - return _mediaUpload.apply(this, arguments); -} -/** - * @param {File} file Media File to Save. - * @param {?Object} additionalData Additional data to include in the request. - * - * @return {Promise} Media Object Promise. - */ - -function _mediaUpload() { - _mediaUpload = Object(asyncToGenerator["a" /* default */])( - /*#__PURE__*/ - regenerator_default.a.mark(function _callee(_ref) { - var allowedTypes, _ref$additionalData, additionalData, filesList, maxUploadFileSize, _ref$onError, onError, onFileChange, _ref$wpAllowedMimeTyp, wpAllowedMimeTypes, files, filesSet, setAndUpdateFiles, isAllowedType, allowedMimeTypesForUser, isAllowedMimeTypeForUser, triggerError, validFiles, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _mediaFile, idx, mediaFile, savedMedia, mediaObject, message; - - return regenerator_default.a.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - allowedTypes = _ref.allowedTypes, _ref$additionalData = _ref.additionalData, additionalData = _ref$additionalData === void 0 ? {} : _ref$additionalData, filesList = _ref.filesList, maxUploadFileSize = _ref.maxUploadFileSize, _ref$onError = _ref.onError, onError = _ref$onError === void 0 ? external_lodash_["noop"] : _ref$onError, onFileChange = _ref.onFileChange, _ref$wpAllowedMimeTyp = _ref.wpAllowedMimeTypes, wpAllowedMimeTypes = _ref$wpAllowedMimeTyp === void 0 ? null : _ref$wpAllowedMimeTyp; - // Cast filesList to array - files = Object(toConsumableArray["a" /* default */])(filesList); - filesSet = []; - - setAndUpdateFiles = function setAndUpdateFiles(idx, value) { - Object(external_this_wp_blob_["revokeBlobURL"])(Object(external_lodash_["get"])(filesSet, [idx, 'url'])); - filesSet[idx] = value; - onFileChange(Object(external_lodash_["compact"])(filesSet)); - }; // Allowed type specified by consumer - - - isAllowedType = function isAllowedType(fileType) { - if (!allowedTypes) { - return true; - } - - return Object(external_lodash_["some"])(allowedTypes, function (allowedType) { - // If a complete mimetype is specified verify if it matches exactly the mime type of the file. - if (Object(external_lodash_["includes"])(allowedType, '/')) { - return allowedType === fileType; - } // Otherwise a general mime type is used and we should verify if the file mimetype starts with it. - - - return Object(external_lodash_["startsWith"])(fileType, "".concat(allowedType, "/")); - }); - }; // Allowed types for the current WP_User - - - allowedMimeTypesForUser = getMimeTypesArray(wpAllowedMimeTypes); - - isAllowedMimeTypeForUser = function isAllowedMimeTypeForUser(fileType) { - return Object(external_lodash_["includes"])(allowedMimeTypesForUser, fileType); - }; // Build the error message including the filename - - - triggerError = function triggerError(error) { - error.message = [Object(external_this_wp_element_["createElement"])("strong", { - key: "filename" - }, error.file.name), ': ', error.message]; - onError(error); - }; - - validFiles = []; - _iteratorNormalCompletion = true; - _didIteratorError = false; - _iteratorError = undefined; - _context.prev = 12; - _iterator = files[Symbol.iterator](); - - case 14: - if (_iteratorNormalCompletion = (_step = _iterator.next()).done) { - _context.next = 34; - break; - } - - _mediaFile = _step.value; - - if (!(allowedMimeTypesForUser && !isAllowedMimeTypeForUser(_mediaFile.type))) { - _context.next = 19; - break; - } - - triggerError({ - code: 'MIME_TYPE_NOT_ALLOWED_FOR_USER', - message: Object(external_this_wp_i18n_["__"])('Sorry, this file type is not permitted for security reasons.'), - file: _mediaFile - }); - return _context.abrupt("continue", 31); - - case 19: - if (isAllowedType(_mediaFile.type)) { - _context.next = 22; - break; - } - - triggerError({ - code: 'MIME_TYPE_NOT_SUPPORTED', - message: Object(external_this_wp_i18n_["__"])('Sorry, this file type is not supported here.'), - file: _mediaFile - }); - return _context.abrupt("continue", 31); - - case 22: - if (!(maxUploadFileSize && _mediaFile.size > maxUploadFileSize)) { - _context.next = 25; - break; - } - - triggerError({ - code: 'SIZE_ABOVE_LIMIT', - message: Object(external_this_wp_i18n_["__"])('This file exceeds the maximum upload size for this site.'), - file: _mediaFile - }); - return _context.abrupt("continue", 31); - - case 25: - if (!(_mediaFile.size <= 0)) { - _context.next = 28; - break; - } - - triggerError({ - code: 'EMPTY_FILE', - message: Object(external_this_wp_i18n_["__"])('This file is empty.'), - file: _mediaFile - }); - return _context.abrupt("continue", 31); - - case 28: - validFiles.push(_mediaFile); // Set temporary URL to create placeholder media file, this is replaced - // with final file from media gallery when upload is `done` below - - filesSet.push({ - url: Object(external_this_wp_blob_["createBlobURL"])(_mediaFile) - }); - onFileChange(filesSet); - - case 31: - _iteratorNormalCompletion = true; - _context.next = 14; - break; - - case 34: - _context.next = 40; - break; - - case 36: - _context.prev = 36; - _context.t0 = _context["catch"](12); - _didIteratorError = true; - _iteratorError = _context.t0; - - case 40: - _context.prev = 40; - _context.prev = 41; - - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - - case 43: - _context.prev = 43; - - if (!_didIteratorError) { - _context.next = 46; - break; - } - - throw _iteratorError; - - case 46: - return _context.finish(43); - - case 47: - return _context.finish(40); - - case 48: - idx = 0; - - case 49: - if (!(idx < validFiles.length)) { - _context.next = 68; - break; - } - - mediaFile = validFiles[idx]; - _context.prev = 51; - _context.next = 54; - return createMediaFromFile(mediaFile, additionalData); - - case 54: - savedMedia = _context.sent; - mediaObject = Object(objectSpread["a" /* default */])({}, Object(external_lodash_["omit"])(savedMedia, ['alt_text', 'source_url']), { - alt: savedMedia.alt_text, - caption: Object(external_lodash_["get"])(savedMedia, ['caption', 'raw'], ''), - title: savedMedia.title.raw, - url: savedMedia.source_url - }); - setAndUpdateFiles(idx, mediaObject); - _context.next = 65; - break; - - case 59: - _context.prev = 59; - _context.t1 = _context["catch"](51); - // Reset to empty on failure. - setAndUpdateFiles(idx, null); - message = void 0; - - if (Object(external_lodash_["has"])(_context.t1, ['message'])) { - message = Object(external_lodash_["get"])(_context.t1, ['message']); - } else { - message = Object(external_this_wp_i18n_["sprintf"])( // translators: %s: file name - Object(external_this_wp_i18n_["__"])('Error while uploading file %s to the media library.'), mediaFile.name); - } - - onError({ - code: 'GENERAL', - message: message, - file: mediaFile - }); - - case 65: - ++idx; - _context.next = 49; - break; - - case 68: - case "end": - return _context.stop(); - } - } - }, _callee, this, [[12, 36, 40, 48], [41,, 43, 47], [51, 59]]); - })); - return _mediaUpload.apply(this, arguments); -} - -function createMediaFromFile(file, additionalData) { - // Create upload payload - var data = new window.FormData(); - data.append('file', file, file.name || file.type.replace('/', '.')); - Object(external_lodash_["forEach"])(additionalData, function (value, key) { - return data.append(key, value); - }); - return external_this_wp_apiFetch_default()({ - path: '/wp/v2/media', - body: data, - method: 'POST' - }); -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/media-upload/index.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - /** * Upload a media file when the file upload button is activated. * Wrapper around mediaUpload() that injects the current post ID. @@ -14837,14 +13339,14 @@ * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available. */ -/* harmony default export */ var media_upload = (function (_ref) { +function mediaUpload(_ref) { var _ref$additionalData = _ref.additionalData, additionalData = _ref$additionalData === void 0 ? {} : _ref$additionalData, allowedTypes = _ref.allowedTypes, filesList = _ref.filesList, maxUploadFileSize = _ref.maxUploadFileSize, _ref$onError = _ref.onError, - _onError = _ref$onError === void 0 ? external_lodash_["noop"] : _ref$onError, + _onError = _ref$onError === void 0 ? external_this_lodash_["noop"] : _ref$onError, onFileChange = _ref.onFileChange; var _select = Object(external_this_wp_data_["select"])('core/editor'), @@ -14853,11 +13355,11 @@ var wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes; maxUploadFileSize = maxUploadFileSize || getEditorSettings().maxUploadFileSize; - mediaUpload({ + Object(external_this_wp_mediaUtils_["uploadMedia"])({ allowedTypes: allowedTypes, filesList: filesList, onFileChange: onFileChange, - additionalData: Object(objectSpread["a" /* default */])({ + additionalData: media_upload_objectSpread({ post: getCurrentPostId() }, additionalData), maxUploadFileSize: maxUploadFileSize, @@ -14867,33 +13369,339 @@ }, wpAllowedMimeTypes: wpAllowedMimeTypes }); -}); - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/index.js -/** - * Internal dependencies - */ - - - - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/index.js - - - - - - +} + +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/reusable-blocks-buttons/reusable-block-convert-button.js /** * External dependencies */ - -/** - * WordPress dependencies - */ +/** + * WordPress dependencies + */ + + + + + + + +function ReusableBlockConvertButton(_ref) { + var isVisible = _ref.isVisible, + isReusable = _ref.isReusable, + onConvertToStatic = _ref.onConvertToStatic, + onConvertToReusable = _ref.onConvertToReusable; + + if (!isVisible) { + return null; + } + + return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockSettingsMenuControls"], null, function (_ref2) { + var onClose = _ref2.onClose; + return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, !isReusable && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], { + onClick: function onClick() { + onConvertToReusable(); + onClose(); + } + }, Object(external_this_wp_i18n_["__"])('Add to Reusable blocks')), isReusable && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], { + onClick: function onClick() { + onConvertToStatic(); + onClose(); + } + }, Object(external_this_wp_i18n_["__"])('Convert to Regular Block'))); + }); +} +/* harmony default export */ var reusable_block_convert_button = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref3) { + var clientIds = _ref3.clientIds; + + var _select = select('core/block-editor'), + getBlocksByClientId = _select.getBlocksByClientId, + canInsertBlockType = _select.canInsertBlockType; + + var _select2 = select('core/editor'), + getReusableBlock = _select2.__experimentalGetReusableBlock; + + var _select3 = select('core'), + canUser = _select3.canUser; + + var blocks = getBlocksByClientId(clientIds); + var isReusable = blocks.length === 1 && blocks[0] && Object(external_this_wp_blocks_["isReusableBlock"])(blocks[0]) && !!getReusableBlock(blocks[0].attributes.ref); // Show 'Convert to Regular Block' when selected block is a reusable block + + var isVisible = isReusable || // Hide 'Add to Reusable blocks' when reusable blocks are disabled + canInsertBlockType('core/block') && Object(external_this_lodash_["every"])(blocks, function (block) { + return (// Guard against the case where a regular block has *just* been converted + !!block && // Hide 'Add to Reusable blocks' on invalid blocks + block.isValid && // Hide 'Add to Reusable blocks' when block doesn't support being made reusable + Object(external_this_wp_blocks_["hasBlockSupport"])(block.name, 'reusable', true) + ); + }) && // Hide 'Add to Reusable blocks' when current doesn't have permission to do that + !!canUser('create', 'blocks'); + return { + isReusable: isReusable, + isVisible: isVisible + }; +}), Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref4) { + var clientIds = _ref4.clientIds; + + var _dispatch = dispatch('core/editor'), + convertBlockToReusable = _dispatch.__experimentalConvertBlockToReusable, + convertBlockToStatic = _dispatch.__experimentalConvertBlockToStatic; + + return { + onConvertToStatic: function onConvertToStatic() { + convertBlockToStatic(clientIds[0]); + }, + onConvertToReusable: function onConvertToReusable() { + convertBlockToReusable(clientIds); + } + }; +})])(ReusableBlockConvertButton)); + +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/reusable-blocks-buttons/reusable-block-delete-button.js + + +/** + * WordPress dependencies + */ + + + + + + +function ReusableBlockDeleteButton(_ref) { + var isVisible = _ref.isVisible, + isDisabled = _ref.isDisabled, + onDelete = _ref.onDelete; + + if (!isVisible) { + return null; + } + + return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockSettingsMenuControls"], null, function (_ref2) { + var onClose = _ref2.onClose; + return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], { + disabled: isDisabled, + onClick: function onClick() { + var hasConfirmed = onDelete(); + + if (hasConfirmed) { + onClose(); + } + } + }, Object(external_this_wp_i18n_["__"])('Remove from Reusable blocks')); + }); +} +/* harmony default export */ var reusable_block_delete_button = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref3) { + var clientId = _ref3.clientId; + + var _select = select('core/block-editor'), + getBlock = _select.getBlock; + + var _select2 = select('core'), + canUser = _select2.canUser; + + var _select3 = select('core/editor'), + getReusableBlock = _select3.__experimentalGetReusableBlock; + + var block = getBlock(clientId); + var reusableBlock = block && Object(external_this_wp_blocks_["isReusableBlock"])(block) ? getReusableBlock(block.attributes.ref) : null; + return { + isVisible: !!reusableBlock && (reusableBlock.isTemporary || !!canUser('delete', 'blocks', reusableBlock.id)), + isDisabled: reusableBlock && reusableBlock.isTemporary + }; +}), Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref4, _ref5) { + var clientId = _ref4.clientId; + var select = _ref5.select; + + var _dispatch = dispatch('core/editor'), + deleteReusableBlock = _dispatch.__experimentalDeleteReusableBlock; + + var _select4 = select('core/block-editor'), + getBlock = _select4.getBlock; + + return { + onDelete: function onDelete() { + // TODO: Make this a component or similar + // eslint-disable-next-line no-alert + var hasConfirmed = window.confirm( // eslint-disable-next-line @wordpress/i18n-no-collapsible-whitespace + Object(external_this_wp_i18n_["__"])('Are you sure you want to delete this Reusable Block?\n\n' + 'It will be permanently removed from all posts and pages that use it.')); + + if (hasConfirmed) { + var block = getBlock(clientId); + deleteReusableBlock(block.attributes.ref); + } + + return hasConfirmed; + } + }; +})])(ReusableBlockDeleteButton)); + +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/reusable-blocks-buttons/index.js + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + + + +function ReusableBlocksButtons(_ref) { + var clientIds = _ref.clientIds; + return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(reusable_block_convert_button, { + clientIds: clientIds + }), clientIds.length === 1 && Object(external_this_wp_element_["createElement"])(reusable_block_delete_button, { + clientId: clientIds[0] + })); +} + +/* harmony default export */ var reusable_blocks_buttons = (Object(external_this_wp_data_["withSelect"])(function (select) { + var _select = select('core/block-editor'), + getSelectedBlockClientIds = _select.getSelectedBlockClientIds; + + return { + clientIds: getSelectedBlockClientIds() + }; +})(ReusableBlocksButtons)); + +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/convert-to-group-buttons/index.js + + +/** + * WordPress dependencies + */ + + + + + + +function ConvertToGroupButton(_ref) { + var onConvertToGroup = _ref.onConvertToGroup, + onConvertFromGroup = _ref.onConvertFromGroup, + _ref$isGroupable = _ref.isGroupable, + isGroupable = _ref$isGroupable === void 0 ? false : _ref$isGroupable, + _ref$isUngroupable = _ref.isUngroupable, + isUngroupable = _ref$isUngroupable === void 0 ? false : _ref$isUngroupable; + + if (!isGroupable && !isUngroupable) { + return null; + } + + return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockSettingsMenuControls"], null, function (_ref2) { + var onClose = _ref2.onClose; + return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, isGroupable && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], { + onClick: function onClick() { + onConvertToGroup(); + onClose(); + } + }, Object(external_this_wp_i18n_["_x"])('Group', 'verb')), isUngroupable && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], { + onClick: function onClick() { + onConvertFromGroup(); + onClose(); + } + }, Object(external_this_wp_i18n_["_x"])('Ungroup', 'Ungrouping blocks from within a Group block back into individual blocks within the Editor '))); + }); +} +/* harmony default export */ var convert_to_group_buttons = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { + var _select = select('core/block-editor'), + getBlockRootClientId = _select.getBlockRootClientId, + getBlocksByClientId = _select.getBlocksByClientId, + canInsertBlockType = _select.canInsertBlockType, + getSelectedBlockClientIds = _select.getSelectedBlockClientIds; + + var _select2 = select('core/blocks'), + getGroupingBlockName = _select2.getGroupingBlockName; + + var clientIds = getSelectedBlockClientIds(); + var groupingBlockName = getGroupingBlockName(); + var rootClientId = clientIds && clientIds.length > 0 ? getBlockRootClientId(clientIds[0]) : undefined; + var groupingBlockAvailable = canInsertBlockType(groupingBlockName, rootClientId); + var blocksSelection = getBlocksByClientId(clientIds); + var isSingleGroupingBlock = blocksSelection.length === 1 && blocksSelection[0] && blocksSelection[0].name === groupingBlockName; // Do we have + // 1. Grouping block available to be inserted? + // 2. One or more blocks selected + // (we allow single Blocks to become groups unless + // they are a soltiary group block themselves) + + var isGroupable = groupingBlockAvailable && blocksSelection.length && !isSingleGroupingBlock; // Do we have a single Group Block selected and does that group have inner blocks? + + var isUngroupable = isSingleGroupingBlock && !!blocksSelection[0].innerBlocks.length; + return { + clientIds: clientIds, + isGroupable: isGroupable, + isUngroupable: isUngroupable, + blocksSelection: blocksSelection, + groupingBlockName: groupingBlockName + }; +}), Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref3) { + var clientIds = _ref3.clientIds, + _ref3$blocksSelection = _ref3.blocksSelection, + blocksSelection = _ref3$blocksSelection === void 0 ? [] : _ref3$blocksSelection, + groupingBlockName = _ref3.groupingBlockName; + + var _dispatch = dispatch('core/block-editor'), + replaceBlocks = _dispatch.replaceBlocks; + + return { + onConvertToGroup: function onConvertToGroup() { + // Activate the `transform` on the Grouping Block which does the conversion + var newBlocks = Object(external_this_wp_blocks_["switchToBlockType"])(blocksSelection, groupingBlockName); + + if (newBlocks) { + replaceBlocks(clientIds, newBlocks); + } + }, + onConvertFromGroup: function onConvertFromGroup() { + var innerBlocks = blocksSelection[0].innerBlocks; + + if (!innerBlocks.length) { + return; + } + + replaceBlocks(clientIds, innerBlocks); + } + }; +})])(ConvertToGroupButton)); + +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/index.js + + + + + + + + + + +function provider_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function provider_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { provider_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { provider_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function provider_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (provider_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } + +function provider_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + @@ -14907,19 +13715,82 @@ -var provider_EditorProvider = -/*#__PURE__*/ -function (_Component) { + +/** + * Fetches link suggestions from the API. This function is an exact copy of a function found at: + * + * wordpress/editor/src/components/provider/index.js + * + * It seems like there is no suitable package to import this from. Ideally it would be either part of core-data. + * Until we refactor it, just copying the code is the simplest solution. + * + * @param {Object} search + * @param {number} perPage + * @return {Promise} List of suggestions + */ + +var fetchLinkSuggestions = /*#__PURE__*/function () { + var _ref = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/external_this_regeneratorRuntime_default.a.mark(function _callee(search) { + var _ref2, + _ref2$perPage, + perPage, + posts, + _args = arguments; + + return external_this_regeneratorRuntime_default.a.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _ref2 = _args.length > 1 && _args[1] !== undefined ? _args[1] : {}, _ref2$perPage = _ref2.perPage, perPage = _ref2$perPage === void 0 ? 20 : _ref2$perPage; + _context.next = 3; + return external_this_wp_apiFetch_default()({ + path: Object(external_this_wp_url_["addQueryArgs"])('/wp/v2/search', { + search: search, + per_page: perPage, + type: 'post' + }) + }); + + case 3: + posts = _context.sent; + return _context.abrupt("return", Object(external_this_lodash_["map"])(posts, function (post) { + return { + id: post.id, + url: post.url, + title: Object(external_this_wp_htmlEntities_["decodeEntities"])(post.title) || Object(external_this_wp_i18n_["__"])('(no title)'), + type: post.subtype || post.type + }; + })); + + case 5: + case "end": + return _context.stop(); + } + } + }, _callee); + })); + + return function fetchLinkSuggestions(_x) { + return _ref.apply(this, arguments); + }; +}(); + +var provider_EditorProvider = /*#__PURE__*/function (_Component) { Object(inherits["a" /* default */])(EditorProvider, _Component); + var _super = provider_createSuper(EditorProvider); + function EditorProvider(props) { var _this; Object(classCallCheck["a" /* default */])(this, EditorProvider); - _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(EditorProvider).apply(this, arguments)); + _this = _super.apply(this, arguments); _this.getBlockEditorSettings = memize_default()(_this.getBlockEditorSettings, { maxSize: 1 + }); + _this.getDefaultBlockContext = memize_default()(_this.getDefaultBlockContext, { + maxSize: 1 }); // Assume that we don't need to initialize in the case of an error recovery. if (props.recovery) { @@ -14944,33 +13815,29 @@ Object(createClass["a" /* default */])(EditorProvider, [{ key: "getBlockEditorSettings", - value: function getBlockEditorSettings(settings, meta, onMetaChange, reusableBlocks) { - return Object(objectSpread["a" /* default */])({}, Object(external_lodash_["pick"])(settings, ['alignWide', 'allowedBlockTypes', 'availableLegacyWidgets', 'bodyPlaceholder', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'focusMode', 'fontSizes', 'hasFixedToolbar', 'hasPermissionsToManageWidgets', 'imageSizes', 'isRTL', 'maxWidth', 'styles', 'template', 'templateLock', 'titlePlaceholder']), { - __experimentalMetaSource: { - value: meta, - onChange: onMetaChange - }, + value: function getBlockEditorSettings(settings, reusableBlocks, __experimentalFetchReusableBlocks, hasUploadPermissions, canUserUseUnfilteredHTML, undo, shouldInsertAtTheTop) { + return provider_objectSpread({}, Object(external_this_lodash_["pick"])(settings, ['__experimentalBlockDirectory', '__experimentalBlockPatterns', '__experimentalBlockPatternCategories', '__experimentalEnableCustomSpacing', '__experimentalEnableLegacyWidgetBlock', '__experimentalEnableLinkColor', '__experimentalEnableFullSiteEditing', '__experimentalEnableFullSiteEditingDemo', '__experimentalFeatures', '__experimentalGlobalStylesUserEntityId', '__experimentalGlobalStylesBase', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', 'alignWide', 'allowedBlockTypes', 'availableLegacyWidgets', 'bodyPlaceholder', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomGradients', 'enableCustomUnits', 'enableCustomLineHeight', 'focusMode', 'fontSizes', 'gradients', 'hasFixedToolbar', 'hasPermissionsToManageWidgets', 'imageEditing', 'imageSizes', 'imageDimensions', 'isRTL', 'keepCaretInsideBlock', 'maxWidth', 'onUpdateDefaultBlockStyles', 'styles', 'template', 'templateLock', 'titlePlaceholder']), { + mediaUpload: hasUploadPermissions ? mediaUpload : undefined, __experimentalReusableBlocks: reusableBlocks, - __experimentalMediaUpload: media_upload - }); + __experimentalFetchReusableBlocks: __experimentalFetchReusableBlocks, + __experimentalFetchLinkSuggestions: fetchLinkSuggestions, + __experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML, + __experimentalUndo: undo, + __experimentalShouldInsertAtTheTop: shouldInsertAtTheTop + }); + } + }, { + key: "getDefaultBlockContext", + value: function getDefaultBlockContext(postId, postType) { + return { + postId: postId, + postType: postType + }; } }, { key: "componentDidMount", value: function componentDidMount() { this.props.updateEditorSettings(this.props.settings); - - if (!this.props.settings.styles) { - return; - } - - var updatedStyles = editor_styles(this.props.settings.styles, '.editor-styles-wrapper'); - Object(external_lodash_["map"])(updatedStyles, function (updatedCSS) { - if (updatedCSS) { - var node = document.createElement('style'); - node.innerHTML = updatedCSS; - document.body.appendChild(node); - } - }); } }, { key: "componentDidUpdate", @@ -14980,56 +13847,95 @@ } } }, { + key: "componentWillUnmount", + value: function componentWillUnmount() { + this.props.tearDownEditor(); + } + }, { key: "render", value: function render() { var _this$props = this.props, + canUserUseUnfilteredHTML = _this$props.canUserUseUnfilteredHTML, children = _this$props.children, + post = _this$props.post, blocks = _this$props.blocks, resetEditorBlocks = _this$props.resetEditorBlocks, + selectionStart = _this$props.selectionStart, + selectionEnd = _this$props.selectionEnd, isReady = _this$props.isReady, settings = _this$props.settings, - meta = _this$props.meta, - onMetaChange = _this$props.onMetaChange, reusableBlocks = _this$props.reusableBlocks, - resetEditorBlocksWithoutUndoLevel = _this$props.resetEditorBlocksWithoutUndoLevel; + resetEditorBlocksWithoutUndoLevel = _this$props.resetEditorBlocksWithoutUndoLevel, + hasUploadPermissions = _this$props.hasUploadPermissions, + isPostTitleSelected = _this$props.isPostTitleSelected, + __experimentalFetchReusableBlocks = _this$props.__experimentalFetchReusableBlocks, + undo = _this$props.undo; if (!isReady) { return null; } - var editorSettings = this.getBlockEditorSettings(settings, meta, onMetaChange, reusableBlocks); - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockEditorProvider"], { + var editorSettings = this.getBlockEditorSettings(settings, reusableBlocks, __experimentalFetchReusableBlocks, hasUploadPermissions, canUserUseUnfilteredHTML, undo, isPostTitleSelected); + var defaultBlockContext = this.getDefaultBlockContext(post.id, post.type); + return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__unstableEditorStyles"], { + styles: settings.styles + }), Object(external_this_wp_element_["createElement"])(external_this_wp_coreData_["EntityProvider"], { + kind: "root", + type: "site" + }, Object(external_this_wp_element_["createElement"])(external_this_wp_coreData_["EntityProvider"], { + kind: "postType", + type: post.type, + id: post.id + }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockContextProvider"], { + value: defaultBlockContext + }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockEditorProvider"], { value: blocks, onInput: resetEditorBlocksWithoutUndoLevel, onChange: resetEditorBlocks, - settings: editorSettings - }, children); + selectionStart: selectionStart, + selectionEnd: selectionEnd, + settings: editorSettings, + useSubRegistry: false + }, children, Object(external_this_wp_element_["createElement"])(reusable_blocks_buttons, null), Object(external_this_wp_element_["createElement"])(convert_to_group_buttons, null)))))); } }]); return EditorProvider; }(external_this_wp_element_["Component"]); -/* harmony default export */ var provider = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { +/* harmony default export */ var provider = (Object(external_this_wp_compose_["compose"])([with_registry_provider, Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), + canUserUseUnfilteredHTML = _select.canUserUseUnfilteredHTML, isEditorReady = _select.__unstableIsEditorReady, getEditorBlocks = _select.getEditorBlocks, - getEditedPostAttribute = _select.getEditedPostAttribute, - __experimentalGetReusableBlocks = _select.__experimentalGetReusableBlocks; - - return { + getEditorSelectionStart = _select.getEditorSelectionStart, + getEditorSelectionEnd = _select.getEditorSelectionEnd, + __experimentalGetReusableBlocks = _select.__experimentalGetReusableBlocks, + isPostTitleSelected = _select.isPostTitleSelected; + + var _select2 = select('core'), + canUser = _select2.canUser; + + return { + canUserUseUnfilteredHTML: canUserUseUnfilteredHTML(), isReady: isEditorReady(), blocks: getEditorBlocks(), - meta: getEditedPostAttribute('meta'), - reusableBlocks: __experimentalGetReusableBlocks() + selectionStart: getEditorSelectionStart(), + selectionEnd: getEditorSelectionEnd(), + reusableBlocks: __experimentalGetReusableBlocks(), + hasUploadPermissions: Object(external_this_lodash_["defaultTo"])(canUser('create', 'media'), true), + // This selector is only defined on mobile. + isPostTitleSelected: isPostTitleSelected && isPostTitleSelected() }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { var _dispatch = dispatch('core/editor'), setupEditor = _dispatch.setupEditor, updatePostLock = _dispatch.updatePostLock, resetEditorBlocks = _dispatch.resetEditorBlocks, - editPost = _dispatch.editPost, - updateEditorSettings = _dispatch.updateEditorSettings; + updateEditorSettings = _dispatch.updateEditorSettings, + __experimentalFetchReusableBlocks = _dispatch.__experimentalFetchReusableBlocks, + __experimentalTearDownEditor = _dispatch.__experimentalTearDownEditor, + undo = _dispatch.undo; var _dispatch2 = dispatch('core/notices'), createWarningNotice = _dispatch2.createWarningNotice; @@ -15040,20 +13946,24 @@ createWarningNotice: createWarningNotice, resetEditorBlocks: resetEditorBlocks, updateEditorSettings: updateEditorSettings, - resetEditorBlocksWithoutUndoLevel: function resetEditorBlocksWithoutUndoLevel(blocks) { - resetEditorBlocks(blocks, { + resetEditorBlocksWithoutUndoLevel: function resetEditorBlocksWithoutUndoLevel(blocks, options) { + resetEditorBlocks(blocks, provider_objectSpread({}, options, { __unstableShouldCreateUndoLevel: false - }); + })); }, - onMetaChange: function onMetaChange(meta) { - editPost({ - meta: meta - }); - } + tearDownEditor: __experimentalTearDownEditor, + __experimentalFetchReusableBlocks: __experimentalFetchReusableBlocks, + undo: undo }; })])(provider_EditorProvider)); +// EXTERNAL MODULE: external {"this":["wp","serverSideRender"]} +var external_this_wp_serverSideRender_ = __webpack_require__(83); +var external_this_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_serverSideRender_); + // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/deprecated.js + + // Block Creation Components /** @@ -15062,9 +13972,91 @@ + + +function deprecateComponent(name, Wrapped) { + var staticsToHoist = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; + var Component = Object(external_this_wp_element_["forwardRef"])(function (props, ref) { + external_this_wp_deprecated_default()('wp.editor.' + name, { + alternative: 'wp.blockEditor.' + name + }); + return Object(external_this_wp_element_["createElement"])(Wrapped, Object(esm_extends["a" /* default */])({ + ref: ref + }, props)); + }); + staticsToHoist.forEach(function (staticName) { + Component[staticName] = deprecateComponent(name + '.' + staticName, Wrapped[staticName]); + }); + return Component; +} + +function deprecateFunction(name, func) { + return function () { + external_this_wp_deprecated_default()('wp.editor.' + name, { + alternative: 'wp.blockEditor.' + name + }); + return func.apply(void 0, arguments); + }; +} + +var RichText = deprecateComponent('RichText', external_this_wp_blockEditor_["RichText"], ['Content']); +RichText.isEmpty = deprecateFunction('RichText.isEmpty', external_this_wp_blockEditor_["RichText"].isEmpty); + +var Autocomplete = deprecateComponent('Autocomplete', external_this_wp_blockEditor_["Autocomplete"]); +var AlignmentToolbar = deprecateComponent('AlignmentToolbar', external_this_wp_blockEditor_["AlignmentToolbar"]); +var BlockAlignmentToolbar = deprecateComponent('BlockAlignmentToolbar', external_this_wp_blockEditor_["BlockAlignmentToolbar"]); +var BlockControls = deprecateComponent('BlockControls', external_this_wp_blockEditor_["BlockControls"], ['Slot']); +var deprecated_BlockEdit = deprecateComponent('BlockEdit', external_this_wp_blockEditor_["BlockEdit"]); +var BlockEditorKeyboardShortcuts = deprecateComponent('BlockEditorKeyboardShortcuts', external_this_wp_blockEditor_["BlockEditorKeyboardShortcuts"]); +var BlockFormatControls = deprecateComponent('BlockFormatControls', external_this_wp_blockEditor_["BlockFormatControls"], ['Slot']); +var BlockIcon = deprecateComponent('BlockIcon', external_this_wp_blockEditor_["BlockIcon"]); +var BlockInspector = deprecateComponent('BlockInspector', external_this_wp_blockEditor_["BlockInspector"]); +var BlockList = deprecateComponent('BlockList', external_this_wp_blockEditor_["BlockList"]); +var BlockMover = deprecateComponent('BlockMover', external_this_wp_blockEditor_["BlockMover"]); +var BlockNavigationDropdown = deprecateComponent('BlockNavigationDropdown', external_this_wp_blockEditor_["BlockNavigationDropdown"]); +var BlockSelectionClearer = deprecateComponent('BlockSelectionClearer', external_this_wp_blockEditor_["BlockSelectionClearer"]); +var BlockSettingsMenu = deprecateComponent('BlockSettingsMenu', external_this_wp_blockEditor_["BlockSettingsMenu"]); +var BlockTitle = deprecateComponent('BlockTitle', external_this_wp_blockEditor_["BlockTitle"]); +var BlockToolbar = deprecateComponent('BlockToolbar', external_this_wp_blockEditor_["BlockToolbar"]); +var ColorPalette = deprecateComponent('ColorPalette', external_this_wp_blockEditor_["ColorPalette"]); +var ContrastChecker = deprecateComponent('ContrastChecker', external_this_wp_blockEditor_["ContrastChecker"]); +var CopyHandler = deprecateComponent('CopyHandler', external_this_wp_blockEditor_["CopyHandler"]); +var DefaultBlockAppender = deprecateComponent('DefaultBlockAppender', external_this_wp_blockEditor_["DefaultBlockAppender"]); +var FontSizePicker = deprecateComponent('FontSizePicker', external_this_wp_blockEditor_["FontSizePicker"]); +var Inserter = deprecateComponent('Inserter', external_this_wp_blockEditor_["Inserter"]); +var InnerBlocks = deprecateComponent('InnerBlocks', external_this_wp_blockEditor_["InnerBlocks"], ['ButtonBlockAppender', 'DefaultBlockAppender', 'Content']); +var InspectorAdvancedControls = deprecateComponent('InspectorAdvancedControls', external_this_wp_blockEditor_["InspectorAdvancedControls"], ['Slot']); +var InspectorControls = deprecateComponent('InspectorControls', external_this_wp_blockEditor_["InspectorControls"], ['Slot']); +var PanelColorSettings = deprecateComponent('PanelColorSettings', external_this_wp_blockEditor_["PanelColorSettings"]); +var PlainText = deprecateComponent('PlainText', external_this_wp_blockEditor_["PlainText"]); +var RichTextShortcut = deprecateComponent('RichTextShortcut', external_this_wp_blockEditor_["RichTextShortcut"]); +var RichTextToolbarButton = deprecateComponent('RichTextToolbarButton', external_this_wp_blockEditor_["RichTextToolbarButton"]); +var __unstableRichTextInputEvent = deprecateComponent('__unstableRichTextInputEvent', external_this_wp_blockEditor_["__unstableRichTextInputEvent"]); +var MediaPlaceholder = deprecateComponent('MediaPlaceholder', external_this_wp_blockEditor_["MediaPlaceholder"]); +var MediaUpload = deprecateComponent('MediaUpload', external_this_wp_blockEditor_["MediaUpload"]); +var MediaUploadCheck = deprecateComponent('MediaUploadCheck', external_this_wp_blockEditor_["MediaUploadCheck"]); +var MultiSelectScrollIntoView = deprecateComponent('MultiSelectScrollIntoView', external_this_wp_blockEditor_["MultiSelectScrollIntoView"]); +var NavigableToolbar = deprecateComponent('NavigableToolbar', external_this_wp_blockEditor_["NavigableToolbar"]); +var ObserveTyping = deprecateComponent('ObserveTyping', external_this_wp_blockEditor_["ObserveTyping"]); +var PreserveScrollInReorder = deprecateComponent('PreserveScrollInReorder', external_this_wp_blockEditor_["PreserveScrollInReorder"]); +var SkipToSelectedBlock = deprecateComponent('SkipToSelectedBlock', external_this_wp_blockEditor_["SkipToSelectedBlock"]); +var URLInput = deprecateComponent('URLInput', external_this_wp_blockEditor_["URLInput"]); +var URLInputButton = deprecateComponent('URLInputButton', external_this_wp_blockEditor_["URLInputButton"]); +var URLPopover = deprecateComponent('URLPopover', external_this_wp_blockEditor_["URLPopover"]); +var Warning = deprecateComponent('Warning', external_this_wp_blockEditor_["Warning"]); +var WritingFlow = deprecateComponent('WritingFlow', external_this_wp_blockEditor_["WritingFlow"]); +var createCustomColorsHOC = deprecateFunction('createCustomColorsHOC', external_this_wp_blockEditor_["createCustomColorsHOC"]); +var getColorClassName = deprecateFunction('getColorClassName', external_this_wp_blockEditor_["getColorClassName"]); +var getColorObjectByAttributeValues = deprecateFunction('getColorObjectByAttributeValues', external_this_wp_blockEditor_["getColorObjectByAttributeValues"]); +var getColorObjectByColorValue = deprecateFunction('getColorObjectByColorValue', external_this_wp_blockEditor_["getColorObjectByColorValue"]); +var getFontSize = deprecateFunction('getFontSize', external_this_wp_blockEditor_["getFontSize"]); +var getFontSizeClass = deprecateFunction('getFontSizeClass', external_this_wp_blockEditor_["getFontSizeClass"]); +var withColorContext = deprecateFunction('withColorContext', external_this_wp_blockEditor_["withColorContext"]); +var withColors = deprecateFunction('withColors', external_this_wp_blockEditor_["withColors"]); +var withFontSizes = deprecateFunction('withFontSizes', external_this_wp_blockEditor_["withFontSizes"]); + // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/index.js // Block Creation Components - // Post Related Components @@ -15118,178 +14110,25 @@ + + + + + // State Related Components -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/default-autocompleters.js -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - +// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/index.js /** * Internal dependencies */ -var defaultAutocompleters = [autocompleters_user]; -var default_autocompleters_fetchReusableBlocks = Object(external_lodash_["once"])(function () { - return Object(external_this_wp_data_["dispatch"])('core/editor').__experimentalFetchReusableBlocks(); -}); - -function setDefaultCompleters(completers, blockName) { - if (!completers) { - // Provide copies so filters may directly modify them. - completers = defaultAutocompleters.map(external_lodash_["clone"]); // Add blocks autocompleter for Paragraph block - - if (blockName === Object(external_this_wp_blocks_["getDefaultBlockName"])()) { - completers.push(Object(external_lodash_["clone"])(autocompleters_block)); - /* - * NOTE: This is a hack to help ensure reusable blocks are loaded - * so they may be included in the block completer. It can be removed - * once we have a way for completers to Promise options while - * store-based data dependencies are being resolved. - */ - - default_autocompleters_fetchReusableBlocks(); - } - } - - return completers; -} - -Object(external_this_wp_hooks_["addFilter"])('editor.Autocomplete.completers', 'editor/autocompleters/set-default-completers', setDefaultCompleters); - -// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/index.js -/** - * Internal dependencies - */ // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/index.js -/* concated harmony reexport ServerSideRender */__webpack_require__.d(__webpack_exports__, "ServerSideRender", function() { return server_side_render; }); -/* concated harmony reexport AutosaveMonitor */__webpack_require__.d(__webpack_exports__, "AutosaveMonitor", function() { return autosave_monitor; }); -/* concated harmony reexport DocumentOutline */__webpack_require__.d(__webpack_exports__, "DocumentOutline", function() { return document_outline; }); -/* concated harmony reexport DocumentOutlineCheck */__webpack_require__.d(__webpack_exports__, "DocumentOutlineCheck", function() { return check; }); -/* concated harmony reexport VisualEditorGlobalKeyboardShortcuts */__webpack_require__.d(__webpack_exports__, "VisualEditorGlobalKeyboardShortcuts", function() { return visual_editor_shortcuts; }); -/* concated harmony reexport EditorGlobalKeyboardShortcuts */__webpack_require__.d(__webpack_exports__, "EditorGlobalKeyboardShortcuts", function() { return EditorGlobalKeyboardShortcuts; }); -/* concated harmony reexport TextEditorGlobalKeyboardShortcuts */__webpack_require__.d(__webpack_exports__, "TextEditorGlobalKeyboardShortcuts", function() { return TextEditorGlobalKeyboardShortcuts; }); -/* concated harmony reexport EditorHistoryRedo */__webpack_require__.d(__webpack_exports__, "EditorHistoryRedo", function() { return editor_history_redo; }); -/* concated harmony reexport EditorHistoryUndo */__webpack_require__.d(__webpack_exports__, "EditorHistoryUndo", function() { return editor_history_undo; }); -/* concated harmony reexport EditorNotices */__webpack_require__.d(__webpack_exports__, "EditorNotices", function() { return editor_notices; }); -/* concated harmony reexport ErrorBoundary */__webpack_require__.d(__webpack_exports__, "ErrorBoundary", function() { return error_boundary; }); -/* concated harmony reexport PageAttributesCheck */__webpack_require__.d(__webpack_exports__, "PageAttributesCheck", function() { return page_attributes_check; }); -/* concated harmony reexport PageAttributesOrder */__webpack_require__.d(__webpack_exports__, "PageAttributesOrder", function() { return page_attributes_order; }); -/* concated harmony reexport PageAttributesParent */__webpack_require__.d(__webpack_exports__, "PageAttributesParent", function() { return page_attributes_parent; }); -/* concated harmony reexport PageTemplate */__webpack_require__.d(__webpack_exports__, "PageTemplate", function() { return page_attributes_template; }); -/* concated harmony reexport PostAuthor */__webpack_require__.d(__webpack_exports__, "PostAuthor", function() { return post_author; }); -/* concated harmony reexport PostAuthorCheck */__webpack_require__.d(__webpack_exports__, "PostAuthorCheck", function() { return post_author_check; }); -/* concated harmony reexport PostComments */__webpack_require__.d(__webpack_exports__, "PostComments", function() { return post_comments; }); -/* concated harmony reexport PostExcerpt */__webpack_require__.d(__webpack_exports__, "PostExcerpt", function() { return post_excerpt; }); -/* concated harmony reexport PostExcerptCheck */__webpack_require__.d(__webpack_exports__, "PostExcerptCheck", function() { return post_excerpt_check; }); -/* concated harmony reexport PostFeaturedImage */__webpack_require__.d(__webpack_exports__, "PostFeaturedImage", function() { return post_featured_image; }); -/* concated harmony reexport PostFeaturedImageCheck */__webpack_require__.d(__webpack_exports__, "PostFeaturedImageCheck", function() { return post_featured_image_check; }); -/* concated harmony reexport PostFormat */__webpack_require__.d(__webpack_exports__, "PostFormat", function() { return post_format; }); -/* concated harmony reexport PostFormatCheck */__webpack_require__.d(__webpack_exports__, "PostFormatCheck", function() { return post_format_check; }); -/* concated harmony reexport PostLastRevision */__webpack_require__.d(__webpack_exports__, "PostLastRevision", function() { return post_last_revision; }); -/* concated harmony reexport PostLastRevisionCheck */__webpack_require__.d(__webpack_exports__, "PostLastRevisionCheck", function() { return post_last_revision_check; }); -/* concated harmony reexport PostLockedModal */__webpack_require__.d(__webpack_exports__, "PostLockedModal", function() { return post_locked_modal; }); -/* concated harmony reexport PostPendingStatus */__webpack_require__.d(__webpack_exports__, "PostPendingStatus", function() { return post_pending_status; }); -/* concated harmony reexport PostPendingStatusCheck */__webpack_require__.d(__webpack_exports__, "PostPendingStatusCheck", function() { return post_pending_status_check; }); -/* concated harmony reexport PostPingbacks */__webpack_require__.d(__webpack_exports__, "PostPingbacks", function() { return post_pingbacks; }); -/* concated harmony reexport PostPreviewButton */__webpack_require__.d(__webpack_exports__, "PostPreviewButton", function() { return post_preview_button; }); -/* concated harmony reexport PostPublishButton */__webpack_require__.d(__webpack_exports__, "PostPublishButton", function() { return post_publish_button; }); -/* concated harmony reexport PostPublishButtonLabel */__webpack_require__.d(__webpack_exports__, "PostPublishButtonLabel", function() { return post_publish_button_label; }); -/* concated harmony reexport PostPublishPanel */__webpack_require__.d(__webpack_exports__, "PostPublishPanel", function() { return post_publish_panel; }); -/* concated harmony reexport PostSavedState */__webpack_require__.d(__webpack_exports__, "PostSavedState", function() { return post_saved_state; }); -/* concated harmony reexport PostSchedule */__webpack_require__.d(__webpack_exports__, "PostSchedule", function() { return post_schedule; }); -/* concated harmony reexport PostScheduleCheck */__webpack_require__.d(__webpack_exports__, "PostScheduleCheck", function() { return post_schedule_check; }); -/* concated harmony reexport PostScheduleLabel */__webpack_require__.d(__webpack_exports__, "PostScheduleLabel", function() { return post_schedule_label; }); -/* concated harmony reexport PostSticky */__webpack_require__.d(__webpack_exports__, "PostSticky", function() { return post_sticky; }); -/* concated harmony reexport PostStickyCheck */__webpack_require__.d(__webpack_exports__, "PostStickyCheck", function() { return post_sticky_check; }); -/* concated harmony reexport PostSwitchToDraftButton */__webpack_require__.d(__webpack_exports__, "PostSwitchToDraftButton", function() { return post_switch_to_draft_button; }); -/* concated harmony reexport PostTaxonomies */__webpack_require__.d(__webpack_exports__, "PostTaxonomies", function() { return post_taxonomies; }); -/* concated harmony reexport PostTaxonomiesCheck */__webpack_require__.d(__webpack_exports__, "PostTaxonomiesCheck", function() { return post_taxonomies_check; }); -/* concated harmony reexport PostTextEditor */__webpack_require__.d(__webpack_exports__, "PostTextEditor", function() { return post_text_editor; }); -/* concated harmony reexport PostTitle */__webpack_require__.d(__webpack_exports__, "PostTitle", function() { return post_title; }); -/* concated harmony reexport PostTrash */__webpack_require__.d(__webpack_exports__, "PostTrash", function() { return post_trash; }); -/* concated harmony reexport PostTrashCheck */__webpack_require__.d(__webpack_exports__, "PostTrashCheck", function() { return post_trash_check; }); -/* concated harmony reexport PostTypeSupportCheck */__webpack_require__.d(__webpack_exports__, "PostTypeSupportCheck", function() { return post_type_support_check; }); -/* concated harmony reexport PostVisibility */__webpack_require__.d(__webpack_exports__, "PostVisibility", function() { return post_visibility; }); -/* concated harmony reexport PostVisibilityLabel */__webpack_require__.d(__webpack_exports__, "PostVisibilityLabel", function() { return post_visibility_label; }); -/* concated harmony reexport PostVisibilityCheck */__webpack_require__.d(__webpack_exports__, "PostVisibilityCheck", function() { return post_visibility_check; }); -/* concated harmony reexport TableOfContents */__webpack_require__.d(__webpack_exports__, "TableOfContents", function() { return table_of_contents; }); -/* concated harmony reexport UnsavedChangesWarning */__webpack_require__.d(__webpack_exports__, "UnsavedChangesWarning", function() { return unsaved_changes_warning; }); -/* concated harmony reexport WordCount */__webpack_require__.d(__webpack_exports__, "WordCount", function() { return word_count; }); -/* concated harmony reexport EditorProvider */__webpack_require__.d(__webpack_exports__, "EditorProvider", function() { return provider; }); -/* concated harmony reexport blockAutocompleter */__webpack_require__.d(__webpack_exports__, "blockAutocompleter", function() { return autocompleters_block; }); -/* concated harmony reexport userAutocompleter */__webpack_require__.d(__webpack_exports__, "userAutocompleter", function() { return autocompleters_user; }); -/* concated harmony reexport Autocomplete */__webpack_require__.d(__webpack_exports__, "Autocomplete", function() { return external_this_wp_blockEditor_["Autocomplete"]; }); -/* concated harmony reexport AlignmentToolbar */__webpack_require__.d(__webpack_exports__, "AlignmentToolbar", function() { return external_this_wp_blockEditor_["AlignmentToolbar"]; }); -/* concated harmony reexport BlockAlignmentToolbar */__webpack_require__.d(__webpack_exports__, "BlockAlignmentToolbar", function() { return external_this_wp_blockEditor_["BlockAlignmentToolbar"]; }); -/* concated harmony reexport BlockControls */__webpack_require__.d(__webpack_exports__, "BlockControls", function() { return external_this_wp_blockEditor_["BlockControls"]; }); -/* concated harmony reexport BlockEdit */__webpack_require__.d(__webpack_exports__, "BlockEdit", function() { return external_this_wp_blockEditor_["BlockEdit"]; }); -/* concated harmony reexport BlockEditorKeyboardShortcuts */__webpack_require__.d(__webpack_exports__, "BlockEditorKeyboardShortcuts", function() { return external_this_wp_blockEditor_["BlockEditorKeyboardShortcuts"]; }); -/* concated harmony reexport BlockFormatControls */__webpack_require__.d(__webpack_exports__, "BlockFormatControls", function() { return external_this_wp_blockEditor_["BlockFormatControls"]; }); -/* concated harmony reexport BlockIcon */__webpack_require__.d(__webpack_exports__, "BlockIcon", function() { return external_this_wp_blockEditor_["BlockIcon"]; }); -/* concated harmony reexport BlockInspector */__webpack_require__.d(__webpack_exports__, "BlockInspector", function() { return external_this_wp_blockEditor_["BlockInspector"]; }); -/* concated harmony reexport BlockList */__webpack_require__.d(__webpack_exports__, "BlockList", function() { return external_this_wp_blockEditor_["BlockList"]; }); -/* concated harmony reexport BlockMover */__webpack_require__.d(__webpack_exports__, "BlockMover", function() { return external_this_wp_blockEditor_["BlockMover"]; }); -/* concated harmony reexport BlockNavigationDropdown */__webpack_require__.d(__webpack_exports__, "BlockNavigationDropdown", function() { return external_this_wp_blockEditor_["BlockNavigationDropdown"]; }); -/* concated harmony reexport BlockSelectionClearer */__webpack_require__.d(__webpack_exports__, "BlockSelectionClearer", function() { return external_this_wp_blockEditor_["BlockSelectionClearer"]; }); -/* concated harmony reexport BlockSettingsMenu */__webpack_require__.d(__webpack_exports__, "BlockSettingsMenu", function() { return external_this_wp_blockEditor_["BlockSettingsMenu"]; }); -/* concated harmony reexport BlockTitle */__webpack_require__.d(__webpack_exports__, "BlockTitle", function() { return external_this_wp_blockEditor_["BlockTitle"]; }); -/* concated harmony reexport BlockToolbar */__webpack_require__.d(__webpack_exports__, "BlockToolbar", function() { return external_this_wp_blockEditor_["BlockToolbar"]; }); -/* concated harmony reexport ColorPalette */__webpack_require__.d(__webpack_exports__, "ColorPalette", function() { return external_this_wp_blockEditor_["ColorPalette"]; }); -/* concated harmony reexport ContrastChecker */__webpack_require__.d(__webpack_exports__, "ContrastChecker", function() { return external_this_wp_blockEditor_["ContrastChecker"]; }); -/* concated harmony reexport CopyHandler */__webpack_require__.d(__webpack_exports__, "CopyHandler", function() { return external_this_wp_blockEditor_["CopyHandler"]; }); -/* concated harmony reexport createCustomColorsHOC */__webpack_require__.d(__webpack_exports__, "createCustomColorsHOC", function() { return external_this_wp_blockEditor_["createCustomColorsHOC"]; }); -/* concated harmony reexport DefaultBlockAppender */__webpack_require__.d(__webpack_exports__, "DefaultBlockAppender", function() { return external_this_wp_blockEditor_["DefaultBlockAppender"]; }); -/* concated harmony reexport FontSizePicker */__webpack_require__.d(__webpack_exports__, "FontSizePicker", function() { return external_this_wp_blockEditor_["FontSizePicker"]; }); -/* concated harmony reexport getColorClassName */__webpack_require__.d(__webpack_exports__, "getColorClassName", function() { return external_this_wp_blockEditor_["getColorClassName"]; }); -/* concated harmony reexport getColorObjectByAttributeValues */__webpack_require__.d(__webpack_exports__, "getColorObjectByAttributeValues", function() { return external_this_wp_blockEditor_["getColorObjectByAttributeValues"]; }); -/* concated harmony reexport getColorObjectByColorValue */__webpack_require__.d(__webpack_exports__, "getColorObjectByColorValue", function() { return external_this_wp_blockEditor_["getColorObjectByColorValue"]; }); -/* concated harmony reexport getFontSize */__webpack_require__.d(__webpack_exports__, "getFontSize", function() { return external_this_wp_blockEditor_["getFontSize"]; }); -/* concated harmony reexport getFontSizeClass */__webpack_require__.d(__webpack_exports__, "getFontSizeClass", function() { return external_this_wp_blockEditor_["getFontSizeClass"]; }); -/* concated harmony reexport Inserter */__webpack_require__.d(__webpack_exports__, "Inserter", function() { return external_this_wp_blockEditor_["Inserter"]; }); -/* concated harmony reexport InnerBlocks */__webpack_require__.d(__webpack_exports__, "InnerBlocks", function() { return external_this_wp_blockEditor_["InnerBlocks"]; }); -/* concated harmony reexport InspectorAdvancedControls */__webpack_require__.d(__webpack_exports__, "InspectorAdvancedControls", function() { return external_this_wp_blockEditor_["InspectorAdvancedControls"]; }); -/* concated harmony reexport InspectorControls */__webpack_require__.d(__webpack_exports__, "InspectorControls", function() { return external_this_wp_blockEditor_["InspectorControls"]; }); -/* concated harmony reexport PanelColorSettings */__webpack_require__.d(__webpack_exports__, "PanelColorSettings", function() { return external_this_wp_blockEditor_["PanelColorSettings"]; }); -/* concated harmony reexport PlainText */__webpack_require__.d(__webpack_exports__, "PlainText", function() { return external_this_wp_blockEditor_["PlainText"]; }); -/* concated harmony reexport RichText */__webpack_require__.d(__webpack_exports__, "RichText", function() { return external_this_wp_blockEditor_["RichText"]; }); -/* concated harmony reexport RichTextShortcut */__webpack_require__.d(__webpack_exports__, "RichTextShortcut", function() { return external_this_wp_blockEditor_["RichTextShortcut"]; }); -/* concated harmony reexport RichTextToolbarButton */__webpack_require__.d(__webpack_exports__, "RichTextToolbarButton", function() { return external_this_wp_blockEditor_["RichTextToolbarButton"]; }); -/* concated harmony reexport RichTextInserterItem */__webpack_require__.d(__webpack_exports__, "RichTextInserterItem", function() { return external_this_wp_blockEditor_["RichTextInserterItem"]; }); -/* concated harmony reexport UnstableRichTextInputEvent */__webpack_require__.d(__webpack_exports__, "UnstableRichTextInputEvent", function() { return external_this_wp_blockEditor_["UnstableRichTextInputEvent"]; }); -/* concated harmony reexport MediaPlaceholder */__webpack_require__.d(__webpack_exports__, "MediaPlaceholder", function() { return external_this_wp_blockEditor_["MediaPlaceholder"]; }); -/* concated harmony reexport MediaUpload */__webpack_require__.d(__webpack_exports__, "MediaUpload", function() { return external_this_wp_blockEditor_["MediaUpload"]; }); -/* concated harmony reexport MediaUploadCheck */__webpack_require__.d(__webpack_exports__, "MediaUploadCheck", function() { return external_this_wp_blockEditor_["MediaUploadCheck"]; }); -/* concated harmony reexport MultiBlocksSwitcher */__webpack_require__.d(__webpack_exports__, "MultiBlocksSwitcher", function() { return external_this_wp_blockEditor_["MultiBlocksSwitcher"]; }); -/* concated harmony reexport MultiSelectScrollIntoView */__webpack_require__.d(__webpack_exports__, "MultiSelectScrollIntoView", function() { return external_this_wp_blockEditor_["MultiSelectScrollIntoView"]; }); -/* concated harmony reexport NavigableToolbar */__webpack_require__.d(__webpack_exports__, "NavigableToolbar", function() { return external_this_wp_blockEditor_["NavigableToolbar"]; }); -/* concated harmony reexport ObserveTyping */__webpack_require__.d(__webpack_exports__, "ObserveTyping", function() { return external_this_wp_blockEditor_["ObserveTyping"]; }); -/* concated harmony reexport PreserveScrollInReorder */__webpack_require__.d(__webpack_exports__, "PreserveScrollInReorder", function() { return external_this_wp_blockEditor_["PreserveScrollInReorder"]; }); -/* concated harmony reexport SkipToSelectedBlock */__webpack_require__.d(__webpack_exports__, "SkipToSelectedBlock", function() { return external_this_wp_blockEditor_["SkipToSelectedBlock"]; }); -/* concated harmony reexport URLInput */__webpack_require__.d(__webpack_exports__, "URLInput", function() { return external_this_wp_blockEditor_["URLInput"]; }); -/* concated harmony reexport URLInputButton */__webpack_require__.d(__webpack_exports__, "URLInputButton", function() { return external_this_wp_blockEditor_["URLInputButton"]; }); -/* concated harmony reexport URLPopover */__webpack_require__.d(__webpack_exports__, "URLPopover", function() { return external_this_wp_blockEditor_["URLPopover"]; }); -/* concated harmony reexport Warning */__webpack_require__.d(__webpack_exports__, "Warning", function() { return external_this_wp_blockEditor_["Warning"]; }); -/* concated harmony reexport WritingFlow */__webpack_require__.d(__webpack_exports__, "WritingFlow", function() { return external_this_wp_blockEditor_["WritingFlow"]; }); -/* concated harmony reexport withColorContext */__webpack_require__.d(__webpack_exports__, "withColorContext", function() { return external_this_wp_blockEditor_["withColorContext"]; }); -/* concated harmony reexport withColors */__webpack_require__.d(__webpack_exports__, "withColors", function() { return external_this_wp_blockEditor_["withColors"]; }); -/* concated harmony reexport withFontSizes */__webpack_require__.d(__webpack_exports__, "withFontSizes", function() { return external_this_wp_blockEditor_["withFontSizes"]; }); -/* concated harmony reexport mediaUpload */__webpack_require__.d(__webpack_exports__, "mediaUpload", function() { return media_upload; }); -/* concated harmony reexport cleanForSlug */__webpack_require__.d(__webpack_exports__, "cleanForSlug", function() { return cleanForSlug; }); -/* concated harmony reexport transformStyles */__webpack_require__.d(__webpack_exports__, "transformStyles", function() { return editor_styles; }); /** * WordPress dependencies */ @@ -15309,165 +14148,45 @@ +/* + * Backward compatibility + */ + + /***/ }), -/***/ 37: +/***/ 45: +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["apiFetch"]; }()); + +/***/ }), + +/***/ 5: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; }); -function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; -} - -/***/ }), - -/***/ 38: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; }); -function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; }); +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; } /***/ }), -/***/ 4: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["components"]; }()); - -/***/ }), - -/***/ 40: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["viewport"]; }()); - -/***/ }), - -/***/ 41: -/***/ (function(module, exports, __webpack_require__) { - -module.exports = function memize( fn, options ) { - var size = 0, - maxSize, head, tail; - - if ( options && options.maxSize ) { - maxSize = options.maxSize; - } - - function memoized( /* ...args */ ) { - var node = head, - len = arguments.length, - args, i; - - searchCache: while ( node ) { - // Perform a shallow equality test to confirm that whether the node - // under test is a candidate for the arguments passed. Two arrays - // are shallowly equal if their length matches and each entry is - // strictly equal between the two sets. Avoid abstracting to a - // function which could incur an arguments leaking deoptimization. - - // Check whether node arguments match arguments length - if ( node.args.length !== arguments.length ) { - node = node.next; - continue; - } - - // Check whether node arguments match arguments values - for ( i = 0; i < len; i++ ) { - if ( node.args[ i ] !== arguments[ i ] ) { - node = node.next; - continue searchCache; - } - } - - // At this point we can assume we've found a match - - // Surface matched node to head if not already - if ( node !== head ) { - // As tail, shift to previous. Must only shift if not also - // head, since if both head and tail, there is no previous. - if ( node === tail ) { - tail = node.prev; - } - - // Adjust siblings to point to each other. If node was tail, - // this also handles new tail's empty `next` assignment. - node.prev.next = node.next; - if ( node.next ) { - node.next.prev = node.prev; - } - - node.next = head; - node.prev = null; - head.prev = node; - head = node; - } - - // Return immediately - return node.val; - } - - // No cached value found. Continue to insertion phase: - - // Create a copy of arguments (avoid leaking deoptimization) - args = new Array( len ); - for ( i = 0; i < len; i++ ) { - args[ i ] = arguments[ i ]; - } - - node = { - args: args, - - // Generate the result from original function - val: fn.apply( null, args ) - }; - - // Don't need to check whether node is already head, since it would - // have been returned above already if it was - - // Shift existing head down list - if ( head ) { - head.prev = node; - node.next = head; - } else { - // If no head, follows that there's no tail (at initial or reset) - tail = node; - } - - // Trim tail if we're reached max size and are pending cache insertion - if ( size === maxSize ) { - tail = tail.prev; - tail.next = null; - } else { - size++; - } - - head = node; - - return node.val; - } - - memoized.clear = function() { - head = null; - tail = null; - size = 0; - }; - - if ( false ) {} - - return memoized; -}; - - -/***/ }), - -/***/ 44: +/***/ 50: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -15510,1819 +14229,252 @@ /***/ }), -/***/ 49: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["deprecated"]; }()); - -/***/ }), - -/***/ 5: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["data"]; }()); - -/***/ }), - -/***/ 50: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["date"]; }()); - -/***/ }), - -/***/ 54: -/***/ (function(module, exports, __webpack_require__) { - -/** - * Copyright (c) 2014-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// This method of obtaining a reference to the global object needs to be -// kept identical to the way it is obtained in runtime.js -var g = (function() { - return this || (typeof self === "object" && self); -})() || Function("return this")(); - -// Use `getOwnPropertyNames` because not all browsers support calling -// `hasOwnProperty` on the global `self` object in a worker. See #183. -var hadRuntime = g.regeneratorRuntime && - Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0; - -// Save the old regeneratorRuntime in case it needs to be restored later. -var oldRuntime = hadRuntime && g.regeneratorRuntime; - -// Force reevalutation of runtime.js. -g.regeneratorRuntime = undefined; - -module.exports = __webpack_require__(55); - -if (hadRuntime) { - // Restore the original runtime. - g.regeneratorRuntime = oldRuntime; -} else { - // Remove the global property added by runtime.js. - try { - delete g.regeneratorRuntime; - } catch(e) { - g.regeneratorRuntime = undefined; - } -} - - -/***/ }), - -/***/ 55: +/***/ 52: /***/ (function(module, exports) { -/** - * Copyright (c) 2014-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -!(function(global) { - "use strict"; - - var Op = Object.prototype; - var hasOwn = Op.hasOwnProperty; - var undefined; // More compressible than void 0. - var $Symbol = typeof Symbol === "function" ? Symbol : {}; - var iteratorSymbol = $Symbol.iterator || "@@iterator"; - var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; - var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; - - var inModule = typeof module === "object"; - var runtime = global.regeneratorRuntime; - if (runtime) { - if (inModule) { - // If regeneratorRuntime is defined globally and we're in a module, - // make the exports object identical to regeneratorRuntime. - module.exports = runtime; - } - // Don't bother evaluating the rest of this file if the runtime was - // already defined globally. - return; - } - - // Define the runtime globally (as expected by generated code) as either - // module.exports (if we're in a module) or a new, empty object. - runtime = global.regeneratorRuntime = inModule ? module.exports : {}; - - function wrap(innerFn, outerFn, self, tryLocsList) { - // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. - var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; - var generator = Object.create(protoGenerator.prototype); - var context = new Context(tryLocsList || []); - - // The ._invoke method unifies the implementations of the .next, - // .throw, and .return methods. - generator._invoke = makeInvokeMethod(innerFn, self, context); - - return generator; - } - runtime.wrap = wrap; - - // Try/catch helper to minimize deoptimizations. Returns a completion - // record like context.tryEntries[i].completion. This interface could - // have been (and was previously) designed to take a closure to be - // invoked without arguments, but in all the cases we care about we - // already have an existing method we want to call, so there's no need - // to create a new function object. We can even get away with assuming - // the method takes exactly one argument, since that happens to be true - // in every case, so we don't have to touch the arguments object. The - // only additional allocation required is the completion record, which - // has a stable shape and so hopefully should be cheap to allocate. - function tryCatch(fn, obj, arg) { - try { - return { type: "normal", arg: fn.call(obj, arg) }; - } catch (err) { - return { type: "throw", arg: err }; - } - } - - var GenStateSuspendedStart = "suspendedStart"; - var GenStateSuspendedYield = "suspendedYield"; - var GenStateExecuting = "executing"; - var GenStateCompleted = "completed"; - - // Returning this object from the innerFn has the same effect as - // breaking out of the dispatch switch statement. - var ContinueSentinel = {}; - - // Dummy constructor functions that we use as the .constructor and - // .constructor.prototype properties for functions that return Generator - // objects. For full spec compliance, you may wish to configure your - // minifier not to mangle the names of these two functions. - function Generator() {} - function GeneratorFunction() {} - function GeneratorFunctionPrototype() {} - - // This is a polyfill for %IteratorPrototype% for environments that - // don't natively support it. - var IteratorPrototype = {}; - IteratorPrototype[iteratorSymbol] = function () { - return this; - }; - - var getProto = Object.getPrototypeOf; - var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); - if (NativeIteratorPrototype && - NativeIteratorPrototype !== Op && - hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { - // This environment has a native %IteratorPrototype%; use it instead - // of the polyfill. - IteratorPrototype = NativeIteratorPrototype; - } - - var Gp = GeneratorFunctionPrototype.prototype = - Generator.prototype = Object.create(IteratorPrototype); - GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; - GeneratorFunctionPrototype.constructor = GeneratorFunction; - GeneratorFunctionPrototype[toStringTagSymbol] = - GeneratorFunction.displayName = "GeneratorFunction"; - - // Helper for defining the .next, .throw, and .return methods of the - // Iterator interface in terms of a single ._invoke method. - function defineIteratorMethods(prototype) { - ["next", "throw", "return"].forEach(function(method) { - prototype[method] = function(arg) { - return this._invoke(method, arg); - }; - }); - } - - runtime.isGeneratorFunction = function(genFun) { - var ctor = typeof genFun === "function" && genFun.constructor; - return ctor - ? ctor === GeneratorFunction || - // For the native GeneratorFunction constructor, the best we can - // do is to check its .name property. - (ctor.displayName || ctor.name) === "GeneratorFunction" - : false; - }; - - runtime.mark = function(genFun) { - if (Object.setPrototypeOf) { - Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); - } else { - genFun.__proto__ = GeneratorFunctionPrototype; - if (!(toStringTagSymbol in genFun)) { - genFun[toStringTagSymbol] = "GeneratorFunction"; - } - } - genFun.prototype = Object.create(Gp); - return genFun; - }; - - // Within the body of any async function, `await x` is transformed to - // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test - // `hasOwn.call(value, "__await")` to determine if the yielded value is - // meant to be awaited. - runtime.awrap = function(arg) { - return { __await: arg }; - }; - - function AsyncIterator(generator) { - function invoke(method, arg, resolve, reject) { - var record = tryCatch(generator[method], generator, arg); - if (record.type === "throw") { - reject(record.arg); - } else { - var result = record.arg; - var value = result.value; - if (value && - typeof value === "object" && - hasOwn.call(value, "__await")) { - return Promise.resolve(value.__await).then(function(value) { - invoke("next", value, resolve, reject); - }, function(err) { - invoke("throw", err, resolve, reject); - }); - } - - return Promise.resolve(value).then(function(unwrapped) { - // When a yielded Promise is resolved, its final value becomes - // the .value of the Promise<{value,done}> result for the - // current iteration. - result.value = unwrapped; - resolve(result); - }, function(error) { - // If a rejected Promise was yielded, throw the rejection back - // into the async generator function so it can be handled there. - return invoke("throw", error, resolve, reject); - }); - } - } - - var previousPromise; - - function enqueue(method, arg) { - function callInvokeWithMethodAndArg() { - return new Promise(function(resolve, reject) { - invoke(method, arg, resolve, reject); - }); - } - - return previousPromise = - // If enqueue has been called before, then we want to wait until - // all previous Promises have been resolved before calling invoke, - // so that results are always delivered in the correct order. If - // enqueue has not been called before, then it is important to - // call invoke immediately, without waiting on a callback to fire, - // so that the async generator function has the opportunity to do - // any necessary setup in a predictable way. This predictability - // is why the Promise constructor synchronously invokes its - // executor callback, and why async functions synchronously - // execute code before the first await. Since we implement simple - // async functions in terms of async generators, it is especially - // important to get this right, even though it requires care. - previousPromise ? previousPromise.then( - callInvokeWithMethodAndArg, - // Avoid propagating failures to Promises returned by later - // invocations of the iterator. - callInvokeWithMethodAndArg - ) : callInvokeWithMethodAndArg(); - } - - // Define the unified helper method that is used to implement .next, - // .throw, and .return (see defineIteratorMethods). - this._invoke = enqueue; - } - - defineIteratorMethods(AsyncIterator.prototype); - AsyncIterator.prototype[asyncIteratorSymbol] = function () { - return this; - }; - runtime.AsyncIterator = AsyncIterator; - - // Note that simple async functions are implemented on top of - // AsyncIterator objects; they just return a Promise for the value of - // the final result produced by the iterator. - runtime.async = function(innerFn, outerFn, self, tryLocsList) { - var iter = new AsyncIterator( - wrap(innerFn, outerFn, self, tryLocsList) - ); - - return runtime.isGeneratorFunction(outerFn) - ? iter // If outerFn is a generator, return the full iterator. - : iter.next().then(function(result) { - return result.done ? result.value : iter.next(); - }); - }; - - function makeInvokeMethod(innerFn, self, context) { - var state = GenStateSuspendedStart; - - return function invoke(method, arg) { - if (state === GenStateExecuting) { - throw new Error("Generator is already running"); - } - - if (state === GenStateCompleted) { - if (method === "throw") { - throw arg; - } - - // Be forgiving, per 25.3.3.3.3 of the spec: - // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume - return doneResult(); - } - - context.method = method; - context.arg = arg; - - while (true) { - var delegate = context.delegate; - if (delegate) { - var delegateResult = maybeInvokeDelegate(delegate, context); - if (delegateResult) { - if (delegateResult === ContinueSentinel) continue; - return delegateResult; - } - } - - if (context.method === "next") { - // Setting context._sent for legacy support of Babel's - // function.sent implementation. - context.sent = context._sent = context.arg; - - } else if (context.method === "throw") { - if (state === GenStateSuspendedStart) { - state = GenStateCompleted; - throw context.arg; - } - - context.dispatchException(context.arg); - - } else if (context.method === "return") { - context.abrupt("return", context.arg); - } - - state = GenStateExecuting; - - var record = tryCatch(innerFn, self, context); - if (record.type === "normal") { - // If an exception is thrown from innerFn, we leave state === - // GenStateExecuting and loop back for another invocation. - state = context.done - ? GenStateCompleted - : GenStateSuspendedYield; - - if (record.arg === ContinueSentinel) { - continue; - } - - return { - value: record.arg, - done: context.done - }; - - } else if (record.type === "throw") { - state = GenStateCompleted; - // Dispatch the exception by looping back around to the - // context.dispatchException(context.arg) call above. - context.method = "throw"; - context.arg = record.arg; - } - } - }; - } - - // Call delegate.iterator[context.method](context.arg) and handle the - // result, either by returning a { value, done } result from the - // delegate iterator, or by modifying context.method and context.arg, - // setting context.delegate to null, and returning the ContinueSentinel. - function maybeInvokeDelegate(delegate, context) { - var method = delegate.iterator[context.method]; - if (method === undefined) { - // A .throw or .return when the delegate iterator has no .throw - // method always terminates the yield* loop. - context.delegate = null; - - if (context.method === "throw") { - if (delegate.iterator.return) { - // If the delegate iterator has a return method, give it a - // chance to clean up. - context.method = "return"; - context.arg = undefined; - maybeInvokeDelegate(delegate, context); - - if (context.method === "throw") { - // If maybeInvokeDelegate(context) changed context.method from - // "return" to "throw", let that override the TypeError below. - return ContinueSentinel; - } - } - - context.method = "throw"; - context.arg = new TypeError( - "The iterator does not provide a 'throw' method"); - } - - return ContinueSentinel; - } - - var record = tryCatch(method, delegate.iterator, context.arg); - - if (record.type === "throw") { - context.method = "throw"; - context.arg = record.arg; - context.delegate = null; - return ContinueSentinel; - } - - var info = record.arg; - - if (! info) { - context.method = "throw"; - context.arg = new TypeError("iterator result is not an object"); - context.delegate = null; - return ContinueSentinel; - } - - if (info.done) { - // Assign the result of the finished delegate to the temporary - // variable specified by delegate.resultName (see delegateYield). - context[delegate.resultName] = info.value; - - // Resume execution at the desired location (see delegateYield). - context.next = delegate.nextLoc; - - // If context.method was "throw" but the delegate handled the - // exception, let the outer generator proceed normally. If - // context.method was "next", forget context.arg since it has been - // "consumed" by the delegate iterator. If context.method was - // "return", allow the original .return call to continue in the - // outer generator. - if (context.method !== "return") { - context.method = "next"; - context.arg = undefined; - } - - } else { - // Re-yield the result returned by the delegate method. - return info; - } - - // The delegate iterator is finished, so forget it and continue with - // the outer generator. - context.delegate = null; - return ContinueSentinel; - } - - // Define Generator.prototype.{next,throw,return} in terms of the - // unified ._invoke helper method. - defineIteratorMethods(Gp); - - Gp[toStringTagSymbol] = "Generator"; - - // A Generator should always return itself as the iterator object when the - // @@iterator function is called on it. Some browsers' implementations of the - // iterator prototype chain incorrectly implement this, causing the Generator - // object to not be returned from this call. This ensures that doesn't happen. - // See https://github.com/facebook/regenerator/issues/274 for more details. - Gp[iteratorSymbol] = function() { - return this; - }; - - Gp.toString = function() { - return "[object Generator]"; - }; - - function pushTryEntry(locs) { - var entry = { tryLoc: locs[0] }; - - if (1 in locs) { - entry.catchLoc = locs[1]; - } - - if (2 in locs) { - entry.finallyLoc = locs[2]; - entry.afterLoc = locs[3]; - } - - this.tryEntries.push(entry); - } - - function resetTryEntry(entry) { - var record = entry.completion || {}; - record.type = "normal"; - delete record.arg; - entry.completion = record; - } - - function Context(tryLocsList) { - // The root entry object (effectively a try statement without a catch - // or a finally block) gives us a place to store values thrown from - // locations where there is no enclosing try statement. - this.tryEntries = [{ tryLoc: "root" }]; - tryLocsList.forEach(pushTryEntry, this); - this.reset(true); - } - - runtime.keys = function(object) { - var keys = []; - for (var key in object) { - keys.push(key); - } - keys.reverse(); - - // Rather than returning an object with a next method, we keep - // things simple and return the next function itself. - return function next() { - while (keys.length) { - var key = keys.pop(); - if (key in object) { - next.value = key; - next.done = false; - return next; - } - } - - // To avoid creating an additional object, we just hang the .value - // and .done properties off the next function object itself. This - // also ensures that the minifier will not anonymize the function. - next.done = true; - return next; - }; - }; - - function values(iterable) { - if (iterable) { - var iteratorMethod = iterable[iteratorSymbol]; - if (iteratorMethod) { - return iteratorMethod.call(iterable); - } - - if (typeof iterable.next === "function") { - return iterable; - } - - if (!isNaN(iterable.length)) { - var i = -1, next = function next() { - while (++i < iterable.length) { - if (hasOwn.call(iterable, i)) { - next.value = iterable[i]; - next.done = false; - return next; - } - } - - next.value = undefined; - next.done = true; - - return next; - }; - - return next.next = next; - } - } - - // Return an iterator with no values. - return { next: doneResult }; - } - runtime.values = values; - - function doneResult() { - return { value: undefined, done: true }; - } - - Context.prototype = { - constructor: Context, - - reset: function(skipTempReset) { - this.prev = 0; - this.next = 0; - // Resetting context._sent for legacy support of Babel's - // function.sent implementation. - this.sent = this._sent = undefined; - this.done = false; - this.delegate = null; - - this.method = "next"; - this.arg = undefined; - - this.tryEntries.forEach(resetTryEntry); - - if (!skipTempReset) { - for (var name in this) { - // Not sure about the optimal order of these conditions: - if (name.charAt(0) === "t" && - hasOwn.call(this, name) && - !isNaN(+name.slice(1))) { - this[name] = undefined; - } - } - } - }, - - stop: function() { - this.done = true; - - var rootEntry = this.tryEntries[0]; - var rootRecord = rootEntry.completion; - if (rootRecord.type === "throw") { - throw rootRecord.arg; - } - - return this.rval; - }, - - dispatchException: function(exception) { - if (this.done) { - throw exception; - } - - var context = this; - function handle(loc, caught) { - record.type = "throw"; - record.arg = exception; - context.next = loc; - - if (caught) { - // If the dispatched exception was caught by a catch block, - // then let that catch block handle the exception normally. - context.method = "next"; - context.arg = undefined; - } - - return !! caught; - } - - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - var record = entry.completion; - - if (entry.tryLoc === "root") { - // Exception thrown outside of any try block that could handle - // it, so set the completion value of the entire function to - // throw the exception. - return handle("end"); - } - - if (entry.tryLoc <= this.prev) { - var hasCatch = hasOwn.call(entry, "catchLoc"); - var hasFinally = hasOwn.call(entry, "finallyLoc"); - - if (hasCatch && hasFinally) { - if (this.prev < entry.catchLoc) { - return handle(entry.catchLoc, true); - } else if (this.prev < entry.finallyLoc) { - return handle(entry.finallyLoc); - } - - } else if (hasCatch) { - if (this.prev < entry.catchLoc) { - return handle(entry.catchLoc, true); - } - - } else if (hasFinally) { - if (this.prev < entry.finallyLoc) { - return handle(entry.finallyLoc); - } - - } else { - throw new Error("try statement without catch or finally"); - } - } - } - }, - - abrupt: function(type, arg) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc <= this.prev && - hasOwn.call(entry, "finallyLoc") && - this.prev < entry.finallyLoc) { - var finallyEntry = entry; - break; - } - } - - if (finallyEntry && - (type === "break" || - type === "continue") && - finallyEntry.tryLoc <= arg && - arg <= finallyEntry.finallyLoc) { - // Ignore the finally entry if control is not jumping to a - // location outside the try/catch block. - finallyEntry = null; - } - - var record = finallyEntry ? finallyEntry.completion : {}; - record.type = type; - record.arg = arg; - - if (finallyEntry) { - this.method = "next"; - this.next = finallyEntry.finallyLoc; - return ContinueSentinel; - } - - return this.complete(record); - }, - - complete: function(record, afterLoc) { - if (record.type === "throw") { - throw record.arg; - } - - if (record.type === "break" || - record.type === "continue") { - this.next = record.arg; - } else if (record.type === "return") { - this.rval = this.arg = record.arg; - this.method = "return"; - this.next = "end"; - } else if (record.type === "normal" && afterLoc) { - this.next = afterLoc; - } - - return ContinueSentinel; - }, - - finish: function(finallyLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.finallyLoc === finallyLoc) { - this.complete(entry.completion, entry.afterLoc); - resetTryEntry(entry); - return ContinueSentinel; - } - } - }, - - "catch": function(tryLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc === tryLoc) { - var record = entry.completion; - if (record.type === "throw") { - var thrown = record.arg; - resetTryEntry(entry); - } - return thrown; - } - } - - // The context.catch method must only be called with a location - // argument that corresponds to a known catch block. - throw new Error("illegal catch attempt"); - }, - - delegateYield: function(iterable, resultName, nextLoc) { - this.delegate = { - iterator: values(iterable), - resultName: resultName, - nextLoc: nextLoc - }; - - if (this.method === "next") { - // Deliberately forget the last sent value so that we don't - // accidentally pass it on to the delegate. - this.arg = undefined; - } - - return ContinueSentinel; - } - }; -})( - // In sloppy mode, unbound `this` refers to the global object, fallback to - // Function constructor if we're in global strict mode. That is sadly a form - // of indirect eval which violates Content Security Policy. - (function() { - return this || (typeof self === "object" && self); - })() || Function("return this")() -); - - -/***/ }), - -/***/ 57: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["htmlEntities"]; }()); - -/***/ }), - -/***/ 59: -/***/ (function(module, exports) { - -var g; - -// This works in non-strict mode -g = (function() { - return this; -})(); - -try { - // This works if eval is allowed (see CSP) - g = g || new Function("return this")(); -} catch (e) { - // This works if the window reference is available - if (typeof window === "object") g = window; -} - -// g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} - -module.exports = g; - +(function() { module.exports = this["wp"]["keyboardShortcuts"]; }()); /***/ }), /***/ 6: /***/ (function(module, exports) { -(function() { module.exports = this["wp"]["compose"]; }()); +(function() { module.exports = this["wp"]["primitives"]; }()); /***/ }), /***/ 60: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["nux"]; }()); - -/***/ }), - -/***/ 61: /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -exports.__esModule = true; -var TextareaAutosize_1 = __webpack_require__(111); -exports["default"] = TextareaAutosize_1["default"]; - - -/***/ }), - -/***/ 62: -/***/ (function(module, exports, __webpack_require__) { - -module.exports = __webpack_require__(341); - - -/***/ }), - -/***/ 66: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["autop"]; }()); +/** + * Memize options object. + * + * @typedef MemizeOptions + * + * @property {number} [maxSize] Maximum size of the cache. + */ + +/** + * Internal cache entry. + * + * @typedef MemizeCacheNode + * + * @property {?MemizeCacheNode|undefined} [prev] Previous node. + * @property {?MemizeCacheNode|undefined} [next] Next node. + * @property {Array<*>} args Function arguments for cache + * entry. + * @property {*} val Function result. + */ + +/** + * Properties of the enhanced function for controlling cache. + * + * @typedef MemizeMemoizedFunction + * + * @property {()=>void} clear Clear the cache. + */ + +/** + * Accepts a function to be memoized, and returns a new memoized function, with + * optional options. + * + * @template {Function} F + * + * @param {F} fn Function to memoize. + * @param {MemizeOptions} [options] Options object. + * + * @return {F & MemizeMemoizedFunction} Memoized function. + */ +function memize( fn, options ) { + var size = 0; + + /** @type {?MemizeCacheNode|undefined} */ + var head; + + /** @type {?MemizeCacheNode|undefined} */ + var tail; + + options = options || {}; + + function memoized( /* ...args */ ) { + var node = head, + len = arguments.length, + args, i; + + searchCache: while ( node ) { + // Perform a shallow equality test to confirm that whether the node + // under test is a candidate for the arguments passed. Two arrays + // are shallowly equal if their length matches and each entry is + // strictly equal between the two sets. Avoid abstracting to a + // function which could incur an arguments leaking deoptimization. + + // Check whether node arguments match arguments length + if ( node.args.length !== arguments.length ) { + node = node.next; + continue; + } + + // Check whether node arguments match arguments values + for ( i = 0; i < len; i++ ) { + if ( node.args[ i ] !== arguments[ i ] ) { + node = node.next; + continue searchCache; + } + } + + // At this point we can assume we've found a match + + // Surface matched node to head if not already + if ( node !== head ) { + // As tail, shift to previous. Must only shift if not also + // head, since if both head and tail, there is no previous. + if ( node === tail ) { + tail = node.prev; + } + + // Adjust siblings to point to each other. If node was tail, + // this also handles new tail's empty `next` assignment. + /** @type {MemizeCacheNode} */ ( node.prev ).next = node.next; + if ( node.next ) { + node.next.prev = node.prev; + } + + node.next = head; + node.prev = null; + /** @type {MemizeCacheNode} */ ( head ).prev = node; + head = node; + } + + // Return immediately + return node.val; + } + + // No cached value found. Continue to insertion phase: + + // Create a copy of arguments (avoid leaking deoptimization) + args = new Array( len ); + for ( i = 0; i < len; i++ ) { + args[ i ] = arguments[ i ]; + } + + node = { + args: args, + + // Generate the result from original function + val: fn.apply( null, args ), + }; + + // Don't need to check whether node is already head, since it would + // have been returned above already if it was + + // Shift existing head down list + if ( head ) { + head.prev = node; + node.next = head; + } else { + // If no head, follows that there's no tail (at initial or reset) + tail = node; + } + + // Trim tail if we're reached max size and are pending cache insertion + if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) { + tail = /** @type {MemizeCacheNode} */ ( tail ).prev; + /** @type {MemizeCacheNode} */ ( tail ).next = null; + } else { + size++; + } + + head = node; + + return node.val; + } + + memoized.clear = function() { + head = null; + tail = null; + size = 0; + }; + + if ( false ) {} + + // Ignore reason: There's not a clear solution to create an intersection of + // the function with additional properties, where the goal is to retain the + // function signature of the incoming argument and add control properties + // on the return value. + + // @ts-ignore + return memoized; +} + +module.exports = memize; + /***/ }), /***/ 7: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; }); -/* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15); - -function _objectSpread(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - var ownKeys = Object.keys(source); - - if (typeof Object.getOwnPropertySymbols === 'function') { - ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { - return Object.getOwnPropertyDescriptor(source, sym).enumerable; - })); - } - - ownKeys.forEach(function (key) { - Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]); - }); - } - - return target; -} - -/***/ }), - -/***/ 70: -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -function flattenIntoMap( map, effects ) { - var i; - if ( Array.isArray( effects ) ) { - for ( i = 0; i < effects.length; i++ ) { - flattenIntoMap( map, effects[ i ] ); - } - } else { - for ( i in effects ) { - map[ i ] = ( map[ i ] || [] ).concat( effects[ i ] ); - } - } -} - -function refx( effects ) { - var map = {}, - middleware; - - flattenIntoMap( map, effects ); - - middleware = function( store ) { - return function( next ) { - return function( action ) { - var handlers = map[ action.type ], - result = next( action ), - i, handlerAction; - - if ( handlers ) { - for ( i = 0; i < handlers.length; i++ ) { - handlerAction = handlers[ i ]( action, store ); - if ( handlerAction ) { - store.dispatch( handlerAction ); - } - } - } - - return result; - }; - }; - }; - - middleware.effects = map; - - return middleware; -} - -module.exports = refx; - - -/***/ }), - -/***/ 72: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["coreData"]; }()); - -/***/ }), - -/***/ 8: /***/ (function(module, exports) { (function() { module.exports = this["wp"]["blockEditor"]; }()); /***/ }), -/***/ 84: -/***/ (function(module, exports, __webpack_require__) { +/***/ 75: +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["htmlEntities"]; }()); + +/***/ }), + +/***/ 79: +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["date"]; }()); + +/***/ }), + +/***/ 8: +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - - - -var punycode = __webpack_require__(117); -var util = __webpack_require__(119); - -exports.parse = urlParse; -exports.resolve = urlResolve; -exports.resolveObject = urlResolveObject; -exports.format = urlFormat; - -exports.Url = Url; - -function Url() { - this.protocol = null; - this.slashes = null; - this.auth = null; - this.host = null; - this.port = null; - this.hostname = null; - this.hash = null; - this.search = null; - this.query = null; - this.pathname = null; - this.path = null; - this.href = null; -} - -// Reference: RFC 3986, RFC 1808, RFC 2396 - -// define these here so at least they only have to be -// compiled once on the first module load. -var protocolPattern = /^([a-z0-9.+-]+:)/i, - portPattern = /:[0-9]*$/, - - // Special case for a simple path URL - simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, - - // RFC 2396: characters reserved for delimiting URLs. - // We actually just auto-escape these. - delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], - - // RFC 2396: characters not allowed for various reasons. - unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), - - // Allowed by RFCs, but cause of XSS attacks. Always escape these. - autoEscape = ['\''].concat(unwise), - // Characters that are never ever allowed in a hostname. - // Note that any invalid chars are also handled, but these - // are the ones that are *expected* to be seen, so we fast-path - // them. - nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), - hostEndingChars = ['/', '?', '#'], - hostnameMaxLen = 255, - hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, - hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, - // protocols that can allow "unsafe" and "unwise" chars. - unsafeProtocol = { - 'javascript': true, - 'javascript:': true - }, - // protocols that never have a hostname. - hostlessProtocol = { - 'javascript': true, - 'javascript:': true - }, - // protocols that always contain a // bit. - slashedProtocol = { - 'http': true, - 'https': true, - 'ftp': true, - 'gopher': true, - 'file': true, - 'http:': true, - 'https:': true, - 'ftp:': true, - 'gopher:': true, - 'file:': true - }, - querystring = __webpack_require__(120); - -function urlParse(url, parseQueryString, slashesDenoteHost) { - if (url && util.isObject(url) && url instanceof Url) return url; - - var u = new Url; - u.parse(url, parseQueryString, slashesDenoteHost); - return u; -} - -Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { - if (!util.isString(url)) { - throw new TypeError("Parameter 'url' must be a string, not " + typeof url); - } - - // Copy chrome, IE, opera backslash-handling behavior. - // Back slashes before the query string get converted to forward slashes - // See: https://code.google.com/p/chromium/issues/detail?id=25916 - var queryIndex = url.indexOf('?'), - splitter = - (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', - uSplit = url.split(splitter), - slashRegex = /\\/g; - uSplit[0] = uSplit[0].replace(slashRegex, '/'); - url = uSplit.join(splitter); - - var rest = url; - - // trim before proceeding. - // This is to support parse stuff like " http://foo.com \n" - rest = rest.trim(); - - if (!slashesDenoteHost && url.split('#').length === 1) { - // Try fast path regexp - var simplePath = simplePathPattern.exec(rest); - if (simplePath) { - this.path = rest; - this.href = rest; - this.pathname = simplePath[1]; - if (simplePath[2]) { - this.search = simplePath[2]; - if (parseQueryString) { - this.query = querystring.parse(this.search.substr(1)); - } else { - this.query = this.search.substr(1); - } - } else if (parseQueryString) { - this.search = ''; - this.query = {}; - } - return this; - } - } - - var proto = protocolPattern.exec(rest); - if (proto) { - proto = proto[0]; - var lowerProto = proto.toLowerCase(); - this.protocol = lowerProto; - rest = rest.substr(proto.length); - } - - // figure out if it's got a host - // user@server is *always* interpreted as a hostname, and url - // resolution will treat //foo/bar as host=foo,path=bar because that's - // how the browser resolves relative URLs. - if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { - var slashes = rest.substr(0, 2) === '//'; - if (slashes && !(proto && hostlessProtocol[proto])) { - rest = rest.substr(2); - this.slashes = true; - } - } - - if (!hostlessProtocol[proto] && - (slashes || (proto && !slashedProtocol[proto]))) { - - // there's a hostname. - // the first instance of /, ?, ;, or # ends the host. - // - // If there is an @ in the hostname, then non-host chars *are* allowed - // to the left of the last @ sign, unless some host-ending character - // comes *before* the @-sign. - // URLs are obnoxious. - // - // ex: - // http://a@b@c/ => user:a@b host:c - // http://a@b?@c => user:a host:c path:/?@c - - // v0.12 TODO(isaacs): This is not quite how Chrome does things. - // Review our test case against browsers more comprehensively. - - // find the first instance of any hostEndingChars - var hostEnd = -1; - for (var i = 0; i < hostEndingChars.length; i++) { - var hec = rest.indexOf(hostEndingChars[i]); - if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) - hostEnd = hec; - } - - // at this point, either we have an explicit point where the - // auth portion cannot go past, or the last @ char is the decider. - var auth, atSign; - if (hostEnd === -1) { - // atSign can be anywhere. - atSign = rest.lastIndexOf('@'); - } else { - // atSign must be in auth portion. - // http://a@b/c@d => host:b auth:a path:/c@d - atSign = rest.lastIndexOf('@', hostEnd); - } - - // Now we have a portion which is definitely the auth. - // Pull that off. - if (atSign !== -1) { - auth = rest.slice(0, atSign); - rest = rest.slice(atSign + 1); - this.auth = decodeURIComponent(auth); - } - - // the host is the remaining to the left of the first non-host char - hostEnd = -1; - for (var i = 0; i < nonHostChars.length; i++) { - var hec = rest.indexOf(nonHostChars[i]); - if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) - hostEnd = hec; - } - // if we still have not hit it, then the entire thing is a host. - if (hostEnd === -1) - hostEnd = rest.length; - - this.host = rest.slice(0, hostEnd); - rest = rest.slice(hostEnd); - - // pull out port. - this.parseHost(); - - // we've indicated that there is a hostname, - // so even if it's empty, it has to be present. - this.hostname = this.hostname || ''; - - // if hostname begins with [ and ends with ] - // assume that it's an IPv6 address. - var ipv6Hostname = this.hostname[0] === '[' && - this.hostname[this.hostname.length - 1] === ']'; - - // validate a little. - if (!ipv6Hostname) { - var hostparts = this.hostname.split(/\./); - for (var i = 0, l = hostparts.length; i < l; i++) { - var part = hostparts[i]; - if (!part) continue; - if (!part.match(hostnamePartPattern)) { - var newpart = ''; - for (var j = 0, k = part.length; j < k; j++) { - if (part.charCodeAt(j) > 127) { - // we replace non-ASCII char with a temporary placeholder - // we need this to make sure size of hostname is not - // broken by replacing non-ASCII by nothing - newpart += 'x'; - } else { - newpart += part[j]; - } - } - // we test again with ASCII char only - if (!newpart.match(hostnamePartPattern)) { - var validParts = hostparts.slice(0, i); - var notHost = hostparts.slice(i + 1); - var bit = part.match(hostnamePartStart); - if (bit) { - validParts.push(bit[1]); - notHost.unshift(bit[2]); - } - if (notHost.length) { - rest = '/' + notHost.join('.') + rest; - } - this.hostname = validParts.join('.'); - break; - } +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; }); +function _extends() { + _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]; } } } - if (this.hostname.length > hostnameMaxLen) { - this.hostname = ''; - } else { - // hostnames are always lower case. - this.hostname = this.hostname.toLowerCase(); - } - - if (!ipv6Hostname) { - // IDNA Support: Returns a punycoded representation of "domain". - // It only converts parts of the domain name that - // have non-ASCII characters, i.e. it doesn't matter if - // you call it with a domain that already is ASCII-only. - this.hostname = punycode.toASCII(this.hostname); - } - - var p = this.port ? ':' + this.port : ''; - var h = this.hostname || ''; - this.host = h + p; - this.href += this.host; - - // strip [ and ] from the hostname - // the host field still retains them, though - if (ipv6Hostname) { - this.hostname = this.hostname.substr(1, this.hostname.length - 2); - if (rest[0] !== '/') { - rest = '/' + rest; - } - } - } - - // now rest is set to the post-host stuff. - // chop off any delim chars. - if (!unsafeProtocol[lowerProto]) { - - // First, make 100% sure that any "autoEscape" chars get - // escaped, even if encodeURIComponent doesn't think they - // need to be. - for (var i = 0, l = autoEscape.length; i < l; i++) { - var ae = autoEscape[i]; - if (rest.indexOf(ae) === -1) - continue; - var esc = encodeURIComponent(ae); - if (esc === ae) { - esc = escape(ae); - } - rest = rest.split(ae).join(esc); - } - } - - - // chop off from the tail first. - var hash = rest.indexOf('#'); - if (hash !== -1) { - // got a fragment string. - this.hash = rest.substr(hash); - rest = rest.slice(0, hash); - } - var qm = rest.indexOf('?'); - if (qm !== -1) { - this.search = rest.substr(qm); - this.query = rest.substr(qm + 1); - if (parseQueryString) { - this.query = querystring.parse(this.query); - } - rest = rest.slice(0, qm); - } else if (parseQueryString) { - // no query string, but parseQueryString still requested - this.search = ''; - this.query = {}; - } - if (rest) this.pathname = rest; - if (slashedProtocol[lowerProto] && - this.hostname && !this.pathname) { - this.pathname = '/'; - } - - //to support http.request - if (this.pathname || this.search) { - var p = this.pathname || ''; - var s = this.search || ''; - this.path = p + s; - } - - // finally, reconstruct the href based on what has been validated. - this.href = this.format(); - return this; -}; - -// format a parsed object into a url string -function urlFormat(obj) { - // ensure it's an object, and not a string url. - // If it's an obj, this is a no-op. - // this way, you can call url_format() on strings - // to clean up potentially wonky urls. - if (util.isString(obj)) obj = urlParse(obj); - if (!(obj instanceof Url)) return Url.prototype.format.call(obj); - return obj.format(); -} - -Url.prototype.format = function() { - var auth = this.auth || ''; - if (auth) { - auth = encodeURIComponent(auth); - auth = auth.replace(/%3A/i, ':'); - auth += '@'; - } - - var protocol = this.protocol || '', - pathname = this.pathname || '', - hash = this.hash || '', - host = false, - query = ''; - - if (this.host) { - host = auth + this.host; - } else if (this.hostname) { - host = auth + (this.hostname.indexOf(':') === -1 ? - this.hostname : - '[' + this.hostname + ']'); - if (this.port) { - host += ':' + this.port; - } - } - - if (this.query && - util.isObject(this.query) && - Object.keys(this.query).length) { - query = querystring.stringify(this.query); - } - - var search = this.search || (query && ('?' + query)) || ''; - - if (protocol && protocol.substr(-1) !== ':') protocol += ':'; - - // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. - // unless they had them to begin with. - if (this.slashes || - (!protocol || slashedProtocol[protocol]) && host !== false) { - host = '//' + (host || ''); - if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname; - } else if (!host) { - host = ''; - } - - if (hash && hash.charAt(0) !== '#') hash = '#' + hash; - if (search && search.charAt(0) !== '?') search = '?' + search; - - pathname = pathname.replace(/[?#]/g, function(match) { - return encodeURIComponent(match); - }); - search = search.replace('#', '%23'); - - return protocol + host + pathname + search + hash; -}; - -function urlResolve(source, relative) { - return urlParse(source, false, true).resolve(relative); -} - -Url.prototype.resolve = function(relative) { - return this.resolveObject(urlParse(relative, false, true)).format(); -}; - -function urlResolveObject(source, relative) { - if (!source) return relative; - return urlParse(source, false, true).resolveObject(relative); -} - -Url.prototype.resolveObject = function(relative) { - if (util.isString(relative)) { - var rel = new Url(); - rel.parse(relative, false, true); - relative = rel; - } - - var result = new Url(); - var tkeys = Object.keys(this); - for (var tk = 0; tk < tkeys.length; tk++) { - var tkey = tkeys[tk]; - result[tkey] = this[tkey]; - } - - // hash is always overridden, no matter what. - // even href="" will remove it. - result.hash = relative.hash; - - // if the relative url is empty, then there's nothing left to do here. - if (relative.href === '') { - result.href = result.format(); - return result; - } - - // hrefs like //foo/bar always cut to the protocol. - if (relative.slashes && !relative.protocol) { - // take everything except the protocol from relative - var rkeys = Object.keys(relative); - for (var rk = 0; rk < rkeys.length; rk++) { - var rkey = rkeys[rk]; - if (rkey !== 'protocol') - result[rkey] = relative[rkey]; - } - - //urlParse appends trailing / to urls like http://www.example.com - if (slashedProtocol[result.protocol] && - result.hostname && !result.pathname) { - result.path = result.pathname = '/'; - } - - result.href = result.format(); - return result; - } - - if (relative.protocol && relative.protocol !== result.protocol) { - // if it's a known url protocol, then changing - // the protocol does weird things - // first, if it's not file:, then we MUST have a host, - // and if there was a path - // to begin with, then we MUST have a path. - // if it is file:, then the host is dropped, - // because that's known to be hostless. - // anything else is assumed to be absolute. - if (!slashedProtocol[relative.protocol]) { - var keys = Object.keys(relative); - for (var v = 0; v < keys.length; v++) { - var k = keys[v]; - result[k] = relative[k]; - } - result.href = result.format(); - return result; - } - - result.protocol = relative.protocol; - if (!relative.host && !hostlessProtocol[relative.protocol]) { - var relPath = (relative.pathname || '').split('/'); - while (relPath.length && !(relative.host = relPath.shift())); - if (!relative.host) relative.host = ''; - if (!relative.hostname) relative.hostname = ''; - if (relPath[0] !== '') relPath.unshift(''); - if (relPath.length < 2) relPath.unshift(''); - result.pathname = relPath.join('/'); - } else { - result.pathname = relative.pathname; - } - result.search = relative.search; - result.query = relative.query; - result.host = relative.host || ''; - result.auth = relative.auth; - result.hostname = relative.hostname || relative.host; - result.port = relative.port; - // to support http.request - if (result.pathname || result.search) { - var p = result.pathname || ''; - var s = result.search || ''; - result.path = p + s; - } - result.slashes = result.slashes || relative.slashes; - result.href = result.format(); - return result; - } - - var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), - isRelAbs = ( - relative.host || - relative.pathname && relative.pathname.charAt(0) === '/' - ), - mustEndAbs = (isRelAbs || isSourceAbs || - (result.host && relative.pathname)), - removeAllDots = mustEndAbs, - srcPath = result.pathname && result.pathname.split('/') || [], - relPath = relative.pathname && relative.pathname.split('/') || [], - psychotic = result.protocol && !slashedProtocol[result.protocol]; - - // if the url is a non-slashed url, then relative - // links like ../.. should be able - // to crawl up to the hostname, as well. This is strange. - // result.protocol has already been set by now. - // Later on, put the first path part into the host field. - if (psychotic) { - result.hostname = ''; - result.port = null; - if (result.host) { - if (srcPath[0] === '') srcPath[0] = result.host; - else srcPath.unshift(result.host); - } - result.host = ''; - if (relative.protocol) { - relative.hostname = null; - relative.port = null; - if (relative.host) { - if (relPath[0] === '') relPath[0] = relative.host; - else relPath.unshift(relative.host); - } - relative.host = null; - } - mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); - } - - if (isRelAbs) { - // it's absolute. - result.host = (relative.host || relative.host === '') ? - relative.host : result.host; - result.hostname = (relative.hostname || relative.hostname === '') ? - relative.hostname : result.hostname; - result.search = relative.search; - result.query = relative.query; - srcPath = relPath; - // fall through to the dot-handling below. - } else if (relPath.length) { - // it's relative - // throw away the existing file, and take the new path instead. - if (!srcPath) srcPath = []; - srcPath.pop(); - srcPath = srcPath.concat(relPath); - result.search = relative.search; - result.query = relative.query; - } else if (!util.isNullOrUndefined(relative.search)) { - // just pull out the search. - // like href='?foo'. - // Put this after the other two cases because it simplifies the booleans - if (psychotic) { - result.hostname = result.host = srcPath.shift(); - //occationaly the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; - if (authInHost) { - result.auth = authInHost.shift(); - result.host = result.hostname = authInHost.shift(); - } - } - result.search = relative.search; - result.query = relative.query; - //to support http.request - if (!util.isNull(result.pathname) || !util.isNull(result.search)) { - result.path = (result.pathname ? result.pathname : '') + - (result.search ? result.search : ''); - } - result.href = result.format(); - return result; - } - - if (!srcPath.length) { - // no path at all. easy. - // we've already handled the other stuff above. - result.pathname = null; - //to support http.request - if (result.search) { - result.path = '/' + result.search; - } else { - result.path = null; - } - result.href = result.format(); - return result; - } - - // if a url ENDs in . or .., then it must get a trailing slash. - // however, if it ends in anything else non-slashy, - // then it must NOT get a trailing slash. - var last = srcPath.slice(-1)[0]; - var hasTrailingSlash = ( - (result.host || relative.host || srcPath.length > 1) && - (last === '.' || last === '..') || last === ''); - - // strip single dots, resolve double dots to parent dir - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = srcPath.length; i >= 0; i--) { - last = srcPath[i]; - if (last === '.') { - srcPath.splice(i, 1); - } else if (last === '..') { - srcPath.splice(i, 1); - up++; - } else if (up) { - srcPath.splice(i, 1); - up--; - } - } - - // if the path is allowed to go above the root, restore leading ..s - if (!mustEndAbs && !removeAllDots) { - for (; up--; up) { - srcPath.unshift('..'); - } - } - - if (mustEndAbs && srcPath[0] !== '' && - (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { - srcPath.unshift(''); - } - - if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { - srcPath.push(''); - } - - var isAbsolute = srcPath[0] === '' || - (srcPath[0] && srcPath[0].charAt(0) === '/'); - - // put the host back - if (psychotic) { - result.hostname = result.host = isAbsolute ? '' : - srcPath.length ? srcPath.shift() : ''; - //occationaly the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; - if (authInHost) { - result.auth = authInHost.shift(); - result.host = result.hostname = authInHost.shift(); - } - } - - mustEndAbs = mustEndAbs || (result.host && srcPath.length); - - if (mustEndAbs && !isAbsolute) { - srcPath.unshift(''); - } - - if (!srcPath.length) { - result.pathname = null; - result.path = null; - } else { - result.pathname = srcPath.join('/'); - } - - //to support request.http - if (!util.isNull(result.pathname) || !util.isNull(result.search)) { - result.path = (result.pathname ? result.pathname : '') + - (result.search ? result.search : ''); - } - result.auth = relative.auth || result.auth; - result.slashes = result.slashes || relative.slashes; - result.href = result.format(); - return result; -}; - -Url.prototype.parseHost = function() { - var host = this.host; - var port = portPattern.exec(host); - if (port) { - port = port[0]; - if (port !== ':') { - this.port = port.substr(1); - } - host = host.substr(0, host.length - port.length); - } - if (host) this.hostname = host; -}; - + return target; + }; + + return _extends.apply(this, arguments); +} /***/ }), -/***/ 89: -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - - -var ReactPropTypesSecret = __webpack_require__(90); - -function emptyFunction() {} - -module.exports = function() { - function shim(props, propName, componentName, location, propFullName, secret) { - if (secret === ReactPropTypesSecret) { - // It is still safe when called from React. - return; - } - var err = new Error( - 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + - 'Use PropTypes.checkPropTypes() to call them. ' + - 'Read more at http://fb.me/use-check-prop-types' - ); - err.name = 'Invariant Violation'; - throw err; - }; - shim.isRequired = shim; - function getShim() { - return shim; - }; - // Important! - // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. - var ReactPropTypes = { - array: shim, - bool: shim, - func: shim, - number: shim, - object: shim, - string: shim, - symbol: shim, - - any: shim, - arrayOf: getShim, - element: shim, - instanceOf: getShim, - node: shim, - objectOf: getShim, - oneOf: getShim, - oneOfType: getShim, - shape: getShim, - exact: getShim - }; - - ReactPropTypes.checkPropTypes = emptyFunction; - ReactPropTypes.PropTypes = ReactPropTypes; - - return ReactPropTypes; -}; - +/***/ 81: +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["viewport"]; }()); + +/***/ }), + +/***/ 83: +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["serverSideRender"]; }()); /***/ }), /***/ 9: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; }); -function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } -} - -function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; -} - -/***/ }), - -/***/ 90: -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - - -var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; - -module.exports = ReactPropTypesSecret; - +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["compose"]; }()); /***/ }), @@ -17331,36 +14483,17 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -/** - * Redux dispatch multiple actions - */ - -function multi(_ref) { - var dispatch = _ref.dispatch; - - return function (next) { - return function (action) { - return Array.isArray(action) ? action.filter(Boolean).map(dispatch) : next(action); - }; - }; -} - -/** - * Exports - */ - -exports.default = multi; +exports.__esModule = true; +var TextareaAutosize_1 = __webpack_require__(173); +exports["default"] = TextareaAutosize_1["default"]; + /***/ }), /***/ 98: /***/ (function(module, exports) { -(function() { module.exports = this["wp"]["wordcount"]; }()); +(function() { module.exports = this["wp"]["coreData"]; }()); /***/ })