%PDF- %PDF-
Direktori : /proc/self/root/proc/thread-self/root/var/softaculous/sitepad/editor/site-inc/js/dist/ |
Current File : //proc/self/root/proc/thread-self/root/var/softaculous/sitepad/editor/site-inc/js/dist/editor.js |
this["wp"] = this["wp"] || {}; this["wp"]["editor"] = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 303); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["element"]; }()); /***/ }), /* 1 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["i18n"]; }()); /***/ }), /* 2 */ /***/ (function(module, exports) { (function() { module.exports = this["lodash"]; }()); /***/ }), /* 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; } /***/ }), /* 4 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["components"]; }()); /***/ }), /* 5 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["data"]; }()); /***/ }), /* 6 */, /* 7 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["compose"]; }()); /***/ }), /* 8 */ /***/ (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; } /***/ }), /* 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; } /***/ }), /* 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"); } } /***/ }), /* 11 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["blocks"]; }()); /***/ }), /* 12 */ /***/ (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__(28); /* 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); } /***/ }), /* 13 */ /***/ (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); } /***/ }), /* 14 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; 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) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } /***/ }), /* 15 */ /***/ (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; } /***/ }), /* 16 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["keycodes"]; }()); /***/ }), /* 17 */ /***/ (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 {} }()); /***/ }), /* 18 */ /***/ (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); } /***/ }), /* 19 */ /***/ (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__(33); // 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(); } /***/ }), /* 20 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["richText"]; }()); /***/ }), /* 21 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } 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; } /***/ }), /* 22 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["dom"]; }()); /***/ }), /* 23 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["hooks"]; }()); /***/ }), /* 24 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["url"]; }()); /***/ }), /* 25 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js var arrayWithHoles = __webpack_require__(35); // 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__(36); // 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 */])(); } /***/ }), /* 26 */ /***/ (function(module, exports) { (function() { module.exports = this["React"]; }()); /***/ }), /* 27 */, /* 28 */ /***/ (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); } /***/ }), /* 29 */ /***/ (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__(109)(); } /***/ }), /* 30 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["apiFetch"]; }()); /***/ }), /* 31 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; var LEAF_KEY, hasWeakMap; /** * Arbitrary value used as key for referencing cache object in WeakMap tree. * * @type {Object} */ LEAF_KEY = {}; /** * Whether environment supports WeakMap. * * @type {boolean} */ hasWeakMap = typeof WeakMap !== 'undefined'; /** * Returns the first argument as the sole entry in an array. * * @param {*} value Value to return. * * @return {Array} Value returned as entry in array. */ function arrayOf( value ) { return [ value ]; } /** * Returns true if the value passed is object-like, or false otherwise. A value * is object-like if it can support property assignment, e.g. object or array. * * @param {*} value Value to test. * * @return {boolean} Whether value is object-like. */ function isObjectLike( value ) { return !! value && 'object' === typeof value; } /** * Creates and returns a new cache object. * * @return {Object} Cache object. */ function createCache() { var cache = { clear: function() { cache.head = null; }, }; return cache; } /** * Returns true if entries within the two arrays are strictly equal by * reference from a starting index. * * @param {Array} a First array. * @param {Array} b Second array. * @param {number} fromIndex Index from which to start comparison. * * @return {boolean} Whether arrays are shallowly equal. */ function isShallowEqual( a, b, fromIndex ) { var i; if ( a.length !== b.length ) { return false; } for ( i = fromIndex; i < a.length; i++ ) { if ( a[ i ] !== b[ i ] ) { return false; } } return true; } /** * Returns a memoized selector function. The getDependants function argument is * called before the memoized selector and is expected to return an immutable * reference or array of references on which the selector depends for computing * its own return value. The memoize cache is preserved only as long as those * dependant references remain the same. If getDependants returns a different * reference(s), the cache is cleared and the selector value regenerated. * * @param {Function} selector Selector function. * @param {Function} getDependants Dependant getter returning an immutable * reference or array of reference used in * cache bust consideration. * * @return {Function} Memoized selector. */ /* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) { var rootCache, getCache; // Use object source as dependant if getter not provided if ( ! getDependants ) { getDependants = arrayOf; } /** * Returns the root cache. If WeakMap is supported, this is assigned to the * root WeakMap cache set, otherwise it is a shared instance of the default * cache object. * * @return {(WeakMap|Object)} Root cache object. */ function getRootCache() { return rootCache; } /** * Returns the cache for a given dependants array. When possible, a WeakMap * will be used to create a unique cache for each set of dependants. This * is feasible due to the nature of WeakMap in allowing garbage collection * to occur on entries where the key object is no longer referenced. Since * WeakMap requires the key to be an object, this is only possible when the * dependant is object-like. The root cache is created as a hierarchy where * each top-level key is the first entry in a dependants set, the value a * WeakMap where each key is the next dependant, and so on. This continues * so long as the dependants are object-like. If no dependants are object- * like, then the cache is shared across all invocations. * * @see isObjectLike * * @param {Array} dependants Selector dependants. * * @return {Object} Cache object. */ function getWeakMapCache( dependants ) { var caches = rootCache, isUniqueByDependants = true, i, dependant, map, cache; for ( i = 0; i < dependants.length; i++ ) { dependant = dependants[ i ]; // Can only compose WeakMap from object-like key. if ( ! isObjectLike( dependant ) ) { isUniqueByDependants = false; break; } // Does current segment of cache already have a WeakMap? if ( caches.has( dependant ) ) { // Traverse into nested WeakMap. caches = caches.get( dependant ); } else { // Create, set, and traverse into a new one. map = new WeakMap(); caches.set( dependant, map ); caches = map; } } // We use an arbitrary (but consistent) object as key for the last item // in the WeakMap to serve as our running cache. if ( ! caches.has( LEAF_KEY ) ) { cache = createCache(); cache.isUniqueByDependants = isUniqueByDependants; caches.set( LEAF_KEY, cache ); } return caches.get( LEAF_KEY ); } // Assign cache handler by availability of WeakMap getCache = hasWeakMap ? getWeakMapCache : getRootCache; /** * Resets root memoization cache. */ function clear() { rootCache = hasWeakMap ? new WeakMap() : createCache(); } // eslint-disable-next-line jsdoc/check-param-names /** * The augmented selector call, considering first whether dependants have * changed before passing it to underlying memoize function. * * @param {Object} source Source object for derivation. * @param {...*} extraArgs Additional arguments to pass to selector. * * @return {*} Selector result. */ function callSelector( /* source, ...extraArgs */ ) { var len = arguments.length, cache, node, i, args, dependants; // Create copy of arguments (avoid leaking deoptimization). args = new Array( len ); for ( i = 0; i < len; i++ ) { args[ i ] = arguments[ i ]; } dependants = getDependants.apply( null, args ); cache = getCache( dependants ); // If not guaranteed uniqueness by dependants (primitive type or lack // of WeakMap support), shallow compare against last dependants and, if // references have changed, destroy cache to recalculate result. if ( ! cache.isUniqueByDependants ) { if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) { cache.clear(); } cache.lastDependants = dependants; } node = cache.head; while ( node ) { // Check whether node arguments match arguments if ( ! isShallowEqual( node.args, args, 1 ) ) { node = node.next; continue; } // At this point we can assume we've found a match // Surface matched node to head if not already if ( node !== cache.head ) { // Adjust siblings to point to each other. node.prev.next = node.next; if ( node.next ) { node.next.prev = node.prev; } node.next = cache.head; node.prev = null; cache.head.prev = node; cache.head = node; } // Return immediately return node.val; } // No cached value found. Continue to insertion phase: node = { // Generate the result from original function val: selector.apply( null, args ), }; // Avoid including the source object in the cache. args[ 0 ] = null; node.args = 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 ( cache.head ) { cache.head.prev = node; node.next = cache.head; } cache.head = node; return node.val; } callSelector.getDependants = getDependants; callSelector.clear = clear; clear(); return callSelector; }); /***/ }), /* 32 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["blob"]; }()); /***/ }), /* 33 */ /***/ (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); } /***/ }), /* 34 */, /* 35 */ /***/ (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; } /***/ }), /* 36 */ /***/ (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"); } /***/ }), /* 37 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["viewport"]; }()); /***/ }), /* 38 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _asyncToGenerator; }); function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } /***/ }), /* 39 */, /* 40 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["isShallowEqual"]; }()); /***/ }), /* 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; }; /***/ }), /* 42 */, /* 43 */, /* 44 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["a11y"]; }()); /***/ }), /* 45 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;// TinyColor v1.4.1 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License (function(Math) { var trimLeft = /^\s+/, trimRight = /\s+$/, tinyCounter = 0, mathRound = Math.round, mathMin = Math.min, mathMax = Math.max, mathRandom = Math.random; function tinycolor (color, opts) { color = (color) ? color : ''; opts = opts || { }; // If input is already a tinycolor, return itself if (color instanceof tinycolor) { return color; } // If we are called as a function, call using new instead if (!(this instanceof tinycolor)) { return new tinycolor(color, opts); } var rgb = inputToRGB(color); this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = mathRound(100*this._a) / 100, this._format = opts.format || rgb.format; this._gradientType = opts.gradientType; // Don't let the range of [0,255] come back in [0,1]. // Potentially lose a little bit of precision here, but will fix issues where // .5 gets interpreted as half of the total, instead of half of 1 // If it was supposed to be 128, this was already taken care of by `inputToRgb` if (this._r < 1) { this._r = mathRound(this._r); } if (this._g < 1) { this._g = mathRound(this._g); } if (this._b < 1) { this._b = mathRound(this._b); } this._ok = rgb.ok; this._tc_id = tinyCounter++; } tinycolor.prototype = { isDark: function() { return this.getBrightness() < 128; }, isLight: function() { return !this.isDark(); }, isValid: function() { return this._ok; }, getOriginalInput: function() { return this._originalInput; }, getFormat: function() { return this._format; }, getAlpha: function() { return this._a; }, getBrightness: function() { //http://www.w3.org/TR/AERT#color-contrast var rgb = this.toRgb(); return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; }, getLuminance: function() { //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef var rgb = this.toRgb(); var RsRGB, GsRGB, BsRGB, R, G, B; RsRGB = rgb.r/255; GsRGB = rgb.g/255; BsRGB = rgb.b/255; if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);} if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);} if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);} return (0.2126 * R) + (0.7152 * G) + (0.0722 * B); }, setAlpha: function(value) { this._a = boundAlpha(value); this._roundA = mathRound(100*this._a) / 100; return this; }, toHsv: function() { var hsv = rgbToHsv(this._r, this._g, this._b); return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a }; }, toHsvString: function() { var hsv = rgbToHsv(this._r, this._g, this._b); var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100); return (this._a == 1) ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")"; }, toHsl: function() { var hsl = rgbToHsl(this._r, this._g, this._b); return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a }; }, toHslString: function() { var hsl = rgbToHsl(this._r, this._g, this._b); var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100); return (this._a == 1) ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")"; }, toHex: function(allow3Char) { return rgbToHex(this._r, this._g, this._b, allow3Char); }, toHexString: function(allow3Char) { return '#' + this.toHex(allow3Char); }, toHex8: function(allow4Char) { return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char); }, toHex8String: function(allow4Char) { return '#' + this.toHex8(allow4Char); }, toRgb: function() { return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a }; }, toRgbString: function() { return (this._a == 1) ? "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" : "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")"; }, toPercentageRgb: function() { return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a }; }, toPercentageRgbString: function() { return (this._a == 1) ? "rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" : "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; }, toName: function() { if (this._a === 0) { return "transparent"; } if (this._a < 1) { return false; } return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; }, toFilter: function(secondColor) { var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a); var secondHex8String = hex8String; var gradientType = this._gradientType ? "GradientType = 1, " : ""; if (secondColor) { var s = tinycolor(secondColor); secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a); } return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")"; }, toString: function(format) { var formatSet = !!format; format = format || this._format; var formattedString = false; var hasAlpha = this._a < 1 && this._a >= 0; var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name"); if (needsAlphaFormat) { // Special case for "transparent", all other non-alpha formats // will return rgba when there is transparency. if (format === "name" && this._a === 0) { return this.toName(); } return this.toRgbString(); } if (format === "rgb") { formattedString = this.toRgbString(); } if (format === "prgb") { formattedString = this.toPercentageRgbString(); } if (format === "hex" || format === "hex6") { formattedString = this.toHexString(); } if (format === "hex3") { formattedString = this.toHexString(true); } if (format === "hex4") { formattedString = this.toHex8String(true); } if (format === "hex8") { formattedString = this.toHex8String(); } if (format === "name") { formattedString = this.toName(); } if (format === "hsl") { formattedString = this.toHslString(); } if (format === "hsv") { formattedString = this.toHsvString(); } return formattedString || this.toHexString(); }, clone: function() { return tinycolor(this.toString()); }, _applyModification: function(fn, args) { var color = fn.apply(null, [this].concat([].slice.call(args))); this._r = color._r; this._g = color._g; this._b = color._b; this.setAlpha(color._a); return this; }, lighten: function() { return this._applyModification(lighten, arguments); }, brighten: function() { return this._applyModification(brighten, arguments); }, darken: function() { return this._applyModification(darken, arguments); }, desaturate: function() { return this._applyModification(desaturate, arguments); }, saturate: function() { return this._applyModification(saturate, arguments); }, greyscale: function() { return this._applyModification(greyscale, arguments); }, spin: function() { return this._applyModification(spin, arguments); }, _applyCombination: function(fn, args) { return fn.apply(null, [this].concat([].slice.call(args))); }, analogous: function() { return this._applyCombination(analogous, arguments); }, complement: function() { return this._applyCombination(complement, arguments); }, monochromatic: function() { return this._applyCombination(monochromatic, arguments); }, splitcomplement: function() { return this._applyCombination(splitcomplement, arguments); }, triad: function() { return this._applyCombination(triad, arguments); }, tetrad: function() { return this._applyCombination(tetrad, arguments); } }; // If input is an object, force 1 into "1.0" to handle ratios properly // String input requires "1.0" as input, so 1 will be treated as 1 tinycolor.fromRatio = function(color, opts) { if (typeof color == "object") { var newColor = {}; for (var i in color) { if (color.hasOwnProperty(i)) { if (i === "a") { newColor[i] = color[i]; } else { newColor[i] = convertToPercentage(color[i]); } } } color = newColor; } return tinycolor(color, opts); }; // Given a string or object, convert that input to RGB // Possible string inputs: // // "red" // "#f00" or "f00" // "#ff0000" or "ff0000" // "#ff000000" or "ff000000" // "rgb 255 0 0" or "rgb (255, 0, 0)" // "rgb 1.0 0 0" or "rgb (1, 0, 0)" // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" // function inputToRGB(color) { var rgb = { r: 0, g: 0, b: 0 }; var a = 1; var s = null; var v = null; var l = null; var ok = false; var format = false; if (typeof color == "string") { color = stringInputToObject(color); } if (typeof color == "object") { if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { rgb = rgbToRgb(color.r, color.g, color.b); ok = true; format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { s = convertToPercentage(color.s); v = convertToPercentage(color.v); rgb = hsvToRgb(color.h, s, v); ok = true; format = "hsv"; } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { s = convertToPercentage(color.s); l = convertToPercentage(color.l); rgb = hslToRgb(color.h, s, l); ok = true; format = "hsl"; } if (color.hasOwnProperty("a")) { a = color.a; } } a = boundAlpha(a); return { ok: ok, format: color.format || format, r: mathMin(255, mathMax(rgb.r, 0)), g: mathMin(255, mathMax(rgb.g, 0)), b: mathMin(255, mathMax(rgb.b, 0)), a: a }; } // Conversion Functions // -------------------- // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: // <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript> // `rgbToRgb` // Handle bounds / percentage checking to conform to CSS color spec // <http://www.w3.org/TR/css3-color/> // *Assumes:* r, g, b in [0, 255] or [0, 1] // *Returns:* { r, g, b } in [0, 255] function rgbToRgb(r, g, b){ return { r: bound01(r, 255) * 255, g: bound01(g, 255) * 255, b: bound01(b, 255) * 255 }; } // `rgbToHsl` // Converts an RGB color value to HSL. // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] // *Returns:* { h, s, l } in [0,1] function rgbToHsl(r, g, b) { r = bound01(r, 255); g = bound01(g, 255); b = bound01(b, 255); var max = mathMax(r, g, b), min = mathMin(r, g, b); var h, s, l = (max + min) / 2; if(max == min) { h = s = 0; // achromatic } else { var d = max - min; s = l > 0.5 ? d / (2 - max - min) : d / (max + min); switch(max) { case r: h = (g - b) / d + (g < b ? 6 : 0); break; case g: h = (b - r) / d + 2; break; case b: h = (r - g) / d + 4; break; } h /= 6; } return { h: h, s: s, l: l }; } // `hslToRgb` // Converts an HSL color value to RGB. // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] // *Returns:* { r, g, b } in the set [0, 255] function hslToRgb(h, s, l) { var r, g, b; h = bound01(h, 360); s = bound01(s, 100); l = bound01(l, 100); function hue2rgb(p, q, t) { if(t < 0) t += 1; if(t > 1) t -= 1; if(t < 1/6) return p + (q - p) * 6 * t; if(t < 1/2) return q; if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; return p; } if(s === 0) { r = g = b = l; // achromatic } else { var q = l < 0.5 ? l * (1 + s) : l + s - l * s; var p = 2 * l - q; r = hue2rgb(p, q, h + 1/3); g = hue2rgb(p, q, h); b = hue2rgb(p, q, h - 1/3); } return { r: r * 255, g: g * 255, b: b * 255 }; } // `rgbToHsv` // Converts an RGB color value to HSV // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] // *Returns:* { h, s, v } in [0,1] function rgbToHsv(r, g, b) { r = bound01(r, 255); g = bound01(g, 255); b = bound01(b, 255); var max = mathMax(r, g, b), min = mathMin(r, g, b); var h, s, v = max; var d = max - min; s = max === 0 ? 0 : d / max; if(max == min) { h = 0; // achromatic } else { switch(max) { case r: h = (g - b) / d + (g < b ? 6 : 0); break; case g: h = (b - r) / d + 2; break; case b: h = (r - g) / d + 4; break; } h /= 6; } return { h: h, s: s, v: v }; } // `hsvToRgb` // Converts an HSV color value to RGB. // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] // *Returns:* { r, g, b } in the set [0, 255] function hsvToRgb(h, s, v) { h = bound01(h, 360) * 6; s = bound01(s, 100); v = bound01(v, 100); var i = Math.floor(h), f = h - i, p = v * (1 - s), q = v * (1 - f * s), t = v * (1 - (1 - f) * s), mod = i % 6, r = [v, q, p, p, t, v][mod], g = [t, v, v, q, p, p][mod], b = [p, p, t, v, v, q][mod]; return { r: r * 255, g: g * 255, b: b * 255 }; } // `rgbToHex` // Converts an RGB color to hex // Assumes r, g, and b are contained in the set [0, 255] // Returns a 3 or 6 character hex function rgbToHex(r, g, b, allow3Char) { var hex = [ pad2(mathRound(r).toString(16)), pad2(mathRound(g).toString(16)), pad2(mathRound(b).toString(16)) ]; // Return a 3 character hex if possible if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) { return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); } return hex.join(""); } // `rgbaToHex` // Converts an RGBA color plus alpha transparency to hex // Assumes r, g, b are contained in the set [0, 255] and // a in [0, 1]. Returns a 4 or 8 character rgba hex function rgbaToHex(r, g, b, a, allow4Char) { var hex = [ pad2(mathRound(r).toString(16)), pad2(mathRound(g).toString(16)), pad2(mathRound(b).toString(16)), pad2(convertDecimalToHex(a)) ]; // Return a 4 character hex if possible if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) { return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); } return hex.join(""); } // `rgbaToArgbHex` // Converts an RGBA color to an ARGB Hex8 string // Rarely used, but required for "toFilter()" function rgbaToArgbHex(r, g, b, a) { var hex = [ pad2(convertDecimalToHex(a)), pad2(mathRound(r).toString(16)), pad2(mathRound(g).toString(16)), pad2(mathRound(b).toString(16)) ]; return hex.join(""); } // `equals` // Can be called with any tinycolor input tinycolor.equals = function (color1, color2) { if (!color1 || !color2) { return false; } return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); }; tinycolor.random = function() { return tinycolor.fromRatio({ r: mathRandom(), g: mathRandom(), b: mathRandom() }); }; // Modification Functions // ---------------------- // Thanks to less.js for some of the basics here // <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js> function desaturate(color, amount) { amount = (amount === 0) ? 0 : (amount || 10); var hsl = tinycolor(color).toHsl(); hsl.s -= amount / 100; hsl.s = clamp01(hsl.s); return tinycolor(hsl); } function saturate(color, amount) { amount = (amount === 0) ? 0 : (amount || 10); var hsl = tinycolor(color).toHsl(); hsl.s += amount / 100; hsl.s = clamp01(hsl.s); return tinycolor(hsl); } function greyscale(color) { return tinycolor(color).desaturate(100); } function lighten (color, amount) { amount = (amount === 0) ? 0 : (amount || 10); var hsl = tinycolor(color).toHsl(); hsl.l += amount / 100; hsl.l = clamp01(hsl.l); return tinycolor(hsl); } function brighten(color, amount) { amount = (amount === 0) ? 0 : (amount || 10); var rgb = tinycolor(color).toRgb(); rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100)))); rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100)))); rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100)))); return tinycolor(rgb); } function darken (color, amount) { amount = (amount === 0) ? 0 : (amount || 10); var hsl = tinycolor(color).toHsl(); hsl.l -= amount / 100; hsl.l = clamp01(hsl.l); return tinycolor(hsl); } // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. // Values outside of this range will be wrapped into this range. function spin(color, amount) { var hsl = tinycolor(color).toHsl(); var hue = (hsl.h + amount) % 360; hsl.h = hue < 0 ? 360 + hue : hue; return tinycolor(hsl); } // Combination Functions // --------------------- // Thanks to jQuery xColor for some of the ideas behind these // <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js> function complement(color) { var hsl = tinycolor(color).toHsl(); hsl.h = (hsl.h + 180) % 360; return tinycolor(hsl); } function triad(color) { var hsl = tinycolor(color).toHsl(); var h = hsl.h; return [ tinycolor(color), tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }), tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l }) ]; } function tetrad(color) { var hsl = tinycolor(color).toHsl(); var h = hsl.h; return [ tinycolor(color), tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }), tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }), tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l }) ]; } function splitcomplement(color) { var hsl = tinycolor(color).toHsl(); var h = hsl.h; return [ tinycolor(color), tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}), tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l}) ]; } function analogous(color, results, slices) { results = results || 6; slices = slices || 30; var hsl = tinycolor(color).toHsl(); var part = 360 / slices; var ret = [tinycolor(color)]; for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) { hsl.h = (hsl.h + part) % 360; ret.push(tinycolor(hsl)); } return ret; } function monochromatic(color, results) { results = results || 6; var hsv = tinycolor(color).toHsv(); var h = hsv.h, s = hsv.s, v = hsv.v; var ret = []; var modification = 1 / results; while (results--) { ret.push(tinycolor({ h: h, s: s, v: v})); v = (v + modification) % 1; } return ret; } // Utility Functions // --------------------- tinycolor.mix = function(color1, color2, amount) { amount = (amount === 0) ? 0 : (amount || 50); var rgb1 = tinycolor(color1).toRgb(); var rgb2 = tinycolor(color2).toRgb(); var p = amount / 100; var rgba = { r: ((rgb2.r - rgb1.r) * p) + rgb1.r, g: ((rgb2.g - rgb1.g) * p) + rgb1.g, b: ((rgb2.b - rgb1.b) * p) + rgb1.b, a: ((rgb2.a - rgb1.a) * p) + rgb1.a }; return tinycolor(rgba); }; // Readability Functions // --------------------- // <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2) // `contrast` // Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2) tinycolor.readability = function(color1, color2) { var c1 = tinycolor(color1); var c2 = tinycolor(color2); return (Math.max(c1.getLuminance(),c2.getLuminance())+0.05) / (Math.min(c1.getLuminance(),c2.getLuminance())+0.05); }; // `isReadable` // Ensure that foreground and background color combinations meet WCAG2 guidelines. // The third argument is an optional Object. // the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA'; // the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'. // If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}. // *Example* // tinycolor.isReadable("#000", "#111") => false // tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false tinycolor.isReadable = function(color1, color2, wcag2) { var readability = tinycolor.readability(color1, color2); var wcag2Parms, out; out = false; wcag2Parms = validateWCAG2Parms(wcag2); switch (wcag2Parms.level + wcag2Parms.size) { case "AAsmall": case "AAAlarge": out = readability >= 4.5; break; case "AAlarge": out = readability >= 3; break; case "AAAsmall": out = readability >= 7; break; } return out; }; // `mostReadable` // Given a base color and a list of possible foreground or background // colors for that base, returns the most readable color. // Optionally returns Black or White if the most readable color is unreadable. // *Example* // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff" tinycolor.mostReadable = function(baseColor, colorList, args) { var bestColor = null; var bestScore = 0; var readability; var includeFallbackColors, level, size ; args = args || {}; includeFallbackColors = args.includeFallbackColors ; level = args.level; size = args.size; for (var i= 0; i < colorList.length ; i++) { readability = tinycolor.readability(baseColor, colorList[i]); if (readability > bestScore) { bestScore = readability; bestColor = tinycolor(colorList[i]); } } if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) { return bestColor; } else { args.includeFallbackColors=false; return tinycolor.mostReadable(baseColor,["#fff", "#000"],args); } }; // Big List of Colors // ------------------ // <http://www.w3.org/TR/css3-color/#svg-color> var names = tinycolor.names = { aliceblue: "f0f8ff", antiquewhite: "faebd7", aqua: "0ff", aquamarine: "7fffd4", azure: "f0ffff", beige: "f5f5dc", bisque: "ffe4c4", black: "000", blanchedalmond: "ffebcd", blue: "00f", blueviolet: "8a2be2", brown: "a52a2a", burlywood: "deb887", burntsienna: "ea7e5d", cadetblue: "5f9ea0", chartreuse: "7fff00", chocolate: "d2691e", coral: "ff7f50", cornflowerblue: "6495ed", cornsilk: "fff8dc", crimson: "dc143c", cyan: "0ff", darkblue: "00008b", darkcyan: "008b8b", darkgoldenrod: "b8860b", darkgray: "a9a9a9", darkgreen: "006400", darkgrey: "a9a9a9", darkkhaki: "bdb76b", darkmagenta: "8b008b", darkolivegreen: "556b2f", darkorange: "ff8c00", darkorchid: "9932cc", darkred: "8b0000", darksalmon: "e9967a", darkseagreen: "8fbc8f", darkslateblue: "483d8b", darkslategray: "2f4f4f", darkslategrey: "2f4f4f", darkturquoise: "00ced1", darkviolet: "9400d3", deeppink: "ff1493", deepskyblue: "00bfff", dimgray: "696969", dimgrey: "696969", dodgerblue: "1e90ff", firebrick: "b22222", floralwhite: "fffaf0", forestgreen: "228b22", fuchsia: "f0f", gainsboro: "dcdcdc", ghostwhite: "f8f8ff", gold: "ffd700", goldenrod: "daa520", gray: "808080", green: "008000", greenyellow: "adff2f", grey: "808080", honeydew: "f0fff0", hotpink: "ff69b4", indianred: "cd5c5c", indigo: "4b0082", ivory: "fffff0", khaki: "f0e68c", lavender: "e6e6fa", lavenderblush: "fff0f5", lawngreen: "7cfc00", lemonchiffon: "fffacd", lightblue: "add8e6", lightcoral: "f08080", lightcyan: "e0ffff", lightgoldenrodyellow: "fafad2", lightgray: "d3d3d3", lightgreen: "90ee90", lightgrey: "d3d3d3", lightpink: "ffb6c1", lightsalmon: "ffa07a", lightseagreen: "20b2aa", lightskyblue: "87cefa", lightslategray: "789", lightslategrey: "789", lightsteelblue: "b0c4de", lightyellow: "ffffe0", lime: "0f0", limegreen: "32cd32", linen: "faf0e6", magenta: "f0f", maroon: "800000", mediumaquamarine: "66cdaa", mediumblue: "0000cd", mediumorchid: "ba55d3", mediumpurple: "9370db", mediumseagreen: "3cb371", mediumslateblue: "7b68ee", mediumspringgreen: "00fa9a", mediumturquoise: "48d1cc", mediumvioletred: "c71585", midnightblue: "191970", mintcream: "f5fffa", mistyrose: "ffe4e1", moccasin: "ffe4b5", navajowhite: "ffdead", navy: "000080", oldlace: "fdf5e6", olive: "808000", olivedrab: "6b8e23", orange: "ffa500", orangered: "ff4500", orchid: "da70d6", palegoldenrod: "eee8aa", palegreen: "98fb98", paleturquoise: "afeeee", palevioletred: "db7093", papayawhip: "ffefd5", peachpuff: "ffdab9", peru: "cd853f", pink: "ffc0cb", plum: "dda0dd", powderblue: "b0e0e6", purple: "800080", rebeccapurple: "663399", red: "f00", rosybrown: "bc8f8f", royalblue: "4169e1", saddlebrown: "8b4513", salmon: "fa8072", sandybrown: "f4a460", seagreen: "2e8b57", seashell: "fff5ee", sienna: "a0522d", silver: "c0c0c0", skyblue: "87ceeb", slateblue: "6a5acd", slategray: "708090", slategrey: "708090", snow: "fffafa", springgreen: "00ff7f", steelblue: "4682b4", tan: "d2b48c", teal: "008080", thistle: "d8bfd8", tomato: "ff6347", turquoise: "40e0d0", violet: "ee82ee", wheat: "f5deb3", white: "fff", whitesmoke: "f5f5f5", yellow: "ff0", yellowgreen: "9acd32" }; // Make it easy to access colors via `hexNames[hex]` var hexNames = tinycolor.hexNames = flip(names); // Utilities // --------- // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` function flip(o) { var flipped = { }; for (var i in o) { if (o.hasOwnProperty(i)) { flipped[o[i]] = i; } } return flipped; } // Return a valid alpha value [0,1] with all invalid values being set to 1 function boundAlpha(a) { a = parseFloat(a); if (isNaN(a) || a < 0 || a > 1) { a = 1; } return a; } // Take input from [0, n] and return it as [0, 1] function bound01(n, max) { if (isOnePointZero(n)) { n = "100%"; } var processPercent = isPercentage(n); n = mathMin(max, mathMax(0, parseFloat(n))); // Automatically convert percentage into number if (processPercent) { n = parseInt(n * max, 10) / 100; } // Handle floating point rounding errors if ((Math.abs(n - max) < 0.000001)) { return 1; } // Convert into [0, 1] range if it isn't already return (n % max) / parseFloat(max); } // Force a number between 0 and 1 function clamp01(val) { return mathMin(1, mathMax(0, val)); } // Parse a base-16 hex value into a base-10 integer function parseIntFromHex(val) { return parseInt(val, 16); } // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 // <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0> function isOnePointZero(n) { return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1; } // Check to see if string passed in is a percentage function isPercentage(n) { return typeof n === "string" && n.indexOf('%') != -1; } // Force a hex value to have 2 characters function pad2(c) { return c.length == 1 ? '0' + c : '' + c; } // Replace a decimal with it's percentage value function convertToPercentage(n) { if (n <= 1) { n = (n * 100) + "%"; } return n; } // Converts a decimal to a hex value function convertDecimalToHex(d) { return Math.round(parseFloat(d) * 255).toString(16); } // Converts a hex value to a decimal function convertHexToDecimal(h) { return (parseIntFromHex(h) / 255); } var matchers = (function() { // <http://www.w3.org/TR/css3-values/#integers> var CSS_INTEGER = "[-\\+]?\\d+%?"; // <http://www.w3.org/TR/css3-values/#number-value> var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; // Actual matching. // Parentheses and commas are optional, but not required. // Whitespace can take the place of commas or opening paren var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; return { CSS_UNIT: new RegExp(CSS_UNIT), rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ }; })(); // `isValidCSSUnit` // Take in a single string / number and check to see if it looks like a CSS unit // (see `matchers` above for definition). function isValidCSSUnit(color) { return !!matchers.CSS_UNIT.exec(color); } // `stringInputToObject` // Permissive string parsing. Take in a number of formats, and output an object // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` function stringInputToObject(color) { color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase(); var named = false; if (names[color]) { color = names[color]; named = true; } else if (color == 'transparent') { return { r: 0, g: 0, b: 0, a: 0, format: "name" }; } // Try to match string input using regular expressions. // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] // Just return an object and let the conversion functions handle that. // This way the result will be the same whether the tinycolor is initialized with string or object. var match; if ((match = matchers.rgb.exec(color))) { return { r: match[1], g: match[2], b: match[3] }; } if ((match = matchers.rgba.exec(color))) { return { r: match[1], g: match[2], b: match[3], a: match[4] }; } if ((match = matchers.hsl.exec(color))) { return { h: match[1], s: match[2], l: match[3] }; } if ((match = matchers.hsla.exec(color))) { return { h: match[1], s: match[2], l: match[3], a: match[4] }; } if ((match = matchers.hsv.exec(color))) { return { h: match[1], s: match[2], v: match[3] }; } if ((match = matchers.hsva.exec(color))) { return { h: match[1], s: match[2], v: match[3], a: match[4] }; } if ((match = matchers.hex8.exec(color))) { return { r: parseIntFromHex(match[1]), g: parseIntFromHex(match[2]), b: parseIntFromHex(match[3]), a: convertHexToDecimal(match[4]), format: named ? "name" : "hex8" }; } if ((match = matchers.hex6.exec(color))) { return { r: parseIntFromHex(match[1]), g: parseIntFromHex(match[2]), b: parseIntFromHex(match[3]), format: named ? "name" : "hex" }; } if ((match = matchers.hex4.exec(color))) { return { r: parseIntFromHex(match[1] + '' + match[1]), g: parseIntFromHex(match[2] + '' + match[2]), b: parseIntFromHex(match[3] + '' + match[3]), a: convertHexToDecimal(match[4] + '' + match[4]), format: named ? "name" : "hex8" }; } if ((match = matchers.hex3.exec(color))) { return { r: parseIntFromHex(match[1] + '' + match[1]), g: parseIntFromHex(match[2] + '' + match[2]), b: parseIntFromHex(match[3] + '' + match[3]), format: named ? "name" : "hex" }; } return false; } function validateWCAG2Parms(parms) { // return valid WCAG2 parms for isReadable. // If input parms are invalid, return {"level":"AA", "size":"small"} var level, size; parms = parms || {"level":"AA", "size":"small"}; level = (parms.level || "AA").toUpperCase(); size = (parms.size || "small").toLowerCase(); if (level !== "AA" && level !== "AAA") { level = "AA"; } if (size !== "small" && size !== "large") { size = "small"; } return {"level":level, "size":size}; } // Node: Export function if ( true && module.exports) { module.exports = tinycolor; } // AMD/requirejs: Define the module else if (true) { !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {return tinycolor;}).call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } // Browser: Expose to window else {} })(Math); /***/ }), /* 46 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["date"]; }()); /***/ }), /* 47 */, /* 48 */, /* 49 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["htmlEntities"]; }()); /***/ }), /* 50 */, /* 51 */ /***/ (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; /***/ }), /* 52 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["nux"]; }()); /***/ }), /* 53 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(270); /***/ }), /* 54 */, /* 55 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var TextareaAutosize_1 = __webpack_require__(271); exports["default"] = TextareaAutosize_1["default"]; /***/ }), /* 56 */, /* 57 */, /* 58 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["autop"]; }()); /***/ }), /* 59 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = __webpack_require__(118); /***/ }), /* 60 */, /* 61 */, /* 62 */, /* 63 */, /* 64 */, /* 65 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["deprecated"]; }()); /***/ }), /* 66 */, /* 67 */, /* 68 */, /* 69 */, /* 70 */, /* 71 */, /* 72 */, /* 73 */, /* 74 */, /* 75 */ /***/ (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 punycode = __webpack_require__(100); var util = __webpack_require__(102); 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__(103); 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; } } } } 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; }; /***/ }), /* 76 */, /* 77 */, /* 78 */, /* 79 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["coreData"]; }()); /***/ }), /* 80 */, /* 81 */, /* 82 */, /* 83 */, /* 84 */, /* 85 */, /* 86 */, /* 87 */ /***/ (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; /***/ }), /* 88 */, /* 89 */, /* 90 */, /* 91 */, /* 92 */, /* 93 */, /* 94 */, /* 95 */, /* 96 */, /* 97 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["wordcount"]; }()); /***/ }), /* 98 */ /***/ (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 } } /***/ }), /* 99 */ /***/ (function(module, exports) { (function() { module.exports = this["jQuery"]; }()); /***/ }), /* 100 */ /***/ (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 <https://mathiasbynens.be/notes/javascript-encoding> * @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 <n,i> state to <m,0>, // 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 <https://mathiasbynens.be/notes/javascript-encoding> * @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__(101)(module), __webpack_require__(51))) /***/ }), /* 101 */ /***/ (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; }; /***/ }), /* 102 */ /***/ (function(module, 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; } }; /***/ }), /* 103 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.decode = exports.parse = __webpack_require__(104); exports.encode = exports.stringify = __webpack_require__(105); /***/ }), /* 104 */ /***/ (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]'; }; /***/ }), /* 105 */ /***/ (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; }; /***/ }), /* 106 */, /* 107 */, /* 108 */, /* 109 */ /***/ (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__(110); 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; }; /***/ }), /* 110 */ /***/ (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; /***/ }), /* 111 */, /* 112 */, /* 113 */, /* 114 */, /* 115 */, /* 116 */, /* 117 */, /* 118 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var util = __webpack_require__(119); function scrollIntoView(elem, container, config) { config = config || {}; // document 归一化到 window if (container.nodeType === 9) { container = util.getWindow(container); } var allowHorizontalScroll = config.allowHorizontalScroll; var onlyScrollIfNeeded = config.onlyScrollIfNeeded; var alignWithTop = config.alignWithTop; var alignWithLeft = config.alignWithLeft; var offsetTop = config.offsetTop || 0; var offsetLeft = config.offsetLeft || 0; var offsetBottom = config.offsetBottom || 0; var offsetRight = config.offsetRight || 0; allowHorizontalScroll = allowHorizontalScroll === undefined ? true : allowHorizontalScroll; var isWin = util.isWindow(container); var elemOffset = util.offset(elem); var eh = util.outerHeight(elem); var ew = util.outerWidth(elem); var containerOffset = undefined; var ch = undefined; var cw = undefined; var containerScroll = undefined; var diffTop = undefined; var diffBottom = undefined; var win = undefined; var winScroll = undefined; var ww = undefined; var wh = undefined; if (isWin) { win = container; wh = util.height(win); ww = util.width(win); winScroll = { left: util.scrollLeft(win), top: util.scrollTop(win) }; // elem 相对 container 可视视窗的距离 diffTop = { left: elemOffset.left - winScroll.left - offsetLeft, top: elemOffset.top - winScroll.top - offsetTop }; diffBottom = { left: elemOffset.left + ew - (winScroll.left + ww) + offsetRight, top: elemOffset.top + eh - (winScroll.top + wh) + offsetBottom }; containerScroll = winScroll; } else { containerOffset = util.offset(container); ch = container.clientHeight; cw = container.clientWidth; containerScroll = { left: container.scrollLeft, top: container.scrollTop }; // elem 相对 container 可视视窗的距离 // 注意边框, offset 是边框到根节点 diffTop = { left: elemOffset.left - (containerOffset.left + (parseFloat(util.css(container, 'borderLeftWidth')) || 0)) - offsetLeft, top: elemOffset.top - (containerOffset.top + (parseFloat(util.css(container, 'borderTopWidth')) || 0)) - offsetTop }; diffBottom = { left: elemOffset.left + ew - (containerOffset.left + cw + (parseFloat(util.css(container, 'borderRightWidth')) || 0)) + offsetRight, top: elemOffset.top + eh - (containerOffset.top + ch + (parseFloat(util.css(container, 'borderBottomWidth')) || 0)) + offsetBottom }; } if (diffTop.top < 0 || diffBottom.top > 0) { // 强制向上 if (alignWithTop === true) { util.scrollTop(container, containerScroll.top + diffTop.top); } else if (alignWithTop === false) { util.scrollTop(container, containerScroll.top + diffBottom.top); } else { // 自动调整 if (diffTop.top < 0) { util.scrollTop(container, containerScroll.top + diffTop.top); } else { util.scrollTop(container, containerScroll.top + diffBottom.top); } } } else { if (!onlyScrollIfNeeded) { alignWithTop = alignWithTop === undefined ? true : !!alignWithTop; if (alignWithTop) { util.scrollTop(container, containerScroll.top + diffTop.top); } else { util.scrollTop(container, containerScroll.top + diffBottom.top); } } } if (allowHorizontalScroll) { if (diffTop.left < 0 || diffBottom.left > 0) { // 强制向上 if (alignWithLeft === true) { util.scrollLeft(container, containerScroll.left + diffTop.left); } else if (alignWithLeft === false) { util.scrollLeft(container, containerScroll.left + diffBottom.left); } else { // 自动调整 if (diffTop.left < 0) { util.scrollLeft(container, containerScroll.left + diffTop.left); } else { util.scrollLeft(container, containerScroll.left + diffBottom.left); } } } else { if (!onlyScrollIfNeeded) { alignWithLeft = alignWithLeft === undefined ? true : !!alignWithLeft; if (alignWithLeft) { util.scrollLeft(container, containerScroll.left + diffTop.left); } else { util.scrollLeft(container, containerScroll.left + diffBottom.left); } } } } } module.exports = scrollIntoView; /***/ }), /* 119 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source; function getClientPosition(elem) { var box = undefined; var x = undefined; var y = undefined; var doc = elem.ownerDocument; var body = doc.body; var docElem = doc && doc.documentElement; // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式 box = elem.getBoundingClientRect(); // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确 // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin x = box.left; y = box.top; // In IE, most of the time, 2 extra pixels are added to the top and left // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and // IE6 standards mode, this border can be overridden by setting the // document element's border to zero -- thus, we cannot rely on the // offset always being 2 pixels. // In quirks mode, the offset can be determined by querying the body's // clientLeft/clientTop, but in standards mode, it is found by querying // the document element's clientLeft/clientTop. Since we already called // getClientBoundingRect we have already forced a reflow, so it is not // too expensive just to query them all. // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的 // 窗口边框标准是设 documentElement ,quirks 时设置 body // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去 // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置 // 标准 ie 下 docElem.clientTop 就是 border-top // ie7 html 即窗口边框改变不了。永远为 2 // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0 x -= docElem.clientLeft || body.clientLeft || 0; y -= docElem.clientTop || body.clientTop || 0; return { left: x, top: y }; } function getScroll(w, top) { var ret = w['page' + (top ? 'Y' : 'X') + 'Offset']; var method = 'scroll' + (top ? 'Top' : 'Left'); if (typeof ret !== 'number') { var d = w.document; // ie6,7,8 standard mode ret = d.documentElement[method]; if (typeof ret !== 'number') { // quirks mode ret = d.body[method]; } } return ret; } function getScrollLeft(w) { return getScroll(w); } function getScrollTop(w) { return getScroll(w, true); } function getOffset(el) { var pos = getClientPosition(el); var doc = el.ownerDocument; var w = doc.defaultView || doc.parentWindow; pos.left += getScrollLeft(w); pos.top += getScrollTop(w); return pos; } function _getComputedStyle(elem, name, computedStyle_) { var val = ''; var d = elem.ownerDocument; var computedStyle = computedStyle_ || d.defaultView.getComputedStyle(elem, null); // https://github.com/kissyteam/kissy/issues/61 if (computedStyle) { val = computedStyle.getPropertyValue(name) || computedStyle[name]; } return val; } var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i'); var RE_POS = /^(top|right|bottom|left)$/; var CURRENT_STYLE = 'currentStyle'; var RUNTIME_STYLE = 'runtimeStyle'; var LEFT = 'left'; var PX = 'px'; function _getComputedStyleIE(elem, name) { // currentStyle maybe null // http://msdn.microsoft.com/en-us/library/ms535231.aspx var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name]; // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值 // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19 // 在 ie 下不对,需要直接用 offset 方式 // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了 // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 // If we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels // exclude left right for relativity if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) { // Remember the original values var style = elem.style; var left = style[LEFT]; var rsLeft = elem[RUNTIME_STYLE][LEFT]; // prevent flashing of content elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT]; // Put in the new values to get a computed value out style[LEFT] = name === 'fontSize' ? '1em' : ret || 0; ret = style.pixelLeft + PX; // Revert the changed values style[LEFT] = left; elem[RUNTIME_STYLE][LEFT] = rsLeft; } return ret === '' ? 'auto' : ret; } var getComputedStyleX = undefined; if (typeof window !== 'undefined') { getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE; } function each(arr, fn) { for (var i = 0; i < arr.length; i++) { fn(arr[i]); } } function isBorderBoxFn(elem) { return getComputedStyleX(elem, 'boxSizing') === 'border-box'; } var BOX_MODELS = ['margin', 'border', 'padding']; var CONTENT_INDEX = -1; var PADDING_INDEX = 2; var BORDER_INDEX = 1; var MARGIN_INDEX = 0; function swap(elem, options, callback) { var old = {}; var style = elem.style; var name = undefined; // Remember the old values, and insert the new ones for (name in options) { if (options.hasOwnProperty(name)) { old[name] = style[name]; style[name] = options[name]; } } callback.call(elem); // Revert the old values for (name in options) { if (options.hasOwnProperty(name)) { style[name] = old[name]; } } } function getPBMWidth(elem, props, which) { var value = 0; var prop = undefined; var j = undefined; var i = undefined; for (j = 0; j < props.length; j++) { prop = props[j]; if (prop) { for (i = 0; i < which.length; i++) { var cssProp = undefined; if (prop === 'border') { cssProp = prop + which[i] + 'Width'; } else { cssProp = prop + which[i]; } value += parseFloat(getComputedStyleX(elem, cssProp)) || 0; } } } return value; } /** * A crude way of determining if an object is a window * @member util */ function isWindow(obj) { // must use == for ie8 /* eslint eqeqeq:0 */ return obj != null && obj == obj.window; } var domUtils = {}; each(['Width', 'Height'], function (name) { domUtils['doc' + name] = function (refWin) { var d = refWin.document; return Math.max( // firefox chrome documentElement.scrollHeight< body.scrollHeight // ie standard mode : documentElement.scrollHeight> body.scrollHeight d.documentElement['scroll' + name], // quirks : documentElement.scrollHeight 最大等于可视窗口多一点? d.body['scroll' + name], domUtils['viewport' + name](d)); }; domUtils['viewport' + name] = function (win) { // pc browser includes scrollbar in window.innerWidth var prop = 'client' + name; var doc = win.document; var body = doc.body; var documentElement = doc.documentElement; var documentElementProp = documentElement[prop]; // 标准模式取 documentElement // backcompat 取 body return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp; }; }); /* 得到元素的大小信息 @param elem @param name @param {String} [extra] 'padding' : (css width) + padding 'border' : (css width) + padding + border 'margin' : (css width) + padding + border + margin */ function getWH(elem, name, extra) { if (isWindow(elem)) { return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem); } else if (elem.nodeType === 9) { return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem); } var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight; var computedStyle = getComputedStyleX(elem); var isBorderBox = isBorderBoxFn(elem, computedStyle); var cssBoxValue = 0; if (borderBoxValue == null || borderBoxValue <= 0) { borderBoxValue = undefined; // Fall back to computed then un computed css if necessary cssBoxValue = getComputedStyleX(elem, name); if (cssBoxValue == null || Number(cssBoxValue) < 0) { cssBoxValue = elem.style[name] || 0; } // Normalize '', auto, and prepare for extra cssBoxValue = parseFloat(cssBoxValue) || 0; } if (extra === undefined) { extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX; } var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox; var val = borderBoxValue || cssBoxValue; if (extra === CONTENT_INDEX) { if (borderBoxValueOrIsBorderBox) { return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle); } return cssBoxValue; } if (borderBoxValueOrIsBorderBox) { var padding = extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle); return val + (extra === BORDER_INDEX ? 0 : padding); } return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle); } var cssShow = { position: 'absolute', visibility: 'hidden', display: 'block' }; // fix #119 : https://github.com/kissyteam/kissy/issues/119 function getWHIgnoreDisplay(elem) { var val = undefined; var args = arguments; // in case elem is window // elem.offsetWidth === undefined if (elem.offsetWidth !== 0) { val = getWH.apply(undefined, args); } else { swap(elem, cssShow, function () { val = getWH.apply(undefined, args); }); } return val; } function css(el, name, v) { var value = v; if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') { for (var i in name) { if (name.hasOwnProperty(i)) { css(el, i, name[i]); } } return undefined; } if (typeof value !== 'undefined') { if (typeof value === 'number') { value += 'px'; } el.style[name] = value; return undefined; } return getComputedStyleX(el, name); } each(['width', 'height'], function (name) { var first = name.charAt(0).toUpperCase() + name.slice(1); domUtils['outer' + first] = function (el, includeMargin) { return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX); }; var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; domUtils[name] = function (elem, val) { if (val !== undefined) { if (elem) { var computedStyle = getComputedStyleX(elem); var isBorderBox = isBorderBoxFn(elem); if (isBorderBox) { val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle); } return css(elem, name, val); } return undefined; } return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX); }; }); // 设置 elem 相对 elem.ownerDocument 的坐标 function setOffset(elem, offset) { // set position first, in-case top/left are set even on static elem if (css(elem, 'position') === 'static') { elem.style.position = 'relative'; } var old = getOffset(elem); var ret = {}; var current = undefined; var key = undefined; for (key in offset) { if (offset.hasOwnProperty(key)) { current = parseFloat(css(elem, key)) || 0; ret[key] = current + offset[key] - old[key]; } } css(elem, ret); } module.exports = _extends({ getWindow: function getWindow(node) { var doc = node.ownerDocument || node; return doc.defaultView || doc.parentWindow; }, offset: function offset(el, value) { if (typeof value !== 'undefined') { setOffset(el, value); } else { return getOffset(el); } }, isWindow: isWindow, each: each, css: css, clone: function clone(obj) { var ret = {}; for (var i in obj) { if (obj.hasOwnProperty(i)) { ret[i] = obj[i]; } } var overflow = obj.overflow; if (overflow) { for (var i in obj) { if (obj.hasOwnProperty(i)) { ret.overflow[i] = obj.overflow[i]; } } } return ret; }, scrollLeft: function scrollLeft(w, v) { if (isWindow(w)) { if (v === undefined) { return getScrollLeft(w); } window.scrollTo(v, getScrollTop(w)); } else { if (v === undefined) { return w.scrollLeft; } w.scrollLeft = v; } }, scrollTop: function scrollTop(w, v) { if (isWindow(w)) { if (v === undefined) { return getScrollTop(w); } window.scrollTo(getScrollLeft(w), v); } else { if (v === undefined) { return w.scrollTop; } w.scrollTop = v; } }, viewportWidth: 0, viewportHeight: 0 }, domUtils); /***/ }), /* 120 */, /* 121 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["notices"]; }()); /***/ }), /* 122 */, /* 123 */, /* 124 */ /***/ (function(module, exports) { (function() { module.exports = this["wp"]["tokenList"]; }()); /***/ }), /* 125 */, /* 126 */, /* 127 */, /* 128 */, /* 129 */, /* 130 */, /* 131 */, /* 132 */, /* 133 */, /* 134 */, /* 135 */, /* 136 */, /* 137 */, /* 138 */, /* 139 */, /* 140 */, /* 141 */, /* 142 */, /* 143 */, /* 144 */, /* 145 */, /* 146 */, /* 147 */, /* 148 */, /* 149 */, /* 150 */, /* 151 */, /* 152 */, /* 153 */, /* 154 */, /* 155 */, /* 156 */, /* 157 */, /* 158 */, /* 159 */, /* 160 */, /* 161 */, /* 162 */, /* 163 */, /* 164 */, /* 165 */, /* 166 */, /* 167 */, /* 168 */, /* 169 */, /* 170 */, /* 171 */, /* 172 */, /* 173 */, /* 174 */, /* 175 */, /* 176 */, /* 177 */, /* 178 */, /* 179 */, /* 180 */, /* 181 */, /* 182 */, /* 183 */, /* 184 */, /* 185 */, /* 186 */, /* 187 */, /* 188 */, /* 189 */, /* 190 */ /***/ (function(module, exports, __webpack_require__) { "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; /***/ }), /* 191 */ /***/ (function(module, exports, __webpack_require__) { /*! diff v3.5.0 Software License Agreement (BSD License) Copyright (c) 2009-2015, Kevin Decker <kpdecker@gmail.com> All rights reserved. Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Kevin Decker nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @license */ (function webpackUniversalModuleDefinition(root, factory) { if(true) module.exports = factory(); else {} })(this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { /*istanbul ignore start*/'use strict'; exports.__esModule = true; exports.canonicalize = exports.convertChangesToXML = exports.convertChangesToDMP = exports.merge = exports.parsePatch = exports.applyPatches = exports.applyPatch = exports.createPatch = exports.createTwoFilesPatch = exports.structuredPatch = exports.diffArrays = exports.diffJson = exports.diffCss = exports.diffSentences = exports.diffTrimmedLines = exports.diffLines = exports.diffWordsWithSpace = exports.diffWords = exports.diffChars = exports.Diff = undefined; /*istanbul ignore end*/var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); /*istanbul ignore end*/var /*istanbul ignore start*/_character = __webpack_require__(2) /*istanbul ignore end*/; var /*istanbul ignore start*/_word = __webpack_require__(3) /*istanbul ignore end*/; var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/; var /*istanbul ignore start*/_sentence = __webpack_require__(6) /*istanbul ignore end*/; var /*istanbul ignore start*/_css = __webpack_require__(7) /*istanbul ignore end*/; var /*istanbul ignore start*/_json = __webpack_require__(8) /*istanbul ignore end*/; var /*istanbul ignore start*/_array = __webpack_require__(9) /*istanbul ignore end*/; var /*istanbul ignore start*/_apply = __webpack_require__(10) /*istanbul ignore end*/; var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/; var /*istanbul ignore start*/_merge = __webpack_require__(13) /*istanbul ignore end*/; var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/; var /*istanbul ignore start*/_dmp = __webpack_require__(16) /*istanbul ignore end*/; var /*istanbul ignore start*/_xml = __webpack_require__(17) /*istanbul ignore end*/; /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /* See LICENSE file for terms of use */ /* * Text diff implementation. * * This library supports the following APIS: * JsDiff.diffChars: Character by character diff * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace * JsDiff.diffLines: Line based diff * * JsDiff.diffCss: Diff targeted at CSS content * * These methods are based on the implementation proposed in * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986). * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927 */ exports. /*istanbul ignore end*/Diff = _base2['default']; /*istanbul ignore start*/exports. /*istanbul ignore end*/diffChars = _character.diffChars; /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWords = _word.diffWords; /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = _word.diffWordsWithSpace; /*istanbul ignore start*/exports. /*istanbul ignore end*/diffLines = _line.diffLines; /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = _line.diffTrimmedLines; /*istanbul ignore start*/exports. /*istanbul ignore end*/diffSentences = _sentence.diffSentences; /*istanbul ignore start*/exports. /*istanbul ignore end*/diffCss = _css.diffCss; /*istanbul ignore start*/exports. /*istanbul ignore end*/diffJson = _json.diffJson; /*istanbul ignore start*/exports. /*istanbul ignore end*/diffArrays = _array.diffArrays; /*istanbul ignore start*/exports. /*istanbul ignore end*/structuredPatch = _create.structuredPatch; /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = _create.createTwoFilesPatch; /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = _create.createPatch; /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatch = _apply.applyPatch; /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = _apply.applyPatches; /*istanbul ignore start*/exports. /*istanbul ignore end*/parsePatch = _parse.parsePatch; /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = _merge.merge; /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToDMP = _dmp.convertChangesToDMP; /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToXML = _xml.convertChangesToXML; /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = _json.canonicalize; //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6WyJEaWZmIiwiZGlmZkNoYXJzIiwiZGlmZldvcmRzIiwiZGlmZldvcmRzV2l0aFNwYWNlIiwiZGlmZkxpbmVzIiwiZGlmZlRyaW1tZWRMaW5lcyIsImRpZmZTZW50ZW5jZXMiLCJkaWZmQ3NzIiwiZGlmZkpzb24iLCJkaWZmQXJyYXlzIiwic3RydWN0dXJlZFBhdGNoIiwiY3JlYXRlVHdvRmlsZXNQYXRjaCIsImNyZWF0ZVBhdGNoIiwiYXBwbHlQYXRjaCIsImFwcGx5UGF0Y2hlcyIsInBhcnNlUGF0Y2giLCJtZXJnZSIsImNvbnZlcnRDaGFuZ2VzVG9ETVAiLCJjb252ZXJ0Q2hhbmdlc1RvWE1MIiwiY2Fub25pY2FsaXplIl0sIm1hcHBpbmdzIjoiOzs7Ozt1QkFnQkE7Ozs7dUJBQ0E7O0FBQ0E7O0FBQ0E7O0FBQ0E7O0FBRU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gRGlmZixcblxuICBkaWZmQ2hhcnMsXG4gIGRpZmZXb3JkcyxcbiAgZGlmZldvcmRzV2l0aFNwYWNlLFxuICBkaWZmTGluZXMsXG4gIGRpZmZUcmltbWVkTGluZXMsXG4gIGRpZmZTZW50ZW5jZXMsXG5cbiAgZGlmZkNzcyxcbiAgZGlmZkpzb24sXG5cbiAgZGlmZkFycmF5cyxcblxuICBzdHJ1Y3R1cmVkUGF0Y2gsXG4gIGNyZWF0ZVR3b0ZpbGVzUGF0Y2gsXG4gIGNyZWF0ZVBhdGNoLFxuICBhcHBseVBhdGNoLFxuICBhcHBseVBhdGNoZXMsXG4gIHBhcnNlUGF0Y2gsXG4gIG1lcmdlLFxuICBjb252ZXJ0Q2hhbmdlc1RvRE1QLFxuICBjb252ZXJ0Q2hhbmdlc1RvWE1MLFxuICBjYW5vbmljYWxpemVcbn07XG4iXX0= /***/ }), /* 1 */ /***/ (function(module, exports) { /*istanbul ignore start*/'use strict'; exports.__esModule = true; exports['default'] = /*istanbul ignore end*/Diff; function Diff() {} Diff.prototype = { /*istanbul ignore start*/ /*istanbul ignore end*/diff: function diff(oldString, newString) { /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var callback = options.callback; if (typeof options === 'function') { callback = options; options = {}; } this.options = options; var self = this; function done(value) { if (callback) { setTimeout(function () { callback(undefined, value); }, 0); return true; } else { return value; } } // Allow subclasses to massage the input prior to running oldString = this.castInput(oldString); newString = this.castInput(newString); oldString = this.removeEmpty(this.tokenize(oldString)); newString = this.removeEmpty(this.tokenize(newString)); var newLen = newString.length, oldLen = oldString.length; var editLength = 1; var maxEditLength = newLen + oldLen; var bestPath = [{ newPos: -1, components: [] }]; // Seed editLength = 0, i.e. the content starts with the same values var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) { // Identity per the equality and tokenizer return done([{ value: this.join(newString), count: newString.length }]); } // Main worker method. checks all permutations of a given edit length for acceptance. function execEditLength() { for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) { var basePath = /*istanbul ignore start*/void 0 /*istanbul ignore end*/; var addPath = bestPath[diagonalPath - 1], removePath = bestPath[diagonalPath + 1], _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; if (addPath) { // No one else is going to attempt to use this value, clear it bestPath[diagonalPath - 1] = undefined; } var canAdd = addPath && addPath.newPos + 1 < newLen, canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen; if (!canAdd && !canRemove) { // If this path is a terminal then prune bestPath[diagonalPath] = undefined; continue; } // Select the diagonal that we want to branch from. We select the prior // path whose position in the new string is the farthest from the origin // and does not pass the bounds of the diff graph if (!canAdd || canRemove && addPath.newPos < removePath.newPos) { basePath = clonePath(removePath); self.pushComponent(basePath.components, undefined, true); } else { basePath = addPath; // No need to clone, we've pulled it from the list basePath.newPos++; self.pushComponent(basePath.components, true, undefined); } _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) { return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken)); } else { // Otherwise track this path as a potential candidate and continue. bestPath[diagonalPath] = basePath; } } editLength++; } // Performs the length of edit iteration. Is a bit fugly as this has to support the // sync and async mode which is never fun. Loops over execEditLength until a value // is produced. if (callback) { (function exec() { setTimeout(function () { // This should not happen, but we want to be safe. /* istanbul ignore next */ if (editLength > maxEditLength) { return callback(); } if (!execEditLength()) { exec(); } }, 0); })(); } else { while (editLength <= maxEditLength) { var ret = execEditLength(); if (ret) { return ret; } } } }, /*istanbul ignore start*/ /*istanbul ignore end*/pushComponent: function pushComponent(components, added, removed) { var last = components[components.length - 1]; if (last && last.added === added && last.removed === removed) { // We need to clone here as the component clone operation is just // as shallow array clone components[components.length - 1] = { count: last.count + 1, added: added, removed: removed }; } else { components.push({ count: 1, added: added, removed: removed }); } }, /*istanbul ignore start*/ /*istanbul ignore end*/extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { var newLen = newString.length, oldLen = oldString.length, newPos = basePath.newPos, oldPos = newPos - diagonalPath, commonCount = 0; while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { newPos++; oldPos++; commonCount++; } if (commonCount) { basePath.components.push({ count: commonCount }); } basePath.newPos = newPos; return oldPos; }, /*istanbul ignore start*/ /*istanbul ignore end*/equals: function equals(left, right) { if (this.options.comparator) { return this.options.comparator(left, right); } else { return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase(); } }, /*istanbul ignore start*/ /*istanbul ignore end*/removeEmpty: function removeEmpty(array) { var ret = []; for (var i = 0; i < array.length; i++) { if (array[i]) { ret.push(array[i]); } } return ret; }, /*istanbul ignore start*/ /*istanbul ignore end*/castInput: function castInput(value) { return value; }, /*istanbul ignore start*/ /*istanbul ignore end*/tokenize: function tokenize(value) { return value.split(''); }, /*istanbul ignore start*/ /*istanbul ignore end*/join: function join(chars) { return chars.join(''); } }; function buildValues(diff, components, newString, oldString, useLongestToken) { var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0; for (; componentPos < componentLen; componentPos++) { var component = components[componentPos]; if (!component.removed) { if (!component.added && useLongestToken) { var value = newString.slice(newPos, newPos + component.count); value = value.map(function (value, i) { var oldValue = oldString[oldPos + i]; return oldValue.length > value.length ? oldValue : value; }); component.value = diff.join(value); } else { component.value = diff.join(newString.slice(newPos, newPos + component.count)); } newPos += component.count; // Common case if (!component.added) { oldPos += component.count; } } else { component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); oldPos += component.count; // Reverse add and remove so removes are output first to match common convention // The diffing algorithm is tied to add then remove output and this is the simplest // route to get the desired output with minimal overhead. if (componentPos && components[componentPos - 1].added) { var tmp = components[componentPos - 1]; components[componentPos - 1] = components[componentPos]; components[componentPos] = tmp; } } } // Special case handle for when one terminal is ignored (i.e. whitespace). // For this case we merge the terminal into the prior string and drop the change. // This is only available for string mode. var lastComponent = components[componentLen - 1]; if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) { components[componentLen - 2].value += lastComponent.value; components.pop(); } return components; } function clonePath(path) { return { newPos: path.newPos, components: path.components.slice(0) }; } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Jhc2UuanMiXSwibmFtZXMiOlsiRGlmZiIsInByb3RvdHlwZSIsImRpZmYiLCJvbGRTdHJpbmciLCJuZXdTdHJpbmciLCJvcHRpb25zIiwiY2FsbGJhY2siLCJzZWxmIiwiZG9uZSIsInZhbHVlIiwic2V0VGltZW91dCIsInVuZGVmaW5lZCIsImNhc3RJbnB1dCIsInJlbW92ZUVtcHR5IiwidG9rZW5pemUiLCJuZXdMZW4iLCJsZW5ndGgiLCJvbGRMZW4iLCJlZGl0TGVuZ3RoIiwibWF4RWRpdExlbmd0aCIsImJlc3RQYXRoIiwibmV3UG9zIiwiY29tcG9uZW50cyIsIm9sZFBvcyIsImV4dHJhY3RDb21tb24iLCJqb2luIiwiY291bnQiLCJleGVjRWRpdExlbmd0aCIsImRpYWdvbmFsUGF0aCIsImJhc2VQYXRoIiwiYWRkUGF0aCIsInJlbW92ZVBhdGgiLCJjYW5BZGQiLCJjYW5SZW1vdmUiLCJjbG9uZVBhdGgiLCJwdXNoQ29tcG9uZW50IiwiYnVpbGRWYWx1ZXMiLCJ1c2VMb25nZXN0VG9rZW4iLCJleGVjIiwicmV0IiwiYWRkZWQiLCJyZW1vdmVkIiwibGFzdCIsInB1c2giLCJjb21tb25Db3VudCIsImVxdWFscyIsImxlZnQiLCJyaWdodCIsImNvbXBhcmF0b3IiLCJpZ25vcmVDYXNlIiwidG9Mb3dlckNhc2UiLCJhcnJheSIsImkiLCJzcGxpdCIsImNoYXJzIiwiY29tcG9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gIH1cbiAgICB9XG4gIH1cblxuICAvLyBTcGVjaWFsIGNhc2UgaGFuZGxlIGZvciB3aGVuIG9uZSB0ZXJtaW5hbCBpcyBpZ25vcmVkIChpLmUuIHdoaXRlc3BhY2UpLlxuICAvLyBGb3IgdGhpcyBjYXNlIHdlIG1lcmdlIHRoZSB0ZXJtaW5hbCBpbnRvIHRoZSBwcmlvciBzdHJpbmcgYW5kIGRyb3AgdGhlIGNoYW5nZS5cbiAgLy8gVGhpcyBpcyBvbmx5IGF2YWlsYWJsZSBmb3Igc3RyaW5nIG1vZGUuXG4gIGxldCBsYXN0Q29tcG9uZW50ID0gY29tcG9uZW50c1tjb21wb25lbnRMZW4gLSAxXTtcbiAgaWYgKGNvbXBvbmVudExlbiA+IDFcbiAgICAgICYmIHR5cGVvZiBsYXN0Q29tcG9uZW50LnZhbHVlID09PSAnc3RyaW5nJ1xuICAgICAgJiYgKGxhc3RDb21wb25lbnQuYWRkZWQgfHwgbGFzdENvbXBvbmVudC5yZW1vdmVkKVxuICAgICAgJiYgZGlmZi5lcXVhbHMoJycsIGxhc3RDb21wb25lbnQudmFsdWUpKSB7XG4gICAgY29tcG9uZW50c1tjb21wb25lbnRMZW4gLSAyXS52YWx1ZSArPSBsYXN0Q29tcG9uZW50LnZhbHVlO1xuICAgIGNvbXBvbmVudHMucG9wKCk7XG4gIH1cblxuICByZXR1cm4gY29tcG9uZW50cztcbn1cblxuZnVuY3Rpb24gY2xvbmVQYXRoKHBhdGgpIHtcbiAgcmV0dXJuIHsgbmV3UG9zOiBwYXRoLm5ld1BvcywgY29tcG9uZW50czogcGF0aC5jb21wb25lbnRzLnNsaWNlKDApIH07XG59XG4iXX0= /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { /*istanbul ignore start*/'use strict'; exports.__esModule = true; exports.characterDiff = undefined; exports. /*istanbul ignore end*/diffChars = diffChars; var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /*istanbul ignore end*/var characterDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/characterDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/(); function diffChars(oldStr, newStr, options) { return characterDiff.diff(oldStr, newStr, options); } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2NoYXJhY3Rlci5qcyJdLCJuYW1lcyI6WyJkaWZmQ2hhcnMiLCJjaGFyYWN0ZXJEaWZmIiwib2xkU3RyIiwibmV3U3RyIiwib3B0aW9ucyIsImRpZmYiXSwibWFwcGluZ3MiOiI7Ozs7Z0NBR2dCQSxTLEdBQUFBLFM7O0FBSGhCOzs7Ozs7dUJBRU8sSUFBTUMseUZBQWdCLHdFQUF0QjtBQUNBLFNBQVNELFNBQVQsQ0FBbUJFLE1BQW5CLEVBQTJCQyxNQUEzQixFQUFtQ0MsT0FBbkMsRUFBNEM7QUFBRSxTQUFPSCxjQUFjSSxJQUFkLENBQW1CSCxNQUFuQixFQUEyQkMsTUFBM0IsRUFBbUNDLE9BQW5DLENBQVA7QUFBcUQiLCJmaWxlIjoiY2hhcmFjdGVyLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IERpZmYgZnJvbSAnLi9iYXNlJztcblxuZXhwb3J0IGNvbnN0IGNoYXJhY3RlckRpZmYgPSBuZXcgRGlmZigpO1xuZXhwb3J0IGZ1bmN0aW9uIGRpZmZDaGFycyhvbGRTdHIsIG5ld1N0ciwgb3B0aW9ucykgeyByZXR1cm4gY2hhcmFjdGVyRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBvcHRpb25zKTsgfVxuIl19 /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { /*istanbul ignore start*/'use strict'; exports.__esModule = true; exports.wordDiff = undefined; exports. /*istanbul ignore end*/diffWords = diffWords; /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = diffWordsWithSpace; var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); /*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/; /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /*istanbul ignore end*/ // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode // // Ranges and exceptions: // Latin-1 Supplement, 0080–00FF // - U+00D7 × Multiplication sign // - U+00F7 ÷ Division sign // Latin Extended-A, 0100–017F // Latin Extended-B, 0180–024F // IPA Extensions, 0250–02AF // Spacing Modifier Letters, 02B0–02FF // - U+02C7 ˇ ˇ Caron // - U+02D8 ˘ ˘ Breve // - U+02D9 ˙ ˙ Dot Above // - U+02DA ˚ ˚ Ring Above // - U+02DB ˛ ˛ Ogonek // - U+02DC ˜ ˜ Small Tilde // - U+02DD ˝ ˝ Double Acute Accent // Latin Extended Additional, 1E00–1EFF var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/; var reWhitespace = /\S/; var wordDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/wordDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/(); wordDiff.equals = function (left, right) { if (this.options.ignoreCase) { left = left.toLowerCase(); right = right.toLowerCase(); } return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right); }; wordDiff.tokenize = function (value) { var tokens = value.split(/(\s+|\b)/); // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set. for (var i = 0; i < tokens.length - 1; i++) { // If we have an empty string in the next field and we have only word chars before and after, merge if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) { tokens[i] += tokens[i + 2]; tokens.splice(i + 1, 2); i--; } } return tokens; }; function diffWords(oldStr, newStr, options) { options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(options, { ignoreWhitespace: true }); return wordDiff.diff(oldStr, newStr, options); } function diffWordsWithSpace(oldStr, newStr, options) { return wordDiff.diff(oldStr, newStr, options); } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL3dvcmQuanMiXSwibmFtZXMiOlsiZGlmZldvcmRzIiwiZGlmZldvcmRzV2l0aFNwYWNlIiwiZXh0ZW5kZWRXb3JkQ2hhcnMiLCJyZVdoaXRlc3BhY2UiLCJ3b3JkRGlmZiIsImVxdWFscyIsImxlZnQiLCJyaWdodCIsIm9wdGlvbnMiLCJpZ25vcmVDYXNlIiwidG9Mb3dlckNhc2UiLCJpZ25vcmVXaGl0ZXNwYWNlIiwidGVzdCIsInRva2VuaXplIiwidmFsdWUiLCJ0b2tlbnMiLCJzcGxpdCIsImkiLCJsZW5ndGgiLCJzcGxpY2UiLCJvbGRTdHIiLCJuZXdTdHIiLCJkaWZmIl0sIm1hcHBpbmdzIjoiOzs7O2dDQW1EZ0JBLFMsR0FBQUEsUzt5REFLQUMsa0IsR0FBQUEsa0I7O0FBeERoQjs7Ozt1QkFDQTs7Ozt3QkFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxJQUFNQyxvQkFBb0IsK0RBQTFCOztBQUVBLElBQU1DLGVBQWUsSUFBckI7O0FBRU8sSUFBTUMsK0VBQVcsd0VBQWpCO0FBQ1BBLFNBQVNDLE1BQVQsR0FBa0IsVUFBU0MsSUFBVCxFQUFlQyxLQUFmLEVBQXNCO0FBQ3RDLE1BQUksS0FBS0MsT0FBTCx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ucyk7XG59XG4iXX0= /***/ }), /* 4 */ /***/ (function(module, exports) { /*istanbul ignore start*/'use strict'; exports.__esModule = true; exports. /*istanbul ignore end*/generateOptions = generateOptions; function generateOptions(options, defaults) { if (typeof options === 'function') { defaults.callback = options; } else if (options) { for (var name in options) { /* istanbul ignore else */ if (options.hasOwnProperty(name)) { defaults[name] = options[name]; } } } return defaults; } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL3BhcmFtcy5qcyJdLCJuYW1lcyI6WyJnZW5lcmF0ZU9wdGlvbnMiLCJvcHRpb25zIiwiZGVmYXVsdHMiLCJjYWxsYmFjayIsIm5hbWUiLCJoYXNPd25Qcm9wZXJ0eSJdLCJtYXBwaW5ncyI6Ijs7O2dDQUFnQkEsZSxHQUFBQSxlO0FBQVQsU0FBU0EsZUFBVCxDQUF5QkMsT0FBekIsRUFBa0NDLFFBQWxDLEVBQTRDO0FBQ2pELE1BQUksT0FBT0QsT0FBUCxLQUFtQixVQUF2QixFQUFtQztBQUNqQ0MsYUFBU0MsUUFBVCxHQUFvQkYsT0FBcEI7QUFDRCxHQUZELE1BRU8sSUFBSUEsT0FBSixFQUFhO0FBQ2xCLFNBQUssSUFBSUcsSUFBVCxJQUFpQkgsT0FBakIsRUFBMEI7QUFDeEI7QUFDQSxVQUFJQSxRQUFRSSxjQUFSLENBQXVCRCxJQUF2QixDQUFKLEVBQWtDO0FBQ2hDRixpQkFBU0UsSUFBVCxJQUFpQkgsUUFBUUcsSUFBUixDQUFqQjtBQUNEO0FBQ0Y7QUFDRjtBQUNELFNBQU9GLFFBQVA7QUFDRCIsImZpbGUiOiJwYXJhbXMuanMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gZ2VuZXJhdGVPcHRpb25zKG9wdGlvbnMsIGRlZmF1bHRzKSB7XG4gIGlmICh0eXBlb2Ygb3B0aW9ucyA9PT0gJ2Z1bmN0aW9uJykge1xuICAgIGRlZmF1bHRzLmNhbGxiYWNrID0gb3B0aW9ucztcbiAgfSBlbHNlIGlmIChvcHRpb25zKSB7XG4gICAgZm9yIChsZXQgbmFtZSBpbiBvcHRpb25zKSB7XG4gICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgZWxzZSAqL1xuICAgICAgaWYgKG9wdGlvbnMuaGFzT3duUHJvcGVydHkobmFtZSkpIHtcbiAgICAgICAgZGVmYXVsdHNbbmFtZV0gPSBvcHRpb25zW25hbWVdO1xuICAgICAgfVxuICAgIH1cbiAgfVxuICByZXR1cm4gZGVmYXVsdHM7XG59XG4iXX0= /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { /*istanbul ignore start*/'use strict'; exports.__esModule = true; exports.lineDiff = undefined; exports. /*istanbul ignore end*/diffLines = diffLines; /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = diffTrimmedLines; var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); /*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/; /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /*istanbul ignore end*/var lineDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/lineDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/(); lineDiff.tokenize = function (value) { var retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line if (!linesAndNewlines[linesAndNewlines.length - 1]) { linesAndNewlines.pop(); } // Merge the content and line separators into single tokens for (var i = 0; i < linesAndNewlines.length; i++) { var line = linesAndNewlines[i]; if (i % 2 && !this.options.newlineIsToken) { retLines[retLines.length - 1] += line; } else { if (this.options.ignoreWhitespace) { line = line.trim(); } retLines.push(line); } } return retLines; }; function diffLines(oldStr, newStr, callback) { return lineDiff.diff(oldStr, newStr, callback); } function diffTrimmedLines(oldStr, newStr, callback) { var options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(callback, { ignoreWhitespace: true }); return lineDiff.diff(oldStr, newStr, options); } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2xpbmUuanMiXSwibmFtZXMiOlsiZGlmZkxpbmVzIiwiZGlmZlRyaW1tZWRMaW5lcyIsImxpbmVEaWZmIiwidG9rZW5pemUiLCJ2YWx1ZSIsInJldExpbmVzIiwibGluZXNBbmROZXdsaW5lcyIsInNwbGl0IiwibGVuZ3RoIiwicG9wIiwiaSIsImxpbmUiLCJvcHRpb25zIiwibmV3bGluZUlzVG9rZW4iLCJpZ25vcmVXaGl0ZXNwYWNlIiwidHJpbSIsInB1c2giLCJvbGRTdHIiLCJuZXdTdHIiLCJjYWxsYmFjayIsImRpZmYiXSwibWFwcGluZ3MiOiI7Ozs7Z0NBOEJnQkEsUyxHQUFBQSxTO3lEQUNBQyxnQixHQUFBQSxnQjs7QUEvQmhCOzs7O3VCQUNBOzs7O3VCQUVPLElBQU1DLCtFQUFXLHdFQUFqQjtBQUNQQSxTQUFTQyxRQUFULEdBQW9CLFVBQVNDLEtBQVQsRUFBZ0I7QUFDbEMsTUFBSUMsV0FBVyxFQUFmO0FBQUEsTUFDSUMsbUJBQW1CRixNQUFNRyxLQUFOLENBQVksV0FBWixDQUR2Qjs7QUFHQTtBQUNBLE1BQUksQ0FBQ0QsaUJBQWlCQSxpQkFBaUJFLE1BQWpCLEdBQTBCLENBQTNDLENBQUwsRUFBb0Q7QUFDbERGLHFCQUFpQkcsR0FBakI7QUFDRDs7QUFFRDtBQUNBLE9BQUssSUFBSUMsSUFBSSxDQUFiLEVBQWdCQSxJQUFJSixpQkFBaUJFLE1BQXJDLEVBQTZDRSxHQUE3QyxFQUFrRDtBQUNoRCxRQUFJQyxPQUFPTC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cyhvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spIHtcbiAgbGV0IG9wdGlvbnMgPSBnZW5lcmF0ZU9wdGlvbnMoY2FsbGJhY2ssIHtpZ25vcmVXaGl0ZXNwYWNlOiB0cnVlfSk7XG4gIHJldHVybiBsaW5lRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBvcHRpb25zKTtcbn1cbiJdfQ== /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { /*istanbul ignore start*/'use strict'; exports.__esModule = true; exports.sentenceDiff = undefined; exports. /*istanbul ignore end*/diffSentences = diffSentences; var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /*istanbul ignore end*/var sentenceDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/sentenceDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/(); sentenceDiff.tokenize = function (value) { return value.split(/(\S.+?[.!?])(?=\s+|$)/); }; function diffSentences(oldStr, newStr, callback) { return sentenceDiff.diff(oldStr, newStr, callback); } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL3NlbnRlbmNlLmpzIl0sIm5hbWVzIjpbImRpZmZTZW50ZW5jZXMiLCJzZW50ZW5jZURpZmYiLCJ0b2tlbml6ZSIsInZhbHVlIiwic3BsaXQiLCJvbGRTdHIiLCJuZXdTdHIiLCJjYWxsYmFjayIsImRpZmYiXSwibWFwcGluZ3MiOiI7Ozs7Z0NBUWdCQSxhLEdBQUFBLGE7O0FBUmhCOzs7Ozs7dUJBR08sSUFBTUMsdUZBQWUsd0VBQXJCO0FBQ1BBLGFBQWFDLFFBQWIsR0FBd0IsVUFBU0MsS0FBVCxFQUFnQjtBQUN0QyxTQUFPQSxNQUFNQyxLQUFOLENBQVksdUJBQVosQ0FBUDtBQUNELENBRkQ7O0FBSU8sU0FBU0osYUFBVCxDQUF1QkssTUFBdkIsRUFBK0JDLE1BQS9CLEVBQXVDQyxRQUF2QyxFQUFpRDtBQUFFLFNBQU9OLGFBQWFPLElBQWIsQ0FBa0JILE1BQWxCLEVBQTBCQyxNQUExQixFQUFrQ0MsUUFBbEMsQ0FBUDtBQUFxRCIsImZpbGUiOiJzZW50ZW5jZS5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBEaWZmIGZyb20gJy4vYmFzZSc7XG5cblxuZXhwb3J0IGNvbnN0IHNlbnRlbmNlRGlmZiA9IG5ldyBEaWZmKCk7XG5zZW50ZW5jZURpZmYudG9rZW5pemUgPSBmdW5jdGlvbih2YWx1ZSkge1xuICByZXR1cm4gdmFsdWUuc3BsaXQoLyhcXFMuKz9bLiE/XSkoPz1cXHMrfCQpLyk7XG59O1xuXG5leHBvcnQgZnVuY3Rpb24gZGlmZlNlbnRlbmNlcyhvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spIHsgcmV0dXJuIHNlbnRlbmNlRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBjYWxsYmFjayk7IH1cbiJdfQ== /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { /*istanbul ignore start*/'use strict'; exports.__esModule = true; exports.cssDiff = undefined; exports. /*istanbul ignore end*/diffCss = diffCss; var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /*istanbul ignore end*/var cssDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/cssDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/(); cssDiff.tokenize = function (value) { return value.split(/([{}:;,]|\s+)/); }; function diffCss(oldStr, newStr, callback) { return cssDiff.diff(oldStr, newStr, callback); } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Nzcy5qcyJdLCJuYW1lcyI6WyJkaWZmQ3NzIiwiY3NzRGlmZiIsInRva2VuaXplIiwidmFsdWUiLCJzcGxpdCIsIm9sZFN0ciIsIm5ld1N0ciIsImNhbGxiYWNrIiwiZGlmZiJdLCJtYXBwaW5ncyI6Ijs7OztnQ0FPZ0JBLE8sR0FBQUEsTzs7QUFQaEI7Ozs7Ozt1QkFFTyxJQUFNQyw2RUFBVSx3RUFBaEI7QUFDUEEsUUFBUUMsUUFBUixHQUFtQixVQUFTQyxLQUFULEVBQWdCO0FBQ2pDLFNBQU9BLE1BQU1DLEtBQU4sQ0FBWSxlQUFaLENBQVA7QUFDRCxDQUZEOztBQUlPLFNBQVNKLE9BQVQsQ0FBaUJLLE1BQWpCLEVBQXlCQyxNQUF6QixFQUFpQ0MsUUFBakMsRUFBMkM7QUFBRSxTQUFPTixRQUFRTyxJQUFSLENBQWFILE1BQWIsRUFBcUJDLE1BQXJCLEVBQTZCQyxRQUE3QixDQUFQO0FBQWdEIiwiZmlsZSI6ImNzcy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBEaWZmIGZyb20gJy4vYmFzZSc7XG5cbmV4cG9ydCBjb25zdCBjc3NEaWZmID0gbmV3IERpZmYoKTtcbmNzc0RpZmYudG9rZW5pemUgPSBmdW5jdGlvbih2YWx1ZSkge1xuICByZXR1cm4gdmFsdWUuc3BsaXQoLyhbe306OyxdfFxccyspLyk7XG59O1xuXG5leHBvcnQgZnVuY3Rpb24gZGlmZkNzcyhvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spIHsgcmV0dXJuIGNzc0RpZmYuZGlmZihvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spOyB9XG4iXX0= /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { /*istanbul ignore start*/'use strict'; exports.__esModule = true; exports.jsonDiff = undefined; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; exports. /*istanbul ignore end*/diffJson = diffJson; /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = canonicalize; var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); /*istanbul ignore end*/var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/; /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /*istanbul ignore end*/var objectPrototypeToString = Object.prototype.toString; var jsonDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/jsonDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/(); // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output: jsonDiff.useLongestToken = true; jsonDiff.tokenize = /*istanbul ignore start*/_line.lineDiff /*istanbul ignore end*/.tokenize; jsonDiff.castInput = function (value) { /*istanbul ignore start*/var _options = /*istanbul ignore end*/this.options, undefinedReplacement = _options.undefinedReplacement, _options$stringifyRep = _options.stringifyReplacer, stringifyReplacer = _options$stringifyRep === undefined ? function (k, v) /*istanbul ignore start*/{ return (/*istanbul ignore end*/typeof v === 'undefined' ? undefinedReplacement : v ); } : _options$stringifyRep; return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' '); }; jsonDiff.equals = function (left, right) { return (/*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1')) ); }; function diffJson(oldObj, newObj, options) { return jsonDiff.diff(oldObj, newObj, options); } // This function handles the presence of circular references by bailing out when encountering an // object that is already on the "stack" of items being processed. Accepts an optional replacer function canonicalize(obj, stack, replacementStack, replacer, key) { stack = stack || []; replacementStack = replacementStack || []; if (replacer) { obj = replacer(key, obj); } var i = /*istanbul ignore start*/void 0 /*istanbul ignore end*/; for (i = 0; i < stack.length; i += 1) { if (stack[i] === obj) { return replacementStack[i]; } } var canonicalizedObj = /*istanbul ignore start*/void 0 /*istanbul ignore end*/; if ('[object Array]' === objectPrototypeToString.call(obj)) { stack.push(obj); canonicalizedObj = new Array(obj.length); replacementStack.push(canonicalizedObj); for (i = 0; i < obj.length; i += 1) { canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key); } stack.pop(); replacementStack.pop(); return canonicalizedObj; } if (obj && obj.toJSON) { obj = obj.toJSON(); } if ( /*istanbul ignore start*/(typeof /*istanbul ignore end*/obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null) { stack.push(obj); canonicalizedObj = {}; replacementStack.push(canonicalizedObj); var sortedKeys = [], _key = /*istanbul ignore start*/void 0 /*istanbul ignore end*/; for (_key in obj) { /* istanbul ignore else */ if (obj.hasOwnProperty(_key)) { sortedKeys.push(_key); } } sortedKeys.sort(); for (i = 0; i < sortedKeys.length; i += 1) { _key = sortedKeys[i]; canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key); } stack.pop(); replacementStack.pop(); } else { canonicalizedObj = obj; } return canonicalizedObj; } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2pzb24uanMiXSwibmFtZXMiOlsiZGlmZkpzb24iLCJjYW5vbmljYWxpemUiLCJvYmplY3RQcm90b3R5cGVUb1N0cmluZyIsIk9iamVjdCIsInByb3RvdHlwZSIsInRvU3RyaW5nIiwianNvbkRpZmYiLCJ1c2VMb25nZXN0VG9rZW4iLCJ0b2tlbml6ZSIsImNhc3RJbnB1dCIsInZhbHVlIiwib3B0aW9ucyIsInVuZGVm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plZE9iajtcbiAgfVxuXG4gIGlmIChvYmogJiYgb2JqLnRvSlNPTikge1xuICAgIG9iaiA9IG9iai50b0pTT04oKTtcbiAgfVxuXG4gIGlmICh0eXBlb2Ygb2JqID09PSAnb2JqZWN0JyAmJiBvYmogIT09IG51bGwpIHtcbiAgICBzdGFjay5wdXNoKG9iaik7XG4gICAgY2Fub25pY2FsaXplZE9iaiA9IHt9O1xuICAgIHJlcGxhY2VtZW50U3RhY2sucHVzaChjYW5vbmljYWxpemVkT2JqKTtcbiAgICBsZXQgc29ydGVkS2V5cyA9IFtdLFxuICAgICAgICBrZXk7XG4gICAgZm9yIChrZXkgaW4gb2JqKSB7XG4gICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgZWxzZSAqL1xuICAgICAgaWYgKG9iai5oYXNPd25Qcm9wZXJ0eShrZXkpKSB7XG4gICAgICAgIHNvcnRlZEtleXMucHVzaChrZXkpO1xuICAgICAgfVxuICAgIH1cbiAgICBzb3J0ZWRLZXlzLnNvcnQoKTtcbiAgICBmb3IgKGkgPSAwOyBpIDwgc29ydGVkS2V5cy5sZW5ndGg7IGkgKz0gMSkge1xuICAgICAga2V5ID0gc29ydGVkS2V5c1tpXTtcbiAgICAgIGNhbm9uaWNhbGl6ZWRPYmpba2V5XSA9IGNhbm9uaWNhbGl6ZShvYmpba2V5XSwgc3RhY2ssIHJlcGxhY2VtZW50U3RhY2ssIHJlcGxhY2VyLCBrZXkpO1xuICAgIH1cbiAgICBzdGFjay5wb3AoKTtcbiAgICByZXBsYWNlbWVudFN0YWNrLnBvcCgpO1xuICB9IGVsc2Uge1xuICAgIGNhbm9uaWNhbGl6ZWRPYmogPSBvYmo7XG4gIH1cbiAgcmV0dXJuIGNhbm9uaWNhbGl6ZWRPYmo7XG59XG4iXX0= /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { /*istanbul ignore start*/'use strict'; exports.__esModule = true; exports.arrayDiff = undefined; exports. /*istanbul ignore end*/diffArrays = diffArrays; var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/; /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /*istanbul ignore end*/var arrayDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/(); arrayDiff.tokenize = function (value) { return value.slice(); }; arrayDiff.join = arrayDiff.removeEmpty = function (value) { return value; }; function diffArrays(oldArr, newArr, callback) { return arrayDiff.diff(oldArr, newArr, callback); } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2FycmF5LmpzIl0sIm5hbWVzIjpbImRpZmZBcnJheXMiLCJhcnJheURpZmYiLCJ0b2tlbml6ZSIsInZhbHVlIiwic2xpY2UiLCJqb2luIiwicmVtb3ZlRW1wdHkiLCJvbGRBcnIiLCJuZXdBcnIiLCJjYWxsYmFjayIsImRpZmYiXSwibWFwcGluZ3MiOiI7Ozs7Z0NBVWdCQSxVLEdBQUFBLFU7O0FBVmhCOzs7Ozs7dUJBRU8sSUFBTUMsaUZBQVksd0VBQWxCO0FBQ1BBLFVBQVVDLFFBQVYsR0FBcUIsVUFBU0MsS0FBVCxFQUFnQjtBQUNuQyxTQUFPQSxNQUFNQyxLQUFOLEVBQVA7QUFDRCxDQUZEO0FBR0FILFVBQVVJLElBQVYsR0FBaUJKLFVBQVVLLFdBQVYsR0FBd0IsVUFBU0gsS0FBVCxFQUFnQjtBQUN2RCxTQUFPQSxLQUFQO0FBQ0QsQ0FGRDs7QUFJTyxTQUFTSCxVQUFULENBQW9CTyxNQUFwQixFQUE0QkMsTUFBNUIsRUFBb0NDLFFBQXBDLEVBQThDO0FBQUUsU0FBT1IsVUFBVVMsSUFBVixDQUFlSCxNQUFmLEVBQXVCQyxNQUF2QixFQUErQkMsUUFBL0IsQ0FBUDtBQUFrRCIsImZpbGUiOiJhcnJheS5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBEaWZmIGZyb20gJy4vYmFzZSc7XG5cbmV4cG9ydCBjb25zdCBhcnJheURpZmYgPSBuZXcgRGlmZigpO1xuYXJyYXlEaWZmLnRva2VuaXplID0gZnVuY3Rpb24odmFsdWUpIHtcbiAgcmV0dXJuIHZhbHVlLnNsaWNlKCk7XG59O1xuYXJyYXlEaWZmLmpvaW4gPSBhcnJheURpZmYucmVtb3ZlRW1wdHkgPSBmdW5jdGlvbih2YWx1ZSkge1xuICByZXR1cm4gdmFsdWU7XG59O1xuXG5leHBvcnQgZnVuY3Rpb24gZGlmZkFycmF5cyhvbGRBcnIsIG5ld0FyciwgY2FsbGJhY2spIHsgcmV0dXJuIGFycmF5RGlmZi5kaWZmKG9sZEFyciwgbmV3QXJyLCBjYWxsYmFjayk7IH1cbiJdfQ== /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { /*istanbul ignore start*/'use strict'; exports.__esModule = true; exports. /*istanbul ignore end*/applyPatch = applyPatch; /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = applyPatches; var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/; var /*istanbul ignore start*/_distanceIterator = __webpack_require__(12) /*istanbul ignore end*/; /*istanbul ignore start*/var _distanceIterator2 = _interopRequireDefault(_distanceIterator); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /*istanbul ignore end*/function applyPatch(source, uniDiff) { /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; if (typeof uniDiff === 'string') { uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff); } if (Array.isArray(uniDiff)) { if (uniDiff.length > 1) { throw new Error('applyPatch only works with a single input.'); } uniDiff = uniDiff[0]; } // Apply the diff to the input var lines = source.split(/\r\n|[\n\v\f\r\x85]/), delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [], hunks = uniDiff.hunks, compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) /*istanbul ignore start*/{ return (/*istanbul ignore end*/line === patchContent ); }, errorCount = 0, fuzzFactor = options.fuzzFactor || 0, minLine = 0, offset = 0, removeEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/, addEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/; /** * Checks if the hunk exactly fits on the provided location */ function hunkFits(hunk, toPos) { for (var j = 0; j < hunk.lines.length; j++) { var line = hunk.lines[j], operation = line.length > 0 ? line[0] : ' ', content = line.length > 0 ? line.substr(1) : line; if (operation === ' ' || operation === '-') { // Context sanity check if (!compareLine(toPos + 1, lines[toPos], operation, content)) { errorCount++; if (errorCount > fuzzFactor) { return false; } } toPos++; } } return true; } // Search best fit offsets for each hunk based on the previous ones for (var i = 0; i < hunks.length; i++) { var hunk = hunks[i], maxLine = lines.length - hunk.oldLines, localOffset = 0, toPos = offset + hunk.oldStart - 1; var iterator = /*istanbul ignore start*/(0, _distanceIterator2['default']) /*istanbul ignore end*/(toPos, minLine, maxLine); for (; localOffset !== undefined; localOffset = iterator()) { if (hunkFits(hunk, toPos + localOffset)) { hunk.offset = offset += localOffset; break; } } if (localOffset === undefined) { return false; } // Set lower text limit to end of the current hunk, so next ones don't try // to fit over already patched text minLine = hunk.offset + hunk.oldStart + hunk.oldLines; } // Apply patch hunks var diffOffset = 0; for (var _i = 0; _i < hunks.length; _i++) { var _hunk = hunks[_i], _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1; diffOffset += _hunk.newLines - _hunk.oldLines; if (_toPos < 0) { // Creating a new file _toPos = 0; } for (var j = 0; j < _hunk.lines.length; j++) { var line = _hunk.lines[j], operation = line.length > 0 ? line[0] : ' ', content = line.length > 0 ? line.substr(1) : line, delimiter = _hunk.linedelimiters[j]; if (operation === ' ') { _toPos++; } else if (operation === '-') { lines.splice(_toPos, 1); delimiters.splice(_toPos, 1); /* istanbul ignore else */ } else if (operation === '+') { lines.splice(_toPos, 0, content); delimiters.splice(_toPos, 0, delimiter); _toPos++; } else if (operation === '\\') { var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null; if (previousOperation === '+') { removeEOFNL = true; } else if (previousOperation === '-') { addEOFNL = true; } } } } // Handle EOFNL insertion/removal if (removeEOFNL) { while (!lines[lines.length - 1]) { lines.pop(); delimiters.pop(); } } else if (addEOFNL) { lines.push(''); delimiters.push('\n'); } for (var _k = 0; _k < lines.length - 1; _k++) { lines[_k] = lines[_k] + delimiters[_k]; } return lines.join(''); } // Wrapper that supports multiple file patches via callbacks. function applyPatches(uniDiff, options) { if (typeof uniDiff === 'string') { uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff); } var currentIndex = 0; function processIndex() { var index = uniDiff[currentIndex++]; if (!index) { return options.complete(); } options.loadFile(index, function (err, data) { if (err) { return options.complete(err); } var updatedContent = applyPatch(data, index, options); options.patched(index, updatedContent, function (err) { if (err) { return options.complete(err); } processIndex(); }); }); } processIndex(); } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9hcHBseS5qcyJdLCJuYW1lcyI6WyJhcHBseVBhdGNoIiwiYXBwbHlQYXRjaGVzIiwic291cmNlIiwidW5pRGlmZiIsIm9wdGlvbnMiLCJBcnJheSIsImlzQXJyYXkiLCJsZW5ndGgiLCJFcnJvciIsImxpbmVzIiwic3BsaXQiLCJkZWxpbWl0ZXJzIiwibWF0Y2giLCJodW5rcyIsImNvbXBhcmVMaW5lIiwibGluZU51bWJlciIsImxpbmUiLCJvcGVyYXRpb24iLCJwYXRjaENvbnRlbnQiLCJlcnJvckNvdW50IiwiZnV6ekZhY3RvciIsIm1pbkxpbmUiLCJvZmZzZXQiLCJyZW1vdmVFT0ZOTCIsImFkZEVPRk5MIiwia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3RseSBmaXRzIG9uIHRoZSBwcm92aWRlZCBsb2NhdGlvblxuICAgKi9cbiAgZnVuY3Rpb24gaHVua0ZpdHMoaHVuaywgdG9Qb3MpIHtcbiAgICBmb3IgKGxldCBqID0gMDsgaiA8IGh1bmsubGluZXMubGVuZ3RoOyBqKyspIHtcbiAgICAgIGxldCBsaW5lID0gaHVuay5saW5lc1tqXSxcbiAgICAgICAgICBvcGVyYXRpb24gPSAobGluZS5sZW5ndGggPiAwID8gbGluZVswXSA6ICcgJyksXG4gICAgICAgICAgY29udGVudCA9IChsaW5lLmxlbmd0aCA+IDAgPyBsaW5lLnN1YnN0cigxKSA6IGxpbmUpO1xuXG4gICAgICBpZiAob3BlcmF0aW9uID09PSAnICcgfHwgb3BlcmF0aW9uID09PSAnLScpIHtcbiAgICAgICAgLy8gQ29udGV4dCBzYW5pdHkgY2hlY2tcbiAgICAgICAgaWYgKCFjb21wYXJlTGluZSh0b1BvcyArIDEsIGxpbmVzW3RvUG9zXSwgb3BlcmF0aW9uLCBjb250ZW50KSkge1xuICAgICAgICAgIGVycm9yQ291bnQrKztcblxuICAgICAgICAgIGlmIChlcnJvckNvdW50ID4gZnV6ekZhY3Rvcikge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICB0b1BvcysrO1xuICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiB0cnVlO1xuICB9XG5cbiAgLy8gU2VhcmNoIGJlc3QgZml0IG9mZnNldHMgZm9yIGVhY2ggaHVuayBiYXNlZCBvbiB0aGUgcHJldmlvdXMgb25lc1xuICBmb3IgKGxldCBpID0gMDsgaSA8IGh1bmtzLmxlbmd0aDsgaSsrKSB7XG4gICAgbGV0IGh1bmsgPSBodW5rc1tpXSxcbiAgICAgICAgbWF4TGluZSA9IGxpbmVzLmxlbmd0aCAtIGh1bmsub2xkTGluZXMsXG4gICAgICAgIGxvY2FsT2Zmc2V0ID0gMCxcbiAgICA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oKTtcbiAgICB9XG5cbiAgICBvcHRpb25zLmxvYWRGaWxlKGluZGV4LCBmdW5jdGlvbihlcnIsIGRhdGEpIHtcbiAgICAgIGlmIChlcnIpIHtcbiAgICAgICAgcmV0dXJuIG9wdGlvbnMuY29tcGxldGUoZXJyKTtcbiAgICAgIH1cblxuICAgICAgbGV0IHVwZGF0ZWRDb250ZW50ID0gYXBwbHlQYXRjaChkYXRhLCBpbmRleCwgb3B0aW9ucyk7XG4gICAgICBvcHRpb25zLnBhdGNoZWQoaW5kZXgsIHVwZGF0ZWRDb250ZW50LCBmdW5jdGlvbihlcnIpIHtcbiAgICAgICAgaWYgKGVycikge1xuICAgICAgICAgIHJldHVybiBvcHRpb25zLmNvbXBsZXRlKGVycik7XG4gICAgICAgIH1cblxuICAgICAgICBwcm9jZXNzSW5kZXgoKTtcbiAgICAgIH0pO1xuICAgIH0pO1xuICB9XG4gIHByb2Nlc3NJbmRleCgpO1xufVxuIl19 /***/ }), /* 11 */ /***/ (function(module, exports) { /*istanbul ignore start*/'use strict'; exports.__esModule = true; exports. /*istanbul ignore end*/parsePatch = parsePatch; function parsePatch(uniDiff) { /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/), delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [], list = [], i = 0; function parseIndex() { var index = {}; list.push(index); // Parse diff metadata while (i < diffstr.length) { var line = diffstr[i]; // File header found, end parsing diff metadata if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) { break; } // Diff index var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line); if (header) { index.index = header[1]; } i++; } // Parse file headers if they are defined. Unified diff requires them, but // there's no technical issues to have an isolated hunk without file header parseFileHeader(index); parseFileHeader(index); // Parse hunks index.hunks = []; while (i < diffstr.length) { var _line = diffstr[i]; if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) { break; } else if (/^@@/.test(_line)) { index.hunks.push(parseHunk()); } else if (_line && options.strict) { // Ignore unexpected content unless in strict mode throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line)); } else { i++; } } } // Parses the --- and +++ headers, if none are found, no lines // are consumed. function parseFileHeader(index) { var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]); if (fileHeader) { var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new'; var data = fileHeader[2].split('\t', 2); var fileName = data[0].replace(/\\\\/g, '\\'); if (/^".*"$/.test(fileName)) { fileName = fileName.substr(1, fileName.length - 2); } index[keyPrefix + 'FileName'] = fileName; index[keyPrefix + 'Header'] = (data[1] || '').trim(); i++; } } // Parses a hunk // This assumes that we are at the start of a hunk. function parseHunk() { var chunkHeaderIndex = i, chunkHeaderLine = diffstr[i++], chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/); var hunk = { oldStart: +chunkHeader[1], oldLines: +chunkHeader[2] || 1, newStart: +chunkHeader[3], newLines: +chunkHeader[4] || 1, lines: [], linedelimiters: [] }; var addCount = 0, removeCount = 0; for (; i < diffstr.length; i++) { // Lines starting with '---' could be mistaken for the "remove line" operation // But they could be the header for the next file. Therefore prune such cases out. if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) { break; } var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0]; if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') { hunk.lines.push(diffstr[i]); hunk.linedelimiters.push(delimiters[i] || '\n'); if (operation === '+') { addCount++; } else if (operation === '-') { removeCount++; } else if (operation === ' ') { addCount++; removeCount++; } } else { break; } } // Handle the empty block count case if (!addCount && hunk.newLines === 1) { hunk.newLines = 0; } if (!removeCount && hunk.oldLines === 1) { hunk.oldLines = 0; } // Perform optional sanity checking if (options.strict) { if (addCount !== hunk.newLines) { throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); } if (removeCount !== hunk.oldLines) { throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); } } return hunk; } while (i < diffstr.length) { parseIndex(); } return list; } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9wYXJzZS5qcyJdLCJuYW1lcyI6WyJwYXJzZVBhdGNoIiwidW5pRGlmZiIsIm9wdGlvbnMiLCJkaWZmc3RyIiwic3BsaXQiLCJkZWxpbWl0ZXJzIiwibWF0Y2giLCJsaXN0IiwiaSIsInBhcnNlSW5kZXgiLCJpbmRleCIsInB1c2giLCJsZW5ndGgiLCJsaW5lIiwidGVzdCIsImhlYWRlciIsImV4ZWMiLCJwYXJzZUZpbGVIZWFkZXIiLCJodW5rcyIsInBhcnNlSHVuayIsInN0cmljdCIsIkVycm9yIiwiSlNPTiIsInN0cmluZ2lmeSIsImZpbGVIZWFkZXIiLCJrZXlQcmVmaXgiLCJkYXRhIiwiZmlsZU5hbWUiLCJyZXBsYWNlIiwic3Vic3RyIiwidHJpbSIsImNodW5rSGVhZGVySW5kZXgiLCJjaHVua0hlYWRlckxpbmUiLCJjaHVua0hlYWRlciIsImh1bmsiLCJvbGRTdGFydCIsIm9sZExpbmVzIiwibmV3U3RhcnQiLCJuZXdMaW5lcyIsImxpbmVzIiwibGluZWRlbGltaXRlcnMiLCJhZGRDb3VudCIsInJlbW92ZUNvdW50IiwiaW5kZXhPZiIsIm9wZXJhdGlvbiJdLCJtYXBwaW5ncyI6Ijs7O2dDQUFnQkEsVSxHQUFBQSxVO0FBQVQsU0FBU0EsVUFBVCxDQUFvQkMsT0FBcEIsRUFBMkM7QUFBQSxzREFBZEMsT0FBYyx1RUFBSixFQUFJOztBQUNoRCxNQUFJQyxVQUFVRixRQUFRRyxLQUFS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bmUgY291bnQgZGlkIG5vdCBtYXRjaCBmb3IgaHVuayBhdCBsaW5lICcgKyAoY2h1bmtIZWFkZXJJbmRleCArIDEpKTtcbiAgICAgIH1cbiAgICAgIGlmIChyZW1vdmVDb3VudCAhPT0gaHVuay5vbGRMaW5lcykge1xuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1JlbW92ZWQgbGluZSBjb3VudCBkaWQgbm90IG1hdGNoIGZvciBodW5rIGF0IGxpbmUgJyArIChjaHVua0hlYWRlckluZGV4ICsgMSkpO1xuICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiBodW5rO1xuICB9XG5cbiAgd2hpbGUgKGkgPCBkaWZmc3RyLmxlbmd0aCkge1xuICAgIHBhcnNlSW5kZXgoKTtcbiAgfVxuXG4gIHJldHVybiBsaXN0O1xufVxuIl19 /***/ }), /* 12 */ /***/ (function(module, exports) { /*istanbul ignore start*/"use strict"; exports.__esModule = true; exports["default"] = /*istanbul ignore end*/function (start, minLine, maxLine) { var wantForward = true, backwardExhausted = false, forwardExhausted = false, localOffset = 1; return function iterator() { if (wantForward && !forwardExhausted) { if (backwardExhausted) { localOffset++; } else { wantForward = false; } // Check if trying to fit beyond text length, and if not, check it fits // after offset location (or desired location on first iteration) if (start + localOffset <= maxLine) { return localOffset; } forwardExhausted = true; } if (!backwardExhausted) { if (!forwardExhausted) { wantForward = true; } // Check if trying to fit before text beginning, and if not, check it fits // before offset location if (minLine <= start - localOffset) { return -localOffset++; } backwardExhausted = true; return iterator(); } // We tried to fit hunk before text beginning and beyond text length, then // hunk can't fit on the text. Return undefined }; }; //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL2Rpc3RhbmNlLWl0ZXJhdG9yLmpzIl0sIm5hbWVzIjpbInN0YXJ0IiwibWluTGluZSIsIm1heExpbmUiLCJ3YW50Rm9yd2FyZCIsImJhY2t3YXJkRXhoYXVzdGVkI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4gICAgICAgIHdhbnRGb3J3YXJkID0gdHJ1ZTtcbiAgICAgIH1cblxuICAgICAgLy8gQ2hlY2sgaWYgdHJ5aW5nIHRvIGZpdCBiZWZvcmUgdGV4dCBiZWdpbm5pbmcsIGFuZCBpZiBub3QsIGNoZWNrIGl0IGZpdHNcbiAgICAgIC8vIGJlZm9yZSBvZmZzZXQgbG9jYXRpb25cbiAgICAgIGlmIChtaW5MaW5lIDw9IHN0YXJ0IC0gbG9jYWxPZmZzZXQpIHtcbiAgICAgICAgcmV0dXJuIC1sb2NhbE9mZnNldCsrO1xuICAgICAgfVxuXG4gICAgICBiYWNrd2FyZEV4aGF1c3RlZCA9IHRydWU7XG4gICAgICByZXR1cm4gaXRlcmF0b3IoKTtcbiAgICB9XG5cbiAgICAvLyBXZSB0cmllZCB0byBmaXQgaHVuayBiZWZvcmUgdGV4dCBiZWdpbm5pbmcgYW5kIGJleW9uZCB0ZXh0IGxlbmd0aCwgdGhlblxuICAgIC8vIGh1bmsgY2FuJ3QgZml0IG9uIHRoZSB0ZXh0LiBSZXR1cm4gdW5kZWZpbmVkXG4gIH07XG59XG4iXX0= /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { /*istanbul ignore start*/'use strict'; exports.__esModule = true; exports. /*istanbul ignore end*/calcLineCount = calcLineCount; /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = merge; var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/; var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/; var /*istanbul ignore start*/_array = __webpack_require__(15) /*istanbul ignore end*/; /*istanbul ignore start*/function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } /*istanbul ignore end*/function calcLineCount(hunk) { /*istanbul ignore start*/var _calcOldNewLineCount = /*istanbul ignore end*/calcOldNewLineCount(hunk.lines), oldLines = _calcOldNewLineCount.oldLines, newLines = _calcOldNewLineCount.newLines; if (oldLines !== undefined) { hunk.oldLines = oldLines; } else { delete hunk.oldLines; } if (newLines !== undefined) { hunk.newLines = newLines; } else { delete hunk.newLines; } } function merge(mine, theirs, base) { mine = loadPatch(mine, base); theirs = loadPatch(theirs, base); var ret = {}; // For index we just let it pass through as it doesn't have any necessary meaning. // Leaving sanity checks on this to the API consumer that may know more about the // meaning in their own context. if (mine.index || theirs.index) { ret.index = mine.index || theirs.index; } if (mine.newFileName || theirs.newFileName) { if (!fileNameChanged(mine)) { // No header or no change in ours, use theirs (and ours if theirs does not exist) ret.oldFileName = theirs.oldFileName || mine.oldFileName; ret.newFileName = theirs.newFileName || mine.newFileName; ret.oldHeader = theirs.oldHeader || mine.oldHeader; ret.newHeader = theirs.newHeader || mine.newHeader; } else if (!fileNameChanged(theirs)) { // No header or no change in theirs, use ours ret.oldFileName = mine.oldFileName; ret.newFileName = mine.newFileName; ret.oldHeader = mine.oldHeader; ret.newHeader = mine.newHeader; } else { // Both changed... figure it out ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName); ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName); ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader); ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader); } } ret.hunks = []; var mineIndex = 0, theirsIndex = 0, mineOffset = 0, theirsOffset = 0; while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) { var mineCurrent = mine.hunks[mineIndex] || { oldStart: Infinity }, theirsCurrent = theirs.hunks[theirsIndex] || { oldStart: Infinity }; if (hunkBefore(mineCurrent, theirsCurrent)) { // This patch does not overlap with any of the others, yay. ret.hunks.push(cloneHunk(mineCurrent, mineOffset)); mineIndex++; theirsOffset += mineCurrent.newLines - mineCurrent.oldLines; } else if (hunkBefore(theirsCurrent, mineCurrent)) { // This patch does not overlap with any of the others, yay. ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset)); theirsIndex++; mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines; } else { // Overlap, merge as best we can var mergedHunk = { oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart), oldLines: 0, newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset), newLines: 0, lines: [] }; mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines); theirsIndex++; mineIndex++; ret.hunks.push(mergedHunk); } } return ret; } function loadPatch(param, base) { if (typeof param === 'string') { if (/^@@/m.test(param) || /^Index:/m.test(param)) { return (/*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(param)[0] ); } if (!base) { throw new Error('Must provide a base reference or pass in a patch'); } return (/*istanbul ignore start*/(0, _create.structuredPatch) /*istanbul ignore end*/(undefined, undefined, base, param) ); } return param; } function fileNameChanged(patch) { return patch.newFileName && patch.newFileName !== patch.oldFileName; } function selectField(index, mine, theirs) { if (mine === theirs) { return mine; } else { index.conflict = true; return { mine: mine, theirs: theirs }; } } function hunkBefore(test, check) { return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart; } function cloneHunk(hunk, offset) { return { oldStart: hunk.oldStart, oldLines: hunk.oldLines, newStart: hunk.newStart + offset, newLines: hunk.newLines, lines: hunk.lines }; } function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) { // This will generally result in a conflicted hunk, but there are cases where the context // is the only overlap where we can successfully merge the content here. var mine = { offset: mineOffset, lines: mineLines, index: 0 }, their = { offset: theirOffset, lines: theirLines, index: 0 }; // Handle any leading content insertLeading(hunk, mine, their); insertLeading(hunk, their, mine); // Now in the overlap content. Scan through and select the best changes from each. while (mine.index < mine.lines.length && their.index < their.lines.length) { var mineCurrent = mine.lines[mine.index], theirCurrent = their.lines[their.index]; if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) { // Both modified ... mutualChange(hunk, mine, their); } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') { /*istanbul ignore start*/var _hunk$lines; /*istanbul ignore end*/ // Mine inserted /*istanbul ignore start*/(_hunk$lines = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/collectChange(mine))); } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') { /*istanbul ignore start*/var _hunk$lines2; /*istanbul ignore end*/ // Theirs inserted /*istanbul ignore start*/(_hunk$lines2 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/collectChange(their))); } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') { // Mine removed or edited removal(hunk, mine, their); } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') { // Their removed or edited removal(hunk, their, mine, true); } else if (mineCurrent === theirCurrent) { // Context identity hunk.lines.push(mineCurrent); mine.index++; their.index++; } else { // Context mismatch conflict(hunk, collectChange(mine), collectChange(their)); } } // Now push anything that may be remaining insertTrailing(hunk, mine); insertTrailing(hunk, their); calcLineCount(hunk); } function mutualChange(hunk, mine, their) { var myChanges = collectChange(mine), theirChanges = collectChange(their); if (allRemoves(myChanges) && allRemoves(theirChanges)) { // Special case for remove changes that are supersets of one another if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) { /*istanbul ignore start*/var _hunk$lines3; /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines3 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/myChanges)); return; } else if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) { /*istanbul ignore start*/var _hunk$lines4; /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines4 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines4 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/theirChanges)); return; } } else if ( /*istanbul ignore start*/(0, _array.arrayEqual) /*istanbul ignore end*/(myChanges, theirChanges)) { /*istanbul ignore start*/var _hunk$lines5; /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines5 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines5 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/myChanges)); return; } conflict(hunk, myChanges, theirChanges); } function removal(hunk, mine, their, swap) { var myChanges = collectChange(mine), theirChanges = collectContext(their, myChanges); if (theirChanges.merged) { /*istanbul ignore start*/var _hunk$lines6; /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines6 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines6 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/theirChanges.merged)); } else { conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges); } } function conflict(hunk, mine, their) { hunk.conflict = true; hunk.lines.push({ conflict: true, mine: mine, theirs: their }); } function insertLeading(hunk, insert, their) { while (insert.offset < their.offset && insert.index < insert.lines.length) { var line = insert.lines[insert.index++]; hunk.lines.push(line); insert.offset++; } } function insertTrailing(hunk, insert) { while (insert.index < insert.lines.length) { var line = insert.lines[insert.index++]; hunk.lines.push(line); } } function collectChange(state) { var ret = [], operation = state.lines[state.index][0]; while (state.index < state.lines.length) { var line = state.lines[state.index]; // Group additions that are immediately after subtractions and treat them as one "atomic" modify change. if (operation === '-' && line[0] === '+') { operation = '+'; } if (operation === line[0]) { ret.push(line); state.index++; } else { break; } } return ret; } function collectContext(state, matchChanges) { var changes = [], merged = [], matchIndex = 0, contextChanges = false, conflicted = false; while (matchIndex < matchChanges.length && state.index < state.lines.length) { var change = state.lines[state.index], match = matchChanges[matchIndex]; // Once we've hit our add, then we are done if (match[0] === '+') { break; } contextChanges = contextChanges || change[0] !== ' '; merged.push(match); matchIndex++; // Consume any additions in the other block as a conflict to attempt // to pull in the remaining context after this if (change[0] === '+') { conflicted = true; while (change[0] === '+') { changes.push(change); change = state.lines[++state.index]; } } if (match.substr(1) === change.substr(1)) { changes.push(change); state.index++; } else { conflicted = true; } } if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) { conflicted = true; } if (conflicted) { return changes; } while (matchIndex < matchChanges.length) { merged.push(matchChanges[matchIndex++]); } return { merged: merged, changes: changes }; } function allRemoves(changes) { return changes.reduce(function (prev, change) { return prev && change[0] === '-'; }, true); } function skipRemoveSuperset(state, removeChanges, delta) { for (var i = 0; i < delta; i++) { var changeContent = removeChanges[removeChanges.length - delta + i].substr(1); if (state.lines[state.index + i] !== ' ' + changeContent) { return false; } } state.index += delta; return true; } function calcOldNewLineCount(lines) { var oldLines = 0; var newLines = 0; lines.forEach(function (line) { if (typeof line !== 'string') { var myCount = calcOldNewLineCount(line.mine); var theirCount = calcOldNewLineCount(line.theirs); if (oldLines !== undefined) { if (myCount.oldLines === theirCount.oldLines) { oldLines += myCount.oldLines; } else { oldLines = undefined; } } if (newLines !== undefined) { if (myCount.newLines === theirCount.newLines) { newLines += myCount.newLines; } else { newLines = undefined; } } } else { if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) { newLines++; } if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) { oldLines++; } } }); return { oldLines: oldLines, newLines: newLines }; } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9tZXJnZS5qcyJdLCJuYW1lcyI6WyJjYWxjTGluZUNvdW50IiwibWVyZ2UiLCJodW5rIiwiY2FsY09sZE5ld0xpbmVDb3VudCIsImxpbmVzIiwib2xkTGluZXMiLCJuZXdMaW5lcyIsInVuZGVmaW5lZCIsIm1pbmUiLCJ0aGVpcnMiLCJiYXNlIiwibG9hZFBhdGNoIiwicmV0IiwiaW5kZXgiLCJuZXdGaWxlTmFtZSIsImZpbGVOYW1lQ2hhbmdlZCIsIm9sZEZpbGVOYW1lIiwib2xkSGVhZGVyIiwibmV3SGVhZGVyIiwic2VsZWN0RmllbGQiLCJodW5rcyIsIm1pbmVJbmRleCIsInRoZWlyc0luZGV4IiwibWluZU9mZnNldCIsInRoZWlyc09mZnNldCIsImxlbmd0aCIsIm1pbmVDdXJyZW50Iiwib2xkU3RhcnQiLCJJbmZpbml0eSIsInRoZWlyc0N1cnJlbnQiLCJodW5rQmVmb3JlIiwicHVzaCIsImNsb25lSHVuayIsIm1lcmdlZEh1bmsiLCJNYXRoIiwibWluIiwibmV3U3RhcnQiLCJtZXJnZUxpbmVzIiwicGFyYW0iLCJ0ZXN0IiwiRXJyb3IiLCJwYXRjaCIsImNvbmZsaWN0IiwiY2hlY2siLCJvZmZzZXQiLCJtaW5lTGluZXMiLCJ0aGVpck9mZnNldCIsInRoZWlyTGluZXMiLCJ0aGVpciIsImluc2VydExlYWRpbmciLCJ0aGVpckN1cnJlbnQiLCJtdXR1YWxDaGFuZ2UiLCJjb2xsZWN0Q2hhbmdlIiwicmVtb3ZhbCIsImluc2VydFRyYWlsaW5nIiwibXlDaGFuZ2VzIiwidGhlaXJDaGFuZ2VzIiwiYWxsUmVtb3ZlcyIsInNraXBSZW1vdmVTdXBlcnNldCIsInN3YXAiLCJjb2xsZWN0Q29udGV4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AgcmV0dXJuIGZhbHNlO1xuICAgIH1cbiAgfVxuXG4gIHN0YXRlLmluZGV4ICs9IGRlbHRhO1xuICByZXR1cm4gdHJ1ZTtcbn1cblxuZnVuY3Rpb24gY2FsY09sZE5ld0xpbmVDb3VudChsaW5lcykge1xuICBsZXQgb2xkTGluZXMgPSAwO1xuICBsZXQgbmV3TGluZXMgPSAwO1xuXG4gIGxpbmVzLmZvckVhY2goZnVuY3Rpb24obGluZSkge1xuICAgIGlmICh0eXBlb2YgbGluZSAhPT0gJ3N0cmluZycpIHtcbiAgICAgIGxldCBteUNvdW50ID0gY2FsY09sZE5ld0xpbmVDb3VudChsaW5lLm1pbmUpO1xuICAgICAgbGV0IHRoZWlyQ291bnQgPSBjYWxjT2xkTmV3TGluZUNvdW50KGxpbmUudGhlaXJzKTtcblxuICAgICAgaWYgKG9sZExpbmVzICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgaWYgKG15Q291bnQub2xkTGluZXMgPT09IHRoZWlyQ291bnQub2xkTGluZXMpIHtcbiAgICAgICAgICBvbGRMaW5lcyArPSBteUNvdW50Lm9sZExpbmVzO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIG9sZExpbmVzID0gdW5kZWZpbmVkO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIGlmIChuZXdMaW5lcyAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgIGlmIChteUNvdW50Lm5ld0xpbmVzID09PSB0aGVpckNvdW50Lm5ld0xpbmVzKSB7XG4gICAgICAgICAgbmV3TGluZXMgKz0gbXlDb3VudC5uZXdMaW5lcztcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBuZXdMaW5lcyA9IHVuZGVmaW5lZDtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0gZWxzZSB7XG4gICAgICBpZiAobmV3TGluZXMgIT09IHVuZGVmaW5lZCAmJiAobGluZVswXSA9PT0gJysnIHx8IGxpbmVbMF0gPT09ICcgJykpIHtcbiAgICAgICAgbmV3TGluZXMrKztcbiAgICAgIH1cbiAgICAgIGlmIChvbGRMaW5lcyAhPT0gdW5kZWZpbmVkICYmIChsaW5lWzBdID09PSAnLScgfHwgbGluZVswXSA9PT0gJyAnKSkge1xuICAgICAgICBvbGRMaW5lcysrO1xuICAgICAgfVxuICAgIH1cbiAgfSk7XG5cbiAgcmV0dXJuIHtvbGRMaW5lcywgbmV3TGluZXN9O1xufVxuIl19 /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { /*istanbul ignore start*/'use strict'; exports.__esModule = true; exports. /*istanbul ignore end*/structuredPatch = structuredPatch; /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = createTwoFilesPatch; /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = createPatch; var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/; /*istanbul ignore start*/function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } /*istanbul ignore end*/function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { if (!options) { options = {}; } if (typeof options.context === 'undefined') { options.context = 4; } var diff = /*istanbul ignore start*/(0, _line.diffLines) /*istanbul ignore end*/(oldStr, newStr, options); diff.push({ value: '', lines: [] }); // Append an empty value to make cleanup easier function contextLines(lines) { return lines.map(function (entry) { return ' ' + entry; }); } var hunks = []; var oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1; /*istanbul ignore start*/var _loop = function _loop( /*istanbul ignore end*/i) { var current = diff[i], lines = current.lines || current.value.replace(/\n$/, '').split('\n'); current.lines = lines; if (current.added || current.removed) { /*istanbul ignore start*/var _curRange; /*istanbul ignore end*/ // If we have previous context, start with that if (!oldRangeStart) { var prev = diff[i - 1]; oldRangeStart = oldLine; newRangeStart = newLine; if (prev) { curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; oldRangeStart -= curRange.length; newRangeStart -= curRange.length; } } // Output our changes /*istanbul ignore start*/(_curRange = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/lines.map(function (entry) { return (current.added ? '+' : '-') + entry; }))); // Track the updated file position if (current.added) { newLine += lines.length; } else { oldLine += lines.length; } } else { // Identical context lines. Track line changes if (oldRangeStart) { // Close out any changes that have been output (or join overlapping) if (lines.length <= options.context * 2 && i < diff.length - 2) { /*istanbul ignore start*/var _curRange2; /*istanbul ignore end*/ // Overlapping /*istanbul ignore start*/(_curRange2 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines))); } else { /*istanbul ignore start*/var _curRange3; /*istanbul ignore end*/ // end the range and output var contextSize = Math.min(lines.length, options.context); /*istanbul ignore start*/(_curRange3 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines.slice(0, contextSize)))); var hunk = { oldStart: oldRangeStart, oldLines: oldLine - oldRangeStart + contextSize, newStart: newRangeStart, newLines: newLine - newRangeStart + contextSize, lines: curRange }; if (i >= diff.length - 2 && lines.length <= options.context) { // EOF is inside this hunk var oldEOFNewline = /\n$/.test(oldStr); var newEOFNewline = /\n$/.test(newStr); if (lines.length == 0 && !oldEOFNewline) { // special case: old has no eol and no trailing context; no-nl can end up before adds curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file'); } else if (!oldEOFNewline || !newEOFNewline) { curRange.push('\\ No newline at end of file'); } } hunks.push(hunk); oldRangeStart = 0; newRangeStart = 0; curRange = []; } } oldLine += lines.length; newLine += lines.length; } }; for (var i = 0; i < diff.length; i++) { /*istanbul ignore start*/_loop( /*istanbul ignore end*/i); } return { oldFileName: oldFileName, newFileName: newFileName, oldHeader: oldHeader, newHeader: newHeader, hunks: hunks }; } function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options); var ret = []; if (oldFileName == newFileName) { ret.push('Index: ' + oldFileName); } ret.push('==================================================================='); ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader)); ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader)); for (var i = 0; i < diff.hunks.length; i++) { var hunk = diff.hunks[i]; ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@'); ret.push.apply(ret, hunk.lines); } return ret.join('\n') + '\n'; } function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9jcmVhdGUuanMiXSwibmFtZXMiOlsic3RydWN0dXJlZFBhdGNoIiwiY3JlYXRlVHdvRmlsZXNQYXRjaCIsImNyZWF0ZVBhdGNoIiwib2xkRmlsZU5hbWUiLCJuZXdGaWxlTmFtZSIsIm9sZFN0ciIsIm5ld1N0ciIsIm9sZEhlYWRlciIsIm5ld0hlYWRlciIsIm9wdGlvbnMiLCJjb250ZXh0IiwiZGlmZiIsInB1c2giLCJ2YWx1ZSIsImxpbmVzIiwiY29udGV4dExpbmVzIiwibWFwIiwiZW50cnkiLCJodW5rcyIsIm9sZFJhbmdlU3RhcnQiLCJuZXdSYW5nZVN0YXJ0IiwiY3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BvbGRTdHIsIG5ld1N0ciwgb2xkSGVhZGVyLCBuZXdIZWFkZXIsIG9wdGlvbnMpO1xufVxuIl19 /***/ }), /* 15 */ /***/ (function(module, exports) { /*istanbul ignore start*/"use strict"; exports.__esModule = true; exports. /*istanbul ignore end*/arrayEqual = arrayEqual; /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayStartsWith = arrayStartsWith; function arrayEqual(a, b) { if (a.length !== b.length) { return false; } return arrayStartsWith(a, b); } function arrayStartsWith(array, start) { if (start.length > array.length) { return false; } for (var i = 0; i < start.length; i++) { if (start[i] !== array[i]) { return false; } } return true; } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL2FycmF5LmpzIl0sIm5hbWVzIjpbImFycmF5RXF1YWwiLCJhcnJheVN0YXJ0c1dpdGgiLCJhIiwiYiIsImxlbmd0aCIsImFycmF5Iiwic3RhcnQiLCJpIl0sIm1hcHBpbmdzIjoiOzs7Z0NBQWdCQSxVLEdBQUFBLFU7eURBUUFDLGUsR0FBQUEsZTtBQVJULFNBQVNELFVBQVQsQ0FBb0JFLENBQXBCLEVBQXVCQyxDQUF2QixFQUEwQjtBQUMvQixNQUFJRCxFQUFFRSxNQUFGLEtBQWFELEVBQUVDLE1BQW5CLEVBQTJCO0FBQ3pCLFdBQU8sS0FBUDtBQUNEOztBQUVELFNBQU9ILGdCQUFnQkMsQ0FBaEIsRUFBbUJDLENBQW5CLENBQVA7QUFDRDs7QUFFTSxTQUFTRixlQUFULENBQXlCSSxLQUF6QixFQUFnQ0MsS0FBaEMsRUFBdUM7QUFDNUMsTUFBSUEsTUFBTUYsTUFBTixHQUFlQyxNQUFNRCxNQUF6QixFQUFpQztBQUMvQixXQUFPLEtBQVA7QUFDRDs7QUFFRCxPQUFLLElBQUlHLElBQUksQ0FBYixFQUFnQkEsSUFBSUQsTUFBTUYsTUFBMUIsRUFBa0NHLEdBQWxDLEVBQXVDO0FBQ3JDLFFBQUlELE1BQU1DLENBQU4sTUFBYUYsTUFBTUUsQ0FBTixDQUFqQixFQUEyQjtBQUN6QixhQUFPLEtBQVA7QUFDRDtBQUNGOztBQUVELFNBQU8sSUFBUDtBQUNEIiwiZmlsZSI6ImFycmF5LmpzIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGZ1bmN0aW9uIGFycmF5RXF1YWwoYSwgYikge1xuICBpZiAoYS5sZW5ndGggIT09IGIubGVuZ3RoKSB7XG4gICAgcmV0dXJuIGZhbHNlO1xuICB9XG5cbiAgcmV0dXJuIGFycmF5U3RhcnRzV2l0aChhLCBiKTtcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIGFycmF5U3RhcnRzV2l0aChhcnJheSwgc3RhcnQpIHtcbiAgaWYgKHN0YXJ0Lmxlbmd0aCA+IGFycmF5Lmxlbmd0aCkge1xuICAgIHJldHVybiBmYWxzZTtcbiAgfVxuXG4gIGZvciAobGV0IGkgPSAwOyBpIDwgc3RhcnQubGVuZ3RoOyBpKyspIHtcbiAgICBpZiAoc3RhcnRbaV0gIT09IGFycmF5W2ldKSB7XG4gICAgICByZXR1cm4gZmFsc2U7XG4gICAgfVxuICB9XG5cbiAgcmV0dXJuIHRydWU7XG59XG4iXX0= /***/ }), /* 16 */ /***/ (function(module, exports) { /*istanbul ignore start*/"use strict"; exports.__esModule = true; exports. /*istanbul ignore end*/convertChangesToDMP = convertChangesToDMP; // See: http://code.google.com/p/google-diff-match-patch/wiki/API function convertChangesToDMP(changes) { var ret = [], change = /*istanbul ignore start*/void 0 /*istanbul ignore end*/, operation = /*istanbul ignore start*/void 0 /*istanbul ignore end*/; for (var i = 0; i < changes.length; i++) { change = changes[i]; if (change.added) { operation = 1; } else if (change.removed) { operation = -1; } else { operation = 0; } ret.push([operation, change.value]); } return ret; } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9j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4gIGZvciAobGV0IGkgPSAwOyBpIDwgY2hhbmdlcy5sZW5ndGg7IGkrKykge1xuICAgIGNoYW5nZSA9IGNoYW5nZXNbaV07XG4gICAgaWYgKGNoYW5nZS5hZGRlZCkge1xuICAgICAgb3BlcmF0aW9uID0gMTtcbiAgICB9IGVsc2UgaWYgKGNoYW5nZS5yZW1vdmVkKSB7XG4gICAgICBvcGVyYXRpb24gPSAtMTtcbiAgICB9IGVsc2Uge1xuICAgICAgb3BlcmF0aW9uID0gMDtcbiAgICB9XG5cbiAgICByZXQucHVzaChbb3BlcmF0aW9uLCBjaGFuZ2UudmFsdWVdKTtcbiAgfVxuICByZXR1cm4gcmV0O1xufVxuIl19 /***/ }), /* 17 */ /***/ (function(module, exports) { /*istanbul ignore start*/'use strict'; exports.__esModule = true; exports. /*istanbul ignore end*/convertChangesToXML = convertChangesToXML; function convertChangesToXML(changes) { var ret = []; for (var i = 0; i < changes.length; i++) { var change = changes[i]; if (change.added) { ret.push('<ins>'); } else if (change.removed) { ret.push('<del>'); } ret.push(escapeHTML(change.value)); if (change.added) { ret.push('</ins>'); } else if (change.removed) { ret.push('</del>'); } } return ret.join(''); } function escapeHTML(s) { var n = s; n = n.replace(/&/g, '&'); n = n.replace(/</g, '<'); n = n.replace(/>/g, '>'); n = n.replace(/"/g, '"'); return n; } /***/ }) /******/ ]) }); ; /***/ }), /* 192 */ /***/ (function(module, exports) { (function() { module.exports = this["tinymce"]; }()); /***/ }), /* 193 */ /***/ (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; }; /***/ }), /* 194 */, /* 195 */, /* 196 */, /* 197 */, /* 198 */, /* 199 */, /* 200 */, /* 201 */, /* 202 */, /* 203 */, /* 204 */, /* 205 */, /* 206 */, /* 207 */, /* 208 */, /* 209 */, /* 210 */, /* 211 */, /* 212 */, /* 213 */, /* 214 */, /* 215 */, /* 216 */, /* 217 */, /* 218 */, /* 219 */, /* 220 */, /* 221 */, /* 222 */, /* 223 */, /* 224 */, /* 225 */, /* 226 */, /* 227 */, /* 228 */, /* 229 */, /* 230 */, /* 231 */, /* 232 */, /* 233 */, /* 234 */, /* 235 */, /* 236 */, /* 237 */, /* 238 */, /* 239 */, /* 240 */, /* 241 */, /* 242 */, /* 243 */, /* 244 */, /* 245 */, /* 246 */, /* 247 */, /* 248 */, /* 249 */, /* 250 */, /* 251 */, /* 252 */, /* 253 */, /* 254 */, /* 255 */, /* 256 */, /* 257 */, /* 258 */, /* 259 */, /* 260 */, /* 261 */, /* 262 */, /* 263 */, /* 264 */, /* 265 */, /* 266 */, /* 267 */, /* 268 */, /* 269 */, /* 270 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } var BEGIN = 'BEGIN'; var COMMIT = 'COMMIT'; var REVERT = 'REVERT'; // Array({transactionID: string or null, beforeState: {object}, action: {object}} var INITIAL_OPTIMIST = []; module.exports = optimist; module.exports.BEGIN = BEGIN; module.exports.COMMIT = COMMIT; module.exports.REVERT = REVERT; function optimist(fn) { function beginReducer(state, action) { var _separateState = separateState(state); var optimist = _separateState.optimist; var innerState = _separateState.innerState; optimist = optimist.concat([{ beforeState: innerState, action: action }]); innerState = fn(innerState, action); validateState(innerState, action); return _extends({ optimist: optimist }, innerState); } function commitReducer(state, action) { var _separateState2 = separateState(state); var optimist = _separateState2.optimist; var innerState = _separateState2.innerState; var newOptimist = [], started = false, committed = false; optimist.forEach(function (entry) { if (started) { if (entry.beforeState && matchesTransaction(entry.action, action.optimist.id)) { committed = true; newOptimist.push({ action: entry.action }); } else { newOptimist.push(entry); } } else if (entry.beforeState && !matchesTransaction(entry.action, action.optimist.id)) { started = true; newOptimist.push(entry); } else if (entry.beforeState && matchesTransaction(entry.action, action.optimist.id)) { committed = true; } }); if (!committed) { console.error('Cannot commit transaction with id "' + action.optimist.id + '" because it does not exist'); } optimist = newOptimist; return baseReducer(optimist, innerState, action); } function revertReducer(state, action) { var _separateState3 = separateState(state); var optimist = _separateState3.optimist; var innerState = _separateState3.innerState; var newOptimist = [], started = false, gotInitialState = false, currentState = innerState; optimist.forEach(function (entry) { if (entry.beforeState && matchesTransaction(entry.action, action.optimist.id)) { currentState = entry.beforeState; gotInitialState = true; } if (!matchesTransaction(entry.action, action.optimist.id)) { if (entry.beforeState) { started = true; } if (started) { if (gotInitialState && entry.beforeState) { newOptimist.push({ beforeState: currentState, action: entry.action }); } else { newOptimist.push(entry); } } if (gotInitialState) { currentState = fn(currentState, entry.action); validateState(innerState, action); } } }); if (!gotInitialState) { console.error('Cannot revert transaction with id "' + action.optimist.id + '" because it does not exist'); } optimist = newOptimist; return baseReducer(optimist, currentState, action); } function baseReducer(optimist, innerState, action) { if (optimist.length) { optimist = optimist.concat([{ action: action }]); } innerState = fn(innerState, action); validateState(innerState, action); return _extends({ optimist: optimist }, innerState); } return function (state, action) { if (action.optimist) { switch (action.optimist.type) { case BEGIN: return beginReducer(state, action); case COMMIT: return commitReducer(state, action); case REVERT: return revertReducer(state, action); } } var _separateState4 = separateState(state); var optimist = _separateState4.optimist; var innerState = _separateState4.innerState; if (state && !optimist.length) { var nextState = fn(innerState, action); if (nextState === innerState) { return state; } validateState(nextState, action); return _extends({ optimist: optimist }, nextState); } return baseReducer(optimist, innerState, action); }; } function matchesTransaction(action, id) { return action.optimist && action.optimist.id === id; } function validateState(newState, action) { if (!newState || typeof newState !== 'object' || Array.isArray(newState)) { throw new TypeError('Error while handling "' + action.type + '": Optimist requires that state is always a plain object.'); } } function separateState(state) { if (!state) { return { optimist: INITIAL_OPTIMIST, innerState: state }; } else { var _state$optimist = state.optimist; var _optimist = _state$optimist === undefined ? INITIAL_OPTIMIST : _state$optimist; var innerState = _objectWithoutProperties(state, ['optimist']); return { optimist: _optimist, innerState: innerState }; } } /***/ }), /* 271 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (this && this.__assign) || Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; }; exports.__esModule = true; var React = __webpack_require__(26); var PropTypes = __webpack_require__(29); var autosize = __webpack_require__(272); var _getLineHeight = __webpack_require__(273); var getLineHeight = _getLineHeight; var UPDATE = 'autosize:update'; var DESTROY = 'autosize:destroy'; var RESIZED = 'autosize:resized'; /** * A light replacement for built-in textarea component * which automaticaly adjusts its height to match the content */ var TextareaAutosize = /** @class */ (function (_super) { __extends(TextareaAutosize, _super); function TextareaAutosize() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.state = { lineHeight: null }; _this.dispatchEvent = function (EVENT_TYPE) { var event = document.createEvent('Event'); event.initEvent(EVENT_TYPE, true, false); _this.textarea.dispatchEvent(event); }; _this.updateLineHeight = function () { _this.setState({ lineHeight: getLineHeight(_this.textarea) }); }; _this.onChange = function (e) { var onChange = _this.props.onChange; _this.currentValue = e.currentTarget.value; onChange && onChange(e); }; _this.saveDOMNodeRef = function (ref) { var innerRef = _this.props.innerRef; if (innerRef) { innerRef(ref); } _this.textarea = ref; }; _this.getLocals = function () { var _a = _this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef"]), lineHeight = _a.state.lineHeight, saveDOMNodeRef = _a.saveDOMNodeRef; var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null; return __assign({}, props, { saveDOMNodeRef: saveDOMNodeRef, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, onChange: _this.onChange }); }; return _this; } TextareaAutosize.prototype.componentDidMount = function () { var _this = this; var _a = this.props, onResize = _a.onResize, maxRows = _a.maxRows; if (typeof maxRows === 'number') { this.updateLineHeight(); } /* the defer is needed to: - force "autosize" to activate the scrollbar when this.props.maxRows is passed - support StyledComponents (see #71) */ setTimeout(function () { return autosize(_this.textarea); }); if (onResize) { this.textarea.addEventListener(RESIZED, onResize); } }; TextareaAutosize.prototype.componentWillUnmount = function () { var onResize = this.props.onResize; if (onResize) { this.textarea.removeEventListener(RESIZED, onResize); } this.dispatchEvent(DESTROY); }; TextareaAutosize.prototype.render = function () { var _a = this.getLocals(), children = _a.children, saveDOMNodeRef = _a.saveDOMNodeRef, locals = __rest(_a, ["children", "saveDOMNodeRef"]); return (React.createElement("textarea", __assign({}, locals, { ref: saveDOMNodeRef }), children)); }; TextareaAutosize.prototype.componentDidUpdate = function (prevProps) { if (this.props.value !== this.currentValue || this.props.rows !== prevProps.rows) { this.dispatchEvent(UPDATE); } }; TextareaAutosize.defaultProps = { rows: 1 }; TextareaAutosize.propTypes = { rows: PropTypes.number, maxRows: PropTypes.number, onResize: PropTypes.func, innerRef: PropTypes.func }; return TextareaAutosize; }(React.Component)); exports["default"] = TextareaAutosize; /***/ }), /* 272 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! autosize 4.0.2 license: MIT http://www.jacklmoore.com/autosize */ (function (global, factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else { var mod; } })(this, function (module, exports) { 'use strict'; var map = typeof Map === "function" ? new Map() : function () { var keys = []; var values = []; return { has: function has(key) { return keys.indexOf(key) > -1; }, get: function get(key) { return values[keys.indexOf(key)]; }, set: function set(key, value) { if (keys.indexOf(key) === -1) { keys.push(key); values.push(value); } }, delete: function _delete(key) { var index = keys.indexOf(key); if (index > -1) { keys.splice(index, 1); values.splice(index, 1); } } }; }(); var createEvent = function createEvent(name) { return new Event(name, { bubbles: true }); }; try { new Event('test'); } catch (e) { // IE does not support `new Event()` createEvent = function createEvent(name) { var evt = document.createEvent('Event'); evt.initEvent(name, true, false); return evt; }; } function assign(ta) { if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return; var heightOffset = null; var clientWidth = null; var cachedHeight = null; function init() { var style = window.getComputedStyle(ta, null); if (style.resize === 'vertical') { ta.style.resize = 'none'; } else if (style.resize === 'both') { ta.style.resize = 'horizontal'; } if (style.boxSizing === 'content-box') { heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom)); } else { heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); } // Fix when a textarea is not on document body and heightOffset is Not a Number if (isNaN(heightOffset)) { heightOffset = 0; } update(); } function changeOverflow(value) { { // Chrome/Safari-specific fix: // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space // made available by removing the scrollbar. The following forces the necessary text reflow. var width = ta.style.width; ta.style.width = '0px'; // Force reflow: /* jshint ignore:start */ ta.offsetWidth; /* jshint ignore:end */ ta.style.width = width; } ta.style.overflowY = value; } function getParentOverflows(el) { var arr = []; while (el && el.parentNode && el.parentNode instanceof Element) { if (el.parentNode.scrollTop) { arr.push({ node: el.parentNode, scrollTop: el.parentNode.scrollTop }); } el = el.parentNode; } return arr; } function resize() { if (ta.scrollHeight === 0) { // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM. return; } var overflows = getParentOverflows(ta); var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240) ta.style.height = ''; ta.style.height = ta.scrollHeight + heightOffset + 'px'; // used to check if an update is actually necessary on window.resize clientWidth = ta.clientWidth; // prevents scroll-position jumping overflows.forEach(function (el) { el.node.scrollTop = el.scrollTop; }); if (docTop) { document.documentElement.scrollTop = docTop; } } function update() { resize(); var styleHeight = Math.round(parseFloat(ta.style.height)); var computed = window.getComputedStyle(ta, null); // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight; // The actual height not matching the style height (set via the resize method) indicates that // the max-height has been exceeded, in which case the overflow should be allowed. if (actualHeight < styleHeight) { if (computed.overflowY === 'hidden') { changeOverflow('scroll'); resize(); actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; } } else { // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands. if (computed.overflowY !== 'hidden') { changeOverflow('hidden'); resize(); actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; } } if (cachedHeight !== actualHeight) { cachedHeight = actualHeight; var evt = createEvent('autosize:resized'); try { ta.dispatchEvent(evt); } catch (err) { // Firefox will throw an error on dispatchEvent for a detached element // https://bugzilla.mozilla.org/show_bug.cgi?id=889376 } } } var pageResize = function pageResize() { if (ta.clientWidth !== clientWidth) { update(); } }; var destroy = function (style) { window.removeEventListener('resize', pageResize, false); ta.removeEventListener('input', update, false); ta.removeEventListener('keyup', update, false); ta.removeEventListener('autosize:destroy', destroy, false); ta.removeEventListener('autosize:update', update, false); Object.keys(style).forEach(function (key) { ta.style[key] = style[key]; }); map.delete(ta); }.bind(ta, { height: ta.style.height, resize: ta.style.resize, overflowY: ta.style.overflowY, overflowX: ta.style.overflowX, wordWrap: ta.style.wordWrap }); ta.addEventListener('autosize:destroy', destroy, false); // IE9 does not fire onpropertychange or oninput for deletions, // so binding to onkeyup to catch most of those events. // There is no way that I know of to detect something like 'cut' in IE9. if ('onpropertychange' in ta && 'oninput' in ta) { ta.addEventListener('keyup', update, false); } window.addEventListener('resize', pageResize, false); ta.addEventListener('input', update, false); ta.addEventListener('autosize:update', update, false); ta.style.overflowX = 'hidden'; ta.style.wordWrap = 'break-word'; map.set(ta, { destroy: destroy, update: update }); init(); } function destroy(ta) { var methods = map.get(ta); if (methods) { methods.destroy(); } } function update(ta) { var methods = map.get(ta); if (methods) { methods.update(); } } var autosize = null; // Do nothing in Node.js environment and IE8 (or lower) if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') { autosize = function autosize(el) { return el; }; autosize.destroy = function (el) { return el; }; autosize.update = function (el) { return el; }; } else { autosize = function autosize(el, options) { if (el) { Array.prototype.forEach.call(el.length ? el : [el], function (x) { return assign(x, options); }); } return el; }; autosize.destroy = function (el) { if (el) { Array.prototype.forEach.call(el.length ? el : [el], destroy); } return el; }; autosize.update = function (el) { if (el) { Array.prototype.forEach.call(el.length ? el : [el], update); } return el; }; } exports.default = autosize; module.exports = exports['default']; }); /***/ }), /* 273 */ /***/ (function(module, exports, __webpack_require__) { // Load in dependencies var computedStyle = __webpack_require__(274); /** * Calculate the `line-height` of a given node * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM. * @returns {Number} `line-height` of the element in pixels */ function lineHeight(node) { // Grab the line-height via style var lnHeightStr = computedStyle(node, 'line-height'); var lnHeight = parseFloat(lnHeightStr, 10); // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em') if (lnHeightStr === lnHeight + '') { // Save the old lineHeight style and update the em unit to the element var _lnHeightStyle = node.style.lineHeight; node.style.lineHeight = lnHeightStr + 'em'; // Calculate the em based height lnHeightStr = computedStyle(node, 'line-height'); lnHeight = parseFloat(lnHeightStr, 10); // Revert the lineHeight style if (_lnHeightStyle) { node.style.lineHeight = _lnHeightStyle; } else { delete node.style.lineHeight; } } // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt) // DEV: `em` units are converted to `pt` in IE6 // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length if (lnHeightStr.indexOf('pt') !== -1) { lnHeight *= 4; lnHeight /= 3; // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm) } else if (lnHeightStr.indexOf('mm') !== -1) { lnHeight *= 96; lnHeight /= 25.4; // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm) } else if (lnHeightStr.indexOf('cm') !== -1) { lnHeight *= 96; lnHeight /= 2.54; // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in) } else if (lnHeightStr.indexOf('in') !== -1) { lnHeight *= 96; // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc) } else if (lnHeightStr.indexOf('pc') !== -1) { lnHeight *= 16; } // Continue our computation lnHeight = Math.round(lnHeight); // If the line-height is "normal", calculate by font-size if (lnHeightStr === 'normal') { // Create a temporary node var nodeName = node.nodeName; var _node = document.createElement(nodeName); _node.innerHTML = ' '; // If we have a text area, reset it to only 1 row // https://github.com/twolfson/line-height/issues/4 if (nodeName.toUpperCase() === 'TEXTAREA') { _node.setAttribute('rows', '1'); } // Set the font-size of the element var fontSizeStr = computedStyle(node, 'font-size'); _node.style.fontSize = fontSizeStr; // Remove default padding/border which can affect offset height // https://github.com/twolfson/line-height/issues/4 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight _node.style.padding = '0px'; _node.style.border = '0px'; // Append it to the body var body = document.body; body.appendChild(_node); // Assume the line height of the element is the height var height = _node.offsetHeight; lnHeight = height; // Remove our child from the DOM body.removeChild(_node); } // Return the calculated height return lnHeight; } // Export lineHeight module.exports = lineHeight; /***/ }), /* 274 */ /***/ (function(module, exports) { // This code has been refactored for 140 bytes // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js var computedStyle = function (el, prop, getComputedStyle) { getComputedStyle = window.getComputedStyle; // In one fell swoop return ( // If we have getComputedStyle getComputedStyle ? // Query it // TODO: From CSS-Query notes, we might need (node, null) for FF getComputedStyle(el) : // Otherwise, we are in IE and use currentStyle el.currentStyle )[ // Switch to camelCase for CSSOM // DEV: Grabbed from jQuery // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194 // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597 prop.replace(/-(\w)/gi, function (word, letter) { return letter.toUpperCase(); }) ]; }; module.exports = computedStyle; /***/ }), /* 275 */, /* 276 */, /* 277 */, /* 278 */, /* 279 */, /* 280 */, /* 281 */, /* 282 */, /* 283 */, /* 284 */, /* 285 */, /* 286 */, /* 287 */, /* 288 */, /* 289 */, /* 290 */, /* 291 */, /* 292 */, /* 293 */, /* 294 */, /* 295 */, /* 296 */, /* 297 */, /* 298 */, /* 299 */, /* 300 */, /* 301 */, /* 302 */, /* 303 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, "setupEditor", function() { return setupEditor; }); __webpack_require__.d(actions_namespaceObject, "resetPost", function() { return resetPost; }); __webpack_require__.d(actions_namespaceObject, "resetAutosave", function() { return resetAutosave; }); __webpack_require__.d(actions_namespaceObject, "updatePost", function() { return updatePost; }); __webpack_require__.d(actions_namespaceObject, "setupEditorState", function() { return setupEditorState; }); __webpack_require__.d(actions_namespaceObject, "resetBlocks", function() { return actions_resetBlocks; }); __webpack_require__.d(actions_namespaceObject, "receiveBlocks", function() { return receiveBlocks; }); __webpack_require__.d(actions_namespaceObject, "updateBlockAttributes", function() { return updateBlockAttributes; }); __webpack_require__.d(actions_namespaceObject, "updateBlock", function() { return updateBlock; }); __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 actions_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 actions_replaceBlocks; }); __webpack_require__.d(actions_namespaceObject, "replaceBlock", function() { return replaceBlock; }); __webpack_require__.d(actions_namespaceObject, "moveBlocksDown", function() { return actions_moveBlocksDown; }); __webpack_require__.d(actions_namespaceObject, "moveBlocksUp", function() { return actions_moveBlocksUp; }); __webpack_require__.d(actions_namespaceObject, "moveBlockToPosition", function() { return moveBlockToPosition; }); __webpack_require__.d(actions_namespaceObject, "insertBlock", function() { return actions_insertBlock; }); __webpack_require__.d(actions_namespaceObject, "insertBlocks", function() { return actions_insertBlocks; }); __webpack_require__.d(actions_namespaceObject, "showInsertionPoint", function() { return actions_showInsertionPoint; }); __webpack_require__.d(actions_namespaceObject, "hideInsertionPoint", function() { return actions_hideInsertionPoint; }); __webpack_require__.d(actions_namespaceObject, "setTemplateValidity", function() { return setTemplateValidity; }); __webpack_require__.d(actions_namespaceObject, "synchronizeTemplate", function() { return synchronizeTemplate; }); __webpack_require__.d(actions_namespaceObject, "editPost", function() { return actions_editPost; }); __webpack_require__.d(actions_namespaceObject, "savePost", function() { return savePost; }); __webpack_require__.d(actions_namespaceObject, "refreshPost", function() { return refreshPost; }); __webpack_require__.d(actions_namespaceObject, "trashPost", function() { return trashPost; }); __webpack_require__.d(actions_namespaceObject, "mergeBlocks", function() { return mergeBlocks; }); __webpack_require__.d(actions_namespaceObject, "autosave", function() { return actions_autosave; }); __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, "removeBlocks", function() { return actions_removeBlocks; }); __webpack_require__.d(actions_namespaceObject, "removeBlock", function() { return removeBlock; }); __webpack_require__.d(actions_namespaceObject, "toggleBlockMode", function() { return toggleBlockMode; }); __webpack_require__.d(actions_namespaceObject, "startTyping", function() { return startTyping; }); __webpack_require__.d(actions_namespaceObject, "stopTyping", function() { return stopTyping; }); __webpack_require__.d(actions_namespaceObject, "enterFormattedText", function() { return enterFormattedText; }); __webpack_require__.d(actions_namespaceObject, "exitFormattedText", function() { return exitFormattedText; }); __webpack_require__.d(actions_namespaceObject, "updatePostLock", function() { return updatePostLock; }); __webpack_require__.d(actions_namespaceObject, "__experimentalFetchReusableBlocks", function() { return __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, "__experimentalConvertBlockToStatic", function() { return __experimentalConvertBlockToStatic; }); __webpack_require__.d(actions_namespaceObject, "__experimentalConvertBlockToReusable", function() { return __experimentalConvertBlockToReusable; }); __webpack_require__.d(actions_namespaceObject, "insertDefaultBlock", function() { return actions_insertDefaultBlock; }); __webpack_require__.d(actions_namespaceObject, "updateBlockListSettings", function() { return actions_updateBlockListSettings; }); __webpack_require__.d(actions_namespaceObject, "updateEditorSettings", function() { return updateEditorSettings; }); __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; }); var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, "POST_UPDATE_TRANSACTION_ID", function() { return POST_UPDATE_TRANSACTION_ID; }); __webpack_require__.d(selectors_namespaceObject, "INSERTER_UTILITY_HIGH", function() { return INSERTER_UTILITY_HIGH; }); __webpack_require__.d(selectors_namespaceObject, "INSERTER_UTILITY_MEDIUM", function() { return INSERTER_UTILITY_MEDIUM; }); __webpack_require__.d(selectors_namespaceObject, "INSERTER_UTILITY_LOW", function() { return INSERTER_UTILITY_LOW; }); __webpack_require__.d(selectors_namespaceObject, "INSERTER_UTILITY_NONE", function() { return INSERTER_UTILITY_NONE; }); __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, "hasChangedContent", function() { return hasChangedContent; }); __webpack_require__.d(selectors_namespaceObject, "isEditedPostDirty", function() { return selectors_isEditedPostDirty; }); __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, "getReferenceByDistinctEdits", function() { return getReferenceByDistinctEdits; }); __webpack_require__.d(selectors_namespaceObject, "getCurrentPostAttribute", function() { return selectors_getCurrentPostAttribute; }); __webpack_require__.d(selectors_namespaceObject, "getEditedPostAttribute", function() { return selectors_getEditedPostAttribute; }); __webpack_require__.d(selectors_namespaceObject, "getAutosaveAttribute", function() { return getAutosaveAttribute; }); __webpack_require__.d(selectors_namespaceObject, "getEditedPostVisibility", function() { return selectors_getEditedPostVisibility; }); __webpack_require__.d(selectors_namespaceObject, "isCurrentPostPending", function() { return isCurrentPostPending; }); __webpack_require__.d(selectors_namespaceObject, "isCurrentPostPublished", function() { return selectors_isCurrentPostPublished; }); __webpack_require__.d(selectors_namespaceObject, "isCurrentPostScheduled", function() { return selectors_isCurrentPostScheduled; }); __webpack_require__.d(selectors_namespaceObject, "isEditedPostPublishable", function() { return selectors_isEditedPostPublishable; }); __webpack_require__.d(selectors_namespaceObject, "isEditedPostSaveable", function() { return selectors_isEditedPostSaveable; }); __webpack_require__.d(selectors_namespaceObject, "isEditedPostEmpty", function() { return isEditedPostEmpty; }); __webpack_require__.d(selectors_namespaceObject, "isEditedPostAutosaveable", function() { return selectors_isEditedPostAutosaveable; }); __webpack_require__.d(selectors_namespaceObject, "getAutosave", function() { return getAutosave; }); __webpack_require__.d(selectors_namespaceObject, "hasAutosave", function() { return hasAutosave; }); __webpack_require__.d(selectors_namespaceObject, "isEditedPostBeingScheduled", function() { return selectors_isEditedPostBeingScheduled; }); __webpack_require__.d(selectors_namespaceObject, "isEditedPostDateFloating", function() { return isEditedPostDateFloating; }); __webpack_require__.d(selectors_namespaceObject, "getBlockDependantsCacheBust", function() { return getBlockDependantsCacheBust; }); __webpack_require__.d(selectors_namespaceObject, "getBlockName", function() { return selectors_getBlockName; }); __webpack_require__.d(selectors_namespaceObject, "isBlockValid", function() { return selectors_isBlockValid; }); __webpack_require__.d(selectors_namespaceObject, "getBlockAttributes", function() { return getBlockAttributes; }); __webpack_require__.d(selectors_namespaceObject, "getBlock", function() { return selectors_getBlock; }); __webpack_require__.d(selectors_namespaceObject, "__unstableGetBlockWithoutInnerBlocks", function() { return selectors_unstableGetBlockWithoutInnerBlocks; }); __webpack_require__.d(selectors_namespaceObject, "getBlocks", function() { return selectors_getBlocks; }); __webpack_require__.d(selectors_namespaceObject, "getClientIdsOfDescendants", function() { return selectors_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 selectors_getBlocksByClientId; }); __webpack_require__.d(selectors_namespaceObject, "getBlockCount", function() { return selectors_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 selectors_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, "getSelectedBlock", function() { return getSelectedBlock; }); __webpack_require__.d(selectors_namespaceObject, "getBlockRootClientId", function() { return selectors_getBlockRootClientId; }); __webpack_require__.d(selectors_namespaceObject, "getBlockHierarchyRootClientId", function() { return getBlockHierarchyRootClientId; }); __webpack_require__.d(selectors_namespaceObject, "getAdjacentBlockClientId", function() { return getAdjacentBlockClientId; }); __webpack_require__.d(selectors_namespaceObject, "getPreviousBlockClientId", function() { return getPreviousBlockClientId; }); __webpack_require__.d(selectors_namespaceObject, "getNextBlockClientId", function() { return getNextBlockClientId; }); __webpack_require__.d(selectors_namespaceObject, "getSelectedBlocksInitialCaretPosition", function() { return selectors_getSelectedBlocksInitialCaretPosition; }); __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlockClientIds", function() { return selectors_getMultiSelectedBlockClientIds; }); __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocks", function() { return getMultiSelectedBlocks; }); __webpack_require__.d(selectors_namespaceObject, "getFirstMultiSelectedBlockClientId", function() { return getFirstMultiSelectedBlockClientId; }); __webpack_require__.d(selectors_namespaceObject, "getLastMultiSelectedBlockClientId", function() { return getLastMultiSelectedBlockClientId; }); __webpack_require__.d(selectors_namespaceObject, "isFirstMultiSelectedBlock", function() { return selectors_isFirstMultiSelectedBlock; }); __webpack_require__.d(selectors_namespaceObject, "isBlockMultiSelected", function() { return selectors_isBlockMultiSelected; }); __webpack_require__.d(selectors_namespaceObject, "isAncestorMultiSelected", function() { return selectors_isAncestorMultiSelected; }); __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocksStartClientId", function() { return getMultiSelectedBlocksStartClientId; }); __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocksEndClientId", function() { return getMultiSelectedBlocksEndClientId; }); __webpack_require__.d(selectors_namespaceObject, "getBlockOrder", function() { return selectors_getBlockOrder; }); __webpack_require__.d(selectors_namespaceObject, "getBlockIndex", function() { return selectors_getBlockIndex; }); __webpack_require__.d(selectors_namespaceObject, "isBlockSelected", function() { return selectors_isBlockSelected; }); __webpack_require__.d(selectors_namespaceObject, "hasSelectedInnerBlock", function() { return selectors_hasSelectedInnerBlock; }); __webpack_require__.d(selectors_namespaceObject, "isBlockWithinSelection", function() { return isBlockWithinSelection; }); __webpack_require__.d(selectors_namespaceObject, "hasMultiSelection", function() { return selectors_hasMultiSelection; }); __webpack_require__.d(selectors_namespaceObject, "isMultiSelecting", function() { return selectors_isMultiSelecting; }); __webpack_require__.d(selectors_namespaceObject, "isSelectionEnabled", function() { return selectors_isSelectionEnabled; }); __webpack_require__.d(selectors_namespaceObject, "getBlockMode", function() { return selectors_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, "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 selectors_getTemplateLock; }); __webpack_require__.d(selectors_namespaceObject, "isSavingPost", function() { return selectors_isSavingPost; }); __webpack_require__.d(selectors_namespaceObject, "didPostSaveRequestSucceed", function() { return didPostSaveRequestSucceed; }); __webpack_require__.d(selectors_namespaceObject, "didPostSaveRequestFail", function() { return didPostSaveRequestFail; }); __webpack_require__.d(selectors_namespaceObject, "isAutosavingPost", function() { return selectors_isAutosavingPost; }); __webpack_require__.d(selectors_namespaceObject, "isPreviewingPost", function() { return isPreviewingPost; }); __webpack_require__.d(selectors_namespaceObject, "getEditedPostPreviewLink", function() { return selectors_getEditedPostPreviewLink; }); __webpack_require__.d(selectors_namespaceObject, "getSuggestedPostFormat", function() { return selectors_getSuggestedPostFormat; }); __webpack_require__.d(selectors_namespaceObject, "getBlocksForSerialization", function() { return getBlocksForSerialization; }); __webpack_require__.d(selectors_namespaceObject, "getEditedPostContent", function() { return getEditedPostContent; }); __webpack_require__.d(selectors_namespaceObject, "canInsertBlockType", function() { return selectors_canInsertBlockType; }); __webpack_require__.d(selectors_namespaceObject, "getInserterItems", function() { return selectors_getInserterItems; }); __webpack_require__.d(selectors_namespaceObject, "hasInserterItems", function() { return hasInserterItems; }); __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, "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, "getPermalink", function() { return getPermalink; }); __webpack_require__.d(selectors_namespaceObject, "getPermalinkParts", function() { return selectors_getPermalinkParts; }); __webpack_require__.d(selectors_namespaceObject, "inSomeHistory", function() { return inSomeHistory; }); __webpack_require__.d(selectors_namespaceObject, "getBlockListSettings", function() { return getBlockListSettings; }); __webpack_require__.d(selectors_namespaceObject, "getEditorSettings", function() { return selectors_getEditorSettings; }); __webpack_require__.d(selectors_namespaceObject, "getTokenSettings", function() { return getTokenSettings; }); __webpack_require__.d(selectors_namespaceObject, "isPostLocked", function() { return isPostLocked; }); __webpack_require__.d(selectors_namespaceObject, "isPostSavingLocked", function() { return selectors_isPostSavingLocked; }); __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, "isPublishSidebarEnabled", function() { return selectors_isPublishSidebarEnabled; }); // EXTERNAL MODULE: external {"this":["wp","blocks"]} var external_this_wp_blocks_ = __webpack_require__(11); // EXTERNAL MODULE: external {"this":["wp","coreData"]} var external_this_wp_coreData_ = __webpack_require__(79); // EXTERNAL MODULE: external {"this":["wp","notices"]} var external_this_wp_notices_ = __webpack_require__(121); // EXTERNAL MODULE: external {"this":["wp","nux"]} var external_this_wp_nux_ = __webpack_require__(52); // EXTERNAL MODULE: external {"this":["wp","richText"]} var external_this_wp_richText_ = __webpack_require__(20); // EXTERNAL MODULE: external {"this":["wp","viewport"]} var external_this_wp_viewport_ = __webpack_require__(37); // 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__(25); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js var objectSpread = __webpack_require__(8); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js + 1 modules var objectWithoutProperties = __webpack_require__(21); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules var toConsumableArray = __webpack_require__(19); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js var defineProperty = __webpack_require__(15); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js var esm_typeof = __webpack_require__(28); // EXTERNAL MODULE: ./node_modules/redux-optimist/index.js var redux_optimist = __webpack_require__(53); 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__(24); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/with-history/index.js /** * 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: Object(toConsumableArray["a" /* default */])(past).concat([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 = Object(toConsumableArray["a" /* default */])(past).concat([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/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: external {"this":["wp","i18n"]} var external_this_wp_i18n_ = __webpack_require__(1); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/defaults.js /** * WordPress dependencies */ var PREFERENCES_DEFAULTS = { insertUsage: {}, isPublishSidebarEnabled: true }; /** * The default editor settings * * alignWide boolean Enable/Disable Wide/Full Alignments * colors Array Palette colors * fontSizes Array Available font sizes * imageSizes Array Available image sizes * maxWidth number Max width to constraint resizing * blockTypes boolean|Array Allowed block types * hasFixedToolbar boolean Whether or not the editor toolbar is fixed * focusMode boolean Whether the focus mode is enabled or not * richEditingEnabled boolean Whether rich editing is enabled or not */ var EDITOR_SETTINGS_DEFAULTS = { alignWide: false, colors: [{ name: Object(external_this_wp_i18n_["__"])('Pale pink'), slug: 'pale-pink', color: '#f78da7' }, { name: Object(external_this_wp_i18n_["__"])('Vivid red'), slug: 'vivid-red', color: '#cf2e2e' }, { name: Object(external_this_wp_i18n_["__"])('Luminous vivid orange'), slug: 'luminous-vivid-orange', color: '#ff6900' }, { name: Object(external_this_wp_i18n_["__"])('Luminous vivid amber'), slug: 'luminous-vivid-amber', color: '#fcb900' }, { name: Object(external_this_wp_i18n_["__"])('Light green cyan'), slug: 'light-green-cyan', color: '#7bdcb5' }, { name: Object(external_this_wp_i18n_["__"])('Vivid green cyan'), slug: 'vivid-green-cyan', color: '#00d084' }, { name: Object(external_this_wp_i18n_["__"])('Pale cyan blue'), slug: 'pale-cyan-blue', color: '#8ed1fc' }, { name: Object(external_this_wp_i18n_["__"])('Vivid cyan blue'), slug: 'vivid-cyan-blue', color: '#0693e3' }, { name: Object(external_this_wp_i18n_["__"])('Very light gray'), slug: 'very-light-gray', color: '#eeeeee' }, { name: Object(external_this_wp_i18n_["__"])('Cyan bluish gray'), slug: 'cyan-bluish-gray', color: '#abb8c3' }, { name: Object(external_this_wp_i18n_["__"])('Very dark gray'), slug: 'very-dark-gray', color: '#313131' }], fontSizes: [{ name: Object(external_this_wp_i18n_["_x"])('Small', 'font size name'), size: 13, slug: 'small' }, { name: Object(external_this_wp_i18n_["_x"])('Normal', 'font size name'), size: 16, slug: 'normal' }, { name: Object(external_this_wp_i18n_["_x"])('Medium', 'font size name'), size: 20, slug: 'medium' }, { name: Object(external_this_wp_i18n_["_x"])('Large', 'font size name'), size: 36, slug: 'large' }, { name: Object(external_this_wp_i18n_["_x"])('Huge', 'font size name'), size: 48, slug: 'huge' }], imageSizes: [{ slug: 'thumbnail', label: Object(external_this_wp_i18n_["__"])('Thumbnail') }, { slug: 'medium', label: Object(external_this_wp_i18n_["__"])('Medium') }, { slug: 'large', label: Object(external_this_wp_i18n_["__"])('Large') }, { slug: 'full', label: Object(external_this_wp_i18n_["__"])('Full Size') }], // This is current max width of the block inner area // It's used to constraint image resizing and this value could be overridden later by themes maxWidth: 580, // Allowed block types for the editor, defaulting to true (all supported). allowedBlockTypes: true, // Maximum upload size in bytes allowed for the site. maxUploadFileSize: 0, // List of allowed mime types and file extensions. allowedMimeTypes: null, // Whether richs editing is enabled or not. richEditingEnabled: true }; /** * Default initial edits state. * * @type {Object} */ var INITIAL_EDITS_DEFAULTS = {}; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/array.js /** * External dependencies */ /** * Insert one or multiple elements into a given position of an array. * * @param {Array} array Source array. * @param {*} elements Elements to insert. * @param {number} index Insert Position. * * @return {Array} Result. */ function insertAt(array, elements, index) { return Object(toConsumableArray["a" /* default */])(array.slice(0, index)).concat(Object(toConsumableArray["a" /* default */])(Object(external_lodash_["castArray"])(elements)), Object(toConsumableArray["a" /* default */])(array.slice(index))); } /** * Moves an element in an array. * * @param {Array} array Source array. * @param {number} from Source index. * @param {number} to Destination index. * @param {number} count Number of elements to move. * * @return {Array} Result. */ function moveTo(array, from, to) { var count = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1; var withoutMovedElements = Object(toConsumableArray["a" /* default */])(array); withoutMovedElements.splice(from, count); return insertAt(withoutMovedElements, array.slice(from, from + count), to); } // 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']); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/reducer.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns a post attribute value, flattening nested rendered content using its * raw value in place of its original object form. * * @param {*} value Original value. * * @return {*} Raw value. */ function getPostRawValue(value) { if (value && 'object' === Object(esm_typeof["a" /* default */])(value) && 'raw' in value) { return value.raw; } return value; } /** * Given an array of blocks, returns an object where each key is a nesting * context, the value of which is an array of block client IDs existing within * that nesting context. * * @param {Array} blocks Blocks to map. * @param {?string} rootClientId Assumed root client ID. * * @return {Object} Block order map object. */ function mapBlockOrder(blocks) { var rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; var result = Object(defineProperty["a" /* default */])({}, rootClientId, []); blocks.forEach(function (block) { var clientId = block.clientId, innerBlocks = block.innerBlocks; result[rootClientId].push(clientId); Object.assign(result, mapBlockOrder(innerBlocks, clientId)); }); return result; } /** * Helper method to iterate through all blocks, recursing into inner blocks, * applying a transformation function to each one. * Returns a flattened object with the transformed blocks. * * @param {Array} blocks Blocks to flatten. * @param {Function} transform Transforming function to be applied to each block. * * @return {Object} Flattened object. */ function flattenBlocks(blocks, transform) { var result = {}; var stack = Object(toConsumableArray["a" /* default */])(blocks); while (stack.length) { var _stack$shift = stack.shift(), innerBlocks = _stack$shift.innerBlocks, block = Object(objectWithoutProperties["a" /* default */])(_stack$shift, ["innerBlocks"]); stack.push.apply(stack, Object(toConsumableArray["a" /* default */])(innerBlocks)); result[block.clientId] = transform(block); } return result; } /** * Given an array of blocks, returns an object containing all blocks, without * attributes, recursing into inner blocks. Keys correspond to the block client * ID, the value of which is the attributes object. * * @param {Array} blocks Blocks to flatten. * * @return {Object} Flattened block attributes object. */ function getFlattenedBlocksWithoutAttributes(blocks) { return flattenBlocks(blocks, function (block) { return Object(external_lodash_["omit"])(block, 'attributes'); }); } /** * Given an array of blocks, returns an object containing all block attributes, * recursing into inner blocks. Keys correspond to the block client ID, the * value of which is the attributes object. * * @param {Array} blocks Blocks to flatten. * * @return {Object} Flattened block attributes object. */ function getFlattenedBlockAttributes(blocks) { return flattenBlocks(blocks, function (block) { return block.attributes; }); } /** * Given a block order map object, returns *all* of the block client IDs that are * a descendant of the given root client ID. * * Calling this with `rootClientId` set to `''` results in a list of client IDs * that are in the post. That is, it excludes blocks like fetched reusable * blocks which are stored into state but not visible. * * @param {Object} blocksOrder Object that maps block client IDs to a list of * nested block client IDs. * @param {?string} rootClientId The root client ID to search. Defaults to ''. * * @return {Array} List of descendant client IDs. */ function getNestedBlockClientIds(blocksOrder) { var rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; return Object(external_lodash_["reduce"])(blocksOrder[rootClientId], function (result, clientId) { return Object(toConsumableArray["a" /* default */])(result).concat([clientId], Object(toConsumableArray["a" /* default */])(getNestedBlockClientIds(blocksOrder, clientId))); }, []); } /** * 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. * * @param {Object} a First object. * @param {Object} b Second object. * * @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)); } /** * Returns true if, given the currently dispatching action and the previously * dispatched action, the two actions are updating the same block attribute, or * false otherwise. * * @param {Object} action Currently dispatching action. * @param {Object} previousAction Previously dispatched action. * * @return {boolean} Whether actions are updating the same block attribute. */ function isUpdatingSameBlockAttribute(action, previousAction) { return action.type === 'UPDATE_BLOCK_ATTRIBUTES' && action.clientId === previousAction.clientId && hasSameKeys(action.attributes, previousAction.attributes); } /** * Returns true if, given the currently dispatching action and the previously * dispatched action, the two actions are editing the same post property, or * false otherwise. * * @param {Object} action Currently dispatching action. * @param {Object} previousAction Previously dispatched action. * * @return {boolean} Whether actions are updating the same post property. */ function isUpdatingSamePostProperty(action, previousAction) { return action.type === 'EDIT_POST' && hasSameKeys(action.edits, previousAction.edits); } /** * Returns true if, given the currently dispatching action and the previously * dispatched action, the two actions are modifying the same property such that * undo history should be batched. * * @param {Object} action Currently dispatching action. * @param {Object} previousAction Previously dispatched action. * * @return {boolean} Whether to overwrite present state. */ function reducer_shouldOverwriteState(action, previousAction) { if (!previousAction || action.type !== previousAction.type) { return false; } return Object(external_lodash_["overSome"])([isUpdatingSameBlockAttribute, isUpdatingSamePostProperty])(action, previousAction); } /** * Higher-order reducer targeting the combined editor reducer, augmenting * block client IDs in remove action to include cascade of inner blocks. * * @param {Function} reducer Original reducer function. * * @return {Function} Enhanced reducer function. */ var reducer_withInnerBlocksRemoveCascade = function withInnerBlocksRemoveCascade(reducer) { return function (state, action) { if (state && action.type === 'REMOVE_BLOCKS') { var clientIds = Object(toConsumableArray["a" /* default */])(action.clientIds); // For each removed client ID, include its inner blocks to remove, // recursing into those so long as inner blocks exist. for (var i = 0; i < clientIds.length; i++) { clientIds.push.apply(clientIds, Object(toConsumableArray["a" /* default */])(state.blocks.order[clientIds[i]])); } action = Object(objectSpread["a" /* default */])({}, action, { clientIds: clientIds }); } return reducer(state, action); }; }; /** * Higher-order reducer which targets the combined blocks reducer and handles * the `RESET_BLOCKS` action. When dispatched, this action will replace all * blocks that exist in the post, leaving blocks that exist only in state (e.g. * reusable blocks) alone. * * @param {Function} reducer Original reducer function. * * @return {Function} Enhanced reducer function. */ var reducer_withBlockReset = function withBlockReset(reducer) { return function (state, action) { if (state && action.type === 'RESET_BLOCKS') { var visibleClientIds = getNestedBlockClientIds(state.order); return Object(objectSpread["a" /* default */])({}, state, { byClientId: Object(objectSpread["a" /* default */])({}, Object(external_lodash_["omit"])(state.byClientId, visibleClientIds), getFlattenedBlocksWithoutAttributes(action.blocks)), attributes: Object(objectSpread["a" /* default */])({}, Object(external_lodash_["omit"])(state.attributes, visibleClientIds), getFlattenedBlockAttributes(action.blocks)), order: Object(objectSpread["a" /* default */])({}, Object(external_lodash_["omit"])(state.order, visibleClientIds), mapBlockOrder(action.blocks)) }); } return reducer(state, action); }; }; /** * Higher-order reducer which targets the combined blocks reducer and handles * the `SAVE_REUSABLE_BLOCK_SUCCESS` action. This action can't be handled by * regular reducers and needs a higher-order reducer since it needs access to * both `byClientId` and `attributes` simultaneously. * * @param {Function} reducer Original reducer function. * * @return {Function} Enhanced reducer function. */ var reducer_withSaveReusableBlock = function withSaveReusableBlock(reducer) { return function (state, action) { if (state && action.type === 'SAVE_REUSABLE_BLOCK_SUCCESS') { var id = action.id, updatedId = action.updatedId; // If a temporary reusable block is saved, we swap the temporary id with the final one if (id === updatedId) { return state; } state = Object(objectSpread["a" /* default */])({}, state); state.attributes = Object(external_lodash_["mapValues"])(state.attributes, function (attributes, clientId) { var name = state.byClientId[clientId].name; if (name === 'core/block' && attributes.ref === id) { return Object(objectSpread["a" /* default */])({}, attributes, { ref: updatedId }); } return attributes; }); } return reducer(state, action); }; }; /** * 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"], reducer_withInnerBlocksRemoveCascade, // Track undo history, starting at editor initialization. with_history({ resetTypes: ['SETUP_EDITOR_STATE'], ignoreTypes: ['RECEIVE_BLOCKS', 'RESET_POST', 'UPDATE_POST'], shouldOverwriteState: reducer_shouldOverwriteState })])({ 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 'RESET_BLOCKS': if ('content' in state) { return Object(external_lodash_["omit"])(state, 'content'); } return 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); } return state; }, blocks: Object(external_lodash_["flow"])([external_this_wp_data_["combineReducers"], reducer_withBlockReset, reducer_withSaveReusableBlock, // Track whether changes exist, resetting at each post save. Relies on // editor initialization firing post reset as an effect. with_change_detection({ resetTypes: ['SETUP_EDITOR_STATE', 'REQUEST_POST_UPDATE_START'], ignoreTypes: ['RECEIVE_BLOCKS', 'RESET_POST', 'UPDATE_POST'] })])({ byClientId: function byClientId() { var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var action = arguments.length > 1 ? arguments[1] : undefined; switch (action.type) { case 'SETUP_EDITOR_STATE': return getFlattenedBlocksWithoutAttributes(action.blocks); case 'RECEIVE_BLOCKS': return Object(objectSpread["a" /* default */])({}, state, getFlattenedBlocksWithoutAttributes(action.blocks)); case 'UPDATE_BLOCK': // Ignore updates if block isn't known if (!state[action.clientId]) { return state; } // Do nothing if only attributes change. var changes = Object(external_lodash_["omit"])(action.updates, 'attributes'); if (Object(external_lodash_["isEmpty"])(changes)) { return state; } return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, action.clientId, Object(objectSpread["a" /* default */])({}, state[action.clientId], changes))); case 'INSERT_BLOCKS': return Object(objectSpread["a" /* default */])({}, state, getFlattenedBlocksWithoutAttributes(action.blocks)); case 'REPLACE_BLOCKS': if (!action.blocks) { return state; } return Object(objectSpread["a" /* default */])({}, Object(external_lodash_["omit"])(state, action.clientIds), getFlattenedBlocksWithoutAttributes(action.blocks)); case 'REMOVE_BLOCKS': return Object(external_lodash_["omit"])(state, action.clientIds); } return state; }, attributes: function attributes() { var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var action = arguments.length > 1 ? arguments[1] : undefined; switch (action.type) { case 'SETUP_EDITOR_STATE': return getFlattenedBlockAttributes(action.blocks); case 'RECEIVE_BLOCKS': return Object(objectSpread["a" /* default */])({}, state, getFlattenedBlockAttributes(action.blocks)); case 'UPDATE_BLOCK': // Ignore updates if block isn't known or there are no attribute changes. if (!state[action.clientId] || !action.updates.attributes) { return state; } return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, action.clientId, Object(objectSpread["a" /* default */])({}, state[action.clientId], action.updates.attributes))); case 'UPDATE_BLOCK_ATTRIBUTES': // Ignore updates if block isn't known if (!state[action.clientId]) { return state; } // Consider as updates only changed values var nextAttributes = Object(external_lodash_["reduce"])(action.attributes, function (result, value, key) { if (value !== result[key]) { result = getMutateSafeObject(state[action.clientId], result); result[key] = value; } return result; }, state[action.clientId]); // Skip update if nothing has been changed. The reference will // match the original block if `reduce` had no changed values. if (nextAttributes === state[action.clientId]) { return state; } // Otherwise replace attributes in state return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, action.clientId, nextAttributes)); case 'INSERT_BLOCKS': return Object(objectSpread["a" /* default */])({}, state, getFlattenedBlockAttributes(action.blocks)); case 'REPLACE_BLOCKS': if (!action.blocks) { return state; } return Object(objectSpread["a" /* default */])({}, Object(external_lodash_["omit"])(state, action.clientIds), getFlattenedBlockAttributes(action.blocks)); case 'REMOVE_BLOCKS': return Object(external_lodash_["omit"])(state, action.clientIds); } return state; }, order: function order() { var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var action = arguments.length > 1 ? arguments[1] : undefined; switch (action.type) { case 'SETUP_EDITOR_STATE': return mapBlockOrder(action.blocks); case 'RECEIVE_BLOCKS': return Object(objectSpread["a" /* default */])({}, state, Object(external_lodash_["omit"])(mapBlockOrder(action.blocks), '')); case 'INSERT_BLOCKS': { var _action$rootClientId = action.rootClientId, rootClientId = _action$rootClientId === void 0 ? '' : _action$rootClientId, blocks = action.blocks; var subState = state[rootClientId] || []; var mappedBlocks = mapBlockOrder(blocks, rootClientId); var _action$index = action.index, index = _action$index === void 0 ? subState.length : _action$index; return Object(objectSpread["a" /* default */])({}, state, mappedBlocks, Object(defineProperty["a" /* default */])({}, rootClientId, insertAt(subState, mappedBlocks[rootClientId], index))); } case 'MOVE_BLOCK_TO_POSITION': { var _objectSpread7; var _action$fromRootClien = action.fromRootClientId, fromRootClientId = _action$fromRootClien === void 0 ? '' : _action$fromRootClien, _action$toRootClientI = action.toRootClientId, toRootClientId = _action$toRootClientI === void 0 ? '' : _action$toRootClientI, clientId = action.clientId; var _action$index2 = action.index, _index = _action$index2 === void 0 ? state[toRootClientId].length : _action$index2; // Moving inside the same parent block if (fromRootClientId === toRootClientId) { var _subState = state[toRootClientId]; var fromIndex = _subState.indexOf(clientId); return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, toRootClientId, moveTo(state[toRootClientId], fromIndex, _index))); } // Moving from a parent block to another return Object(objectSpread["a" /* default */])({}, state, (_objectSpread7 = {}, Object(defineProperty["a" /* default */])(_objectSpread7, fromRootClientId, Object(external_lodash_["without"])(state[fromRootClientId], clientId)), Object(defineProperty["a" /* default */])(_objectSpread7, toRootClientId, insertAt(state[toRootClientId], clientId, _index)), _objectSpread7)); } case 'MOVE_BLOCKS_UP': { var clientIds = action.clientIds, _action$rootClientId2 = action.rootClientId, _rootClientId = _action$rootClientId2 === void 0 ? '' : _action$rootClientId2; var firstClientId = Object(external_lodash_["first"])(clientIds); var _subState2 = state[_rootClientId]; if (!_subState2.length || firstClientId === Object(external_lodash_["first"])(_subState2)) { return state; } var firstIndex = _subState2.indexOf(firstClientId); return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, _rootClientId, moveTo(_subState2, firstIndex, firstIndex - 1, clientIds.length))); } case 'MOVE_BLOCKS_DOWN': { var _clientIds = action.clientIds, _action$rootClientId3 = action.rootClientId, _rootClientId2 = _action$rootClientId3 === void 0 ? '' : _action$rootClientId3; var _firstClientId = Object(external_lodash_["first"])(_clientIds); var lastClientId = Object(external_lodash_["last"])(_clientIds); var _subState3 = state[_rootClientId2]; if (!_subState3.length || lastClientId === Object(external_lodash_["last"])(_subState3)) { return state; } var _firstIndex = _subState3.indexOf(_firstClientId); return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, _rootClientId2, moveTo(_subState3, _firstIndex, _firstIndex + 1, _clientIds.length))); } case 'REPLACE_BLOCKS': { var _blocks = action.blocks, _clientIds2 = action.clientIds; if (!_blocks) { return state; } var _mappedBlocks = mapBlockOrder(_blocks); return Object(external_lodash_["flow"])([function (nextState) { return Object(external_lodash_["omit"])(nextState, _clientIds2); }, function (nextState) { return Object(objectSpread["a" /* default */])({}, nextState, Object(external_lodash_["omit"])(_mappedBlocks, '')); }, function (nextState) { return Object(external_lodash_["mapValues"])(nextState, function (subState) { return Object(external_lodash_["reduce"])(subState, function (result, clientId) { if (clientId === _clientIds2[0]) { return Object(toConsumableArray["a" /* default */])(result).concat(Object(toConsumableArray["a" /* default */])(_mappedBlocks[''])); } if (_clientIds2.indexOf(clientId) === -1) { result.push(clientId); } return result; }, []); }); }])(state); } case 'REMOVE_BLOCKS': return Object(external_lodash_["flow"])([// Remove inner block ordering for removed blocks function (nextState) { return Object(external_lodash_["omit"])(nextState, action.clientIds); }, // Remove deleted blocks from other blocks' orderings function (nextState) { return Object(external_lodash_["mapValues"])(nextState, function (subState) { return external_lodash_["without"].apply(void 0, [subState].concat(Object(toConsumableArray["a" /* default */])(action.clientIds))); }); }])(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 prmopting 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] : {}; 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 reducer_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 reducer_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 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 is replacement block(s), assign first's client ID as // the next selected block. If empty replacement, reset to null. var nextSelectedBlockClientId = Object(external_lodash_["get"])(action.blocks, [0, '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() { 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; } return state; } /** * Reducer returning whether the post blocks match the defined template or not. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {boolean} Updated state. */ function reducer_template() { var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { isValid: true }; var action = arguments.length > 1 ? arguments[1] : undefined; switch (action.type) { case 'SET_TEMPLATE_VALIDITY': return Object(objectSpread["a" /* default */])({}, state, { isValid: action.isValid }); } return state; } /** * Reducer returning the editor setting. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function reducer_settings() { var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : EDITOR_SETTINGS_DEFAULTS; var action = arguments.length > 1 ? arguments[1] : undefined; switch (action.type) { case 'UPDATE_EDITOR_SETTINGS': return Object(objectSpread["a" /* default */])({}, state, action.settings); } return state; } /** * Reducer returning the user preferences. * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {string} Updated state. */ function preferences() { var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : PREFERENCES_DEFAULTS; var action = arguments.length > 1 ? arguments[1] : undefined; switch (action.type) { case 'INSERT_BLOCKS': case 'REPLACE_BLOCKS': return action.blocks.reduce(function (prevState, block) { var id = block.name; var insert = { name: block.name }; if (Object(external_this_wp_blocks_["isReusableBlock"])(block)) { insert.ref = block.attributes.ref; id += '/' + block.attributes.ref; } return Object(objectSpread["a" /* default */])({}, prevState, { insertUsage: Object(objectSpread["a" /* default */])({}, prevState.insertUsage, Object(defineProperty["a" /* default */])({}, id, { time: action.time, count: prevState.insertUsage[id] ? prevState.insertUsage[id].count + 1 : 1, insert: insert })) }); }, state); case 'REMOVE_REUSABLE_BLOCK': return Object(objectSpread["a" /* default */])({}, state, { insertUsage: Object(external_lodash_["omitBy"])(state.insertUsage, function (_ref) { var insert = _ref.insert; return insert.ref === action.id; }) }); case 'ENABLE_PUBLISH_SIDEBAR': return Object(objectSpread["a" /* default */])({}, state, { isPublishSidebarEnabled: true }); case 'DISABLE_PUBLISH_SIDEBAR': return Object(objectSpread["a" /* default */])({}, state, { isPublishSidebarEnabled: false }); } return state; } /** * Reducer returning current network request state (whether a request to * the WP REST API is in progress, successful, or failed). * * @param {Object} state Current state. * @param {Object} action Dispatched action. * * @return {Object} Updated state. */ function saving() { var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var action = arguments.length > 1 ? arguments[1] : undefined; switch (action.type) { case 'REQUEST_POST_UPDATE_START': return { requesting: true, successful: false, error: null, options: action.options || {} }; case 'REQUEST_POST_UPDATE_SUCCESS': return { requesting: false, successful: true, error: null, options: action.options || {} }; case 'REQUEST_POST_UPDATE_FAILURE': return { requesting: false, successful: false, error: action.error, options: action.options || {} }; } return state; } /** * Post Lock State. * * @typedef {Object} PostLockState * * @property {boolean} isLocked Whether the post is locked. * @property {?boolean} isTakeover Whether the post editing has been taken over. * @property {?boolean} activePostLock Active post lock value. * @property {?Object} user User that took over the post. */ /** * Reducer returning the post lock status. * * @param {PostLockState} state Current state. * @param {Object} action Dispatched action. * * @return {PostLockState} Updated state. */ function postLock() { var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { isLocked: false }; var action = arguments.length > 1 ? arguments[1] : undefined; switch (action.type) { case 'UPDATE_POST_LOCK': return action.lock; } return state; } /** * Post saving lock. * * When post saving is locked, the post cannot be published or updated. * * @param {PostSavingLockState} state Current state. * @param {Object} action Dispatched action. * * @return {PostLockState} Updated state. */ function postSavingLock() { var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var action = arguments.length > 1 ? arguments[1] : undefined; switch (action.type) { case 'LOCK_POST_SAVING': return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, action.lockName, true)); case 'UNLOCK_POST_SAVING': return Object(external_lodash_["omit"])(state, action.lockName); } return state; } var reusableBlocks = Object(external_this_wp_data_["combineReducers"])({ data: function data() { var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var action = arguments.length > 1 ? arguments[1] : undefined; 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); } case 'UPDATE_REUSABLE_BLOCK_TITLE': { 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 }))); } case 'SAVE_REUSABLE_BLOCK_SUCCESS': { var _id = action.id, updatedId = action.updatedId; // If a temporary reusable block is saved, we swap the temporary id with the final one if (_id === updatedId) { return state; } var value = state[_id]; return Object(objectSpread["a" /* default */])({}, Object(external_lodash_["omit"])(state, _id), Object(defineProperty["a" /* default */])({}, updatedId, value)); } case 'REMOVE_REUSABLE_BLOCK': { var _id2 = action.id; return Object(external_lodash_["omit"])(state, _id2); } } return state; }, isFetching: function isFetching() { var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var action = arguments.length > 1 ? arguments[1] : undefined; switch (action.type) { case 'FETCH_REUSABLE_BLOCKS': { var id = action.id; if (!id) { return state; } return Object(objectSpread["a" /* default */])({}, 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 state; }, isSaving: function isSaving() { var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var action = arguments.length > 1 ? arguments[1] : undefined; switch (action.type) { case 'SAVE_REUSABLE_BLOCK': return Object(objectSpread["a" /* default */])({}, 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 state; } }); /** * 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; } /* harmony default export */ var store_reducer = (redux_optimist_default()(Object(external_this_wp_data_["combineReducers"])({ editor: editor, initialEdits: initialEdits, currentPost: currentPost, isTyping: reducer_isTyping, isCaretWithinFormattedText: reducer_isCaretWithinFormattedText, blockSelection: blockSelection, blocksMode: blocksMode, blockListSettings: reducer_blockListSettings, insertionPoint: insertionPoint, preferences: preferences, saving: saving, postLock: postLock, reusableBlocks: reusableBlocks, template: reducer_template, autosave: autosave, previewLink: reducer_previewLink, settings: reducer_settings, postSavingLock: postSavingLock }))); // EXTERNAL MODULE: ./node_modules/refx/refx.js var refx = __webpack_require__(87); var refx_default = /*#__PURE__*/__webpack_require__.n(refx); // EXTERNAL MODULE: ./node_modules/redux-multi/lib/index.js var lib = __webpack_require__(190); var lib_default = /*#__PURE__*/__webpack_require__.n(lib); // EXTERNAL MODULE: external {"this":["wp","a11y"]} var external_this_wp_a11y_ = __webpack_require__(44); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/actions.js /** * External Dependencies */ /** * WordPress dependencies */ /** * Returns an action object 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. * * @return {Object} Action object. */ function setupEditor(post, edits) { return { type: 'SETUP_EDITOR', post: post, edits: edits }; } /** * Returns an action object used in signalling that the latest version of the * post has been received, either by initialization or save. * * @param {Object} post Post object. * * @return {Object} Action object. */ function resetPost(post) { return { type: 'RESET_POST', post: post }; } /** * 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. * * @return {Object} Action object. */ function resetAutosave(post) { return { type: 'RESET_AUTOSAVE', post: post }; } /** * Returns an action object used in signalling that a patch of updates for the * latest version of the post have been received. * * @param {Object} edits Updated post fields. * * @return {Object} Action object. */ function updatePost(edits) { return { type: 'UPDATE_POST', edits: edits }; } /** * Returns an action object used to setup the editor state when first opening an editor. * * @param {Object} post Post object. * @param {Array} blocks Array of blocks. * * @return {Object} Action object. */ function setupEditorState(post, blocks) { return { type: 'SETUP_EDITOR_STATE', post: post, blocks: blocks }; } /** * Returns an action object used in signalling that blocks state should be * reset to the specified array of blocks, taking precedence over any other * content reflected as an edit in state. * * @param {Array} blocks Array of blocks. * * @return {Object} Action object. */ function actions_resetBlocks(blocks) { return { type: 'RESET_BLOCKS', blocks: blocks }; } /** * Returns an action object used in signalling that blocks have been received. * Unlike resetBlocks, these should be appended to the existing known set, not * replacing. * * @param {Object[]} blocks Array of block objects. * * @return {Object} Action object. */ function receiveBlocks(blocks) { return { type: 'RECEIVE_BLOCKS', blocks: blocks }; } /** * Returns an action object used in signalling that the block attributes with * the specified client ID has been updated. * * @param {string} clientId Block client ID. * @param {Object} attributes Block attributes to be merged. * * @return {Object} Action object. */ function updateBlockAttributes(clientId, attributes) { return { type: 'UPDATE_BLOCK_ATTRIBUTES', clientId: clientId, attributes: attributes }; } /** * Returns an action object used in signalling that the block with the * specified client ID has been updated. * * @param {string} clientId Block client ID. * @param {Object} updates Block attributes to be merged. * * @return {Object} Action object. */ function updateBlock(clientId, updates) { return { type: 'UPDATE_BLOCK', clientId: clientId, updates: updates }; } /** * Returns an action object used in signalling that the block with the * specified client ID has been selected, optionally accepting a position * value reflecting its selection directionality. An initialPosition of -1 * reflects a reverse selection. * * @param {string} clientId Block client ID. * @param {?number} initialPosition Optional initial position. Pass as -1 to * reflect reverse selection. * * @return {Object} Action object. */ function actions_selectBlock(clientId) { var initialPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return { type: 'SELECT_BLOCK', initialPosition: initialPosition, clientId: clientId }; } function startMultiSelect() { return { type: 'START_MULTI_SELECT' }; } function stopMultiSelect() { return { type: 'STOP_MULTI_SELECT' }; } function actions_multiSelect(start, end) { return { type: 'MULTI_SELECT', start: start, end: end }; } function clearSelectedBlock() { return { type: 'CLEAR_SELECTED_BLOCK' }; } /** * Returns an action object that enables or disables block selection. * * @param {boolean} [isSelectionEnabled=true] Whether block selection should * be enabled. * @return {Object} Action object. */ function toggleSelection() { var isSelectionEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; return { type: 'TOGGLE_SELECTION', isSelectionEnabled: isSelectionEnabled }; } /** * Returns an action object signalling that a blocks should be replaced with * one or more replacement blocks. * * @param {(string|string[])} clientIds Block client ID(s) to replace. * @param {(Object|Object[])} blocks Replacement block(s). * * @return {Object} Action object. */ function actions_replaceBlocks(clientIds, blocks) { return { type: 'REPLACE_BLOCKS', clientIds: Object(external_lodash_["castArray"])(clientIds), blocks: Object(external_lodash_["castArray"])(blocks), time: Date.now() }; } /** * Returns an action object signalling that a single block should be replaced * with one or more replacement blocks. * * @param {(string|string[])} clientId Block client ID to replace. * @param {(Object|Object[])} block Replacement block(s). * * @return {Object} Action object. */ function replaceBlock(clientId, block) { return actions_replaceBlocks(clientId, block); } /** * Higher-order action creator which, given the action type to dispatch creates * an action creator for managing block movement. * * @param {string} type Action type to dispatch. * * @return {Function} Action creator. */ function createOnMove(type) { return function (clientIds, rootClientId) { return { clientIds: Object(external_lodash_["castArray"])(clientIds), type: type, rootClientId: rootClientId }; }; } var actions_moveBlocksDown = createOnMove('MOVE_BLOCKS_DOWN'); var actions_moveBlocksUp = createOnMove('MOVE_BLOCKS_UP'); /** * Returns an action object signalling that an indexed block should be moved * to a new index. * * @param {?string} clientId The client ID of the block. * @param {?string} fromRootClientId Root client ID source. * @param {?string} toRootClientId Root client ID destination. * @param {number} index The index to move the block into. * * @return {Object} Action object. */ function moveBlockToPosition(clientId, fromRootClientId, toRootClientId, index) { return { type: 'MOVE_BLOCK_TO_POSITION', fromRootClientId: fromRootClientId, toRootClientId: toRootClientId, clientId: clientId, index: index }; } /** * Returns an action object used in signalling that a single block should be * inserted, optionally at a specific index respective a root block list. * * @param {Object} block Block object to insert. * @param {?number} index Index at which block should be inserted. * @param {?string} rootClientId Optional root client ID of block list on which to insert. * @param {?boolean} updateSelection If true block selection will be updated. If false, block selection will not change. Defaults to true. * * @return {Object} Action object. */ function actions_insertBlock(block, index, rootClientId) { var updateSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; return actions_insertBlocks([block], index, rootClientId, updateSelection); } /** * Returns an action object used in signalling that an array of blocks should * be inserted, optionally at a specific index respective a root block list. * * @param {Object[]} blocks Block objects to insert. * @param {?number} index Index at which block should be inserted. * @param {?string} rootClientId Optional root cliente ID of block list on which to insert. * @param {?boolean} updateSelection If true block selection will be updated. If false, block selection will not change. Defaults to true. * * @return {Object} Action object. */ function actions_insertBlocks(blocks, index, rootClientId) { var updateSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; return { type: 'INSERT_BLOCKS', blocks: Object(external_lodash_["castArray"])(blocks), index: index, rootClientId: rootClientId, time: Date.now(), updateSelection: updateSelection }; } /** * Returns an action object used in signalling that the insertion point should * be shown. * * @param {?string} rootClientId Optional root client ID of block list on * which to insert. * @param {?number} index Index at which block should be inserted. * * @return {Object} Action object. */ function actions_showInsertionPoint(rootClientId, index) { return { type: 'SHOW_INSERTION_POINT', rootClientId: rootClientId, index: index }; } /** * Returns an action object hiding the insertion point. * * @return {Object} Action object. */ function actions_hideInsertionPoint() { return { type: 'HIDE_INSERTION_POINT' }; } /** * Returns an action object resetting the template validity. * * @param {boolean} isValid template validity flag. * * @return {Object} Action object. */ function setTemplateValidity(isValid) { return { type: 'SET_TEMPLATE_VALIDITY', isValid: isValid }; } /** * Returns an action object synchronize the template with the list of blocks * * @return {Object} Action object. */ function synchronizeTemplate() { return { type: 'SYNCHRONIZE_TEMPLATE' }; } /** * 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 }; } /** * Returns an action object to save the post. * * @param {Object} options Options for the save. * @param {boolean} options.isAutosave Perform an autosave if true. * * @return {Object} Action object. */ function savePost() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; return { type: 'REQUEST_POST_UPDATE', options: options }; } function refreshPost() { return { type: 'REFRESH_POST' }; } function trashPost(postId, postType) { return { type: 'TRASH_POST', postId: postId, postType: postType }; } /** * Returns an action object used in signalling that two blocks should be merged * * @param {string} firstBlockClientId Client ID of the first block to merge. * @param {string} secondBlockClientId Client ID of the second block to merge. * * @return {Object} Action object. */ function mergeBlocks(firstBlockClientId, secondBlockClientId) { return { type: 'MERGE_BLOCKS', blocks: [firstBlockClientId, secondBlockClientId] }; } /** * Returns an action object used in signalling that the post should autosave. * * @param {Object?} options Extra flags to identify the autosave. * * @return {Object} Action object. */ function actions_autosave(options) { return savePost(Object(objectSpread["a" /* default */])({ isAutosave: true }, options)); } /** * Returns an action object used in signalling that undo history should * restore last popped state. * * @return {Object} Action object. */ function actions_redo() { return { type: 'REDO' }; } /** * Returns an action object used in signalling that undo history should pop. * * @return {Object} Action object. */ function actions_undo() { return { type: 'UNDO' }; } /** * Returns an action object used in signalling that undo history record should * be created. * * @return {Object} Action object. */ function createUndoLevel() { return { type: 'CREATE_UNDO_LEVEL' }; } /** * Returns an action object used in signalling that the blocks corresponding to * the set of specified client IDs are to be removed. * * @param {string|string[]} clientIds Client IDs of blocks to remove. * @param {boolean} selectPrevious True if the previous block should be * selected when a block is removed. * * @return {Object} Action object. */ function actions_removeBlocks(clientIds) { var selectPrevious = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; return { type: 'REMOVE_BLOCKS', clientIds: Object(external_lodash_["castArray"])(clientIds), selectPrevious: selectPrevious }; } /** * Returns an action object used in signalling that the block with the * specified client ID is to be removed. * * @param {string} clientId Client ID of block to remove. * @param {boolean} selectPrevious True if the previous block should be * selected when a block is removed. * * @return {Object} Action object. */ function removeBlock(clientId, selectPrevious) { return actions_removeBlocks([clientId], selectPrevious); } /** * Returns an action object used to toggle the block editing mode between * visual and HTML modes. * * @param {string} clientId Block client ID. * * @return {Object} Action object. */ function toggleBlockMode(clientId) { return { type: 'TOGGLE_BLOCK_MODE', clientId: clientId }; } /** * Returns an action object used in signalling that the user has begun to type. * * @return {Object} Action object. */ function startTyping() { return { type: 'START_TYPING' }; } /** * Returns an action object used in signalling that the user has stopped typing. * * @return {Object} Action object. */ function stopTyping() { return { type: 'STOP_TYPING' }; } /** * Returns an action object used in signalling that the caret has entered formatted text. * * @return {Object} Action object. */ function enterFormattedText() { return { type: 'ENTER_FORMATTED_TEXT' }; } /** * Returns an action object used in signalling that the user caret has exited formatted text. * * @return {Object} Action object. */ function exitFormattedText() { return { type: 'EXIT_FORMATTED_TEXT' }; } /** * Returns an action object used to lock the editor. * * @param {Object} lock Details about the post lock status, user, and nonce. * * @return {Object} Action object. */ function updatePostLock(lock) { return { type: 'UPDATE_POST_LOCK', lock: lock }; } /** * Returns an action object used to fetch a single reusable block or all * reusable blocks from the REST API into the store. * * @param {?string} id If given, only a single reusable block with this ID will * be fetched. * * @return {Object} Action object. */ function __experimentalFetchReusableBlocks(id) { return { type: 'FETCH_REUSABLE_BLOCKS', id: id }; } /** * Returns an action object used in signalling that reusable blocks have been * received. `results` is an array of objects containing: * - `reusableBlock` - Details about how the reusable block is persisted. * - `parsedBlock` - The original block. * * @param {Object[]} results Reusable blocks received. * * @return {Object} Action object. */ function __experimentalReceiveReusableBlocks(results) { return { type: 'RECEIVE_REUSABLE_BLOCKS', results: results }; } /** * Returns an action object used to save a reusable block that's in the store to * the REST API. * * @param {Object} id The ID of the reusable block to save. * * @return {Object} Action object. */ function __experimentalSaveReusableBlock(id) { return { type: 'SAVE_REUSABLE_BLOCK', id: id }; } /** * Returns an action object used to delete a reusable block via the REST API. * * @param {number} id The ID of the reusable block to delete. * * @return {Object} Action object. */ function __experimentalDeleteReusableBlock(id) { return { type: 'DELETE_REUSABLE_BLOCK', id: id }; } /** * Returns an action object used in signalling that a reusable block's title is * to be updated. * * @param {number} id The ID of the reusable block to update. * @param {string} title The new title. * * @return {Object} Action object. */ function __experimentalUpdateReusableBlockTitle(id, title) { return { type: 'UPDATE_REUSABLE_BLOCK_TITLE', id: id, title: title }; } /** * Returns an action object used to convert a reusable block into a static block. * * @param {string} clientId The client ID of the block to attach. * * @return {Object} Action object. */ function __experimentalConvertBlockToStatic(clientId) { return { type: 'CONVERT_BLOCK_TO_STATIC', clientId: clientId }; } /** * Returns an action object used to convert a static block into a reusable block. * * @param {string} clientIds The client IDs of the block to detach. * * @return {Object} Action object. */ function __experimentalConvertBlockToReusable(clientIds) { return { type: 'CONVERT_BLOCK_TO_REUSABLE', clientIds: Object(external_lodash_["castArray"])(clientIds) }; } /** * Returns an action object used in signalling that a new block of the default * type should be added to the block list. * * @param {?Object} attributes Optional attributes of the block to assign. * @param {?string} rootClientId Optional root client ID of block list on which * to append. * @param {?number} index Optional index where to insert the default block * * @return {Object} Action object */ function actions_insertDefaultBlock(attributes, rootClientId, index) { var block = Object(external_this_wp_blocks_["createBlock"])(Object(external_this_wp_blocks_["getDefaultBlockName"])(), attributes); return actions_insertBlock(block, index, rootClientId); } /** * Returns an action object that changes the nested settings of a given block. * * @param {string} clientId Client ID of the block whose nested setting are * being received. * @param {Object} settings Object with the new settings for the nested block. * * @return {Object} Action object */ function actions_updateBlockListSettings(clientId, settings) { return { type: 'UPDATE_BLOCK_LIST_SETTINGS', clientId: clientId, settings: settings }; } /* * Returns an action object used in signalling that the editor settings have been updated. * * @param {Object} settings Updated settings * * @return {Object} Action object */ function updateEditorSettings(settings) { return { type: 'UPDATE_EDITOR_SETTINGS', settings: settings }; } /** * Returns an action object used in signalling that the user has enabled the publish sidebar. * * @return {Object} Action object */ function enablePublishSidebar() { return { type: 'ENABLE_PUBLISH_SIDEBAR' }; } /** * Returns an action object used in signalling that the user has disabled the publish sidebar. * * @return {Object} Action object */ function disablePublishSidebar() { return { type: 'DISABLE_PUBLISH_SIDEBAR' }; } /** * Returns an action object used to signal that post saving is locked. * * @param {string} lockName The lock name. * * @return {Object} Action object */ function lockPostSaving(lockName) { return { type: 'LOCK_POST_SAVING', lockName: lockName }; } /** * Returns an action object used to signal that post saving is unlocked. * * @param {string} lockName The lock name. * * @return {Object} Action object */ function unlockPostSaving(lockName) { return { type: 'UNLOCK_POST_SAVING', lockName: lockName }; } // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js var rememo = __webpack_require__(31); // EXTERNAL MODULE: external {"this":["wp","date"]} var external_this_wp_date_ = __webpack_require__(46); // EXTERNAL MODULE: external {"this":["wp","autop"]} var external_this_wp_autop_ = __webpack_require__(58); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/selectors.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /*** * Module constants */ var POST_UPDATE_TRANSACTION_ID = 'post-update'; var PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/; var INSERTER_UTILITY_HIGH = 3; var INSERTER_UTILITY_MEDIUM = 2; var INSERTER_UTILITY_LOW = 1; var INSERTER_UTILITY_NONE = 0; var MILLISECONDS_PER_HOUR = 3600 * 1000; var MILLISECONDS_PER_DAY = 24 * 3600 * 1000; var MILLISECONDS_PER_WEEK = 7 * 24 * 3600 * 1000; var ONE_MINUTE_IN_MS = 60 * 1000; /** * 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. * * @type {Array} */ var EMPTY_ARRAY = []; /** * Returns true if any past editor history snapshots exist, or false otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether undo history exists. */ function hasEditorUndo(state) { return state.editor.past.length > 0; } /** * Returns true if any future editor history snapshots exist, or false * otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether redo history exists. */ function hasEditorRedo(state) { return state.editor.future.length > 0; } /** * Returns true if the currently edited post is yet to be saved, or false if * the post has been saved. * * @param {Object} state Global application state. * * @return {boolean} Whether the post is new. */ function selectors_isEditedPostNew(state) { return selectors_getCurrentPost(state).status === 'auto-draft'; } /** * Returns true if content includes unsaved changes, or false otherwise. * * @param {Object} state Editor state. * * @return {boolean} Whether content includes unsaved changes. */ function hasChangedContent(state) { return state.editor.present.blocks.isDirty || // `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; } /** * Returns true if there are unsaved values for the current edit session, or * false if the editing state matches the saved or new post. * * @param {Object} state Global application state. * * @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 detectiona 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); } /** * 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). * * @param {Object} state Global application state. * * @return {boolean} Whether new post and unsaved values exist. */ function selectors_isCleanNewPost(state) { return !selectors_isEditedPostDirty(state) && selectors_isEditedPostNew(state); } /** * Returns the post currently being edited in its last known saved state, not * including unsaved edits. Returns an object containing relevant default post * values if the post has not yet been saved. * * @param {Object} state Global application state. * * @return {Object} Post object. */ function selectors_getCurrentPost(state) { return state.currentPost; } /** * Returns the post type of the post currently being edited. * * @param {Object} state Global application state. * * @return {string} Post type. */ function selectors_getCurrentPostType(state) { return state.currentPost.type; } /** * Returns the ID of the post currently being edited, or null if the post has * not yet been saved. * * @param {Object} state Global application state. * * @return {?number} ID of current post. */ function selectors_getCurrentPostId(state) { return selectors_getCurrentPost(state).id || null; } /** * Returns the number of revisions of the post currently being edited. * * @param {Object} state Global application state. * * @return {number} Number of revisions. */ function getCurrentPostRevisionsCount(state) { return Object(external_lodash_["get"])(selectors_getCurrentPost(state), ['_links', 'version-history', 0, 'count'], 0); } /** * Returns the last revision ID of the post currently being edited, * or null if the post has no revisions. * * @param {Object} state Global application state. * * @return {?number} ID of the last revision. */ function getCurrentPostLastRevisionId(state) { return Object(external_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 * been saved. * * @param {Object} state Global application state. * * @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]; }); /** * 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. * * @example * * ``` * const hasEditOccurred = ( * getReferenceByDistinctEdits( beforeState ) !== * getReferenceByDistinctEdits( afterState ) * ); * ``` * * @param {Object} state Editor state. * * @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]; }); /** * Returns an attribute value of the saved post. * * @param {Object} state Global application state. * @param {string} attributeName Post attribute name. * * @return {*} Post attribute value. */ function selectors_getCurrentPostAttribute(state, attributeName) { var post = selectors_getCurrentPost(state); if (post.hasOwnProperty(attributeName)) { return post[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 * saved state of the post. * * @param {Object} state Global application state. * @param {string} attributeName Post attribute name. * * @return {*} Post attribute value. */ function selectors_getEditedPostAttribute(state, attributeName) { // Special cases switch (attributeName) { case 'content': return getEditedPostContent(state); } // Fall back to saved post value if not edited. var edits = getPostEdits(state); if (!edits.hasOwnProperty(attributeName)) { return selectors_getCurrentPostAttribute(state, attributeName); } // Merge properties are objects which contain only the patch edit in state, // and thus must be merged with the current post attribute. if (EDIT_MERGE_PROPERTIES.has(attributeName)) { // [TODO]: Since this will return a new reference on each invocation, // consider caching in a way which would not impact non-merged property // derivation. Alternatively, introduce a new selector for meta lookup. return Object(objectSpread["a" /* default */])({}, selectors_getCurrentPostAttribute(state, attributeName), edits[attributeName]); } return edits[attributeName]; } /** * Returns an attribute value of the current autosave revision for a post, or * null if there is no autosave for the post. * * @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]; } } /** * 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 * "private", "password", or "public". * * @param {Object} state Global application state. * * @return {string} Post visibility. */ function selectors_getEditedPostVisibility(state) { var status = selectors_getEditedPostAttribute(state, 'status'); if (status === 'private') { return 'private'; } var password = selectors_getEditedPostAttribute(state, 'password'); if (password) { return 'password'; } return 'public'; } /** * Returns true if post is pending review. * * @param {Object} state Global application state. * * @return {boolean} Whether current post is pending review. */ function isCurrentPostPending(state) { return selectors_getCurrentPost(state).status === 'pending'; } /** * Return true if the current post has already been published. * * @param {Object} state Global application state. * * @return {boolean} Whether the post has been published. */ function selectors_isCurrentPostPublished(state) { var post = 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)); } /** * Returns true if post is already scheduled. * * @param {Object} state Global application state. * * @return {boolean} Whether current post is scheduled to be posted. */ function selectors_isCurrentPostScheduled(state) { return selectors_getCurrentPost(state).status === 'future' && !selectors_isCurrentPostPublished(state); } /** * Return true if the post being edited can be published. * * @param {Object} state Global application state. * * @return {boolean} Whether the post can been published. */ function selectors_isEditedPostPublishable(state) { var post = selectors_getCurrentPost(state); // TODO: Post being publishable should be superset of condition of post // being saveable. Currently this restriction is imposed at UI. // // See: <PostPublishButton /> (`isButtonEnabled` assigned by `isSaveable`) return selectors_isEditedPostDirty(state) || ['publish', 'private', 'future'].indexOf(post.status) === -1; } /** * Returns true if the post can be saved, or false otherwise. A post must * contain a title, an excerpt, or non-empty content to be valid for save. * * @param {Object} state Global application state. * * @return {boolean} Whether the post can be saved. */ function selectors_isEditedPostSaveable(state) { if (selectors_isSavingPost(state)) { return false; } // TODO: Post should not be saveable if not dirty. Cannot be added here at // this time since posts where meta boxes are present can be saved even if // the post is not dirty. Currently this restriction is imposed at UI, but // should be moved here. // // See: `isEditedPostPublishable` (includes `isEditedPostDirty` condition) // See: <PostSavedState /> (`forceIsDirty` prop) // See: <PostPublishButton /> (`forceIsDirty` prop) // See: https://github.com/WordPress/gutenberg/pull/4184 return !!selectors_getEditedPostAttribute(state, 'title') || !!selectors_getEditedPostAttribute(state, 'excerpt') || !isEditedPostEmpty(state); } /** * Returns true if the edited post has content. A post has content if it has at * least one saveable block or otherwise has a non-empty content property * assigned. * * @param {Object} state Global application state. * * @return {boolean} Whether post has content. */ function isEditedPostEmpty(state) { var blocks = getBlocksForSerialization(state); // While the condition of truthy content string is sufficient to determine // emptiness, testing saveable blocks length is a trivial operation. Since // this function can be called frequently, optimize for the fast case as a // condition of the mere existence of blocks. Note that the value of edited // content is used in place of blocks, thus allowed to fall through. if (blocks.length && !('content' in getPostEdits(state))) { // 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. if (blocks.length > 1) { return false; } // Freeform and unregistered blocks omit comment delimiters in their // output. The freeform block specifically may produce an empty string // to save. In the case of a single freeform block, fall through to the // full serialize. Otherwise, the single block is assumed non-empty by // virtue of its comment delimiters. if (blocks[0].name !== Object(external_this_wp_blocks_["getFreeformContentHandlerName"])()) { return false; } } return !getEditedPostContent(state); } /** * Returns true if the post can be autosaved, or false otherwise. * * @param {Object} state Global application state. * * @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); }); } /** * 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). * * @param {Object} state Editor state. * * @return {?Object} Current autosave, if exists. */ function getAutosave(state) { return state.autosave; } /** * Returns the true if there is an existing autosave, otherwise false. * * @param {Object} state Global application state. * * @return {boolean} Whether there is an existing autosave. */ function hasAutosave(state) { return !!getAutosave(state); } /** * Return true if the post being edited is being scheduled. Preferring the * unsaved status values. * * @param {Object} state Global application state. * * @return {boolean} Whether the post has been published. */ function selectors_isEditedPostBeingScheduled(state) { var date = selectors_getEditedPostAttribute(state, 'date'); // Offset the date by one minute (network latency) var checkedDate = new Date(Number(Object(external_this_wp_date_["getDate"])(date)) - ONE_MINUTE_IN_MS); return Object(external_this_wp_date_["isInTheFuture"])(checkedDate); } /** * Returns whether the current post should be considered to have a "floating" * date (i.e. that it would publish "Immediately" rather than at a set time). * * Unlike in the PHP backend, the REST API returns a full date string for posts * where the 0000-00-00T00:00:00 placeholder is present in the database. To * 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. * * @return {boolean} Whether the edited post has a floating date value. */ function isEditedPostDateFloating(state) { var date = selectors_getEditedPostAttribute(state, 'date'); var modified = selectors_getEditedPostAttribute(state, 'modified'); var status = selectors_getEditedPostAttribute(state, 'status'); if (status === 'draft' || status === 'auto-draft') { return date === modified; } return false; } /** * Returns a new reference when the inner blocks of a given block client ID * change. This is used exclusively as a memoized selector dependant, relying * on this selector's shared return value and recursively those of its inner * blocks defined as dependencies. This abuses mechanics of the selector * memoization to return from the original selector function only when * dependants change. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {*} A value whose reference will change only when inner blocks of * the given block client ID change. */ var getBlockDependantsCacheBust = Object(rememo["a" /* default */])(function () { return []; }, function (state, clientId) { return Object(external_lodash_["map"])(selectors_getBlockOrder(state, clientId), function (innerBlockClientId) { return selectors_getBlock(state, innerBlockClientId); }); }); /** * Returns a block's name given its client ID, or null if no block exists with * the client ID. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {string} Block name. */ function selectors_getBlockName(state, clientId) { var block = state.editor.present.blocks.byClientId[clientId]; return block ? block.name : null; } /** * Returns whether a block is valid or not. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {boolean} Is Valid. */ function selectors_isBlockValid(state, clientId) { var block = state.editor.present.blocks.byClientId[clientId]; return !!block && block.isValid; } /** * Returns a block's attributes given its client ID, or null if no block exists with * the client ID. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {Object?} Block attributes. */ var getBlockAttributes = Object(rememo["a" /* default */])(function (state, clientId) { var block = state.editor.present.blocks.byClientId[clientId]; if (!block) { return null; } var attributes = state.editor.present.blocks.attributes[clientId]; // Inject custom source attribute values. // // TODO: Create generic external sourcing pattern, not explicitly // targeting meta attributes. var type = Object(external_this_wp_blocks_["getBlockType"])(block.name); if (type) { attributes = Object(external_lodash_["reduce"])(type.attributes, function (result, value, key) { if (value.source === 'meta') { if (result === attributes) { result = Object(objectSpread["a" /* default */])({}, result); } result[key] = getPostMeta(state, value.meta); } return result; }, attributes); } return attributes; }, function (state, clientId) { return [state.editor.present.blocks.byClientId[clientId], state.editor.present.blocks.attributes[clientId], state.editor.present.edits.meta, state.initialEdits.meta, state.currentPost.meta]; }); /** * Returns a block given its client ID. This is a parsed copy of the block, * containing its `blockName`, `clientId`, and current `attributes` state. This * is not the block's registration settings, which must be retrieved from the * blocks module registration store. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {Object} Parsed block object. */ var selectors_getBlock = Object(rememo["a" /* default */])(function (state, clientId) { var block = state.editor.present.blocks.byClientId[clientId]; if (!block) { return null; } return Object(objectSpread["a" /* default */])({}, block, { attributes: getBlockAttributes(state, clientId), innerBlocks: selectors_getBlocks(state, clientId) }); }, function (state, clientId) { return Object(toConsumableArray["a" /* default */])(getBlockAttributes.getDependants(state, clientId)).concat([getBlockDependantsCacheBust(state, clientId)]); }); var selectors_unstableGetBlockWithoutInnerBlocks = Object(rememo["a" /* default */])(function (state, clientId) { var block = state.editor.present.blocks.byClientId[clientId]; if (!block) { return null; } return Object(objectSpread["a" /* default */])({}, block, { attributes: getBlockAttributes(state, clientId) }); }, function (state, clientId) { return [state.editor.present.blocks.byClientId[clientId]].concat(Object(toConsumableArray["a" /* default */])(getBlockAttributes.getDependants(state, clientId))); }); function getPostMeta(state, key) { return Object(external_lodash_["has"])(state, ['editor', 'present', 'edits', 'meta', key]) ? Object(external_lodash_["get"])(state, ['editor', 'present', 'edits', 'meta', key]) : Object(external_lodash_["get"])(state, ['currentPost', 'meta', key]); } /** * Returns all block objects for the current post being edited as an array in * the order they appear in the post. * * Note: It's important to memoize this selector to avoid return a new instance * on each call * * @param {Object} state Editor state. * @param {?String} rootClientId Optional root client ID of block list. * * @return {Object[]} Post blocks. */ var selectors_getBlocks = Object(rememo["a" /* default */])(function (state, rootClientId) { return Object(external_lodash_["map"])(selectors_getBlockOrder(state, rootClientId), function (clientId) { return selectors_getBlock(state, clientId); }); }, function (state) { return [state.editor.present.blocks]; }); /** * Returns an array containing the clientIds of all descendants * of the blocks given. * * @param {Object} state Global application state. * @param {Array} clientIds Array of blocks to inspect. * * @return {Array} ids of descendants. */ var selectors_getClientIdsOfDescendants = function getClientIdsOfDescendants(state, clientIds) { return Object(external_lodash_["flatMap"])(clientIds, function (clientId) { var descendants = selectors_getBlockOrder(state, clientId); return Object(toConsumableArray["a" /* default */])(descendants).concat(Object(toConsumableArray["a" /* default */])(getClientIdsOfDescendants(state, descendants))); }); }; /** * Returns an array containing the clientIds of the top-level blocks * and their descendants of any depth (for nested blocks). * * @param {Object} state Global application state. * * @return {Array} ids of top-level and descendant blocks. */ var getClientIdsWithDescendants = Object(rememo["a" /* default */])(function (state) { var topLevelIds = selectors_getBlockOrder(state); return Object(toConsumableArray["a" /* default */])(topLevelIds).concat(Object(toConsumableArray["a" /* default */])(selectors_getClientIdsOfDescendants(state, topLevelIds))); }, function (state) { return [state.editor.present.blocks.order]; }); /** * Returns the total number of blocks, or the total number of blocks with a specific name in a post. * The number returned includes nested blocks. * * @param {Object} state Global application state. * @param {?String} blockName Optional block name, if specified only blocks of that type will be counted. * * @return {number} Number of blocks in the post, or number of blocks with name equal to blockName. */ var getGlobalBlockCount = Object(rememo["a" /* default */])(function (state, blockName) { var clientIds = getClientIdsWithDescendants(state); if (!blockName) { return clientIds.length; } return Object(external_lodash_["reduce"])(clientIds, function (count, clientId) { var block = state.editor.present.blocks.byClientId[clientId]; return block.name === blockName ? count + 1 : count; }, 0); }, function (state) { return [state.editor.present.blocks.order, state.editor.present.blocks.byClientId]; }); /** * Given an array of block client IDs, returns the corresponding array of block * objects. * * @param {Object} state Editor state. * @param {string[]} clientIds Client IDs for which blocks are to be returned. * * @return {WPBlock[]} Block objects. */ var selectors_getBlocksByClientId = Object(rememo["a" /* default */])(function (state, clientIds) { return Object(external_lodash_["map"])(Object(external_lodash_["castArray"])(clientIds), function (clientId) { return selectors_getBlock(state, clientId); }); }, function (state) { return [state.editor.present.edits.meta, state.initialEdits.meta, state.currentPost.meta, state.editor.present.blocks]; }); /** * Returns the number of blocks currently present in the post. * * @param {Object} state Editor state. * @param {?string} rootClientId Optional root client ID of block list. * * @return {number} Number of blocks in the post. */ function selectors_getBlockCount(state, rootClientId) { return selectors_getBlockOrder(state, rootClientId).length; } /** * Returns the current block selection start. This value may be null, and it * may represent either a singular block selection or multi-selection start. * A selection is singular if its start and end match. * * @param {Object} state Global application state. * * @return {?string} Client ID of block selection start. */ function getBlockSelectionStart(state) { return state.blockSelection.start; } /** * Returns the current block selection end. This value may be null, and it * may represent either a singular block selection or multi-selection end. * A selection is singular if its start and end match. * * @param {Object} state Global application state. * * @return {?string} Client ID of block selection end. */ function getBlockSelectionEnd(state) { return state.blockSelection.end; } /** * Returns the number of blocks currently selected in the post. * * @param {Object} state Global application state. * * @return {number} Number of blocks selected in the post. */ function selectors_getSelectedBlockCount(state) { var multiSelectedBlockCount = selectors_getMultiSelectedBlockClientIds(state).length; if (multiSelectedBlockCount) { return multiSelectedBlockCount; } return state.blockSelection.start ? 1 : 0; } /** * Returns true if there is a single selected block, or false otherwise. * * @param {Object} state Editor state. * * @return {boolean} Whether a single block is selected. */ function hasSelectedBlock(state) { var _state$blockSelection = state.blockSelection, start = _state$blockSelection.start, end = _state$blockSelection.end; return !!start && start === end; } /** * Returns the currently selected block client ID, or null if there is no * selected block. * * @param {Object} state Editor state. * * @return {?string} Selected block client ID. */ function selectors_getSelectedBlockClientId(state) { var _state$blockSelection2 = state.blockSelection, start = _state$blockSelection2.start, end = _state$blockSelection2.end; // We need to check the block exists because the current state.blockSelection reducer // doesn't take into account the UNDO / REDO actions to update selection. // To be removed when that's fixed. return start && start === end && !!state.editor.present.blocks.byClientId[start] ? start : null; } /** * Returns the currently selected block, or null if there is no selected block. * * @param {Object} state Global application state. * * @return {?Object} Selected block. */ function getSelectedBlock(state) { var clientId = selectors_getSelectedBlockClientId(state); return clientId ? selectors_getBlock(state, clientId) : null; } /** * Given a block client ID, returns the root block from which the block is * nested, an empty string for top-level blocks, or null if the block does not * exist. * * @param {Object} state Editor state. * @param {string} clientId Block from which to find root client ID. * * @return {?string} Root client ID, if exists */ var selectors_getBlockRootClientId = Object(rememo["a" /* default */])(function (state, clientId) { var order = state.editor.present.blocks.order; for (var rootClientId in order) { if (Object(external_lodash_["includes"])(order[rootClientId], clientId)) { return rootClientId; } } return null; }, function (state) { return [state.editor.present.blocks.order]; }); /** * Given a block client ID, returns the root of the hierarchy from which the block is nested, return the block itself for root level blocks. * * @param {Object} state Editor state. * @param {string} clientId Block from which to find root client ID. * * @return {string} Root client ID */ var getBlockHierarchyRootClientId = Object(rememo["a" /* default */])(function (state, clientId) { var rootClientId = clientId; var current = clientId; while (rootClientId) { current = rootClientId; rootClientId = selectors_getBlockRootClientId(state, current); } return current; }, function (state) { return [state.editor.present.blocks.order]; }); /** * Returns the client ID of the block adjacent one at the given reference * startClientId and modifier directionality. Defaults start startClientId to * the selected block, and direction as next block. Returns null if there is no * adjacent block. * * @param {Object} state Editor state. * @param {?string} startClientId Optional client ID of block from which to * search. * @param {?number} modifier Directionality multiplier (1 next, -1 * previous). * * @return {?string} Return the client ID of the block, or null if none exists. */ function getAdjacentBlockClientId(state, startClientId) { var modifier = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; // Default to selected block. if (startClientId === undefined) { startClientId = selectors_getSelectedBlockClientId(state); } // Try multi-selection starting at extent based on modifier. if (startClientId === undefined) { if (modifier < 0) { startClientId = getFirstMultiSelectedBlockClientId(state); } else { startClientId = getLastMultiSelectedBlockClientId(state); } } // Validate working start client ID. if (!startClientId) { return null; } // Retrieve start block root client ID, being careful to allow the falsey // empty string top-level root by explicitly testing against null. var rootClientId = selectors_getBlockRootClientId(state, startClientId); if (rootClientId === null) { return null; } var order = state.editor.present.blocks.order; var orderSet = order[rootClientId]; var index = orderSet.indexOf(startClientId); var nextIndex = index + 1 * modifier; // Block was first in set and we're attempting to get previous. if (nextIndex < 0) { return null; } // Block was last in set and we're attempting to get next. if (nextIndex === orderSet.length) { return null; } // Assume incremented index is within the set. return orderSet[nextIndex]; } /** * Returns the previous block's client ID from the given reference start ID. * Defaults start to the selected block. Returns null if there is no previous * block. * * @param {Object} state Editor state. * @param {?string} startClientId Optional client ID of block from which to * search. * * @return {?string} Adjacent block's client ID, or null if none exists. */ function getPreviousBlockClientId(state, startClientId) { return getAdjacentBlockClientId(state, startClientId, -1); } /** * Returns the next block's client ID from the given reference start ID. * Defaults start to the selected block. Returns null if there is no next * block. * * @param {Object} state Editor state. * @param {?string} startClientId Optional client ID of block from which to * search. * * @return {?string} Adjacent block's client ID, or null if none exists. */ function getNextBlockClientId(state, startClientId) { return getAdjacentBlockClientId(state, startClientId, 1); } /** * Returns the initial caret position for the selected block. * This position is to used to position the caret properly when the selected block changes. * * @param {Object} state Global application state. * * @return {?Object} Selected block. */ function selectors_getSelectedBlocksInitialCaretPosition(state) { var _state$blockSelection3 = state.blockSelection, start = _state$blockSelection3.start, end = _state$blockSelection3.end; if (start !== end || !start) { return null; } return state.blockSelection.initialPosition; } /** * Returns the current multi-selection set of block client IDs, or an empty * array if there is no multi-selection. * * @param {Object} state Editor state. * * @return {Array} Multi-selected block client IDs. */ var selectors_getMultiSelectedBlockClientIds = Object(rememo["a" /* default */])(function (state) { var _state$blockSelection4 = state.blockSelection, start = _state$blockSelection4.start, end = _state$blockSelection4.end; if (start === end) { return []; } // Retrieve root client ID to aid in retrieving relevant nested block // order, being careful to allow the falsey empty string top-level root // by explicitly testing against null. var rootClientId = selectors_getBlockRootClientId(state, start); if (rootClientId === null) { return []; } var blockOrder = selectors_getBlockOrder(state, rootClientId); var startIndex = blockOrder.indexOf(start); var endIndex = blockOrder.indexOf(end); if (startIndex > endIndex) { return blockOrder.slice(endIndex, startIndex + 1); } return blockOrder.slice(startIndex, endIndex + 1); }, function (state) { return [state.editor.present.blocks.order, state.blockSelection.start, state.blockSelection.end]; }); /** * Returns the current multi-selection set of blocks, or an empty array if * there is no multi-selection. * * @param {Object} state Editor state. * * @return {Array} Multi-selected block objects. */ var getMultiSelectedBlocks = Object(rememo["a" /* default */])(function (state) { var multiSelectedBlockClientIds = selectors_getMultiSelectedBlockClientIds(state); if (!multiSelectedBlockClientIds.length) { return EMPTY_ARRAY; } return multiSelectedBlockClientIds.map(function (clientId) { return selectors_getBlock(state, clientId); }); }, function (state) { return Object(toConsumableArray["a" /* default */])(selectors_getMultiSelectedBlockClientIds.getDependants(state)).concat([state.editor.present.blocks, state.editor.present.edits.meta, state.initialEdits.meta, state.currentPost.meta]); }); /** * Returns the client ID of the first block in the multi-selection set, or null * if there is no multi-selection. * * @param {Object} state Editor state. * * @return {?string} First block client ID in the multi-selection set. */ function getFirstMultiSelectedBlockClientId(state) { return Object(external_lodash_["first"])(selectors_getMultiSelectedBlockClientIds(state)) || null; } /** * Returns the client ID of the last block in the multi-selection set, or null * if there is no multi-selection. * * @param {Object} state Editor state. * * @return {?string} Last block client ID in the multi-selection set. */ function getLastMultiSelectedBlockClientId(state) { return Object(external_lodash_["last"])(selectors_getMultiSelectedBlockClientIds(state)) || null; } /** * Checks if possibleAncestorId is an ancestor of possibleDescendentId. * * @param {Object} state Editor state. * @param {string} possibleAncestorId Possible ancestor client ID. * @param {string} possibleDescendentId Possible descent client ID. * * @return {boolean} True if possibleAncestorId is an ancestor * of possibleDescendentId, and false otherwise. */ var isAncestorOf = Object(rememo["a" /* default */])(function (state, possibleAncestorId, possibleDescendentId) { var idToCheck = possibleDescendentId; while (possibleAncestorId !== idToCheck && idToCheck) { idToCheck = selectors_getBlockRootClientId(state, idToCheck); } return possibleAncestorId === idToCheck; }, function (state) { return [state.editor.present.blocks.order]; }); /** * Returns true if a multi-selection exists, and the block corresponding to the * specified client ID is the first block of the multi-selection set, or false * otherwise. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {boolean} Whether block is first in multi-selection. */ function selectors_isFirstMultiSelectedBlock(state, clientId) { return getFirstMultiSelectedBlockClientId(state) === clientId; } /** * Returns true if the client ID occurs within the block multi-selection, or * false otherwise. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {boolean} Whether block is in multi-selection set. */ function selectors_isBlockMultiSelected(state, clientId) { return selectors_getMultiSelectedBlockClientIds(state).indexOf(clientId) !== -1; } /** * Returns true if an ancestor of the block is multi-selected, or false * otherwise. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {boolean} Whether an ancestor of the block is in multi-selection * set. */ var selectors_isAncestorMultiSelected = Object(rememo["a" /* default */])(function (state, clientId) { var ancestorClientId = clientId; var isMultiSelected = false; while (ancestorClientId && !isMultiSelected) { ancestorClientId = selectors_getBlockRootClientId(state, ancestorClientId); isMultiSelected = selectors_isBlockMultiSelected(state, ancestorClientId); } return isMultiSelected; }, function (state) { return [state.editor.present.blocks.order, state.blockSelection.start, state.blockSelection.end]; }); /** * Returns the client ID of the block which begins the multi-selection set, or * null if there is no multi-selection. * * This is not necessarily the first client ID in the selection. * * @see getFirstMultiSelectedBlockClientId * * @param {Object} state Editor state. * * @return {?string} Client ID of block beginning multi-selection. */ function getMultiSelectedBlocksStartClientId(state) { var _state$blockSelection5 = state.blockSelection, start = _state$blockSelection5.start, end = _state$blockSelection5.end; if (start === end) { return null; } return start || null; } /** * Returns the client ID of the block which ends the multi-selection set, or * null if there is no multi-selection. * * This is not necessarily the last client ID in the selection. * * @see getLastMultiSelectedBlockClientId * * @param {Object} state Editor state. * * @return {?string} Client ID of block ending multi-selection. */ function getMultiSelectedBlocksEndClientId(state) { var _state$blockSelection6 = state.blockSelection, start = _state$blockSelection6.start, end = _state$blockSelection6.end; if (start === end) { return null; } return end || null; } /** * Returns an array containing all block client IDs in the editor in the order * they appear. Optionally accepts a root client ID of the block list for which * the order should be returned, defaulting to the top-level block order. * * @param {Object} state Editor state. * @param {?string} rootClientId Optional root client ID of block list. * * @return {Array} Ordered client IDs of editor blocks. */ function selectors_getBlockOrder(state, rootClientId) { return state.editor.present.blocks.order[rootClientId || ''] || EMPTY_ARRAY; } /** * Returns the index at which the block corresponding to the specified client * ID occurs within the block order, or `-1` if the block does not exist. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * @param {?string} rootClientId Optional root client ID of block list. * * @return {number} Index at which block exists in order. */ function selectors_getBlockIndex(state, clientId, rootClientId) { return selectors_getBlockOrder(state, rootClientId).indexOf(clientId); } /** * Returns true if the block corresponding to the specified client ID is * currently selected and no multi-selection exists, or false otherwise. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {boolean} Whether block is selected and multi-selection exists. */ function selectors_isBlockSelected(state, clientId) { var _state$blockSelection7 = state.blockSelection, start = _state$blockSelection7.start, end = _state$blockSelection7.end; if (start !== end) { return false; } return start === clientId; } /** * Returns true if one of the block's inner blocks is selected. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * @param {boolean} deep Perform a deep check. * * @return {boolean} Whether the block as an inner block selected */ function selectors_hasSelectedInnerBlock(state, clientId) { var deep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; return Object(external_lodash_["some"])(selectors_getBlockOrder(state, clientId), function (innerClientId) { return selectors_isBlockSelected(state, innerClientId) || selectors_isBlockMultiSelected(state, innerClientId) || deep && selectors_hasSelectedInnerBlock(state, innerClientId, deep); }); } /** * Returns true if the block corresponding to the specified client ID is * currently selected but isn't the last of the selected blocks. Here "last" * refers to the block sequence in the document, _not_ the sequence of * multi-selection, which is why `state.blockSelection.end` isn't used. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {boolean} Whether block is selected and not the last in the * selection. */ function isBlockWithinSelection(state, clientId) { if (!clientId) { return false; } var clientIds = selectors_getMultiSelectedBlockClientIds(state); var index = clientIds.indexOf(clientId); return index > -1 && index < clientIds.length - 1; } /** * Returns true if a multi-selection has been made, or false otherwise. * * @param {Object} state Editor state. * * @return {boolean} Whether multi-selection has been made. */ function selectors_hasMultiSelection(state) { var _state$blockSelection8 = state.blockSelection, start = _state$blockSelection8.start, end = _state$blockSelection8.end; return start !== end; } /** * Whether in the process of multi-selecting or not. This flag is only true * while the multi-selection is being selected (by mouse move), and is false * once the multi-selection has been settled. * * @see hasMultiSelection * * @param {Object} state Global application state. * * @return {boolean} True if multi-selecting, false if not. */ function selectors_isMultiSelecting(state) { return state.blockSelection.isMultiSelecting; } /** * Selector that returns if multi-selection is enabled or not. * * @param {Object} state Global application state. * * @return {boolean} True if it should be possible to multi-select blocks, false if multi-selection is disabled. */ function selectors_isSelectionEnabled(state) { return state.blockSelection.isEnabled; } /** * Returns the block's editing mode, defaulting to "visual" if not explicitly * assigned. * * @param {Object} state Editor state. * @param {string} clientId Block client ID. * * @return {Object} Block editing mode. */ function selectors_getBlockMode(state, clientId) { return state.blocksMode[clientId] || 'visual'; } /** * Returns true if the user is typing, or false otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether user is typing. */ function selectors_isTyping(state) { return state.isTyping; } /** * Returns true if the caret is within formatted text, or false otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether the caret is within formatted text. */ function selectors_isCaretWithinFormattedText(state) { return state.isCaretWithinFormattedText; } /** * Returns the insertion point, the index at which the new inserted block would * be placed. Defaults to the last index. * * @param {Object} state Editor state. * * @return {Object} Insertion point object with `rootClientId`, `index`. */ function getBlockInsertionPoint(state) { var rootClientId, index; var insertionPoint = state.insertionPoint, blockSelection = state.blockSelection; if (insertionPoint !== null) { return insertionPoint; } var end = blockSelection.end; if (end) { rootClientId = selectors_getBlockRootClientId(state, end) || undefined; index = selectors_getBlockIndex(state, end, rootClientId) + 1; } else { index = selectors_getBlockOrder(state).length; } return { rootClientId: rootClientId, index: index }; } /** * Returns true if we should show the block insertion point. * * @param {Object} state Global application state. * * @return {?boolean} Whether the insertion point is visible or not. */ function isBlockInsertionPointVisible(state) { return state.insertionPoint !== null; } /** * Returns whether the blocks matches the template or not. * * @param {boolean} state * @return {?boolean} Whether the template is valid or not. */ function isValidTemplate(state) { return state.template.isValid; } /** * Returns the defined block template * * @param {boolean} state * @return {?Array} Block Template */ function getTemplate(state) { return state.settings.template; } /** * Returns the defined block template lock. Optionally accepts a root block * client ID as context, otherwise defaulting to the global context. * * @param {Object} state Editor state. * @param {?string} rootClientId Optional block root client ID. * * @return {?string} Block Template Lock */ function selectors_getTemplateLock(state, rootClientId) { if (!rootClientId) { return state.settings.templateLock; } var blockListSettings = getBlockListSettings(state, rootClientId); if (!blockListSettings) { return null; } return blockListSettings.templateLock; } /** * Returns true if the post is currently being saved, or false otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether post is being saved. */ function selectors_isSavingPost(state) { return state.saving.requesting; } /** * Returns true if a previous post save was attempted successfully, or false * otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether the post was saved successfully. */ function didPostSaveRequestSucceed(state) { return state.saving.successful; } /** * Returns true if a previous post save was attempted but failed, or false * otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether the post save failed. */ function didPostSaveRequestFail(state) { return !!state.saving.error; } /** * Returns true if the post is autosaving, or false otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether the post is autosaving. */ function selectors_isAutosavingPost(state) { return selectors_isSavingPost(state) && !!state.saving.options.isAutosave; } /** * Returns true if the post is being previewed, or false otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether the post is being previewed. */ function isPreviewingPost(state) { return selectors_isSavingPost(state) && !!state.saving.options.isPreview; } /** * Returns the post preview link * * @param {Object} state Global application state. * * @return {string?} Preview Link. */ function selectors_getEditedPostPreviewLink(state) { var featuredImageId = selectors_getEditedPostAttribute(state, 'featured_media'); var previewLink = state.previewLink; if (previewLink && featuredImageId) { return Object(external_this_wp_url_["addQueryArgs"])(previewLink, { _thumbnail_id: featuredImageId }); } return previewLink; } /** * Returns a suggested post format for the current post, inferred only if there * is a single block within the post and it is of a type known to match a * default post format. Returns null if the format cannot be determined. * * @param {Object} state Global application state. * * @return {?string} Suggested post format. */ function selectors_getSuggestedPostFormat(state) { var blocks = selectors_getBlockOrder(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. if (blocks.length === 1) { name = selectors_getBlockName(state, blocks[0]); } // If there are two blocks in the content and the last one is a text blocks // grab the name of the first one to also suggest a post format from it. if (blocks.length === 2) { if (selectors_getBlockName(state, blocks[1]) === 'core/paragraph') { name = selectors_getBlockName(state, blocks[0]); } } // We only convert to default post formats in core. switch (name) { case 'core/image': return 'image'; case 'core/quote': case 'core/pullquote': return 'quote'; case 'core/gallery': return 'gallery'; case 'core/video': case 'core-embed/youtube': case 'core-embed/vimeo': return 'video'; case 'core/audio': case 'core-embed/spotify': case 'core-embed/soundcloud': return 'audio'; } return null; } /** * Returns a set of blocks which are to be used in consideration of the post's * generated save content. * * @param {Object} state Editor state. * * @return {WPBlock[]} Filtered set of blocks for save. */ function getBlocksForSerialization(state) { var blocks = selectors_getBlocks(state); // A single unmodified default block is assumed to be equivalent to an // empty post. var isSingleUnmodifiedDefaultBlock = blocks.length === 1 && Object(external_this_wp_blocks_["isUnmodifiedDefaultBlock"])(blocks[0]); if (isSingleUnmodifiedDefaultBlock) { return []; } return blocks; } /** * Returns the content of the post being edited, preferring raw string edit * before falling back to serialization of block state. * * @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, state.editor.present.edits.content, state.initialEdits.content]; }); /** * Determines if the given block type is allowed to be inserted into the block list. * This function is not exported and not memoized because using a memoized selector * inside another memoized selector is just a waste of time. * * @param {Object} state Editor state. * @param {string} blockName The name of the block type, e.g.' core/paragraph'. * @param {?string} rootClientId Optional root client ID of block list. * * @return {boolean} Whether the given block type is allowed to be inserted. */ var selectors_canInsertBlockTypeUnmemoized = function canInsertBlockTypeUnmemoized(state, blockName) { var rootClientId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var checkAllowList = function checkAllowList(list, item) { var defaultResult = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; if (Object(external_lodash_["isBoolean"])(list)) { return list; } if (Object(external_lodash_["isArray"])(list)) { return Object(external_lodash_["includes"])(list, item); } return defaultResult; }; var blockType = Object(external_this_wp_blocks_["getBlockType"])(blockName); if (!blockType) { return false; } var _getEditorSettings = selectors_getEditorSettings(state), allowedBlockTypes = _getEditorSettings.allowedBlockTypes; var isBlockAllowedInEditor = checkAllowList(allowedBlockTypes, blockName, true); if (!isBlockAllowedInEditor) { return false; } var isLocked = !!selectors_getTemplateLock(state, rootClientId); if (isLocked) { return false; } var parentBlockListSettings = getBlockListSettings(state, rootClientId); var parentAllowedBlocks = Object(external_lodash_["get"])(parentBlockListSettings, ['allowedBlocks']); var hasParentAllowedBlock = checkAllowList(parentAllowedBlocks, blockName); var blockAllowedParentBlocks = blockType.parent; var parentName = selectors_getBlockName(state, rootClientId); var hasBlockAllowedParent = checkAllowList(blockAllowedParentBlocks, parentName); if (hasParentAllowedBlock !== null && hasBlockAllowedParent !== null) { return hasParentAllowedBlock || hasBlockAllowedParent; } else if (hasParentAllowedBlock !== null) { return hasParentAllowedBlock; } else if (hasBlockAllowedParent !== null) { return hasBlockAllowedParent; } return true; }; /** * Determines if the given block type is allowed to be inserted into the block list. * * @param {Object} state Editor state. * @param {string} blockName The name of the block type, e.g.' core/paragraph'. * @param {?string} rootClientId Optional root client ID of block list. * * @return {boolean} Whether the given block type is allowed to be inserted. */ var selectors_canInsertBlockType = Object(rememo["a" /* default */])(selectors_canInsertBlockTypeUnmemoized, function (state, blockName, rootClientId) { return [state.blockListSettings[rootClientId], state.editor.present.blocks.byClientId[rootClientId], state.settings.allowedBlockTypes, state.settings.templateLock]; }); /** * Returns information about how recently and frequently a block has been inserted. * * @param {Object} state Global application state. * @param {string} id A string which identifies the insert, e.g. 'core/block/12' * * @return {?{ time: number, count: number }} An object containing `time` which is when the last * insert occured as a UNIX epoch, and `count` which is * the number of inserts that have occurred. */ function getInsertUsage(state, id) { return state.preferences.insertUsage[id] || null; } /** * Returns whether we can show a block type in the inserter * * @param {Object} state Global State * @param {Object} blockType BlockType * @param {?string} rootClientId Optional root client ID of block list. * * @return {boolean} Whether the given block type is allowed to be shown in the inserter. */ var selectors_canIncludeBlockTypeInInserter = function canIncludeBlockTypeInInserter(state, blockType, rootClientId) { if (!Object(external_this_wp_blocks_["hasBlockSupport"])(blockType, 'inserter', true)) { return false; } return selectors_canInsertBlockTypeUnmemoized(state, blockType.name, rootClientId); }; /** * Returns whether we can show a reusable block in the inserter * * @param {Object} state Global State * @param {Object} reusableBlock Reusable block object * @param {?string} rootClientId Optional root client ID of block list. * * @return {boolean} Whether the given block type is allowed to be shown in the inserter. */ var selectors_canIncludeReusableBlockInInserter = function canIncludeReusableBlockInInserter(state, reusableBlock, rootClientId) { if (!selectors_canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId)) { return false; } var referencedBlockName = selectors_getBlockName(state, reusableBlock.clientId); if (!referencedBlockName) { return false; } var referencedBlockType = Object(external_this_wp_blocks_["getBlockType"])(referencedBlockName); if (!referencedBlockType) { return false; } if (!selectors_canInsertBlockTypeUnmemoized(state, referencedBlockName, rootClientId)) { return false; } if (isAncestorOf(state, reusableBlock.clientId, rootClientId)) { return false; } return true; }; /** * Determines the items that appear in the inserter. Includes both static * items (e.g. a regular block type) and dynamic items (e.g. a reusable block). * * Each item object contains what's necessary to display a button in the * inserter and handle its selection. * * The 'utility' property indicates how useful we think an item will be to the * user. There are 4 levels of utility: * * 1. Blocks that are contextually useful (utility = 3) * 2. Blocks that have been previously inserted (utility = 2) * 3. Blocks that are in the common category (utility = 1) * 4. All other blocks (utility = 0) * * The 'frecency' property is a heuristic (https://en.wikipedia.org/wiki/Frecency) * that combines block usage frequenty and recency. * * Items are returned ordered descendingly by their 'utility' and 'frecency'. * * @param {Object} state Editor state. * @param {?string} rootClientId Optional root client ID of block list. * * @return {Editor.InserterItem[]} Items that appear in inserter. * * @typedef {Object} Editor.InserterItem * @property {string} id Unique identifier for the item. * @property {string} name The type of block to create. * @property {Object} initialAttributes Attributes to pass to the newly created block. * @property {string} title Title of the item, as it appears in the inserter. * @property {string} icon Dashicon for the item, as it appears in the inserter. * @property {string} category Block category that the item is associated with. * @property {string[]} keywords Keywords that can be searched to find this item. * @property {boolean} isDisabled Whether or not the user should be prevented from inserting * this item. * @property {number} utility How useful we think this item is, between 0 and 3. * @property {number} frecency Hueristic that combines frequency and recency. */ var selectors_getInserterItems = Object(rememo["a" /* default */])(function (state) { var rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var calculateUtility = function calculateUtility(category, count, isContextual) { if (isContextual) { return INSERTER_UTILITY_HIGH; } else if (count > 0) { return INSERTER_UTILITY_MEDIUM; } else if (category === 'common') { return INSERTER_UTILITY_LOW; } return INSERTER_UTILITY_NONE; }; var calculateFrecency = function calculateFrecency(time, count) { if (!time) { return count; } // The selector is cached, which means Date.now() is the last time that the // relevant state changed. This suits our needs. var duration = Date.now() - time; switch (true) { case duration < MILLISECONDS_PER_HOUR: return count * 4; case duration < MILLISECONDS_PER_DAY: return count * 2; case duration < MILLISECONDS_PER_WEEK: return count / 2; default: return count / 4; } }; var buildBlockTypeInserterItem = function buildBlockTypeInserterItem(blockType) { var id = blockType.name; var isDisabled = false; if (!Object(external_this_wp_blocks_["hasBlockSupport"])(blockType.name, 'multiple', true)) { isDisabled = Object(external_lodash_["some"])(selectors_getBlocksByClientId(state, getClientIdsWithDescendants(state)), { name: blockType.name }); } var isContextual = Object(external_lodash_["isArray"])(blockType.parent); var _ref = getInsertUsage(state, id) || {}, time = _ref.time, _ref$count = _ref.count, count = _ref$count === void 0 ? 0 : _ref$count; return { id: id, name: blockType.name, initialAttributes: {}, title: blockType.title, icon: blockType.icon, category: blockType.category, keywords: blockType.keywords, isDisabled: isDisabled, utility: calculateUtility(blockType.category, count, isContextual), frecency: calculateFrecency(time, count), hasChildBlocksWithInserterSupport: Object(external_this_wp_blocks_["hasChildBlocksWithInserterSupport"])(blockType.name) }; }; var buildReusableBlockInserterItem = function buildReusableBlockInserterItem(reusableBlock) { var id = "core/block/".concat(reusableBlock.id); var referencedBlockName = selectors_getBlockName(state, reusableBlock.clientId); var referencedBlockType = Object(external_this_wp_blocks_["getBlockType"])(referencedBlockName); var _ref2 = getInsertUsage(state, id) || {}, time = _ref2.time, _ref2$count = _ref2.count, count = _ref2$count === void 0 ? 0 : _ref2$count; var utility = calculateUtility('reusable', count, false); var frecency = calculateFrecency(time, count); return { id: id, name: 'core/block', initialAttributes: { ref: reusableBlock.id }, title: reusableBlock.title, icon: referencedBlockType.icon, category: 'reusable', keywords: [], isDisabled: false, utility: utility, frecency: frecency }; }; var blockTypeInserterItems = Object(external_this_wp_blocks_["getBlockTypes"])().filter(function (blockType) { return selectors_canIncludeBlockTypeInInserter(state, blockType, rootClientId); }).map(buildBlockTypeInserterItem); var reusableBlockInserterItems = __experimentalGetReusableBlocks(state).filter(function (block) { return selectors_canIncludeReusableBlockInInserter(state, block, rootClientId); }).map(buildReusableBlockInserterItem); return Object(external_lodash_["orderBy"])(Object(toConsumableArray["a" /* default */])(blockTypeInserterItems).concat(Object(toConsumableArray["a" /* default */])(reusableBlockInserterItems)), ['utility', 'frecency'], ['desc', 'desc']); }, function (state, rootClientId) { return [state.blockListSettings[rootClientId], state.editor.present.blocks.byClientId, state.editor.present.blocks.order, state.preferences.insertUsage, state.settings.allowedBlockTypes, state.settings.templateLock, state.reusableBlocks.data, Object(external_this_wp_blocks_["getBlockTypes"])()]; }); /** * Determines whether there are items to show in the inserter. * @param {Object} state Editor state. * @param {?string} rootClientId Optional root client ID of block list. * * @return {boolean} Items that appear in inserter. */ var hasInserterItems = Object(rememo["a" /* default */])(function (state) { var rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var hasBlockType = Object(external_lodash_["some"])(Object(external_this_wp_blocks_["getBlockTypes"])(), function (blockType) { return selectors_canIncludeBlockTypeInInserter(state, blockType, rootClientId); }); if (hasBlockType) { return true; } var hasReusableBlock = Object(external_lodash_["some"])(__experimentalGetReusableBlocks(state), function (block) { return selectors_canIncludeReusableBlockInInserter(state, block, rootClientId); }); return hasReusableBlock; }, function (state, rootClientId) { return [state.blockListSettings[rootClientId], state.editor.present.blocks.byClientId, state.settings.allowedBlockTypes, state.settings.templateLock, state.reusableBlocks.data, Object(external_this_wp_blocks_["getBlockTypes"])()]; }); /** * Returns the reusable block with the given ID. * * @param {Object} state Global application state. * @param {number|string} ref The reusable block's ID. * * @return {Object} The reusable block, or null if none exists. */ var __experimentalGetReusableBlock = Object(rememo["a" /* default */])(function (state, ref) { var block = state.reusableBlocks.data[ref]; if (!block) { return null; } var isTemporary = isNaN(parseInt(ref)); return Object(objectSpread["a" /* default */])({}, block, { id: isTemporary ? ref : +ref, isTemporary: isTemporary }); }, function (state, ref) { return [state.reusableBlocks.data[ref]]; }); /** * Returns whether or not the reusable block with the given ID is being saved. * * @param {Object} state Global application state. * @param {string} ref The reusable block's ID. * * @return {boolean} Whether or not the reusable block is being saved. */ function __experimentalIsSavingReusableBlock(state, ref) { return state.reusableBlocks.isSaving[ref] || false; } /** * Returns true if the reusable block with the given ID is being fetched, or * false otherwise. * * @param {Object} state Global application state. * @param {string} ref The reusable block's ID. * * @return {boolean} Whether the reusable block is being fetched. */ function __experimentalIsFetchingReusableBlock(state, ref) { return !!state.reusableBlocks.isFetching[ref]; } /** * Returns an array of all reusable blocks. * * @param {Object} state Global application state. * * @return {Array} An array of all reusable blocks. */ function __experimentalGetReusableBlocks(state) { return Object(external_lodash_["map"])(state.reusableBlocks.data, function (value, ref) { return __experimentalGetReusableBlock(state, ref); }); } /** * Returns state object prior to a specified optimist transaction ID, or `null` * if the transaction corresponding to the given ID cannot be found. * * @param {Object} state Current global application state. * @param {Object} transactionId Optimist transaction ID. * * @return {Object} Global application state prior to transaction. */ 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; }); return transaction ? transaction.beforeState : null; } /** * Returns true if the post is being published, or false otherwise. * * @param {Object} state Global application state. * * @return {boolean} Whether post is being published. */ function selectors_isPublishingPost(state) { if (!selectors_isSavingPost(state)) { return false; } // Saving is optimistic, so assume that current post would be marked as // published if publishing if (!selectors_isCurrentPostPublished(state)) { return false; } // Use post update transaction ID to retrieve the state prior to the // optimistic transaction 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); } /** * Returns whether the permalink is editable or not. * * @param {Object} state Editor state. * * @return {boolean} Whether or not the permalink is editable. */ function selectors_isPermalinkEditable(state) { var permalinkTemplate = selectors_getEditedPostAttribute(state, 'permalink_template'); return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate); } /** * Returns the permalink for the post. * * @param {Object} state Editor state. * * @return {?string} The permalink, or null if the post is not viewable. */ function getPermalink(state) { var permalinkParts = selectors_getPermalinkParts(state); if (!permalinkParts) { return null; } var prefix = permalinkParts.prefix, postName = permalinkParts.postName, suffix = permalinkParts.suffix; if (selectors_isPermalinkEditable(state)) { return prefix + postName + suffix; } return prefix; } /** * Returns the permalink for a post, split into it's three parts: the prefix, * the postName, and the suffix. * * @param {Object} state Editor state. * * @return {Object} An object containing the prefix, postName, and suffix for * the permalink, or null if the post is not viewable. */ function selectors_getPermalinkParts(state) { var permalinkTemplate = selectors_getEditedPostAttribute(state, 'permalink_template'); if (!permalinkTemplate) { return null; } var postName = selectors_getEditedPostAttribute(state, 'slug') || selectors_getEditedPostAttribute(state, 'generated_slug'); var _permalinkTemplate$sp = permalinkTemplate.split(PERMALINK_POSTNAME_REGEX), _permalinkTemplate$sp2 = Object(slicedToArray["a" /* default */])(_permalinkTemplate$sp, 2), prefix = _permalinkTemplate$sp2[0], suffix = _permalinkTemplate$sp2[1]; return { prefix: prefix, postName: postName, suffix: suffix }; } /** * Returns true if an optimistic transaction is pending commit, for which the * before state satisfies the given predicate function. * * @param {Object} state Editor state. * @param {Function} predicate Function given state, returning true if match. * * @return {boolean} Whether predicate matches for some history. */ function inSomeHistory(state, predicate) { var optimist = state.optimist; // In recursion, optimist state won't exist. Assume exhausted options. if (!optimist) { return false; } return optimist.some(function (_ref3) { var beforeState = _ref3.beforeState; return beforeState && predicate(beforeState); }); } /** * Returns the Block List settings of a block, if any exist. * * @param {Object} state Editor state. * @param {?string} clientId Block client ID. * * @return {?Object} Block settings of the block if set. */ function getBlockListSettings(state, clientId) { return state.blockListSettings[clientId]; } /** * Returns the editor settings. * * @param {Object} state Editor state. * * @return {Object} The editor settings object. */ function selectors_getEditorSettings(state) { return state.settings; } /** * Returns the token settings. * * @param {Object} state Editor state. * @param {?string} name Token name. * * @return {Object} Token settings object, or the named token settings object if set. */ function getTokenSettings(state, name) { if (!name) { return state.tokens; } return state.tokens[name]; } /** * Returns whether the post is locked. * * @param {Object} state Global application state. * * @return {boolean} Is locked. */ function isPostLocked(state) { return state.postLock.isLocked; } /** * Returns whether post saving is locked. * * @param {Object} state Global application state. * * @return {boolean} Is locked. */ function selectors_isPostSavingLocked(state) { return Object.keys(state.postSavingLock).length > 0; } /** * Returns whether the edition of the post has been taken over. * * @param {Object} state Global application state. * * @return {boolean} Is post lock takeover. */ function isPostLockTakeover(state) { return state.postLock.isTakeover; } /** * Returns details about the post lock user. * * @param {Object} state Global application state. * * @return {Object} A user object. */ function getPostLockUser(state) { return state.postLock.user; } /** * Returns the active post lock. * * @param {Object} state Global application state. * * @return {Object} The lock object. */ function getActivePostLock(state) { return state.postLock.activePostLock; } /** * Returns whether or not the user has the unfiltered_html capability. * * @param {Object} state Editor state. * * @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']); } /** * Returns whether the pre-publish panel should be shown * or skipped when the user clicks the "publish" button. * * @param {Object} state Global application state. * * @return {boolean} Whether the pre-publish panel should be shown or not. */ function selectors_isPublishSidebarEnabled(state) { if (state.preferences.hasOwnProperty('isPublishSidebarEnabled')) { return state.preferences.isPublishSidebarEnabled; } return PREFERENCES_DEFAULTS.isPublishSidebarEnabled; } // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js var asyncToGenerator = __webpack_require__(38); // EXTERNAL MODULE: external {"this":["wp","apiFetch"]} var external_this_wp_apiFetch_ = __webpack_require__(30); var external_this_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_apiFetch_); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/effects/reusable-blocks.js /** * External dependencies */ /** * WordPress dependencies */ // TODO: Ideally this would be the only dispatch in scope. This requires either // refactoring editor actions to yielded controls, or replacing direct dispatch // on the editor store with action creators (e.g. `REMOVE_REUSABLE_BLOCK`). /** * Internal dependencies */ /** * Module Constants */ var REUSABLE_BLOCK_NOTICE_ID = 'REUSABLE_BLOCK_NOTICE_ID'; /** * Fetch Reusable Blocks Effect Handler. * * @param {Object} action action object. * @param {Object} store Redux Store. */ var reusable_blocks_fetchReusableBlocks = /*#__PURE__*/ function () { var _ref = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/ regeneratorRuntime.mark(function _callee(action, store) { var id, dispatch, postType, posts, results; return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: id = action.id; dispatch = store.dispatch; // TODO: these are potentially undefined, this fix is in place // until there is a filter to not use reusable blocks if undefined _context.next = 4; return external_this_wp_apiFetch_default()({ path: '/core/types/wp_block' }); case 4: postType = _context.sent; if (postType) { _context.next = 7; break; } return _context.abrupt("return"); case 7: _context.prev = 7; if (!id) { _context.next = 15; break; } _context.next = 11; return external_this_wp_apiFetch_default()({ path: "/core/".concat(postType.rest_base, "/").concat(id) }); case 11: _context.t0 = _context.sent; posts = [_context.t0]; _context.next = 18; break; case 15: _context.next = 17; return external_this_wp_apiFetch_default()({ path: "/core/".concat(postType.rest_base, "?per_page=-1") }); case 17: posts = _context.sent; case 18: results = Object(external_lodash_["compact"])(Object(external_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) }; })); if (results.length) { dispatch(__experimentalReceiveReusableBlocks(results)); } dispatch({ type: 'FETCH_REUSABLE_BLOCKS_SUCCESS', id: id }); _context.next = 26; break; case 23: _context.prev = 23; _context.t1 = _context["catch"](7); dispatch({ type: 'FETCH_REUSABLE_BLOCKS_FAILURE', id: id, error: _context.t1 }); case 26: case "end": return _context.stop(); } } }, _callee, this, [[7, 23]]); })); return function fetchReusableBlocks(_x, _x2) { return _ref.apply(this, arguments); }; }(); /** * 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__*/ regeneratorRuntime.mark(function _callee2(action, store) { var postType, id, dispatch, state, _getReusableBlock, clientId, title, isTemporary, reusableBlock, content, data, path, method, updatedReusableBlock, message; return regeneratorRuntime.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: _context2.next = 2; return external_this_wp_apiFetch_default()({ path: '/core/types/wp_block' }); case 2: postType = _context2.sent; if (postType) { _context2.next = 5; break; } return _context2.abrupt("return"); case 5: id = action.id; dispatch = store.dispatch; state = store.getState(); _getReusableBlock = __experimentalGetReusableBlock(state, id), clientId = _getReusableBlock.clientId, title = _getReusableBlock.title, isTemporary = _getReusableBlock.isTemporary; reusableBlock = selectors_getBlock(state, clientId); content = Object(external_this_wp_blocks_["serialize"])(reusableBlock.name === 'core/template' ? reusableBlock.innerBlocks : reusableBlock); data = isTemporary ? { title: title, content: content, status: 'publish' } : { id: id, title: title, content: content, status: 'publish' }; path = isTemporary ? "/core/".concat(postType.rest_base) : "/core/".concat(postType.rest_base, "/").concat(id); method = isTemporary ? 'POST' : 'PUT'; _context2.prev = 14; _context2.next = 17; return external_this_wp_apiFetch_default()({ path: path, data: data, method: method }); case 17: updatedReusableBlock = _context2.sent; dispatch({ type: 'SAVE_REUSABLE_BLOCK_SUCCESS', updatedId: updatedReusableBlock.id, id: id }); 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 }); _context2.next = 27; break; case 23: _context2.prev = 23; _context2.t0 = _context2["catch"](14); dispatch({ type: 'SAVE_REUSABLE_BLOCK_FAILURE', id: id }); Object(external_this_wp_data_["dispatch"])('core/notices').createErrorNotice(_context2.t0.message, { id: REUSABLE_BLOCK_NOTICE_ID }); case 27: case "end": return _context2.stop(); } } }, _callee2, this, [[14, 23]]); })); return function saveReusableBlocks(_x3, _x4) { return _ref2.apply(this, arguments); }; }(); /** * 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__*/ regeneratorRuntime.mark(function _callee3(action, store) { var postType, id, getState, dispatch, reusableBlock, allBlocks, associatedBlocks, associatedBlockClientIds, transactionId, message; return regeneratorRuntime.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: _context3.next = 2; return external_this_wp_apiFetch_default()({ path: '/core/types/wp_block' }); case 2: postType = _context3.sent; if (postType) { _context3.next = 5; break; } return _context3.abrupt("return"); case 5: id = action.id; getState = store.getState, dispatch = store.dispatch; // Don't allow a reusable block with a temporary ID to be deleted reusableBlock = __experimentalGetReusableBlock(getState(), id); if (!(!reusableBlock || reusableBlock.isTemporary)) { _context3.next = 10; break; } return _context3.abrupt("return"); case 10: // Remove any other blocks that reference this reusable block allBlocks = selectors_getBlocks(getState()); associatedBlocks = allBlocks.filter(function (block) { return Object(external_this_wp_blocks_["isReusableBlock"])(block) && block.attributes.ref === id; }); associatedBlockClientIds = associatedBlocks.map(function (block) { return block.clientId; }); transactionId = Object(external_lodash_["uniqueId"])(); dispatch({ type: 'REMOVE_REUSABLE_BLOCK', id: id, optimist: { type: redux_optimist["BEGIN"], id: transactionId } }); // Remove the parsed block. dispatch(actions_removeBlocks(Object(toConsumableArray["a" /* default */])(associatedBlockClientIds).concat([reusableBlock.clientId]))); _context3.prev = 16; _context3.next = 19; return external_this_wp_apiFetch_default()({ path: "/core/".concat(postType.rest_base, "/").concat(id), method: 'DELETE' }); case 19: dispatch({ type: 'DELETE_REUSABLE_BLOCK_SUCCESS', id: id, optimist: { type: redux_optimist["COMMIT"], id: transactionId } }); message = Object(external_this_wp_i18n_["__"])('Block deleted.'); Object(external_this_wp_data_["dispatch"])('core/notices').createSuccessNotice(message, { id: REUSABLE_BLOCK_NOTICE_ID }); _context3.next = 28; break; case 24: _context3.prev = 24; _context3.t0 = _context3["catch"](16); dispatch({ type: 'DELETE_REUSABLE_BLOCK_FAILURE', id: id, optimist: { type: redux_optimist["REVERT"], id: transactionId } }); Object(external_this_wp_data_["dispatch"])('core/notices').createErrorNotice(_context3.t0.message, { id: REUSABLE_BLOCK_NOTICE_ID }); case 28: case "end": return _context3.stop(); } } }, _callee3, this, [[16, 24]]); })); return function deleteReusableBlocks(_x5, _x6) { return _ref3.apply(this, arguments); }; }(); /** * Receive Reusable Blocks Effect Handler. * * @param {Object} action action object. * @return {Object} receive blocks action */ var reusable_blocks_receiveReusableBlocks = function receiveReusableBlocks(action) { return receiveBlocks(Object(external_lodash_["map"])(action.results, 'parsedBlock')); }; /** * Convert a reusable block to a static block effect handler * * @param {Object} action action object. * @param {Object} store Redux Store. */ var reusable_blocks_convertBlockToStatic = function convertBlockToStatic(action, store) { var state = store.getState(); var oldBlock = selectors_getBlock(state, action.clientId); var reusableBlock = __experimentalGetReusableBlock(state, oldBlock.attributes.ref); var referencedBlock = selectors_getBlock(state, 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)]; } store.dispatch(actions_replaceBlocks(oldBlock.clientId, newBlocks)); }; /** * Convert a static block to a reusable block effect handler * * @param {Object} action action object. * @param {Object} store Redux Store. */ var reusable_blocks_convertBlockToReusable = function convertBlockToReusable(action, store) { var getState = store.getState, dispatch = store.dispatch; var parsedBlock; if (action.clientIds.length === 1) { parsedBlock = selectors_getBlock(getState(), action.clientIds[0]); } else { parsedBlock = Object(external_this_wp_blocks_["createBlock"])('core/template', {}, selectors_getBlocksByClientId(getState(), 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. dispatch(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 }])); dispatch(__experimentalSaveReusableBlock(reusableBlock.id)); dispatch(actions_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 dispatch(receiveBlocks([parsedBlock])); }; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/effects/utils.js /** * WordPress dependencies */ /** * Waits for the resolution of a selector before returning the selector's value. * * @param {string} namespace Store namespace. * @param {string} selectorName Selector name. * @param {Array} args Selector args. * * @return {Promise} Selector result. */ function resolveSelector(namespace, 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 new Promise(function (resolve) { var hasFinished = function hasFinished() { return Object(external_this_wp_data_["select"])('core/data').hasFinishedResolution(namespace, selectorName, args); }; var getResult = function getResult() { return Object(external_this_wp_data_["select"])(namespace)[selectorName].apply(null, args); }; // We need to trigger the selector (to trigger the resolver) var result = getResult(); if (hasFinished()) { return resolve(result); } var unsubscribe = Object(external_this_wp_data_["subscribe"])(function () { if (hasFinished()) { unsubscribe(); resolve(getResult()); } }); }); } // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/effects/posts.js /** * External dependencies */ /** * WordPress dependencies */ // TODO: Ideally this would be the only dispatch in scope. This requires either // refactoring editor actions to yielded controls, or replacing direct dispatch // on the editor store with action creators (e.g. `REQUEST_POST_UPDATE_START`). /** * Internal dependencies */ /** * Module Constants */ var SAVE_POST_NOTICE_ID = 'SAVE_POST_NOTICE_ID'; var TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID'; /** * Request Post Update Effect handler * * @param {Object} action the fetchReusableBlocks action object. * @param {Object} store Redux Store. */ var requestPostUpdate = /*#__PURE__*/ function () { var _ref = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/ regeneratorRuntime.mark(function _callee(action, store) { var dispatch, getState, state, edits, isAutosave, post, toSend, postType, request, newPost, reset, isRevision; return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: dispatch = store.dispatch, getState = store.getState; state = getState(); // Prevent save if not saveable. // We don't check for dirtiness here as this can be overriden in the UI. if (selectors_isEditedPostSaveable(state)) { _context.next = 4; break; } return _context.abrupt("return"); case 4: edits = getPostEdits(state); isAutosave = !!action.options.isAutosave; if (isAutosave) { edits = Object(external_lodash_["pick"])(edits, ['title', 'content', 'excerpt']); } // 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 (selectors_isEditedPostNew(state)) { edits = Object(objectSpread["a" /* default */])({ status: 'draft' }, edits); } post = selectors_getCurrentPost(state); toSend = Object(objectSpread["a" /* default */])({}, edits, { content: getEditedPostContent(state), id: post.id }); _context.next = 12; return resolveSelector('core', 'getPostType', selectors_getCurrentPostType(state)); case 12: postType = _context.sent; dispatch({ type: 'REQUEST_POST_UPDATE_START', optimist: { type: redux_optimist["BEGIN"], id: POST_UPDATE_TRANSACTION_ID }, options: action.options }); // Optimistically apply updates under the assumption that the post // will be updated. See below logic in success resolution for revert // if the autosave is applied as a revision. dispatch(Object(objectSpread["a" /* default */])({}, updatePost(toSend), { optimist: { id: POST_UPDATE_TRANSACTION_ID } })); if (isAutosave) { // 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']), getAutosave(state), toSend); request = external_this_wp_apiFetch_default()({ path: "/core/".concat(postType.rest_base, "/").concat(post.id, "/autosaves"), method: 'POST', data: toSend }); } else { Object(external_this_wp_data_["dispatch"])('core/notices').removeNotice(SAVE_POST_NOTICE_ID); Object(external_this_wp_data_["dispatch"])('core/notices').removeNotice('autosave-exists'); request = external_this_wp_apiFetch_default()({ path: "/core/".concat(postType.rest_base, "/").concat(post.id), method: 'PUT', data: toSend }); } _context.prev = 16; _context.next = 19; return request; case 19: newPost = _context.sent; reset = isAutosave ? resetAutosave : resetPost; dispatch(reset(newPost)); // 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; dispatch({ type: 'REQUEST_POST_UPDATE_SUCCESS', previousPost: post, post: newPost, 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: action.options, postType: postType }); _context.next = 29; break; case 26: _context.prev = 26; _context.t0 = _context["catch"](16); dispatch({ type: 'REQUEST_POST_UPDATE_FAILURE', optimist: { type: redux_optimist["REVERT"], id: POST_UPDATE_TRANSACTION_ID }, post: post, edits: edits, error: _context.t0, options: action.options }); case 29: case "end": return _context.stop(); } } }, _callee, this, [[16, 26]]); })); return function requestPostUpdate(_x, _x2) { return _ref.apply(this, arguments); }; }(); /** * Request Post Update Success Effect handler * * @param {Object} action action object. * @param {Object} store Redux Store. */ var posts_requestPostUpdateSuccess = function requestPostUpdateSuccess(action) { var previousPost = action.previousPost, post = action.post, postType = action.postType; // Autosaves are neither shown a notice nor redirected. if (Object(external_lodash_["get"])(action.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 noticeMessage; var shouldShowLink = Object(external_lodash_["get"])(postType, ['viewable'], false); if (!isPublished && !willPublish) { // If saving a non-published post, don't show notice. noticeMessage = null; } else if (isPublished && !willPublish) { // If undoing publish status, show specific notice noticeMessage = postType.labels.item_reverted_to_draft; shouldShowLink = false; } else if (!isPublished && willPublish) { // If publishing or scheduling a post, show the corresponding // publish message noticeMessage = { publish: postType.labels.item_published, private: postType.labels.item_published_privately, future: postType.labels.item_scheduled }[post.status]; } else { // Generic fallback notice noticeMessage = postType.labels.item_updated; } if (noticeMessage) { var actions = []; if (shouldShowLink) { actions.push({ label: postType.labels.view_item, url: post.link }); } Object(external_this_wp_data_["dispatch"])('core/notices').createSuccessNotice(noticeMessage, { id: SAVE_POST_NOTICE_ID, actions: actions }); } }; /** * Request Post Update Failure Effect handler * * @param {Object} action action object. */ var posts_requestPostUpdateFailure = function requestPostUpdateFailure(action) { var post = action.post, edits = action.edits, error = action.error; if (error && 'rest_autosave_no_changes' === error.code) { // Autosave requested a new autosave, but there were no changes. This shouldn't // result in an error notice for the user. return; } var publishStatus = ['publish', 'private', 'future']; var isPublished = publishStatus.indexOf(post.status) !== -1; // If the post was being published, we show the corresponding publish error message // 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'); Object(external_this_wp_data_["dispatch"])('core/notices').createErrorNotice(noticeMessage, { id: SAVE_POST_NOTICE_ID }); }; /** * Trash Post Effect handler * * @param {Object} action action object. * @param {Object} store Redux Store. */ var posts_trashPost = /*#__PURE__*/ function () { var _ref2 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/ regeneratorRuntime.mark(function _callee2(action, store) { var dispatch, getState, postId, postTypeSlug, postType, post; return regeneratorRuntime.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: dispatch = store.dispatch, getState = store.getState; postId = action.postId; postTypeSlug = selectors_getCurrentPostType(getState()); _context2.next = 5; return resolveSelector('core', 'getPostType', postTypeSlug); case 5: postType = _context2.sent; Object(external_this_wp_data_["dispatch"])('core/notices').removeNotice(TRASH_POST_NOTICE_ID); _context2.prev = 7; _context2.next = 10; return external_this_wp_apiFetch_default()({ path: "/core/".concat(postType.rest_base, "/").concat(postId), method: 'DELETE' }); case 10: post = selectors_getCurrentPost(getState()); // TODO: This should be an updatePost action (updating subsets of post properties), // But right now editPost is tied with change detection. dispatch(resetPost(Object(objectSpread["a" /* default */])({}, post, { status: 'trash' }))); _context2.next = 17; break; case 14: _context2.prev = 14; _context2.t0 = _context2["catch"](7); dispatch(Object(objectSpread["a" /* default */])({}, action, { type: 'TRASH_POST_FAILURE', error: _context2.t0 })); case 17: case "end": return _context2.stop(); } } }, _callee2, this, [[7, 14]]); })); return function trashPost(_x3, _x4) { return _ref2.apply(this, arguments); }; }(); /** * Trash Post Failure Effect handler * * @param {Object} action action object. * @param {Object} store Redux Store. */ var posts_trashPostFailure = function trashPostFailure(action) { var message = action.error.message && action.error.code !== 'unknown_error' ? action.error.message : Object(external_this_wp_i18n_["__"])('Trashing failed'); Object(external_this_wp_data_["dispatch"])('core/notices').createErrorNotice(message, { id: TRASH_POST_NOTICE_ID }); }; /** * Refresh Post Effect handler * * @param {Object} action action object. * @param {Object} store Redux Store. */ var posts_refreshPost = /*#__PURE__*/ function () { var _ref3 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/ regeneratorRuntime.mark(function _callee3(action, store) { var dispatch, getState, state, post, postTypeSlug, postType, newPost; return regeneratorRuntime.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: dispatch = store.dispatch, getState = store.getState; state = getState(); post = selectors_getCurrentPost(state); postTypeSlug = selectors_getCurrentPostType(getState()); _context3.next = 6; return resolveSelector('core', 'getPostType', postTypeSlug); case 6: postType = _context3.sent; _context3.next = 9; return external_this_wp_apiFetch_default()({ // Timestamp arg allows caller to bypass browser caching, which is expected for this specific function. path: "/core/".concat(postType.rest_base, "/").concat(post.id, "?context=edit&_timestamp=").concat(Date.now()) }); case 9: newPost = _context3.sent; dispatch(resetPost(newPost)); case 11: case "end": return _context3.stop(); } } }, _callee3, this); })); return function refreshPost(_x5, _x6) { return _ref3.apply(this, arguments); }; }(); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/effects.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Block validity is a function of blocks state (at the point of a * reset) and the template setting. As a compromise to its placement * across distinct parts of state, it is implemented here as a side- * effect of the block reset action. * * @param {Object} action RESET_BLOCKS action. * @param {Object} store Store instance. * * @return {?Object} New validity set action if validity has changed. */ function validateBlocksToTemplate(action, store) { var state = store.getState(); var template = getTemplate(state); var templateLock = selectors_getTemplateLock(state); // Unlocked templates are considered always valid because they act // as default values only. var isBlocksValidToTemplate = !template || templateLock !== 'all' || Object(external_this_wp_blocks_["doBlocksMatchTemplate"])(action.blocks, template); // Update if validity has changed. if (isBlocksValidToTemplate !== isValidTemplate(state)) { return setTemplateValidity(isBlocksValidToTemplate); } } /** * Effect handler which will return a block select action to select the block * occurring before the selected block in the previous state, unless it is the * same block or the action includes a falsey `selectPrevious` option flag. * * @param {Object} action Action which had initiated the effect handler. * @param {Object} store Store instance. * * @return {?Object} Block select action to select previous, if applicable. */ function selectPreviousBlock(action, store) { // if the action says previous block should not be selected don't do anything. if (!action.selectPrevious) { return; } var firstRemovedBlockClientId = action.clientIds[0]; var state = store.getState(); var selectedBlockClientId = selectors_getSelectedBlockClientId(state); // recreate the state before the block was removed. var previousState = Object(objectSpread["a" /* default */])({}, state, { editor: { present: Object(external_lodash_["last"])(state.editor.past) } }); // rootClientId of the removed block. var rootClientId = selectors_getBlockRootClientId(previousState, firstRemovedBlockClientId); // Client ID of the block that was before the removed block or the // rootClientId if the removed block was first amongst its siblings. var blockClientIdToSelect = getPreviousBlockClientId(previousState, firstRemovedBlockClientId) || rootClientId; // Dispatch select block action if the currently selected block // is not already the block we want to be selected. if (blockClientIdToSelect !== selectedBlockClientId) { return actions_selectBlock(blockClientIdToSelect, -1); } } /** * Effect handler which will return a default block insertion action if there * are no other blocks at the root of the editor. This is expected to be used * in actions which may result in no blocks remaining in the editor (removal, * replacement, etc). * * @param {Object} action Action which had initiated the effect handler. * @param {Object} store Store instance. * * @return {?Object} Default block insert action, if no other blocks exist. */ function ensureDefaultBlock(action, store) { if (!selectors_getBlockCount(store.getState())) { return actions_insertDefaultBlock(); } } /* harmony default export */ var effects = ({ REQUEST_POST_UPDATE: function REQUEST_POST_UPDATE(action, store) { requestPostUpdate(action, store); }, REQUEST_POST_UPDATE_SUCCESS: posts_requestPostUpdateSuccess, REQUEST_POST_UPDATE_FAILURE: posts_requestPostUpdateFailure, TRASH_POST: function TRASH_POST(action, store) { posts_trashPost(action, store); }, TRASH_POST_FAILURE: posts_trashPostFailure, REFRESH_POST: function REFRESH_POST(action, store) { posts_refreshPost(action, store); }, MERGE_BLOCKS: function MERGE_BLOCKS(action, store) { var dispatch = store.dispatch; var state = store.getState(); var _action$blocks = Object(slicedToArray["a" /* default */])(action.blocks, 2), firstBlockClientId = _action$blocks[0], secondBlockClientId = _action$blocks[1]; var blockA = selectors_getBlock(state, firstBlockClientId); var blockType = Object(external_this_wp_blocks_["getBlockType"])(blockA.name); // Only focus the previous block if it's not mergeable if (!blockType.merge) { dispatch(actions_selectBlock(blockA.clientId)); return; } // We can only merge blocks with similar types // thus, we transform the block to merge first var blockB = selectors_getBlock(state, secondBlockClientId); var blocksWithTheSameType = blockA.name === blockB.name ? [blockB] : Object(external_this_wp_blocks_["switchToBlockType"])(blockB, blockA.name); // If the block types can not match, do nothing if (!blocksWithTheSameType || !blocksWithTheSameType.length) { return; } // Calling the merge to update the attributes and remove the block to be merged var updatedAttributes = blockType.merge(blockA.attributes, blocksWithTheSameType[0].attributes); dispatch(actions_selectBlock(blockA.clientId, -1)); dispatch(actions_replaceBlocks([blockA.clientId, blockB.clientId], [Object(objectSpread["a" /* default */])({}, blockA, { attributes: Object(objectSpread["a" /* default */])({}, blockA.attributes, updatedAttributes) })].concat(Object(toConsumableArray["a" /* default */])(blocksWithTheSameType.slice(1))))); }, SETUP_EDITOR: function SETUP_EDITOR(action, store) { var post = action.post, edits = action.edits; var state = store.getState(); // 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'; var template = getTemplate(state); if (isNewPost && template) { blocks = Object(external_this_wp_blocks_["synchronizeBlocksWithTemplate"])(blocks, template); } var setupAction = setupEditorState(post, blocks); return Object(external_lodash_["compact"])([setupAction, // TODO: This is temporary, necessary only so long as editor setup // is a separate action from block resetting. // // See: https://github.com/WordPress/gutenberg/pull/9403 validateBlocksToTemplate(setupAction, store)]); }, RESET_BLOCKS: [validateBlocksToTemplate], SYNCHRONIZE_TEMPLATE: function SYNCHRONIZE_TEMPLATE(action, _ref) { var getState = _ref.getState; var state = getState(); var blocks = selectors_getBlocks(state); var template = getTemplate(state); var updatedBlockList = Object(external_this_wp_blocks_["synchronizeBlocksWithTemplate"])(blocks, template); return actions_resetBlocks(updatedBlockList); }, FETCH_REUSABLE_BLOCKS: function FETCH_REUSABLE_BLOCKS(action, store) { reusable_blocks_fetchReusableBlocks(action, store); }, SAVE_REUSABLE_BLOCK: function SAVE_REUSABLE_BLOCK(action, store) { saveReusableBlocks(action, store); }, 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, REMOVE_BLOCKS: [selectPreviousBlock, ensureDefaultBlock], REPLACE_BLOCKS: [ensureDefaultBlock], MULTI_SELECT: function MULTI_SELECT(action, _ref2) { var getState = _ref2.getState; var blockCount = selectors_getSelectedBlockCount(getState()); /* translators: %s: number of selected blocks */ Object(external_this_wp_a11y_["speak"])(Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_n"])('%s block selected.', '%s blocks selected.', blockCount), blockCount), 'assertive'); } }); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/middlewares.js /** * External dependencies */ /** * Internal dependencies */ /** * Applies the custom middlewares used specifically in the editor module. * * @param {Object} store Store Object. * * @return {Object} Update Store Object. */ 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); store.dispatch = enhancedDispatch; return store; } /* harmony default export */ var store_middlewares = (applyMiddlewares); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/index.js /** * WordPress Dependencies */ /** * Internal dependencies */ /** * Module Constants */ var MODULE_KEY = 'core/editor'; var store_store = Object(external_this_wp_data_["registerStore"])(MODULE_KEY, { reducer: store_reducer, selectors: selectors_namespaceObject, actions: actions_namespaceObject, persist: ['preferences'] }); store_middlewares(store_store); /* harmony default export */ var build_module_store = (store_store); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js var esm_extends = __webpack_require__(18); // EXTERNAL MODULE: external {"this":["wp","element"]} var external_this_wp_element_ = __webpack_require__(0); // EXTERNAL MODULE: ./node_modules/classnames/index.js var classnames = __webpack_require__(17); var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); // EXTERNAL MODULE: external {"this":["wp","compose"]} var external_this_wp_compose_ = __webpack_require__(7); // EXTERNAL MODULE: external {"this":["wp","hooks"]} var external_this_wp_hooks_ = __webpack_require__(23); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js var classCallCheck = __webpack_require__(10); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js var createClass = __webpack_require__(9); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js var possibleConstructorReturn = __webpack_require__(12); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js var getPrototypeOf = __webpack_require__(13); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules var inherits = __webpack_require__(14); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js var assertThisInitialized = __webpack_require__(3); // EXTERNAL MODULE: external {"this":["wp","components"]} var external_this_wp_components_ = __webpack_require__(4); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-edit/context.js /** * External dependencies */ /** * WordPress dependencies */ var _createContext = Object(external_this_wp_element_["createContext"])({ name: '', isSelected: false, focusedElement: null, setFocusedElement: external_lodash_["noop"], clientId: null }), Consumer = _createContext.Consumer, context_Provider = _createContext.Provider; /** * A Higher Order Component used to inject BlockEdit context to the * wrapped component. * * @param {Function} mapContextToProps Function called on every context change, * expected to return object of props to * merge with the component's own props. * * @return {Component} Enhanced component with injected context as props. */ var context_withBlockEditContext = function withBlockEditContext(mapContextToProps) { return Object(external_this_wp_compose_["createHigherOrderComponent"])(function (OriginalComponent) { return function (props) { return Object(external_this_wp_element_["createElement"])(Consumer, null, function (context) { return Object(external_this_wp_element_["createElement"])(OriginalComponent, Object(esm_extends["a" /* default */])({}, props, mapContextToProps(context, props))); }); }; }, 'withBlockEditContext'); }; /** * A Higher Order Component used to render conditionally the wrapped * component only when the BlockEdit has selected state set. * * @param {Component} OriginalComponent Component to wrap. * * @return {Component} Component which renders only when the BlockEdit is selected. */ var ifBlockEditSelected = Object(external_this_wp_compose_["createHigherOrderComponent"])(function (OriginalComponent) { return function (props) { return Object(external_this_wp_element_["createElement"])(Consumer, null, function (_ref) { var isSelected = _ref.isSelected; return isSelected && Object(external_this_wp_element_["createElement"])(OriginalComponent, props); }); }; }, 'ifBlockEditSelected'); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocomplete/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /* * Use one array instance for fallback rather than inline array literals * because the latter may cause rerender due to failed prop equality checks. */ var completersFallback = []; /** * Wrap the default Autocomplete component with one that * supports a filter hook for customizing its list of autocompleters. * * Since there may be many Autocomplete instances at one time, this component * applies the filter on demand, when the component is first focused after * receiving a new list of completers. * * This function is exported for unit test. * * @param {Function} Autocomplete Original component. * @return {Function} Wrapped component */ function withFilteredAutocompleters(Autocomplete) { return ( /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(FilteredAutocomplete, _Component); function FilteredAutocomplete() { var _this; Object(classCallCheck["a" /* default */])(this, FilteredAutocomplete); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(FilteredAutocomplete).call(this)); _this.state = { completers: completersFallback }; _this.saveParentRef = _this.saveParentRef.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onFocus = _this.onFocus.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); return _this; } Object(createClass["a" /* default */])(FilteredAutocomplete, [{ key: "componentDidUpdate", value: function componentDidUpdate() { var hasFocus = this.parentNode.contains(document.activeElement); /* * It's possible for props to be updated when the component has focus, * so here, we ensure new completers are immediately applied while we * have the focus. * * NOTE: This may trigger another render but only when the component has focus. */ if (hasFocus && this.hasStaleCompleters()) { this.updateCompletersState(); } } }, { key: "onFocus", value: function onFocus() { if (this.hasStaleCompleters()) { this.updateCompletersState(); } } }, { key: "hasStaleCompleters", value: function hasStaleCompleters() { return !('lastFilteredCompletersProp' in this.state) || this.state.lastFilteredCompletersProp !== this.props.completers; } }, { key: "updateCompletersState", value: function updateCompletersState() { var _this$props = this.props, blockName = _this$props.blockName, completers = _this$props.completers; var nextCompleters = completers; var lastFilteredCompletersProp = nextCompleters; if (Object(external_this_wp_hooks_["hasFilter"])('editor.Autocomplete.completers')) { nextCompleters = Object(external_this_wp_hooks_["applyFilters"])('editor.Autocomplete.completers', // Provide copies so filters may directly modify them. nextCompleters && nextCompleters.map(external_lodash_["clone"]), blockName); } this.setState({ lastFilteredCompletersProp: lastFilteredCompletersProp, completers: nextCompleters || completersFallback }); } }, { key: "saveParentRef", value: function saveParentRef(parentNode) { this.parentNode = parentNode; } }, { key: "render", value: function render() { var completers = this.state.completers; var autocompleteProps = Object(objectSpread["a" /* default */])({}, this.props, { completers: completers }); return Object(external_this_wp_element_["createElement"])("div", { onFocus: this.onFocus, ref: this.saveParentRef }, Object(external_this_wp_element_["createElement"])(Autocomplete, Object(esm_extends["a" /* default */])({ onFocus: this.onFocus }, autocompleteProps))); } }]); return FilteredAutocomplete; }(external_this_wp_element_["Component"]) ); } /* harmony default export */ var autocomplete = (Object(external_this_wp_compose_["compose"])([context_withBlockEditContext(function (_ref) { var name = _ref.name; return { blockName: name }; }), withFilteredAutocompleters])(external_this_wp_components_["Autocomplete"])); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-icon/index.js /** * External dependencies */ /** * WordPress dependencies */ function BlockIcon(_ref) { var icon = _ref.icon, _ref$showColors = _ref.showColors, showColors = _ref$showColors === void 0 ? false : _ref$showColors, className = _ref.className; if (Object(external_lodash_["get"])(icon, ['src']) === 'block-default') { icon = { src: Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { d: "M19 7h-1V5h-4v2h-4V5H6v2H5c-1.1 0-2 .9-2 2v10h18V9c0-1.1-.9-2-2-2zm0 10H5V9h14v8z" })) }; } var renderedIcon = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Icon"], { icon: icon && icon.src ? icon.src : icon }); var style = showColors ? { backgroundColor: icon && icon.background, color: icon && icon.foreground } : {}; return Object(external_this_wp_element_["createElement"])("span", { style: style, className: classnames_default()('editor-block-icon', className, { 'has-colors': showColors }) }, renderedIcon); } // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/block.js /** * WordPress dependencies */ /** * Internal 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/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<Editor.InserterItem>} The inserter items for the specified * parent. */ function defaultGetInserterItems(rootClientId) { return Object(external_this_wp_data_["select"])('core/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/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"])(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()); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/user.js /** * WordPress dependencies */ /** * A user mentions completer. * * @type {Completer} */ /* harmony default export */ var autocompleters_user = ({ name: 'users', className: 'editor-autocompleters__user', triggerPrefix: '@', options: function options(search) { var payload = ''; if (search) { payload = '?search=' + encodeURIComponent(search); } return external_this_wp_apiFetch_default()({ path: '/core/users' + payload }); }, isDebounced: true, getOptionKeywords: function getOptionKeywords(user) { return [user.slug, user.name]; }, getOptionLabel: function getOptionLabel(user) { return [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", { key: "name", className: "editor-autocompleters__user-name" }, user.name), Object(external_this_wp_element_["createElement"])("span", { key: "slug", className: "editor-autocompleters__user-slug" }, user.slug)]; }, getOptionCompletion: function getOptionCompletion(user) { return "@".concat(user.slug); } }); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/index.js // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/alignment-toolbar/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var DEFAULT_ALIGNMENT_CONTROLS = [{ icon: 'editor-alignleft', title: Object(external_this_wp_i18n_["__"])('Align text left'), align: 'left' }, { icon: 'editor-aligncenter', title: Object(external_this_wp_i18n_["__"])('Align text center'), align: 'center' }, { icon: 'editor-alignright', title: Object(external_this_wp_i18n_["__"])('Align text right'), align: 'right' }]; function AlignmentToolbar(_ref) { var isCollapsed = _ref.isCollapsed, value = _ref.value, onChange = _ref.onChange, _ref$alignmentControl = _ref.alignmentControls, alignmentControls = _ref$alignmentControl === void 0 ? DEFAULT_ALIGNMENT_CONTROLS : _ref$alignmentControl; function applyOrUnset(align) { return function () { return onChange(value === align ? undefined : align); }; } var activeAlignment = Object(external_lodash_["find"])(alignmentControls, function (control) { return control.align === value; }); return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Toolbar"], { isCollapsed: isCollapsed, icon: activeAlignment ? activeAlignment.icon : 'editor-alignleft', label: Object(external_this_wp_i18n_["__"])('Change Text Alignment'), controls: alignmentControls.map(function (control) { var align = control.align; var isActive = value === align; return Object(objectSpread["a" /* default */])({}, control, { isActive: isActive, onClick: applyOrUnset(align) }); }) }); } /* harmony default export */ var alignment_toolbar = (Object(external_this_wp_compose_["compose"])(context_withBlockEditContext(function (_ref2) { var clientId = _ref2.clientId; return { clientId: clientId }; }), Object(external_this_wp_viewport_["withViewportMatch"])({ isLargeViewport: 'medium' }), Object(external_this_wp_data_["withSelect"])(function (select, _ref3) { var clientId = _ref3.clientId, isLargeViewport = _ref3.isLargeViewport, isCollapsed = _ref3.isCollapsed; var _select = select('core/editor'), getBlockRootClientId = _select.getBlockRootClientId, getEditorSettings = _select.getEditorSettings; return { isCollapsed: isCollapsed || !isLargeViewport || !getEditorSettings().hasFixedToolbar && getBlockRootClientId(clientId) }; }))(AlignmentToolbar)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-alignment-toolbar/index.js /** * WordPress dependencies */ /** * Internal dependencies */ var BLOCK_ALIGNMENTS_CONTROLS = { left: { icon: 'align-left', title: Object(external_this_wp_i18n_["__"])('Align left') }, center: { icon: 'align-center', title: Object(external_this_wp_i18n_["__"])('Align center') }, right: { icon: 'align-right', title: Object(external_this_wp_i18n_["__"])('Align right') }, wide: { icon: 'align-wide', title: Object(external_this_wp_i18n_["__"])('Wide width') }, full: { icon: 'align-full-width', title: Object(external_this_wp_i18n_["__"])('Full width') } }; var DEFAULT_CONTROLS = ['left', 'center', 'right', 'wide', 'full']; var WIDE_CONTROLS = ['wide', 'full']; function BlockAlignmentToolbar(_ref) { var isCollapsed = _ref.isCollapsed, value = _ref.value, onChange = _ref.onChange, _ref$controls = _ref.controls, controls = _ref$controls === void 0 ? DEFAULT_CONTROLS : _ref$controls, _ref$wideControlsEnab = _ref.wideControlsEnabled, wideControlsEnabled = _ref$wideControlsEnab === void 0 ? false : _ref$wideControlsEnab; function applyOrUnset(align) { return function () { return onChange(value === align ? undefined : align); }; } var enabledControls = wideControlsEnabled ? controls : controls.filter(function (control) { return WIDE_CONTROLS.indexOf(control) === -1; }); var activeAlignment = BLOCK_ALIGNMENTS_CONTROLS[value]; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Toolbar"], { isCollapsed: isCollapsed, icon: activeAlignment ? activeAlignment.icon : 'align-left', label: Object(external_this_wp_i18n_["__"])('Change Alignment'), controls: enabledControls.map(function (control) { return Object(objectSpread["a" /* default */])({}, BLOCK_ALIGNMENTS_CONTROLS[control], { isActive: value === control, onClick: applyOrUnset(control) }); }) }); } /* harmony default export */ var block_alignment_toolbar = (Object(external_this_wp_compose_["compose"])(context_withBlockEditContext(function (_ref2) { var clientId = _ref2.clientId; return { clientId: clientId }; }), Object(external_this_wp_viewport_["withViewportMatch"])({ isLargeViewport: 'medium' }), Object(external_this_wp_data_["withSelect"])(function (select, _ref3) { var clientId = _ref3.clientId, isLargeViewport = _ref3.isLargeViewport, isCollapsed = _ref3.isCollapsed; var _select = select('core/editor'), getBlockRootClientId = _select.getBlockRootClientId, getEditorSettings = _select.getEditorSettings; return { wideControlsEnabled: select('core/editor').getEditorSettings().alignWide, isCollapsed: isCollapsed || !isLargeViewport || !getEditorSettings().hasFixedToolbar && getBlockRootClientId(clientId) }; }))(BlockAlignmentToolbar)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-controls/index.js /** * WordPress dependencies */ /** * Internal dependencies */ var _createSlotFill = Object(external_this_wp_components_["createSlotFill"])('BlockControls'), Fill = _createSlotFill.Fill, Slot = _createSlotFill.Slot; var block_controls_BlockControlsFill = function BlockControlsFill(_ref) { var controls = _ref.controls, children = _ref.children; return Object(external_this_wp_element_["createElement"])(Fill, null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Toolbar"], { controls: controls }), children); }; var BlockControls = ifBlockEditSelected(block_controls_BlockControlsFill); BlockControls.Slot = Slot; /* harmony default export */ var block_controls = (BlockControls); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-edit/edit.js /** * External dependencies */ /** * WordPress dependencies */ var edit_Edit = function Edit(props) { var _props$attributes = props.attributes, attributes = _props$attributes === void 0 ? {} : _props$attributes, name = props.name; var blockType = Object(external_this_wp_blocks_["getBlockType"])(name); if (!blockType) { return null; } // Generate a class name for the block's editable form var generatedClassName = Object(external_this_wp_blocks_["hasBlockSupport"])(blockType, 'className', true) ? Object(external_this_wp_blocks_["getBlockDefaultClassName"])(name) : null; var className = classnames_default()(generatedClassName, attributes.className); // `edit` and `save` are functions or components describing the markup // with which a block is displayed. If `blockType` is valid, assign // them preferentially as the render value for the block. var Component = blockType.edit || blockType.save; return Object(external_this_wp_element_["createElement"])(Component, Object(esm_extends["a" /* default */])({}, props, { className: className })); }; /* harmony default export */ var edit = (Object(external_this_wp_components_["withFilters"])('editor.BlockEdit')(edit_Edit)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-edit/index.js /** * WordPress dependencies */ /** * Internal dependencies */ var block_edit_BlockEdit = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(BlockEdit, _Component); function BlockEdit(props) { var _this; Object(classCallCheck["a" /* default */])(this, BlockEdit); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(BlockEdit).call(this, props)); _this.setFocusedElement = _this.setFocusedElement.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.state = { focusedElement: null, setFocusedElement: _this.setFocusedElement }; return _this; } Object(createClass["a" /* default */])(BlockEdit, [{ key: "setFocusedElement", value: function setFocusedElement(focusedElement) { this.setState(function (prevState) { if (prevState.focusedElement === focusedElement) { return null; } return { focusedElement: focusedElement }; }); } }, { key: "render", value: function render() { return Object(external_this_wp_element_["createElement"])(context_Provider, { value: this.state }, Object(external_this_wp_element_["createElement"])(edit, this.props)); } }], [{ key: "getDerivedStateFromProps", value: function getDerivedStateFromProps(props) { var clientId = props.clientId, name = props.name, isSelected = props.isSelected; return { name: name, isSelected: isSelected, clientId: clientId }; } }]); return BlockEdit; }(external_this_wp_element_["Component"]); /* harmony default export */ var block_edit = (block_edit_BlockEdit); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-format-controls/index.js /** * WordPress dependencies */ /** * Internal dependencies */ var block_format_controls_createSlotFill = Object(external_this_wp_components_["createSlotFill"])('BlockFormatControls'), block_format_controls_Fill = block_format_controls_createSlotFill.Fill, block_format_controls_Slot = block_format_controls_createSlotFill.Slot; var BlockFormatControls = ifBlockEditSelected(block_format_controls_Fill); BlockFormatControls.Slot = block_format_controls_Slot; /* harmony default export */ var block_format_controls = (BlockFormatControls); // EXTERNAL MODULE: external {"this":["wp","keycodes"]} var external_this_wp_keycodes_ = __webpack_require__(16); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-navigation/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function BlockNavigationList(_ref) { var blocks = _ref.blocks, selectedBlockClientId = _ref.selectedBlockClientId, selectBlock = _ref.selectBlock, showNestedBlocks = _ref.showNestedBlocks; 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"])("ul", { className: "editor-block-navigation__list", role: "list" }, Object(external_lodash_["map"])(blocks, function (block) { var blockType = Object(external_this_wp_blocks_["getBlockType"])(block.name); var isSelected = block.clientId === selectedBlockClientId; return Object(external_this_wp_element_["createElement"])("li", { key: block.clientId }, Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-navigation__item" }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { className: classnames_default()('editor-block-navigation__item-button', { 'is-selected': block.clientId === selectedBlockClientId }), onClick: function onClick() { return selectBlock(block.clientId); }, isSelected: isSelected }, Object(external_this_wp_element_["createElement"])(BlockIcon, { icon: blockType.icon, showColors: true }), blockType.title, isSelected && Object(external_this_wp_element_["createElement"])("span", { className: "screen-reader-text" }, Object(external_this_wp_i18n_["__"])('(selected block)')))), showNestedBlocks && !!block.innerBlocks && !!block.innerBlocks.length && Object(external_this_wp_element_["createElement"])(BlockNavigationList, { blocks: block.innerBlocks, selectedBlockClientId: selectedBlockClientId, selectBlock: selectBlock, showNestedBlocks: true })); })) /* eslint-enable jsx-a11y/no-redundant-roles */ ); } function BlockNavigation(_ref2) { var rootBlock = _ref2.rootBlock, rootBlocks = _ref2.rootBlocks, selectedBlockClientId = _ref2.selectedBlockClientId, selectBlock = _ref2.selectBlock; if (!rootBlocks || rootBlocks.length === 0) { return null; } var hasHierarchy = rootBlock && (rootBlock.clientId !== selectedBlockClientId || rootBlock.innerBlocks && rootBlock.innerBlocks.length !== 0); return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["NavigableMenu"], { role: "presentation", className: "editor-block-navigation__container" }, Object(external_this_wp_element_["createElement"])("p", { className: "editor-block-navigation__label" }, Object(external_this_wp_i18n_["__"])('Block Navigation')), hasHierarchy && Object(external_this_wp_element_["createElement"])(BlockNavigationList, { blocks: [rootBlock], selectedBlockClientId: selectedBlockClientId, selectBlock: selectBlock, showNestedBlocks: true }), !hasHierarchy && Object(external_this_wp_element_["createElement"])(BlockNavigationList, { blocks: rootBlocks, selectedBlockClientId: selectedBlockClientId, selectBlock: selectBlock })); } /* harmony default export */ var block_navigation = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getSelectedBlockClientId = _select.getSelectedBlockClientId, getBlockHierarchyRootClientId = _select.getBlockHierarchyRootClientId, getBlock = _select.getBlock, getBlocks = _select.getBlocks; var selectedBlockClientId = getSelectedBlockClientId(); return { rootBlocks: getBlocks(), rootBlock: selectedBlockClientId ? getBlock(getBlockHierarchyRootClientId(selectedBlockClientId)) : null, selectedBlockClientId: selectedBlockClientId }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref3) { var _ref3$onSelect = _ref3.onSelect, onSelect = _ref3$onSelect === void 0 ? external_lodash_["noop"] : _ref3$onSelect; return { selectBlock: function selectBlock(clientId) { dispatch('core/editor').selectBlock(clientId); onSelect(clientId); } }; }))(BlockNavigation)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-navigation/dropdown.js /** * WordPress dependencies */ /** * Internal dependencies */ var MenuIcon = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "20", height: "20" }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { d: "M5 5H3v2h2V5zm3 8h11v-2H8v2zm9-8H6v2h11V5zM7 11H5v2h2v-2zm0 8h2v-2H7v2zm3-2v2h11v-2H10z" })); function BlockNavigationDropdown(_ref) { var hasBlocks = _ref.hasBlocks; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Dropdown"], { renderToggle: function renderToggle(_ref2) { var isOpen = _ref2.isOpen, onToggle = _ref2.onToggle; return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["KeyboardShortcuts"], { bindGlobal: true, shortcuts: Object(defineProperty["a" /* default */])({}, external_this_wp_keycodes_["rawShortcut"].access('o'), onToggle) }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { icon: MenuIcon, "aria-expanded": isOpen, onClick: hasBlocks ? onToggle : undefined, label: Object(external_this_wp_i18n_["__"])('Block Navigation'), className: "editor-block-navigation", shortcut: external_this_wp_keycodes_["displayShortcut"].access('o'), "aria-disabled": !hasBlocks })); }, renderContent: function renderContent(_ref4) { var onClose = _ref4.onClose; return Object(external_this_wp_element_["createElement"])(block_navigation, { onSelect: onClose }); } }); } /* harmony default export */ var dropdown = (Object(external_this_wp_data_["withSelect"])(function (select) { return { hasBlocks: !!select('core/editor').getBlockCount() }; })(BlockNavigationDropdown)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/color-palette/with-color-context.js /** * External dependencies */ /** * WordPress dependencies */ /* harmony default export */ var with_color_context = (Object(external_this_wp_compose_["createHigherOrderComponent"])(Object(external_this_wp_data_["withSelect"])(function (select, ownProps) { var settings = select('core/editor').getEditorSettings(); var colors = ownProps.colors === undefined ? settings.colors : ownProps.colors; var disableCustomColors = ownProps.disableCustomColors === undefined ? settings.disableCustomColors : ownProps.disableCustomColors; return { colors: colors, disableCustomColors: disableCustomColors, hasColorsToChoose: !Object(external_lodash_["isEmpty"])(colors) || !disableCustomColors }; }), 'withColorContext')); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/color-palette/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /* harmony default export */ var color_palette = (with_color_context(external_this_wp_components_["ColorPalette"])); // EXTERNAL MODULE: ./node_modules/tinycolor2/tinycolor.js var tinycolor = __webpack_require__(45); var tinycolor_default = /*#__PURE__*/__webpack_require__.n(tinycolor); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/colors/utils.js /** * External dependencies */ /** * Provided an array of color objects as set by the theme or by the editor defaults, * and the values of the defined color or custom color returns a color object describing the color. * * @param {Array} colors Array of color objects as set by the theme or by the editor defaults. * @param {?string} definedColor A string containing the color slug. * @param {?string} customColor A string containing the customColor value. * * @return {?string} If definedColor is passed and the name is found in colors, * the color object exactly as set by the theme or editor defaults is returned. * Otherwise, an object that just sets the color is defined. */ var utils_getColorObjectByAttributeValues = function getColorObjectByAttributeValues(colors, definedColor, customColor) { if (definedColor) { var colorObj = Object(external_lodash_["find"])(colors, { slug: definedColor }); if (colorObj) { return colorObj; } } return { color: customColor }; }; /** * Provided an array of color objects as set by the theme or by the editor defaults, and a color value returns the color object matching that value or undefined. * * @param {Array} colors Array of color objects as set by the theme or by the editor defaults. * @param {?string} colorValue A string containing the color value. * * @return {?string} Returns the color object included in the colors array whose color property equals colorValue. * Returns undefined if no color object matches this requirement. */ var utils_getColorObjectByColorValue = function getColorObjectByColorValue(colors, colorValue) { return Object(external_lodash_["find"])(colors, { color: colorValue }); }; /** * Returns a class based on the context a color is being used and its slug. * * @param {string} colorContextName Context/place where color is being used e.g: background, text etc... * @param {string} colorSlug Slug of the color. * * @return {string} String with the class corresponding to the color in the provided context. */ function getColorClassName(colorContextName, colorSlug) { if (!colorContextName || !colorSlug) { return; } return "has-".concat(Object(external_lodash_["kebabCase"])(colorSlug), "-").concat(colorContextName); } /** * Given an array of color objects and a color value returns the color value of the most readable color in the array. * * @param {Array} colors Array of color objects as set by the theme or by the editor defaults. * @param {?string} colorValue A string containing the color value. * * @return {string} String with the color value of the most readable color. */ function utils_getMostReadableColor(colors, colorValue) { return tinycolor_default.a.mostReadable(colorValue, Object(external_lodash_["map"])(colors, 'color')).toHexString(); } // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/colors/with-colors.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var DEFAULT_COLORS = []; /** * Higher-order component, which handles color logic for class generation * color value, retrieval and color attribute setting. * * @param {...(object|string)} args The arguments can be strings or objects. If the argument is an object, * it should contain the color attribute name as key and the color context as value. * If the argument is a string the value should be the color attribute name, * the color context is computed by applying a kebab case transform to the value. * Color context represents the context/place where the color is going to be used. * The class name of the color is generated using 'has' followed by the color name * and ending with the color context all in kebab case e.g: has-green-background-color. * * * @return {Function} Higher-order component. */ /* harmony default export */ var with_colors = (function () { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var colorMap = Object(external_lodash_["reduce"])(args, function (colorObject, arg) { return Object(objectSpread["a" /* default */])({}, colorObject, Object(external_lodash_["isString"])(arg) ? Object(defineProperty["a" /* default */])({}, arg, Object(external_lodash_["kebabCase"])(arg)) : arg); }, {}); return Object(external_this_wp_compose_["createHigherOrderComponent"])(Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { var settings = select('core/editor').getEditorSettings(); return { colors: Object(external_lodash_["get"])(settings, ['colors'], DEFAULT_COLORS) }; }), function (WrappedComponent) { return ( /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(_class, _Component); function _class(props) { var _this; Object(classCallCheck["a" /* default */])(this, _class); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(_class).call(this, props)); _this.setters = _this.createSetters(); _this.colorUtils = { getMostReadableColor: _this.getMostReadableColor.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))) }; _this.state = {}; return _this; } Object(createClass["a" /* default */])(_class, [{ key: "getMostReadableColor", value: function getMostReadableColor(colorValue) { var colors = this.props.colors; return utils_getMostReadableColor(colors, colorValue); } }, { key: "createSetters", value: function createSetters() { var _this2 = this; return Object(external_lodash_["reduce"])(colorMap, function (settersAccumulator, colorContext, colorAttributeName) { var upperFirstColorAttributeName = Object(external_lodash_["upperFirst"])(colorAttributeName); var customColorAttributeName = "custom".concat(upperFirstColorAttributeName); settersAccumulator["set".concat(upperFirstColorAttributeName)] = _this2.createSetColor(colorAttributeName, customColorAttributeName); return settersAccumulator; }, {}); } }, { key: "createSetColor", value: function createSetColor(colorAttributeName, customColorAttributeName) { var _this3 = this; return function (colorValue) { var _this3$props$setAttri; var colorObject = utils_getColorObjectByColorValue(_this3.props.colors, colorValue); _this3.props.setAttributes((_this3$props$setAttri = {}, Object(defineProperty["a" /* default */])(_this3$props$setAttri, colorAttributeName, colorObject && colorObject.slug ? colorObject.slug : undefined), Object(defineProperty["a" /* default */])(_this3$props$setAttri, customColorAttributeName, colorObject && colorObject.slug ? undefined : colorValue), _this3$props$setAttri)); }; } }, { key: "render", value: function render() { return Object(external_this_wp_element_["createElement"])(WrappedComponent, Object(objectSpread["a" /* default */])({}, this.props, { colors: undefined }, this.state, this.setters, { colorUtils: this.colorUtils })); } }], [{ key: "getDerivedStateFromProps", value: function getDerivedStateFromProps(_ref2, previousState) { var attributes = _ref2.attributes, colors = _ref2.colors; return Object(external_lodash_["reduce"])(colorMap, function (newState, colorContext, colorAttributeName) { var colorObject = utils_getColorObjectByAttributeValues(colors, attributes[colorAttributeName], attributes["custom".concat(Object(external_lodash_["upperFirst"])(colorAttributeName))]); var previousColorObject = previousState[colorAttributeName]; var previousColor = Object(external_lodash_["get"])(previousColorObject, ['color']); /** * The "and previousColorObject" condition checks that a previous color object was already computed. * At the start previousColorObject and colorValue are both equal to undefined * bus as previousColorObject does not exist we should compute the object. */ if (previousColor === colorObject.color && previousColorObject) { newState[colorAttributeName] = previousColorObject; } else { newState[colorAttributeName] = Object(objectSpread["a" /* default */])({}, colorObject, { class: getColorClassName(colorContext, colorObject.slug) }); } return newState; }, {}); } }]); return _class; }(external_this_wp_element_["Component"]) ); }]), 'withColors'); }); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/colors/index.js // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/contrast-checker/index.js /** * External dependencies */ /** * WordPress dependencies */ function ContrastChecker(_ref) { var backgroundColor = _ref.backgroundColor, fallbackBackgroundColor = _ref.fallbackBackgroundColor, fallbackTextColor = _ref.fallbackTextColor, fontSize = _ref.fontSize, isLargeText = _ref.isLargeText, textColor = _ref.textColor; if (!(backgroundColor || fallbackBackgroundColor) || !(textColor || fallbackTextColor)) { return null; } var tinyBackgroundColor = tinycolor_default()(backgroundColor || fallbackBackgroundColor); var tinyTextColor = tinycolor_default()(textColor || fallbackTextColor); var hasTransparency = tinyBackgroundColor.getAlpha() !== 1 || tinyTextColor.getAlpha() !== 1; if (hasTransparency || tinycolor_default.a.isReadable(tinyBackgroundColor, tinyTextColor, { level: 'AA', size: isLargeText || isLargeText !== false && fontSize >= 24 ? 'large' : 'small' })) { return null; } var msg = tinyBackgroundColor.getBrightness() < tinyTextColor.getBrightness() ? Object(external_this_wp_i18n_["__"])('This color combination may be hard for people to read. Try using a darker background color and/or a brighter text color.') : Object(external_this_wp_i18n_["__"])('This color combination may be hard for people to read. Try using a brighter background color and/or a darker text color.'); return Object(external_this_wp_element_["createElement"])("div", { className: "editor-contrast-checker" }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Notice"], { status: "warning", isDismissible: false }, msg)); } /* harmony default export */ var contrast_checker = (ContrastChecker); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/font-sizes/utils.js /** * External dependencies */ /** * Returns the font size object based on an array of named font sizes and the namedFontSize and customFontSize values. * If namedFontSize is undefined or not found in fontSizes an object with just the size value based on customFontSize is returned. * * @param {Array} fontSizes Array of font size objects containing at least the "name" and "size" values as properties. * @param {?string} fontSizeAttribute Content of the font size attribute (slug). * @param {?number} customFontSizeAttribute Contents of the custom font size attribute (value). * * @return {?string} If fontSizeAttribute is set and an equal slug is found in fontSizes it returns the font size object for that slug. * Otherwise, an object with just the size value based on customFontSize is returned. */ var utils_getFontSize = function getFontSize(fontSizes, fontSizeAttribute, customFontSizeAttribute) { if (fontSizeAttribute) { var fontSizeObject = Object(external_lodash_["find"])(fontSizes, { slug: fontSizeAttribute }); if (fontSizeObject) { return fontSizeObject; } } return { size: customFontSizeAttribute }; }; /** * Returns a class based on fontSizeName. * * @param {string} fontSizeSlug Slug of the fontSize. * * @return {string} String with the class corresponding to the fontSize passed. * The class is generated by appending 'has-' followed by fontSizeSlug in kebabCase and ending with '-font-size'. */ function getFontSizeClass(fontSizeSlug) { if (!fontSizeSlug) { return; } return "has-".concat(Object(external_lodash_["kebabCase"])(fontSizeSlug), "-font-size"); } // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/font-sizes/font-size-picker.js /** * WordPress dependencies */ /* harmony default export */ var font_size_picker = (Object(external_this_wp_data_["withSelect"])(function (select) { var _select$getEditorSett = select('core/editor').getEditorSettings(), disableCustomFontSizes = _select$getEditorSett.disableCustomFontSizes, fontSizes = _select$getEditorSett.fontSizes; return { disableCustomFontSizes: disableCustomFontSizes, fontSizes: fontSizes }; })(external_this_wp_components_["FontSizePicker"])); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/font-sizes/with-font-sizes.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Higher-order component, which handles font size logic for class generation, * font size value retrieval, and font size change handling. * * @param {...(object|string)} args The arguments should all be strings * Each string contains the font size attribute name e.g: 'fontSize'. * * @return {Function} Higher-order component. */ /* harmony default export */ var with_font_sizes = (function () { for (var _len = arguments.length, fontSizeNames = new Array(_len), _key = 0; _key < _len; _key++) { fontSizeNames[_key] = arguments[_key]; } /* * Computes an object whose key is the font size attribute name as passed in the array, * and the value is the custom font size attribute name. * Custom font size is automatically compted by appending custom followed by the font size attribute name in with the first letter capitalized. */ var fontSizeAttributeNames = Object(external_lodash_["reduce"])(fontSizeNames, function (fontSizeAttributeNamesAccumulator, fontSizeAttributeName) { fontSizeAttributeNamesAccumulator[fontSizeAttributeName] = "custom".concat(Object(external_lodash_["upperFirst"])(fontSizeAttributeName)); return fontSizeAttributeNamesAccumulator; }, {}); return Object(external_this_wp_compose_["createHigherOrderComponent"])(Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { var _select$getEditorSett = select('core/editor').getEditorSettings(), fontSizes = _select$getEditorSett.fontSizes; return { fontSizes: fontSizes }; }), function (WrappedComponent) { return ( /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(_class, _Component); function _class(props) { var _this; Object(classCallCheck["a" /* default */])(this, _class); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(_class).call(this, props)); _this.setters = _this.createSetters(); _this.state = {}; return _this; } Object(createClass["a" /* default */])(_class, [{ key: "createSetters", value: function createSetters() { var _this2 = this; return Object(external_lodash_["reduce"])(fontSizeAttributeNames, function (settersAccumulator, customFontSizeAttributeName, fontSizeAttributeName) { var upperFirstFontSizeAttributeName = Object(external_lodash_["upperFirst"])(fontSizeAttributeName); settersAccumulator["set".concat(upperFirstFontSizeAttributeName)] = _this2.createSetFontSize(fontSizeAttributeName, customFontSizeAttributeName); return settersAccumulator; }, {}); } }, { key: "createSetFontSize", value: function createSetFontSize(fontSizeAttributeName, customFontSizeAttributeName) { var _this3 = this; return function (fontSizeValue) { var _this3$props$setAttri; var fontSizeObject = Object(external_lodash_["find"])(_this3.props.fontSizes, { size: fontSizeValue }); _this3.props.setAttributes((_this3$props$setAttri = {}, Object(defineProperty["a" /* default */])(_this3$props$setAttri, fontSizeAttributeName, fontSizeObject && fontSizeObject.slug ? fontSizeObject.slug : undefined), Object(defineProperty["a" /* default */])(_this3$props$setAttri, customFontSizeAttributeName, fontSizeObject && fontSizeObject.slug ? undefined : fontSizeValue), _this3$props$setAttri)); }; } }, { key: "render", value: function render() { return Object(external_this_wp_element_["createElement"])(WrappedComponent, Object(objectSpread["a" /* default */])({}, this.props, { fontSizes: undefined }, this.state, this.setters)); } }], [{ key: "getDerivedStateFromProps", value: function getDerivedStateFromProps(_ref, previousState) { var attributes = _ref.attributes, fontSizes = _ref.fontSizes; var didAttributesChange = function didAttributesChange(customFontSizeAttributeName, fontSizeAttributeName) { if (previousState[fontSizeAttributeName]) { // if new font size is name compare with the previous slug if (attributes[fontSizeAttributeName]) { return attributes[fontSizeAttributeName] !== previousState[fontSizeAttributeName].slug; } // if font size is not named, update when the font size value changes. return previousState[fontSizeAttributeName].size !== attributes[customFontSizeAttributeName]; } // in this case we need to build the font size object return true; }; if (!Object(external_lodash_["some"])(fontSizeAttributeNames, didAttributesChange)) { return null; } var newState = Object(external_lodash_["reduce"])(Object(external_lodash_["pickBy"])(fontSizeAttributeNames, didAttributesChange), function (newStateAccumulator, customFontSizeAttributeName, fontSizeAttributeName) { var fontSizeAttributeValue = attributes[fontSizeAttributeName]; var fontSizeObject = utils_getFontSize(fontSizes, fontSizeAttributeValue, attributes[customFontSizeAttributeName]); newStateAccumulator[fontSizeAttributeName] = Object(objectSpread["a" /* default */])({}, fontSizeObject, { class: getFontSizeClass(fontSizeAttributeValue) }); return newStateAccumulator; }, {}); return Object(objectSpread["a" /* default */])({}, previousState, newState); } }]); return _class; }(external_this_wp_element_["Component"]) ); }]), 'withFontSizes'); }); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/font-sizes/index.js // EXTERNAL MODULE: external {"this":["wp","isShallowEqual"]} var external_this_wp_isShallowEqual_ = __webpack_require__(40); var external_this_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_isShallowEqual_); // EXTERNAL MODULE: external {"this":["wp","dom"]} var external_this_wp_dom_ = __webpack_require__(22); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-mover/mover-description.js /** * WordPress dependencies */ /** * Return a label for the block movement controls depending on block position. * * @param {number} selectedCount Number of blocks selected. * @param {string} type Block type - in the case of a single block, should * define its 'type'. I.e. 'Text', 'Heading', 'Image' etc. * @param {number} firstIndex The index (position - 1) of the first block selected. * @param {boolean} isFirst This is the first block. * @param {boolean} isLast This is the last block. * @param {number} dir Direction of movement (> 0 is considered to be going * down, < 0 is up). * * @return {string} Label for the block movement controls. */ function getBlockMoverDescription(selectedCount, type, firstIndex, isFirst, isLast, dir) { var position = firstIndex + 1; if (selectedCount > 1) { return getMultiBlockMoverDescription(selectedCount, firstIndex, isFirst, isLast, dir); } if (isFirst && isLast) { // translators: %s: Type of block (i.e. Text, Image etc) return Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["__"])('Block %s is the only block, and cannot be moved'), type); } if (dir > 0 && !isLast) { // moving down return Object(external_this_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position Object(external_this_wp_i18n_["__"])('Move %1$s block from position %2$d down to position %3$d'), type, position, position + 1); } if (dir > 0 && isLast) { // moving down, and is the last item // translators: %s: Type of block (i.e. Text, Image etc) return Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["__"])('Block %s is at the end of the content and can’t be moved down'), type); } if (dir < 0 && !isFirst) { // moving up return Object(external_this_wp_i18n_["sprintf"])( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position Object(external_this_wp_i18n_["__"])('Move %1$s block from position %2$d up to position %3$d'), type, position, position - 1); } if (dir < 0 && isFirst) { // moving up, and is the first item // translators: %s: Type of block (i.e. Text, Image etc) return Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["__"])('Block %s is at the beginning of the content and can’t be moved up'), type); } } /** * Return a label for the block movement controls depending on block position. * * @param {number} selectedCount Number of blocks selected. * @param {number} firstIndex The index (position - 1) of the first block selected. * @param {boolean} isFirst This is the first block. * @param {boolean} isLast This is the last block. * @param {number} dir Direction of movement (> 0 is considered to be going * down, < 0 is up). * * @return {string} Label for the block movement controls. */ function getMultiBlockMoverDescription(selectedCount, firstIndex, isFirst, isLast, dir) { var position = firstIndex + 1; if (dir < 0 && isFirst) { return Object(external_this_wp_i18n_["__"])('Blocks cannot be moved up as they are already at the top'); } if (dir > 0 && isLast) { return Object(external_this_wp_i18n_["__"])('Blocks cannot be moved down as they are already at the bottom'); } if (dir < 0 && !isFirst) { return Object(external_this_wp_i18n_["sprintf"])( // translators: 1: Number of selected blocks, 2: Position of selected blocks Object(external_this_wp_i18n_["_n"])('Move %1$d block from position %2$d up by one place', 'Move %1$d blocks from position %2$d up by one place', selectedCount), selectedCount, position); } if (dir > 0 && !isLast) { return Object(external_this_wp_i18n_["sprintf"])( // translators: 1: Number of selected blocks, 2: Position of selected blocks Object(external_this_wp_i18n_["_n"])('Move %1$d block from position %2$d down by one place', 'Move %1$d blocks from position %2$d down by one place', selectedCount), selectedCount, position); } } // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-mover/icons.js /** * WordPress dependencies */ var upArrow = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { width: "18", height: "18", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 18 18" }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Polygon"], { points: "9,4.5 3.3,10.1 4.8,11.5 9,7.3 13.2,11.5 14.7,10.1 " })); var downArrow = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { width: "18", height: "18", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 18 18" }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Polygon"], { points: "9,13.5 14.7,7.9 13.2,6.5 9,10.7 4.8,6.5 3.3,7.9 " })); var dragHandle = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { width: "18", height: "18", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 18 18" }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { d: "M13,8c0.6,0,1-0.4,1-1s-0.4-1-1-1s-1,0.4-1,1S12.4,8,13,8z M5,6C4.4,6,4,6.4,4,7s0.4,1,1,1s1-0.4,1-1S5.6,6,5,6z M5,10 c-0.6,0-1,0.4-1,1s0.4,1,1,1s1-0.4,1-1S5.6,10,5,10z M13,10c-0.6,0-1,0.4-1,1s0.4,1,1,1s1-0.4,1-1S13.6,10,13,10z M9,6 C8.4,6,8,6.4,8,7s0.4,1,1,1s1-0.4,1-1S9.6,6,9,6z M9,10c-0.6,0-1,0.4-1,1s0.4,1,1,1s1-0.4,1-1S9.6,10,9,10z" })); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-draggable/index.js /** * WordPress dependencies */ var block_draggable_BlockDraggable = function BlockDraggable(_ref) { var children = _ref.children, clientId = _ref.clientId, rootClientId = _ref.rootClientId, blockElementId = _ref.blockElementId, index = _ref.index, onDragStart = _ref.onDragStart, onDragEnd = _ref.onDragEnd; var transferData = { type: 'block', srcIndex: index, srcRootClientId: rootClientId, srcClientId: clientId }; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Draggable"], { elementId: blockElementId, transferData: transferData, onDragStart: onDragStart, onDragEnd: onDragEnd }, function (_ref2) { var onDraggableStart = _ref2.onDraggableStart, onDraggableEnd = _ref2.onDraggableEnd; return children({ onDraggableStart: onDraggableStart, onDraggableEnd: onDraggableEnd }); }); }; /* harmony default export */ var block_draggable = (Object(external_this_wp_data_["withSelect"])(function (select, _ref3) { var clientId = _ref3.clientId; var _select = select('core/editor'), getBlockIndex = _select.getBlockIndex, getBlockRootClientId = _select.getBlockRootClientId; return { index: getBlockIndex(clientId), rootClientId: getBlockRootClientId(clientId) }; })(block_draggable_BlockDraggable)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-mover/drag-handle.js /** * External dependencies */ /** * WordPress dependencies */ var drag_handle_IconDragHandle = function IconDragHandle(_ref) { var isVisible = _ref.isVisible, className = _ref.className, icon = _ref.icon, onDragStart = _ref.onDragStart, onDragEnd = _ref.onDragEnd, blockElementId = _ref.blockElementId, clientId = _ref.clientId; if (!isVisible) { return null; } var dragHandleClassNames = classnames_default()('editor-block-mover__control-drag-handle', className); return Object(external_this_wp_element_["createElement"])(block_draggable, { clientId: clientId, blockElementId: blockElementId, onDragStart: onDragStart, onDragEnd: onDragEnd }, function (_ref2) { var onDraggableStart = _ref2.onDraggableStart, onDraggableEnd = _ref2.onDraggableEnd; return Object(external_this_wp_element_["createElement"])("div", { className: dragHandleClassNames, "aria-hidden": "true", onDragStart: onDraggableStart, onDragEnd: onDraggableEnd, draggable: true }, icon); }); }; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-mover/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var block_mover_BlockMover = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(BlockMover, _Component); function BlockMover() { var _this; Object(classCallCheck["a" /* default */])(this, BlockMover); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(BlockMover).apply(this, arguments)); _this.state = { isFocused: false }; _this.onFocus = _this.onFocus.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onBlur = _this.onBlur.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); return _this; } Object(createClass["a" /* default */])(BlockMover, [{ key: "onFocus", value: function onFocus() { this.setState({ isFocused: true }); } }, { key: "onBlur", value: function onBlur() { this.setState({ isFocused: false }); } }, { key: "render", value: function render() { var _this$props = this.props, onMoveUp = _this$props.onMoveUp, onMoveDown = _this$props.onMoveDown, isFirst = _this$props.isFirst, isLast = _this$props.isLast, isDraggable = _this$props.isDraggable, onDragStart = _this$props.onDragStart, onDragEnd = _this$props.onDragEnd, clientIds = _this$props.clientIds, blockElementId = _this$props.blockElementId, blockType = _this$props.blockType, firstIndex = _this$props.firstIndex, isLocked = _this$props.isLocked, instanceId = _this$props.instanceId, isHidden = _this$props.isHidden; var isFocused = this.state.isFocused; var blocksCount = Object(external_lodash_["castArray"])(clientIds).length; if (isLocked || isFirst && isLast) { return null; } // We emulate a disabled state because forcefully applying the `disabled` // attribute on the button while it has focus causes the screen to change // to an unfocused state (body as active element) without firing blur on, // the rendering parent, leaving it unable to react to focus out. return Object(external_this_wp_element_["createElement"])("div", { className: classnames_default()('editor-block-mover', { 'is-visible': isFocused || !isHidden }) }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { className: "editor-block-mover__control", onClick: isFirst ? null : onMoveUp, icon: upArrow, label: Object(external_this_wp_i18n_["__"])('Move up'), "aria-describedby": "editor-block-mover__up-description-".concat(instanceId), "aria-disabled": isFirst, onFocus: this.onFocus, onBlur: this.onBlur }), Object(external_this_wp_element_["createElement"])(drag_handle_IconDragHandle, { className: "editor-block-mover__control", icon: dragHandle, clientId: clientIds, blockElementId: blockElementId, isVisible: isDraggable, onDragStart: onDragStart, onDragEnd: onDragEnd }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { className: "editor-block-mover__control", onClick: isLast ? null : onMoveDown, icon: downArrow, label: Object(external_this_wp_i18n_["__"])('Move down'), "aria-describedby": "editor-block-mover__down-description-".concat(instanceId), "aria-disabled": isLast, onFocus: this.onFocus, onBlur: this.onBlur }), Object(external_this_wp_element_["createElement"])("span", { id: "editor-block-mover__up-description-".concat(instanceId), className: "editor-block-mover__description" }, getBlockMoverDescription(blocksCount, blockType && blockType.title, firstIndex, isFirst, isLast, -1)), Object(external_this_wp_element_["createElement"])("span", { id: "editor-block-mover__down-description-".concat(instanceId), className: "editor-block-mover__description" }, getBlockMoverDescription(blocksCount, blockType && blockType.title, firstIndex, isFirst, isLast, 1))); } }]); return BlockMover; }(external_this_wp_element_["Component"]); /* harmony default export */ var block_mover = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select, _ref) { var clientIds = _ref.clientIds; var _select = select('core/editor'), getBlock = _select.getBlock, getBlockIndex = _select.getBlockIndex, getTemplateLock = _select.getTemplateLock, getBlockRootClientId = _select.getBlockRootClientId; var firstClientId = Object(external_lodash_["first"])(Object(external_lodash_["castArray"])(clientIds)); var block = getBlock(firstClientId); var rootClientId = getBlockRootClientId(Object(external_lodash_["first"])(Object(external_lodash_["castArray"])(clientIds))); return { firstIndex: getBlockIndex(firstClientId, rootClientId), blockType: block ? Object(external_this_wp_blocks_["getBlockType"])(block.name) : null, isLocked: getTemplateLock(rootClientId) === 'all', rootClientId: rootClientId }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref2) { var clientIds = _ref2.clientIds, rootClientId = _ref2.rootClientId; var _dispatch = dispatch('core/editor'), moveBlocksDown = _dispatch.moveBlocksDown, moveBlocksUp = _dispatch.moveBlocksUp; return { onMoveDown: Object(external_lodash_["partial"])(moveBlocksDown, clientIds, rootClientId), onMoveUp: Object(external_lodash_["partial"])(moveBlocksUp, clientIds, rootClientId) }; }), external_this_wp_compose_["withInstanceId"])(block_mover_BlockMover)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/media-upload/check.js /** * WordPress dependencies */ function MediaUploadCheck(_ref) { var hasUploadPermissions = _ref.hasUploadPermissions, _ref$fallback = _ref.fallback, fallback = _ref$fallback === void 0 ? null : _ref$fallback, children = _ref.children; return hasUploadPermissions ? children : fallback; } /* harmony default export */ var check = (Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core'), hasUploadPermissions = _select.hasUploadPermissions; return { hasUploadPermissions: hasUploadPermissions() }; })(MediaUploadCheck)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-drop-zone/index.js /** * External Dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var parseDropEvent = function parseDropEvent(event) { var result = { srcRootClientId: null, srcClientId: null, srcIndex: null, type: null }; if (!event.dataTransfer) { return result; } try { result = Object.assign(result, JSON.parse(event.dataTransfer.getData('text'))); } catch (err) { return result; } return result; }; var block_drop_zone_BlockDropZone = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(BlockDropZone, _Component); function BlockDropZone() { var _this; Object(classCallCheck["a" /* default */])(this, BlockDropZone); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(BlockDropZone).apply(this, arguments)); _this.onFilesDrop = _this.onFilesDrop.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onHTMLDrop = _this.onHTMLDrop.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onDrop = _this.onDrop.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); return _this; } Object(createClass["a" /* default */])(BlockDropZone, [{ key: "getInsertIndex", value: function getInsertIndex(position) { var index = this.props.index; if (index !== undefined) { return position.y === 'top' ? index : index + 1; } } }, { key: "onFilesDrop", value: function onFilesDrop(files, position) { var transformation = Object(external_this_wp_blocks_["findTransform"])(Object(external_this_wp_blocks_["getBlockTransforms"])('from'), function (transform) { return transform.type === 'files' && transform.isMatch(files); }); if (transformation) { var insertIndex = this.getInsertIndex(position); var blocks = transformation.transform(files, this.props.updateBlockAttributes); this.props.insertBlocks(blocks, insertIndex); } } }, { key: "onHTMLDrop", value: function onHTMLDrop(HTML, position) { var blocks = Object(external_this_wp_blocks_["pasteHandler"])({ HTML: HTML, mode: 'BLOCKS' }); if (blocks.length) { this.props.insertBlocks(blocks, this.getInsertIndex(position)); } } }, { key: "onDrop", value: function onDrop(event, position) { var _this$props = this.props, dstRootClientId = _this$props.rootClientId, dstClientId = _this$props.clientId, dstIndex = _this$props.index, getClientIdsOfDescendants = _this$props.getClientIdsOfDescendants; var _parseDropEvent = parseDropEvent(event), srcRootClientId = _parseDropEvent.srcRootClientId, srcClientId = _parseDropEvent.srcClientId, srcIndex = _parseDropEvent.srcIndex, type = _parseDropEvent.type; var isBlockDropType = function isBlockDropType(dropType) { return dropType === 'block'; }; var isSameLevel = function isSameLevel(srcRoot, dstRoot) { // Note that rootClientId of top-level blocks will be undefined OR a void string, // so we also need to account for that case separately. return srcRoot === dstRoot || !srcRoot === true && !dstRoot === true; }; var isSameBlock = function isSameBlock(src, dst) { return src === dst; }; var isSrcBlockAnAncestorOfDstBlock = function isSrcBlockAnAncestorOfDstBlock(src, dst) { return getClientIdsOfDescendants([src]).some(function (id) { return id === dst; }); }; if (!isBlockDropType(type) || isSameBlock(srcClientId, dstClientId) || isSrcBlockAnAncestorOfDstBlock(srcClientId, dstClientId)) { return; } var positionIndex = this.getInsertIndex(position); // If the block is kept at the same level and moved downwards, // subtract to account for blocks shifting upward to occupy its old position. var insertIndex = dstIndex && srcIndex < dstIndex && isSameLevel(srcRootClientId, dstRootClientId) ? positionIndex - 1 : positionIndex; this.props.moveBlockToPosition(srcClientId, srcRootClientId, insertIndex); } }, { key: "render", value: function render() { var _this$props2 = this.props, isLocked = _this$props2.isLocked, index = _this$props2.index; if (isLocked) { return null; } var isAppender = index === undefined; return Object(external_this_wp_element_["createElement"])(check, null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["DropZone"], { className: classnames_default()('editor-block-drop-zone', { 'is-appender': isAppender }), onFilesDrop: this.onFilesDrop, onHTMLDrop: this.onHTMLDrop, onDrop: this.onDrop })); } }]); return BlockDropZone; }(external_this_wp_element_["Component"]); /* harmony default export */ var block_drop_zone = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withDispatch"])(function (dispatch, ownProps) { var _dispatch = dispatch('core/editor'), _insertBlocks = _dispatch.insertBlocks, _updateBlockAttributes = _dispatch.updateBlockAttributes, _moveBlockToPosition = _dispatch.moveBlockToPosition; return { insertBlocks: function insertBlocks(blocks, index) { var rootClientId = ownProps.rootClientId; _insertBlocks(blocks, index, rootClientId); }, updateBlockAttributes: function updateBlockAttributes() { _updateBlockAttributes.apply(void 0, arguments); }, moveBlockToPosition: function moveBlockToPosition(srcClientId, srcRootClientId, dstIndex) { var dstRootClientId = ownProps.rootClientId; _moveBlockToPosition(srcClientId, srcRootClientId, dstRootClientId, dstIndex); } }; }), Object(external_this_wp_data_["withSelect"])(function (select, _ref) { var rootClientId = _ref.rootClientId; var _select = select('core/editor'), getClientIdsOfDescendants = _select.getClientIdsOfDescendants, getTemplateLock = _select.getTemplateLock; return { isLocked: !!getTemplateLock(rootClientId), getClientIdsOfDescendants: getClientIdsOfDescendants }; }), Object(external_this_wp_components_["withFilters"])('editor.BlockDropZone'))(block_drop_zone_BlockDropZone)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/warning/index.js /** * External dependencies */ /** * WordPress dependencies */ function Warning(_ref) { var className = _ref.className, actions = _ref.actions, children = _ref.children, secondaryActions = _ref.secondaryActions; return Object(external_this_wp_element_["createElement"])("div", { className: classnames_default()(className, 'editor-warning') }, Object(external_this_wp_element_["createElement"])("div", { className: "editor-warning__contents" }, Object(external_this_wp_element_["createElement"])("p", { className: "editor-warning__message" }, children), external_this_wp_element_["Children"].count(actions) > 0 && Object(external_this_wp_element_["createElement"])("div", { className: "editor-warning__actions" }, external_this_wp_element_["Children"].map(actions, function (action, i) { return Object(external_this_wp_element_["createElement"])("span", { key: i, className: "editor-warning__action" }, action); }))), secondaryActions && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Dropdown"], { className: "editor-warning__secondary", position: "bottom left", renderToggle: function renderToggle(_ref2) { var isOpen = _ref2.isOpen, onToggle = _ref2.onToggle; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { icon: "ellipsis", label: Object(external_this_wp_i18n_["__"])('More options'), onClick: onToggle, "aria-expanded": isOpen }); }, renderContent: function renderContent() { return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuGroup"], { label: Object(external_this_wp_i18n_["__"])('More options') }, secondaryActions.map(function (item, pos) { return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], { onClick: item.onClick, key: pos }, item.title); })); } })); } /* harmony default export */ var warning = (Warning); // EXTERNAL MODULE: ./node_modules/diff/dist/diff.js var diff = __webpack_require__(191); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-compare/block-view.js /** * WordPress dependencies */ var block_view_BlockView = function BlockView(_ref) { var title = _ref.title, rawContent = _ref.rawContent, renderedContent = _ref.renderedContent, action = _ref.action, actionText = _ref.actionText, className = _ref.className; return Object(external_this_wp_element_["createElement"])("div", { className: className }, Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-compare__content" }, Object(external_this_wp_element_["createElement"])("h2", { className: "editor-block-compare__heading" }, title), Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-compare__html" }, rawContent), Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-compare__preview edit-post-visual-editor" }, renderedContent)), Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-compare__action" }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { isLarge: true, tabIndex: "0", onClick: action }, actionText))); }; /* harmony default export */ var block_view = (block_view_BlockView); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-compare/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var block_compare_BlockCompare = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(BlockCompare, _Component); function BlockCompare() { Object(classCallCheck["a" /* default */])(this, BlockCompare); return Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(BlockCompare).apply(this, arguments)); } Object(createClass["a" /* default */])(BlockCompare, [{ key: "getDifference", value: function getDifference(originalContent, newContent) { var difference = Object(diff["diffChars"])(originalContent, newContent); return difference.map(function (item, pos) { var classes = classnames_default()({ 'editor-block-compare__added': item.added, 'editor-block-compare__removed': item.removed }); return Object(external_this_wp_element_["createElement"])("span", { key: pos, className: classes }, item.value); }); } }, { key: "getOriginalContent", value: function getOriginalContent(block) { return { rawContent: block.originalContent, renderedContent: Object(external_this_wp_blocks_["getSaveElement"])(block.name, block.attributes) }; } }, { key: "getConvertedContent", value: function getConvertedContent(block) { // The convertor may return an array of items or a single item var newBlocks = Object(external_lodash_["castArray"])(block); // Get converted block details var newContent = newBlocks.map(function (item) { return Object(external_this_wp_blocks_["getSaveContent"])(item.name, item.attributes, item.innerBlocks); }); var renderedContent = newBlocks.map(function (item) { return Object(external_this_wp_blocks_["getSaveElement"])(item.name, item.attributes, item.innerBlocks); }); return { rawContent: newContent.join(''), renderedContent: renderedContent }; } }, { key: "render", value: function render() { var _this$props = this.props, block = _this$props.block, onKeep = _this$props.onKeep, onConvert = _this$props.onConvert, convertor = _this$props.convertor, convertButtonText = _this$props.convertButtonText; var original = this.getOriginalContent(block); var converted = this.getConvertedContent(convertor(block)); var difference = this.getDifference(original.rawContent, converted.rawContent); return Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-compare__wrapper" }, Object(external_this_wp_element_["createElement"])(block_view, { title: Object(external_this_wp_i18n_["__"])('Current'), className: "editor-block-compare__current", action: onKeep, actionText: Object(external_this_wp_i18n_["__"])('Convert to HTML'), rawContent: original.rawContent, renderedContent: original.renderedContent }), Object(external_this_wp_element_["createElement"])(block_view, { title: Object(external_this_wp_i18n_["__"])('After Conversion'), className: "editor-block-compare__converted", action: onConvert, actionText: convertButtonText, rawContent: difference, renderedContent: converted.renderedContent })); } }]); return BlockCompare; }(external_this_wp_element_["Component"]); /* harmony default export */ var block_compare = (block_compare_BlockCompare); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-list/block-invalid-warning.js /** * WordPress dependencies */ /** * Internal dependencies */ var block_invalid_warning_BlockInvalidWarning = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(BlockInvalidWarning, _Component); function BlockInvalidWarning(props) { var _this; Object(classCallCheck["a" /* default */])(this, BlockInvalidWarning); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(BlockInvalidWarning).call(this, props)); _this.state = { compare: false }; _this.onCompare = _this.onCompare.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onCompareClose = _this.onCompareClose.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); return _this; } Object(createClass["a" /* default */])(BlockInvalidWarning, [{ key: "onCompare", value: function onCompare() { this.setState({ compare: true }); } }, { key: "onCompareClose", value: function onCompareClose() { this.setState({ compare: false }); } }, { key: "render", value: function render() { var _this$props = this.props, convertToHTML = _this$props.convertToHTML, convertToBlocks = _this$props.convertToBlocks, convertToClassic = _this$props.convertToClassic, block = _this$props.block; var hasHTMLBlock = !!Object(external_this_wp_blocks_["getBlockType"])('core/html'); var compare = this.state.compare; var hiddenActions = [{ title: Object(external_this_wp_i18n_["__"])('Convert to Classic Block'), onClick: convertToClassic }]; if (compare) { return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Modal"], { title: // translators: Dialog title to fix block content Object(external_this_wp_i18n_["__"])('Resolve Block'), onRequestClose: this.onCompareClose, className: "editor-block-compare" }, Object(external_this_wp_element_["createElement"])(block_compare, { block: block, onKeep: convertToHTML, onConvert: convertToBlocks, convertor: block_invalid_warning_blockToBlocks, convertButtonText: Object(external_this_wp_i18n_["__"])('Convert to Blocks') })); } return Object(external_this_wp_element_["createElement"])(warning, { actions: [Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { key: "convert", onClick: this.onCompare, isLarge: true, isPrimary: !hasHTMLBlock }, // translators: Button to fix block content Object(external_this_wp_i18n_["_x"])('Resolve', 'imperative verb')), hasHTMLBlock && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { key: "edit", onClick: convertToHTML, isLarge: true, isPrimary: true }, Object(external_this_wp_i18n_["__"])('Convert to HTML'))], secondaryActions: hiddenActions }, Object(external_this_wp_i18n_["__"])('This block contains unexpected or invalid content.')); } }]); return BlockInvalidWarning; }(external_this_wp_element_["Component"]); var block_invalid_warning_blockToClassic = function blockToClassic(block) { return Object(external_this_wp_blocks_["createBlock"])('core/freeform', { content: block.originalContent }); }; var block_invalid_warning_blockToHTML = function blockToHTML(block) { return Object(external_this_wp_blocks_["createBlock"])('core/html', { content: block.originalContent }); }; var block_invalid_warning_blockToBlocks = function blockToBlocks(block) { return Object(external_this_wp_blocks_["rawHandler"])({ HTML: block.originalContent }); }; /* harmony default export */ var block_invalid_warning = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref) { var clientId = _ref.clientId; return { block: select('core/editor').getBlock(clientId) }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref2) { var block = _ref2.block; var _dispatch = dispatch('core/editor'), replaceBlock = _dispatch.replaceBlock; return { convertToClassic: function convertToClassic() { replaceBlock(block.clientId, block_invalid_warning_blockToClassic(block)); }, convertToHTML: function convertToHTML() { replaceBlock(block.clientId, block_invalid_warning_blockToHTML(block)); }, convertToBlocks: function convertToBlocks() { replaceBlock(block.clientId, block_invalid_warning_blockToBlocks(block)); } }; })])(block_invalid_warning_BlockInvalidWarning)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-list/block-crash-warning.js /** * WordPress dependencies */ /** * Internal dependencies */ var block_crash_warning_warning = Object(external_this_wp_element_["createElement"])(warning, null, Object(external_this_wp_i18n_["__"])('This block has encountered an error and cannot be previewed.')); /* harmony default export */ var block_crash_warning = (function () { return block_crash_warning_warning; }); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-list/block-crash-boundary.js /** * WordPress dependencies */ var block_crash_boundary_BlockCrashBoundary = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(BlockCrashBoundary, _Component); function BlockCrashBoundary() { var _this; Object(classCallCheck["a" /* default */])(this, BlockCrashBoundary); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(BlockCrashBoundary).apply(this, arguments)); _this.state = { hasError: false }; return _this; } Object(createClass["a" /* default */])(BlockCrashBoundary, [{ key: "componentDidCatch", value: function componentDidCatch(error) { this.props.onError(error); this.setState({ hasError: true }); } }, { key: "render", value: function render() { if (this.state.hasError) { return null; } return this.props.children; } }]); return BlockCrashBoundary; }(external_this_wp_element_["Component"]); /* harmony default export */ var block_crash_boundary = (block_crash_boundary_BlockCrashBoundary); // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js var react_autosize_textarea_lib = __webpack_require__(55); var react_autosize_textarea_lib_default = /*#__PURE__*/__webpack_require__.n(react_autosize_textarea_lib); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-list/block-html.js /** * External Dependencies */ /** * WordPress Dependencies */ var block_html_BlockHTML = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(BlockHTML, _Component); function BlockHTML(props) { var _this; Object(classCallCheck["a" /* default */])(this, BlockHTML); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(BlockHTML).apply(this, arguments)); _this.onChange = _this.onChange.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onBlur = _this.onBlur.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.state = { html: props.block.isValid ? Object(external_this_wp_blocks_["getBlockContent"])(props.block) : props.block.originalContent }; return _this; } Object(createClass["a" /* default */])(BlockHTML, [{ key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { if (!Object(external_lodash_["isEqual"])(this.props.block.attributes, prevProps.block.attributes)) { this.setState({ html: Object(external_this_wp_blocks_["getBlockContent"])(this.props.block) }); } } }, { key: "onBlur", value: function onBlur() { var html = this.state.html; var blockType = Object(external_this_wp_blocks_["getBlockType"])(this.props.block.name); var attributes = Object(external_this_wp_blocks_["getBlockAttributes"])(blockType, html, this.props.block.attributes); // If html is empty we reset the block to the default HTML and mark it as valid to avoid triggering an error var content = html ? html : Object(external_this_wp_blocks_["getSaveContent"])(blockType, attributes); var isValid = html ? Object(external_this_wp_blocks_["isValidBlockContent"])(blockType, attributes, content) : true; this.props.onChange(this.props.clientId, attributes, content, isValid); // Ensure the state is updated if we reset so it displays the default content if (!html) { this.setState({ html: content }); } } }, { key: "onChange", value: function onChange(event) { this.setState({ html: event.target.value }); } }, { key: "render", value: function render() { var html = this.state.html; return Object(external_this_wp_element_["createElement"])(react_autosize_textarea_lib_default.a, { className: "editor-block-list__block-html-textarea", value: html, onBlur: this.onBlur, onChange: this.onChange }); } }]); return BlockHTML; }(external_this_wp_element_["Component"]); /* harmony default export */ var block_html = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, ownProps) { return { block: select('core/editor').getBlock(ownProps.clientId) }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { return { onChange: function onChange(clientId, attributes, originalContent, isValid) { dispatch('core/editor').updateBlock(clientId, { attributes: attributes, originalContent: originalContent, isValid: isValid }); } }; })])(block_html_BlockHTML)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-title/index.js /** * WordPress dependencies */ /** * Renders the block's configured title as a string, or empty if the title * cannot be determined. * * @example * * ```jsx * <BlockTitle clientId="afd1cb17-2c08-4e7a-91be-007ba7ddc3a1" /> * ``` * * @param {?string} props.name Block name. * * @return {?string} Block title. */ function BlockTitle(_ref) { var name = _ref.name; if (!name) { return null; } var blockType = Object(external_this_wp_blocks_["getBlockType"])(name); if (!blockType) { return null; } return blockType.title; } /* harmony default export */ var block_title = (Object(external_this_wp_data_["withSelect"])(function (select, ownProps) { var _select = select('core/editor'), getBlockName = _select.getBlockName; var clientId = ownProps.clientId; return { name: getBlockName(clientId) }; })(BlockTitle)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-list/breadcrumb.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Block breadcrumb component, displaying the label of the block. If the block * descends from a root block, a button is displayed enabling the user to select * the root block. * * @param {string} props.clientId Client ID of block. * @param {string} props.rootClientId Client ID of block's root. * @param {Function} props.selectRootBlock Callback to select root block. */ var breadcrumb_BlockBreadcrumb = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(BlockBreadcrumb, _Component); function BlockBreadcrumb() { var _this; Object(classCallCheck["a" /* default */])(this, BlockBreadcrumb); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(BlockBreadcrumb).apply(this, arguments)); _this.state = { isFocused: false }; _this.onFocus = _this.onFocus.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onBlur = _this.onBlur.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); return _this; } Object(createClass["a" /* default */])(BlockBreadcrumb, [{ key: "onFocus", value: function onFocus(event) { this.setState({ isFocused: true }); // This is used for improved interoperability // with the block's `onFocus` handler which selects the block, thus conflicting // with the intention to select the root block. event.stopPropagation(); } }, { key: "onBlur", value: function onBlur() { this.setState({ isFocused: false }); } }, { key: "render", value: function render() { var _this$props = this.props, clientId = _this$props.clientId, rootClientId = _this$props.rootClientId; return Object(external_this_wp_element_["createElement"])("div", { className: 'editor-block-list__breadcrumb' }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Toolbar"], null, rootClientId && Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(block_title, { clientId: rootClientId }), Object(external_this_wp_element_["createElement"])("span", { className: "editor-block-list__descendant-arrow" })), Object(external_this_wp_element_["createElement"])(block_title, { clientId: clientId }))); } }]); return BlockBreadcrumb; }(external_this_wp_element_["Component"]); /* harmony default export */ var breadcrumb = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, ownProps) { var _select = select('core/editor'), getBlockRootClientId = _select.getBlockRootClientId; var clientId = ownProps.clientId; return { rootClientId: getBlockRootClientId(clientId) }; })])(breadcrumb_BlockBreadcrumb)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/navigable-toolbar/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Browser dependencies */ var _window = window, Node = _window.Node, getSelection = _window.getSelection; var navigable_toolbar_NavigableToolbar = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(NavigableToolbar, _Component); function NavigableToolbar() { var _this; Object(classCallCheck["a" /* default */])(this, NavigableToolbar); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(NavigableToolbar).apply(this, arguments)); _this.focusToolbar = _this.focusToolbar.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.focusSelection = _this.focusSelection.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.switchOnKeyDown = Object(external_lodash_["cond"])([[Object(external_lodash_["matchesProperty"])(['keyCode'], external_this_wp_keycodes_["ESCAPE"]), _this.focusSelection]]); _this.toolbar = Object(external_this_wp_element_["createRef"])(); return _this; } Object(createClass["a" /* default */])(NavigableToolbar, [{ key: "focusToolbar", value: function focusToolbar() { var tabbables = external_this_wp_dom_["focus"].tabbable.find(this.toolbar.current); if (tabbables.length) { tabbables[0].focus(); } } /** * Programmatically shifts focus to the element where the current selection * exists, if there is a selection. */ }, { key: "focusSelection", value: function focusSelection() { // Ensure that a selection exists. var selection = getSelection(); if (!selection) { return; } // Focus node may be a text node, which cannot be focused directly. // Find its parent element instead. var focusNode = selection.focusNode; var focusElement = focusNode; if (focusElement.nodeType !== Node.ELEMENT_NODE) { focusElement = focusElement.parentElement; } if (focusElement) { focusElement.focus(); } } }, { key: "componentDidMount", value: function componentDidMount() { if (this.props.focusOnMount) { this.focusToolbar(); } } }, { key: "render", value: function render() { var _this$props = this.props, children = _this$props.children, props = Object(objectWithoutProperties["a" /* default */])(_this$props, ["children"]); return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["NavigableMenu"], Object(esm_extends["a" /* default */])({ orientation: "horizontal", role: "toolbar", ref: this.toolbar, onKeyDown: this.switchOnKeyDown }, Object(external_lodash_["omit"])(props, ['focusOnMount'])), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["KeyboardShortcuts"], { bindGlobal: true // Use the same event that TinyMCE uses in the Classic block for its own `alt+f10` shortcut. , eventName: "keydown", shortcuts: { 'alt+f10': this.focusToolbar } }), children); } }]); return NavigableToolbar; }(external_this_wp_element_["Component"]); /* harmony default export */ var navigable_toolbar = (navigable_toolbar_NavigableToolbar); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-list/block-contextual-toolbar.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockContextualToolbar(_ref) { var focusOnMount = _ref.focusOnMount; return Object(external_this_wp_element_["createElement"])(navigable_toolbar, { focusOnMount: focusOnMount, className: "editor-block-contextual-toolbar" /* translators: accessibility text for the block toolbar */ , "aria-label": Object(external_this_wp_i18n_["__"])('Block tools') }, Object(external_this_wp_element_["createElement"])(block_toolbar, null)); } /* harmony default export */ var block_contextual_toolbar = (BlockContextualToolbar); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-list/multi-controls.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function BlockListMultiControls(_ref) { var multiSelectedBlockClientIds = _ref.multiSelectedBlockClientIds, clientId = _ref.clientId, isSelecting = _ref.isSelecting, isFirst = _ref.isFirst, isLast = _ref.isLast; if (isSelecting) { return null; } return Object(external_this_wp_element_["createElement"])(block_mover, { key: "mover", clientId: clientId, clientIds: multiSelectedBlockClientIds, isFirst: isFirst, isLast: isLast }); } /* harmony default export */ var multi_controls = (Object(external_this_wp_data_["withSelect"])(function (select, _ref2) { var clientId = _ref2.clientId; var _select = select('core/editor'), getMultiSelectedBlockClientIds = _select.getMultiSelectedBlockClientIds, isMultiSelecting = _select.isMultiSelecting, getBlockIndex = _select.getBlockIndex, getBlockCount = _select.getBlockCount; var clientIds = getMultiSelectedBlockClientIds(); var firstIndex = getBlockIndex(Object(external_lodash_["first"])(clientIds), clientId); var lastIndex = getBlockIndex(Object(external_lodash_["last"])(clientIds), clientId); return { multiSelectedBlockClientIds: clientIds, isSelecting: isMultiSelecting(), isFirst: firstIndex === 0, isLast: lastIndex + 1 === getBlockCount() }; })(BlockListMultiControls)); // EXTERNAL MODULE: ./node_modules/dom-scroll-into-view/lib/index.js var dom_scroll_into_view_lib = __webpack_require__(59); var dom_scroll_into_view_lib_default = /*#__PURE__*/__webpack_require__.n(dom_scroll_into_view_lib); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-preview/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Block Preview Component: It renders a preview given a block name and attributes. * * @param {Object} props Component props. * * @return {WPElement} Rendered element. */ function BlockPreview(props) { return Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-preview" }, Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-preview__title" }, Object(external_this_wp_i18n_["__"])('Preview')), Object(external_this_wp_element_["createElement"])(BlockPreviewContent, props)); } function BlockPreviewContent(_ref) { var name = _ref.name, attributes = _ref.attributes; var block = Object(external_this_wp_blocks_["createBlock"])(name, attributes); return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Disabled"], { className: "editor-block-preview__content editor-styles-wrapper", "aria-hidden": true }, Object(external_this_wp_element_["createElement"])(block_edit, { name: name, focus: false, attributes: block.attributes, setAttributes: external_lodash_["noop"] })); } /* harmony default export */ var block_preview = (BlockPreview); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/inserter-list-item/index.js /** * External dependencies */ /** * Internal dependencies */ function InserterListItem(_ref) { var icon = _ref.icon, hasChildBlocksWithInserterSupport = _ref.hasChildBlocksWithInserterSupport, _onClick = _ref.onClick, isDisabled = _ref.isDisabled, title = _ref.title, className = _ref.className, props = Object(objectWithoutProperties["a" /* default */])(_ref, ["icon", "hasChildBlocksWithInserterSupport", "onClick", "isDisabled", "title", "className"]); var itemIconStyle = icon ? { backgroundColor: icon.background, color: icon.foreground } : {}; var itemIconStackStyle = icon && icon.shadowColor ? { backgroundColor: icon.shadowColor } : {}; return Object(external_this_wp_element_["createElement"])("li", { className: "editor-block-types-list__list-item" }, Object(external_this_wp_element_["createElement"])("button", Object(esm_extends["a" /* default */])({ className: classnames_default()('editor-block-types-list__item', className, { 'editor-block-types-list__item-has-children': hasChildBlocksWithInserterSupport }), onClick: function onClick(event) { event.preventDefault(); _onClick(); }, disabled: isDisabled, "aria-label": title // Fix for IE11 and JAWS 2018. }, props), Object(external_this_wp_element_["createElement"])("span", { className: "editor-block-types-list__item-icon", style: itemIconStyle }, Object(external_this_wp_element_["createElement"])(BlockIcon, { icon: icon, showColors: true }), hasChildBlocksWithInserterSupport && Object(external_this_wp_element_["createElement"])("span", { className: "editor-block-types-list__item-icon-stack", style: itemIconStackStyle })), Object(external_this_wp_element_["createElement"])("span", { className: "editor-block-types-list__item-title" }, title))); } /* harmony default export */ var inserter_list_item = (InserterListItem); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-types-list/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockTypesList(_ref) { var items = _ref.items, onSelect = _ref.onSelect, _ref$onHover = _ref.onHover, onHover = _ref$onHover === void 0 ? function () {} : _ref$onHover, children = _ref.children; 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"])("ul", { role: "list", className: "editor-block-types-list" }, items && items.map(function (item) { return Object(external_this_wp_element_["createElement"])(inserter_list_item, { key: item.id, className: Object(external_this_wp_blocks_["getBlockMenuDefaultClassName"])(item.id), icon: item.icon, hasChildBlocksWithInserterSupport: item.hasChildBlocksWithInserterSupport, onClick: function onClick() { onSelect(item); onHover(null); }, onFocus: function onFocus() { return onHover(item); }, onMouseEnter: function onMouseEnter() { return onHover(item); }, onMouseLeave: function onMouseLeave() { return onHover(null); }, onBlur: function onBlur() { return onHover(null); }, isDisabled: item.isDisabled, title: item.title }); }), children) /* eslint-enable jsx-a11y/no-redundant-roles */ ); } /* harmony default export */ var block_types_list = (BlockTypesList); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/inserter/child-blocks.js /** * WordPress dependencies */ /** * Internal dependencies */ function ChildBlocks(_ref) { var rootBlockIcon = _ref.rootBlockIcon, rootBlockTitle = _ref.rootBlockTitle, items = _ref.items, props = Object(objectWithoutProperties["a" /* default */])(_ref, ["rootBlockIcon", "rootBlockTitle", "items"]); return Object(external_this_wp_element_["createElement"])("div", { className: "editor-inserter__child-blocks" }, (rootBlockIcon || rootBlockTitle) && Object(external_this_wp_element_["createElement"])("div", { className: "editor-inserter__parent-block-header" }, Object(external_this_wp_element_["createElement"])(BlockIcon, { icon: rootBlockIcon, showColors: true }), rootBlockTitle && Object(external_this_wp_element_["createElement"])("h2", null, rootBlockTitle)), Object(external_this_wp_element_["createElement"])(block_types_list, Object(esm_extends["a" /* default */])({ items: items }, props))); } /* harmony default export */ var child_blocks = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_compose_["ifCondition"])(function (_ref2) { var items = _ref2.items; return items && items.length > 0; }), Object(external_this_wp_data_["withSelect"])(function (select, _ref3) { var rootClientId = _ref3.rootClientId; var _select = select('core/blocks'), getBlockType = _select.getBlockType; var _select2 = select('core/editor'), getBlockName = _select2.getBlockName; var rootBlockName = getBlockName(rootClientId); var rootBlockType = getBlockType(rootBlockName); return { rootBlockTitle: rootBlockType && rootBlockType.title, rootBlockIcon: rootBlockType && rootBlockType.icon }; }))(ChildBlocks)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/inserter/inline-elements.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var inline_elements_InserterInlineElements = function InserterInlineElements(_ref) { var filterValue = _ref.filterValue; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Slot"], { name: "Inserter.InlineElements", fillProps: { filterValue: filterValue } }, function (fills) { return !Object(external_lodash_["isEmpty"])(fills) && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { title: Object(external_this_wp_i18n_["__"])('Inline Elements'), initialOpen: false, className: "editor-inserter__inline-elements" }, Object(external_this_wp_element_["createElement"])(block_types_list, null, fills)); }); }; /* harmony default export */ var inline_elements = (inline_elements_InserterInlineElements); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/inserter/menu.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var MAX_SUGGESTED_ITEMS = 9; var stopKeyPropagation = function stopKeyPropagation(event) { return event.stopPropagation(); }; /** * Filters an item list given a search term. * * @param {Array} items Item list * @param {string} searchTerm Search term. * * @return {Array} Filtered item list. */ var menu_searchItems = function searchItems(items, searchTerm) { var normalizedSearchTerm = menu_normalizeTerm(searchTerm); var matchSearch = function matchSearch(string) { return menu_normalizeTerm(string).indexOf(normalizedSearchTerm) !== -1; }; var categories = Object(external_this_wp_blocks_["getCategories"])(); return items.filter(function (item) { var itemCategory = Object(external_lodash_["find"])(categories, { slug: item.category }); return matchSearch(item.title) || Object(external_lodash_["some"])(item.keywords, matchSearch) || itemCategory && matchSearch(itemCategory.title); }); }; /** * Converts the search term into a normalized term. * * @param {string} term The search term to normalize. * * @return {string} The normalized search term. */ var menu_normalizeTerm = function normalizeTerm(term) { // Disregard diacritics. // Input: "média" term = Object(external_lodash_["deburr"])(term); // Accommodate leading slash, matching autocomplete expectations. // Input: "/media" term = term.replace(/^\//, ''); // Lowercase. // Input: "MEDIA" term = term.toLowerCase(); // Strip leading and trailing whitespace. // Input: " media " term = term.trim(); return term; }; var menu_InserterMenu = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(InserterMenu, _Component); function InserterMenu() { var _this; Object(classCallCheck["a" /* default */])(this, InserterMenu); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(InserterMenu).apply(this, arguments)); _this.state = { childItems: [], filterValue: '', hoveredItem: null, suggestedItems: [], reusableItems: [], itemsPerCategory: {}, openPanels: ['suggested'] }; _this.onChangeSearchInput = _this.onChangeSearchInput.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onHover = _this.onHover.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.panels = {}; _this.inserterResults = Object(external_this_wp_element_["createRef"])(); return _this; } Object(createClass["a" /* default */])(InserterMenu, [{ key: "componentDidMount", value: function componentDidMount() { // This could be replaced by a resolver. this.props.fetchReusableBlocks(); this.filter(); } }, { key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { if (prevProps.items !== this.props.items) { this.filter(this.state.filterValue); } } }, { key: "onChangeSearchInput", value: function onChangeSearchInput(event) { this.filter(event.target.value); } }, { key: "onHover", value: function onHover(item) { this.setState({ hoveredItem: item }); var _this$props = this.props, showInsertionPoint = _this$props.showInsertionPoint, hideInsertionPoint = _this$props.hideInsertionPoint; if (item) { var _this$props2 = this.props, rootClientId = _this$props2.rootClientId, index = _this$props2.index; showInsertionPoint(rootClientId, index); } else { hideInsertionPoint(); } } }, { key: "bindPanel", value: function bindPanel(name) { var _this2 = this; return function (ref) { _this2.panels[name] = ref; }; } }, { key: "onTogglePanel", value: function onTogglePanel(panel) { var _this3 = this; return function () { var isOpened = _this3.state.openPanels.indexOf(panel) !== -1; if (isOpened) { _this3.setState({ openPanels: Object(external_lodash_["without"])(_this3.state.openPanels, panel) }); } else { _this3.setState({ openPanels: Object(toConsumableArray["a" /* default */])(_this3.state.openPanels).concat([panel]) }); _this3.props.setTimeout(function () { // We need a generic way to access the panel's container // eslint-disable-next-line react/no-find-dom-node dom_scroll_into_view_lib_default()(_this3.panels[panel], _this3.inserterResults.current, { alignWithTop: true }); }); } }; } }, { key: "filter", value: function filter() { var filterValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; var _this$props3 = this.props, debouncedSpeak = _this$props3.debouncedSpeak, items = _this$props3.items, rootChildBlocks = _this$props3.rootChildBlocks; var filteredItems = menu_searchItems(items, filterValue); var childItems = Object(external_lodash_["filter"])(filteredItems, function (_ref) { var name = _ref.name; return Object(external_lodash_["includes"])(rootChildBlocks, name); }); var suggestedItems = []; if (!filterValue) { var maxSuggestedItems = this.props.maxSuggestedItems || MAX_SUGGESTED_ITEMS; suggestedItems = Object(external_lodash_["filter"])(items, function (item) { return item.utility > 0; }).slice(0, maxSuggestedItems); } var reusableItems = Object(external_lodash_["filter"])(filteredItems, { category: 'reusable' }); var getCategoryIndex = function getCategoryIndex(item) { return Object(external_lodash_["findIndex"])(Object(external_this_wp_blocks_["getCategories"])(), function (category) { return category.slug === item.category; }); }; var itemsPerCategory = Object(external_lodash_["flow"])(function (itemList) { return Object(external_lodash_["filter"])(itemList, function (item) { return item.category !== 'reusable'; }); }, function (itemList) { return Object(external_lodash_["sortBy"])(itemList, getCategoryIndex); }, function (itemList) { return Object(external_lodash_["groupBy"])(itemList, 'category'); })(filteredItems); var openPanels = this.state.openPanels; if (filterValue !== this.state.filterValue) { if (!filterValue) { openPanels = ['suggested']; } else if (reusableItems.length) { openPanels = ['reusable']; } else if (filteredItems.length) { var firstCategory = Object(external_lodash_["find"])(Object(external_this_wp_blocks_["getCategories"])(), function (_ref2) { var slug = _ref2.slug; return itemsPerCategory[slug] && itemsPerCategory[slug].length; }); openPanels = [firstCategory.slug]; } } this.setState({ hoveredItem: null, childItems: childItems, filterValue: filterValue, suggestedItems: suggestedItems, reusableItems: reusableItems, itemsPerCategory: itemsPerCategory, openPanels: openPanels }); var resultCount = Object.keys(itemsPerCategory).reduce(function (accumulator, currentCategorySlug) { return accumulator + itemsPerCategory[currentCategorySlug].length; }, 0); var resultsFoundMessage = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_n"])('%d result found.', '%d results found.', resultCount), resultCount); debouncedSpeak(resultsFoundMessage, 'assertive'); } }, { key: "onKeyDown", value: function onKeyDown(event) { if (Object(external_lodash_["includes"])([external_this_wp_keycodes_["LEFT"], external_this_wp_keycodes_["DOWN"], external_this_wp_keycodes_["RIGHT"], external_this_wp_keycodes_["UP"], external_this_wp_keycodes_["BACKSPACE"], external_this_wp_keycodes_["ENTER"]], event.keyCode)) { // Stop the key event from propagating up to ObserveTyping.startTypingInTextField. event.stopPropagation(); } } }, { key: "render", value: function render() { var _this4 = this; var _this$props4 = this.props, instanceId = _this$props4.instanceId, onSelect = _this$props4.onSelect, rootClientId = _this$props4.rootClientId; var _this$state = this.state, childItems = _this$state.childItems, filterValue = _this$state.filterValue, hoveredItem = _this$state.hoveredItem, suggestedItems = _this$state.suggestedItems, reusableItems = _this$state.reusableItems, itemsPerCategory = _this$state.itemsPerCategory, openPanels = _this$state.openPanels; var isPanelOpen = function isPanelOpen(panel) { return openPanels.indexOf(panel) !== -1; }; var isSearching = !!filterValue; // Disable reason (no-autofocus): The inserter menu is a modal display, not one which // is always visible, and one which already incurs this behavior of autoFocus via // Popover's focusOnMount. // Disable reason (no-static-element-interactions): Navigational key-presses within // the menu are prevented from triggering WritingFlow and ObserveTyping interactions. /* eslint-disable jsx-a11y/no-autofocus, jsx-a11y/no-static-element-interactions */ return Object(external_this_wp_element_["createElement"])("div", { className: "editor-inserter__menu", onKeyPress: stopKeyPropagation, onKeyDown: this.onKeyDown }, Object(external_this_wp_element_["createElement"])("label", { htmlFor: "editor-inserter__search-".concat(instanceId), className: "screen-reader-text" }, Object(external_this_wp_i18n_["__"])('Search for a block')), Object(external_this_wp_element_["createElement"])("input", { id: "editor-inserter__search-".concat(instanceId), type: "search", placeholder: Object(external_this_wp_i18n_["__"])('Search for a block'), className: "editor-inserter__search", autoFocus: true, onChange: this.onChangeSearchInput }), Object(external_this_wp_element_["createElement"])("div", { className: "editor-inserter__results", ref: this.inserterResults, tabIndex: "0", role: "region", "aria-label": Object(external_this_wp_i18n_["__"])('Available block types') }, Object(external_this_wp_element_["createElement"])(child_blocks, { rootClientId: rootClientId, items: childItems, onSelect: onSelect, onHover: this.onHover }), !!suggestedItems.length && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { title: Object(external_this_wp_i18n_["_x"])('Most Used', 'blocks'), opened: isPanelOpen('suggested'), onToggle: this.onTogglePanel('suggested'), ref: this.bindPanel('suggested') }, Object(external_this_wp_element_["createElement"])(block_types_list, { items: suggestedItems, onSelect: onSelect, onHover: this.onHover })), Object(external_this_wp_element_["createElement"])(inline_elements, { filterValue: filterValue }), Object(external_lodash_["map"])(Object(external_this_wp_blocks_["getCategories"])(), function (category) { var categoryItems = itemsPerCategory[category.slug]; if (!categoryItems || !categoryItems.length) { return null; } return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { key: category.slug, title: category.title, icon: category.icon, opened: isSearching || isPanelOpen(category.slug), onToggle: _this4.onTogglePanel(category.slug), ref: _this4.bindPanel(category.slug) }, Object(external_this_wp_element_["createElement"])(block_types_list, { items: categoryItems, onSelect: onSelect, onHover: _this4.onHover })); }), !!reusableItems.length && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { className: "editor-inserter__reusable-blocks-panel", title: Object(external_this_wp_i18n_["__"])('Reusable'), opened: isPanelOpen('reusable'), onToggle: this.onTogglePanel('reusable'), icon: "controls-repeat", ref: this.bindPanel('reusable') }, Object(external_this_wp_element_["createElement"])(block_types_list, { items: reusableItems, onSelect: onSelect, onHover: this.onHover }), Object(external_this_wp_element_["createElement"])("a", { className: "editor-inserter__manage-reusable-blocks", href: "edit.php?post_type=wp_block" }, Object(external_this_wp_i18n_["__"])('Manage All Reusable Blocks'))), Object(external_lodash_["isEmpty"])(suggestedItems) && Object(external_lodash_["isEmpty"])(reusableItems) && Object(external_lodash_["isEmpty"])(itemsPerCategory) && Object(external_this_wp_element_["createElement"])("p", { className: "editor-inserter__no-results" }, Object(external_this_wp_i18n_["__"])('No blocks found.'))), hoveredItem && Object(external_this_wp_blocks_["isReusableBlock"])(hoveredItem) && Object(external_this_wp_element_["createElement"])(block_preview, { name: hoveredItem.name, attributes: hoveredItem.initialAttributes })); /* eslint-enable jsx-a11y/no-autofocus, jsx-a11y/no-noninteractive-element-interactions */ } }]); return InserterMenu; }(external_this_wp_element_["Component"]); /* harmony default export */ var menu = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select, _ref3) { var rootClientId = _ref3.rootClientId; var _select = select('core/editor'), getEditedPostAttribute = _select.getEditedPostAttribute, getSelectedBlock = _select.getSelectedBlock, getInserterItems = _select.getInserterItems, getBlockName = _select.getBlockName; var _select2 = select('core/blocks'), getChildBlockNames = _select2.getChildBlockNames; var rootBlockName = getBlockName(rootClientId); return { selectedBlock: getSelectedBlock(), rootChildBlocks: getChildBlockNames(rootBlockName), title: getEditedPostAttribute('title'), items: getInserterItems(rootClientId), rootClientId: rootClientId }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, ownProps) { var _dispatch = dispatch('core/editor'), fetchReusableBlocks = _dispatch.__experimentalFetchReusableBlocks, showInsertionPoint = _dispatch.showInsertionPoint, hideInsertionPoint = _dispatch.hideInsertionPoint; return { fetchReusableBlocks: fetchReusableBlocks, showInsertionPoint: showInsertionPoint, hideInsertionPoint: hideInsertionPoint, onSelect: function onSelect(item) { var _dispatch2 = dispatch('core/editor'), replaceBlocks = _dispatch2.replaceBlocks, insertBlock = _dispatch2.insertBlock; var selectedBlock = ownProps.selectedBlock, index = ownProps.index, rootClientId = ownProps.rootClientId; var name = item.name, initialAttributes = item.initialAttributes; var insertedBlock = Object(external_this_wp_blocks_["createBlock"])(name, initialAttributes); if (selectedBlock && Object(external_this_wp_blocks_["isUnmodifiedDefaultBlock"])(selectedBlock)) { replaceBlocks(selectedBlock.clientId, insertedBlock); } else { insertBlock(insertedBlock, index, rootClientId); } ownProps.onSelect(); } }; }), external_this_wp_components_["withSpokenMessages"], external_this_wp_compose_["withInstanceId"], external_this_wp_compose_["withSafeTimeout"])(menu_InserterMenu)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/inserter/index.js /** * WordPress dependencies */ /** * Internal dependencies */ var inserter_defaultRenderToggle = function defaultRenderToggle(_ref) { var onToggle = _ref.onToggle, disabled = _ref.disabled, isOpen = _ref.isOpen; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { icon: "insert", label: Object(external_this_wp_i18n_["__"])('Add block'), labelPosition: "bottom", onClick: onToggle, className: "editor-inserter__toggle", "aria-haspopup": "true", "aria-expanded": isOpen, disabled: disabled }); }; var inserter_Inserter = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(Inserter, _Component); function Inserter() { var _this; Object(classCallCheck["a" /* default */])(this, Inserter); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(Inserter).apply(this, arguments)); _this.onToggle = _this.onToggle.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.renderToggle = _this.renderToggle.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.renderContent = _this.renderContent.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); return _this; } Object(createClass["a" /* default */])(Inserter, [{ key: "onToggle", value: function onToggle(isOpen) { var onToggle = this.props.onToggle; // Surface toggle callback to parent component if (onToggle) { onToggle(isOpen); } } /** * Render callback to display Dropdown toggle element. * * @param {Function} options.onToggle Callback to invoke when toggle is * pressed. * @param {boolean} options.isOpen Whether dropdown is currently open. * * @return {WPElement} Dropdown toggle element. */ }, { key: "renderToggle", value: function renderToggle(_ref2) { var onToggle = _ref2.onToggle, isOpen = _ref2.isOpen; var _this$props = this.props, disabled = _this$props.disabled, _this$props$renderTog = _this$props.renderToggle, renderToggle = _this$props$renderTog === void 0 ? inserter_defaultRenderToggle : _this$props$renderTog; return renderToggle({ onToggle: onToggle, isOpen: isOpen, disabled: disabled }); } /** * Render callback to display Dropdown content element. * * @param {Function} options.onClose Callback to invoke when dropdown is * closed. * * @return {WPElement} Dropdown content element. */ }, { key: "renderContent", value: function renderContent(_ref3) { var onClose = _ref3.onClose; var _this$props2 = this.props, rootClientId = _this$props2.rootClientId, index = _this$props2.index; return Object(external_this_wp_element_["createElement"])(menu, { onSelect: onClose, rootClientId: rootClientId, index: index }); } }, { key: "render", value: function render() { var _this$props3 = this.props, position = _this$props3.position, title = _this$props3.title; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Dropdown"], { className: "editor-inserter", contentClassName: "editor-inserter__popover", position: position, onToggle: this.onToggle, expandOnMobile: true, headerTitle: title, renderToggle: this.renderToggle, renderContent: this.renderContent }); } }]); return Inserter; }(external_this_wp_element_["Component"]); /* harmony default export */ var inserter = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref4) { var rootClientId = _ref4.rootClientId, index = _ref4.index; var _select = select('core/editor'), getEditedPostAttribute = _select.getEditedPostAttribute, getBlockInsertionPoint = _select.getBlockInsertionPoint, hasInserterItems = _select.hasInserterItems; if (rootClientId === undefined && index === undefined) { // Unless explicitly provided, the default insertion point provided // by the store occurs immediately following the selected block. // Otherwise, the default behavior for an undefined index is to // append block to the end of the rootClientId context. var insertionPoint = getBlockInsertionPoint(); rootClientId = insertionPoint.rootClientId; index = insertionPoint.index; } return { title: getEditedPostAttribute('title'), hasItems: hasInserterItems(rootClientId), rootClientId: rootClientId, index: index }; }), Object(external_this_wp_compose_["ifCondition"])(function (_ref5) { var hasItems = _ref5.hasItems; return hasItems; })])(inserter_Inserter)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-list/block-mobile-toolbar.js /** * WordPress dependencies */ /** * Internal dependencies */ function BlockMobileToolbar(_ref) { var clientId = _ref.clientId; return Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-list__block-mobile-toolbar" }, Object(external_this_wp_element_["createElement"])(inserter, null), Object(external_this_wp_element_["createElement"])(block_mover, { clientIds: [clientId] })); } /* harmony default export */ var block_mobile_toolbar = (Object(external_this_wp_viewport_["ifViewportMatches"])('< small')(BlockMobileToolbar)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-list/insertion-point.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var insertion_point_BlockInsertionPoint = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(BlockInsertionPoint, _Component); function BlockInsertionPoint() { var _this; Object(classCallCheck["a" /* default */])(this, BlockInsertionPoint); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(BlockInsertionPoint).apply(this, arguments)); _this.state = { isInserterFocused: false }; _this.onBlurInserter = _this.onBlurInserter.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onFocusInserter = _this.onFocusInserter.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); return _this; } Object(createClass["a" /* default */])(BlockInsertionPoint, [{ key: "onFocusInserter", value: function onFocusInserter(event) { // Stop propagation of the focus event to avoid selecting the current // block while inserting a new block, as it is not relevant to sibling // insertion and conflicts with contextual toolbar placement. event.stopPropagation(); this.setState({ isInserterFocused: true }); } }, { key: "onBlurInserter", value: function onBlurInserter() { this.setState({ isInserterFocused: false }); } }, { key: "render", value: function render() { var isInserterFocused = this.state.isInserterFocused; var _this$props = this.props, showInsertionPoint = _this$props.showInsertionPoint, rootClientId = _this$props.rootClientId, insertIndex = _this$props.insertIndex; return Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-list__insertion-point" }, showInsertionPoint && Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-list__insertion-point-indicator" }), Object(external_this_wp_element_["createElement"])("div", { onFocus: this.onFocusInserter, onBlur: this.onBlurInserter // While ideally it would be enough to capture the // bubbling focus event from the Inserter, due to the // characteristics of click focusing of `button`s in // Firefox and Safari, it is not reliable. // // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus , tabIndex: -1, className: classnames_default()('editor-block-list__insertion-point-inserter', { 'is-visible': isInserterFocused }) }, Object(external_this_wp_element_["createElement"])(inserter, { rootClientId: rootClientId, index: insertIndex }))); } }]); return BlockInsertionPoint; }(external_this_wp_element_["Component"]); /* harmony default export */ var insertion_point = (Object(external_this_wp_data_["withSelect"])(function (select, _ref) { var clientId = _ref.clientId, rootClientId = _ref.rootClientId; var _select = select('core/editor'), getBlockIndex = _select.getBlockIndex, getBlockInsertionPoint = _select.getBlockInsertionPoint, isBlockInsertionPointVisible = _select.isBlockInsertionPointVisible; var blockIndex = getBlockIndex(clientId, rootClientId); var insertIndex = blockIndex; var insertionPoint = getBlockInsertionPoint(); var showInsertionPoint = isBlockInsertionPointVisible() && insertionPoint.index === insertIndex && insertionPoint.rootClientId === rootClientId; return { showInsertionPoint: showInsertionPoint, insertIndex: insertIndex }; })(insertion_point_BlockInsertionPoint)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/ignore-nested-events/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Component which renders a div with passed props applied except the optional * `childHandledEvents` prop. Event prop handlers are replaced with a proxying * event handler to capture and prevent events from being handled by ancestor * `IgnoreNestedEvents` elements by testing the presence of a private property * assigned on the event object. * * Optionally accepts an `childHandledEvents` prop array, which can be used in * instances where an inner `IgnoreNestedEvents` element exists and the outer * element should stop propagation but not invoke a callback handler, since it * would be assumed these are invoked by the child element. * * @type {Component} */ var ignore_nested_events_IgnoreNestedEvents = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(IgnoreNestedEvents, _Component); function IgnoreNestedEvents() { var _this; Object(classCallCheck["a" /* default */])(this, IgnoreNestedEvents); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(IgnoreNestedEvents).apply(this, arguments)); _this.proxyEvent = _this.proxyEvent.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); // The event map is responsible for tracking an event type to a React // component prop name, since it is easy to determine event type from // a React prop name, but not the other way around. _this.eventMap = {}; return _this; } /** * General event handler which only calls to its original props callback if * it has not already been handled by a descendant IgnoreNestedEvents. * * @param {Event} event Event object. * * @return {void} */ Object(createClass["a" /* default */])(IgnoreNestedEvents, [{ key: "proxyEvent", value: function proxyEvent(event) { var isHandled = !!event.nativeEvent._blockHandled; // Assign into the native event, since React will reuse their synthetic // event objects and this property assignment could otherwise leak. // // See: https://reactjs.org/docs/events.html#event-pooling event.nativeEvent._blockHandled = true; // Invoke original prop handler var propKey = this.eventMap[event.type]; // If already handled (i.e. assume nested block), only invoke a // corresponding "Handled"-suffixed prop callback. if (isHandled) { propKey += 'Handled'; } if (this.props[propKey]) { this.props[propKey](event); } } }, { key: "render", value: function render() { var _this2 = this; var _this$props = this.props, _this$props$childHand = _this$props.childHandledEvents, childHandledEvents = _this$props$childHand === void 0 ? [] : _this$props$childHand, forwardedRef = _this$props.forwardedRef, props = Object(objectWithoutProperties["a" /* default */])(_this$props, ["childHandledEvents", "forwardedRef"]); var eventHandlers = Object(external_lodash_["reduce"])(Object(toConsumableArray["a" /* default */])(childHandledEvents).concat(Object(toConsumableArray["a" /* default */])(Object.keys(props))), function (result, key) { // Try to match prop key as event handler var match = key.match(/^on([A-Z][a-zA-Z]+?)(Handled)?$/); if (match) { var isHandledProp = !!match[2]; if (isHandledProp) { // Avoid assigning through the invalid prop key. This // assumes mutation of shallow clone by above spread. delete props[key]; } // Re-map the prop to the local proxy handler to check whether // the event has already been handled. var proxiedPropName = 'on' + match[1]; result[proxiedPropName] = _this2.proxyEvent; // Assign event -> propName into an instance variable, so as to // avoid re-renders which could be incurred either by setState // or in mapping values to a newly created function. _this2.eventMap[match[1].toLowerCase()] = proxiedPropName; } return result; }, {}); return Object(external_this_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ ref: forwardedRef }, props, eventHandlers)); } }]); return IgnoreNestedEvents; }(external_this_wp_element_["Component"]); var ignore_nested_events_forwardedIgnoreNestedEvents = function forwardedIgnoreNestedEvents(props, ref) { return Object(external_this_wp_element_["createElement"])(ignore_nested_events_IgnoreNestedEvents, Object(esm_extends["a" /* default */])({}, props, { forwardedRef: ref })); }; ignore_nested_events_forwardedIgnoreNestedEvents.displayName = 'IgnoreNestedEvents'; /* harmony default export */ var ignore_nested_events = (Object(external_this_wp_element_["forwardRef"])(ignore_nested_events_forwardedIgnoreNestedEvents)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/inserter-with-shortcuts/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function InserterWithShortcuts(_ref) { var items = _ref.items, isLocked = _ref.isLocked, onInsert = _ref.onInsert; if (isLocked) { return null; } var itemsWithoutDefaultBlock = Object(external_lodash_["filter"])(items, function (item) { return !item.isDisabled && (item.name !== Object(external_this_wp_blocks_["getDefaultBlockName"])() || !Object(external_lodash_["isEmpty"])(item.initialAttributes)); }).slice(0, 3); return Object(external_this_wp_element_["createElement"])("div", { className: "editor-inserter-with-shortcuts" }, itemsWithoutDefaultBlock.map(function (item) { return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { key: item.id, className: "editor-inserter-with-shortcuts__block", onClick: function onClick() { return onInsert(item); } // translators: %s: block title/name to be added , label: Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["__"])('Add %s'), item.title), icon: Object(external_this_wp_element_["createElement"])(BlockIcon, { icon: item.icon }) }); })); } /* harmony default export */ var inserter_with_shortcuts = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select, _ref2) { var rootClientId = _ref2.rootClientId; var _select = select('core/editor'), getInserterItems = _select.getInserterItems, getTemplateLock = _select.getTemplateLock; return { items: getInserterItems(rootClientId), isLocked: !!getTemplateLock(rootClientId) }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, ownProps) { var clientId = ownProps.clientId, rootClientId = ownProps.rootClientId; return { onInsert: function onInsert(_ref3) { var name = _ref3.name, initialAttributes = _ref3.initialAttributes; var block = Object(external_this_wp_blocks_["createBlock"])(name, initialAttributes); if (clientId) { dispatch('core/editor').replaceBlocks(clientId, block); } else { dispatch('core/editor').insertBlock(block, undefined, rootClientId); } } }; }))(InserterWithShortcuts)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-list/hover-area.js /** * WordPress dependencies */ var hover_area_HoverArea = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(HoverArea, _Component); function HoverArea() { var _this; Object(classCallCheck["a" /* default */])(this, HoverArea); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(HoverArea).apply(this, arguments)); _this.state = { hoverArea: null }; _this.onMouseLeave = _this.onMouseLeave.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onMouseMove = _this.onMouseMove.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); return _this; } Object(createClass["a" /* default */])(HoverArea, [{ key: "componentWillUnmount", value: function componentWillUnmount() { if (this.props.container) { this.toggleListeners(this.props.container, false); } } }, { key: "componentDidMount", value: function componentDidMount() { if (this.props.container) { this.toggleListeners(this.props.container); } } }, { key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { if (prevProps.container === this.props.container) { return; } if (prevProps.container) { this.toggleListeners(prevProps.container, false); } if (this.props.container) { this.toggleListeners(this.props.container, true); } } }, { key: "toggleListeners", value: function toggleListeners(container) { var shouldListnerToEvents = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; var method = shouldListnerToEvents ? 'addEventListener' : 'removeEventListener'; container[method]('mousemove', this.onMouseMove); container[method]('mouseleave', this.onMouseLeave); } }, { key: "onMouseLeave", value: function onMouseLeave() { if (this.state.hoverArea) { this.setState({ hoverArea: null }); } } }, { key: "onMouseMove", value: function onMouseMove(event) { var _this$props = this.props, isRTL = _this$props.isRTL, container = _this$props.container; var _container$getBoundin = container.getBoundingClientRect(), width = _container$getBoundin.width, left = _container$getBoundin.left, right = _container$getBoundin.right; var hoverArea = null; if (event.clientX - left < width / 3) { hoverArea = isRTL ? 'right' : 'left'; } else if (right - event.clientX < width / 3) { hoverArea = isRTL ? 'left' : 'right'; } if (hoverArea !== this.state.hoverArea) { this.setState({ hoverArea: hoverArea }); } } }, { key: "render", value: function render() { var hoverArea = this.state.hoverArea; var children = this.props.children; return children({ hoverArea: hoverArea }); } }]); return HoverArea; }(external_this_wp_element_["Component"]); /* harmony default export */ var hover_area = (Object(external_this_wp_data_["withSelect"])(function (select) { return { isRTL: select('core/editor').getEditorSettings().isRTL }; })(hover_area_HoverArea)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/dom.js /** * Given a block client ID, returns the corresponding DOM node for the block, * if exists. As much as possible, this helper should be avoided, and used only * in cases where isolated behaviors need remote access to a block node. * * @param {string} clientId Block client ID. * * @return {Element} Block DOM node. */ function getBlockDOMNode(clientId) { return document.querySelector('[data-block="' + clientId + '"]'); } /** * Given a block client ID, returns the corresponding DOM node for the block * focusable wrapper, if exists. As much as possible, this helper should be * avoided, and used only in cases where isolated behaviors need remote access * to a block node. * * @param {string} clientId Block client ID. * * @return {Element} Block DOM node. */ function getBlockFocusableWrapper(clientId) { return getBlockDOMNode(clientId).closest('.editor-block-list__block'); } /** * Returns true if the given HTMLElement is a block focus stop. Blocks without * their own text fields rely on the focus stop to be keyboard navigable. * * @param {HTMLElement} element Element to test. * * @return {boolean} Whether element is a block focus stop. */ function isBlockFocusStop(element) { return element.classList.contains('editor-block-list__block'); } /** * Returns true if two elements are contained within the same block. * * @param {HTMLElement} a First element. * @param {HTMLElement} b Second element. * * @return {boolean} Whether elements are in the same block. */ function isInSameBlock(a, b) { return a.closest('[data-block]') === b.closest('[data-block]'); } /** * Returns true if an elements is considered part of the block and not its children. * * @param {HTMLElement} blockElement Block container element. * @param {HTMLElement} element Element. * * @return {boolean} Whether element is in the block Element but not its children. */ function isInsideRootBlock(blockElement, element) { var innerBlocksContainer = blockElement.querySelector('.editor-block-list__layout'); return blockElement.contains(element) && (!innerBlocksContainer || !innerBlocksContainer.contains(element)); } /** * Returns true if the given HTMLElement contains inner blocks (an InnerBlocks * element). * * @param {HTMLElement} element Element to test. * * @return {boolean} Whether element contains inner blocks. */ function hasInnerBlocksContext(element) { return !!element.querySelector('.editor-block-list__layout'); } // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-list/block.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var block_BlockListBlock = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(BlockListBlock, _Component); function BlockListBlock() { var _this; Object(classCallCheck["a" /* default */])(this, BlockListBlock); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(BlockListBlock).apply(this, arguments)); _this.setBlockListRef = _this.setBlockListRef.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.bindBlockNode = _this.bindBlockNode.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.setAttributes = _this.setAttributes.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.maybeHover = _this.maybeHover.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.forceFocusedContextualToolbar = _this.forceFocusedContextualToolbar.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.hideHoverEffects = _this.hideHoverEffects.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.insertBlocksAfter = _this.insertBlocksAfter.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onFocus = _this.onFocus.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.preventDrag = _this.preventDrag.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onPointerDown = _this.onPointerDown.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.deleteOrInsertAfterWrapper = _this.deleteOrInsertAfterWrapper.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onBlockError = _this.onBlockError.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onTouchStart = _this.onTouchStart.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onClick = _this.onClick.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onDragStart = _this.onDragStart.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onDragEnd = _this.onDragEnd.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.selectOnOpen = _this.selectOnOpen.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.hadTouchStart = false; _this.state = { error: null, dragging: false, isHovered: false }; _this.isForcingContextualToolbar = false; return _this; } Object(createClass["a" /* default */])(BlockListBlock, [{ key: "componentDidMount", value: function componentDidMount() { if (this.props.isSelected) { this.focusTabbable(); } } }, { key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { if (this.isForcingContextualToolbar) { // The forcing of contextual toolbar should only be true during one update, // after the first update normal conditions should apply. this.isForcingContextualToolbar = false; } if (this.props.isTypingWithinBlock || this.props.isSelected) { this.hideHoverEffects(); } if (this.props.isSelected && !prevProps.isSelected) { this.focusTabbable(true); } // When triggering a multi-selection, // move the focus to the wrapper of the first selected block. if (this.props.isFirstMultiSelected && !prevProps.isFirstMultiSelected) { this.wrapperNode.focus(); } } }, { key: "setBlockListRef", value: function setBlockListRef(node) { this.wrapperNode = node; this.props.blockRef(node, this.props.clientId); // We need to rerender to trigger a rerendering of HoverArea // it depents on this.wrapperNode but we can't keep this.wrapperNode in state // Because we need it to be immediately availeble for `focusableTabbable` to work. this.forceUpdate(); } }, { key: "bindBlockNode", value: function bindBlockNode(node) { this.node = node; } /** * When a block becomes selected, transition focus to an inner tabbable. * * @param {boolean} ignoreInnerBlocks Should not focus inner blocks. */ }, { key: "focusTabbable", value: function focusTabbable(ignoreInnerBlocks) { var _this2 = this; var initialPosition = this.props.initialPosition; // Focus is captured by the wrapper node, so while focus transition // should only consider tabbables within editable display, since it // may be the wrapper itself or a side control which triggered the // focus event, don't unnecessary transition to an inner tabbable. if (this.wrapperNode.contains(document.activeElement)) { return; } // Find all tabbables within node. var textInputs = external_this_wp_dom_["focus"].tabbable.find(this.node).filter(external_this_wp_dom_["isTextField"]) // Exclude inner blocks .filter(function (node) { return !ignoreInnerBlocks || isInsideRootBlock(_this2.node, node); }); // If reversed (e.g. merge via backspace), use the last in the set of // tabbables. var isReverse = -1 === initialPosition; var target = (isReverse ? external_lodash_["last"] : external_lodash_["first"])(textInputs); if (!target) { this.wrapperNode.focus(); return; } target.focus(); // In reverse case, need to explicitly place caret position. if (isReverse) { Object(external_this_wp_dom_["placeCaretAtHorizontalEdge"])(target, true); Object(external_this_wp_dom_["placeCaretAtVerticalEdge"])(target, true); } } }, { key: "setAttributes", value: function setAttributes(attributes) { var _this$props = this.props, clientId = _this$props.clientId, name = _this$props.name, onChange = _this$props.onChange; var type = Object(external_this_wp_blocks_["getBlockType"])(name); onChange(clientId, attributes); var metaAttributes = Object(external_lodash_["reduce"])(attributes, function (result, value, key) { if (Object(external_lodash_["get"])(type, ['attributes', key, 'source']) === 'meta') { result[type.attributes[key].meta] = value; } return result; }, {}); if (Object(external_lodash_["size"])(metaAttributes)) { this.props.onMetaChange(metaAttributes); } } }, { key: "onTouchStart", value: function onTouchStart() { // Detect touchstart to disable hover on iOS this.hadTouchStart = true; } }, { key: "onClick", value: function onClick() { // Clear touchstart detection // Browser will try to emulate mouse events also see https://www.html5rocks.com/en/mobile/touchandmouse/ this.hadTouchStart = false; } /** * A mouseover event handler to apply hover effect when a pointer device is * placed within the bounds of the block. The mouseover event is preferred * over mouseenter because it may be the case that a previous mouseenter * event was blocked from being handled by a IgnoreNestedEvents component, * therefore transitioning out of a nested block to the bounds of the block * would otherwise not trigger a hover effect. * * @see https://developer.mozilla.org/en-US/docs/Web/Events/mouseenter */ }, { key: "maybeHover", value: function maybeHover() { var _this$props2 = this.props, isPartOfMultiSelection = _this$props2.isPartOfMultiSelection, isSelected = _this$props2.isSelected; var isHovered = this.state.isHovered; if (isHovered || isPartOfMultiSelection || isSelected || this.props.isMultiSelecting || this.hadTouchStart) { return; } this.setState({ isHovered: true }); } /** * Sets the block state as unhovered if currently hovering. There are cases * where mouseleave may occur but the block is not hovered (multi-select), * so to avoid unnecesary renders, the state is only set if hovered. */ }, { key: "hideHoverEffects", value: function hideHoverEffects() { if (this.state.isHovered) { this.setState({ isHovered: false }); } } }, { key: "insertBlocksAfter", value: function insertBlocksAfter(blocks) { this.props.onInsertBlocks(blocks, this.props.order + 1); } /** * Marks the block as selected when focused and not already selected. This * specifically handles the case where block does not set focus on its own * (via `setFocus`), typically if there is no focusable input in the block. * * @return {void} */ }, { key: "onFocus", value: function onFocus() { if (!this.props.isSelected && !this.props.isPartOfMultiSelection) { this.props.onSelect(); } } /** * Prevents default dragging behavior within a block to allow for multi- * selection to take effect unhampered. * * @param {DragEvent} event Drag event. * * @return {void} */ }, { key: "preventDrag", value: function preventDrag(event) { event.preventDefault(); } /** * Begins tracking cursor multi-selection when clicking down within block. * * @param {MouseEvent} event A mousedown event. * * @return {void} */ }, { key: "onPointerDown", value: function onPointerDown(event) { // Not the main button. // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button if (event.button !== 0) { return; } if (event.shiftKey) { if (!this.props.isSelected) { this.props.onShiftSelection(); event.preventDefault(); } } else { this.props.onSelectionStart(this.props.clientId); // Allow user to escape out of a multi-selection to a singular // selection of a block via click. This is handled here since // onFocus excludes blocks involved in a multiselection, as // focus can be incurred by starting a multiselection (focus // moved to first block's multi-controls). if (this.props.isPartOfMultiSelection) { this.props.onSelect(); } } } /** * Interprets keydown event intent to remove or insert after block if key * event occurs on wrapper node. This can occur when the block has no text * fields of its own, particularly after initial insertion, to allow for * easy deletion and continuous writing flow to add additional content. * * @param {KeyboardEvent} event Keydown event. */ }, { key: "deleteOrInsertAfterWrapper", value: function deleteOrInsertAfterWrapper(event) { var keyCode = event.keyCode, target = event.target; if (!this.props.isSelected || target !== this.wrapperNode || this.props.isLocked) { return; } switch (keyCode) { case external_this_wp_keycodes_["ENTER"]: // Insert default block after current block if enter and event // not already handled by descendant. this.props.onInsertDefaultBlockAfter(); event.preventDefault(); break; case external_this_wp_keycodes_["BACKSPACE"]: case external_this_wp_keycodes_["DELETE"]: // Remove block on backspace. var _this$props3 = this.props, clientId = _this$props3.clientId, onRemove = _this$props3.onRemove; onRemove(clientId); event.preventDefault(); break; } } }, { key: "onBlockError", value: function onBlockError(error) { this.setState({ error: error }); } }, { key: "onDragStart", value: function onDragStart() { this.setState({ dragging: true }); } }, { key: "onDragEnd", value: function onDragEnd() { this.setState({ dragging: false }); } }, { key: "selectOnOpen", value: function selectOnOpen(open) { if (open && !this.props.isSelected) { this.props.onSelect(); } } }, { key: "forceFocusedContextualToolbar", value: function forceFocusedContextualToolbar() { this.isForcingContextualToolbar = true; // trigger a re-render this.setState(function () { return {}; }); } }, { key: "render", value: function render() { var _this3 = this; return Object(external_this_wp_element_["createElement"])(hover_area, { container: this.wrapperNode }, function (_ref) { var hoverArea = _ref.hoverArea; var _this3$props = _this3.props, order = _this3$props.order, mode = _this3$props.mode, isFocusMode = _this3$props.isFocusMode, hasFixedToolbar = _this3$props.hasFixedToolbar, isLocked = _this3$props.isLocked, isFirst = _this3$props.isFirst, isLast = _this3$props.isLast, clientId = _this3$props.clientId, rootClientId = _this3$props.rootClientId, isSelected = _this3$props.isSelected, isPartOfMultiSelection = _this3$props.isPartOfMultiSelection, isFirstMultiSelected = _this3$props.isFirstMultiSelected, isTypingWithinBlock = _this3$props.isTypingWithinBlock, isCaretWithinFormattedText = _this3$props.isCaretWithinFormattedText, isMultiSelecting = _this3$props.isMultiSelecting, isEmptyDefaultBlock = _this3$props.isEmptyDefaultBlock, isMovable = _this3$props.isMovable, isParentOfSelectedBlock = _this3$props.isParentOfSelectedBlock, isDraggable = _this3$props.isDraggable, className = _this3$props.className, name = _this3$props.name, isValid = _this3$props.isValid, attributes = _this3$props.attributes; var isHovered = _this3.state.isHovered && !isMultiSelecting; var blockType = Object(external_this_wp_blocks_["getBlockType"])(name); // translators: %s: Type of block (i.e. Text, Image etc) var blockLabel = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["__"])('Block: %s'), blockType.title); // The block as rendered in the editor is composed of general block UI // (mover, toolbar, wrapper) and the display of the block content. var isUnregisteredBlock = name === Object(external_this_wp_blocks_["getUnregisteredTypeHandlerName"])(); // If the block is selected and we're typing the block should not appear. // Empty paragraph blocks should always show up as unselected. var showEmptyBlockSideInserter = (isSelected || isHovered) && isEmptyDefaultBlock && isValid; var showSideInserter = (isSelected || isHovered) && isEmptyDefaultBlock; var shouldAppearSelected = !isFocusMode && !showSideInserter && isSelected && !isTypingWithinBlock; var shouldAppearHovered = !isFocusMode && !hasFixedToolbar && isHovered && !isEmptyDefaultBlock; // We render block movers and block settings to keep them tabbale even if hidden var shouldRenderMovers = !isFocusMode && (isSelected || hoverArea === 'left') && !showEmptyBlockSideInserter && !isMultiSelecting && !isPartOfMultiSelection && !isTypingWithinBlock; var shouldShowBreadcrumb = !isFocusMode && isHovered && !isEmptyDefaultBlock; var shouldShowContextualToolbar = !hasFixedToolbar && !showSideInserter && (isSelected && (!isTypingWithinBlock || isCaretWithinFormattedText) || isFirstMultiSelected); var shouldShowMobileToolbar = shouldAppearSelected; var _this3$state = _this3.state, error = _this3$state.error, dragging = _this3$state.dragging; // Insertion point can only be made visible if the block is at the // the extent of a multi-selection, or not in a multi-selection. var shouldShowInsertionPoint = isPartOfMultiSelection && isFirstMultiSelected || !isPartOfMultiSelection; // The wp-block className is important for editor styles. // Generate the wrapper class names handling the different states of the block. var wrapperClassName = classnames_default()('wp-block editor-block-list__block', { 'has-warning': !isValid || !!error || isUnregisteredBlock, 'is-selected': shouldAppearSelected, 'is-multi-selected': isPartOfMultiSelection, 'is-hovered': shouldAppearHovered, 'is-reusable': Object(external_this_wp_blocks_["isReusableBlock"])(blockType), 'is-dragging': dragging, 'is-typing': isTypingWithinBlock, 'is-focused': isFocusMode && (isSelected || isParentOfSelectedBlock), 'is-focus-mode': isFocusMode }, className); var onReplace = _this3.props.onReplace; // Determine whether the block has props to apply to the wrapper. var wrapperProps = _this3.props.wrapperProps; if (blockType.getEditWrapperProps) { wrapperProps = Object(objectSpread["a" /* default */])({}, wrapperProps, blockType.getEditWrapperProps(attributes)); } var blockElementId = "block-".concat(clientId); // We wrap the BlockEdit component in a div that hides it when editing in // HTML mode. This allows us to render all of the ancillary pieces // (InspectorControls, etc.) which are inside `BlockEdit` but not // `BlockHTML`, even in HTML mode. var blockEdit = Object(external_this_wp_element_["createElement"])(block_edit, { name: name, isSelected: isSelected, attributes: attributes, setAttributes: _this3.setAttributes, insertBlocksAfter: isLocked ? undefined : _this3.insertBlocksAfter, onReplace: isLocked ? undefined : onReplace, mergeBlocks: isLocked ? undefined : _this3.props.onMerge, clientId: clientId, isSelectionEnabled: _this3.props.isSelectionEnabled, toggleSelection: _this3.props.toggleSelection }); if (mode !== 'visual') { blockEdit = Object(external_this_wp_element_["createElement"])("div", { style: { display: 'none' } }, blockEdit); } // Disable reasons: // // jsx-a11y/mouse-events-have-key-events: // - onMouseOver is explicitly handling hover effects // // jsx-a11y/no-static-element-interactions: // - Each block can be selected by clicking on it /* eslint-disable jsx-a11y/mouse-events-have-key-events, jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */ return Object(external_this_wp_element_["createElement"])(ignore_nested_events, Object(esm_extends["a" /* default */])({ id: blockElementId, ref: _this3.setBlockListRef, onMouseOver: _this3.maybeHover, onMouseOverHandled: _this3.hideHoverEffects, onMouseLeave: _this3.hideHoverEffects, className: wrapperClassName, "data-type": name, onTouchStart: _this3.onTouchStart, onFocus: _this3.onFocus, onClick: _this3.onClick, onKeyDown: _this3.deleteOrInsertAfterWrapper, tabIndex: "0", "aria-label": blockLabel, childHandledEvents: ['onDragStart', 'onMouseDown'] }, wrapperProps), shouldShowInsertionPoint && Object(external_this_wp_element_["createElement"])(insertion_point, { clientId: clientId, rootClientId: rootClientId }), Object(external_this_wp_element_["createElement"])(block_drop_zone, { index: order, clientId: clientId, rootClientId: rootClientId }), shouldRenderMovers && Object(external_this_wp_element_["createElement"])(block_mover, { clientIds: clientId, blockElementId: blockElementId, isFirst: isFirst, isLast: isLast, isHidden: !(isHovered || isSelected) || hoverArea !== 'left', isDraggable: isDraggable !== false && !isPartOfMultiSelection && isMovable, onDragStart: _this3.onDragStart, onDragEnd: _this3.onDragEnd }), isFirstMultiSelected && Object(external_this_wp_element_["createElement"])(multi_controls, { rootClientId: rootClientId }), Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-list__block-edit" }, shouldShowBreadcrumb && Object(external_this_wp_element_["createElement"])(breadcrumb, { clientId: clientId, isHidden: !(isHovered || isSelected) || hoverArea !== 'left' }), (shouldShowContextualToolbar || _this3.isForcingContextualToolbar) && Object(external_this_wp_element_["createElement"])(block_contextual_toolbar // If the toolbar is being shown because of being forced // it should focus the toolbar right after the mount. , { focusOnMount: _this3.isForcingContextualToolbar }), !shouldShowContextualToolbar && isSelected && !hasFixedToolbar && !isEmptyDefaultBlock && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["KeyboardShortcuts"], { bindGlobal: true, eventName: "keydown", shortcuts: { 'alt+f10': _this3.forceFocusedContextualToolbar } }), Object(external_this_wp_element_["createElement"])(ignore_nested_events, { ref: _this3.bindBlockNode, onDragStart: _this3.preventDrag, onMouseDown: _this3.onPointerDown, "data-block": clientId }, Object(external_this_wp_element_["createElement"])(block_crash_boundary, { onError: _this3.onBlockError }, isValid && blockEdit, isValid && mode === 'html' && Object(external_this_wp_element_["createElement"])(block_html, { clientId: clientId }), !isValid && [Object(external_this_wp_element_["createElement"])(block_invalid_warning, { key: "invalid-warning", clientId: clientId }), Object(external_this_wp_element_["createElement"])("div", { key: "invalid-preview" }, Object(external_this_wp_blocks_["getSaveElement"])(blockType, attributes))]), shouldShowMobileToolbar && Object(external_this_wp_element_["createElement"])(block_mobile_toolbar, { clientId: clientId }), !!error && Object(external_this_wp_element_["createElement"])(block_crash_warning, null))), showEmptyBlockSideInserter && Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-list__side-inserter" }, Object(external_this_wp_element_["createElement"])(inserter_with_shortcuts, { clientId: clientId, rootClientId: rootClientId, onToggle: _this3.selectOnOpen })), Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-list__empty-block-inserter" }, Object(external_this_wp_element_["createElement"])(inserter, { position: "top right", onToggle: _this3.selectOnOpen })))); /* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */ }); } }]); return BlockListBlock; }(external_this_wp_element_["Component"]); var applyWithSelect = Object(external_this_wp_data_["withSelect"])(function (select, _ref2) { var clientId = _ref2.clientId, rootClientId = _ref2.rootClientId, isLargeViewport = _ref2.isLargeViewport; var _select = select('core/editor'), isBlockSelected = _select.isBlockSelected, isAncestorMultiSelected = _select.isAncestorMultiSelected, isBlockMultiSelected = _select.isBlockMultiSelected, isFirstMultiSelectedBlock = _select.isFirstMultiSelectedBlock, isMultiSelecting = _select.isMultiSelecting, isTyping = _select.isTyping, isCaretWithinFormattedText = _select.isCaretWithinFormattedText, getBlockIndex = _select.getBlockIndex, getBlockMode = _select.getBlockMode, isSelectionEnabled = _select.isSelectionEnabled, getSelectedBlocksInitialCaretPosition = _select.getSelectedBlocksInitialCaretPosition, getEditorSettings = _select.getEditorSettings, hasSelectedInnerBlock = _select.hasSelectedInnerBlock, getTemplateLock = _select.getTemplateLock, __unstableGetBlockWithoutInnerBlocks = _select.__unstableGetBlockWithoutInnerBlocks; var block = __unstableGetBlockWithoutInnerBlocks(clientId); var isSelected = isBlockSelected(clientId); var _getEditorSettings = getEditorSettings(), hasFixedToolbar = _getEditorSettings.hasFixedToolbar, focusMode = _getEditorSettings.focusMode; var templateLock = getTemplateLock(rootClientId); var isParentOfSelectedBlock = hasSelectedInnerBlock(clientId, true); // The fallback to `{}` is a temporary fix. // This function should never be called when a block is not present in the state. // It happens now because the order in withSelect rendering is not correct. var _ref3 = block || {}, name = _ref3.name, attributes = _ref3.attributes, isValid = _ref3.isValid; return { isPartOfMultiSelection: isBlockMultiSelected(clientId) || isAncestorMultiSelected(clientId), isFirstMultiSelected: isFirstMultiSelectedBlock(clientId), isMultiSelecting: isMultiSelecting(), // We only care about this prop when the block is selected // Thus to avoid unnecessary rerenders we avoid updating the prop if the block is not selected. isTypingWithinBlock: (isSelected || isParentOfSelectedBlock) && isTyping(), isCaretWithinFormattedText: isCaretWithinFormattedText(), order: getBlockIndex(clientId, rootClientId), mode: getBlockMode(clientId), isSelectionEnabled: isSelectionEnabled(), initialPosition: getSelectedBlocksInitialCaretPosition(), isEmptyDefaultBlock: name && Object(external_this_wp_blocks_["isUnmodifiedDefaultBlock"])({ name: name, attributes: attributes }), isMovable: 'all' !== templateLock, isLocked: !!templateLock, isFocusMode: focusMode && isLargeViewport, hasFixedToolbar: hasFixedToolbar && isLargeViewport, // Users of the editor.BlockListBlock filter used to be able to access the block prop // Ideally these blocks would rely on the clientId prop only. // This is kept for backward compatibility reasons. block: block, name: name, attributes: attributes, isValid: isValid, isSelected: isSelected, isParentOfSelectedBlock: isParentOfSelectedBlock }; }); var applyWithDispatch = Object(external_this_wp_data_["withDispatch"])(function (dispatch, ownProps, _ref4) { var select = _ref4.select; var _select2 = select('core/editor'), getBlockSelectionStart = _select2.getBlockSelectionStart; var _dispatch = dispatch('core/editor'), updateBlockAttributes = _dispatch.updateBlockAttributes, selectBlock = _dispatch.selectBlock, multiSelect = _dispatch.multiSelect, insertBlocks = _dispatch.insertBlocks, insertDefaultBlock = _dispatch.insertDefaultBlock, removeBlock = _dispatch.removeBlock, mergeBlocks = _dispatch.mergeBlocks, replaceBlocks = _dispatch.replaceBlocks, editPost = _dispatch.editPost, _toggleSelection = _dispatch.toggleSelection; return { onChange: function onChange(clientId, attributes) { updateBlockAttributes(clientId, attributes); }, onSelect: function onSelect() { var clientId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ownProps.clientId; var initialPosition = arguments.length > 1 ? arguments[1] : undefined; selectBlock(clientId, initialPosition); }, onInsertBlocks: function onInsertBlocks(blocks, index) { var rootClientId = ownProps.rootClientId; insertBlocks(blocks, index, rootClientId); }, onInsertDefaultBlockAfter: function onInsertDefaultBlockAfter() { var order = ownProps.order, rootClientId = ownProps.rootClientId; insertDefaultBlock({}, rootClientId, order + 1); }, onRemove: function onRemove(clientId) { removeBlock(clientId); }, onMerge: function onMerge(forward) { var clientId = ownProps.clientId; var _select3 = select('core/editor'), getPreviousBlockClientId = _select3.getPreviousBlockClientId, getNextBlockClientId = _select3.getNextBlockClientId; if (forward) { var nextBlockClientId = getNextBlockClientId(clientId); if (nextBlockClientId) { mergeBlocks(clientId, nextBlockClientId); } } else { var previousBlockClientId = getPreviousBlockClientId(clientId); if (previousBlockClientId) { mergeBlocks(previousBlockClientId, clientId); } } }, onReplace: function onReplace(blocks) { replaceBlocks([ownProps.clientId], blocks); }, onMetaChange: function onMetaChange(meta) { editPost({ meta: meta }); }, onShiftSelection: function onShiftSelection() { if (!ownProps.isSelectionEnabled) { return; } if (getBlockSelectionStart()) { multiSelect(getBlockSelectionStart(), ownProps.clientId); } else { selectBlock(ownProps.clientId); } }, toggleSelection: function toggleSelection(selectionEnabled) { _toggleSelection(selectionEnabled); } }; }); /* harmony default export */ var block_list_block = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_viewport_["withViewportMatch"])({ isLargeViewport: 'medium' }), applyWithSelect, applyWithDispatch, Object(external_this_wp_components_["withFilters"])('editor.BlockListBlock'))(block_BlockListBlock)); // EXTERNAL MODULE: external {"this":["wp","htmlEntities"]} var external_this_wp_htmlEntities_ = __webpack_require__(49); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/default-block-appender/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function DefaultBlockAppender(_ref) { var isLocked = _ref.isLocked, isVisible = _ref.isVisible, onAppend = _ref.onAppend, showPrompt = _ref.showPrompt, placeholder = _ref.placeholder, rootClientId = _ref.rootClientId, hovered = _ref.hovered, setState = _ref.setState; if (isLocked || !isVisible) { return null; } var value = Object(external_this_wp_htmlEntities_["decodeEntities"])(placeholder) || Object(external_this_wp_i18n_["__"])('Start writing or type / to choose a block'); // The appender "button" is in-fact a text field so as to support // transitions by WritingFlow occurring by arrow key press. WritingFlow // only supports tab transitions into text fields and to the block focus // boundary. // // See: https://github.com/WordPress/gutenberg/issues/4829#issuecomment-374213658 // // If it were ever to be made to be a proper `button` element, it is // important to note that `onFocus` alone would not be sufficient to // capture click events, notably in Firefox. // // See: https://gist.github.com/cvrebert/68659d0333a578d75372 // The wp-block className is important for editor styles. return Object(external_this_wp_element_["createElement"])("div", { "data-root-client-id": rootClientId || '', className: "wp-block editor-default-block-appender", onMouseEnter: function onMouseEnter() { return setState({ hovered: true }); }, onMouseLeave: function onMouseLeave() { return setState({ hovered: false }); } }, Object(external_this_wp_element_["createElement"])(block_drop_zone, { rootClientId: rootClientId }), Object(external_this_wp_element_["createElement"])(react_autosize_textarea_lib_default.a, { role: "button", "aria-label": Object(external_this_wp_i18n_["__"])('Add block'), className: "editor-default-block-appender__content", readOnly: true, onFocus: onAppend, value: showPrompt ? value : '' }), hovered && Object(external_this_wp_element_["createElement"])(inserter_with_shortcuts, { rootClientId: rootClientId }), Object(external_this_wp_element_["createElement"])(inserter, { position: "top right" })); } /* harmony default export */ var default_block_appender = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_compose_["withState"])({ hovered: false }), Object(external_this_wp_data_["withSelect"])(function (select, ownProps) { var _select = select('core/editor'), getBlockCount = _select.getBlockCount, getBlockName = _select.getBlockName, isBlockValid = _select.isBlockValid, getEditorSettings = _select.getEditorSettings, getTemplateLock = _select.getTemplateLock; var isEmpty = !getBlockCount(ownProps.rootClientId); var isLastBlockDefault = getBlockName(ownProps.lastBlockClientId) === Object(external_this_wp_blocks_["getDefaultBlockName"])(); var isLastBlockValid = isBlockValid(ownProps.lastBlockClientId); var _getEditorSettings = getEditorSettings(), bodyPlaceholder = _getEditorSettings.bodyPlaceholder; return { isVisible: isEmpty || !isLastBlockDefault || !isLastBlockValid, showPrompt: isEmpty, isLocked: !!getTemplateLock(ownProps.rootClientId), placeholder: bodyPlaceholder }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, ownProps) { var _dispatch = dispatch('core/editor'), insertDefaultBlock = _dispatch.insertDefaultBlock, startTyping = _dispatch.startTyping; return { onAppend: function onAppend() { var rootClientId = ownProps.rootClientId; insertDefaultBlock(undefined, rootClientId); startTyping(); } }; }))(DefaultBlockAppender)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-list-appender/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function BlockListAppender(_ref) { var blockClientIds = _ref.blockClientIds, rootClientId = _ref.rootClientId, canInsertDefaultBlock = _ref.canInsertDefaultBlock, isLocked = _ref.isLocked; if (isLocked) { return null; } if (canInsertDefaultBlock) { return Object(external_this_wp_element_["createElement"])(ignore_nested_events, { childHandledEvents: ['onFocus', 'onClick', 'onKeyDown'] }, Object(external_this_wp_element_["createElement"])(default_block_appender, { rootClientId: rootClientId, lastBlockClientId: Object(external_lodash_["last"])(blockClientIds) })); } return Object(external_this_wp_element_["createElement"])("div", { className: "block-list-appender" }, Object(external_this_wp_element_["createElement"])(inserter, { rootClientId: rootClientId, renderToggle: function renderToggle(_ref2) { var onToggle = _ref2.onToggle, disabled = _ref2.disabled, isOpen = _ref2.isOpen; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { "aria-label": Object(external_this_wp_i18n_["__"])('Add block'), onClick: onToggle, className: "block-list-appender__toggle", "aria-haspopup": "true", "aria-expanded": isOpen, disabled: disabled }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Dashicon"], { icon: "insert" })); } })); } /* harmony default export */ var block_list_appender = (Object(external_this_wp_data_["withSelect"])(function (select, _ref3) { var rootClientId = _ref3.rootClientId; var _select = select('core/editor'), getBlockOrder = _select.getBlockOrder, canInsertBlockType = _select.canInsertBlockType, getTemplateLock = _select.getTemplateLock; return { isLocked: !!getTemplateLock(rootClientId), blockClientIds: getBlockOrder(rootClientId), canInsertDefaultBlock: canInsertBlockType(Object(external_this_wp_blocks_["getDefaultBlockName"])(), rootClientId) }; })(BlockListAppender)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-list/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var block_list_BlockList = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(BlockList, _Component); function BlockList(props) { var _this; Object(classCallCheck["a" /* default */])(this, BlockList); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(BlockList).call(this, props)); _this.onSelectionStart = _this.onSelectionStart.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onSelectionEnd = _this.onSelectionEnd.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.setBlockRef = _this.setBlockRef.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.setLastClientY = _this.setLastClientY.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onPointerMove = Object(external_lodash_["throttle"])(_this.onPointerMove.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))), 100); // Browser does not fire `*move` event when the pointer position changes // relative to the document, so fire it with the last known position. _this.onScroll = function () { return _this.onPointerMove({ clientY: _this.lastClientY }); }; _this.lastClientY = 0; _this.nodes = {}; return _this; } Object(createClass["a" /* default */])(BlockList, [{ key: "componentDidMount", value: function componentDidMount() { window.addEventListener('mousemove', this.setLastClientY); } }, { key: "componentWillUnmount", value: function componentWillUnmount() { window.removeEventListener('mousemove', this.setLastClientY); } }, { key: "setLastClientY", value: function setLastClientY(_ref) { var clientY = _ref.clientY; this.lastClientY = clientY; } }, { key: "setBlockRef", value: function setBlockRef(node, clientId) { if (node === null) { delete this.nodes[clientId]; } else { this.nodes = Object(objectSpread["a" /* default */])({}, this.nodes, Object(defineProperty["a" /* default */])({}, clientId, node)); } } /** * Handles a pointer move event to update the extent of the current cursor * multi-selection. * * @param {MouseEvent} event A mousemove event object. * * @return {void} */ }, { key: "onPointerMove", value: function onPointerMove(_ref2) { var clientY = _ref2.clientY; // We don't start multi-selection until the mouse starts moving, so as // to avoid dispatching multi-selection actions on an in-place click. if (!this.props.isMultiSelecting) { this.props.onStartMultiSelect(); } var blockContentBoundaries = getBlockDOMNode(this.selectionAtStart).getBoundingClientRect(); // prevent multi-selection from triggering when the selected block is a float // and the cursor is still between the top and the bottom of the block. if (clientY >= blockContentBoundaries.top && clientY <= blockContentBoundaries.bottom) { return; } var y = clientY - blockContentBoundaries.top; var key = Object(external_lodash_["findLast"])(this.coordMapKeys, function (coordY) { return coordY < y; }); this.onSelectionChange(this.coordMap[key]); } /** * Binds event handlers to the document for tracking a pending multi-select * in response to a mousedown event occurring in a rendered block. * * @param {string} clientId Client ID of block where mousedown occurred. * * @return {void} */ }, { key: "onSelectionStart", value: function onSelectionStart(clientId) { if (!this.props.isSelectionEnabled) { return; } var boundaries = this.nodes[clientId].getBoundingClientRect(); // Create a clientId to Y coördinate map. var clientIdToCoordMap = Object(external_lodash_["mapValues"])(this.nodes, function (node) { return node.getBoundingClientRect().top - boundaries.top; }); // Cache a Y coördinate to clientId map for use in `onPointerMove`. this.coordMap = Object(external_lodash_["invert"])(clientIdToCoordMap); // Cache an array of the Y coördinates for use in `onPointerMove`. // Sort the coördinates, as `this.nodes` will not necessarily reflect // the current block sequence. this.coordMapKeys = Object(external_lodash_["sortBy"])(Object.values(clientIdToCoordMap)); this.selectionAtStart = clientId; window.addEventListener('mousemove', this.onPointerMove); // Capture scroll on all elements. window.addEventListener('scroll', this.onScroll, true); window.addEventListener('mouseup', this.onSelectionEnd); } /** * Handles multi-selection changes in response to pointer move. * * @param {string} clientId Client ID of block under cursor in multi-select * drag. */ }, { key: "onSelectionChange", value: function onSelectionChange(clientId) { var _this$props = this.props, onMultiSelect = _this$props.onMultiSelect, selectionStart = _this$props.selectionStart, selectionEnd = _this$props.selectionEnd; var selectionAtStart = this.selectionAtStart; var isAtStart = selectionAtStart === clientId; if (!selectionAtStart || !this.props.isSelectionEnabled) { return; } // If multi-selecting and cursor extent returns to the start of // selection, cancel multi-select. if (isAtStart && selectionStart) { onMultiSelect(null, null); } // Expand multi-selection to block under cursor. if (!isAtStart && selectionEnd !== clientId) { onMultiSelect(selectionAtStart, clientId); } } /** * Handles a mouseup event to end the current cursor multi-selection. * * @return {void} */ }, { key: "onSelectionEnd", value: function onSelectionEnd() { // Cancel throttled calls. this.onPointerMove.cancel(); delete this.coordMap; delete this.coordMapKeys; delete this.selectionAtStart; window.removeEventListener('mousemove', this.onPointerMove); window.removeEventListener('scroll', this.onScroll, true); window.removeEventListener('mouseup', this.onSelectionEnd); // We may or may not be in a multi-selection when mouseup occurs (e.g. // an in-place mouse click), so only trigger stop if multi-selecting. if (this.props.isMultiSelecting) { this.props.onStopMultiSelect(); } } }, { key: "render", value: function render() { var _this2 = this; var _this$props2 = this.props, blockClientIds = _this$props2.blockClientIds, rootClientId = _this$props2.rootClientId, isDraggable = _this$props2.isDraggable; return Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-list__layout" }, Object(external_lodash_["map"])(blockClientIds, function (clientId, blockIndex) { return Object(external_this_wp_element_["createElement"])(block_list_block, { key: 'block-' + clientId, index: blockIndex, clientId: clientId, blockRef: _this2.setBlockRef, onSelectionStart: _this2.onSelectionStart, rootClientId: rootClientId, isFirst: blockIndex === 0, isLast: blockIndex === blockClientIds.length - 1, isDraggable: isDraggable }); }), Object(external_this_wp_element_["createElement"])(block_list_appender, { rootClientId: rootClientId })); } }]); return BlockList; }(external_this_wp_element_["Component"]); /* harmony default export */ var block_list = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, ownProps) { var _select = select('core/editor'), getBlockOrder = _select.getBlockOrder, isSelectionEnabled = _select.isSelectionEnabled, isMultiSelecting = _select.isMultiSelecting, getMultiSelectedBlocksStartClientId = _select.getMultiSelectedBlocksStartClientId, getMultiSelectedBlocksEndClientId = _select.getMultiSelectedBlocksEndClientId; var rootClientId = ownProps.rootClientId; return { blockClientIds: getBlockOrder(rootClientId), selectionStart: getMultiSelectedBlocksStartClientId(), selectionEnd: getMultiSelectedBlocksEndClientId(), isSelectionEnabled: isSelectionEnabled(), isMultiSelecting: isMultiSelecting() }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { var _dispatch = dispatch('core/editor'), startMultiSelect = _dispatch.startMultiSelect, stopMultiSelect = _dispatch.stopMultiSelect, multiSelect = _dispatch.multiSelect; return { onStartMultiSelect: startMultiSelect, onStopMultiSelect: stopMultiSelect, onMultiSelect: multiSelect }; })])(block_list_BlockList)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/inner-blocks/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var inner_blocks_InnerBlocks = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(InnerBlocks, _Component); function InnerBlocks() { var _this; Object(classCallCheck["a" /* default */])(this, InnerBlocks); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(InnerBlocks).apply(this, arguments)); _this.state = { templateInProcess: !!_this.props.template }; _this.updateNestedSettings(); return _this; } Object(createClass["a" /* default */])(InnerBlocks, [{ key: "getTemplateLock", value: function getTemplateLock() { var _this$props = this.props, templateLock = _this$props.templateLock, parentLock = _this$props.parentLock; return templateLock === undefined ? parentLock : templateLock; } }, { key: "componentDidMount", value: function componentDidMount() { var innerBlocks = this.props.block.innerBlocks; // only synchronize innerBlocks with template if innerBlocks are empty or a locking all exists if (innerBlocks.length === 0 || this.getTemplateLock() === 'all') { this.synchronizeBlocksWithTemplate(); } if (this.state.templateInProcess) { this.setState({ templateInProcess: false }); } } }, { key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { var _this$props2 = this.props, template = _this$props2.template, block = _this$props2.block; var innerBlocks = block.innerBlocks; this.updateNestedSettings(); // only synchronize innerBlocks with template if innerBlocks are empty or a locking all exists if (innerBlocks.length === 0 || this.getTemplateLock() === 'all') { var hasTemplateChanged = !Object(external_lodash_["isEqual"])(template, prevProps.template); if (hasTemplateChanged) { this.synchronizeBlocksWithTemplate(); } } } /** * Called on mount or when a mismatch exists between the templates and * inner blocks, synchronizes inner blocks with the template, replacing * current blocks. */ }, { key: "synchronizeBlocksWithTemplate", value: function synchronizeBlocksWithTemplate() { var _this$props3 = this.props, template = _this$props3.template, block = _this$props3.block, replaceInnerBlocks = _this$props3.replaceInnerBlocks; var innerBlocks = block.innerBlocks; // Synchronize with templates. If the next set differs, replace. var nextBlocks = Object(external_this_wp_blocks_["synchronizeBlocksWithTemplate"])(innerBlocks, template); if (!Object(external_lodash_["isEqual"])(nextBlocks, innerBlocks)) { replaceInnerBlocks(nextBlocks); } } }, { key: "updateNestedSettings", value: function updateNestedSettings() { var _this$props4 = this.props, blockListSettings = _this$props4.blockListSettings, allowedBlocks = _this$props4.allowedBlocks, updateNestedSettings = _this$props4.updateNestedSettings; var newSettings = { allowedBlocks: allowedBlocks, templateLock: this.getTemplateLock() }; if (!external_this_wp_isShallowEqual_default()(blockListSettings, newSettings)) { updateNestedSettings(newSettings); } } }, { key: "render", value: function render() { var _this$props5 = this.props, clientId = _this$props5.clientId, isSmallScreen = _this$props5.isSmallScreen, isSelectedBlockInRoot = _this$props5.isSelectedBlockInRoot; var templateInProcess = this.state.templateInProcess; var classes = classnames_default()('editor-inner-blocks', { 'has-overlay': isSmallScreen && !isSelectedBlockInRoot }); return Object(external_this_wp_element_["createElement"])("div", { className: classes }, !templateInProcess && Object(external_this_wp_element_["createElement"])(block_list, { rootClientId: clientId })); } }]); return InnerBlocks; }(external_this_wp_element_["Component"]); inner_blocks_InnerBlocks = Object(external_this_wp_compose_["compose"])([context_withBlockEditContext(function (context) { return Object(external_lodash_["pick"])(context, ['clientId']); }), Object(external_this_wp_viewport_["withViewportMatch"])({ isSmallScreen: '< medium' }), Object(external_this_wp_data_["withSelect"])(function (select, ownProps) { var _select = select('core/editor'), isBlockSelected = _select.isBlockSelected, hasSelectedInnerBlock = _select.hasSelectedInnerBlock, getBlock = _select.getBlock, getBlockListSettings = _select.getBlockListSettings, getBlockRootClientId = _select.getBlockRootClientId, getTemplateLock = _select.getTemplateLock; var clientId = ownProps.clientId; var rootClientId = getBlockRootClientId(clientId); return { isSelectedBlockInRoot: isBlockSelected(clientId) || hasSelectedInnerBlock(clientId), block: getBlock(clientId), blockListSettings: getBlockListSettings(clientId), parentLock: getTemplateLock(rootClientId) }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, ownProps) { var _dispatch = dispatch('core/editor'), replaceBlocks = _dispatch.replaceBlocks, insertBlocks = _dispatch.insertBlocks, updateBlockListSettings = _dispatch.updateBlockListSettings; var block = ownProps.block, clientId = ownProps.clientId, _ownProps$templateIns = ownProps.templateInsertUpdatesSelection, templateInsertUpdatesSelection = _ownProps$templateIns === void 0 ? true : _ownProps$templateIns; return { replaceInnerBlocks: function replaceInnerBlocks(blocks) { var clientIds = Object(external_lodash_["map"])(block.innerBlocks, 'clientId'); if (clientIds.length) { replaceBlocks(clientIds, blocks); } else { insertBlocks(blocks, undefined, clientId, templateInsertUpdatesSelection); } }, updateNestedSettings: function updateNestedSettings(settings) { dispatch(updateBlockListSettings(clientId, settings)); } }; })])(inner_blocks_InnerBlocks); inner_blocks_InnerBlocks.Content = Object(external_this_wp_blocks_["withBlockContentContext"])(function (_ref) { var BlockContent = _ref.BlockContent; return Object(external_this_wp_element_["createElement"])(BlockContent, null); }); /* harmony default export */ var inner_blocks = (inner_blocks_InnerBlocks); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/inspector-advanced-controls/index.js /** * WordPress dependencies */ /** * Internal dependencies */ var inspector_advanced_controls_createSlotFill = Object(external_this_wp_components_["createSlotFill"])('InspectorAdvancedControls'), inspector_advanced_controls_Fill = inspector_advanced_controls_createSlotFill.Fill, inspector_advanced_controls_Slot = inspector_advanced_controls_createSlotFill.Slot; var InspectorAdvancedControls = ifBlockEditSelected(inspector_advanced_controls_Fill); InspectorAdvancedControls.Slot = inspector_advanced_controls_Slot; /* harmony default export */ var inspector_advanced_controls = (InspectorAdvancedControls); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/inspector-controls/index.js /** * WordPress dependencies */ /** * Internal dependencies */ var inspector_controls_createSlotFill = Object(external_this_wp_components_["createSlotFill"])('InspectorControls'), inspector_controls_Fill = inspector_controls_createSlotFill.Fill, inspector_controls_Slot = inspector_controls_createSlotFill.Slot; var InspectorControls = ifBlockEditSelected(inspector_controls_Fill); InspectorControls.Slot = inspector_controls_Slot; /* harmony default export */ var inspector_controls = (InspectorControls); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/color-palette/control.js /** * WordPress dependencies */ /** * Internal dependencies */ // translators: first %s: The type of color (e.g. background color), second %s: the color name or value (e.g. red or #ff0000) var colorIndicatorAriaLabel = Object(external_this_wp_i18n_["__"])('(current %s: %s)'); function ColorPaletteControl(_ref) { var colors = _ref.colors, disableCustomColors = _ref.disableCustomColors, label = _ref.label, onChange = _ref.onChange, value = _ref.value; var colorObject = utils_getColorObjectByColorValue(colors, value); var colorName = colorObject && colorObject.name; var ariaLabel = Object(external_this_wp_i18n_["sprintf"])(colorIndicatorAriaLabel, label.toLowerCase(), colorName || value); var labelElement = Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, label, value && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ColorIndicator"], { colorValue: value, "aria-label": ariaLabel })); return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["BaseControl"], { className: "editor-color-palette-control", label: labelElement }, Object(external_this_wp_element_["createElement"])(color_palette, Object(esm_extends["a" /* default */])({ className: "editor-color-palette-control__color-palette", value: value, onChange: onChange }, { colors: colors, disableCustomColors: disableCustomColors }))); } /* harmony default export */ var color_palette_control = (Object(external_this_wp_compose_["compose"])([with_color_context, Object(external_this_wp_compose_["ifCondition"])(function (_ref2) { var hasColorsToChoose = _ref2.hasColorsToChoose; return hasColorsToChoose; })])(ColorPaletteControl)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/panel-color-settings/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var hasCustomColorsDisabledForSetting = function hasCustomColorsDisabledForSetting(disableCustomColors, colorSetting) { if (colorSetting.disableCustomColors !== undefined) { return colorSetting.disableCustomColors; } return disableCustomColors; }; var hasColorsToChooseInSetting = function hasColorsToChooseInSetting() { var colors = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var disableCustomColors = arguments.length > 1 ? arguments[1] : undefined; var colorSetting = arguments.length > 2 ? arguments[2] : undefined; if (!hasCustomColorsDisabledForSetting(disableCustomColors, colorSetting)) { return true; } return (colorSetting.colors || colors).length > 0; }; var panel_color_settings_hasColorsToChoose = function hasColorsToChoose(_ref) { var colors = _ref.colors, disableCustomColors = _ref.disableCustomColors, colorSettings = _ref.colorSettings; return Object(external_lodash_["some"])(colorSettings, function (colorSetting) { return hasColorsToChooseInSetting(colors, disableCustomColors, colorSetting); }); }; // translators: first %s: The type of color (e.g. background color), second %s: the color name or value (e.g. red or #ff0000) var panel_color_settings_colorIndicatorAriaLabel = Object(external_this_wp_i18n_["__"])('(%s: %s)'); var panel_color_settings_renderColorIndicators = function renderColorIndicators(colorSettings, colors) { return colorSettings.map(function (_ref2, index) { var value = _ref2.value, label = _ref2.label, availableColors = _ref2.colors; if (!value) { return null; } var colorObject = utils_getColorObjectByColorValue(availableColors || colors, value); var colorName = colorObject && colorObject.name; var ariaLabel = Object(external_this_wp_i18n_["sprintf"])(panel_color_settings_colorIndicatorAriaLabel, label.toLowerCase(), colorName || value); return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ColorIndicator"], { key: index, colorValue: value, "aria-label": ariaLabel }); }); }; // colorSettings is passed as an array of props so that it can be used for // mapping both ColorIndicator and ColorPaletteControl components. Passing // an array of components/nodes here wouldn't be feasible. var PanelColorSettings = Object(external_this_wp_compose_["ifCondition"])(panel_color_settings_hasColorsToChoose)(function (_ref3) { var children = _ref3.children, colors = _ref3.colors, colorSettings = _ref3.colorSettings, disableCustomColors = _ref3.disableCustomColors, title = _ref3.title, props = Object(objectWithoutProperties["a" /* default */])(_ref3, ["children", "colors", "colorSettings", "disableCustomColors", "title"]); var className = 'editor-panel-color-settings'; var titleElement = Object(external_this_wp_element_["createElement"])("span", { className: "".concat(className, "__panel-title") }, title, panel_color_settings_renderColorIndicators(colorSettings, colors)); return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], Object(esm_extends["a" /* default */])({ className: className, title: titleElement }, props), colorSettings.map(function (settings, index) { return Object(external_this_wp_element_["createElement"])(color_palette_control, Object(esm_extends["a" /* default */])({ key: index }, Object(objectSpread["a" /* default */])({ colors: colors, disableCustomColors: disableCustomColors }, settings))); }), children); }); /* harmony default export */ var panel_color_settings = (with_color_context(PanelColorSettings)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/plain-text/index.js /** * External dependencies */ function PlainText(_ref) { var _onChange = _ref.onChange, className = _ref.className, props = Object(objectWithoutProperties["a" /* default */])(_ref, ["onChange", "className"]); return Object(external_this_wp_element_["createElement"])(react_autosize_textarea_lib_default.a, Object(esm_extends["a" /* default */])({ className: classnames_default()('editor-plain-text', className), onChange: function onChange(event) { return _onChange(event.target.value); } }, props)); } /* harmony default export */ var plain_text = (PlainText); // EXTERNAL MODULE: ./node_modules/memize/index.js var memize = __webpack_require__(41); var memize_default = /*#__PURE__*/__webpack_require__.n(memize); // EXTERNAL MODULE: external {"this":["wp","blob"]} var external_this_wp_blob_ = __webpack_require__(32); // EXTERNAL MODULE: external {"this":["wp","deprecated"]} var external_this_wp_deprecated_ = __webpack_require__(65); var external_this_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_deprecated_); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/rich-text/format-edit.js /** * WordPress dependencies */ var format_edit_FormatEdit = function FormatEdit(_ref) { var formatTypes = _ref.formatTypes, onChange = _ref.onChange, value = _ref.value; return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, formatTypes.map(function (_ref2) { var name = _ref2.name, Edit = _ref2.edit; if (!Edit) { return null; } var activeFormat = Object(external_this_wp_richText_["getActiveFormat"])(value, name); var isActive = activeFormat !== undefined; var activeAttributes = isActive ? activeFormat.attributes || {} : {}; return Object(external_this_wp_element_["createElement"])(Edit, { key: name, isActive: isActive, activeAttributes: activeAttributes, value: value, onChange: onChange }); })); }; /* harmony default export */ var format_edit = (Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/rich-text'), getFormatTypes = _select.getFormatTypes; return { formatTypes: getFormatTypes() }; })(format_edit_FormatEdit)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/rich-text/format-toolbar/index.js /** * WordPress dependencies */ var format_toolbar_FormatToolbar = function FormatToolbar(_ref) { var controls = _ref.controls; return Object(external_this_wp_element_["createElement"])("div", { className: "editor-format-toolbar" }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Toolbar"], null, controls.map(function (format) { return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Slot"], { name: "RichText.ToolbarControls.".concat(format), key: format }); }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Slot"], { name: "RichText.ToolbarControls" }))); }; /* harmony default export */ var format_toolbar = (format_toolbar_FormatToolbar); // EXTERNAL MODULE: external "tinymce" var external_tinymce_ = __webpack_require__(192); var external_tinymce_default = /*#__PURE__*/__webpack_require__.n(external_tinymce_); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/rich-text/aria.js /** * External dependencies */ var aria_isAriaPropName = function isAriaPropName(name) { return Object(external_lodash_["startsWith"])(name, 'aria-'); }; var aria_pickAriaProps = function pickAriaProps(props) { return Object(external_lodash_["pickBy"])(props, function (value, key) { return aria_isAriaPropName(key) && !Object(external_lodash_["isNil"])(value); }); }; var aria_diffAriaProps = function diffAriaProps(props, nextProps) { var prevAriaKeys = Object(external_lodash_["keys"])(aria_pickAriaProps(props)); var nextAriaKeys = Object(external_lodash_["keys"])(aria_pickAriaProps(nextProps)); var removedKeys = Object(external_lodash_["difference"])(prevAriaKeys, nextAriaKeys); var updatedKeys = nextAriaKeys.filter(function (key) { return !Object(external_lodash_["isEqual"])(props[key], nextProps[key]); }); return { removedKeys: removedKeys, updatedKeys: updatedKeys }; }; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/rich-text/tinymce.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Browser dependencies */ var tinymce_window = window, tinymce_getSelection = tinymce_window.getSelection; var TEXT_NODE = window.Node.TEXT_NODE; var userAgent = window.navigator.userAgent; /** * Zero-width space character used by TinyMCE as a caret landing point for * inline boundary nodes. * * @see tinymce/src/core/main/ts/text/Zwsp.ts * * @type {string} */ var TINYMCE_ZWSP = "\uFEFF"; /** * Applies a fix that provides `input` events for contenteditable in Internet Explorer. * * @param {Element} editorNode The root editor node. * * @return {Function} A function to remove the fix (for cleanup). */ function applyInternetExplorerInputFix(editorNode) { /** * Dispatches `input` events in response to `textinput` events. * * IE provides a `textinput` event that is similar to an `input` event, * and we use it to manually dispatch an `input` event. * `textinput` is dispatched for text entry but for not deletions. * * @param {Event} textInputEvent An Internet Explorer `textinput` event. */ function mapTextInputEvent(textInputEvent) { textInputEvent.stopImmediatePropagation(); var inputEvent = document.createEvent('Event'); inputEvent.initEvent('input', true, false); inputEvent.data = textInputEvent.data; textInputEvent.target.dispatchEvent(inputEvent); } /** * Dispatches `input` events in response to Delete and Backspace keyup. * * It would be better dispatch an `input` event after each deleting * `keydown` because the DOM is updated after each, but it is challenging * to determine the right time to dispatch `input` since propagation of * `keydown` can be stopped at any point. * * It's easier to listen for `keyup` in the capture phase and dispatch * `input` before `keyup` propagates further. It's not perfect, but should * be good enough. * * @param {KeyboardEvent} keyUp * @param {Node} keyUp.target The event target. * @param {number} keyUp.keyCode The key code. */ function mapDeletionKeyUpEvents(_ref) { var target = _ref.target, keyCode = _ref.keyCode; var isDeletion = external_this_wp_keycodes_["BACKSPACE"] === keyCode || external_this_wp_keycodes_["DELETE"] === keyCode; if (isDeletion && editorNode.contains(target)) { var inputEvent = document.createEvent('Event'); inputEvent.initEvent('input', true, false); inputEvent.data = null; target.dispatchEvent(inputEvent); } } editorNode.addEventListener('textinput', mapTextInputEvent); document.addEventListener('keyup', mapDeletionKeyUpEvents, true); return function removeInternetExplorerInputFix() { editorNode.removeEventListener('textinput', mapTextInputEvent); document.removeEventListener('keyup', mapDeletionKeyUpEvents, true); }; } var IS_PLACEHOLDER_VISIBLE_ATTR_NAME = 'data-is-placeholder-visible'; /** * Whether or not the user agent is Internet Explorer. * * @type {boolean} */ var IS_IE = userAgent.indexOf('Trident') >= 0; var tinymce_TinyMCE = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(TinyMCE, _Component); function TinyMCE() { var _this; Object(classCallCheck["a" /* default */])(this, TinyMCE); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(TinyMCE).call(this)); _this.bindEditorNode = _this.bindEditorNode.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onFocus = _this.onFocus.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.initialize = _this.initialize.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); return _this; } Object(createClass["a" /* default */])(TinyMCE, [{ key: "onFocus", value: function onFocus() { if (this.props.onFocus) { this.props.onFocus(); } this.initialize(); } // We must prevent rerenders because RichText, the browser, and TinyMCE will // modify the DOM. React will rerender the DOM fine, but we're losing // selection and it would be more expensive to do so as it would just set // the inner HTML through `dangerouslySetInnerHTML`. Instead RichText does // it's own diffing and selection setting. // // Because we never update the component, we have to look through props and // update the attributes on the wrapper nodes here. `componentDidUpdate` // will never be called. }, { key: "shouldComponentUpdate", value: function shouldComponentUpdate(nextProps) { var _this2 = this; this.configureIsPlaceholderVisible(nextProps.isPlaceholderVisible); if (!Object(external_lodash_["isEqual"])(this.props.style, nextProps.style)) { this.editorNode.setAttribute('style', ''); Object.assign(this.editorNode.style, nextProps.style); } if (!Object(external_lodash_["isEqual"])(this.props.className, nextProps.className)) { this.editorNode.className = classnames_default()(nextProps.className, 'editor-rich-text__tinymce'); } var _diffAriaProps = aria_diffAriaProps(this.props, nextProps), removedKeys = _diffAriaProps.removedKeys, updatedKeys = _diffAriaProps.updatedKeys; removedKeys.forEach(function (key) { return _this2.editorNode.removeAttribute(key); }); updatedKeys.forEach(function (key) { return _this2.editorNode.setAttribute(key, nextProps[key]); }); return false; } }, { key: "componentWillUnmount", value: function componentWillUnmount() { if (!this.editor) { return; } this.editor.destroy(); delete this.editor; } }, { key: "configureIsPlaceholderVisible", value: function configureIsPlaceholderVisible(isPlaceholderVisible) { var isPlaceholderVisibleString = String(!!isPlaceholderVisible); if (this.editorNode.getAttribute(IS_PLACEHOLDER_VISIBLE_ATTR_NAME) !== isPlaceholderVisibleString) { this.editorNode.setAttribute(IS_PLACEHOLDER_VISIBLE_ATTR_NAME, isPlaceholderVisibleString); } } /** * Initializes TinyMCE. Can only be called once per instance. */ }, { key: "initialize", value: function initialize() { var _this3 = this; if (this.initialize.called) { return; } this.initialize.called = true; var multilineTag = this.props.multilineTag; var settings = { theme: false, inline: true, toolbar: false, browser_spellcheck: true, entity_encoding: 'raw', convert_urls: false, // Disables TinyMCE's parsing to verify HTML. It makes // initialisation a bit faster. Since we're setting raw HTML // already with dangerouslySetInnerHTML, we don't need this to be // verified. verify_html: false, inline_boundaries_selector: 'a[href],code,b,i,strong,em,del,ins,sup,sub', plugins: [], forced_root_block: multilineTag || false, // Allow TinyMCE to keep one undo level for comparing changes. // Prevent it otherwise from accumulating any history. custom_undo_redo_levels: 1, lists_indent_on_tab: false }; external_tinymce_default.a.init(Object(objectSpread["a" /* default */])({}, settings, { target: this.editorNode, setup: function setup(editor) { _this3.editor = editor; // TinyMCE resets the element content on initialization, even // when it's already identical to what exists currently. This // behavior clobbers a selection which exists at the time of // initialization, thus breaking writing flow navigation. The // hack here neutralizes setHTML during initialization. var setHTML; editor.on('preinit', function () { setHTML = editor.dom.setHTML; editor.dom.setHTML = function () {}; }); editor.on('init', function () { // History is handled internally by RichText. // // See: https://github.com/tinymce/tinymce/blob/master/src/core/main/ts/api/UndoManager.ts ['z', 'y'].forEach(function (character) { editor.shortcuts.remove("meta+".concat(character)); }); editor.shortcuts.remove('meta+shift+z'); // Reset TinyMCE's default formatting shortcuts, since // RichText supports only registered formats. // // See: https://github.com/tinymce/tinymce/blob/master/src/core/main/ts/keyboard/FormatShortcuts.ts ['b', 'i', 'u'].forEach(function (character) { editor.shortcuts.remove("meta+".concat(character)); }); [1, 2, 3, 4, 5, 6, 7, 8, 9].forEach(function (number) { editor.shortcuts.remove("access+".concat(number)); }); // Restore the original `setHTML` once initialized. editor.dom.setHTML = setHTML; // In IE11, focus is lost to parent after initialising // TinyMCE, so we have to set it back. if (IS_IE && document.activeElement !== _this3.editorNode && document.activeElement.contains(_this3.editorNode)) { _this3.editorNode.focus(); } }); editor.on('keydown', _this3.onKeyDown, true); } })); } }, { key: "bindEditorNode", value: function bindEditorNode(editorNode) { this.editorNode = editorNode; if (this.props.setRef) { this.props.setRef(editorNode); } if (IS_IE) { if (editorNode) { // Mounting: this.removeInternetExplorerInputFix = applyInternetExplorerInputFix(editorNode); } else { // Unmounting: this.removeInternetExplorerInputFix(); } } } }, { key: "onKeyDown", value: function onKeyDown(event) { var keyCode = event.keyCode; var isDelete = keyCode === external_this_wp_keycodes_["DELETE"] || keyCode === external_this_wp_keycodes_["BACKSPACE"]; // Disables TinyMCE behaviour. if (keyCode === external_this_wp_keycodes_["ENTER"] || isDelete && Object(external_this_wp_dom_["isEntirelySelected"])(this.editorNode)) { event.preventDefault(); // For some reason this is needed to also prevent the insertion of // line breaks. return false; } // Handles a horizontal navigation key down event to handle the case // where TinyMCE attempts to preventDefault when on the outside edge of // an inline boundary when arrowing _away_ from the boundary, not within // it. Replaces the TinyMCE event `preventDefault` behavior with a noop, // such that those relying on `defaultPrevented` are not misinformed // about the arrow event. // // If TinyMCE#4476 is resolved, this handling may be removed. // // @see https://github.com/tinymce/tinymce/issues/4476 if (keyCode !== external_this_wp_keycodes_["LEFT"] && keyCode !== external_this_wp_keycodes_["RIGHT"]) { return; } var _getSelection = tinymce_getSelection(), focusNode = _getSelection.focusNode; var nodeType = focusNode.nodeType, nodeValue = focusNode.nodeValue; if (nodeType !== TEXT_NODE) { return; } if (nodeValue.length !== 1 || nodeValue[0] !== TINYMCE_ZWSP) { return; } // Consider to be moving away from inline boundary based on: // // 1. Within a text fragment consisting only of ZWSP. // 2. If in reverse, there is no previous sibling. If forward, there is // no next sibling (i.e. end of node). var isReverse = event.keyCode === external_this_wp_keycodes_["LEFT"]; var edgeSibling = isReverse ? 'previousSibling' : 'nextSibling'; if (!focusNode[edgeSibling]) { // Note: This is not reassigning on the native event, rather the // "fixed" TinyMCE copy, which proxies its preventDefault to the // native event. By reassigning here, we're effectively preventing // the proxied call on the native event, but not otherwise mutating // the original event object. event.preventDefault = external_lodash_["noop"]; } } }, { key: "render", value: function render() { var _objectSpread2; var ariaProps = aria_pickAriaProps(this.props); var _this$props = this.props, _this$props$tagName = _this$props.tagName, tagName = _this$props$tagName === void 0 ? 'div' : _this$props$tagName, style = _this$props.style, record = _this$props.record, valueToEditableHTML = _this$props.valueToEditableHTML, className = _this$props.className, isPlaceholderVisible = _this$props.isPlaceholderVisible, onPaste = _this$props.onPaste, onInput = _this$props.onInput, onKeyDown = _this$props.onKeyDown, onCompositionEnd = _this$props.onCompositionEnd, onBlur = _this$props.onBlur; /* * The role=textbox and aria-multiline=true must always be used together * as TinyMCE always behaves like a sort of textarea where text wraps in * multiple lines. Only the table block editable element is excluded. */ if (tagName !== 'table') { ariaProps.role = 'textbox'; ariaProps['aria-multiline'] = true; } // If a default value is provided, render it into the DOM even before // TinyMCE finishes initializing. This avoids a short delay by allowing // us to show and focus the content before it's truly ready to edit. return Object(external_this_wp_element_["createElement"])(tagName, Object(objectSpread["a" /* default */])({}, ariaProps, (_objectSpread2 = { className: classnames_default()(className, 'editor-rich-text__tinymce'), contentEditable: true }, Object(defineProperty["a" /* default */])(_objectSpread2, IS_PLACEHOLDER_VISIBLE_ATTR_NAME, isPlaceholderVisible), Object(defineProperty["a" /* default */])(_objectSpread2, "ref", this.bindEditorNode), Object(defineProperty["a" /* default */])(_objectSpread2, "style", style), Object(defineProperty["a" /* default */])(_objectSpread2, "suppressContentEditableWarning", true), Object(defineProperty["a" /* default */])(_objectSpread2, "dangerouslySetInnerHTML", { __html: valueToEditableHTML(record) }), Object(defineProperty["a" /* default */])(_objectSpread2, "onPaste", onPaste), Object(defineProperty["a" /* default */])(_objectSpread2, "onInput", onInput), Object(defineProperty["a" /* default */])(_objectSpread2, "onFocus", this.onFocus), Object(defineProperty["a" /* default */])(_objectSpread2, "onBlur", onBlur), Object(defineProperty["a" /* default */])(_objectSpread2, "onKeyDown", onKeyDown), Object(defineProperty["a" /* default */])(_objectSpread2, "onCompositionEnd", onCompositionEnd), _objectSpread2))); } }]); return TinyMCE; }(external_this_wp_element_["Component"]); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/rich-text/patterns.js /** * WordPress dependencies */ function getPatterns(_ref) { var onReplace = _ref.onReplace, valueToFormat = _ref.valueToFormat, onCreateUndoLevel = _ref.onCreateUndoLevel, onChange = _ref.onChange; var prefixTransforms = Object(external_this_wp_blocks_["getBlockTransforms"])('from').filter(function (_ref2) { var type = _ref2.type; return type === 'prefix'; }); return [function (record) { if (!onReplace) { return record; } var start = Object(external_this_wp_richText_["getSelectionStart"])(record); var text = Object(external_this_wp_richText_["getTextContent"])(record); var characterBefore = text.slice(start - 1, start); if (!/\s/.test(characterBefore)) { return record; } var trimmedTextBefore = text.slice(0, start).trim(); var transformation = Object(external_this_wp_blocks_["findTransform"])(prefixTransforms, function (_ref3) { var prefix = _ref3.prefix; return trimmedTextBefore === prefix; }); if (!transformation) { return record; } var content = valueToFormat(Object(external_this_wp_richText_["slice"])(record, start, text.length)); var block = transformation.transform(content); onCreateUndoLevel(); onReplace([block]); return record; }, function (record) { var BACKTICK = '`'; var start = Object(external_this_wp_richText_["getSelectionStart"])(record); var text = Object(external_this_wp_richText_["getTextContent"])(record); var characterBefore = text.slice(start - 1, start); // Quick check the text for the necessary character. if (characterBefore !== BACKTICK) { return record; } var textBefore = text.slice(0, start - 1); var indexBefore = textBefore.lastIndexOf(BACKTICK); if (indexBefore === -1) { return record; } var startIndex = indexBefore; var endIndex = start - 2; if (startIndex === endIndex) { return record; } onChange(record); record = Object(external_this_wp_richText_["remove"])(record, startIndex, startIndex + 1); record = Object(external_this_wp_richText_["remove"])(record, endIndex, endIndex + 1); record = Object(external_this_wp_richText_["applyFormat"])(record, { type: 'code' }, startIndex, endIndex); return record; }]; } // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/rich-text/shortcut.js /** * WordPress dependencies */ var shortcut_RichTextShortcut = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(RichTextShortcut, _Component); function RichTextShortcut() { var _this; Object(classCallCheck["a" /* default */])(this, RichTextShortcut); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(RichTextShortcut).apply(this, arguments)); _this.onUse = _this.onUse.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); return _this; } Object(createClass["a" /* default */])(RichTextShortcut, [{ key: "onUse", value: function onUse() { this.props.onUse(); return false; } }, { key: "render", value: function render() { var _this$props = this.props, character = _this$props.character, type = _this$props.type; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["KeyboardShortcuts"], { bindGlobal: true, shortcuts: Object(defineProperty["a" /* default */])({}, external_this_wp_keycodes_["rawShortcut"][type](character), this.onUse) }); } }]); return RichTextShortcut; }(external_this_wp_element_["Component"]); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/rich-text/list-edit.js /** * WordPress dependencies */ /** * Internal dependencies */ var _window$Node = window.Node, list_edit_TEXT_NODE = _window$Node.TEXT_NODE, ELEMENT_NODE = _window$Node.ELEMENT_NODE; /** * Gets the selected list node, which is the closest list node to the start of * the selection. * * @return {?Element} The selected list node, or undefined if none is selected. */ function getSelectedListNode() { var selection = window.getSelection(); if (selection.rangeCount === 0) { return; } var _selection$getRangeAt = selection.getRangeAt(0), startContainer = _selection$getRangeAt.startContainer; if (startContainer.nodeType === list_edit_TEXT_NODE) { startContainer = startContainer.parentNode; } if (startContainer.nodeType !== ELEMENT_NODE) { return; } var rootNode = startContainer.closest('*[contenteditable]'); if (!rootNode || !rootNode.contains(startContainer)) { return; } return startContainer.closest('ol,ul'); } /** * Whether or not the root list is selected. * * @return {boolean} True if the root list or nothing is selected, false if an * inner list is selected. */ function isListRootSelected() { var listNode = getSelectedListNode(); // Consider the root list selected if nothing is selected. return !listNode || listNode.contentEditable === 'true'; } /** * Wether or not the selected list has the given tag name. * * @param {string} tagName The tag name the list should have. * @param {string} rootTagName The current root tag name, to compare with in * case nothing is selected. * * @return {boolean} [description] */ function isActiveListType(tagName, rootTagName) { var listNode = getSelectedListNode(); if (!listNode) { return tagName === rootTagName; } return listNode.nodeName.toLowerCase() === tagName; } var list_edit_ListEdit = function ListEdit(_ref) { var onTagNameChange = _ref.onTagNameChange, tagName = _ref.tagName, value = _ref.value, onChange = _ref.onChange; return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(shortcut_RichTextShortcut, { type: "primary", character: "[", onUse: function onUse() { onChange(Object(external_this_wp_richText_["outdentListItems"])(value)); } }), Object(external_this_wp_element_["createElement"])(shortcut_RichTextShortcut, { type: "primary", character: "]", onUse: function onUse() { onChange(Object(external_this_wp_richText_["indentListItems"])(value, { type: tagName })); } }), Object(external_this_wp_element_["createElement"])(shortcut_RichTextShortcut, { type: "primary", character: "m", onUse: function onUse() { onChange(Object(external_this_wp_richText_["indentListItems"])(value, { type: tagName })); } }), Object(external_this_wp_element_["createElement"])(shortcut_RichTextShortcut, { type: "primaryShift", character: "m", onUse: function onUse() { onChange(Object(external_this_wp_richText_["outdentListItems"])(value)); } }), Object(external_this_wp_element_["createElement"])(block_format_controls, null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Toolbar"], { controls: [{ icon: 'editor-ul', title: Object(external_this_wp_i18n_["__"])('Convert to unordered list'), isActive: isActiveListType('ul', tagName), onClick: function onClick() { onChange(Object(external_this_wp_richText_["changeListType"])(value, { type: 'ul' })); if (isListRootSelected()) { onTagNameChange('ul'); } } }, { icon: 'editor-ol', title: Object(external_this_wp_i18n_["__"])('Convert to ordered list'), isActive: isActiveListType('ol', tagName), onClick: function onClick() { onChange(Object(external_this_wp_richText_["changeListType"])(value, { type: 'ol' })); if (isListRootSelected()) { onTagNameChange('ol'); } } }, { icon: 'editor-outdent', title: Object(external_this_wp_i18n_["__"])('Outdent list item'), onClick: function onClick() { onChange(Object(external_this_wp_richText_["outdentListItems"])(value)); } }, { icon: 'editor-indent', title: Object(external_this_wp_i18n_["__"])('Indent list item'), onClick: function onClick() { onChange(Object(external_this_wp_richText_["indentListItems"])(value, { type: tagName })); } }] }))); }; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/rich-text/remove-browser-shortcuts.js /** * External dependencies */ /** * WordPress dependencies */ /** * Set of keyboard shortcuts handled internally by RichText. * * @type {Array} */ var HANDLED_SHORTCUTS = [external_this_wp_keycodes_["rawShortcut"].primary('z'), external_this_wp_keycodes_["rawShortcut"].primaryShift('z'), external_this_wp_keycodes_["rawShortcut"].primary('y')]; /** * An instance of a KeyboardShortcuts element pre-bound for the handled * shortcuts. Since shortcuts never change, the element can be considered * static, and can be skipped in reconciliation. * * @type {WPElement} */ var SHORTCUTS_ELEMENT = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["KeyboardShortcuts"], { bindGlobal: true, shortcuts: Object(external_lodash_["fromPairs"])(HANDLED_SHORTCUTS.map(function (shortcut) { return [shortcut, function (event) { return event.preventDefault(); }]; })) }); /** * Component which registered keyboard event handlers to prevent default * behaviors for key combinations otherwise handled internally by RichText. * * @return {WPElement} WordPress element. */ var RemoveBrowserShortcuts = function RemoveBrowserShortcuts() { return SHORTCUTS_ELEMENT; }; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/rich-text/toolbar-button.js /** * WordPress dependencies */ function RichTextToolbarButton(_ref) { var name = _ref.name, shortcutType = _ref.shortcutType, shortcutCharacter = _ref.shortcutCharacter, props = Object(objectWithoutProperties["a" /* default */])(_ref, ["name", "shortcutType", "shortcutCharacter"]); var shortcut; var fillName = 'RichText.ToolbarControls'; if (name) { fillName += ".".concat(name); } if (shortcutType && shortcutCharacter) { shortcut = external_this_wp_keycodes_["displayShortcut"][shortcutType](shortcutCharacter); } return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Fill"], { name: fillName }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarButton"], Object(esm_extends["a" /* default */])({}, props, { shortcut: shortcut }))); } // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/rich-text/inserter-list-item.js /** * WordPress dependencies */ /** * Internal dependencies */ function isResult(keywords, filterValue) { return keywords.some(function (string) { return menu_normalizeTerm(string).indexOf(menu_normalizeTerm(filterValue)) !== -1; }); } var RichTextInserterItem = Object(external_this_wp_data_["withSelect"])(function (select, _ref) { var name = _ref.name; return { formatType: select('core/rich-text').getFormatType(name) }; })(function (props) { return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Fill"], { name: "Inserter.InlineElements" }, function (_ref2) { var filterValue = _ref2.filterValue; var _props$formatType = props.formatType, _props$formatType$key = _props$formatType.keywords, keywords = _props$formatType$key === void 0 ? [] : _props$formatType$key, title = _props$formatType.title; keywords.push(title, props.title); if (filterValue && !isResult(keywords, filterValue)) { return null; } return Object(external_this_wp_element_["createElement"])(inserter_list_item, Object(esm_extends["a" /* default */])({}, props, { icon: Object(external_this_wp_blocks_["normalizeIconObject"])(props.icon) })); }); }); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/rich-text/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Browser dependencies */ var rich_text_window = window, rich_text_getSelection = rich_text_window.getSelection; var rich_text_RichText = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(RichText, _Component); function RichText(_ref) { var _this; var value = _ref.value, onReplace = _ref.onReplace, multiline = _ref.multiline; Object(classCallCheck["a" /* default */])(this, RichText); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(RichText).apply(this, arguments)); if (multiline === true || multiline === 'p' || multiline === 'li') { _this.multilineTag = multiline === true ? 'p' : multiline; } if (_this.multilineTag === 'li') { _this.multilineWrapperTags = ['ul', 'ol']; } if (_this.props.onSplit) { _this.onSplit = _this.props.onSplit; external_this_wp_deprecated_default()('wp.editor.RichText onSplit prop', { plugin: 'Gutenberg', alternative: 'wp.editor.RichText unstableOnSplit prop' }); } else if (_this.props.unstableOnSplit) { _this.onSplit = _this.props.unstableOnSplit; } _this.onFocus = _this.onFocus.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onBlur = _this.onBlur.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.onDeleteKeyDown = _this.onDeleteKeyDown.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.onPaste = _this.onPaste.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onCreateUndoLevel = _this.onCreateUndoLevel.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.setFocusedElement = _this.setFocusedElement.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onInput = _this.onInput.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onCompositionEnd = _this.onCompositionEnd.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onSelectionChange = _this.onSelectionChange.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.getRecord = _this.getRecord.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.createRecord = _this.createRecord.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.applyRecord = _this.applyRecord.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.isEmpty = _this.isEmpty.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.valueToFormat = _this.valueToFormat.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.setRef = _this.setRef.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.valueToEditableHTML = _this.valueToEditableHTML.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.formatToValue = memize_default()(_this.formatToValue.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))), { size: 1 }); _this.savedContent = value; _this.patterns = getPatterns({ onReplace: onReplace, onCreateUndoLevel: _this.onCreateUndoLevel, valueToFormat: _this.valueToFormat, onChange: _this.onChange }); _this.enterPatterns = Object(external_this_wp_blocks_["getBlockTransforms"])('from').filter(function (_ref2) { var type = _ref2.type; return type === 'enter'; }); _this.state = {}; _this.usedDeprecatedChildrenSource = Array.isArray(value); _this.lastHistoryValue = value; return _this; } Object(createClass["a" /* default */])(RichText, [{ key: "componentWillUnmount", value: function componentWillUnmount() { document.removeEventListener('selectionchange', this.onSelectionChange); } }, { key: "setRef", value: function setRef(node) { this.editableRef = node; } }, { key: "setFocusedElement", value: function setFocusedElement() { if (this.props.setFocusedElement) { this.props.setFocusedElement(this.props.instanceId); } } /** * Get the current record (value and selection) from props and state. * * @return {Object} The current record (value and selection). */ }, { key: "getRecord", value: function getRecord() { var _this$formatToValue = this.formatToValue(this.props.value), formats = _this$formatToValue.formats, text = _this$formatToValue.text; var _this$state = this.state, start = _this$state.start, end = _this$state.end; return { formats: formats, text: text, start: start, end: end }; } }, { key: "createRecord", value: function createRecord() { var range = rich_text_getSelection().getRangeAt(0); return Object(external_this_wp_richText_["create"])({ element: this.editableRef, range: range, multilineTag: this.multilineTag, multilineWrapperTags: this.multilineWrapperTags, removeNode: function removeNode(node) { return node.getAttribute('data-mce-bogus') === 'all'; }, unwrapNode: function unwrapNode(node) { return !!node.getAttribute('data-mce-bogus'); }, removeAttribute: function removeAttribute(attribute) { return attribute.indexOf('data-mce-') === 0; }, filterString: function filterString(string) { return string.replace(TINYMCE_ZWSP, ''); }, prepareEditableTree: this.props.prepareEditableTree }); } }, { key: "applyRecord", value: function applyRecord(record) { Object(external_this_wp_richText_["apply"])({ value: record, current: this.editableRef, multilineTag: this.multilineTag, multilineWrapperTags: this.multilineWrapperTags, createLinePadding: function createLinePadding(doc) { var element = doc.createElement('br'); element.setAttribute('data-mce-bogus', '1'); return element; }, prepareEditableTree: this.props.prepareEditableTree }); } }, { key: "isEmpty", value: function isEmpty() { return Object(external_this_wp_richText_["isEmpty"])(this.formatToValue(this.props.value)); } /** * Handles a paste event. * * Saves the pasted data as plain text in `pastedPlainText`. * * @param {PasteEvent} event The paste event. */ }, { key: "onPaste", value: function onPaste(event) { var clipboardData = event.clipboardData; var items = clipboardData.items, files = clipboardData.files; // In Edge these properties can be null instead of undefined, so a more // rigorous test is required over using default values. items = Object(external_lodash_["isNil"])(items) ? [] : items; files = Object(external_lodash_["isNil"])(files) ? [] : files; 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; } } event.preventDefault(); // 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); // Only process file if no HTML is present. // Note: a pasted file may have the URL as plain text. var item = Object(external_lodash_["find"])(Object(toConsumableArray["a" /* default */])(items).concat(Object(toConsumableArray["a" /* default */])(files)), function (_ref3) { var type = _ref3.type; return /^image\/(?:jpe?g|png|gif)$/.test(type); }); if (item && !html) { var file = item.getAsFile ? item.getAsFile() : item; var _content = Object(external_this_wp_blocks_["pasteHandler"])({ HTML: "<img src=\"".concat(Object(external_this_wp_blob_["createBlobURL"])(file), "\">"), mode: 'BLOCKS', tagName: this.props.tagName }); var _shouldReplace = this.props.onReplace && this.isEmpty(); // Allows us to ask for this information when we get a report. window.console.log('Received item:\n\n', file); if (_shouldReplace) { this.props.onReplace(_content); } else if (this.onSplit) { this.splitContent(_content); } return; } var record = this.getRecord(); // There is a selection, check if a URL is pasted. if (!Object(external_this_wp_richText_["isCollapsed"])(record)) { var pastedText = (html || plainText).replace(/<[^>]+>/g, '').trim(); // A URL was pasted, turn the selection into a link if (Object(external_this_wp_url_["isURL"])(pastedText)) { this.onChange(Object(external_this_wp_richText_["applyFormat"])(record, { type: 'a', attributes: { href: Object(external_this_wp_htmlEntities_["decodeEntities"])(pastedText) } })); // Allows us to ask for this information when we get a report. window.console.log('Created link:\n\n', pastedText); return; } } var shouldReplace = this.props.onReplace && this.isEmpty(); var mode = 'INLINE'; if (shouldReplace) { mode = 'BLOCKS'; } else if (this.onSplit) { mode = 'AUTO'; } var content = Object(external_this_wp_blocks_["pasteHandler"])({ HTML: html, plainText: plainText, mode: mode, tagName: this.props.tagName, canUserUseUnfilteredHTML: this.props.canUserUseUnfilteredHTML }); if (typeof content === 'string') { var recordToInsert = Object(external_this_wp_richText_["create"])({ html: content }); this.onChange(Object(external_this_wp_richText_["insert"])(record, recordToInsert)); } else if (this.onSplit) { if (!content.length) { return; } if (shouldReplace) { this.props.onReplace(content); } else { this.splitContent(content, { paste: true }); } } } /** * Handles a focus event on the contenteditable field, calling the * `unstableOnFocus` prop callback if one is defined. The callback does not * receive any arguments. * * This is marked as a private API and the `unstableOnFocus` prop is not * documented, as the current requirements where it is used are subject to * future refactoring following `isSelected` handling. * * In contrast with `setFocusedElement`, this is only triggered in response * to focus within the contenteditable field, whereas `setFocusedElement` * is triggered on focus within any `RichText` descendent element. * * @see setFocusedElement * * @private */ }, { key: "onFocus", value: function onFocus() { var unstableOnFocus = this.props.unstableOnFocus; if (unstableOnFocus) { unstableOnFocus(); } document.addEventListener('selectionchange', this.onSelectionChange); } }, { key: "onBlur", value: function onBlur() { document.removeEventListener('selectionchange', this.onSelectionChange); } /** * Handle input on the next selection change event. * * @param {SyntheticEvent} event Synthetic input event. */ }, { key: "onInput", value: function onInput(event) { // For Input Method Editor (IME), used in Chinese, Japanese, and Korean // (CJK), do not trigger a change if characters are being composed. // Browsers setting `isComposing` to `true` will usually emit a final // `input` event when the characters are composed. if (event.nativeEvent.isComposing) { return; } var record = this.createRecord(); var transformed = this.patterns.reduce(function (accumlator, transform) { return transform(accumlator); }, record); this.onChange(transformed, { withoutHistory: true }); // Create an undo level when input stops for over a second. this.props.clearTimeout(this.onInput.timeout); this.onInput.timeout = this.props.setTimeout(this.onCreateUndoLevel, 1000); } }, { key: "onCompositionEnd", value: function onCompositionEnd() { // Ensure the value is up-to-date for browsers that don't emit a final // input event after composition. this.onChange(this.createRecord()); } /** * Handles the `selectionchange` event: sync the selection to local state. */ }, { key: "onSelectionChange", value: function onSelectionChange() { var _this$createRecord = this.createRecord(), start = _this$createRecord.start, end = _this$createRecord.end, formats = _this$createRecord.formats; if (start !== this.state.start || end !== this.state.end) { var isCaretWithinFormattedText = this.props.isCaretWithinFormattedText; if (!isCaretWithinFormattedText && formats[start]) { this.props.onEnterFormattedText(); } else if (isCaretWithinFormattedText && !formats[start]) { this.props.onExitFormattedText(); } this.setState({ start: start, end: end }); } } /** * Calls all registered onChangeEditableValue handlers. * * @param {Array} formats The formats of the latest rich-text value. * @param {string} text The text of the latest rich-text value. */ }, { key: "onChangeEditableValue", value: function onChangeEditableValue(_ref4) { var formats = _ref4.formats, text = _ref4.text; Object(external_lodash_["get"])(this.props, ['onChangeEditableValue'], []).forEach(function (eventHandler) { eventHandler(formats, text); }); } /** * Sync the value to global state. The node tree and selection will also be * updated if differences are found. * * @param {Object} record The record to sync and apply. * @param {Object} $2 Named options. * @param {boolean} $2.withoutHistory If true, no undo level will be * created. */ }, { key: "onChange", value: function onChange(record) { var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, withoutHistory = _ref5.withoutHistory; this.applyRecord(record); var start = record.start, end = record.end; this.onChangeEditableValue(record); this.savedContent = this.valueToFormat(record); this.props.onChange(this.savedContent); this.setState({ start: start, end: end }); if (!withoutHistory) { this.onCreateUndoLevel(); } } }, { key: "onCreateUndoLevel", value: function onCreateUndoLevel() { // If the content is the same, no level needs to be created. if (this.lastHistoryValue === this.savedContent) { return; } this.props.onCreateUndoLevel(); this.lastHistoryValue = this.savedContent; } /** * Handles a delete keyDown event to handle merge or removal for collapsed * selection where caret is at directional edge: forward for a delete key, * reverse for a backspace key. * * @link https://en.wikipedia.org/wiki/Caret_navigation * * @param {KeyboardEvent} event Keydown event. */ }, { key: "onDeleteKeyDown", value: function onDeleteKeyDown(event) { var _this$props = this.props, onMerge = _this$props.onMerge, onRemove = _this$props.onRemove; if (!onMerge && !onRemove) { return; } var keyCode = event.keyCode; var isReverse = keyCode === external_this_wp_keycodes_["BACKSPACE"]; // Only process delete if the key press occurs at uncollapsed edge. if (!Object(external_this_wp_richText_["isCollapsed"])(this.createRecord())) { return; } var empty = this.isEmpty(); // It is important to consider emptiness because an empty container // will include a bogus TinyMCE BR node _after_ the caret, so in a // forward deletion the isHorizontalEdge function will incorrectly // interpret the presence of the bogus node as not being at the edge. var isEdge = empty || Object(external_this_wp_dom_["isHorizontalEdge"])(this.editableRef, isReverse); if (!isEdge) { return; } if (onMerge) { onMerge(!isReverse); } // Only handle remove on Backspace. This serves dual-purpose of being // an intentional user interaction distinguishing between Backspace and // Delete to remove the empty field, but also to avoid merge & remove // causing destruction of two fields (merge, then removed merged). if (onRemove && empty && isReverse) { onRemove(!isReverse); } event.preventDefault(); } /** * Handles a keydown event. * * @param {KeyboardEvent} event The keydown event. */ }, { key: "onKeyDown", value: function onKeyDown(event) { var keyCode = event.keyCode; if (keyCode === external_this_wp_keycodes_["DELETE"] || keyCode === external_this_wp_keycodes_["BACKSPACE"]) { var value = this.createRecord(); var start = Object(external_this_wp_richText_["getSelectionStart"])(value); var end = Object(external_this_wp_richText_["getSelectionEnd"])(value); // Always handle full content deletion ourselves. if (start === 0 && end !== 0 && end === value.text.length) { this.onChange(Object(external_this_wp_richText_["remove"])(value)); event.preventDefault(); return; } if (this.multilineTag) { var newValue; if (keyCode === external_this_wp_keycodes_["BACKSPACE"]) { if (Object(external_this_wp_richText_["charAt"])(value, start - 1) === external_this_wp_richText_["LINE_SEPARATOR"]) { newValue = Object(external_this_wp_richText_["remove"])(value, // Only remove the line if the selection is // collapsed. Object(external_this_wp_richText_["isCollapsed"])(value) ? start - 1 : start, end); } } else if (Object(external_this_wp_richText_["charAt"])(value, end) === external_this_wp_richText_["LINE_SEPARATOR"]) { newValue = Object(external_this_wp_richText_["remove"])(value, start, // Only remove the line if the selection is collapsed. Object(external_this_wp_richText_["isCollapsed"])(value) ? end + 1 : end); } if (newValue) { this.onChange(newValue); event.preventDefault(); } } this.onDeleteKeyDown(event); } else if (keyCode === external_this_wp_keycodes_["ENTER"]) { event.preventDefault(); var record = this.createRecord(); if (this.props.onReplace) { var text = Object(external_this_wp_richText_["getTextContent"])(record); var transformation = Object(external_this_wp_blocks_["findTransform"])(this.enterPatterns, function (item) { return item.regExp.test(text); }); if (transformation) { this.props.onReplace([transformation.transform({ content: text })]); return; } } if (this.multilineTag) { if (this.onSplit && Object(external_this_wp_richText_["isEmptyLine"])(record)) { this.onSplit.apply(this, Object(toConsumableArray["a" /* default */])(Object(external_this_wp_richText_["split"])(record).map(this.valueToFormat))); } else { this.onChange(Object(external_this_wp_richText_["insertLineSeparator"])(record)); } } else if (event.shiftKey || !this.onSplit) { var _text = Object(external_this_wp_richText_["getTextContent"])(record); var length = _text.length; var toInsert = '\n'; // If the caret is at the end of the text, and there is no // trailing line break or no text at all, we have to insert two // line breaks in order to create a new line visually and place // the caret there. if (record.end === length && (_text.charAt(length - 1) !== '\n' || length === 0)) { toInsert = '\n\n'; } this.onChange(Object(external_this_wp_richText_["insert"])(record, toInsert)); } else { this.splitContent(); } } } /** * Splits the content at the location of the selection. * * Replaces the content of the editor inside this element with the contents * before the selection. Sends the elements after the selection to the `onSplit` * handler. * * @param {Array} blocks The blocks to add after the split point. * @param {Object} context The context for splitting. */ }, { key: "splitContent", value: function splitContent() { var blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; if (!this.onSplit) { return; } var record = this.createRecord(); var _split = Object(external_this_wp_richText_["split"])(record), _split2 = Object(slicedToArray["a" /* default */])(_split, 2), before = _split2[0], after = _split2[1]; // In case split occurs at the trailing or leading edge of the field, // assume that the before/after values respectively reflect the current // value. This also provides an opportunity for the parent component to // determine whether the before/after value has changed using a trivial // strict equality operation. if (Object(external_this_wp_richText_["isEmpty"])(after)) { before = record; } else if (Object(external_this_wp_richText_["isEmpty"])(before)) { after = record; } // If pasting and the split would result in no content other than the // pasted blocks, remove the before and after blocks. if (context.paste) { before = Object(external_this_wp_richText_["isEmpty"])(before) ? null : before; after = Object(external_this_wp_richText_["isEmpty"])(after) ? null : after; } if (before) { before = this.valueToFormat(before); } if (after) { after = this.valueToFormat(after); } this.onSplit.apply(this, [before, after].concat(Object(toConsumableArray["a" /* default */])(blocks))); } }, { key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { var _this2 = this; var _this$props2 = this.props, tagName = _this$props2.tagName, value = _this$props2.value, isSelected = _this$props2.isSelected; if (tagName === prevProps.tagName && value !== prevProps.value && value !== this.savedContent) { // Handle deprecated `children` and `node` sources. // The old way of passing a value with the `node` matcher required // the value to be mapped first, creating a new array each time, so // a shallow check wouldn't work. We need to check deep equality. // This is only executed for a deprecated API and will eventually be // removed. if (Array.isArray(value) && Object(external_lodash_["isEqual"])(value, this.savedContent)) { return; } var record = this.formatToValue(value); if (isSelected) { var prevRecord = this.formatToValue(prevProps.value); var length = Object(external_this_wp_richText_["getTextContent"])(prevRecord).length; record.start = length; record.end = length; } this.applyRecord(record); this.savedContent = value; } // If any format props update, reapply value. var shouldReapply = Object.keys(this.props).some(function (name) { if (name.indexOf('format_') !== 0) { return false; } // Allow primitives and arrays: if (!Object(external_lodash_["isPlainObject"])(_this2.props[name])) { return _this2.props[name] !== prevProps[name]; } return Object.keys(_this2.props[name]).some(function (subName) { return _this2.props[name][subName] !== prevProps[name][subName]; }); }); if (shouldReapply) { var _record = this.formatToValue(value); // Maintain the previous selection if the instance is currently // selected. if (isSelected) { _record.start = this.state.start; _record.end = this.state.end; } this.applyRecord(_record); } } /** * Get props that are provided by formats to modify RichText. * * @return {Object} Props that start with 'format_'. */ }, { key: "getFormatProps", value: function getFormatProps() { return Object(external_lodash_["pickBy"])(this.props, function (propValue, name) { return name.startsWith('format_'); }); } /** * Converts the outside data structure to our internal representation. * * @param {*} value The outside value, data type depends on props. * @return {Object} An internal rich-text value. */ }, { key: "formatToValue", value: function formatToValue(value) { // Handle deprecated `children` and `node` sources. if (Array.isArray(value)) { return Object(external_this_wp_richText_["create"])({ html: external_this_wp_blocks_["children"].toHTML(value), multilineTag: this.multilineTag, multilineWrapperTags: this.multilineWrapperTags }); } if (this.props.format === 'string') { return Object(external_this_wp_richText_["create"])({ html: value, multilineTag: this.multilineTag, multilineWrapperTags: this.multilineWrapperTags }); } // Guard for blocks passing `null` in onSplit callbacks. May be removed // if onSplit is revised to not pass a `null` value. if (value === null) { return Object(external_this_wp_richText_["create"])(); } return value; } }, { key: "valueToEditableHTML", value: function valueToEditableHTML(value) { return Object(external_this_wp_richText_["unstableToDom"])({ value: value, multilineTag: this.multilineTag, multilineWrapperTags: this.multilineWrapperTags, createLinePadding: function createLinePadding(doc) { var element = doc.createElement('br'); element.setAttribute('data-mce-bogus', '1'); return element; }, prepareEditableTree: this.props.prepareEditableTree }).body.innerHTML; } /** * Removes editor only formats from the value. * * Editor only formats are applied using `prepareEditableTree`, so we need to * remove them before converting the internal state * * @param {Object} value The internal rich-text value. * @return {Object} A new rich-text value. */ }, { key: "removeEditorOnlyFormats", value: function removeEditorOnlyFormats(value) { this.props.formatTypes.forEach(function (formatType) { // Remove formats created by prepareEditableTree, because they are editor only. if (formatType.__experimentalCreatePrepareEditableTree) { value = Object(external_this_wp_richText_["removeFormat"])(value, formatType.name, 0, value.text.length); } }); return value; } /** * Converts the internal value to the external data format. * * @param {Object} value The internal rich-text value. * @return {*} The external data format, data type depends on props. */ }, { key: "valueToFormat", value: function valueToFormat(value) { value = this.removeEditorOnlyFormats(value); // Handle deprecated `children` and `node` sources. if (this.usedDeprecatedChildrenSource) { return external_this_wp_blocks_["children"].fromDOM(Object(external_this_wp_richText_["unstableToDom"])({ value: value, multilineTag: this.multilineTag, multilineWrapperTags: this.multilineWrapperTags }).body.childNodes); } if (this.props.format === 'string') { return Object(external_this_wp_richText_["toHTMLString"])({ value: value, multilineTag: this.multilineTag, multilineWrapperTags: this.multilineWrapperTags }); } return value; } }, { key: "render", value: function render() { var _this3 = this; var _this$props3 = this.props, _this$props3$tagName = _this$props3.tagName, Tagname = _this$props3$tagName === void 0 ? 'div' : _this$props3$tagName, style = _this$props3.style, wrapperClassName = _this$props3.wrapperClassName, className = _this$props3.className, _this$props3$inlineTo = _this$props3.inlineToolbar, inlineToolbar = _this$props3$inlineTo === void 0 ? false : _this$props3$inlineTo, formattingControls = _this$props3.formattingControls, placeholder = _this$props3.placeholder, _this$props3$keepPlac = _this$props3.keepPlaceholderOnFocus, keepPlaceholderOnFocus = _this$props3$keepPlac === void 0 ? false : _this$props3$keepPlac, isSelected = _this$props3.isSelected, autocompleters = _this$props3.autocompleters, onTagNameChange = _this$props3.onTagNameChange; var MultilineTag = this.multilineTag; var ariaProps = aria_pickAriaProps(this.props); // Generating a key that includes `tagName` ensures that if the tag // changes, we unmount and destroy the previous TinyMCE element, then // mount and initialize a new child element in its place. var key = ['editor', Tagname].join(); var isPlaceholderVisible = placeholder && (!isSelected || keepPlaceholderOnFocus) && this.isEmpty(); var classes = classnames_default()(wrapperClassName, 'editor-rich-text'); var record = this.getRecord(); return Object(external_this_wp_element_["createElement"])("div", { className: classes, onFocus: this.setFocusedElement }, isSelected && this.multilineTag === 'li' && Object(external_this_wp_element_["createElement"])(list_edit_ListEdit, { onTagNameChange: onTagNameChange, tagName: Tagname, value: record, onChange: this.onChange }), isSelected && !inlineToolbar && Object(external_this_wp_element_["createElement"])(block_format_controls, null, Object(external_this_wp_element_["createElement"])(format_toolbar, { controls: formattingControls })), isSelected && inlineToolbar && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IsolatedEventContainer"], { className: "editor-rich-text__inline-toolbar" }, Object(external_this_wp_element_["createElement"])(format_toolbar, { controls: formattingControls })), Object(external_this_wp_element_["createElement"])(autocomplete, { onReplace: this.props.onReplace, completers: autocompleters, record: record, onChange: this.onChange }, function (_ref6) { var listBoxId = _ref6.listBoxId, activeId = _ref6.activeId; return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(tinymce_TinyMCE, Object(esm_extends["a" /* default */])({ tagName: Tagname, style: style, record: record, valueToEditableHTML: _this3.valueToEditableHTML, isPlaceholderVisible: isPlaceholderVisible, "aria-label": placeholder, "aria-autocomplete": "list", "aria-owns": listBoxId, "aria-activedescendant": activeId }, ariaProps, { className: className, key: key, onPaste: _this3.onPaste, onInput: _this3.onInput, onCompositionEnd: _this3.onCompositionEnd, onKeyDown: _this3.onKeyDown, onFocus: _this3.onFocus, onBlur: _this3.onBlur, multilineTag: _this3.multilineTag, multilineWrapperTags: _this3.multilineWrapperTags, setRef: _this3.setRef })), isPlaceholderVisible && Object(external_this_wp_element_["createElement"])(Tagname, { className: classnames_default()('editor-rich-text__tinymce', className), style: style }, MultilineTag ? Object(external_this_wp_element_["createElement"])(MultilineTag, null, placeholder) : placeholder), isSelected && Object(external_this_wp_element_["createElement"])(format_edit, { value: record, onChange: _this3.onChange })); }), isSelected && Object(external_this_wp_element_["createElement"])(RemoveBrowserShortcuts, null)); } }]); return RichText; }(external_this_wp_element_["Component"]); rich_text_RichText.defaultProps = { formattingControls: ['bold', 'italic', 'link', 'strikethrough'], format: 'string', value: '' }; var RichTextContainer = Object(external_this_wp_compose_["compose"])([external_this_wp_compose_["withInstanceId"], context_withBlockEditContext(function (context, ownProps) { // When explicitly set as not selected, do nothing. if (ownProps.isSelected === false) { return { clientId: context.clientId }; } // When explicitly set as selected, use the value stored in the context instead. if (ownProps.isSelected === true) { return { isSelected: context.isSelected, clientId: context.clientId }; } // Ensures that only one RichText component can be focused. return { isSelected: context.isSelected && context.focusedElement === ownProps.instanceId, setFocusedElement: context.setFocusedElement, clientId: context.clientId }; }), Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), canUserUseUnfilteredHTML = _select.canUserUseUnfilteredHTML, isCaretWithinFormattedText = _select.isCaretWithinFormattedText; var _select2 = select('core/rich-text'), getFormatTypes = _select2.getFormatTypes; return { canUserUseUnfilteredHTML: canUserUseUnfilteredHTML(), isCaretWithinFormattedText: isCaretWithinFormattedText(), formatTypes: getFormatTypes() }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { var _dispatch = dispatch('core/editor'), createUndoLevel = _dispatch.createUndoLevel, redo = _dispatch.redo, undo = _dispatch.undo, enterFormattedText = _dispatch.enterFormattedText, exitFormattedText = _dispatch.exitFormattedText; return { onCreateUndoLevel: createUndoLevel, onRedo: redo, onUndo: undo, onEnterFormattedText: enterFormattedText, onExitFormattedText: exitFormattedText }; }), external_this_wp_compose_["withSafeTimeout"], Object(external_this_wp_components_["withFilters"])('experimentalRichText')])(rich_text_RichText); RichTextContainer.Content = function (_ref7) { var value = _ref7.value, Tag = _ref7.tagName, multiline = _ref7.multiline, props = Object(objectWithoutProperties["a" /* default */])(_ref7, ["value", "tagName", "multiline"]); var html = value; var MultilineTag; if (multiline === true || multiline === 'p' || multiline === 'li') { MultilineTag = multiline === true ? 'p' : multiline; } // Handle deprecated `children` and `node` sources. if (Array.isArray(value)) { html = external_this_wp_blocks_["children"].toHTML(value); } if (!html && MultilineTag) { html = "<".concat(MultilineTag, "></").concat(MultilineTag, ">"); } var content = Object(external_this_wp_element_["createElement"])(external_this_wp_element_["RawHTML"], null, html); if (Tag) { return Object(external_this_wp_element_["createElement"])(Tag, Object(external_lodash_["omit"])(props, ['format']), content); } return content; }; RichTextContainer.isEmpty = function () { var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; // Handle deprecated `children` and `node` sources. if (Array.isArray(value)) { return !value || value.length === 0; } return value.length === 0; }; RichTextContainer.Content.defaultProps = { format: 'string', value: '' }; /* harmony default export */ var rich_text = (RichTextContainer); // 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)); }); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/media-upload/index.js /** * WordPress dependencies */ /** * This is a placeholder for the media upload component necessary to make it possible to provide * an integration with the core blocks that handle media files. By default it renders nothing but * it provides a way to have it overridden with the `editor.MediaUpload` filter. * * @return {WPElement} Media upload element. */ var MediaUpload = function MediaUpload() { return null; }; // Todo: rename the filter /* harmony default export */ var media_upload = (Object(external_this_wp_components_["withFilters"])('editor.MediaUpload')(MediaUpload)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/url-popover/index.js /** * WordPress dependencies */ var url_popover_URLPopover = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(URLPopover, _Component); function URLPopover() { var _this; Object(classCallCheck["a" /* default */])(this, URLPopover); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(URLPopover).apply(this, arguments)); _this.toggleSettingsVisibility = _this.toggleSettingsVisibility.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.state = { isSettingsExpanded: false }; return _this; } Object(createClass["a" /* default */])(URLPopover, [{ key: "toggleSettingsVisibility", value: function toggleSettingsVisibility() { this.setState({ isSettingsExpanded: !this.state.isSettingsExpanded }); } }, { key: "render", value: function render() { var _this$props = this.props, children = _this$props.children, renderSettings = _this$props.renderSettings, onClose = _this$props.onClose, onClickOutside = _this$props.onClickOutside, _this$props$position = _this$props.position, position = _this$props$position === void 0 ? 'bottom center' : _this$props$position, _this$props$focusOnMo = _this$props.focusOnMount, focusOnMount = _this$props$focusOnMo === void 0 ? 'firstElement' : _this$props$focusOnMo; var isSettingsExpanded = this.state.isSettingsExpanded; var showSettings = !!renderSettings && isSettingsExpanded; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Popover"], { className: "editor-url-popover", focusOnMount: focusOnMount, position: position, onClose: onClose, onClickOutside: onClickOutside }, Object(external_this_wp_element_["createElement"])("div", { className: "editor-url-popover__row" }, children, !!renderSettings && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { className: "editor-url-popover__settings-toggle", icon: "ellipsis", label: Object(external_this_wp_i18n_["__"])('Link Settings'), onClick: this.toggleSettingsVisibility, "aria-expanded": isSettingsExpanded })), showSettings && Object(external_this_wp_element_["createElement"])("div", { className: "editor-url-popover__row editor-url-popover__settings" }, renderSettings())); } }]); return URLPopover; }(external_this_wp_element_["Component"]); /* harmony default export */ var url_popover = (url_popover_URLPopover); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/media-upload/media-upload.js /** * External Dependencies */ /** * WordPress dependencies */ /** * 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__*/ regeneratorRuntime.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 regeneratorRuntime.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('/', '.')); data.append('title', file.name ? file.name.replace(/\.[^.]+$/, '') : file.type.replace('/', '.')); Object(external_lodash_["forEach"])(additionalData, function (value, key) { return data.append(key, value); }); return external_this_wp_apiFetch_default()({ path: '/core/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. * * @param {Object} $0 Parameters object passed to the function. * @param {string} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed. * @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. */ /* harmony default export */ var utils_media_upload = (function (_ref) { var allowedTypes = _ref.allowedTypes, filesList = _ref.filesList, maxUploadFileSize = _ref.maxUploadFileSize, _ref$onError = _ref.onError, _onError = _ref$onError === void 0 ? external_lodash_["noop"] : _ref$onError, onFileChange = _ref.onFileChange; var _select = Object(external_this_wp_data_["select"])('core/editor'), getCurrentPostId = _select.getCurrentPostId, getEditorSettings = _select.getEditorSettings; var wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes; maxUploadFileSize = maxUploadFileSize || getEditorSettings().maxUploadFileSize; mediaUpload({ allowedTypes: allowedTypes, filesList: filesList, onFileChange: onFileChange, additionalData: { post: getCurrentPostId() }, maxUploadFileSize: maxUploadFileSize, onError: function onError(_ref2) { var message = _ref2.message; return _onError(message); }, wpAllowedMimeTypes: wpAllowedMimeTypes }); }); // 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/utils/index.js /** * Internal dependencies */ // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/media-placeholder/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var media_placeholder_InsertFromURLPopover = function InsertFromURLPopover(_ref) { var src = _ref.src, onChange = _ref.onChange, onSubmit = _ref.onSubmit, onClose = _ref.onClose; return Object(external_this_wp_element_["createElement"])(url_popover, { onClose: onClose }, Object(external_this_wp_element_["createElement"])("form", { className: "editor-media-placeholder__url-input-form", onSubmit: onSubmit }, Object(external_this_wp_element_["createElement"])("input", { className: "editor-media-placeholder__url-input-field", type: "url", "aria-label": Object(external_this_wp_i18n_["__"])('URL'), placeholder: Object(external_this_wp_i18n_["__"])('Paste or type URL'), onChange: onChange, value: src }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { className: "editor-media-placeholder__url-input-submit-button", icon: "editor-break", label: Object(external_this_wp_i18n_["__"])('Apply'), type: "submit" }))); }; var media_placeholder_MediaPlaceholder = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(MediaPlaceholder, _Component); function MediaPlaceholder() { var _this; Object(classCallCheck["a" /* default */])(this, MediaPlaceholder); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(MediaPlaceholder).apply(this, arguments)); _this.state = { src: '', isURLInputVisible: false }; _this.onChangeSrc = _this.onChangeSrc.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onSubmitSrc = _this.onSubmitSrc.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onUpload = _this.onUpload.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onFilesUpload = _this.onFilesUpload.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.openURLInput = _this.openURLInput.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.closeURLInput = _this.closeURLInput.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); return _this; } Object(createClass["a" /* default */])(MediaPlaceholder, [{ key: "onlyAllowsImages", value: function onlyAllowsImages() { var allowedTypes = this.props.allowedTypes; if (!allowedTypes) { return false; } return Object(external_lodash_["every"])(allowedTypes, function (allowedType) { return allowedType === 'image' || Object(external_lodash_["startsWith"])(allowedType, 'image/'); }); } }, { key: "componentDidMount", value: function componentDidMount() { this.setState({ src: Object(external_lodash_["get"])(this.props.value, ['src'], '') }); } }, { key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { if (Object(external_lodash_["get"])(prevProps.value, ['src'], '') !== Object(external_lodash_["get"])(this.props.value, ['src'], '')) { this.setState({ src: Object(external_lodash_["get"])(this.props.value, ['src'], '') }); } } }, { key: "onChangeSrc", value: function onChangeSrc(event) { this.setState({ src: event.target.value }); } }, { key: "onSubmitSrc", value: function onSubmitSrc(event) { event.preventDefault(); if (this.state.src && this.props.onSelectURL) { this.props.onSelectURL(this.state.src); this.closeURLInput(); } } }, { key: "onUpload", value: function onUpload(event) { this.onFilesUpload(event.target.files); } }, { key: "onFilesUpload", value: function onFilesUpload(files) { var _this$props = this.props, onSelect = _this$props.onSelect, multiple = _this$props.multiple, onError = _this$props.onError, allowedTypes = _this$props.allowedTypes; var setMedia = multiple ? onSelect : function (_ref2) { var _ref3 = Object(slicedToArray["a" /* default */])(_ref2, 1), media = _ref3[0]; return onSelect(media); }; utils_media_upload({ allowedTypes: allowedTypes, filesList: files, onFileChange: setMedia, onError: onError }); } }, { key: "openURLInput", value: function openURLInput() { this.setState({ isURLInputVisible: true }); } }, { key: "closeURLInput", value: function closeURLInput() { this.setState({ isURLInputVisible: false }); } }, { key: "render", value: function render() { var _this$props2 = this.props, accept = _this$props2.accept, icon = _this$props2.icon, className = _this$props2.className, _this$props2$labels = _this$props2.labels, labels = _this$props2$labels === void 0 ? {} : _this$props2$labels, onSelect = _this$props2.onSelect, _this$props2$value = _this$props2.value, value = _this$props2$value === void 0 ? {} : _this$props2$value, onSelectURL = _this$props2.onSelectURL, _this$props2$onHTMLDr = _this$props2.onHTMLDrop, onHTMLDrop = _this$props2$onHTMLDr === void 0 ? external_lodash_["noop"] : _this$props2$onHTMLDr, _this$props2$multiple = _this$props2.multiple, multiple = _this$props2$multiple === void 0 ? false : _this$props2$multiple, notices = _this$props2.notices, _this$props2$allowedT = _this$props2.allowedTypes, allowedTypes = _this$props2$allowedT === void 0 ? [] : _this$props2$allowedT, hasUploadPermissions = _this$props2.hasUploadPermissions; var _this$state = this.state, isURLInputVisible = _this$state.isURLInputVisible, src = _this$state.src; var instructions = labels.instructions || ''; var title = labels.title || ''; if (!hasUploadPermissions && !onSelectURL) { instructions = Object(external_this_wp_i18n_["__"])('To edit this block, you need permission to upload media.'); } if (!instructions || !title) { var isOneType = 1 === allowedTypes.length; var isAudio = isOneType && 'audio' === allowedTypes[0]; var isImage = isOneType && 'image' === allowedTypes[0]; var isVideo = isOneType && 'video' === allowedTypes[0]; if (!instructions) { if (hasUploadPermissions) { instructions = Object(external_this_wp_i18n_["__"])('Drag a media file, upload a new one or select a file from your library.'); if (isAudio) { instructions = Object(external_this_wp_i18n_["__"])('Drag an audio, upload a new one or select a file from your library.'); } else if (isImage) { instructions = Object(external_this_wp_i18n_["__"])('Drag an image, upload a new one or select a file from your library.'); } else if (isVideo) { instructions = Object(external_this_wp_i18n_["__"])('Drag a video, upload a new one or select a file from your library.'); } } else if (!hasUploadPermissions && onSelectURL) { instructions = Object(external_this_wp_i18n_["__"])('Given your current role, you can only link a media file, you cannot upload.'); if (isAudio) { instructions = Object(external_this_wp_i18n_["__"])('Given your current role, you can only link an audio, you cannot upload.'); } else if (isImage) { instructions = Object(external_this_wp_i18n_["__"])('Given your current role, you can only link an image, you cannot upload.'); } else if (isVideo) { instructions = Object(external_this_wp_i18n_["__"])('Given your current role, you can only link a video, you cannot upload.'); } } } if (!title) { title = Object(external_this_wp_i18n_["__"])('Media'); if (isAudio) { title = Object(external_this_wp_i18n_["__"])('Audio'); } else if (isImage) { title = Object(external_this_wp_i18n_["__"])('Image'); } else if (isVideo) { title = Object(external_this_wp_i18n_["__"])('Video'); } } } return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Placeholder"], { icon: icon, label: title, instructions: instructions, className: classnames_default()('editor-media-placeholder', className), notices: notices }, Object(external_this_wp_element_["createElement"])(check, null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["DropZone"], { onFilesDrop: this.onFilesUpload, onHTMLDrop: onHTMLDrop }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["FormFileUpload"], { isLarge: true, className: "editor-media-placeholder__button", onChange: this.onUpload, accept: accept, multiple: multiple }, Object(external_this_wp_i18n_["__"])('Upload')), Object(external_this_wp_element_["createElement"])(media_upload, { gallery: multiple && this.onlyAllowsImages(), multiple: multiple, onSelect: onSelect, allowedTypes: allowedTypes, value: value.id, render: function render(_ref4) { var open = _ref4.open; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { isLarge: true, className: "editor-media-placeholder__button", onClick: open }, Object(external_this_wp_i18n_["__"])('Media Library')); } })), onSelectURL && Object(external_this_wp_element_["createElement"])("div", { className: "editor-media-placeholder__url-input-container" }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { className: "editor-media-placeholder__button", onClick: this.openURLInput, isToggled: isURLInputVisible, isLarge: true }, Object(external_this_wp_i18n_["__"])('Insert from URL')), isURLInputVisible && Object(external_this_wp_element_["createElement"])(media_placeholder_InsertFromURLPopover, { src: src, onChange: this.onChangeSrc, onSubmit: this.onSubmitSrc, onClose: this.closeURLInput }))); } }]); return MediaPlaceholder; }(external_this_wp_element_["Component"]); var media_placeholder_applyWithSelect = Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core'), hasUploadPermissions = _select.hasUploadPermissions; return { hasUploadPermissions: hasUploadPermissions() }; }); /* harmony default export */ var media_placeholder = (Object(external_this_wp_compose_["compose"])(media_placeholder_applyWithSelect, Object(external_this_wp_components_["withFilters"])('editor.MediaPlaceholder'))(media_placeholder_MediaPlaceholder)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/url-input/index.js /** * External dependencies */ /** * WordPress dependencies */ // Since URLInput is rendered in the context of other inputs, but should be // considered a separate modal node, prevent keyboard events from propagating // as being considered from the input. var stopEventPropagation = function stopEventPropagation(event) { return event.stopPropagation(); }; var url_input_URLInput = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(URLInput, _Component); function URLInput(_ref) { var _this; var autocompleteRef = _ref.autocompleteRef; Object(classCallCheck["a" /* default */])(this, URLInput); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(URLInput).apply(this, arguments)); _this.onChange = _this.onChange.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.autocompleteRef = autocompleteRef || Object(external_this_wp_element_["createRef"])(); _this.inputRef = Object(external_this_wp_element_["createRef"])(); _this.updateSuggestions = Object(external_lodash_["throttle"])(_this.updateSuggestions.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))), 200); _this.suggestionNodes = []; _this.state = { posts: [], showSuggestions: false, selectedSuggestion: null }; return _this; } Object(createClass["a" /* default */])(URLInput, [{ key: "componentDidUpdate", value: function componentDidUpdate() { var _this2 = this; var _this$state = this.state, showSuggestions = _this$state.showSuggestions, selectedSuggestion = _this$state.selectedSuggestion; // only have to worry about scrolling selected suggestion into view // when already expanded if (showSuggestions && selectedSuggestion !== null && !this.scrollingIntoView) { this.scrollingIntoView = true; dom_scroll_into_view_lib_default()(this.suggestionNodes[selectedSuggestion], this.autocompleteRef.current, { onlyScrollIfNeeded: true }); setTimeout(function () { _this2.scrollingIntoView = false; }, 100); } } }, { key: "componentWillUnmount", value: function componentWillUnmount() { delete this.suggestionsRequest; } }, { key: "bindSuggestionNode", value: function bindSuggestionNode(index) { var _this3 = this; return function (ref) { _this3.suggestionNodes[index] = ref; }; } }, { key: "updateSuggestions", value: function updateSuggestions(value) { var _this4 = this; // Show the suggestions after typing at least 2 characters // and also for URLs if (value.length < 2 || /^https?:/.test(value)) { this.setState({ showSuggestions: false, selectedSuggestion: null, loading: false }); return; } this.setState({ showSuggestions: true, selectedSuggestion: null, loading: true }); var request = external_this_wp_apiFetch_default()({ path: Object(external_this_wp_url_["addQueryArgs"])('/core/search', { search: value, per_page: 20, type: 'post' }) }); request.then(function (posts) { // A fetch Promise doesn't have an abort option. It's mimicked by // comparing the request reference in on the instance, which is // reset or deleted on subsequent requests or unmounting. if (_this4.suggestionsRequest !== request) { return; } _this4.setState({ posts: posts, loading: false }); if (!!posts.length) { _this4.props.debouncedSpeak(Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_n"])('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', posts.length), posts.length), 'assertive'); } else { _this4.props.debouncedSpeak(Object(external_this_wp_i18n_["__"])('No results.'), 'assertive'); } }).catch(function () { if (_this4.suggestionsRequest === request) { _this4.setState({ loading: false }); } }); this.suggestionsRequest = request; } }, { key: "onChange", value: function onChange(event) { var inputValue = event.target.value; this.props.onChange(inputValue); this.updateSuggestions(inputValue); } }, { key: "onKeyDown", value: function onKeyDown(event) { var _this$state2 = this.state, showSuggestions = _this$state2.showSuggestions, selectedSuggestion = _this$state2.selectedSuggestion, posts = _this$state2.posts, loading = _this$state2.loading; // If the suggestions are not shown or loading, we shouldn't handle the arrow keys // We shouldn't preventDefault to allow block arrow keys navigation if (!showSuggestions || !posts.length || loading) { // In the Windows version of Firefox the up and down arrows don't move the caret // within an input field like they do for Mac Firefox/Chrome/Safari. This causes // a form of focus trapping that is disruptive to the user experience. This disruption // only happens if the caret is not in the first or last position in the text input. // See: https://github.com/WordPress/gutenberg/issues/5693#issuecomment-436684747 switch (event.keyCode) { // When UP is pressed, if the caret is at the start of the text, move it to the 0 // position. case external_this_wp_keycodes_["UP"]: { if (0 !== event.target.selectionStart) { event.stopPropagation(); event.preventDefault(); // Set the input caret to position 0 event.target.setSelectionRange(0, 0); } break; } // When DOWN is pressed, if the caret is not at the end of the text, move it to the // last position. case external_this_wp_keycodes_["DOWN"]: { if (this.props.value.length !== event.target.selectionStart) { event.stopPropagation(); event.preventDefault(); // Set the input caret to the last position event.target.setSelectionRange(this.props.value.length, this.props.value.length); } break; } } return; } var post = this.state.posts[this.state.selectedSuggestion]; switch (event.keyCode) { case external_this_wp_keycodes_["UP"]: { event.stopPropagation(); event.preventDefault(); var previousIndex = !selectedSuggestion ? posts.length - 1 : selectedSuggestion - 1; this.setState({ selectedSuggestion: previousIndex }); break; } case external_this_wp_keycodes_["DOWN"]: { event.stopPropagation(); event.preventDefault(); var nextIndex = selectedSuggestion === null || selectedSuggestion === posts.length - 1 ? 0 : selectedSuggestion + 1; this.setState({ selectedSuggestion: nextIndex }); break; } case external_this_wp_keycodes_["TAB"]: { if (this.state.selectedSuggestion !== null) { this.selectLink(post); // Announce a link has been selected when tabbing away from the input field. this.props.speak(Object(external_this_wp_i18n_["__"])('Link selected.')); } break; } case external_this_wp_keycodes_["ENTER"]: { if (this.state.selectedSuggestion !== null) { event.stopPropagation(); this.selectLink(post); } break; } } } }, { key: "selectLink", value: function selectLink(post) { this.props.onChange(post.url, post); this.setState({ selectedSuggestion: null, showSuggestions: false }); } }, { key: "handleOnClick", value: function handleOnClick(post) { this.selectLink(post); // Move focus to the input field when a link suggestion is clicked. this.inputRef.current.focus(); } }, { key: "render", value: function render() { var _this5 = this; var _this$props = this.props, _this$props$value = _this$props.value, value = _this$props$value === void 0 ? '' : _this$props$value, _this$props$autoFocus = _this$props.autoFocus, autoFocus = _this$props$autoFocus === void 0 ? true : _this$props$autoFocus, instanceId = _this$props.instanceId; var _this$state3 = this.state, showSuggestions = _this$state3.showSuggestions, posts = _this$state3.posts, selectedSuggestion = _this$state3.selectedSuggestion, loading = _this$state3.loading; /* eslint-disable jsx-a11y/no-autofocus */ return Object(external_this_wp_element_["createElement"])("div", { className: "editor-url-input" }, Object(external_this_wp_element_["createElement"])("input", { autoFocus: autoFocus, type: "text", "aria-label": Object(external_this_wp_i18n_["__"])('URL'), required: true, value: value, onChange: this.onChange, onInput: stopEventPropagation, placeholder: Object(external_this_wp_i18n_["__"])('Paste URL or type to search'), onKeyDown: this.onKeyDown, role: "combobox", "aria-expanded": showSuggestions, "aria-autocomplete": "list", "aria-owns": "editor-url-input-suggestions-".concat(instanceId), "aria-activedescendant": selectedSuggestion !== null ? "editor-url-input-suggestion-".concat(instanceId, "-").concat(selectedSuggestion) : undefined, ref: this.inputRef }), loading && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Spinner"], null), showSuggestions && !!posts.length && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Popover"], { position: "bottom", noArrow: true, focusOnMount: false }, Object(external_this_wp_element_["createElement"])("div", { className: "editor-url-input__suggestions", id: "editor-url-input-suggestions-".concat(instanceId), ref: this.autocompleteRef, role: "listbox" }, posts.map(function (post, index) { return Object(external_this_wp_element_["createElement"])("button", { key: post.id, role: "option", tabIndex: "-1", id: "editor-url-input-suggestion-".concat(instanceId, "-").concat(index), ref: _this5.bindSuggestionNode(index), className: classnames_default()('editor-url-input__suggestion', { 'is-selected': index === selectedSuggestion }), onClick: function onClick() { return _this5.handleOnClick(post); }, "aria-selected": index === selectedSuggestion }, Object(external_this_wp_htmlEntities_["decodeEntities"])(post.title) || Object(external_this_wp_i18n_["__"])('(no title)')); })))); /* eslint-enable jsx-a11y/no-autofocus */ } }]); return URLInput; }(external_this_wp_element_["Component"]); /* harmony default export */ var url_input = (Object(external_this_wp_components_["withSpokenMessages"])(Object(external_this_wp_compose_["withInstanceId"])(url_input_URLInput))); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/url-input/button.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var button_URLInputButton = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(URLInputButton, _Component); function URLInputButton() { var _this; Object(classCallCheck["a" /* default */])(this, URLInputButton); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(URLInputButton).apply(this, arguments)); _this.toggle = _this.toggle.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.submitLink = _this.submitLink.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.state = { expanded: false }; return _this; } Object(createClass["a" /* default */])(URLInputButton, [{ key: "toggle", value: function toggle() { this.setState({ expanded: !this.state.expanded }); } }, { key: "submitLink", value: function submitLink(event) { event.preventDefault(); this.toggle(); } }, { key: "render", value: function render() { var _this$props = this.props, url = _this$props.url, onChange = _this$props.onChange; var expanded = this.state.expanded; var buttonLabel = url ? Object(external_this_wp_i18n_["__"])('Edit Link') : Object(external_this_wp_i18n_["__"])('Insert Link'); return Object(external_this_wp_element_["createElement"])("div", { className: "editor-url-input__button" }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { icon: "admin-links", label: buttonLabel, onClick: this.toggle, className: classnames_default()('components-toolbar__control', { 'is-active': url }) }), expanded && Object(external_this_wp_element_["createElement"])("form", { className: "editor-url-input__button-modal", onSubmit: this.submitLink }, Object(external_this_wp_element_["createElement"])("div", { className: "editor-url-input__button-modal-line" }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { className: "editor-url-input__back", icon: "arrow-left-alt", label: Object(external_this_wp_i18n_["__"])('Close'), onClick: this.toggle }), Object(external_this_wp_element_["createElement"])(url_input, { value: url || '', onChange: onChange }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { icon: "editor-break", label: Object(external_this_wp_i18n_["__"])('Submit'), type: "submit" })))); } }]); return URLInputButton; }(external_this_wp_element_["Component"]); /* harmony default export */ var url_input_button = (button_URLInputButton); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autosave-monitor/index.js /** * WordPress dependencies */ var autosave_monitor_AutosaveMonitor = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(AutosaveMonitor, _Component); function AutosaveMonitor() { Object(classCallCheck["a" /* default */])(this, AutosaveMonitor); return Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(AutosaveMonitor).apply(this, arguments)); } Object(createClass["a" /* default */])(AutosaveMonitor, [{ key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { var _this$props = this.props, isDirty = _this$props.isDirty, editsReference = _this$props.editsReference, isAutosaveable = _this$props.isAutosaveable; if (prevProps.isDirty !== isDirty || prevProps.isAutosaveable !== isAutosaveable || prevProps.editsReference !== editsReference) { this.toggleTimer(isDirty && isAutosaveable); } } }, { key: "componentWillUnmount", value: function componentWillUnmount() { this.toggleTimer(false); } }, { key: "toggleTimer", value: function toggleTimer(isPendingSave) { var _this = this; clearTimeout(this.pendingSave); var autosaveInterval = this.props.autosaveInterval; if (isPendingSave) { this.pendingSave = setTimeout(function () { return _this.props.autosave(); }, autosaveInterval * 1000); } } }, { key: "render", value: function render() { return null; } }]); 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, getEditorSettings = _select.getEditorSettings, getReferenceByDistinctEdits = _select.getReferenceByDistinctEdits; var _getEditorSettings = getEditorSettings(), autosaveInterval = _getEditorSettings.autosaveInterval; return { isDirty: isEditedPostDirty(), isAutosaveable: isEditedPostAutosaveable(), editsReference: getReferenceByDistinctEdits(), autosaveInterval: autosaveInterval }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { return { autosave: dispatch('core/editor').autosave }; })])(autosave_monitor_AutosaveMonitor)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/item.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var item_TableOfContentsItem = function TableOfContentsItem(_ref) { var children = _ref.children, isValid = _ref.isValid, level = _ref.level, onClick = _ref.onClick, _ref$path = _ref.path, path = _ref$path === void 0 ? [] : _ref$path; return Object(external_this_wp_element_["createElement"])("li", { className: classnames_default()('document-outline__item', "is-".concat(level.toLowerCase()), { 'is-invalid': !isValid }) }, Object(external_this_wp_element_["createElement"])("button", { className: "document-outline__button", onClick: onClick }, Object(external_this_wp_element_["createElement"])("span", { className: "document-outline__emdash", "aria-hidden": "true" }), // path is an array of nodes that are ancestors of the heading starting in the top level node. // This mapping renders each ancestor to make it easier for the user to know where the headings are nested. path.map(function (_ref2, index) { var clientId = _ref2.clientId; return Object(external_this_wp_element_["createElement"])("strong", { key: index, className: "document-outline__level" }, Object(external_this_wp_element_["createElement"])(block_title, { clientId: clientId })); }), Object(external_this_wp_element_["createElement"])("strong", { className: "document-outline__level" }, level), Object(external_this_wp_element_["createElement"])("span", { className: "document-outline__item-content" }, children), Object(external_this_wp_element_["createElement"])("span", { className: "screen-reader-text" }, Object(external_this_wp_i18n_["__"])('(Click to focus this heading)')))); }; /* harmony default export */ var document_outline_item = (item_TableOfContentsItem); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Module constants */ var emptyHeadingContent = Object(external_this_wp_element_["createElement"])("em", null, Object(external_this_wp_i18n_["__"])('(Empty heading)')); var incorrectLevelContent = [Object(external_this_wp_element_["createElement"])("br", { key: "incorrect-break" }), Object(external_this_wp_element_["createElement"])("em", { key: "incorrect-message" }, Object(external_this_wp_i18n_["__"])('(Incorrect heading level)'))]; var singleH1Headings = [Object(external_this_wp_element_["createElement"])("br", { key: "incorrect-break-h1" }), Object(external_this_wp_element_["createElement"])("em", { key: "incorrect-message-h1" }, Object(external_this_wp_i18n_["__"])('(Your theme may already use a H1 for the post title)'))]; var multipleH1Headings = [Object(external_this_wp_element_["createElement"])("br", { key: "incorrect-break-multiple-h1" }), Object(external_this_wp_element_["createElement"])("em", { key: "incorrect-message-multiple-h1" }, Object(external_this_wp_i18n_["__"])('(Multiple H1 headings are not recommended)'))]; /** * Returns an array of heading blocks enhanced with the following properties: * path - An array of blocks that are ancestors of the heading starting from a top-level node. * Can be an empty array if the heading is a top-level node (is not nested inside another block). * level - An integer with the heading level. * isEmpty - Flag indicating if the heading has no content. * * @param {?Array} blocks An array of blocks. * @param {?Array} path An array of blocks that are ancestors of the blocks passed as blocks. * * @return {Array} An array of heading blocks enhanced with the properties described above. */ 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 () { var block = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; if (block.name === 'core/heading') { return Object(objectSpread["a" /* default */])({}, block, { path: path, level: block.attributes.level, isEmpty: isEmptyHeading(block) }); } return computeOutlineHeadings(block.innerBlocks, Object(toConsumableArray["a" /* default */])(path).concat([block])); }); }; var isEmptyHeading = function isEmptyHeading(heading) { return !heading.attributes.content || heading.attributes.content.length === 0; }; var document_outline_DocumentOutline = function DocumentOutline(_ref) { var _ref$blocks = _ref.blocks, blocks = _ref$blocks === void 0 ? [] : _ref$blocks, title = _ref.title, onSelect = _ref.onSelect, isTitleSupported = _ref.isTitleSupported; var headings = document_outline_computeOutlineHeadings(blocks); if (headings.length < 1) { return null; } var prevHeadingLevel = 1; // Select the corresponding block in the main editor // when clicking on a heading item from the list. var onSelectHeading = function onSelectHeading(clientId) { return onSelect(clientId); }; var focusTitle = function focusTitle() { // Not great but it's the simplest way to focus the title right now. var titleNode = document.querySelector('.editor-post-title__input'); if (titleNode) { titleNode.focus(); } }; var hasTitle = isTitleSupported && title; var countByLevel = Object(external_lodash_["countBy"])(headings, 'level'); var hasMultipleH1 = countByLevel[1] > 1; return Object(external_this_wp_element_["createElement"])("div", { className: "document-outline" }, Object(external_this_wp_element_["createElement"])("ul", null, hasTitle && Object(external_this_wp_element_["createElement"])(document_outline_item, { level: Object(external_this_wp_i18n_["__"])('Title'), isValid: true, onClick: focusTitle }, title), headings.map(function (item, index) { // Headings remain the same, go up by one, or down by any amount. // Otherwise there are missing levels. var isIncorrectLevel = item.level > prevHeadingLevel + 1; var isValid = !item.isEmpty && !isIncorrectLevel && !!item.level && (item.level !== 1 || !hasMultipleH1 && !hasTitle); prevHeadingLevel = item.level; return Object(external_this_wp_element_["createElement"])(document_outline_item, { key: index, level: "H".concat(item.level), isValid: isValid, onClick: function onClick() { return onSelectHeading(item.clientId); }, path: item.path }, item.isEmpty ? emptyHeadingContent : Object(external_this_wp_richText_["getTextContent"])(Object(external_this_wp_richText_["create"])({ html: item.attributes.content })), isIncorrectLevel && incorrectLevelContent, item.level === 1 && hasMultipleH1 && multipleH1Headings, hasTitle && item.level === 1 && !hasMultipleH1 && singleH1Headings); }))); }; /* harmony default export */ var document_outline = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getEditedPostAttribute = _select.getEditedPostAttribute, getBlocks = _select.getBlocks; var _select2 = select('core'), getPostType = _select2.getPostType; var postType = getPostType(getEditedPostAttribute('type')); return { title: getEditedPostAttribute('title'), blocks: getBlocks(), isTitleSupported: Object(external_lodash_["get"])(postType, ['supports', 'title'], false) }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { var _dispatch = dispatch('core/editor'), selectBlock = _dispatch.selectBlock; return { onSelect: selectBlock }; }))(document_outline_DocumentOutline)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/check.js /** * External dependencies */ /** * WordPress dependencies */ function DocumentOutlineCheck(_ref) { var blocks = _ref.blocks, children = _ref.children; var headings = Object(external_lodash_["filter"])(blocks, function (block) { return block.name === 'core/heading'; }); if (headings.length < 1) { return null; } return children; } /* harmony default export */ var document_outline_check = (Object(external_this_wp_data_["withSelect"])(function (select) { return { blocks: select('core/editor').getBlocks() }; })(DocumentOutlineCheck)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-actions/index.js /** * External dependencies */ /** * WordPress dependencies */ function BlockActions(_ref) { var onDuplicate = _ref.onDuplicate, onRemove = _ref.onRemove, onInsertBefore = _ref.onInsertBefore, onInsertAfter = _ref.onInsertAfter, isLocked = _ref.isLocked, canDuplicate = _ref.canDuplicate, children = _ref.children; return children({ onDuplicate: onDuplicate, onRemove: onRemove, onInsertAfter: onInsertAfter, onInsertBefore: onInsertBefore, isLocked: isLocked, canDuplicate: canDuplicate }); } /* harmony default export */ var block_actions = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, props) { var _select = select('core/editor'), getBlocksByClientId = _select.getBlocksByClientId, getBlockIndex = _select.getBlockIndex, getTemplateLock = _select.getTemplateLock, getBlockRootClientId = _select.getBlockRootClientId; var blocks = getBlocksByClientId(props.clientIds); var canDuplicate = Object(external_lodash_["every"])(blocks, function (block) { return !!block && Object(external_this_wp_blocks_["hasBlockSupport"])(block.name, 'multiple', true); }); var rootClientId = getBlockRootClientId(props.clientIds[0]); return { firstSelectedIndex: getBlockIndex(Object(external_lodash_["first"])(Object(external_lodash_["castArray"])(props.clientIds)), rootClientId), lastSelectedIndex: getBlockIndex(Object(external_lodash_["last"])(Object(external_lodash_["castArray"])(props.clientIds)), rootClientId), isLocked: !!getTemplateLock(rootClientId), blocks: blocks, canDuplicate: canDuplicate, rootClientId: rootClientId, extraProps: props }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, props) { var clientIds = props.clientIds, rootClientId = props.rootClientId, blocks = props.blocks, firstSelectedIndex = props.firstSelectedIndex, lastSelectedIndex = props.lastSelectedIndex, isLocked = props.isLocked, canDuplicate = props.canDuplicate; var _dispatch = dispatch('core/editor'), insertBlocks = _dispatch.insertBlocks, multiSelect = _dispatch.multiSelect, removeBlocks = _dispatch.removeBlocks, insertDefaultBlock = _dispatch.insertDefaultBlock; return { onDuplicate: function onDuplicate() { if (isLocked || !canDuplicate) { return; } var clonedBlocks = blocks.map(function (block) { return Object(external_this_wp_blocks_["cloneBlock"])(block); }); insertBlocks(clonedBlocks, lastSelectedIndex + 1, rootClientId); if (clonedBlocks.length > 1) { multiSelect(Object(external_lodash_["first"])(clonedBlocks).clientId, Object(external_lodash_["last"])(clonedBlocks).clientId); } }, onRemove: function onRemove() { if (!isLocked) { removeBlocks(clientIds); } }, onInsertBefore: function onInsertBefore() { if (!isLocked) { insertDefaultBlock({}, rootClientId, firstSelectedIndex); } }, onInsertAfter: function onInsertAfter() { if (!isLocked) { insertDefaultBlock({}, rootClientId, lastSelectedIndex + 1); } } }; })])(BlockActions)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-global-keyboard-shortcuts/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var preventDefault = function preventDefault(event) { event.preventDefault(); return event; }; var shortcuts = { duplicate: { raw: external_this_wp_keycodes_["rawShortcut"].primaryShift('d'), display: external_this_wp_keycodes_["displayShortcut"].primaryShift('d') }, removeBlock: { raw: external_this_wp_keycodes_["rawShortcut"].access('z'), display: external_this_wp_keycodes_["displayShortcut"].access('z') }, insertBefore: { raw: external_this_wp_keycodes_["rawShortcut"].primaryAlt('t'), display: external_this_wp_keycodes_["displayShortcut"].primaryAlt('t') }, insertAfter: { raw: external_this_wp_keycodes_["rawShortcut"].primaryAlt('y'), display: external_this_wp_keycodes_["displayShortcut"].primaryAlt('y') } }; var editor_global_keyboard_shortcuts_EditorGlobalKeyboardShortcuts = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(EditorGlobalKeyboardShortcuts, _Component); function EditorGlobalKeyboardShortcuts() { var _this; Object(classCallCheck["a" /* default */])(this, EditorGlobalKeyboardShortcuts); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(EditorGlobalKeyboardShortcuts).apply(this, arguments)); _this.selectAll = _this.selectAll.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.undoOrRedo = _this.undoOrRedo.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.save = _this.save.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.deleteSelectedBlocks = _this.deleteSelectedBlocks.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.clearMultiSelection = _this.clearMultiSelection.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); return _this; } Object(createClass["a" /* default */])(EditorGlobalKeyboardShortcuts, [{ key: "selectAll", value: function selectAll(event) { var _this$props = this.props, rootBlocksClientIds = _this$props.rootBlocksClientIds, onMultiSelect = _this$props.onMultiSelect; event.preventDefault(); onMultiSelect(Object(external_lodash_["first"])(rootBlocksClientIds), Object(external_lodash_["last"])(rootBlocksClientIds)); } }, { key: "undoOrRedo", value: function undoOrRedo(event) { var _this$props2 = this.props, onRedo = _this$props2.onRedo, onUndo = _this$props2.onUndo; if (event.shiftKey) { onRedo(); } else { onUndo(); } event.preventDefault(); } }, { key: "save", value: function save(event) { event.preventDefault(); this.props.onSave(); } }, { key: "deleteSelectedBlocks", value: function deleteSelectedBlocks(event) { var _this$props3 = this.props, selectedBlockClientIds = _this$props3.selectedBlockClientIds, hasMultiSelection = _this$props3.hasMultiSelection, onRemove = _this$props3.onRemove, isLocked = _this$props3.isLocked; if (hasMultiSelection) { event.preventDefault(); if (!isLocked) { onRemove(selectedBlockClientIds); } } } /** * Clears current multi-selection, if one exists. */ }, { key: "clearMultiSelection", value: function clearMultiSelection() { var _this$props4 = this.props, hasMultiSelection = _this$props4.hasMultiSelection, clearSelectedBlock = _this$props4.clearSelectedBlock; if (hasMultiSelection) { clearSelectedBlock(); window.getSelection().removeAllRanges(); } } }, { key: "render", value: function render() { var _ref; var selectedBlockClientIds = this.props.selectedBlockClientIds; return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], 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('a'), this.selectAll), 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), Object(defineProperty["a" /* default */])(_ref, "backspace", this.deleteSelectedBlocks), Object(defineProperty["a" /* default */])(_ref, "del", this.deleteSelectedBlocks), Object(defineProperty["a" /* default */])(_ref, "escape", this.clearMultiSelection), _ref) }), 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'), this.save) }), selectedBlockClientIds.length > 0 && Object(external_this_wp_element_["createElement"])(block_actions, { clientIds: selectedBlockClientIds }, function (_ref3) { var _ref4; var onDuplicate = _ref3.onDuplicate, onRemove = _ref3.onRemove, onInsertAfter = _ref3.onInsertAfter, onInsertBefore = _ref3.onInsertBefore; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["KeyboardShortcuts"], { bindGlobal: true, shortcuts: (_ref4 = {}, Object(defineProperty["a" /* default */])(_ref4, shortcuts.duplicate.raw, Object(external_lodash_["flow"])(preventDefault, onDuplicate)), Object(defineProperty["a" /* default */])(_ref4, shortcuts.removeBlock.raw, Object(external_lodash_["flow"])(preventDefault, onRemove)), Object(defineProperty["a" /* default */])(_ref4, shortcuts.insertBefore.raw, Object(external_lodash_["flow"])(preventDefault, onInsertBefore)), Object(defineProperty["a" /* default */])(_ref4, shortcuts.insertAfter.raw, Object(external_lodash_["flow"])(preventDefault, onInsertAfter)), _ref4) }); })); } }]); return EditorGlobalKeyboardShortcuts; }(external_this_wp_element_["Component"]); /* harmony default export */ var editor_global_keyboard_shortcuts = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getBlockOrder = _select.getBlockOrder, getMultiSelectedBlockClientIds = _select.getMultiSelectedBlockClientIds, hasMultiSelection = _select.hasMultiSelection, isEditedPostDirty = _select.isEditedPostDirty, getBlockRootClientId = _select.getBlockRootClientId, getTemplateLock = _select.getTemplateLock, getSelectedBlockClientId = _select.getSelectedBlockClientId; var selectedBlockClientId = getSelectedBlockClientId(); var selectedBlockClientIds = selectedBlockClientId ? [selectedBlockClientId] : getMultiSelectedBlockClientIds(); return { rootBlocksClientIds: getBlockOrder(), hasMultiSelection: hasMultiSelection(), isLocked: Object(external_lodash_["some"])(selectedBlockClientIds, function (clientId) { return !!getTemplateLock(getBlockRootClientId(clientId)); }), isDirty: isEditedPostDirty(), selectedBlockClientIds: selectedBlockClientIds }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, ownProps) { var _dispatch = dispatch('core/editor'), clearSelectedBlock = _dispatch.clearSelectedBlock, multiSelect = _dispatch.multiSelect, redo = _dispatch.redo, undo = _dispatch.undo, removeBlocks = _dispatch.removeBlocks, 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. When removing, also // remember to remove `isDirty` prop passing from `withSelect`. // // See: `isEditedPostSaveable` if (!ownProps.isDirty) { return; } savePost(); }, clearSelectedBlock: clearSelectedBlock, onMultiSelect: multiSelect, onRedo: redo, onUndo: undo, onRemove: removeBlocks }; })])(editor_global_keyboard_shortcuts_EditorGlobalKeyboardShortcuts)); // 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", 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. // See: https://github.com/WordPress/gutenberg/issues/3486 , "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)); // 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", 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. // See: https://github.com/WordPress/gutenberg/issues/3486 , "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)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/template-validation-notice/index.js /** * WordPress dependencies */ function TemplateValidationNotice(_ref) { var isValid = _ref.isValid, props = Object(objectWithoutProperties["a" /* default */])(_ref, ["isValid"]); if (isValid) { return null; } 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?'))) { props.synchronizeTemplate(); } }; 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')))); } /* harmony default export */ var template_validation_notice = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { return { isValid: select('core/editor').isValidTemplate() }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { var _dispatch = dispatch('core/editor'), setTemplateValidity = _dispatch.setTemplateValidity, synchronizeTemplate = _dispatch.synchronizeTemplate; return { resetTemplateValidity: function resetTemplateValidity() { return setTemplateValidity(true); }, synchronizeTemplate: synchronizeTemplate }; })])(TemplateValidationNotice)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-notices/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function EditorNotices(props) { return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["NoticeList"], props, Object(external_this_wp_element_["createElement"])(template_validation_notice, null)); } /* harmony default export */ var editor_notices = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { return { notices: select('core/notices').getNotices() }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { return { onRemove: dispatch('core/notices').removeNotice }; })])(EditorNotices)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/check.js /** * External dependencies */ /** * WordPress dependencies */ function PageAttributesCheck(_ref) { 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)) { return null; } return children; } /* harmony default export */ var page_attributes_check = (Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getEditedPostAttribute = _select.getEditedPostAttribute, getEditorSettings = _select.getEditorSettings; var _select2 = select('core'), getPostType = _select2.getPostType; var _getEditorSettings = getEditorSettings(), availableTemplates = _getEditorSettings.availableTemplates; return { postType: getPostType(getEditedPostAttribute('type')), availableTemplates: availableTemplates }; })(PageAttributesCheck)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-type-support-check/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * 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. */ function PostTypeSupportCheck(_ref) { var postType = _ref.postType, children = _ref.children, supportKeys = _ref.supportKeys; var isSupported = true; if (postType) { isSupported = Object(external_lodash_["some"])(Object(external_lodash_["castArray"])(supportKeys), function (key) { return !!postType.supports[key]; }); } if (!isSupported) { return null; } return children; } /* harmony default export */ var post_type_support_check = (Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getEditedPostAttribute = _select.getEditedPostAttribute; var _select2 = select('core'), getPostType = _select2.getPostType; return { postType: getPostType(getEditedPostAttribute('type')) }; })(PostTypeSupportCheck)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/order.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var PageAttributesOrder = Object(external_this_wp_compose_["withState"])({ orderInput: null })(function (_ref) { var onUpdateOrder = _ref.onUpdateOrder, _ref$order = _ref.order, order = _ref$order === void 0 ? 0 : _ref$order, orderInput = _ref.orderInput, setState = _ref.setState; var setUpdatedOrder = function setUpdatedOrder(value) { setState({ orderInput: value }); var newOrder = Number(value); if (Number.isInteger(newOrder) && Object(external_lodash_["invoke"])(value, ['trim']) !== '') { onUpdateOrder(Number(value)); } }; var value = orderInput === null ? order : orderInput; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TextControl"], { className: "editor-page-attributes__order", type: "number", label: Object(external_this_wp_i18n_["__"])('Order'), value: value, onChange: setUpdatedOrder, size: 6, onBlur: function onBlur() { setState({ orderInput: null }); } }); }); function PageAttributesOrderWithChecks(props) { return Object(external_this_wp_element_["createElement"])(post_type_support_check, { supportKeys: "page-attributes" }, Object(external_this_wp_element_["createElement"])(PageAttributesOrder, props)); } /* harmony default export */ var page_attributes_order = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { return { order: select('core/editor').getEditedPostAttribute('menu_order') }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { return { onUpdateOrder: function onUpdateOrder(order) { dispatch('core/editor').editPost({ menu_order: order }); } }; })])(PageAttributesOrderWithChecks)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/terms.js /** * External dependencies */ /** * Returns terms in a tree form. * * @param {Array} flatTerms Array of terms in flat format. * * @return {Array} Array of terms in tree format. */ function buildTermsTree(flatTerms) { var termsByParent = Object(external_lodash_["groupBy"])(flatTerms, 'parent'); var fillWithChildren = function fillWithChildren(terms) { return terms.map(function (term) { var children = termsByParent[term.id]; return Object(objectSpread["a" /* default */])({}, term, { children: children && children.length ? fillWithChildren(children) : [] }); }); }; return fillWithChildren(termsByParent['0'] || []); } // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/parent.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function PageAttributesParent(_ref) { var parent = _ref.parent, 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 pageItems = items || []; if (!isHierarchical || !parentPageLabel || !pageItems.length) { return null; } var pagesTree = buildTermsTree(pageItems.map(function (item) { 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'), ")") }; })); return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TreeSelect"], { label: parentPageLabel, noOptionLabel: "(".concat(Object(external_this_wp_i18n_["__"])('no parent'), ")"), tree: pagesTree, selectedId: parent, onChange: onUpdateParent }); } var parent_applyWithSelect = Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core'), getPostType = _select.getPostType, getEntityRecords = _select.getEntityRecords; var _select2 = select('core/editor'), getCurrentPostId = _select2.getCurrentPostId, getEditedPostAttribute = _select2.getEditedPostAttribute; var postTypeSlug = getEditedPostAttribute('type'); var postType = getPostType(postTypeSlug); var postId = getCurrentPostId(); var isHierarchical = Object(external_lodash_["get"])(postType, ['hierarchical'], false); var query = { per_page: -1, exclude: postId, parent_exclude: postId, orderby: 'menu_order', order: 'asc' }; return { parent: getEditedPostAttribute('parent'), items: isHierarchical ? getEntityRecords('postType', postTypeSlug, query) : [], postType: postType }; }); var parent_applyWithDispatch = Object(external_this_wp_data_["withDispatch"])(function (dispatch) { var _dispatch = dispatch('core/editor'), editPost = _dispatch.editPost; return { onUpdateParent: function onUpdateParent(parent) { editPost({ parent: parent || 0 }); } }; }); /* harmony default export */ var page_attributes_parent = (Object(external_this_wp_compose_["compose"])([parent_applyWithSelect, parent_applyWithDispatch])(PageAttributesParent)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/template.js /** * External dependencies */ /** * WordPress dependencies */ function PageTemplate(_ref) { var availableTemplates = _ref.availableTemplates, selectedTemplate = _ref.selectedTemplate, onUpdate = _ref.onUpdate; if (Object(external_lodash_["isEmpty"])(availableTemplates)) { return null; } return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SelectControl"], { label: Object(external_this_wp_i18n_["__"])('Template:'), value: selectedTemplate, onChange: onUpdate, className: "editor-page-attributes__template", options: Object(external_lodash_["map"])(availableTemplates, function (templateName, templateSlug) { return { value: templateSlug, label: templateName }; }) }); } /* harmony default export */ var page_attributes_template = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getEditedPostAttribute = _select.getEditedPostAttribute, getEditorSettings = _select.getEditorSettings; var _getEditorSettings = getEditorSettings(), availableTemplates = _getEditorSettings.availableTemplates; return { selectedTemplate: getEditedPostAttribute('template'), availableTemplates: availableTemplates }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { return { onUpdate: function onUpdate(templateSlug) { dispatch('core/editor').editPost({ template: templateSlug || '' }); } }; }))(PageTemplate)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/check.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function PostAuthorCheck(_ref) { var hasAssignAuthorAction = _ref.hasAssignAuthorAction, authors = _ref.authors, children = _ref.children; if (!hasAssignAuthorAction || authors.length < 2) { return null; } return Object(external_this_wp_element_["createElement"])(post_type_support_check, { supportKeys: "author" }, children); } /* 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), postType: select('core/editor').getCurrentPostType(), authors: select('core').getAuthors() }; }), external_this_wp_compose_["withInstanceId"]])(PostAuthorCheck)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/index.js /** * WordPress dependencies */ /** * Internal dependencies */ var post_author_PostAuthor = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(PostAuthor, _Component); 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))); return _this; } Object(createClass["a" /* default */])(PostAuthor, [{ key: "setAuthorId", value: function setAuthorId(event) { var onUpdateAuthor = this.props.onUpdateAuthor; var value = event.target.value; onUpdateAuthor(Number(value)); } }, { key: "render", value: function render() { var _this$props = this.props, postAuthor = _this$props.postAuthor, instanceId = _this$props.instanceId, authors = _this$props.authors; var selectId = 'post-author-selector-' + instanceId; // Disable reason: A select with an onchange throws a warning /* eslint-disable jsx-a11y/no-onchange */ return Object(external_this_wp_element_["createElement"])(post_author_check, null, Object(external_this_wp_element_["createElement"])("label", { htmlFor: selectId }, Object(external_this_wp_i18n_["__"])('Author')), Object(external_this_wp_element_["createElement"])("select", { id: selectId, value: postAuthor, onChange: this.setAuthorId, className: "editor-post-author__select" }, authors.map(function (author) { return Object(external_this_wp_element_["createElement"])("option", { key: author.id, value: author.id }, author.name); }))); /* eslint-enable jsx-a11y/no-onchange */ } }]); return PostAuthor; }(external_this_wp_element_["Component"]); /* harmony default export */ var post_author = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { return { postAuthor: select('core/editor').getEditedPostAttribute('author'), authors: select('core').getAuthors() }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { return { onUpdateAuthor: function onUpdateAuthor(author) { dispatch('core/editor').editPost({ author: author }); } }; }), external_this_wp_compose_["withInstanceId"]])(post_author_PostAuthor)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-comments/index.js /** * WordPress dependencies */ function PostComments(_ref) { var _ref$commentStatus = _ref.commentStatus, commentStatus = _ref$commentStatus === void 0 ? 'open' : _ref$commentStatus, props = Object(objectWithoutProperties["a" /* default */])(_ref, ["commentStatus"]); var onToggleComments = function onToggleComments() { return props.editPost({ comment_status: commentStatus === 'open' ? 'closed' : 'open' }); }; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], { label: Object(external_this_wp_i18n_["__"])('Allow Comments'), checked: commentStatus === 'open', onChange: onToggleComments }); } /* harmony default export */ var post_comments = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { return { commentStatus: select('core/editor').getEditedPostAttribute('comment_status') }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { return { editPost: dispatch('core/editor').editPost }; })])(PostComments)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/index.js /** * WordPress dependencies */ function PostExcerpt(_ref) { var excerpt = _ref.excerpt, onUpdateExcerpt = _ref.onUpdateExcerpt; return Object(external_this_wp_element_["createElement"])("div", { className: "editor-post-excerpt" }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TextareaControl"], { label: Object(external_this_wp_i18n_["__"])('Write an excerpt (optional)'), className: "editor-post-excerpt__textarea", onChange: function onChange(value) { return onUpdateExcerpt(value); }, value: excerpt }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ExternalLink"], { href: "https://sitepad.com/docs/Excerpt" }, Object(external_this_wp_i18n_["__"])('Learn more about manual excerpts'))); } /* harmony default export */ var post_excerpt = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { return { excerpt: select('core/editor').getEditedPostAttribute('excerpt') }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { return { onUpdateExcerpt: function onUpdateExcerpt(excerpt) { dispatch('core/editor').editPost({ excerpt: excerpt }); } }; })])(PostExcerpt)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/check.js /** * Internal dependencies */ function PostExcerptCheck(props) { return Object(external_this_wp_element_["createElement"])(post_type_support_check, Object(esm_extends["a" /* default */])({}, props, { supportKeys: "excerpt" })); } /* harmony default export */ var post_excerpt_check = (PostExcerptCheck); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/theme-support-check/index.js /** * External dependencies */ /** * WordPress dependencies */ function ThemeSupportCheck(_ref) { var themeSupports = _ref.themeSupports, 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. // 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); } return supported; }); if (!isSupported) { return null; } return children; } /* harmony default export */ var theme_support_check = (Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core'), getThemeSupports = _select.getThemeSupports; var _select2 = select('core/editor'), getEditedPostAttribute = _select2.getEditedPostAttribute; return { postType: getEditedPostAttribute('type'), themeSupports: getThemeSupports() }; })(ThemeSupportCheck)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/check.js /** * Internal dependencies */ function PostFeaturedImageCheck(props) { return Object(external_this_wp_element_["createElement"])(theme_support_check, { supportKeys: "post-thumbnails" }, Object(external_this_wp_element_["createElement"])(post_type_support_check, Object(esm_extends["a" /* default */])({}, props, { supportKeys: "thumbnail" }))); } /* harmony default export */ var post_featured_image_check = (PostFeaturedImageCheck); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ 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_SET_FEATURE_IMAGE_LABEL = Object(external_this_wp_i18n_["__"])('Set featured image'); var DEFAULT_REMOVE_FEATURE_IMAGE_LABEL = Object(external_this_wp_i18n_["__"])('Remove image'); function PostFeaturedImage(_ref) { var currentPostId = _ref.currentPostId, featuredImageId = _ref.featuredImageId, onUpdateImage = _ref.onUpdateImage, onRemoveImage = _ref.onRemoveImage, media = _ref.media, postType = _ref.postType; var postLabel = Object(external_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])) { 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", { className: "editor-post-featured-image" }, !!featuredImageId && Object(external_this_wp_element_["createElement"])(check, { fallback: instructions }, Object(external_this_wp_element_["createElement"])(media_upload, { title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, onSelect: onUpdateImage, allowedTypes: ALLOWED_MEDIA_TYPES, modalClass: "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"], { className: "editor-post-featured-image__preview", onClick: open, "aria-label": Object(external_this_wp_i18n_["__"])('Edit or update the image') }, media && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ResponsiveWrapper"], { naturalWidth: mediaWidth, naturalHeight: mediaHeight }, Object(external_this_wp_element_["createElement"])("img", { src: mediaSourceUrl, alt: "" })), !media && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Spinner"], null)); }, value: featuredImageId })), !!featuredImageId && media && !media.isLoading && Object(external_this_wp_element_["createElement"])(check, null, Object(external_this_wp_element_["createElement"])(media_upload, { title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, onSelect: onUpdateImage, 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')); } })), !featuredImageId && Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])(check, { fallback: instructions }, Object(external_this_wp_element_["createElement"])(media_upload, { title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, onSelect: onUpdateImage, allowedTypes: ALLOWED_MEDIA_TYPES, modalClass: "editor-post-featured-image__media-modal", render: function render(_ref4) { var open = _ref4.open; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { className: "editor-post-featured-image__toggle", onClick: open }, postLabel.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL); } }))), !!featuredImageId && Object(external_this_wp_element_["createElement"])(check, null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { onClick: onRemoveImage, isLink: true, isDestructive: true }, postLabel.remove_featured_image || DEFAULT_REMOVE_FEATURE_IMAGE_LABEL)))); } var post_featured_image_applyWithSelect = Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core'), getMedia = _select.getMedia, getPostType = _select.getPostType; var _select2 = select('core/editor'), getCurrentPostId = _select2.getCurrentPostId, getEditedPostAttribute = _select2.getEditedPostAttribute; var featuredImageId = getEditedPostAttribute('featured_media'); return { media: featuredImageId ? getMedia(featuredImageId) : null, currentPostId: getCurrentPostId(), postType: getPostType(getEditedPostAttribute('type')), featuredImageId: featuredImageId }; }); var post_featured_image_applyWithDispatch = Object(external_this_wp_data_["withDispatch"])(function (dispatch) { var _dispatch = dispatch('core/editor'), editPost = _dispatch.editPost; return { onUpdateImage: function onUpdateImage(image) { editPost({ featured_media: image.id }); }, onRemoveImage: function onRemoveImage() { editPost({ featured_media: 0 }); } }; }); /* 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)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/check.js /** * WordPress dependencies */ /** * Internal dependencies */ function PostFormatCheck(_ref) { var disablePostFormats = _ref.disablePostFormats, props = Object(objectWithoutProperties["a" /* default */])(_ref, ["disablePostFormats"]); return !disablePostFormats && Object(external_this_wp_element_["createElement"])(post_type_support_check, Object(esm_extends["a" /* default */])({}, props, { supportKeys: "post-formats" })); } /* harmony default export */ var post_format_check = (Object(external_this_wp_data_["withSelect"])(function (select) { var editorSettings = select('core/editor').getEditorSettings(); return { disablePostFormats: editorSettings.disablePostFormats }; })(PostFormatCheck)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var POST_FORMATS = [{ id: 'aside', caption: Object(external_this_wp_i18n_["__"])('Aside') }, { id: 'gallery', caption: Object(external_this_wp_i18n_["__"])('Gallery') }, { id: 'link', caption: Object(external_this_wp_i18n_["__"])('Link') }, { id: 'image', caption: Object(external_this_wp_i18n_["__"])('Image') }, { id: 'quote', caption: Object(external_this_wp_i18n_["__"])('Quote') }, { id: 'standard', caption: Object(external_this_wp_i18n_["__"])('Standard') }, { id: 'status', caption: Object(external_this_wp_i18n_["__"])('Status') }, { id: 'video', caption: Object(external_this_wp_i18n_["__"])('Video') }, { id: 'audio', caption: Object(external_this_wp_i18n_["__"])('Audio') }, { id: 'chat', caption: Object(external_this_wp_i18n_["__"])('Chat') }]; function PostFormat(_ref) { var onUpdatePostFormat = _ref.onUpdatePostFormat, _ref$postFormat = _ref.postFormat, postFormat = _ref$postFormat === void 0 ? 'standard' : _ref$postFormat, supportedFormats = _ref.supportedFormats, suggestedFormat = _ref.suggestedFormat, instanceId = _ref.instanceId; var postFormatSelectorId = 'post-format-selector-' + instanceId; var formats = POST_FORMATS.filter(function (format) { return Object(external_lodash_["includes"])(supportedFormats, format.id); }); var suggestion = Object(external_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", { className: "editor-post-format__content" }, Object(external_this_wp_element_["createElement"])("label", { htmlFor: postFormatSelectorId }, Object(external_this_wp_i18n_["__"])('Post Format')), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SelectControl"], { value: postFormat, onChange: function onChange(format) { return onUpdatePostFormat(format); }, id: postFormatSelectorId, options: formats.map(function (format) { return { label: format.caption, value: format.id }; }) })), suggestion && suggestion.id !== postFormat && Object(external_this_wp_element_["createElement"])("div", { className: "editor-post-format__suggestion" }, Object(external_this_wp_i18n_["__"])('Suggestion:'), ' ', Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { isLink: true, onClick: function onClick() { 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) { var _select = select('core/editor'), getEditedPostAttribute = _select.getEditedPostAttribute, getSuggestedPostFormat = _select.getSuggestedPostFormat; var postFormat = getEditedPostAttribute('format'); 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'], [])); return { postFormat: postFormat, supportedFormats: supportedFormats, suggestedFormat: getSuggestedPostFormat() }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { return { onUpdatePostFormat: function onUpdatePostFormat(postFormat) { dispatch('core/editor').editPost({ format: postFormat }); } }; }), external_this_wp_compose_["withInstanceId"]])(PostFormat)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/check.js /** * WordPress dependencies */ /** * Internal dependencies */ function PostLastRevisionCheck(_ref) { var lastRevisionId = _ref.lastRevisionId, revisionsCount = _ref.revisionsCount, children = _ref.children; if (!lastRevisionId || revisionsCount < 2) { return null; } return Object(external_this_wp_element_["createElement"])(post_type_support_check, { supportKeys: "revisions" }, children); } /* harmony default export */ var post_last_revision_check = (Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getCurrentPostLastRevisionId = _select.getCurrentPostLastRevisionId, getCurrentPostRevisionsCount = _select.getCurrentPostRevisionsCount; return { lastRevisionId: getCurrentPostLastRevisionId(), revisionsCount: getCurrentPostRevisionsCount() }; })(PostLastRevisionCheck)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/index.js /** * WordPress dependencies */ /** * Internal dependencies */ 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"], { 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))); } /* harmony default export */ var post_last_revision = (Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getCurrentPostLastRevisionId = _select.getCurrentPostLastRevisionId, getCurrentPostRevisionsCount = _select.getCurrentPostRevisionsCount; return { lastRevisionId: getCurrentPostLastRevisionId(), revisionsCount: getCurrentPostRevisionsCount() }; })(LastRevision)); // EXTERNAL MODULE: external "jQuery" var external_jQuery_ = __webpack_require__(99); var external_jQuery_default = /*#__PURE__*/__webpack_require__.n(external_jQuery_); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-preview-button/index.js /** * External dependencies */ /** * WordPress dependencies */ function writeInterstitialMessage(targetDocument) { var markup = Object(external_this_wp_element_["renderToString"])(Object(external_this_wp_element_["createElement"])("div", { className: "editor-post-preview-button__interstitial-message" }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 96 96" }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { className: "outer", d: "M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36", fill: "none" }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { className: "inner", d: "M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z", fill: "none" })), Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_i18n_["__"])('Generating preview…')))); markup += "\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\twidth: 100vw;\n\t\t\t}\n\t\t\t@-webkit-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-moz-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-o-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg {\n\t\t\t\twidth: 192px;\n\t\t\t\theight: 192px;\n\t\t\t\tstroke: #555d66;\n\t\t\t\tstroke-width: 0.75;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg .outer,\n\t\t\t.editor-post-preview-button__interstitial-message svg .inner {\n\t\t\t\tstroke-dasharray: 280;\n\t\t\t\tstroke-dashoffset: 280;\n\t\t\t\t-webkit-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-moz-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-o-animation: paint 1.5s ease infinite alternate;\n\t\t\t\tanimation: paint 1.5s ease infinite alternate;\n\t\t\t}\n\t\t\tp {\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen-Sans, Ubuntu, Cantarell, \"Helvetica Neue\", sans-serif;\n\t\t\t}\n\t\t</style>\n\t"; targetDocument.write(markup); targetDocument.title = Object(external_this_wp_i18n_["__"])('Generating preview…'); targetDocument.close(); } var post_preview_button_PostPreviewButton = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(PostPreviewButton, _Component); 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))); return _this; } Object(createClass["a" /* default */])(PostPreviewButton, [{ key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { var previewLink = this.props.previewLink; // This relies on the window being responsible to unset itself when // navigation occurs or a new preview window is opened, to avoid // unintentional forceful redirects. if (previewLink && !prevProps.previewLink) { this.setPreviewWindowLink(previewLink); } } /** * Sets the preview window's location to the given URL, if a preview window * exists and is not closed. * * @param {string} url URL to assign as preview window location. */ }, { key: "setPreviewWindowLink", value: function setPreviewWindowLink(url) { var previewWindow = this.previewWindow; if (previewWindow && !previewWindow.closed) { previewWindow.location = url; } } }, { key: "getWindowTarget", value: function getWindowTarget() { var postId = this.props.postId; return "wp-preview-".concat(postId); } }, { key: "openPreviewWindow", value: function openPreviewWindow(event) { // Our Preview button has its 'href' and 'target' set correctly for a11y // purposes. Unfortunately, though, we can't rely on the default 'click' // handler since sometimes it incorrectly opens a new tab instead of reusing // the existing one. // https://github.com/WordPress/gutenberg/pull/8330 event.preventDefault(); // Open up a Preview tab if needed. This is where we'll show the preview. if (!this.previewWindow || this.previewWindow.closed) { this.previewWindow = window.open('', this.getWindowTarget()); } // Focus the Preview tab. This might not do anything, depending on the browser's // and user's preferences. // https://html.spec.whatwg.org/multipage/interaction.html#dom-window-focus this.previewWindow.focus(); // If we don't need to autosave the post before previewing, then we simply // load the Preview URL in the Preview tab. if (!this.props.isAutosaveable) { this.setPreviewWindowLink(event.target.href); return; } // Request an autosave. This happens asynchronously and causes the component // to update when finished. if (this.props.isDraft) { this.props.savePost({ isPreview: true }); } else { this.props.autosave({ isPreview: true }); } // Display a 'Generating preview' message in the Preview tab while we wait for the // autosave to finish. writeInterstitialMessage(this.previewWindow.document); } }, { key: "render", value: function render() { var _this$props = this.props, previewLink = _this$props.previewLink, currentPostLink = _this$props.currentPostLink, isSaveable = _this$props.isSaveable; // Link to the `?preview=true` URL if we have it, since this lets us see // changes that were autosaved since the post was last published. Otherwise, // just link to the post's URL. var href = previewLink || currentPostLink; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { isLarge: true, className: "editor-post-preview", 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" }, /* 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.'))); } }]); return PostPreviewButton; }(external_this_wp_element_["Component"]); /* harmony default export */ var post_preview_button = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref) { var forcePreviewLink = _ref.forcePreviewLink, forceIsAutosaveable = _ref.forceIsAutosaveable; var _select = select('core/editor'), getCurrentPostId = _select.getCurrentPostId, getCurrentPostAttribute = _select.getCurrentPostAttribute, getEditedPostAttribute = _select.getEditedPostAttribute, isEditedPostSaveable = _select.isEditedPostSaveable, isEditedPostAutosaveable = _select.isEditedPostAutosaveable, getEditedPostPreviewLink = _select.getEditedPostPreviewLink; var _select2 = select('core'), getPostType = _select2.getPostType; var previewLink = getEditedPostPreviewLink(); var postType = getPostType(getEditedPostAttribute('type')); return { postId: getCurrentPostId(), currentPostLink: getCurrentPostAttribute('link'), previewLink: forcePreviewLink !== undefined ? forcePreviewLink : previewLink, isSaveable: isEditedPostSaveable(), isAutosaveable: forceIsAutosaveable || isEditedPostAutosaveable(), isViewable: Object(external_lodash_["get"])(postType, ['viewable'], false), isDraft: ['draft', 'auto-draft'].indexOf(getEditedPostAttribute('status')) !== -1 }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { return { autosave: dispatch('core/editor').autosave, savePost: dispatch('core/editor').savePost }; }), Object(external_this_wp_compose_["ifCondition"])(function (_ref2) { var isViewable = _ref2.isViewable; return isViewable; })])(post_preview_button_PostPreviewButton)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-locked-modal/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var post_locked_modal_PostLockedModal = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(PostLockedModal, _Component); 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))); return _this; } Object(createClass["a" /* default */])(PostLockedModal, [{ key: "componentDidMount", value: function componentDidMount() { // Details on these events on the Heartbeat API docs // https://developer.wordpress.org/plugins/javascript/heartbeat-api/ external_jQuery_default()(document).on('heartbeat-send.refresh-lock', this.sendPostLock).on('heartbeat-tick.refresh-lock', this.receivePostLock); } }, { key: "componentWillUnmount", value: function componentWillUnmount() { external_jQuery_default()(document).off('heartbeat-send.refresh-lock', this.sendPostLock).off('heartbeat-tick.refresh-lock', this.receivePostLock); } /** * Keep the lock refreshed. * * When the user does not send a heartbeat in a heartbeat-tick * the user is no longer editing and another user can start editing. * * @param {Object} event Event. * @param {Object} data Data to send in the heartbeat request. */ }, { key: "sendPostLock", value: function sendPostLock(event, data) { var _this$props = this.props, isLocked = _this$props.isLocked, activePostLock = _this$props.activePostLock, postId = _this$props.postId; if (isLocked) { return; } data['wp-refresh-post-lock'] = { lock: activePostLock, post_id: postId }; } /** * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing. * * @param {Object} event Event. * @param {Object} data Data received in the heartbeat request */ }, { key: "receivePostLock", value: function receivePostLock(event, data) { if (!data['wp-refresh-post-lock']) { return; } var _this$props2 = this.props, autosave = _this$props2.autosave, updatePostLock = _this$props2.updatePostLock; var received = data['wp-refresh-post-lock']; if (received.lock_error) { // Auto save and display the takeover modal. autosave(); updatePostLock({ isLocked: true, isTakeover: true, user: { avatar: received.lock_error.avatar_src } }); } else if (received.new_lock) { updatePostLock({ isLocked: false, activePostLock: received.new_lock }); } } /** * Unlock the post before the window is exited. */ }, { key: "releasePostLock", value: function releasePostLock() { var _this$props3 = this.props, isLocked = _this$props3.isLocked, activePostLock = _this$props3.activePostLock, postLockUtils = _this$props3.postLockUtils, postId = _this$props3.postId; if (isLocked || !activePostLock) { return; } var data = { action: 'wp-remove-post-lock', _wpnonce: postLockUtils.unlockNonce, post_ID: postId, active_post_lock: activePostLock }; external_jQuery_default.a.post({ async: false, url: postLockUtils.ajaxUrl, data: data }); } }, { key: "render", value: function render() { var _this$props4 = this.props, user = _this$props4.user, postId = _this$props4.postId, isLocked = _this$props4.isLocked, isTakeover = _this$props4.isTakeover, postLockUtils = _this$props4.postLockUtils, postType = _this$props4.postType; if (!isLocked) { return null; } var userDisplayName = user.name; var userAvatar = user.avatar; var unlockUrl = Object(external_this_wp_url_["addQueryArgs"])('post.php', { 'get-post-lock': '1', lockKey: true, post: postId, action: 'edit', _wpnonce: postLockUtils.nonce }); var allPostsUrl = getWPAdminURL('edit.php', { post_type: Object(external_lodash_["get"])(postType, ['slug']) }); var allPostsLabel = Object(external_lodash_["get"])(postType, ['labels', 'all_items']); return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Modal"], { title: isTakeover ? Object(external_this_wp_i18n_["__"])('Someone else has taken over this post.') : Object(external_this_wp_i18n_["__"])('This post is already being edited.'), focusOnMount: true, shouldCloseOnClickOutside: false, shouldCloseOnEsc: false, isDismissable: false, className: "editor-post-locked-modal" }, !!userAvatar && Object(external_this_wp_element_["createElement"])("img", { src: userAvatar, alt: Object(external_this_wp_i18n_["__"])('Avatar'), className: "editor-post-locked-modal__avatar" }), !!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 now has editing control of this post. Don’t worry, your changes up to this moment have been saved.'), userDisplayName) : Object(external_this_wp_i18n_["__"])('Another user now has editing control of this post. Don’t worry, your changes up to this moment have been saved.')), Object(external_this_wp_element_["createElement"])("div", { 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, 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'))))); } }]); return PostLockedModal; }(external_this_wp_element_["Component"]); /* harmony default export */ var post_locked_modal = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getEditorSettings = _select.getEditorSettings, isPostLocked = _select.isPostLocked, isPostLockTakeover = _select.isPostLockTakeover, getPostLockUser = _select.getPostLockUser, getCurrentPostId = _select.getCurrentPostId, getActivePostLock = _select.getActivePostLock, getEditedPostAttribute = _select.getEditedPostAttribute; var _select2 = select('core'), getPostType = _select2.getPostType; return { isLocked: isPostLocked(), isTakeover: isPostLockTakeover(), user: getPostLockUser(), postId: getCurrentPostId(), postLockUtils: getEditorSettings().postLockUtils, activePostLock: getActivePostLock(), postType: getPostType(getEditedPostAttribute('type')) }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { var _dispatch = dispatch('core/editor'), autosave = _dispatch.autosave, updatePostLock = _dispatch.updatePostLock; return { autosave: autosave, updatePostLock: updatePostLock }; }), Object(external_this_wp_compose_["withGlobalEvents"])({ beforeunload: 'releasePostLock' }))(post_locked_modal_PostLockedModal)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/check.js /** * External dependencies */ /** * WordPress dependencies */ function PostPendingStatusCheck(_ref) { var hasPublishAction = _ref.hasPublishAction, isPublished = _ref.isPublished, children = _ref.children; if (isPublished || !hasPublishAction) { return null; } return children; } /* harmony default export */ var post_pending_status_check = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), isCurrentPostPublished = _select.isCurrentPostPublished, getCurrentPostType = _select.getCurrentPostType, getCurrentPost = _select.getCurrentPost; return { hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), isPublished: isCurrentPostPublished(), postType: getCurrentPostType() }; }))(PostPendingStatusCheck)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function PostPendingStatus(_ref) { var status = _ref.status, onUpdateStatus = _ref.onUpdateStatus; var togglePendingStatus = function togglePendingStatus() { var updatedStatus = status === 'pending' ? 'draft' : 'pending'; onUpdateStatus(updatedStatus); }; 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'), checked: status === 'pending', onChange: togglePendingStatus })); } /* harmony default export */ var post_pending_status = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select) { return { status: select('core/editor').getEditedPostAttribute('status') }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { return { onUpdateStatus: function onUpdateStatus(status) { dispatch('core/editor').editPost({ status: status }); } }; }))(PostPendingStatus)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pingbacks/index.js /** * WordPress dependencies */ function PostPingbacks(_ref) { var _ref$pingStatus = _ref.pingStatus, pingStatus = _ref$pingStatus === void 0 ? 'open' : _ref$pingStatus, props = Object(objectWithoutProperties["a" /* default */])(_ref, ["pingStatus"]); var onTogglePingback = function onTogglePingback() { return props.editPost({ ping_status: pingStatus === 'open' ? 'closed' : 'open' }); }; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], { label: Object(external_this_wp_i18n_["__"])('Allow Pingbacks & Trackbacks'), checked: pingStatus === 'open', onChange: onTogglePingback }); } /* harmony default export */ var post_pingbacks = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { return { pingStatus: select('core/editor').getEditedPostAttribute('ping_status') }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { return { editPost: dispatch('core/editor').editPost }; })])(PostPingbacks)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/label.js /** * External dependencies */ /** * WordPress dependencies */ function PublishButtonLabel(_ref) { var isPublished = _ref.isPublished, isBeingScheduled = _ref.isBeingScheduled, isSaving = _ref.isSaving, isPublishing = _ref.isPublishing, hasPublishAction = _ref.hasPublishAction, isAutosaving = _ref.isAutosaving; if (isPublishing) { return Object(external_this_wp_i18n_["__"])('Publishing…'); } else if (isPublished && isSaving && !isAutosaving) { return Object(external_this_wp_i18n_["__"])('Updating…'); } else if (isBeingScheduled && isSaving && !isAutosaving) { return Object(external_this_wp_i18n_["__"])('Scheduling…'); } if (!hasPublishAction) { return Object(external_this_wp_i18n_["__"])('Submit for Review'); } else if (isPublished) { return Object(external_this_wp_i18n_["__"])('Update'); } else if (isBeingScheduled) { return Object(external_this_wp_i18n_["__"])('Schedule'); } return Object(external_this_wp_i18n_["__"])('Publish'); } /* harmony default export */ var post_publish_button_label = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref2) { var forceIsSaving = _ref2.forceIsSaving; var _select = select('core/editor'), isCurrentPostPublished = _select.isCurrentPostPublished, isEditedPostBeingScheduled = _select.isEditedPostBeingScheduled, isSavingPost = _select.isSavingPost, isPublishingPost = _select.isPublishingPost, getCurrentPost = _select.getCurrentPost, getCurrentPostType = _select.getCurrentPostType, isAutosavingPost = _select.isAutosavingPost; return { isPublished: isCurrentPostPublished(), isBeingScheduled: isEditedPostBeingScheduled(), isSaving: forceIsSaving || isSavingPost(), isPublishing: isPublishingPost(), hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), postType: getCurrentPostType(), isAutosaving: isAutosavingPost() }; })])(PublishButtonLabel)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var post_publish_button_PostPublishButton = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(PostPublishButton, _Component); 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.buttonNode = Object(external_this_wp_element_["createRef"])(); return _this; } Object(createClass["a" /* default */])(PostPublishButton, [{ key: "componentDidMount", value: function componentDidMount() { if (this.props.focusOnMount) { this.buttonNode.current.focus(); } } }, { 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 isButtonDisabled = isSaving || forceIsSaving || !isSaveable || isPostSavingLocked || !isPublishable && !forceIsDirty; var isToggleDisabled = isPublished || isSaving || forceIsSaving || !isSaveable || !isPublishable && !forceIsDirty; var publishStatus; if (!hasPublishAction) { publishStatus = 'pending'; } else if (isBeingScheduled) { publishStatus = 'future'; } else if (visibility === 'private') { publishStatus = 'private'; } else { publishStatus = 'publish'; } var onClick = function onClick() { if (isButtonDisabled) { return; } onSubmit(); onStatusChange(publishStatus); onSave(); }; var buttonProps = { 'aria-disabled': isButtonDisabled, className: 'editor-post-publish-button', isBusy: isSaving && isPublished, isLarge: true, isPrimary: true, onClick: onClick }; var toggleProps = { 'aria-disabled': isToggleDisabled, 'aria-expanded': isOpen, className: 'editor-post-publish-panel__toggle', isBusy: isSaving && isPublished, isPrimary: true, onClick: onToggle }; 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 }); 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 */])({ 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.'))); } }]); return PostPublishButton; }(external_this_wp_element_["Component"]); /* harmony default export */ var post_publish_button = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), isSavingPost = _select.isSavingPost, isEditedPostBeingScheduled = _select.isEditedPostBeingScheduled, getEditedPostVisibility = _select.getEditedPostVisibility, isCurrentPostPublished = _select.isCurrentPostPublished, isEditedPostSaveable = _select.isEditedPostSaveable, isEditedPostPublishable = _select.isEditedPostPublishable, isPostSavingLocked = _select.isPostSavingLocked, getCurrentPost = _select.getCurrentPost, getCurrentPostType = _select.getCurrentPostType; return { isSaving: isSavingPost(), isBeingScheduled: isEditedPostBeingScheduled(), visibility: getEditedPostVisibility(), isSaveable: isEditedPostSaveable(), isPostSavingLocked: isPostSavingLocked(), isPublishable: isEditedPostPublishable(), isPublished: isCurrentPostPublished(), hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), postType: getCurrentPostType() }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { var _dispatch = dispatch('core/editor'), editPost = _dispatch.editPost, savePost = _dispatch.savePost; return { onStatusChange: function onStatusChange(status) { return editPost({ status: status }); }, onSave: savePost }; })])(post_publish_button_PostPublishButton)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/utils.js /** * WordPress Dependencies */ var visibilityOptions = [{ value: 'public', label: Object(external_this_wp_i18n_["__"])('Public'), info: Object(external_this_wp_i18n_["__"])('Visible to everyone.') }, { value: 'private', label: Object(external_this_wp_i18n_["__"])('Private'), info: Object(external_this_wp_i18n_["__"])('Only visible to site admins and editors.') }, { value: 'password', label: Object(external_this_wp_i18n_["__"])('Password Protected'), info: Object(external_this_wp_i18n_["__"])('Protected with a password you choose. Only those with the password can view this post.') }]; // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/index.js /** * WordPress dependencies */ /** * Internal Dependencies */ var post_visibility_PostVisibility = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(PostVisibility, _Component); 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.state = { hasPassword: !!props.password }; return _this; } Object(createClass["a" /* default */])(PostVisibility, [{ key: "setPublic", value: function setPublic() { var _this$props = this.props, visibility = _this$props.visibility, onUpdateVisibility = _this$props.onUpdateVisibility, status = _this$props.status; onUpdateVisibility(visibility === 'private' ? 'draft' : status); this.setState({ hasPassword: false }); } }, { 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 return; } var _this$props2 = this.props, onUpdateVisibility = _this$props2.onUpdateVisibility, onSave = _this$props2.onSave; onUpdateVisibility('private'); this.setState({ hasPassword: false }); onSave(); } }, { key: "setPasswordProtected", value: function setPasswordProtected() { var _this$props3 = this.props, visibility = _this$props3.visibility, onUpdateVisibility = _this$props3.onUpdateVisibility, status = _this$props3.status, password = _this$props3.password; onUpdateVisibility(visibility === 'private' ? 'draft' : status, password || ''); this.setState({ hasPassword: true }); } }, { key: "updatePassword", value: function updatePassword(event) { var _this$props4 = this.props, status = _this$props4.status, onUpdateVisibility = _this$props4.onUpdateVisibility; onUpdateVisibility(status, event.target.value); } }, { key: "render", value: function render() { var _this$props5 = this.props, visibility = _this$props5.visibility, password = _this$props5.password, instanceId = _this$props5.instanceId; var visibilityHandlers = { public: { onSelect: this.setPublic, checked: visibility === 'public' && !this.state.hasPassword }, private: { onSelect: this.setPrivate, checked: visibility === 'private' }, password: { onSelect: this.setPasswordProtected, checked: this.state.hasPassword } }; return [Object(external_this_wp_element_["createElement"])("fieldset", { key: "visibility-selector", className: "editor-post-visibility__dialog-fieldset" }, Object(external_this_wp_element_["createElement"])("legend", { className: "editor-post-visibility__dialog-legend" }, Object(external_this_wp_i18n_["__"])('Post Visibility')), visibilityOptions.map(function (_ref) { var value = _ref.value, label = _ref.label, info = _ref.info; return Object(external_this_wp_element_["createElement"])("div", { key: value, className: "editor-post-visibility__choice" }, Object(external_this_wp_element_["createElement"])("input", { type: "radio", name: "editor-post-visibility__setting-".concat(instanceId), value: value, onChange: visibilityHandlers[value].onSelect, checked: visibilityHandlers[value].checked, id: "editor-post-".concat(value, "-").concat(instanceId), "aria-describedby": "editor-post-".concat(value, "-").concat(instanceId, "-description"), className: "editor-post-visibility__dialog-radio" }), Object(external_this_wp_element_["createElement"])("label", { htmlFor: "editor-post-".concat(value, "-").concat(instanceId), className: "editor-post-visibility__dialog-label" }, label), Object(external_this_wp_element_["createElement"])("p", { id: "editor-post-".concat(value, "-").concat(instanceId, "-description"), className: "editor-post-visibility__dialog-info" }, info)); })), 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_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), type: "text", onChange: this.updatePassword, value: password, placeholder: Object(external_this_wp_i18n_["__"])('Use a secure password') }))]; } }]); return PostVisibility; }(external_this_wp_element_["Component"]); /* harmony default export */ var post_visibility = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getEditedPostAttribute = _select.getEditedPostAttribute, getEditedPostVisibility = _select.getEditedPostVisibility; return { status: getEditedPostAttribute('status'), visibility: getEditedPostVisibility(), password: getEditedPostAttribute('password') }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { var _dispatch = dispatch('core/editor'), savePost = _dispatch.savePost, editPost = _dispatch.editPost; return { onSave: savePost, onUpdateVisibility: function onUpdateVisibility(status) { var password = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; editPost({ status: status, password: password }); } }; }), external_this_wp_compose_["withInstanceId"]])(post_visibility_PostVisibility)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/label.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal Dependencies */ function PostVisibilityLabel(_ref) { var visibility = _ref.visibility; var getVisibilityLabel = function getVisibilityLabel() { return Object(external_lodash_["find"])(visibilityOptions, { value: visibility }).label; }; return getVisibilityLabel(visibility); } /* harmony default export */ var post_visibility_label = (Object(external_this_wp_data_["withSelect"])(function (select) { return { visibility: select('core/editor').getEditedPostVisibility() }; })(PostVisibilityLabel)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/index.js /** * WordPress dependencies */ function PostSchedule(_ref) { var date = _ref.date, onUpdateDate = _ref.onUpdateDate; 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 "/" var is12HourTime = /a(?!\\)/i.test(settings.formats.time.toLowerCase() // Test only the lower case a .replace(/\\\\/g, '') // Replace "//" with empty strings .split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash ); return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["DateTimePicker"], { key: "date-time-picker", currentDate: date, onChange: onUpdateDate, is12Hour: is12HourTime }); } /* harmony default export */ var post_schedule = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { return { date: select('core/editor').getEditedPostAttribute('date') }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { return { onUpdateDate: function onUpdateDate(date) { dispatch('core/editor').editPost({ date: date }); } }; })])(PostSchedule)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/label.js /** * WordPress dependencies */ function PostScheduleLabel(_ref) { var date = _ref.date, isFloating = _ref.isFloating; 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'); } /* harmony default export */ var post_schedule_label = (Object(external_this_wp_data_["withSelect"])(function (select) { return { date: select('core/editor').getEditedPostAttribute('date'), isFloating: select('core/editor').isEditedPostDateFloating() }; })(PostScheduleLabel)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/flat-term-selector.js /** * External dependencies */ /** * WordPress dependencies */ /** * Module constants */ var DEFAULT_QUERY = { per_page: -1, orderby: 'count', order: 'desc', _fields: 'id,name' }; var MAX_TERMS_SUGGESTIONS = 20; var isSameTermName = function isSameTermName(termA, termB) { return termA.toLowerCase() === termB.toLowerCase(); }; var flat_term_selector_FlatTermSelector = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(FlatTermSelector, _Component); 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.state = { loading: false, availableTerms: [], selectedTerms: [] }; return _this; } Object(createClass["a" /* default */])(FlatTermSelector, [{ key: "componentDidMount", value: function componentDidMount() { var _this2 = this; if (!Object(external_lodash_["isEmpty"])(this.props.terms)) { this.setState({ loading: false }); this.initRequest = this.fetchTerms({ include: this.props.terms.join(','), per_page: -1 }); this.initRequest.then(function () { _this2.setState({ loading: false }); }, function (xhr) { if (xhr.statusText === 'abort') { return; } _this2.setState({ loading: false }); }); } } }, { key: "componentWillUnmount", value: function componentWillUnmount() { Object(external_lodash_["invoke"])(this.initRequest, ['abort']); Object(external_lodash_["invoke"])(this.searchRequest, ['abort']); } }, { key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { if (prevProps.terms !== this.props.terms) { this.updateSelectedTerms(this.props.terms); } } }, { key: "fetchTerms", value: function fetchTerms() { var _this3 = this; 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 request = external_this_wp_apiFetch_default()({ path: Object(external_this_wp_url_["addQueryArgs"])("/core/".concat(taxonomy.rest_base), query) }); request.then(function (terms) { _this3.setState(function (state) { return { availableTerms: state.availableTerms.concat(terms.filter(function (term) { return !Object(external_lodash_["find"])(state.availableTerms, function (availableTerm) { return availableTerm.id === term.id; }); })) }; }); _this3.updateSelectedTerms(_this3.props.terms); }); return request; } }, { key: "updateSelectedTerms", value: function updateSelectedTerms() { 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) { return term.id === termId; }); if (termObject) { result.push(termObject.name); } return result; }, []); this.setState({ selectedTerms: selectedTerms }); } }, { key: "findOrCreateTerm", value: function findOrCreateTerm(termName) { var _this5 = this; var taxonomy = this.props.taxonomy; // Tries to create a term or fetch it if it already exists. return external_this_wp_apiFetch_default()({ path: "/core/".concat(taxonomy.rest_base), method: 'POST', data: { name: termName } }).catch(function (error) { var errorCode = error.code; 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"])("/core/".concat(taxonomy.rest_base), Object(objectSpread["a" /* default */])({}, DEFAULT_QUERY, { search: termName })) }); return _this5.addRequest.then(function (searchResult) { return Object(external_lodash_["find"])(searchResult, function (result) { return isSameTermName(result.name, termName); }); }); } return Promise.reject(error); }); } }, { key: "onChange", value: function onChange(termNames) { var _this6 = this; var uniqueTerms = Object(external_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 isSameTermName(term.name, termName); }); }); var termNamesToIds = function termNamesToIds(names, availableTerms) { return names.map(function (termName) { return Object(external_lodash_["find"])(availableTerms, function (term) { return isSameTermName(term.name, termName); }).id; }); }; if (newTermNames.length === 0) { return this.props.onUpdateTerms(termNamesToIds(uniqueTerms, this.state.availableTerms), this.props.taxonomy.rest_base); } Promise.all(newTermNames.map(this.findOrCreateTerm)).then(function (newTerms) { var newAvailableTerms = _this6.state.availableTerms.concat(newTerms); _this6.setState({ availableTerms: newAvailableTerms }); return _this6.props.onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms), _this6.props.taxonomy.rest_base); }); } }, { key: "searchTerms", value: function searchTerms() { var search = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; Object(external_lodash_["invoke"])(this.searchRequest, ['abort']); this.searchRequest = this.fetchTerms({ search: search }); } }, { key: "render", value: function render() { var _this$props = this.props, slug = _this$props.slug, taxonomy = _this$props.taxonomy, hasAssignAction = _this$props.hasAssignAction; if (!hasAssignAction) { return null; } var _this$state = this.state, loading = _this$state.loading, availableTerms = _this$state.availableTerms, selectedTerms = _this$state.selectedTerms; 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); return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["FormTokenField"], { value: selectedTerms, displayTransform: external_lodash_["unescape"], suggestions: termNames, onChange: this.onChange, onInputChange: this.searchTerms, maxSuggestions: MAX_TERMS_SUGGESTIONS, disabled: loading, label: newTermLabel, messages: { added: termAddedLabel, removed: termRemovedLabel, remove: removeTermLabel } }); } }]); return FlatTermSelector; }(external_this_wp_element_["Component"]); /* harmony default export */ var flat_term_selector = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select, _ref) { var slug = _ref.slug; var _select = select('core/editor'), getCurrentPost = _select.getCurrentPost; var _select2 = select('core'), getTaxonomy = _select2.getTaxonomy; 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, terms: taxonomy ? select('core/editor').getEditedPostAttribute(taxonomy.rest_base) : [], taxonomy: taxonomy }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { return { onUpdateTerms: function onUpdateTerms(terms, restBase) { dispatch('core/editor').editPost(Object(defineProperty["a" /* default */])({}, restBase, terms)); } }; }), Object(external_this_wp_components_["withFilters"])('editor.PostTaxonomyType'))(flat_term_selector_FlatTermSelector)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-tags-panel.js /** * External dependencies */ /** * WordPress dependencies */ var maybe_tags_panel_TagsPanel = function TagsPanel() { var panelBodyTitle = [Object(external_this_wp_i18n_["__"])('Suggestion:'), Object(external_this_wp_element_["createElement"])("span", { className: "editor-post-publish-panel__link", key: "label" }, Object(external_this_wp_i18n_["__"])('Add tags'))]; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { initialOpen: false, title: panelBodyTitle }, Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_i18n_["__"])('Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.')), Object(external_this_wp_element_["createElement"])(flat_term_selector, { slug: 'post_tag' })); }; var maybe_tags_panel_MaybeTagsPanel = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(MaybeTagsPanel, _Component); 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.state = { hadTagsWhenOpeningThePanel: props.hasTags }; return _this; } /* * We only want to show the tag panel if the post didn't have * any tags when the user hit the Publish button. * * We can't use the prop.hasTags because it'll change to true * if the user adds a new tag within the pre-publish panel. * This would force a re-render and a new prop.hasTags check, * hiding this panel and keeping the user from adding * more than one tag. */ Object(createClass["a" /* default */])(MaybeTagsPanel, [{ key: "render", value: function render() { if (!this.state.hadTagsWhenOpeningThePanel) { return Object(external_this_wp_element_["createElement"])(maybe_tags_panel_TagsPanel, null); } return null; } }]); return MaybeTagsPanel; }(external_this_wp_element_["Component"]); /* harmony default export */ var maybe_tags_panel = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select) { var postType = select('core/editor').getCurrentPostType(); var tagsTaxonomy = select('core').getTaxonomy('post_tag'); var tags = tagsTaxonomy && select('core/editor').getEditedPostAttribute(tagsTaxonomy.rest_base); return { areTagsFetched: tagsTaxonomy !== undefined, isPostTypeSupported: tagsTaxonomy && Object(external_lodash_["some"])(tagsTaxonomy.types, function (type) { return type === postType; }), hasTags: tags && tags.length }; }), Object(external_this_wp_compose_["ifCondition"])(function (_ref) { var areTagsFetched = _ref.areTagsFetched, isPostTypeSupported = _ref.isPostTypeSupported; return isPostTypeSupported && areTagsFetched; }))(maybe_tags_panel_MaybeTagsPanel)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-post-format-panel.js /** * External dependencies */ /** * WordPress dependencies. */ /** * Internal dependencies. */ var maybe_post_format_panel_PostFormatSuggestion = function PostFormatSuggestion(_ref) { var suggestedPostFormat = _ref.suggestedPostFormat, suggestionText = _ref.suggestionText, onUpdatePostFormat = _ref.onUpdatePostFormat; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { isLink: true, onClick: function onClick() { return onUpdatePostFormat(suggestedPostFormat); } }, suggestionText); }; var maybe_post_format_panel_PostFormatPanel = function PostFormatPanel(_ref2) { var suggestion = _ref2.suggestion, onUpdatePostFormat = _ref2.onUpdatePostFormat; var panelBodyTitle = [Object(external_this_wp_i18n_["__"])('Suggestion:'), Object(external_this_wp_element_["createElement"])("span", { className: "editor-post-publish-panel__link", key: "label" }, Object(external_this_wp_i18n_["__"])('Use a post format'))]; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { initialOpen: false, title: panelBodyTitle }, 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) }))); }; 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_lodash_["find"])(formats, function (format) { return format.id === suggestedPostFormat; }); }; /* harmony default export */ var maybe_post_format_panel = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getEditedPostAttribute = _select.getEditedPostAttribute, getSuggestedPostFormat = _select.getSuggestedPostFormat; var supportedFormats = Object(external_lodash_["get"])(select('core').getThemeSupports(), ['formats'], []); return { currentPostFormat: getEditedPostAttribute('format'), suggestion: maybe_post_format_panel_getSuggestion(supportedFormats, getSuggestedPostFormat()) }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { return { onUpdatePostFormat: function onUpdatePostFormat(postFormat) { dispatch('core/editor').editPost({ format: postFormat }); } }; }), Object(external_this_wp_compose_["ifCondition"])(function (_ref3) { var suggestion = _ref3.suggestion, currentPostFormat = _ref3.currentPostFormat; return suggestion && suggestion.id !== currentPostFormat; }))(maybe_post_format_panel_PostFormatPanel)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/prepublish.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal Dependencies */ function PostPublishPanelPrepublish(_ref) { var hasPublishAction = _ref.hasPublishAction, isBeingScheduled = _ref.isBeingScheduled, children = _ref.children; var prePublishTitle, prePublishBodyText; if (!hasPublishAction) { prePublishTitle = Object(external_this_wp_i18n_["__"])('Are you ready to submit for review?'); prePublishBodyText = Object(external_this_wp_i18n_["__"])('When you’re ready, submit your work for review, and an Editor will be able to approve it for you.'); } else if (isBeingScheduled) { prePublishTitle = Object(external_this_wp_i18n_["__"])('Are you ready to schedule?'); prePublishBodyText = Object(external_this_wp_i18n_["__"])('Your work will be published at the specified date and time.'); } else { prePublishTitle = Object(external_this_wp_i18n_["__"])('Are you ready to publish?'); prePublishBodyText = Object(external_this_wp_i18n_["__"])('Double-check your settings before publishing.'); } return Object(external_this_wp_element_["createElement"])("div", { className: "editor-post-publish-panel__prepublish" }, Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])("strong", null, prePublishTitle)), Object(external_this_wp_element_["createElement"])("p", null, prePublishBodyText), hasPublishAction && Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { initialOpen: false, title: [Object(external_this_wp_i18n_["__"])('Visibility:'), Object(external_this_wp_element_["createElement"])("span", { className: "editor-post-publish-panel__link", key: "label" }, Object(external_this_wp_element_["createElement"])(post_visibility_label, null))] }, Object(external_this_wp_element_["createElement"])(post_visibility, null)), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { initialOpen: false, title: [Object(external_this_wp_i18n_["__"])('Publish:'), Object(external_this_wp_element_["createElement"])("span", { 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)); } /* harmony default export */ var prepublish = (Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getCurrentPost = _select.getCurrentPost, isEditedPostBeingScheduled = _select.isEditedPostBeingScheduled; return { hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), isBeingScheduled: isEditedPostBeingScheduled() }; })(PostPublishPanelPrepublish)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/postpublish.js /** * External Dependencies */ /** * WordPress Dependencies */ /** * Internal dependencies */ var postpublish_PostPublishPanelPostpublish = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(PostPublishPanelPostpublish, _Component); 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.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.postLink = Object(external_this_wp_element_["createRef"])(); return _this; } Object(createClass["a" /* default */])(PostPublishPanelPostpublish, [{ key: "componentDidMount", value: function componentDidMount() { if (this.props.focusOnMount) { this.postLink.current.focus(); } } }, { key: "componentWillUnmount", value: function componentWillUnmount() { clearTimeout(this.dismissCopyConfirmation); } }, { key: "onCopy", value: function onCopy() { var _this2 = this; this.setState({ showCopyConfirmation: true }); clearTimeout(this.dismissCopyConfirmation); this.dismissCopyConfirmation = setTimeout(function () { _this2.setState({ showCopyConfirmation: false }); }, 4000); } }, { key: "onSelectInput", value: function onSelectInput(event) { event.target.select(); } }, { key: "render", value: function render() { var _this$props = this.props, children = _this$props.children, 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.'); 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", { 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", readOnly: true, label: Object(external_this_wp_i18n_["sprintf"])( /* translators: %s: post type singular name */ Object(external_this_wp_i18n_["__"])('%s address'), postLabel), value: post.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 }, viewPostLabel), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ClipboardButton"], { isDefault: true, text: post.link, onCopy: this.onCopy }, this.state.showCopyConfirmation ? Object(external_this_wp_i18n_["__"])('Copied!') : Object(external_this_wp_i18n_["__"])('Copy Link')))), children); } }]); return PostPublishPanelPostpublish; }(external_this_wp_element_["Component"]); /* harmony default export */ var postpublish = (Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getEditedPostAttribute = _select.getEditedPostAttribute, getCurrentPost = _select.getCurrentPost, isCurrentPostScheduled = _select.isCurrentPostScheduled; var _select2 = select('core'), getPostType = _select2.getPostType; return { post: getCurrentPost(), postType: getPostType(getEditedPostAttribute('type')), isScheduled: isCurrentPostScheduled() }; })(postpublish_PostPublishPanelPostpublish)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal Dependencies */ var post_publish_panel_PostPublishPanel = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(PostPublishPanel, _Component); 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))); return _this; } Object(createClass["a" /* default */])(PostPublishPanel, [{ key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { // Automatically collapse the publish sidebar when a post // is published and the user makes an edit. if (prevProps.isPublished && !this.props.isSaving && this.props.isDirty) { this.props.onClose(); } } }, { key: "onSubmit", value: function onSubmit() { var _this$props = this.props, onClose = _this$props.onClose, hasPublishAction = _this$props.hasPublishAction, isPostTypeViewable = _this$props.isPostTypeViewable; if (!hasPublishAction || !isPostTypeViewable) { onClose(); } } }, { key: "render", value: function render() { var _this$props2 = this.props, forceIsDirty = _this$props2.forceIsDirty, forceIsSaving = _this$props2.forceIsSaving, isBeingScheduled = _this$props2.isBeingScheduled, isPublished = _this$props2.isPublished, isPublishSidebarEnabled = _this$props2.isPublishSidebarEnabled, isScheduled = _this$props2.isScheduled, isSaving = _this$props2.isSaving, onClose = _this$props2.onClose, onTogglePublishSidebar = _this$props2.onTogglePublishSidebar, PostPublishExtension = _this$props2.PostPublishExtension, 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 isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled; var isPrePublish = !isPublishedOrScheduled && !isSaving; var isPostPublish = isPublishedOrScheduled && !isSaving; return Object(external_this_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ 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", { 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, onClick: onClose, icon: "no-alt", label: Object(external_this_wp_i18n_["__"])('Close panel') })), 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 }, PostPublishExtension && Object(external_this_wp_element_["createElement"])(PostPublishExtension, null)), isSaving && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Spinner"], null)), Object(external_this_wp_element_["createElement"])("div", { className: "editor-post-publish-panel__footer" }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], { label: Object(external_this_wp_i18n_["__"])('Always show pre-publish checks.'), checked: isPublishSidebarEnabled, onChange: onTogglePublishSidebar }))); } }]); return PostPublishPanel; }(external_this_wp_element_["Component"]); /* harmony default export */ var post_publish_panel = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core'), getPostType = _select.getPostType; var _select2 = select('core/editor'), getCurrentPost = _select2.getCurrentPost, getEditedPostAttribute = _select2.getEditedPostAttribute, isCurrentPostPublished = _select2.isCurrentPostPublished, isCurrentPostScheduled = _select2.isCurrentPostScheduled, isEditedPostBeingScheduled = _select2.isEditedPostBeingScheduled, isEditedPostDirty = _select2.isEditedPostDirty, isSavingPost = _select2.isSavingPost; var _select3 = select('core/editor'), isPublishSidebarEnabled = _select3.isPublishSidebarEnabled; 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), isBeingScheduled: isEditedPostBeingScheduled(), isDirty: isEditedPostDirty(), isPublished: isCurrentPostPublished(), isPublishSidebarEnabled: isPublishSidebarEnabled(), isSaving: isSavingPost(), isScheduled: isCurrentPostScheduled() }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref) { var isPublishSidebarEnabled = _ref.isPublishSidebarEnabled; var _dispatch = dispatch('core/editor'), disablePublishSidebar = _dispatch.disablePublishSidebar, enablePublishSidebar = _dispatch.enablePublishSidebar; return { onTogglePublishSidebar: function onTogglePublishSidebar() { if (isPublishSidebarEnabled) { disablePublishSidebar(); } else { enablePublishSidebar(); } } }; }), external_this_wp_components_["withFocusReturn"], external_this_wp_components_["withConstrainedTabbing"]])(post_publish_panel_PostPublishPanel)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-switch-to-draft-button/index.js /** * WordPress dependencies */ function PostSwitchToDraftButton(_ref) { var isSaving = _ref.isSaving, isPublished = _ref.isPublished, isScheduled = _ref.isScheduled, onClick = _ref.onClick; if (!isPublished && !isScheduled) { return null; } var onSwitch = function onSwitch() { var alertMessage; if (isPublished) { alertMessage = Object(external_this_wp_i18n_["__"])('Are you sure you want to unpublish this post?'); } else if (isScheduled) { alertMessage = Object(external_this_wp_i18n_["__"])('Are you sure you want to unschedule this post?'); } // eslint-disable-next-line no-alert if (window.confirm(alertMessage)) { onClick(); } }; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { className: "editor-post-switch-to-draft", onClick: onSwitch, disabled: isSaving, isTertiary: true }, 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) { var _select = select('core/editor'), isSavingPost = _select.isSavingPost, isCurrentPostPublished = _select.isCurrentPostPublished, isCurrentPostScheduled = _select.isCurrentPostScheduled; return { isSaving: isSavingPost(), isPublished: isCurrentPostPublished(), isScheduled: isCurrentPostScheduled() }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { var _dispatch = dispatch('core/editor'), editPost = _dispatch.editPost, savePost = _dispatch.savePost; return { onClick: function onClick() { editPost({ status: 'draft' }); savePost(); } }; })])(PostSwitchToDraftButton)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-saved-state/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Component showing whether the post is saved or not and displaying save links. * * @param {Object} Props Component Props. */ var post_saved_state_PostSavedState = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(PostSavedState, _Component); 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.state = { forceSavedMessage: false }; return _this; } Object(createClass["a" /* default */])(PostSavedState, [{ key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { var _this2 = this; if (prevProps.isSaving && !this.props.isSaving) { this.setState({ forceSavedMessage: true }); this.props.setTimeout(function () { _this2.setState({ forceSavedMessage: false }); }, 1000); } } }, { key: "render", value: function render() { var _this$props = this.props, post = _this$props.post, isNew = _this$props.isNew, isScheduled = _this$props.isScheduled, isPublished = _this$props.isPublished, isDirty = _this$props.isDirty, isSaving = _this$props.isSaving, isSaveable = _this$props.isSaveable, onSave = _this$props.onSave, isAutosaving = _this$props.isAutosaving, isPending = _this$props.isPending, isLargeViewport = _this$props.isLargeViewport; var forceSavedMessage = this.state.forceSavedMessage; if (isSaving) { // TODO: Classes generation should be common across all return // paths of this function, including proper naming convention for // the "Save Draft" button. 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')); } if (isPublished || isScheduled) { return Object(external_this_wp_element_["createElement"])(post_switch_to_draft_button, null); } if (!isSaveable) { return null; } 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_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'); if (!isLargeViewport) { return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { className: "editor-post-save-draft", label: label, onClick: onSave, shortcut: external_this_wp_keycodes_["displayShortcut"].primary('s'), icon: "cloud-upload" }); } return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { className: "editor-post-save-draft", onClick: onSave, shortcut: external_this_wp_keycodes_["displayShortcut"].primary('s'), isTertiary: true }, label); } }]); 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; var _select = select('core/editor'), isEditedPostNew = _select.isEditedPostNew, isCurrentPostPublished = _select.isCurrentPostPublished, isCurrentPostScheduled = _select.isCurrentPostScheduled, isEditedPostDirty = _select.isEditedPostDirty, isSavingPost = _select.isSavingPost, isEditedPostSaveable = _select.isEditedPostSaveable, getCurrentPost = _select.getCurrentPost, isAutosavingPost = _select.isAutosavingPost, getEditedPostAttribute = _select.getEditedPostAttribute; return { post: getCurrentPost(), isNew: isEditedPostNew(), isPublished: isCurrentPostPublished(), isScheduled: isCurrentPostScheduled(), isDirty: forceIsDirty || isEditedPostDirty(), isSaving: forceIsSaving || isSavingPost(), isSaveable: isEditedPostSaveable(), isAutosaving: isAutosavingPost(), isPending: 'pending' === getEditedPostAttribute('status') }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { return { onSave: dispatch('core/editor').savePost }; }), external_this_wp_compose_["withSafeTimeout"], Object(external_this_wp_viewport_["withViewportMatch"])({ isLargeViewport: 'medium' })])(post_saved_state_PostSavedState)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/check.js /** * External dependencies */ /** * WordPress dependencies */ function PostScheduleCheck(_ref) { var hasPublishAction = _ref.hasPublishAction, children = _ref.children; if (!hasPublishAction) { return null; } return children; } /* harmony default export */ var post_schedule_check = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getCurrentPost = _select.getCurrentPost, getCurrentPostType = _select.getCurrentPostType; return { hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), postType: getCurrentPostType() }; })])(PostScheduleCheck)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/check.js /** * External dependencies */ /** * WordPress dependencies */ function PostStickyCheck(_ref) { var hasStickyAction = _ref.hasStickyAction, postType = _ref.postType, children = _ref.children; if (postType !== 'post' || !hasStickyAction) { return null; } return children; } /* 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), postType: select('core/editor').getCurrentPostType() }; })])(PostStickyCheck)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function PostSticky(_ref) { var onUpdateSticky = _ref.onUpdateSticky, _ref$postSticky = _ref.postSticky, postSticky = _ref$postSticky === void 0 ? false : _ref$postSticky; return Object(external_this_wp_element_["createElement"])(post_sticky_check, null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CheckboxControl"], { label: Object(external_this_wp_i18n_["__"])('Stick to the Front Page'), checked: postSticky, onChange: function onChange() { return onUpdateSticky(!postSticky); } })); } /* harmony default export */ var post_sticky = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { return { postSticky: select('core/editor').getEditedPostAttribute('sticky') }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { return { onUpdateSticky: function onUpdateSticky(postSticky) { dispatch('core/editor').editPost({ sticky: postSticky }); } }; })])(PostSticky)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/hierarchical-term-selector.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Module Constants */ var hierarchical_term_selector_DEFAULT_QUERY = { per_page: -1, orderby: 'name', order: 'asc', _fields: 'id,name,parent' }; var MIN_TERMS_COUNT_FOR_FILTER = 8; var hierarchical_term_selector_HierarchicalTermSelector = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(HierarchicalTermSelector, _Component); 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.state = { loading: true, availableTermsTree: [], availableTerms: [], adding: false, formName: '', formParent: '', showForm: false, filterValue: '', filteredTermsTree: [] }; return _this; } Object(createClass["a" /* default */])(HierarchicalTermSelector, [{ key: "onChange", value: function onChange(event) { 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) : Object(toConsumableArray["a" /* default */])(terms).concat([termId]); onUpdateTerms(newTerms, taxonomy.rest_base); } }, { key: "onChangeFormName", value: function onChangeFormName(event) { var newValue = event.target.value.trim() === '' ? '' : event.target.value; this.setState({ formName: newValue }); } }, { key: "onChangeFormParent", value: function onChangeFormParent(newParent) { this.setState({ formParent: newParent }); } }, { key: "onToggleForm", value: function onToggleForm() { this.setState(function (state) { return { showForm: !state.showForm }; }); } }, { key: "findTerm", value: function findTerm(terms, parent, name) { return Object(external_lodash_["find"])(terms, function (term) { return (!term.parent && !parent || parseInt(term.parent) === parseInt(parent)) && term.name.toLowerCase() === name.toLowerCase(); }); } }, { key: "onAddTerm", value: function onAddTerm(event) { var _this2 = this; event.preventDefault(); var _this$props2 = this.props, onUpdateTerms = _this$props2.onUpdateTerms, taxonomy = _this$props2.taxonomy, terms = _this$props2.terms, slug = _this$props2.slug; var _this$state = this.state, formName = _this$state.formName, formParent = _this$state.formParent, adding = _this$state.adding, availableTerms = _this$state.availableTerms; if (formName === '' || adding) { return; } // check if the term we are adding already exists var existingTerm = this.findTerm(availableTerms, formParent, formName); if (existingTerm) { // if the term we are adding exists but is not selected select it if (!Object(external_lodash_["some"])(terms, function (term) { return term === existingTerm.id; })) { onUpdateTerms(Object(toConsumableArray["a" /* default */])(terms).concat([existingTerm.id]), taxonomy.rest_base); } this.setState({ formName: '', formParent: '' }); return; } this.setState({ adding: true }); this.addRequest = external_this_wp_apiFetch_default()({ path: "/core/".concat(taxonomy.rest_base), method: 'POST', data: { name: formName, parent: formParent ? formParent : undefined } }); // Tries to create a term or fetch it if it already exists var findOrCreatePromise = this.addRequest.catch(function (error) { var errorCode = error.code; 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"])("/core/".concat(taxonomy.rest_base), Object(objectSpread["a" /* default */])({}, hierarchical_term_selector_DEFAULT_QUERY, { parent: formParent || 0, search: formName })) }); return _this2.addRequest.then(function (searchResult) { return _this2.findTerm(searchResult, formParent, formName); }); } return Promise.reject(error); }); findOrCreatePromise.then(function (term) { var hasTerm = !!Object(external_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'))); _this2.props.speak(termAddedMessage, 'assertive'); _this2.addRequest = null; _this2.setState({ adding: false, formName: '', formParent: '', availableTerms: newAvailableTerms, availableTermsTree: _this2.sortBySelected(buildTermsTree(newAvailableTerms)) }); onUpdateTerms(Object(toConsumableArray["a" /* default */])(terms).concat([term.id]), taxonomy.rest_base); }, function (xhr) { if (xhr.statusText === 'abort') { return; } _this2.addRequest = null; _this2.setState({ adding: false }); }); } }, { key: "componentDidMount", value: function componentDidMount() { this.fetchTerms(); } }, { key: "componentWillUnmount", value: function componentWillUnmount() { Object(external_lodash_["invoke"])(this.fetchRequest, ['abort']); Object(external_lodash_["invoke"])(this.addRequest, ['abort']); } }, { key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { if (this.props.taxonomy !== prevProps.taxonomy) { this.fetchTerms(); } } }, { key: "fetchTerms", value: function fetchTerms() { var _this3 = this; var taxonomy = this.props.taxonomy; if (!taxonomy) { return; } this.fetchRequest = external_this_wp_apiFetch_default()({ path: Object(external_this_wp_url_["addQueryArgs"])("/core/".concat(taxonomy.rest_base), hierarchical_term_selector_DEFAULT_QUERY) }); this.fetchRequest.then(function (terms) { // resolve var availableTermsTree = _this3.sortBySelected(buildTermsTree(terms)); _this3.fetchRequest = null; _this3.setState({ loading: false, availableTermsTree: availableTermsTree, availableTerms: terms }); }, function (xhr) { // reject if (xhr.statusText === 'abort') { return; } _this3.fetchRequest = null; _this3.setState({ loading: false }); }); } }, { key: "sortBySelected", value: function sortBySelected(termsTree) { var terms = this.props.terms; var treeHasSelection = function treeHasSelection(termTree) { if (terms.indexOf(termTree.id) !== -1) { return true; } if (undefined === termTree.children) { return false; } var anyChildIsSelected = termTree.children.map(treeHasSelection).filter(function (child) { return child; }).length > 0; if (anyChildIsSelected) { return true; } return false; }; var termOrChildIsSelected = function termOrChildIsSelected(termA, termB) { var termASelected = treeHasSelection(termA); var termBSelected = treeHasSelection(termB); if (termASelected === termBSelected) { return 0; } if (termASelected && !termBSelected) { return -1; } if (!termASelected && termBSelected) { return 1; } return 0; }; termsTree.sort(termOrChildIsSelected); return termsTree; } }, { key: "setFilterValue", value: function setFilterValue(event) { var availableTermsTree = this.state.availableTermsTree; var filterValue = event.target.value; var filteredTermsTree = availableTermsTree.map(this.getFilterMatcher(filterValue)).filter(function (term) { return term; }); var getResultCount = function getResultCount(terms) { var count = 0; for (var i = 0; i < terms.length; i++) { count++; if (undefined !== terms[i].children) { count += getResultCount(terms[i].children); } } return count; }; this.setState({ filterValue: filterValue, 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); this.props.debouncedSpeak(resultsFoundMessage, 'assertive'); } }, { key: "getFilterMatcher", value: function getFilterMatcher(filterValue) { var matchTermsForFilter = function matchTermsForFilter(originalTerm) { if ('' === filterValue) { return originalTerm; } // Shallow clone, because we'll be filtering the term's children and // 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 // and any deeper levels. if (term.children.length > 0) { term.children = term.children.map(matchTermsForFilter).filter(function (child) { return child; }); } // If the term's name contains the filterValue, or it has children // (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) { return term; } // Otherwise, return false. After mapping, the list of terms will need // to have false values filtered out. return false; }; return matchTermsForFilter; } }, { key: "renderTerms", value: function renderTerms(renderedTerms) { var _this4 = this; 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", 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", { className: "editor-post-taxonomies__hierarchical-terms-subchoices" }, _this4.renderTerms(term.children))); }); } }, { key: "render", value: function render() { var _this$props3 = this.props, slug = _this$props3.slug, taxonomy = _this$props3.taxonomy, instanceId = _this$props3.instanceId, hasCreateAction = _this$props3.hasCreateAction, hasAssignAction = _this$props3.hasAssignAction; if (!hasAssignAction) { return null; } var _this$state2 = this.state, availableTermsTree = _this$state2.availableTermsTree, availableTerms = _this$state2.availableTerms, filteredTermsTree = _this$state2.filteredTermsTree, formName = _this$state2.formName, formParent = _this$state2.formParent, loading = _this$state2.loading, showForm = _this$state2.showForm, filterValue = _this$state2.filterValue; var labelWithFallback = function labelWithFallback(labelProperty, fallbackIsCategory, fallbackIsNotCategory) { return Object(external_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')); var newTermLabel = labelWithFallback('new_item_name', Object(external_this_wp_i18n_["__"])('Add new category'), Object(external_this_wp_i18n_["__"])('Add new term')); var parentSelectLabel = labelWithFallback('parent_item', Object(external_this_wp_i18n_["__"])('Parent Category'), Object(external_this_wp_i18n_["__"])('Parent Term')); var noParentOption = "\u2014 ".concat(parentSelectLabel, " \u2014"); 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_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_x"])('Search %s', 'term'), Object(external_lodash_["get"])(this.props.taxonomy, ['name'], slug === 'category' ? Object(external_this_wp_i18n_["__"])('Categories') : Object(external_this_wp_i18n_["__"])('Terms'))); var groupLabel = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_x"])('Available %s', 'term'), Object(external_lodash_["get"])(this.props.taxonomy, ['name'], slug === 'category' ? Object(external_this_wp_i18n_["__"])('Categories') : 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", htmlFor: filterInputId }, filterLabel), showFilter && Object(external_this_wp_element_["createElement"])("input", { type: "search", id: filterInputId, value: filterValue, onChange: this.setFilterValue, className: "editor-post-taxonomies__hierarchical-terms-filter", key: "term-filter-input" }), Object(external_this_wp_element_["createElement"])("div", { className: "editor-post-taxonomies__hierarchical-terms-list", key: "term-list", tabIndex: "0", role: "group", "aria-label": groupLabel }, this.renderTerms('' !== filterValue ? filteredTermsTree : availableTermsTree)), !loading && hasCreateAction && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { key: "term-add-button", onClick: this.onToggleForm, className: "editor-post-taxonomies__hierarchical-terms-add", "aria-expanded": showForm, isLink: true }, newTermButtonLabel), showForm && Object(external_this_wp_element_["createElement"])("form", { onSubmit: this.onAddTerm, key: "hierarchical-terms-form" }, Object(external_this_wp_element_["createElement"])("label", { htmlFor: inputId, className: "editor-post-taxonomies__hierarchical-terms-label" }, newTermLabel), Object(external_this_wp_element_["createElement"])("input", { type: "text", id: inputId, className: "editor-post-taxonomies__hierarchical-terms-input", value: formName, onChange: this.onChangeFormName, required: true }), !!availableTerms.length && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TreeSelect"], { label: parentSelectLabel, noOptionLabel: noParentOption, onChange: this.onChangeFormParent, selectedId: formParent, tree: availableTermsTree }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { isDefault: true, type: "submit", className: "editor-post-taxonomies__hierarchical-terms-submit" }, newTermSubmitLabel))]; /* eslint-enable jsx-a11y/no-onchange */ } }]); return HierarchicalTermSelector; }(external_this_wp_element_["Component"]); /* harmony default export */ var hierarchical_term_selector = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref) { var slug = _ref.slug; var _select = select('core/editor'), getCurrentPost = _select.getCurrentPost; var _select2 = select('core'), getTaxonomy = _select2.getTaxonomy; 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, terms: taxonomy ? select('core/editor').getEditedPostAttribute(taxonomy.rest_base) : [], taxonomy: taxonomy }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { return { onUpdateTerms: function onUpdateTerms(terms, restBase) { dispatch('core/editor').editPost(Object(defineProperty["a" /* default */])({}, restBase, terms)); } }; }), external_this_wp_components_["withSpokenMessages"], external_this_wp_compose_["withInstanceId"], Object(external_this_wp_components_["withFilters"])('editor.PostTaxonomyType')])(hierarchical_term_selector_HierarchicalTermSelector)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/index.js /** * External Dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function PostTaxonomies(_ref) { 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); }); var visibleTaxonomies = Object(external_lodash_["filter"])(availableTaxonomies, function (taxonomy) { return taxonomy.visibility.show_ui; }); return visibleTaxonomies.map(function (taxonomy) { var TaxonomyComponent = taxonomy.hierarchical ? hierarchical_term_selector : flat_term_selector; return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], { key: "taxonomy-".concat(taxonomy.slug) }, taxonomyWrapper(Object(external_this_wp_element_["createElement"])(TaxonomyComponent, { slug: taxonomy.slug }), taxonomy)); }); } /* harmony default export */ var post_taxonomies = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { return { postType: select('core/editor').getCurrentPostType(), taxonomies: select('core').getTaxonomies({ per_page: -1 }) }; })])(PostTaxonomies)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/check.js /** * External Dependencies */ /** * WordPress dependencies */ function PostTaxonomiesCheck(_ref) { 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); }); if (!hasTaxonomies) { return null; } return children; } /* harmony default export */ var post_taxonomies_check = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { return { postType: select('core/editor').getCurrentPostType(), taxonomies: select('core').getTaxonomies({ per_page: -1 }) }; })])(PostTaxonomiesCheck)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-text-editor/index.js /** * External dependencies */ /** * WordPress dependencies */ var post_text_editor_PostTextEditor = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(PostTextEditor, _Component); 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.state = {}; return _this; } Object(createClass["a" /* default */])(PostTextEditor, [{ key: "edit", /** * Handles a textarea change event to notify the onChange prop callback and * reflect the new value in the component's own state. This marks the start * of the user's edits, if not already changed, preventing future props * changes to value from replacing the rendered value. This is expected to * be followed by a reset to dirty state via `stopEditing`. * * @see stopEditing * * @param {Event} event Change event. */ value: function edit(event) { var value = event.target.value; this.props.onChange(value); this.setState({ value: value, isDirty: true }); } /** * Function called when the user has completed their edits, responsible for * ensuring that changes, if made, are surfaced to the onPersist prop * callback and resetting dirty state. */ }, { key: "stopEditing", value: function stopEditing() { if (this.state.isDirty) { this.props.onPersist(this.state.value); this.setState({ isDirty: false }); } } }, { key: "render", 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, { autoComplete: "off", dir: "auto", value: value, onChange: this.edit, onBlur: this.stopEditing, className: "editor-post-text-editor", id: "post-content-".concat(instanceId), placeholder: Object(external_this_wp_i18n_["__"])('Start writing with text or HTML') })); } }], [{ key: "getDerivedStateFromProps", value: function getDerivedStateFromProps(props, state) { if (state.isDirty) { return null; } return { value: props.value, isDirty: false }; } }]); return PostTextEditor; }(external_this_wp_element_["Component"]); /* harmony default export */ var post_text_editor = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getEditedPostContent = _select.getEditedPostContent; return { value: getEditedPostContent() }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { var _dispatch = dispatch('core/editor'), editPost = _dispatch.editPost, resetBlocks = _dispatch.resetBlocks; return { onChange: function onChange(content) { editPost({ content: content }); }, onPersist: function onPersist(content) { resetBlocks(Object(external_this_wp_blocks_["parse"])(content)); } }; }), external_this_wp_compose_["withInstanceId"]])(post_text_editor_PostTextEditor)); // 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 /** * External dependencies */ /** * WordPress dependencies */ /** * 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 = 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 */ /** * Internal dependencies */ /** * Constants */ var REGEXP_NEWLINES = /[\r\n]+/g; var post_title_PostTitle = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(PostTitle, _Component); 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.state = { isSelected: false }; return _this; } Object(createClass["a" /* default */])(PostTitle, [{ key: "handleFocusOutside", value: function handleFocusOutside() { this.onUnselect(); } }, { key: "onSelect", value: function onSelect() { this.setState({ isSelected: true }); this.props.clearSelectedBlock(); } }, { key: "onUnselect", value: function onUnselect() { this.setState({ isSelected: false }); } }, { key: "onChange", value: function onChange(event) { var newTitle = event.target.value.replace(REGEXP_NEWLINES, ' '); this.props.onUpdate(newTitle); } }, { key: "onKeyDown", value: function onKeyDown(event) { if (event.keyCode === external_this_wp_keycodes_["ENTER"]) { event.preventDefault(); 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: "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 isSelected = this.state.isSelected; // The wp-block className is important for editor styles. var className = classnames_default()('wp-block editor-post-title__block', { 'is-selected': isSelected, 'is-focus-mode': isFocusMode, 'has-fixed-toolbar': hasFixedToolbar }); var decodedPlaceholder = Object(external_this_wp_htmlEntities_["decodeEntities"])(placeholder); 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, { 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, onKeyDown: this.onKeyDown, onKeyPress: this.onUnselect /* Only autofocus the title when the post is entirely empty. This should only happen for a new post, which means we focus the title on new post so the author can start typing right away, without needing to click anything. */ /* eslint-disable jsx-a11y/no-autofocus */ , autoFocus: isCleanNewPost /* eslint-enable jsx-a11y/no-autofocus */ })), isSelected && isPostTypeViewable && Object(external_this_wp_element_["createElement"])(post_permalink, null)))); } }]); return PostTitle; }(external_this_wp_element_["Component"]); var post_title_applyWithSelect = Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getEditedPostAttribute = _select.getEditedPostAttribute, getEditorSettings = _select.getEditorSettings, isCleanNewPost = _select.isCleanNewPost; var _select2 = select('core'), getPostType = _select2.getPostType; var postType = getPostType(getEditedPostAttribute('type')); var _getEditorSettings = getEditorSettings(), titlePlaceholder = _getEditorSettings.titlePlaceholder, focusMode = _getEditorSettings.focusMode, hasFixedToolbar = _getEditorSettings.hasFixedToolbar; return { isCleanNewPost: isCleanNewPost(), title: getEditedPostAttribute('title'), isPostTypeViewable: Object(external_lodash_["get"])(postType, ['viewable'], false), placeholder: titlePlaceholder, isFocusMode: focusMode, hasFixedToolbar: hasFixedToolbar }; }); var post_title_applyWithDispatch = Object(external_this_wp_data_["withDispatch"])(function (dispatch) { var _dispatch = dispatch('core/editor'), insertDefaultBlock = _dispatch.insertDefaultBlock, editPost = _dispatch.editPost, clearSelectedBlock = _dispatch.clearSelectedBlock, undo = _dispatch.undo, redo = _dispatch.redo; return { onEnterPress: function onEnterPress() { insertDefaultBlock(undefined, undefined, 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)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/index.js /** * WordPress dependencies */ function PostTrash(_ref) { var isNew = _ref.isNew, postId = _ref.postId, postType = _ref.postType, props = Object(objectWithoutProperties["a" /* default */])(_ref, ["isNew", "postId", "postType"]); if (isNew || !postId) { return null; } var onClick = function onClick() { return props.trashPost(postId, postType); }; 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 }, Object(external_this_wp_i18n_["__"])('Move to trash')); } /* harmony default export */ var post_trash = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), isEditedPostNew = _select.isEditedPostNew, getCurrentPostId = _select.getCurrentPostId, getCurrentPostType = _select.getCurrentPostType; return { isNew: isEditedPostNew(), postId: getCurrentPostId(), postType: getCurrentPostType() }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { return { trashPost: dispatch('core/editor').trashPost }; })])(PostTrash)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/check.js /** * WordPress dependencies */ function PostTrashCheck(_ref) { var isNew = _ref.isNew, postId = _ref.postId, children = _ref.children; if (isNew || !postId) { return null; } return children; } /* 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; return { isNew: isEditedPostNew(), postId: getCurrentPostId() }; })(PostTrashCheck)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/check.js /** * External dependencies */ /** * WordPress dependencies */ function PostVisibilityCheck(_ref) { var hasPublishAction = _ref.hasPublishAction, render = _ref.render; var canEdit = hasPublishAction; return render({ canEdit: canEdit }); } /* harmony default export */ var post_visibility_check = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getCurrentPost = _select.getCurrentPost, getCurrentPostType = _select.getCurrentPostType; return { hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), postType: getCurrentPostType() }; })])(PostVisibilityCheck)); // EXTERNAL MODULE: external {"this":["wp","wordcount"]} var external_this_wp_wordcount_ = __webpack_require__(97); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/word-count/index.js /** * WordPress dependencies */ function WordCount(_ref) { var content = _ref.content; /* * translators: If your word count is based on single characters (e.g. East Asian characters), * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'. * Do not translate into your own language. */ var wordCountType = Object(external_this_wp_i18n_["_x"])('words', 'Word count type. Do not translate!'); return Object(external_this_wp_element_["createElement"])("span", { className: "word-count" }, Object(external_this_wp_wordcount_["count"])(content, wordCountType)); } /* harmony default export */ var word_count = (Object(external_this_wp_data_["withSelect"])(function (select) { return { content: select('core/editor').getEditedPostAttribute('content') }; })(WordCount)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/panel.js /** * WordPress dependencies */ /** * Internal dependencies */ function TableOfContentsPanel(_ref) { var headingCount = _ref.headingCount, paragraphCount = _ref.paragraphCount, numberOfBlocks = _ref.numberOfBlocks; 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, null))); } /* harmony default export */ var table_of_contents_panel = (Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getGlobalBlockCount = _select.getGlobalBlockCount; return { headingCount: getGlobalBlockCount('core/heading'), paragraphCount: getGlobalBlockCount('core/paragraph'), numberOfBlocks: getGlobalBlockCount() }; })(TableOfContentsPanel)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/index.js /** * WordPress dependencies */ /** * Internal dependencies */ function TableOfContents(_ref) { var hasBlocks = _ref.hasBlocks; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Dropdown"], { position: "bottom", className: "table-of-contents", contentClassName: "table-of-contents__popover", renderToggle: function renderToggle(_ref2) { var isOpen = _ref2.isOpen, onToggle = _ref2.onToggle; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { onClick: hasBlocks ? onToggle : undefined, icon: "info-outline", "aria-expanded": isOpen, label: Object(external_this_wp_i18n_["__"])('Content structure'), labelPosition: "bottom", "aria-disabled": !hasBlocks }); }, renderContent: function renderContent() { return Object(external_this_wp_element_["createElement"])(table_of_contents_panel, null); } }); } /* harmony default export */ var table_of_contents = (Object(external_this_wp_data_["withSelect"])(function (select) { return { hasBlocks: !!select('core/editor').getBlockCount() }; })(TableOfContents)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/unsaved-changes-warning/index.js /** * WordPress dependencies */ var unsaved_changes_warning_UnsavedChangesWarning = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(UnsavedChangesWarning, _Component); 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))); return _this; } Object(createClass["a" /* default */])(UnsavedChangesWarning, [{ key: "componentDidMount", value: function componentDidMount() { window.addEventListener('beforeunload', this.warnIfUnsavedChanges); } }, { key: "componentWillUnmount", value: function componentWillUnmount() { window.removeEventListener('beforeunload', this.warnIfUnsavedChanges); } /** * Warns the user if there are unsaved changes before leaving the editor. * * @param {Event} event `beforeunload` event. * * @return {?string} Warning prompt message, if unsaved changes exist. */ }, { key: "warnIfUnsavedChanges", value: function warnIfUnsavedChanges(event) { var isDirty = this.props.isDirty; if (isDirty) { event.returnValue = Object(external_this_wp_i18n_["__"])('You have unsaved changes. If you proceed, they will be lost.'); return event.returnValue; } } }, { key: "render", value: function render() { return null; } }]); return UnsavedChangesWarning; }(external_this_wp_element_["Component"]); /* harmony default export */ var unsaved_changes_warning = (Object(external_this_wp_data_["withSelect"])(function (select) { return { isDirty: select('core/editor').isEditedPostDirty() }; })(unsaved_changes_warning_UnsavedChangesWarning)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/skip-to-selected-block/index.js /** * WordPress dependencies */ /** * Internal Dependencies */ var skip_to_selected_block_SkipToSelectedBlock = function SkipToSelectedBlock(_ref) { var selectedBlockClientId = _ref.selectedBlockClientId; var onClick = function onClick() { var selectedBlockElement = getBlockFocusableWrapper(selectedBlockClientId); selectedBlockElement.focus(); }; return selectedBlockClientId && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { isDefault: true, type: "button", className: "editor-skip-to-selected-block", onClick: onClick }, Object(external_this_wp_i18n_["__"])('Skip to the selected block')); }; /* harmony default export */ var skip_to_selected_block = (Object(external_this_wp_data_["withSelect"])(function (select) { return { selectedBlockClientId: select('core/editor').getBlockSelectionStart() }; })(skip_to_selected_block_SkipToSelectedBlock)); // EXTERNAL MODULE: external {"this":["wp","tokenList"]} var external_this_wp_tokenList_ = __webpack_require__(124); var external_this_wp_tokenList_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_tokenList_); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-styles/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Returns the active style from the given className. * * @param {Array} styles Block style variations. * @param {string} className Class name * * @return {Object?} The active style. */ function getActiveStyle(styles, className) { var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = new external_this_wp_tokenList_default.a(className).values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var style = _step.value; if (style.indexOf('is-style-') === -1) { continue; } var potentialStyleName = style.substring(9); var activeStyle = Object(external_lodash_["find"])(styles, { name: potentialStyleName }); if (activeStyle) { return activeStyle; } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return != null) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return Object(external_lodash_["find"])(styles, 'isDefault'); } /** * Replaces the active style in the block's className. * * @param {string} className Class name. * @param {Object?} activeStyle The replaced style. * @param {Object} newStyle The replacing style. * * @return {string} The updated className. */ function replaceActiveStyle(className, activeStyle, newStyle) { var list = new external_this_wp_tokenList_default.a(className); if (activeStyle) { list.remove('is-style-' + activeStyle.name); } list.add('is-style-' + newStyle.name); return list.value; } function BlockStyles(_ref) { var styles = _ref.styles, className = _ref.className, onChangeClassName = _ref.onChangeClassName, name = _ref.name, attributes = _ref.attributes, _ref$onSwitch = _ref.onSwitch, onSwitch = _ref$onSwitch === void 0 ? external_lodash_["noop"] : _ref$onSwitch, _ref$onHoverClassName = _ref.onHoverClassName, onHoverClassName = _ref$onHoverClassName === void 0 ? external_lodash_["noop"] : _ref$onHoverClassName; if (!styles || styles.length === 0) { return null; } var activeStyle = getActiveStyle(styles, className); function updateClassName(style) { var updatedClassName = replaceActiveStyle(className, activeStyle, style); onChangeClassName(updatedClassName); onSwitch(); } return Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-styles" }, styles.map(function (style) { var styleClassName = replaceActiveStyle(className, activeStyle, style); return Object(external_this_wp_element_["createElement"])("div", { key: style.name, className: classnames_default()('editor-block-styles__item', { 'is-active': activeStyle === style }), onClick: function onClick() { return updateClassName(style); }, onKeyDown: function onKeyDown(event) { if (external_this_wp_keycodes_["ENTER"] === event.keyCode || external_this_wp_keycodes_["SPACE"] === event.keyCode) { event.preventDefault(); updateClassName(style); } }, onMouseEnter: function onMouseEnter() { return onHoverClassName(styleClassName); }, onMouseLeave: function onMouseLeave() { return onHoverClassName(null); }, role: "button", tabIndex: "0", "aria-label": style.label || style.name }, Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-styles__item-preview" }, Object(external_this_wp_element_["createElement"])(BlockPreviewContent, { name: name, attributes: Object(objectSpread["a" /* default */])({}, attributes, { className: styleClassName }) })), Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-styles__item-label" }, style.label || style.name)); })); } /* harmony default export */ var block_styles = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref2) { var clientId = _ref2.clientId; var _select = select('core/editor'), getBlock = _select.getBlock; var _select2 = select('core/blocks'), getBlockStyles = _select2.getBlockStyles; var block = getBlock(clientId); return { name: block.name, attributes: block.attributes, className: block.attributes.className || '', styles: getBlockStyles(block.name) }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref3) { var clientId = _ref3.clientId; return { onChangeClassName: function onChangeClassName(newClassName) { dispatch('core/editor').updateBlockAttributes(clientId, { className: newClassName }); } }; })])(BlockStyles)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/multi-selection-inspector/index.js /** * WordPress dependencies */ /** * Internal Dependencies */ function MultiSelectionInspector(_ref) { var blocks = _ref.blocks; var words = Object(external_this_wp_wordcount_["count"])(Object(external_this_wp_blocks_["serialize"])(blocks), 'words'); return Object(external_this_wp_element_["createElement"])("div", { className: "editor-multi-selection-inspector__card" }, Object(external_this_wp_element_["createElement"])(BlockIcon, { icon: Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { d: "M3 5H1v16c0 1.1.9 2 2 2h16v-2H3V5zm18-4H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 16H7V3h14v14z" })), showColors: true }), Object(external_this_wp_element_["createElement"])("div", { className: "editor-multi-selection-inspector__card-content" }, Object(external_this_wp_element_["createElement"])("div", { className: "editor-multi-selection-inspector__card-title" }, /* translators: %d: number of blocks */ Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_n"])('%d block', '%d blocks', blocks.length), blocks.length)), Object(external_this_wp_element_["createElement"])("div", { className: "editor-multi-selection-inspector__card-description" }, /* translators: %d: number of words */ Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_n"])('%d word', '%d words', words), words)))); } /* harmony default export */ var multi_selection_inspector = (Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getMultiSelectedBlocks = _select.getMultiSelectedBlocks; return { blocks: getMultiSelectedBlocks() }; })(MultiSelectionInspector)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-inspector/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal Dependencies */ var block_inspector_BlockInspector = function BlockInspector(_ref) { var selectedBlockClientId = _ref.selectedBlockClientId, selectedBlockName = _ref.selectedBlockName, blockType = _ref.blockType, count = _ref.count, hasBlockStyles = _ref.hasBlockStyles; if (count > 1) { return Object(external_this_wp_element_["createElement"])(multi_selection_inspector, null); } var isSelectedBlockUnregistered = selectedBlockName === Object(external_this_wp_blocks_["getUnregisteredTypeHandlerName"])(); /* * If the selected block is of an unregistered type, avoid showing it as an actual selection * because we want the user to focus on the unregistered block warning, not block settings. */ if (!blockType || !selectedBlockClientId || isSelectedBlockUnregistered) { return Object(external_this_wp_element_["createElement"])("span", { className: "editor-block-inspector__no-blocks" }, Object(external_this_wp_i18n_["__"])('No block selected.')); } return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-inspector__card" }, Object(external_this_wp_element_["createElement"])(BlockIcon, { icon: blockType.icon, showColors: true }), Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-inspector__card-content" }, Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-inspector__card-title" }, blockType.title), Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-inspector__card-description" }, blockType.description))), hasBlockStyles && Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { title: Object(external_this_wp_i18n_["__"])('Styles'), initialOpen: false }, Object(external_this_wp_element_["createElement"])(block_styles, { clientId: selectedBlockClientId }))), Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])(inspector_controls.Slot, null)), Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])(inspector_advanced_controls.Slot, null, function (fills) { return !Object(external_lodash_["isEmpty"])(fills) && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { className: "editor-block-inspector__advanced", title: Object(external_this_wp_i18n_["__"])('Advanced'), initialOpen: false }, fills); })), Object(external_this_wp_element_["createElement"])(skip_to_selected_block, { key: "back" })); }; /* harmony default export */ var block_inspector = (Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getSelectedBlockClientId = _select.getSelectedBlockClientId, getSelectedBlockCount = _select.getSelectedBlockCount, getBlockName = _select.getBlockName; var _select2 = select('core/blocks'), getBlockStyles = _select2.getBlockStyles; var selectedBlockClientId = getSelectedBlockClientId(); var selectedBlockName = selectedBlockClientId && getBlockName(selectedBlockClientId); var blockType = selectedBlockClientId && Object(external_this_wp_blocks_["getBlockType"])(selectedBlockName); var blockStyles = selectedBlockClientId && getBlockStyles(selectedBlockName); return { count: getSelectedBlockCount(), hasBlockStyles: blockStyles && blockStyles.length > 0, selectedBlockName: selectedBlockName, selectedBlockClientId: selectedBlockClientId, blockType: blockType }; })(block_inspector_BlockInspector)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-selection-clearer/index.js /** * External dependencies */ /** * WordPress dependencies */ var block_selection_clearer_BlockSelectionClearer = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(BlockSelectionClearer, _Component); function BlockSelectionClearer() { var _this; Object(classCallCheck["a" /* default */])(this, BlockSelectionClearer); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(BlockSelectionClearer).apply(this, arguments)); _this.bindContainer = _this.bindContainer.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.clearSelectionIfFocusTarget = _this.clearSelectionIfFocusTarget.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); return _this; } Object(createClass["a" /* default */])(BlockSelectionClearer, [{ key: "bindContainer", value: function bindContainer(ref) { this.container = ref; } /** * Clears the selected block on focus if the container is the target of the * focus. This assumes no other descendents have received focus until event * has bubbled to the container. * * @param {FocusEvent} event Focus event. */ }, { key: "clearSelectionIfFocusTarget", value: function clearSelectionIfFocusTarget(event) { var _this$props = this.props, hasSelectedBlock = _this$props.hasSelectedBlock, hasMultiSelection = _this$props.hasMultiSelection, clearSelectedBlock = _this$props.clearSelectedBlock; var hasSelection = hasSelectedBlock || hasMultiSelection; if (event.target === this.container && hasSelection) { clearSelectedBlock(); } } }, { key: "render", value: function render() { return Object(external_this_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ tabIndex: -1, onFocus: this.clearSelectionIfFocusTarget, ref: this.bindContainer }, Object(external_lodash_["omit"])(this.props, ['clearSelectedBlock', 'hasSelectedBlock', 'hasMultiSelection']))); } }]); return BlockSelectionClearer; }(external_this_wp_element_["Component"]); /* harmony default export */ var block_selection_clearer = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), hasSelectedBlock = _select.hasSelectedBlock, hasMultiSelection = _select.hasMultiSelection; return { hasSelectedBlock: hasSelectedBlock(), hasMultiSelection: hasMultiSelection() }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { var _dispatch = dispatch('core/editor'), clearSelectedBlock = _dispatch.clearSelectedBlock; return { clearSelectedBlock: clearSelectedBlock }; })])(block_selection_clearer_BlockSelectionClearer)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/block-mode-toggle.js /** * External dependencies */ /** * WordPress dependencies */ function BlockModeToggle(_ref) { var blockType = _ref.blockType, mode = _ref.mode, onToggleMode = _ref.onToggleMode, _ref$small = _ref.small, small = _ref$small === void 0 ? false : _ref$small; if (!Object(external_this_wp_blocks_["hasBlockSupport"])(blockType, 'html', true)) { return null; } var label = mode === 'visual' ? Object(external_this_wp_i18n_["__"])('Edit as HTML') : Object(external_this_wp_i18n_["__"])('Edit visually'); return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], { className: "editor-block-settings-menu__control", onClick: onToggleMode, icon: "html", label: small ? label : undefined }, !small && label); } /* harmony default export */ var block_mode_toggle = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref2) { var clientId = _ref2.clientId; var _select = select('core/editor'), getBlock = _select.getBlock, getBlockMode = _select.getBlockMode; var block = getBlock(clientId); return { mode: getBlockMode(clientId), blockType: block ? Object(external_this_wp_blocks_["getBlockType"])(block.name) : null }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref3) { var _ref3$onToggle = _ref3.onToggle, onToggle = _ref3$onToggle === void 0 ? external_lodash_["noop"] : _ref3$onToggle, clientId = _ref3.clientId; return { onToggleMode: function onToggleMode() { dispatch('core/editor').toggleBlockMode(clientId); onToggle(); } }; })])(BlockModeToggle)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/reusable-block-convert-button.js /** * External dependencies */ /** * WordPress dependencies */ function ReusableBlockConvertButton(_ref) { var isVisible = _ref.isVisible, isStaticBlock = _ref.isStaticBlock, onConvertToStatic = _ref.onConvertToStatic, onConvertToReusable = _ref.onConvertToReusable; if (!isVisible) { return null; } return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, isStaticBlock && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], { className: "editor-block-settings-menu__control", icon: "controls-repeat", onClick: onConvertToReusable }, Object(external_this_wp_i18n_["__"])('Add to Reusable Blocks')), !isStaticBlock && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], { className: "editor-block-settings-menu__control", icon: "controls-repeat", onClick: onConvertToStatic }, 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, _ref2) { var clientIds = _ref2.clientIds; var _select = select('core/editor'), getBlocksByClientId = _select.getBlocksByClientId, canInsertBlockType = _select.canInsertBlockType, getReusableBlock = _select.__experimentalGetReusableBlock; var blocks = getBlocksByClientId(clientIds); var isVisible = // Hide 'Add to Reusable Blocks' when Reusable Blocks are disabled, i.e. when // core/block is not in the allowed_block_types filter. canInsertBlockType('core/block') && Object(external_lodash_["every"])(blocks, function (block) { return (// Guard against the case where a regular block has *just* been converted to a // reusable block and doesn't yet exist in the editor store. !!block && // Only show the option to covert to reusable blocks on valid blocks. block.isValid && // Make sure the block supports being converted into a reusable block (by default that is the case). Object(external_this_wp_blocks_["hasBlockSupport"])(block.name, 'reusable', true) ); }); return { isVisible: isVisible, isStaticBlock: isVisible && (blocks.length !== 1 || !Object(external_this_wp_blocks_["isReusableBlock"])(blocks[0]) || !getReusableBlock(blocks[0].attributes.ref)) }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref3) { var clientIds = _ref3.clientIds, _ref3$onToggle = _ref3.onToggle, onToggle = _ref3$onToggle === void 0 ? external_lodash_["noop"] : _ref3$onToggle; var _dispatch = dispatch('core/editor'), convertBlockToReusable = _dispatch.__experimentalConvertBlockToReusable, convertBlockToStatic = _dispatch.__experimentalConvertBlockToStatic; return { onConvertToStatic: function onConvertToStatic() { if (clientIds.length !== 1) { return; } convertBlockToStatic(clientIds[0]); onToggle(); }, onConvertToReusable: function onConvertToReusable() { convertBlockToReusable(clientIds); onToggle(); } }; })])(ReusableBlockConvertButton)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/reusable-block-delete-button.js /** * External dependencies */ /** * WordPress dependencies */ function ReusableBlockDeleteButton(_ref) { var reusableBlock = _ref.reusableBlock, onDelete = _ref.onDelete; if (!reusableBlock) { return null; } return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], { className: "editor-block-settings-menu__control", icon: "no", disabled: reusableBlock.isTemporary, onClick: function onClick() { return onDelete(reusableBlock.id); } }, 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, _ref2) { var clientId = _ref2.clientId; var _select = select('core/editor'), getBlock = _select.getBlock, getReusableBlock = _select.__experimentalGetReusableBlock; var block = getBlock(clientId); return { reusableBlock: block && Object(external_this_wp_blocks_["isReusableBlock"])(block) ? getReusableBlock(block.attributes.ref) : null }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref3) { var _ref3$onToggle = _ref3.onToggle, onToggle = _ref3$onToggle === void 0 ? external_lodash_["noop"] : _ref3$onToggle; var _dispatch = dispatch('core/editor'), deleteReusableBlock = _dispatch.__experimentalDeleteReusableBlock; return { onDelete: function onDelete(id) { // TODO: Make this a <Confirm /> component or similar // eslint-disable-next-line no-alert var hasConfirmed = window.confirm(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) { deleteReusableBlock(id); onToggle(); } } }; })])(ReusableBlockDeleteButton)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/block-convert-button.js /** * WordPress dependencies */ function BlockConvertButton(_ref) { var shouldRender = _ref.shouldRender, onClick = _ref.onClick, small = _ref.small; if (!shouldRender) { return null; } var label = Object(external_this_wp_i18n_["__"])('Convert to Blocks'); return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], { className: "editor-block-settings-menu__control", onClick: onClick, icon: "screenoptions", label: small ? label : undefined }, !small && label); } // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/block-html-convert-button.js /** * WordPress dependencies */ /** * Internal dependencies */ /* harmony default export */ var block_html_convert_button = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select, _ref) { var clientId = _ref.clientId; var block = select('core/editor').getBlock(clientId); return { block: block, shouldRender: block && block.name === 'core/html' }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref2) { var block = _ref2.block; return { onClick: function onClick() { return dispatch('core/editor').replaceBlocks(block.clientId, Object(external_this_wp_blocks_["rawHandler"])({ HTML: Object(external_this_wp_blocks_["getBlockContent"])(block) })); } }; }))(BlockConvertButton)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/block-unknown-convert-button.js /** * WordPress dependencies */ /** * Internal dependencies */ /* harmony default export */ var block_unknown_convert_button = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select, _ref) { var clientId = _ref.clientId; var block = select('core/editor').getBlock(clientId); return { block: block, shouldRender: block && block.name === Object(external_this_wp_blocks_["getFreeformContentHandlerName"])() }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref2) { var block = _ref2.block; return { onClick: function onClick() { return dispatch('core/editor').replaceBlocks(block.clientId, Object(external_this_wp_blocks_["rawHandler"])({ HTML: Object(external_this_wp_blocks_["serialize"])(block) })); } }; }))(BlockConvertButton)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/block-settings-menu-first-item.js /** * WordPress dependencies */ var block_settings_menu_first_item_createSlotFill = Object(external_this_wp_components_["createSlotFill"])('_BlockSettingsMenuFirstItem'), _BlockSettingsMenuFirstItem = block_settings_menu_first_item_createSlotFill.Fill, block_settings_menu_first_item_Slot = block_settings_menu_first_item_createSlotFill.Slot; _BlockSettingsMenuFirstItem.Slot = block_settings_menu_first_item_Slot; /* harmony default export */ var block_settings_menu_first_item = (_BlockSettingsMenuFirstItem); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/block-settings-menu-plugins-extension.js /** * WordPress dependencies */ var block_settings_menu_plugins_extension_createSlotFill = Object(external_this_wp_components_["createSlotFill"])('_BlockSettingsMenuPluginsExtension'), _BlockSettingsMenuPluginsExtension = block_settings_menu_plugins_extension_createSlotFill.Fill, block_settings_menu_plugins_extension_Slot = block_settings_menu_plugins_extension_createSlotFill.Slot; _BlockSettingsMenuPluginsExtension.Slot = block_settings_menu_plugins_extension_Slot; /* harmony default export */ var block_settings_menu_plugins_extension = (_BlockSettingsMenuPluginsExtension); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-settings-menu/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ function BlockSettingsMenu(_ref) { var clientIds = _ref.clientIds, onSelect = _ref.onSelect; var blockClientIds = Object(external_lodash_["castArray"])(clientIds); var count = blockClientIds.length; var firstBlockClientId = blockClientIds[0]; return Object(external_this_wp_element_["createElement"])(block_actions, { clientIds: clientIds }, function (_ref2) { var onDuplicate = _ref2.onDuplicate, onRemove = _ref2.onRemove, onInsertAfter = _ref2.onInsertAfter, onInsertBefore = _ref2.onInsertBefore, canDuplicate = _ref2.canDuplicate, isLocked = _ref2.isLocked; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Dropdown"], { contentClassName: "editor-block-settings-menu__popover", position: "bottom right", renderToggle: function renderToggle(_ref3) { var onToggle = _ref3.onToggle, isOpen = _ref3.isOpen; var toggleClassname = classnames_default()('editor-block-settings-menu__toggle', { 'is-opened': isOpen }); var label = isOpen ? Object(external_this_wp_i18n_["__"])('Hide options') : Object(external_this_wp_i18n_["__"])('More options'); return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Toolbar"], { controls: [{ icon: 'ellipsis', title: label, onClick: function onClick() { if (count === 1) { onSelect(firstBlockClientId); } onToggle(); }, className: toggleClassname, extraProps: { 'aria-expanded': isOpen } }] }); }, renderContent: function renderContent(_ref4) { var onClose = _ref4.onClose; return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["NavigableMenu"], { className: "editor-block-settings-menu__content" }, Object(external_this_wp_element_["createElement"])(block_settings_menu_first_item.Slot, { fillProps: { onClose: onClose } }), count === 1 && Object(external_this_wp_element_["createElement"])(block_unknown_convert_button, { clientId: firstBlockClientId }), count === 1 && Object(external_this_wp_element_["createElement"])(block_html_convert_button, { clientId: firstBlockClientId }), !isLocked && canDuplicate && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], { className: "editor-block-settings-menu__control", onClick: onDuplicate, icon: "admin-page", shortcut: shortcuts.duplicate.display }, Object(external_this_wp_i18n_["__"])('Duplicate')), !isLocked && Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], { className: "editor-block-settings-menu__control", onClick: onInsertBefore, icon: "insert-before", shortcut: shortcuts.insertBefore.display }, Object(external_this_wp_i18n_["__"])('Insert Before')), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], { className: "editor-block-settings-menu__control", onClick: onInsertAfter, icon: "insert-after", shortcut: shortcuts.insertAfter.display }, Object(external_this_wp_i18n_["__"])('Insert After'))), count === 1 && Object(external_this_wp_element_["createElement"])(block_mode_toggle, { clientId: firstBlockClientId, onToggle: onClose }), Object(external_this_wp_element_["createElement"])(reusable_block_convert_button, { clientIds: clientIds, onToggle: onClose }), Object(external_this_wp_element_["createElement"])(block_settings_menu_plugins_extension.Slot, { fillProps: { clientIds: clientIds, onClose: onClose } }), Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-settings-menu__separator" }), count === 1 && Object(external_this_wp_element_["createElement"])(reusable_block_delete_button, { clientId: firstBlockClientId, onToggle: onClose }), !isLocked && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], { className: "editor-block-settings-menu__control", onClick: onRemove, icon: "trash", shortcut: shortcuts.removeBlock.display }, Object(external_this_wp_i18n_["__"])('Remove Block'))); } }); }); } /* harmony default export */ var block_settings_menu = (Object(external_this_wp_data_["withDispatch"])(function (dispatch) { var _dispatch = dispatch('core/editor'), selectBlock = _dispatch.selectBlock; return { onSelect: function onSelect(clientId) { selectBlock(clientId); } }; })(BlockSettingsMenu)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-switcher/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var block_switcher_BlockSwitcher = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(BlockSwitcher, _Component); function BlockSwitcher() { var _this; Object(classCallCheck["a" /* default */])(this, BlockSwitcher); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(BlockSwitcher).apply(this, arguments)); _this.state = { hoveredClassName: null }; _this.onHoverClassName = _this.onHoverClassName.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); return _this; } Object(createClass["a" /* default */])(BlockSwitcher, [{ key: "onHoverClassName", value: function onHoverClassName(className) { this.setState({ hoveredClassName: className }); } }, { key: "render", value: function render() { var _this2 = this; var _this$props = this.props, blocks = _this$props.blocks, onTransform = _this$props.onTransform, inserterItems = _this$props.inserterItems, hasBlockStyles = _this$props.hasBlockStyles; var hoveredClassName = this.state.hoveredClassName; if (!blocks || !blocks.length) { return null; } var itemsByName = Object(external_lodash_["mapKeys"])(inserterItems, function (_ref) { var name = _ref.name; return name; }); var possibleBlockTransformations = Object(external_lodash_["orderBy"])(Object(external_lodash_["filter"])(Object(external_this_wp_blocks_["getPossibleBlockTransformations"])(blocks), function (block) { return block && !!itemsByName[block.name]; }), function (block) { return itemsByName[block.name].frecency; }, 'desc'); var sourceBlockName = blocks[0].name; var blockType = Object(external_this_wp_blocks_["getBlockType"])(sourceBlockName); if (!hasBlockStyles && !possibleBlockTransformations.length) { if (blocks.length > 1) { return null; } return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Toolbar"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { disabled: true, className: "editor-block-switcher__no-switcher-icon", label: Object(external_this_wp_i18n_["__"])('Block icon') }, Object(external_this_wp_element_["createElement"])(BlockIcon, { icon: blockType.icon, showColors: true }))); } return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Dropdown"], { position: "bottom right", className: "editor-block-switcher", contentClassName: "editor-block-switcher__popover", renderToggle: function renderToggle(_ref2) { var onToggle = _ref2.onToggle, isOpen = _ref2.isOpen; var openOnArrowDown = function openOnArrowDown(event) { if (!isOpen && event.keyCode === external_this_wp_keycodes_["DOWN"]) { event.preventDefault(); event.stopPropagation(); onToggle(); } }; var label = 1 === blocks.length ? Object(external_this_wp_i18n_["__"])('Change block type') : Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["_n"])('Change type of %d block', 'Change type of %d blocks', blocks.length), blocks.length); return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Toolbar"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { className: "editor-block-switcher__toggle", onClick: onToggle, "aria-haspopup": "true", "aria-expanded": isOpen, label: label, tooltip: label, onKeyDown: openOnArrowDown }, Object(external_this_wp_element_["createElement"])(BlockIcon, { icon: blockType.icon, showColors: true }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { className: "editor-block-switcher__transform", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { d: "M6.5 8.9c.6-.6 1.4-.9 2.2-.9h6.9l-1.3 1.3 1.4 1.4L19.4 7l-3.7-3.7-1.4 1.4L15.6 6H8.7c-1.4 0-2.6.5-3.6 1.5l-2.8 2.8 1.4 1.4 2.8-2.8zm13.8 2.4l-2.8 2.8c-.6.6-1.3.9-2.1.9h-7l1.3-1.3-1.4-1.4L4.6 16l3.7 3.7 1.4-1.4L8.4 17h6.9c1.3 0 2.6-.5 3.5-1.5l2.8-2.8-1.3-1.4z" })))); }, renderContent: function renderContent(_ref3) { var onClose = _ref3.onClose; return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, hasBlockStyles && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { title: Object(external_this_wp_i18n_["__"])('Block Styles'), initialOpen: true }, Object(external_this_wp_element_["createElement"])(block_styles, { clientId: blocks[0].clientId, onSwitch: onClose, onHoverClassName: _this2.onHoverClassName })), possibleBlockTransformations.length !== 0 && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { title: Object(external_this_wp_i18n_["__"])('Transform To:'), initialOpen: true }, Object(external_this_wp_element_["createElement"])(block_types_list, { items: possibleBlockTransformations.map(function (destinationBlockType) { return { id: destinationBlockType.name, icon: destinationBlockType.icon, title: destinationBlockType.title, hasChildBlocksWithInserterSupport: Object(external_this_wp_blocks_["hasChildBlocksWithInserterSupport"])(destinationBlockType.name) }; }), onSelect: function onSelect(item) { onTransform(blocks, item.id); onClose(); } })), hoveredClassName !== null && Object(external_this_wp_element_["createElement"])(block_preview, { name: blocks[0].name, attributes: Object(objectSpread["a" /* default */])({}, blocks[0].attributes, { className: hoveredClassName }) })); } }); } }]); return BlockSwitcher; }(external_this_wp_element_["Component"]); /* harmony default export */ var block_switcher = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select, _ref4) { var clientIds = _ref4.clientIds; var _select = select('core/editor'), getBlocksByClientId = _select.getBlocksByClientId, getBlockRootClientId = _select.getBlockRootClientId, getInserterItems = _select.getInserterItems; var _select2 = select('core/blocks'), getBlockStyles = _select2.getBlockStyles; var rootClientId = getBlockRootClientId(Object(external_lodash_["first"])(Object(external_lodash_["castArray"])(clientIds))); var blocks = getBlocksByClientId(clientIds); var firstBlock = blocks && blocks.length === 1 ? blocks[0] : null; var styles = firstBlock && getBlockStyles(firstBlock.name); return { blocks: blocks, inserterItems: getInserterItems(rootClientId), hasBlockStyles: styles && styles.length > 0 }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, ownProps) { return { onTransform: function onTransform(blocks, name) { dispatch('core/editor').replaceBlocks(ownProps.clientIds, Object(external_this_wp_blocks_["switchToBlockType"])(blocks, name)); } }; }))(block_switcher_BlockSwitcher)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-switcher/multi-blocks-switcher.js /** * WordPress dependencies */ /** * Internal dependencies */ function MultiBlocksSwitcher(_ref) { var isMultiBlockSelection = _ref.isMultiBlockSelection, selectedBlockClientIds = _ref.selectedBlockClientIds; if (!isMultiBlockSelection) { return null; } return Object(external_this_wp_element_["createElement"])(block_switcher, { key: "switcher", clientIds: selectedBlockClientIds }); } /* harmony default export */ var multi_blocks_switcher = (Object(external_this_wp_data_["withSelect"])(function (select) { var selectedBlockClientIds = select('core/editor').getMultiSelectedBlockClientIds(); return { isMultiBlockSelection: selectedBlockClientIds.length > 1, selectedBlockClientIds: selectedBlockClientIds }; })(MultiBlocksSwitcher)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/block-toolbar/index.js /** * WordPress Dependencies */ /** * Internal Dependencies */ function BlockToolbar(_ref) { var blockClientIds = _ref.blockClientIds, isValid = _ref.isValid, mode = _ref.mode; if (blockClientIds.length === 0) { return null; } if (blockClientIds.length > 1) { return Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-toolbar" }, Object(external_this_wp_element_["createElement"])(multi_blocks_switcher, null), Object(external_this_wp_element_["createElement"])(block_settings_menu, { clientIds: blockClientIds })); } return Object(external_this_wp_element_["createElement"])("div", { className: "editor-block-toolbar" }, mode === 'visual' && isValid && Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(block_switcher, { clientIds: blockClientIds }), Object(external_this_wp_element_["createElement"])(block_controls.Slot, null), Object(external_this_wp_element_["createElement"])(block_format_controls.Slot, null)), Object(external_this_wp_element_["createElement"])(block_settings_menu, { clientIds: blockClientIds })); } /* harmony default export */ var block_toolbar = (Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getSelectedBlockClientId = _select.getSelectedBlockClientId, getBlockMode = _select.getBlockMode, getMultiSelectedBlockClientIds = _select.getMultiSelectedBlockClientIds, isBlockValid = _select.isBlockValid; var selectedBlockClientId = getSelectedBlockClientId(); var blockClientIds = selectedBlockClientId ? [selectedBlockClientId] : getMultiSelectedBlockClientIds(); return { blockClientIds: blockClientIds, isValid: selectedBlockClientId ? isBlockValid(selectedBlockClientId) : null, mode: selectedBlockClientId ? getBlockMode(selectedBlockClientId) : null }; })(BlockToolbar)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/copy-handler/index.js /** * WordPress dependencies */ var copy_handler_CopyHandler = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(CopyHandler, _Component); function CopyHandler() { var _this; Object(classCallCheck["a" /* default */])(this, CopyHandler); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(CopyHandler).apply(this, arguments)); _this.onCopy = function (event) { return _this.props.onCopy(event); }; _this.onCut = function (event) { return _this.props.onCut(event); }; return _this; } Object(createClass["a" /* default */])(CopyHandler, [{ key: "componentDidMount", value: function componentDidMount() { document.addEventListener('copy', this.onCopy); document.addEventListener('cut', this.onCut); } }, { key: "componentWillUnmount", value: function componentWillUnmount() { document.removeEventListener('copy', this.onCopy); document.removeEventListener('cut', this.onCut); } }, { key: "render", value: function render() { return null; } }]); return CopyHandler; }(external_this_wp_element_["Component"]); /* harmony default export */ var copy_handler = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withDispatch"])(function (dispatch, ownProps, _ref) { var select = _ref.select; var _select = select('core/editor'), getBlocksByClientId = _select.getBlocksByClientId, getMultiSelectedBlockClientIds = _select.getMultiSelectedBlockClientIds, getSelectedBlockClientId = _select.getSelectedBlockClientId, hasMultiSelection = _select.hasMultiSelection; var _dispatch = dispatch('core/editor'), removeBlocks = _dispatch.removeBlocks; var onCopy = function onCopy(event) { var selectedBlockClientIds = getSelectedBlockClientId() ? [getSelectedBlockClientId()] : getMultiSelectedBlockClientIds(); if (selectedBlockClientIds.length === 0) { return; } // Let native copy behaviour take over in input fields. if (!hasMultiSelection() && Object(external_this_wp_dom_["documentHasSelection"])()) { return; } var serialized = Object(external_this_wp_blocks_["serialize"])(getBlocksByClientId(selectedBlockClientIds)); event.clipboardData.setData('text/plain', serialized); event.clipboardData.setData('text/html', serialized); event.preventDefault(); }; return { onCopy: onCopy, onCut: function onCut(event) { onCopy(event); if (hasMultiSelection()) { var selectedBlockClientIds = getSelectedBlockClientId() ? [getSelectedBlockClientId()] : getMultiSelectedBlockClientIds(); removeBlocks(selectedBlockClientIds); } } }; })])(copy_handler_CopyHandler)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/error-boundary/index.js /** * WordPress dependencies */ /** * Internal dependencies */ var error_boundary_ErrorBoundary = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(ErrorBoundary, _Component); 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.state = { error: null }; return _this; } Object(createClass["a" /* default */])(ErrorBoundary, [{ key: "componentDidCatch", value: function componentDidCatch(error) { this.setState({ error: error }); } }, { key: "reboot", value: function reboot() { this.props.onError(); } }, { key: "getContent", value: function getContent() { try { // While `select` in a component is generally discouraged, it is // used here because it (a) reduces the chance of data loss in the // case of additional errors by performing a direct retrieval and // (b) avoids the performance cost associated with unnecessary // content serialization throughout the lifetime of a non-erroring // application. return Object(external_this_wp_data_["select"])('core/editor').getEditedPostContent(); } catch (error) {} } }, { key: "render", value: function render() { var error = this.state.error; if (!error) { return this.props.children; } return Object(external_this_wp_element_["createElement"])(warning, { className: "editor-error-boundary", actions: [Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { key: "recovery", onClick: this.reboot, isLarge: 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 }, 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 }, Object(external_this_wp_i18n_["__"])('Copy Error'))] }, Object(external_this_wp_i18n_["__"])('The editor has encountered an unexpected error.')); } }]); return ErrorBoundary; }(external_this_wp_element_["Component"]); /* harmony default export */ var error_boundary = (error_boundary_ErrorBoundary); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/multi-select-scroll-into-view/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ var multi_select_scroll_into_view_MultiSelectScrollIntoView = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(MultiSelectScrollIntoView, _Component); function MultiSelectScrollIntoView() { Object(classCallCheck["a" /* default */])(this, MultiSelectScrollIntoView); return Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(MultiSelectScrollIntoView).apply(this, arguments)); } Object(createClass["a" /* default */])(MultiSelectScrollIntoView, [{ key: "componentDidUpdate", value: function componentDidUpdate() { // Relies on expectation that `componentDidUpdate` will only be called // if value of `extentClientId` changes. this.scrollIntoView(); } /** * Ensures that if a multi-selection exists, the extent of the selection is * visible within the nearest scrollable container. * * @return {void} */ }, { key: "scrollIntoView", value: function scrollIntoView() { var extentClientId = this.props.extentClientId; if (!extentClientId) { return; } var extentNode = getBlockDOMNode(extentClientId); if (!extentNode) { return; } var scrollContainer = Object(external_this_wp_dom_["getScrollContainer"])(extentNode); // If there's no scroll container, it follows that there's no scrollbar // and thus there's no need to try to scroll into view. if (!scrollContainer) { return; } dom_scroll_into_view_lib_default()(extentNode, scrollContainer, { onlyScrollIfNeeded: true }); } }, { key: "render", value: function render() { return null; } }]); return MultiSelectScrollIntoView; }(external_this_wp_element_["Component"]); /* harmony default export */ var multi_select_scroll_into_view = (Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getLastMultiSelectedBlockClientId = _select.getLastMultiSelectedBlockClientId; return { extentClientId: getLastMultiSelectedBlockClientId() }; })(multi_select_scroll_into_view_MultiSelectScrollIntoView)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/observe-typing/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Set of key codes upon which typing is to be initiated on a keydown event. * * @type {number[]} */ var KEY_DOWN_ELIGIBLE_KEY_CODES = [external_this_wp_keycodes_["UP"], external_this_wp_keycodes_["RIGHT"], external_this_wp_keycodes_["DOWN"], external_this_wp_keycodes_["LEFT"], external_this_wp_keycodes_["ENTER"], external_this_wp_keycodes_["BACKSPACE"]]; /** * Returns true if a given keydown event can be inferred as intent to start * typing, or false otherwise. A keydown is considered eligible if it is a * text navigation without shift active. * * @param {KeyboardEvent} event Keydown event to test. * * @return {boolean} Whether event is eligible to start typing. */ function isKeyDownEligibleForStartTyping(event) { var keyCode = event.keyCode, shiftKey = event.shiftKey; return !shiftKey && Object(external_lodash_["includes"])(KEY_DOWN_ELIGIBLE_KEY_CODES, keyCode); } var observe_typing_ObserveTyping = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(ObserveTyping, _Component); function ObserveTyping() { var _this; Object(classCallCheck["a" /* default */])(this, ObserveTyping); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(ObserveTyping).apply(this, arguments)); _this.stopTypingOnSelectionUncollapse = _this.stopTypingOnSelectionUncollapse.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.stopTypingOnMouseMove = _this.stopTypingOnMouseMove.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.startTypingInTextField = _this.startTypingInTextField.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.stopTypingOnNonTextField = _this.stopTypingOnNonTextField.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.stopTypingOnEscapeKey = _this.stopTypingOnEscapeKey.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.onKeyDown = Object(external_lodash_["over"])([_this.startTypingInTextField, _this.stopTypingOnEscapeKey]); _this.lastMouseMove = null; return _this; } Object(createClass["a" /* default */])(ObserveTyping, [{ key: "componentDidMount", value: function componentDidMount() { this.toggleEventBindings(this.props.isTyping); } }, { key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { if (this.props.isTyping !== prevProps.isTyping) { this.toggleEventBindings(this.props.isTyping); } } }, { key: "componentWillUnmount", value: function componentWillUnmount() { this.toggleEventBindings(false); } /** * Bind or unbind events to the document when typing has started or stopped * respectively, or when component has become unmounted. * * @param {boolean} isBound Whether event bindings should be applied. */ }, { key: "toggleEventBindings", value: function toggleEventBindings(isBound) { var bindFn = isBound ? 'addEventListener' : 'removeEventListener'; document[bindFn]('selectionchange', this.stopTypingOnSelectionUncollapse); document[bindFn]('mousemove', this.stopTypingOnMouseMove); } /** * On mouse move, unset typing flag if user has moved cursor. * * @param {MouseEvent} event Mousemove event. */ }, { key: "stopTypingOnMouseMove", value: function stopTypingOnMouseMove(event) { var clientX = event.clientX, clientY = event.clientY; // We need to check that the mouse really moved because Safari triggers // mousemove events when shift or ctrl are pressed. if (this.lastMouseMove) { var _this$lastMouseMove = this.lastMouseMove, lastClientX = _this$lastMouseMove.clientX, lastClientY = _this$lastMouseMove.clientY; if (lastClientX !== clientX || lastClientY !== clientY) { this.props.onStopTyping(); } } this.lastMouseMove = { clientX: clientX, clientY: clientY }; } /** * On selection change, unset typing flag if user has made an uncollapsed * (shift) selection. */ }, { key: "stopTypingOnSelectionUncollapse", value: function stopTypingOnSelectionUncollapse() { var selection = window.getSelection(); var isCollapsed = selection.rangeCount > 0 && selection.getRangeAt(0).collapsed; if (!isCollapsed) { this.props.onStopTyping(); } } /** * Unsets typing flag if user presses Escape while typing flag is active. * * @param {KeyboardEvent} event Keypress or keydown event to interpret. */ }, { key: "stopTypingOnEscapeKey", value: function stopTypingOnEscapeKey(event) { if (this.props.isTyping && event.keyCode === external_this_wp_keycodes_["ESCAPE"]) { this.props.onStopTyping(); } } /** * Handles a keypress or keydown event to infer intention to start typing. * * @param {KeyboardEvent} event Keypress or keydown event to interpret. */ }, { key: "startTypingInTextField", value: function startTypingInTextField(event) { var _this$props = this.props, isTyping = _this$props.isTyping, onStartTyping = _this$props.onStartTyping; var type = event.type, target = event.target; // Abort early if already typing, or key press is incurred outside a // text field (e.g. arrow-ing through toolbar buttons). // Ignore typing in a block toolbar if (isTyping || !Object(external_this_wp_dom_["isTextField"])(target) || target.closest('.editor-block-toolbar')) { return; } // Special-case keydown because certain keys do not emit a keypress // event. Conversely avoid keydown as the canonical event since there // are many keydown which are explicitly not targeted for typing. if (type === 'keydown' && !isKeyDownEligibleForStartTyping(event)) { return; } onStartTyping(); } /** * Stops typing when focus transitions to a non-text field element. * * @param {FocusEvent} event Focus event. */ }, { key: "stopTypingOnNonTextField", value: function stopTypingOnNonTextField(event) { var _this2 = this; event.persist(); // Since focus to a non-text field via arrow key will trigger before // the keydown event, wait until after current stack before evaluating // whether typing is to be stopped. Otherwise, typing will re-start. this.props.setTimeout(function () { var _this2$props = _this2.props, isTyping = _this2$props.isTyping, onStopTyping = _this2$props.onStopTyping; var target = event.target; if (isTyping && !Object(external_this_wp_dom_["isTextField"])(target)) { onStopTyping(); } }); } }, { key: "render", value: function render() { var children = this.props.children; // Disable reason: This component is responsible for capturing bubbled // keyboard events which are interpreted as typing intent. /* eslint-disable jsx-a11y/no-static-element-interactions */ return Object(external_this_wp_element_["createElement"])("div", { onFocus: this.stopTypingOnNonTextField, onKeyPress: this.startTypingInTextField, onKeyDown: this.onKeyDown }, children); /* eslint-enable jsx-a11y/no-static-element-interactions */ } }]); return ObserveTyping; }(external_this_wp_element_["Component"]); /* harmony default export */ var observe_typing = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), isTyping = _select.isTyping; return { isTyping: isTyping() }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { var _dispatch = dispatch('core/editor'), startTyping = _dispatch.startTyping, stopTyping = _dispatch.stopTyping; return { onStartTyping: startTyping, onStopTyping: stopTyping }; }), external_this_wp_compose_["withSafeTimeout"]])(observe_typing_ObserveTyping)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/preserve-scroll-in-reorder/index.js /** * WordPress dependencies */ /** * Internal dependencies */ /** * Non-visual component which preserves offset of selected block within nearest * scrollable container while reordering. * * @example * * ```jsx * <PreserveScrollInReorder /> * ``` */ var preserve_scroll_in_reorder_PreserveScrollInReorder = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(PreserveScrollInReorder, _Component); function PreserveScrollInReorder() { Object(classCallCheck["a" /* default */])(this, PreserveScrollInReorder); return Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(PreserveScrollInReorder).apply(this, arguments)); } Object(createClass["a" /* default */])(PreserveScrollInReorder, [{ key: "getSnapshotBeforeUpdate", value: function getSnapshotBeforeUpdate(prevProps) { var _this$props = this.props, blockOrder = _this$props.blockOrder, selectionStart = _this$props.selectionStart; if (blockOrder !== prevProps.blockOrder && selectionStart) { return this.getOffset(selectionStart); } return null; } }, { key: "componentDidUpdate", value: function componentDidUpdate(prevProps, prevState, snapshot) { if (snapshot) { this.restorePreviousOffset(snapshot); } } /** * Given the block client ID of the start of the selection, saves the * block's top offset as an instance property before a reorder is to occur. * * @param {string} selectionStart Client ID of selected block. * * @return {number?} The scroll offset. */ }, { key: "getOffset", value: function getOffset(selectionStart) { var blockNode = getBlockDOMNode(selectionStart); if (!blockNode) { return null; } return blockNode.getBoundingClientRect().top; } /** * After a block reordering, restores the previous viewport top offset. * * @param {number} offset The scroll offset. */ }, { key: "restorePreviousOffset", value: function restorePreviousOffset(offset) { var selectionStart = this.props.selectionStart; var blockNode = getBlockDOMNode(selectionStart); if (blockNode) { var scrollContainer = Object(external_this_wp_dom_["getScrollContainer"])(blockNode); if (scrollContainer) { scrollContainer.scrollTop = scrollContainer.scrollTop + blockNode.getBoundingClientRect().top - offset; } } } }, { key: "render", value: function render() { return null; } }]); return PreserveScrollInReorder; }(external_this_wp_element_["Component"]); /* harmony default export */ var preserve_scroll_in_reorder = (Object(external_this_wp_data_["withSelect"])(function (select) { return { blockOrder: select('core/editor').getBlockOrder(), selectionStart: select('core/editor').getBlockSelectionStart() }; })(preserve_scroll_in_reorder_PreserveScrollInReorder)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/writing-flow/index.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Browser constants */ var writing_flow_window = window, writing_flow_getSelection = writing_flow_window.getSelection; /** * Given an element, returns true if the element is a tabbable text field, or * false otherwise. * * @param {Element} element Element to test. * * @return {boolean} Whether element is a tabbable text field. */ var isTabbableTextField = Object(external_lodash_["overEvery"])([external_this_wp_dom_["isTextField"], external_this_wp_dom_["focus"].tabbable.isTabbableIndex]); /** * Returns true if the element should consider edge navigation upon a keyboard * event of the given directional key code, or false otherwise. * * @param {Element} element HTML element to test. * @param {number} keyCode KeyboardEvent keyCode to test. * @param {boolean} hasModifier Whether a modifier is pressed. * * @return {boolean} Whether element should consider edge navigation. */ function isNavigationCandidate(element, keyCode, hasModifier) { var isVertical = keyCode === external_this_wp_keycodes_["UP"] || keyCode === external_this_wp_keycodes_["DOWN"]; // Currently, all elements support unmodified vertical navigation. if (isVertical && !hasModifier) { return true; } // Native inputs should not navigate horizontally. var tagName = element.tagName; return tagName !== 'INPUT' && tagName !== 'TEXTAREA'; } var writing_flow_WritingFlow = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(WritingFlow, _Component); function WritingFlow() { var _this; Object(classCallCheck["a" /* default */])(this, WritingFlow); _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(WritingFlow).apply(this, arguments)); _this.onKeyDown = _this.onKeyDown.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.bindContainer = _this.bindContainer.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.clearVerticalRect = _this.clearVerticalRect.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); _this.focusLastTextField = _this.focusLastTextField.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); /** * Here a rectangle is stored while moving the caret vertically so * vertical position of the start position can be restored. * This is to recreate browser behaviour across blocks. * * @type {?DOMRect} */ _this.verticalRect = null; return _this; } Object(createClass["a" /* default */])(WritingFlow, [{ key: "bindContainer", value: function bindContainer(ref) { this.container = ref; } }, { key: "clearVerticalRect", value: function clearVerticalRect() { this.verticalRect = null; } /** * Returns the optimal tab target from the given focused element in the * desired direction. A preference is made toward text fields, falling back * to the block focus stop if no other candidates exist for the block. * * @param {Element} target Currently focused text field. * @param {boolean} isReverse True if considering as the first field. * * @return {?Element} Optimal tab target, if one exists. */ }, { key: "getClosestTabbable", value: function getClosestTabbable(target, isReverse) { // Since the current focus target is not guaranteed to be a text field, // find all focusables. Tabbability is considered later. var focusableNodes = external_this_wp_dom_["focus"].focusable.find(this.container); if (isReverse) { focusableNodes = Object(external_lodash_["reverse"])(focusableNodes); } // Consider as candidates those focusables after the current target. // It's assumed this can only be reached if the target is focusable // (on its keydown event), so no need to verify it exists in the set. focusableNodes = focusableNodes.slice(focusableNodes.indexOf(target) + 1); function isTabCandidate(node, i, array) { // Not a candidate if the node is not tabbable. if (!external_this_wp_dom_["focus"].tabbable.isTabbableIndex(node)) { return false; } // Prefer text fields... if (Object(external_this_wp_dom_["isTextField"])(node)) { return true; } // ...but settle for block focus stop. if (!isBlockFocusStop(node)) { return false; } // If element contains inner blocks, stop immediately at its focus // wrapper. if (hasInnerBlocksContext(node)) { return true; } // If navigating out of a block (in reverse), don't consider its // block focus stop. if (node.contains(target)) { return false; } // In case of block focus stop, check to see if there's a better // text field candidate within. for (var offset = 1, nextNode; nextNode = array[i + offset]; offset++) { // Abort if no longer testing descendents of focus stop. if (!node.contains(nextNode)) { break; } // Apply same tests by recursion. This is important to consider // nestable blocks where we don't want to settle for the inner // block focus stop. if (isTabCandidate(nextNode, i + offset, array)) { return false; } } return true; } return Object(external_lodash_["find"])(focusableNodes, isTabCandidate); } }, { key: "expandSelection", value: function expandSelection(isReverse) { var _this$props = this.props, selectedBlockClientId = _this$props.selectedBlockClientId, selectionStartClientId = _this$props.selectionStartClientId, selectionBeforeEndClientId = _this$props.selectionBeforeEndClientId, selectionAfterEndClientId = _this$props.selectionAfterEndClientId; var nextSelectionEndClientId = isReverse ? selectionBeforeEndClientId : selectionAfterEndClientId; if (nextSelectionEndClientId) { this.props.onMultiSelect(selectionStartClientId || selectedBlockClientId, nextSelectionEndClientId); } } }, { key: "moveSelection", value: function moveSelection(isReverse) { var _this$props2 = this.props, selectedFirstClientId = _this$props2.selectedFirstClientId, selectedLastClientId = _this$props2.selectedLastClientId; var focusedBlockClientId = isReverse ? selectedFirstClientId : selectedLastClientId; if (focusedBlockClientId) { this.props.onSelectBlock(focusedBlockClientId); } } /** * Returns true if the given target field is the last in its block which * can be considered for tab transition. For example, in a block with two * text fields, this would return true when reversing from the first of the * two fields, but false when reversing from the second. * * @param {Element} target Currently focused text field. * @param {boolean} isReverse True if considering as the first field. * * @return {boolean} Whether field is at edge for tab transition. */ }, { key: "isTabbableEdge", value: function isTabbableEdge(target, isReverse) { var closestTabbable = this.getClosestTabbable(target, isReverse); return !closestTabbable || !isInSameBlock(target, closestTabbable); } }, { key: "onKeyDown", value: function onKeyDown(event) { var _this$props3 = this.props, hasMultiSelection = _this$props3.hasMultiSelection, onMultiSelect = _this$props3.onMultiSelect, blocks = _this$props3.blocks; var keyCode = event.keyCode, target = event.target; var isUp = keyCode === external_this_wp_keycodes_["UP"]; var isDown = keyCode === external_this_wp_keycodes_["DOWN"]; var isLeft = keyCode === external_this_wp_keycodes_["LEFT"]; var isRight = keyCode === external_this_wp_keycodes_["RIGHT"]; var isReverse = isUp || isLeft; var isHorizontal = isLeft || isRight; var isVertical = isUp || isDown; var isNav = isHorizontal || isVertical; var isShift = event.shiftKey; var hasModifier = isShift || event.ctrlKey || event.altKey || event.metaKey; var isNavEdge = isVertical ? external_this_wp_dom_["isVerticalEdge"] : external_this_wp_dom_["isHorizontalEdge"]; // This logic inside this condition needs to be checked before // the check for event.nativeEvent.defaultPrevented. // The logic handles meta+a keypress and this event is default prevented by TinyMCE. if (!isNav) { // Set immediately before the meta+a combination can be pressed. if (external_this_wp_keycodes_["isKeyboardEvent"].primary(event)) { this.isEntirelySelected = Object(external_this_wp_dom_["isEntirelySelected"])(target); } if (external_this_wp_keycodes_["isKeyboardEvent"].primary(event, 'a')) { // When the target is contentEditable, selection will already // have been set by TinyMCE earlier in this call stack. We need // check the previous result, otherwise all blocks will be // selected right away. if (target.isContentEditable ? this.isEntirelySelected : Object(external_this_wp_dom_["isEntirelySelected"])(target)) { onMultiSelect(Object(external_lodash_["first"])(blocks), Object(external_lodash_["last"])(blocks)); event.preventDefault(); } // After pressing primary + A we can assume isEntirelySelected is true. // Calling right away isEntirelySelected after primary + A may still return false on some browsers. this.isEntirelySelected = true; } return; } // Abort if navigation has already been handled (e.g. TinyMCE inline // boundaries). if (event.nativeEvent.defaultPrevented) { return; } // Abort if our current target is not a candidate for navigation (e.g. // preserve native input behaviors). if (!isNavigationCandidate(target, keyCode, hasModifier)) { return; } if (!isVertical) { this.verticalRect = null; } else if (!this.verticalRect) { this.verticalRect = Object(external_this_wp_dom_["computeCaretRect"])(target); } if (isShift && (hasMultiSelection || this.isTabbableEdge(target, isReverse) && isNavEdge(target, isReverse))) { // Shift key is down, and there is multi selection or we're at the end of the current block. this.expandSelection(isReverse); event.preventDefault(); } else if (hasMultiSelection) { // Moving from block multi-selection to single block selection this.moveSelection(isReverse); event.preventDefault(); } else if (isVertical && Object(external_this_wp_dom_["isVerticalEdge"])(target, isReverse)) { var closestTabbable = this.getClosestTabbable(target, isReverse); if (closestTabbable) { Object(external_this_wp_dom_["placeCaretAtVerticalEdge"])(closestTabbable, isReverse, this.verticalRect); event.preventDefault(); } } else if (isHorizontal && writing_flow_getSelection().isCollapsed && Object(external_this_wp_dom_["isHorizontalEdge"])(target, isReverse)) { var _closestTabbable = this.getClosestTabbable(target, isReverse); Object(external_this_wp_dom_["placeCaretAtHorizontalEdge"])(_closestTabbable, isReverse); event.preventDefault(); } } /** * Sets focus to the end of the last tabbable text field, if one exists. */ }, { key: "focusLastTextField", value: function focusLastTextField() { var focusableNodes = external_this_wp_dom_["focus"].focusable.find(this.container); var target = Object(external_lodash_["findLast"])(focusableNodes, isTabbableTextField); if (target) { Object(external_this_wp_dom_["placeCaretAtHorizontalEdge"])(target, true); } } }, { key: "render", value: function render() { var children = this.props.children; // Disable reason: Wrapper itself is non-interactive, but must capture // bubbling events from children to determine focus transition intents. /* eslint-disable jsx-a11y/no-static-element-interactions */ return Object(external_this_wp_element_["createElement"])("div", { className: "editor-writing-flow" }, Object(external_this_wp_element_["createElement"])("div", { ref: this.bindContainer, onKeyDown: this.onKeyDown, onMouseDown: this.clearVerticalRect }, children), Object(external_this_wp_element_["createElement"])("div", { "aria-hidden": true, tabIndex: -1, onClick: this.focusLastTextField, className: "wp-block editor-writing-flow__click-redirect" })); /* eslint-disable jsx-a11y/no-static-element-interactions */ } }]); return WritingFlow; }(external_this_wp_element_["Component"]); /* harmony default export */ var writing_flow = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getSelectedBlockClientId = _select.getSelectedBlockClientId, getMultiSelectedBlocksStartClientId = _select.getMultiSelectedBlocksStartClientId, getMultiSelectedBlocksEndClientId = _select.getMultiSelectedBlocksEndClientId, getPreviousBlockClientId = _select.getPreviousBlockClientId, getNextBlockClientId = _select.getNextBlockClientId, getFirstMultiSelectedBlockClientId = _select.getFirstMultiSelectedBlockClientId, getLastMultiSelectedBlockClientId = _select.getLastMultiSelectedBlockClientId, hasMultiSelection = _select.hasMultiSelection, getBlockOrder = _select.getBlockOrder; var selectedBlockClientId = getSelectedBlockClientId(); var selectionStartClientId = getMultiSelectedBlocksStartClientId(); var selectionEndClientId = getMultiSelectedBlocksEndClientId(); return { selectedBlockClientId: selectedBlockClientId, selectionStartClientId: selectionStartClientId, selectionBeforeEndClientId: getPreviousBlockClientId(selectionEndClientId || selectedBlockClientId), selectionAfterEndClientId: getNextBlockClientId(selectionEndClientId || selectedBlockClientId), selectedFirstClientId: getFirstMultiSelectedBlockClientId(), selectedLastClientId: getLastMultiSelectedBlockClientId(), hasMultiSelection: hasMultiSelection(), blocks: getBlockOrder() }; }), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { var _dispatch = dispatch('core/editor'), multiSelect = _dispatch.multiSelect, selectBlock = _dispatch.selectBlock; return { onMultiSelect: multiSelect, onSelectBlock: selectBlock }; })])(writing_flow_WritingFlow)); // 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__(98); 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. // EXTERNAL MODULE: ./node_modules/traverse/index.js var traverse = __webpack_require__(193); var traverse_default = /*#__PURE__*/__webpack_require__.n(traverse); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/editor-styles/traverse.js /** * External 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_url = __webpack_require__(75); // 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_url["parse"])(str).pathname; var filePath = Object(url_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).*$/; 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)/, 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 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/index.js /** * External dependencies */ /** * WordPress Dependencies */ /** * Internal dependencies */ var provider_EditorProvider = /*#__PURE__*/ function (_Component) { Object(inherits["a" /* default */])(EditorProvider, _Component); 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)); // Assume that we don't need to initialize in the case of an error recovery. if (props.recovery) { return Object(possibleConstructorReturn["a" /* default */])(_this); } props.updateEditorSettings(props.settings); props.updatePostLock(props.settings.postLock); props.setupEditor(props.post, props.initialEdits); if (props.settings.autosave) { props.createWarningNotice(Object(external_this_wp_i18n_["__"])('There is an autosave of this post that is more recent than the version below.'), { id: 'autosave-exists', actions: [{ label: Object(external_this_wp_i18n_["__"])('View the autosave'), url: props.settings.autosave.editLink }] }); } return _this; } Object(createClass["a" /* default */])(EditorProvider, [{ key: "componentDidMount", value: function componentDidMount() { if (!this.props.settings.styles) { return; } Object(external_lodash_["map"])(this.props.settings.styles, function (_ref) { var css = _ref.css, baseURL = _ref.baseURL; var transforms = [transforms_wrap('.editor-styles-wrapper')]; if (baseURL) { transforms.push(url_rewrite(baseURL)); } var updatedCSS = editor_styles_traverse(css, Object(external_this_wp_compose_["compose"])(transforms)); if (updatedCSS) { var node = document.createElement('style'); node.innerHTML = updatedCSS; document.body.appendChild(node); } }); } }, { key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { if (this.props.settings !== prevProps.settings) { this.props.updateEditorSettings(this.props.settings); } } }, { key: "render", value: function render() { var children = this.props.children; var providers = [// Slot / Fill provider: // // - context.getSlot // - context.registerSlot // - context.unregisterSlot [external_this_wp_components_["SlotFillProvider"]], // DropZone provider: [external_this_wp_components_["DropZoneProvider"]]]; var createEditorElement = Object(external_lodash_["flow"])(providers.map(function (_ref2) { var _ref3 = Object(slicedToArray["a" /* default */])(_ref2, 2), Provider = _ref3[0], props = _ref3[1]; return function (arg) { return Object(external_this_wp_element_["createElement"])(Provider, props, arg); }; })); return createEditorElement(children); } }]); return EditorProvider; }(external_this_wp_element_["Component"]); /* harmony default export */ var provider = (Object(external_this_wp_data_["withDispatch"])(function (dispatch) { var _dispatch = dispatch('core/editor'), setupEditor = _dispatch.setupEditor, updateEditorSettings = _dispatch.updateEditorSettings, updatePostLock = _dispatch.updatePostLock; var _dispatch2 = dispatch('core/notices'), createWarningNotice = _dispatch2.createWarningNotice; return { setupEditor: setupEditor, updateEditorSettings: updateEditorSettings, updatePostLock: updatePostLock, createWarningNotice: createWarningNotice }; })(provider_EditorProvider)); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/index.js // Block Creation Components // Post Related Components // Content Related Components // State Related Components // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/align.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * An array which includes all possible valid alignments, * used to validate if an alignment is valid or not. * * @constant * @type {string[]} */ var ALL_ALIGNMENTS = ['left', 'center', 'right', 'wide', 'full']; /** * An array which includes all wide alignments. * In order for this alignments to be valid they need to be supported by the block, * and by the theme. * * @constant * @type {string[]} */ var WIDE_ALIGNMENTS = ['wide', 'full']; /** * Returns the valid alignments. * Takes into consideration the aligns supported by a block, if the block supports wide controls or not and if theme supports wide controls or not. * Exported just for testing purposes, not exported outside the module. * * @param {?boolean|string[]} blockAlign Aligns supported by the block. * @param {?boolean} hasWideBlockSupport True if block supports wide alignments. And False otherwise. * @param {?boolean} hasWideEnabled True if theme supports wide alignments. And False otherwise. * * @return {string[]} Valid alignments. */ function getValidAlignments(blockAlign) { var hasWideBlockSupport = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; var hasWideEnabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; var validAlignments; if (Array.isArray(blockAlign)) { validAlignments = blockAlign; } else if (blockAlign === true) { // `true` includes all alignments... validAlignments = ALL_ALIGNMENTS; } else { validAlignments = []; } if (!hasWideEnabled || blockAlign === true && !hasWideBlockSupport) { return external_lodash_["without"].apply(void 0, [validAlignments].concat(WIDE_ALIGNMENTS)); } return validAlignments; } /** * Filters registered block settings, extending attributes to include `align`. * * @param {Object} settings Original block settings * @return {Object} Filtered block settings */ function addAttribute(settings) { // allow blocks to specify their own attribute definition with default values if needed. if (Object(external_lodash_["has"])(settings.attributes, ['align', 'type'])) { return settings; } if (Object(external_this_wp_blocks_["hasBlockSupport"])(settings, 'align')) { // Use Lodash's assign to gracefully handle if attributes are undefined settings.attributes = Object(external_lodash_["assign"])(settings.attributes, { align: { type: 'string' } }); } return settings; } /** * Override the default edit UI to include new toolbar controls for block * alignment, if block defines support. * * @param {Function} BlockEdit Original component * @return {Function} Wrapped component */ var withToolbarControls = Object(external_this_wp_compose_["createHigherOrderComponent"])(function (BlockEdit) { return function (props) { var blockName = props.name; // Compute valid alignments without taking into account, // if the theme supports wide alignments or not. // BlockAlignmentToolbar takes into account the theme support. var validAlignments = getValidAlignments(Object(external_this_wp_blocks_["getBlockSupport"])(blockName, 'align'), Object(external_this_wp_blocks_["hasBlockSupport"])(blockName, 'alignWide', true)); var updateAlignment = function updateAlignment(nextAlign) { if (!nextAlign) { var blockType = Object(external_this_wp_blocks_["getBlockType"])(props.name); var blockDefaultAlign = Object(external_lodash_["get"])(blockType, ['attributes', 'align', 'default']); if (blockDefaultAlign) { nextAlign = ''; } } props.setAttributes({ align: nextAlign }); }; return [validAlignments.length > 0 && props.isSelected && Object(external_this_wp_element_["createElement"])(block_controls, { key: "align-controls" }, Object(external_this_wp_element_["createElement"])(block_alignment_toolbar, { value: props.attributes.align, onChange: updateAlignment, controls: validAlignments })), Object(external_this_wp_element_["createElement"])(BlockEdit, Object(esm_extends["a" /* default */])({ key: "edit" }, props))]; }; }, 'withToolbarControls'); // Exported just for testing purposes, not exported outside the module. var align_insideSelectWithDataAlign = function insideSelectWithDataAlign(BlockListBlock) { return function (props) { var name = props.name, attributes = props.attributes, hasWideEnabled = props.hasWideEnabled; var align = attributes.align; var validAlignments = getValidAlignments(Object(external_this_wp_blocks_["getBlockSupport"])(name, 'align'), Object(external_this_wp_blocks_["hasBlockSupport"])(name, 'alignWide', true), hasWideEnabled); var wrapperProps = props.wrapperProps; if (Object(external_lodash_["includes"])(validAlignments, align)) { wrapperProps = Object(objectSpread["a" /* default */])({}, wrapperProps, { 'data-align': align }); } return Object(external_this_wp_element_["createElement"])(BlockListBlock, Object(esm_extends["a" /* default */])({}, props, { wrapperProps: wrapperProps })); }; }; /** * Override the default block element to add alignment wrapper props. * * @param {Function} BlockListBlock Original component * @return {Function} Wrapped component */ var withDataAlign = Object(external_this_wp_compose_["createHigherOrderComponent"])(Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) { var _select = select('core/editor'), getEditorSettings = _select.getEditorSettings; return { hasWideEnabled: !!getEditorSettings().alignWide }; }), align_insideSelectWithDataAlign])); /** * Override props assigned to save component to inject alignment class name if * block supports it. * * @param {Object} props Additional props applied to save element * @param {Object} blockType Block type * @param {Object} attributes Block attributes * @return {Object} Filtered props applied to save element */ function addAssignedAlign(props, blockType, attributes) { var align = attributes.align; var blockAlign = Object(external_this_wp_blocks_["getBlockSupport"])(blockType, 'align'); var hasWideBlockSupport = Object(external_this_wp_blocks_["hasBlockSupport"])(blockType, 'alignWide', true); var isAlignValid = Object(external_lodash_["includes"])( // Compute valid alignments without taking into account, // if the theme supports wide alignments or not. // This way changing themes does not impacts the block save. getValidAlignments(blockAlign, hasWideBlockSupport), align); if (isAlignValid) { props.className = classnames_default()("align".concat(align), props.className); } return props; } Object(external_this_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/align/addAttribute', addAttribute); Object(external_this_wp_hooks_["addFilter"])('editor.BlockListBlock', 'core/editor/align/with-data-align', withDataAlign); Object(external_this_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/editor/align/with-toolbar-controls', withToolbarControls); Object(external_this_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/align/addAssignedAlign', addAssignedAlign); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/anchor.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Regular expression matching invalid anchor characters for replacement. * * @type {RegExp} */ var ANCHOR_REGEX = /[\s#]/g; /** * Filters registered block settings, extending attributes with anchor using ID * of the first node. * * @param {Object} settings Original block settings. * * @return {Object} Filtered block settings. */ function anchor_addAttribute(settings) { if (Object(external_this_wp_blocks_["hasBlockSupport"])(settings, 'anchor')) { // Use Lodash's assign to gracefully handle if attributes are undefined settings.attributes = Object(external_lodash_["assign"])(settings.attributes, { anchor: { type: 'string', source: 'attribute', attribute: 'id', selector: '*' } }); } return settings; } /** * Override the default edit UI to include a new block inspector control for * assigning the anchor ID, if block supports anchor. * * @param {function|Component} BlockEdit Original component. * * @return {string} Wrapped component. */ var withInspectorControl = Object(external_this_wp_compose_["createHigherOrderComponent"])(function (BlockEdit) { return function (props) { var hasAnchor = Object(external_this_wp_blocks_["hasBlockSupport"])(props.name, 'anchor'); if (hasAnchor && props.isSelected) { return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(BlockEdit, props), Object(external_this_wp_element_["createElement"])(inspector_advanced_controls, null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TextControl"], { label: Object(external_this_wp_i18n_["__"])('HTML Anchor'), help: Object(external_this_wp_i18n_["__"])('Anchors lets you link directly to a section on a page.'), value: props.attributes.anchor || '', onChange: function onChange(nextValue) { nextValue = nextValue.replace(ANCHOR_REGEX, '-'); props.setAttributes({ anchor: nextValue }); } }))); } return Object(external_this_wp_element_["createElement"])(BlockEdit, props); }; }, 'withInspectorControl'); /** * Override props assigned to save component to inject anchor ID, if block * supports anchor. This is only applied if the block's save result is an * element and not a markup string. * * @param {Object} extraProps Additional props applied to save element. * @param {Object} blockType Block type. * @param {Object} attributes Current block attributes. * * @return {Object} Filtered props applied to save element. */ function addSaveProps(extraProps, blockType, attributes) { if (Object(external_this_wp_blocks_["hasBlockSupport"])(blockType, 'anchor')) { extraProps.id = attributes.anchor === '' ? null : attributes.anchor; } return extraProps; } Object(external_this_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/anchor/attribute', anchor_addAttribute); Object(external_this_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/editor/anchor/with-inspector-control', withInspectorControl); Object(external_this_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/anchor/save-props', addSaveProps); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/custom-class-name.js /** * External dependencies */ /** * WordPress dependencies */ /** * Internal dependencies */ /** * Filters registered block settings, extending attributes with anchor using ID * of the first node. * * @param {Object} settings Original block settings. * * @return {Object} Filtered block settings. */ function custom_class_name_addAttribute(settings) { if (Object(external_this_wp_blocks_["hasBlockSupport"])(settings, 'customClassName', true)) { // Use Lodash's assign to gracefully handle if attributes are undefined settings.attributes = Object(external_lodash_["assign"])(settings.attributes, { className: { type: 'string' } }); } return settings; } /** * Override the default edit UI to include a new block inspector control for * assigning the custom class name, if block supports custom class name. * * @param {function|Component} BlockEdit Original component. * * @return {string} Wrapped component. */ var custom_class_name_withInspectorControl = Object(external_this_wp_compose_["createHigherOrderComponent"])(function (BlockEdit) { return function (props) { var hasCustomClassName = Object(external_this_wp_blocks_["hasBlockSupport"])(props.name, 'customClassName', true); if (hasCustomClassName && props.isSelected) { return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(BlockEdit, props), Object(external_this_wp_element_["createElement"])(inspector_advanced_controls, null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TextControl"], { label: Object(external_this_wp_i18n_["__"])('Additional CSS Class'), value: props.attributes.className || '', onChange: function onChange(nextValue) { props.setAttributes({ className: nextValue }); } }))); } return Object(external_this_wp_element_["createElement"])(BlockEdit, props); }; }, 'withInspectorControl'); /** * Override props assigned to save component to inject anchor ID, if block * supports anchor. This is only applied if the block's save result is an * element and not a markup string. * * @param {Object} extraProps Additional props applied to save element. * @param {Object} blockType Block type. * @param {Object} attributes Current block attributes. * * @return {Object} Filtered props applied to save element. */ function custom_class_name_addSaveProps(extraProps, blockType, attributes) { if (Object(external_this_wp_blocks_["hasBlockSupport"])(blockType, 'customClassName', true) && attributes.className) { extraProps.className = classnames_default()(extraProps.className, attributes.className); } return extraProps; } /** * Given an HTML string, returns an array of class names assigned to the root * element in the markup. * * @param {string} innerHTML Markup string from which to extract classes. * * @return {string[]} Array of class names assigned to the root element. */ function getHTMLRootElementClasses(innerHTML) { innerHTML = "<div data-custom-class-name>".concat(innerHTML, "</div>"); var parsed = Object(external_this_wp_blocks_["parseWithAttributeSchema"])(innerHTML, { type: 'string', source: 'attribute', selector: '[data-custom-class-name] > *', attribute: 'class' }); return parsed ? parsed.trim().split(/\s+/) : []; } /** * Given a parsed set of block attributes, if the block supports custom class * names and an unknown class (per the block's serialization behavior) is * found, the unknown classes are treated as custom classes. This prevents the * block from being considered as invalid. * * @param {Object} blockAttributes Original block attributes. * @param {Object} blockType Block type settings. * @param {string} innerHTML Original block markup. * * @return {Object} Filtered block attributes. */ function addParsedDifference(blockAttributes, blockType, innerHTML) { if (Object(external_this_wp_blocks_["hasBlockSupport"])(blockType, 'customClassName', true)) { // To determine difference, serialize block given the known set of // attributes, with the exception of `className`. This will determine // the default set of classes. From there, any difference in innerHTML // can be considered as custom classes. var attributesSansClassName = Object(external_lodash_["omit"])(blockAttributes, ['className']); var serialized = Object(external_this_wp_blocks_["getSaveContent"])(blockType, attributesSansClassName); var defaultClasses = getHTMLRootElementClasses(serialized); var actualClasses = getHTMLRootElementClasses(innerHTML); var customClasses = Object(external_lodash_["difference"])(actualClasses, defaultClasses); if (customClasses.length) { blockAttributes.className = customClasses.join(' '); } else if (serialized) { delete blockAttributes.className; } } return blockAttributes; } Object(external_this_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/custom-class-name/attribute', custom_class_name_addAttribute); Object(external_this_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/editor/custom-class-name/with-inspector-control', custom_class_name_withInspectorControl); Object(external_this_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/custom-class-name/save-props', custom_class_name_addSaveProps); Object(external_this_wp_hooks_["addFilter"])('blocks.getBlockAttributes', 'core/custom-class-name/addParsedDifference', addParsedDifference); // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/default-autocompleters.js /** * External dependencies */ /** * WordPress dependencies */ /** * 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/generated-class-name.js /** * External dependencies */ /** * WordPress dependencies */ /** * Override props assigned to save component to inject generated className if * block supports it. This is only applied if the block's save result is an * element and not a markup string. * * @param {Object} extraProps Additional props applied to save element. * @param {Object} blockType Block type. * * @return {Object} Filtered props applied to save element. */ function addGeneratedClassName(extraProps, blockType) { // Adding the generated className if (Object(external_this_wp_blocks_["hasBlockSupport"])(blockType, 'className', true)) { if (typeof extraProps.className === 'string') { // We have some extra classes and want to add the default classname // We use uniq to prevent duplicate classnames extraProps.className = Object(external_lodash_["uniq"])([Object(external_this_wp_blocks_["getBlockDefaultClassName"])(blockType.name)].concat(Object(toConsumableArray["a" /* default */])(extraProps.className.split(' ')))).join(' ').trim(); } else { // There is no string in the className variable, // so we just dump the default name in there extraProps.className = Object(external_this_wp_blocks_["getBlockDefaultClassName"])(blockType.name); } } return extraProps; } Object(external_this_wp_hooks_["addFilter"])('blocks.getSaveContent.extraProps', 'core/generated-class-name/save-props', addGeneratedClassName); // 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 Autocomplete */__webpack_require__.d(__webpack_exports__, "Autocomplete", function() { return autocomplete; }); /* concated harmony reexport AlignmentToolbar */__webpack_require__.d(__webpack_exports__, "AlignmentToolbar", function() { return alignment_toolbar; }); /* concated harmony reexport BlockAlignmentToolbar */__webpack_require__.d(__webpack_exports__, "BlockAlignmentToolbar", function() { return block_alignment_toolbar; }); /* concated harmony reexport BlockControls */__webpack_require__.d(__webpack_exports__, "BlockControls", function() { return block_controls; }); /* concated harmony reexport BlockEdit */__webpack_require__.d(__webpack_exports__, "BlockEdit", function() { return block_edit; }); /* concated harmony reexport BlockFormatControls */__webpack_require__.d(__webpack_exports__, "BlockFormatControls", function() { return block_format_controls; }); /* concated harmony reexport BlockNavigationDropdown */__webpack_require__.d(__webpack_exports__, "BlockNavigationDropdown", function() { return dropdown; }); /* concated harmony reexport BlockIcon */__webpack_require__.d(__webpack_exports__, "BlockIcon", function() { return BlockIcon; }); /* concated harmony reexport ColorPalette */__webpack_require__.d(__webpack_exports__, "ColorPalette", function() { return color_palette; }); /* concated harmony reexport withColorContext */__webpack_require__.d(__webpack_exports__, "withColorContext", function() { return with_color_context; }); /* concated harmony reexport ContrastChecker */__webpack_require__.d(__webpack_exports__, "ContrastChecker", function() { return contrast_checker; }); /* concated harmony reexport InnerBlocks */__webpack_require__.d(__webpack_exports__, "InnerBlocks", function() { return inner_blocks; }); /* concated harmony reexport InspectorAdvancedControls */__webpack_require__.d(__webpack_exports__, "InspectorAdvancedControls", function() { return inspector_advanced_controls; }); /* concated harmony reexport InspectorControls */__webpack_require__.d(__webpack_exports__, "InspectorControls", function() { return inspector_controls; }); /* concated harmony reexport PanelColorSettings */__webpack_require__.d(__webpack_exports__, "PanelColorSettings", function() { return panel_color_settings; }); /* concated harmony reexport PlainText */__webpack_require__.d(__webpack_exports__, "PlainText", function() { return plain_text; }); /* concated harmony reexport RichText */__webpack_require__.d(__webpack_exports__, "RichText", function() { return rich_text; }); /* concated harmony reexport RichTextShortcut */__webpack_require__.d(__webpack_exports__, "RichTextShortcut", function() { return shortcut_RichTextShortcut; }); /* concated harmony reexport RichTextToolbarButton */__webpack_require__.d(__webpack_exports__, "RichTextToolbarButton", function() { return RichTextToolbarButton; }); /* concated harmony reexport RichTextInserterItem */__webpack_require__.d(__webpack_exports__, "RichTextInserterItem", function() { return RichTextInserterItem; }); /* concated harmony reexport ServerSideRender */__webpack_require__.d(__webpack_exports__, "ServerSideRender", function() { return server_side_render; }); /* concated harmony reexport MediaPlaceholder */__webpack_require__.d(__webpack_exports__, "MediaPlaceholder", function() { return media_placeholder; }); /* concated harmony reexport MediaUpload */__webpack_require__.d(__webpack_exports__, "MediaUpload", function() { return media_upload; }); /* concated harmony reexport MediaUploadCheck */__webpack_require__.d(__webpack_exports__, "MediaUploadCheck", function() { return check; }); /* concated harmony reexport URLInput */__webpack_require__.d(__webpack_exports__, "URLInput", function() { return url_input; }); /* concated harmony reexport URLInputButton */__webpack_require__.d(__webpack_exports__, "URLInputButton", function() { return url_input_button; }); /* concated harmony reexport URLPopover */__webpack_require__.d(__webpack_exports__, "URLPopover", function() { return url_popover; }); /* 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 document_outline_check; }); /* concated harmony reexport EditorGlobalKeyboardShortcuts */__webpack_require__.d(__webpack_exports__, "EditorGlobalKeyboardShortcuts", function() { return editor_global_keyboard_shortcuts; }); /* 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 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 BlockInspector */__webpack_require__.d(__webpack_exports__, "BlockInspector", function() { return block_inspector; }); /* concated harmony reexport BlockList */__webpack_require__.d(__webpack_exports__, "BlockList", function() { return block_list; }); /* concated harmony reexport BlockMover */__webpack_require__.d(__webpack_exports__, "BlockMover", function() { return block_mover; }); /* concated harmony reexport BlockSelectionClearer */__webpack_require__.d(__webpack_exports__, "BlockSelectionClearer", function() { return block_selection_clearer; }); /* concated harmony reexport BlockSettingsMenu */__webpack_require__.d(__webpack_exports__, "BlockSettingsMenu", function() { return block_settings_menu; }); /* concated harmony reexport _BlockSettingsMenuFirstItem */__webpack_require__.d(__webpack_exports__, "_BlockSettingsMenuFirstItem", function() { return block_settings_menu_first_item; }); /* concated harmony reexport _BlockSettingsMenuPluginsExtension */__webpack_require__.d(__webpack_exports__, "_BlockSettingsMenuPluginsExtension", function() { return block_settings_menu_plugins_extension; }); /* concated harmony reexport BlockTitle */__webpack_require__.d(__webpack_exports__, "BlockTitle", function() { return block_title; }); /* concated harmony reexport BlockToolbar */__webpack_require__.d(__webpack_exports__, "BlockToolbar", function() { return block_toolbar; }); /* concated harmony reexport CopyHandler */__webpack_require__.d(__webpack_exports__, "CopyHandler", function() { return copy_handler; }); /* concated harmony reexport DefaultBlockAppender */__webpack_require__.d(__webpack_exports__, "DefaultBlockAppender", function() { return default_block_appender; }); /* concated harmony reexport ErrorBoundary */__webpack_require__.d(__webpack_exports__, "ErrorBoundary", function() { return error_boundary; }); /* concated harmony reexport Inserter */__webpack_require__.d(__webpack_exports__, "Inserter", function() { return inserter; }); /* concated harmony reexport MultiBlocksSwitcher */__webpack_require__.d(__webpack_exports__, "MultiBlocksSwitcher", function() { return multi_blocks_switcher; }); /* concated harmony reexport MultiSelectScrollIntoView */__webpack_require__.d(__webpack_exports__, "MultiSelectScrollIntoView", function() { return multi_select_scroll_into_view; }); /* concated harmony reexport NavigableToolbar */__webpack_require__.d(__webpack_exports__, "NavigableToolbar", function() { return navigable_toolbar; }); /* concated harmony reexport ObserveTyping */__webpack_require__.d(__webpack_exports__, "ObserveTyping", function() { return observe_typing; }); /* concated harmony reexport PreserveScrollInReorder */__webpack_require__.d(__webpack_exports__, "PreserveScrollInReorder", function() { return preserve_scroll_in_reorder; }); /* concated harmony reexport SkipToSelectedBlock */__webpack_require__.d(__webpack_exports__, "SkipToSelectedBlock", function() { return skip_to_selected_block; }); /* concated harmony reexport Warning */__webpack_require__.d(__webpack_exports__, "Warning", function() { return warning; }); /* concated harmony reexport WritingFlow */__webpack_require__.d(__webpack_exports__, "WritingFlow", function() { return writing_flow; }); /* 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 getColorClassName */__webpack_require__.d(__webpack_exports__, "getColorClassName", function() { return getColorClassName; }); /* concated harmony reexport getColorObjectByAttributeValues */__webpack_require__.d(__webpack_exports__, "getColorObjectByAttributeValues", function() { return utils_getColorObjectByAttributeValues; }); /* concated harmony reexport getColorObjectByColorValue */__webpack_require__.d(__webpack_exports__, "getColorObjectByColorValue", function() { return utils_getColorObjectByColorValue; }); /* concated harmony reexport withColors */__webpack_require__.d(__webpack_exports__, "withColors", function() { return with_colors; }); /* concated harmony reexport getFontSize */__webpack_require__.d(__webpack_exports__, "getFontSize", function() { return utils_getFontSize; }); /* concated harmony reexport getFontSizeClass */__webpack_require__.d(__webpack_exports__, "getFontSizeClass", function() { return getFontSizeClass; }); /* concated harmony reexport FontSizePicker */__webpack_require__.d(__webpack_exports__, "FontSizePicker", function() { return font_size_picker; }); /* concated harmony reexport withFontSizes */__webpack_require__.d(__webpack_exports__, "withFontSizes", function() { return with_font_sizes; }); /* concated harmony reexport mediaUpload */__webpack_require__.d(__webpack_exports__, "mediaUpload", function() { return utils_media_upload; }); /* concated harmony reexport cleanForSlug */__webpack_require__.d(__webpack_exports__, "cleanForSlug", function() { return cleanForSlug; }); /** * WordPress dependencies */ /** * Internal dependencies */ /***/ }) /******/ ]);